blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
8dcbcc9a27c99ec8891b8c057b65f11a20d5cfc1
668584d63f6ed8f48c8609c3a142f8bdf1ba1a40
/prj/coherence-core/src/main/java/com/tangosol/dev/compiler/java/CaseClause.java
8c30713b0c545dd8b953621fed052021521733f3
[ "EPL-1.0", "Classpath-exception-2.0", "LicenseRef-scancode-unicode", "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-protobuf", "CDDL-1.1", "W3C", "APSL-1.0", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-public-domain", "SAX-PD", "MPL-2.0", "MPL-1.1", "CC-PDDC", "BSD-2-Clause", "Plexus", "EPL-2.0", "CDDL-1.0", "LicenseRef-scancode-proprietary-license", "MIT", "CC0-1.0", "APSL-2.0", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-only", "LGPL-2.1-or-later", "UPL-1.0" ]
permissive
oracle/coherence
34c48d36674e69974a693925c18f097175052c5f
b1a009a406e37fdc5479366035d8c459165324e1
refs/heads/main
2023-08-31T14:53:40.437690
2023-08-31T02:04:15
2023-08-31T02:04:15
242,776,849
416
96
UPL-1.0
2023-08-07T04:27:39
2020-02-24T15:51:04
Java
UTF-8
Java
false
false
4,855
java
/* * Copyright (c) 2000, 2020, Oracle and/or its affiliates. * * Licensed under the Universal Permissive License v 1.0 as shown at * http://oss.oracle.com/licenses/upl. */ package com.tangosol.dev.compiler.java; import com.tangosol.dev.assembler.CodeAttribute; import com.tangosol.dev.compiler.CompilerException; import com.tangosol.dev.compiler.Context; import com.tangosol.dev.component.DataType; import com.tangosol.util.ErrorList; import java.util.Set; import java.util.Map; /** * This class implements the "case <constant-value> :" clause of a switch * statement. * * SwitchLabel: * case ConstantExpression : * default : * * @version 1.00, 09/21/98 * @author Cameron Purdy */ public class CaseClause extends TargetStatement { // ----- construction --------------------------------------------------- /** * Construct a case clause. * * @param stmt the statement within which this element exists * @param token the "case" token */ public CaseClause(Statement stmt, Token token) { super(stmt, token); } // ----- code generation ------------------------------------------------ /** * Perform semantic checks, parse tree re-organization, name binding, * and optimizations. * * @param ctx the compiler context * @param setUVars the set of potentially unassigned variables * @param setFVars the set of potentially assigned final variables * @param mapThrown the set of potentially thrown checked exceptions * @param errlist the error list * * @exception CompilerException thrown if an error occurs that should * stop the compilation process */ protected Element precompile(Context ctx, DualSet setUVars, DualSet setFVars, Map mapThrown, ErrorList errlist) throws CompilerException { Expression expr = getTest(); // pre-compile the test expr = (Expression) expr.precompile(ctx, setUVars, setFVars, mapThrown, errlist); // the test must be constant if (expr.checkConstant(errlist)) { // the test must match (be assignable to) the type of the switch if (expr.checkIntegral(errlist)) { DataType dt = ((SwitchStatement) getOuterStatement()).getTest().getType(); if (expr.checkAssignable(ctx, dt, errlist)) { expr = expr.convertAssignable(ctx, DataType.INT); } } } // store the test setTest(expr); // this will require a label getStartLabel(); return this; } /** * Perform final optimizations and code generation. * * @param ctx the compiler context * @param code the assembler code attribute to compile to * @param fReached true if this language element is reached (JLS 14.19) * @param errlist the error list to log errors to * * @return true if the element can complete normally (JLS 14.1) * * @exception CompilerException thrown if an error occurs that should * stop the compilation process */ protected boolean compileImpl(Context ctx, CodeAttribute code, boolean fReached, ErrorList errlist) throws CompilerException { return true; } // ----- accessors ------------------------------------------------------ /** * Get the test expression. * * @return the test expression */ public Expression getTest() { return test; } /** * Set the test expression. * * @param test the test expression */ protected void setTest(Expression test) { this.test = test; } /** * Determine if the test expression has a constant value. * * @return true if the test expression results in a constant value */ public boolean isConstant() { return test.isConstant(); } /** * Get the case value. * * @return the int case value */ protected int getValue() { return ((Number) getTest().getValue()).intValue(); } // ----- Element methods ------------------------------------------------ /** * Print the element information. * * @param sIndent */ public void print(String sIndent) { out(sIndent + toString()); out(sIndent + " Value:"); test.print(sIndent + " "); } // ----- data members --------------------------------------------------- /** * The class name. */ private static final String CLASS = "CaseClause"; /** * The conditional expression. */ private Expression test; }
[ "a@b" ]
a@b
cfe23568ca6d6c310746aeefef49908714169155
b892831c64f72e7519752b92d2dde468755c278a
/ajax/src/main/java/com/kaishengit/web/DictionaryServlet.java
336533ba4207db6dbaec9b2785c850ecc4a75796
[]
no_license
lizhenqi/MyJava
c2586fe3c695c7c1d98bb8894fc540bb80afc1b0
3786a82152c4230e5b0980b32f6d4f0783149615
refs/heads/master
2021-01-19T04:20:13.600927
2016-07-20T03:38:49
2016-07-20T03:38:49
60,684,848
0
0
null
null
null
null
UTF-8
Java
false
false
1,083
java
package com.kaishengit.web; import com.kaishengit.util.HttpUtil; import com.kaishengit.util.HttpUtil; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; /** * Created by Administrator on 2016/6/21. */ @WebServlet("/dict") public class DictionaryServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String word=req.getParameter("q"); word=new String(word.getBytes("ISO8859-1"),"utf-8"); String url="http://fanyi.youdao.com/openapi.do?keyfrom=kaishengit&key=1587754017&type=data&doctype=xml&version=1.1&q="+word; String xml= HttpUtil.getRequestText(url); resp.setContentType("text/xml;charset=utf-8"); PrintWriter out=resp.getWriter(); out.print(xml); out.flush(); out.close(); }}
a4feb646d236795b6035904e4ea9b28bd6044e9c
0a45c48d057a004b7da215d589132fdb2160b2d5
/src/QUANLICUAHANGXEMAYDAL/UserDAL.java
a12723b5e65b15bce6bd5e816b7b39673a8137ec
[]
no_license
campha10x/QUANLICUAHANGXEMAY_JAVA
30a7fb8631f6db07d713ebb188b3c9227b606bf2
6a219ec88650d73e4aa020965d62f0ee9aedddff
refs/heads/master
2021-01-12T03:12:58.698086
2017-01-06T05:04:04
2017-01-06T05:04:04
78,175,447
0
1
null
null
null
null
UTF-8
Java
false
false
6,097
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 QUANLICUAHANGXEMAYDAL; import QUANLICUAHANGXEMAYEntity.User; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author duy */ public class UserDAL extends DataAccessHelper { private final String GET_LOGIN = "SELECT * FROM Users where [User]=? and MatKhauMoi=?"; private final String GET_MANV = "SELECT MaUser FROM Users where [User]=? "; private final String UPDATE_Password = "UPDATE dbo.Users SET [MatKhauMoi] = ? " + " WHERE [User] = ?"; private String GET_ALL = "SELECT * FROM dbo.Users"; private final String ADD_DATA = "INSERT INTO dbo.Users([User], MaNhanVien, MatKhauMoi, Quyen)" + "VALUES (?,?,?,?)"; private final String UPDATE = "UPDATE dbo.Users SET [MaNhanVien] = ? ,[MatKhauMoi] = ? ,[Quyen] = ? " + " WHERE [User] = ?"; public ArrayList<User> getALL(String TOP, String WHERE, String ORDER) { ArrayList<User> objs = new ArrayList<>(); if (TOP.length() != 0 || WHERE.length() != 0 || ORDER.length() != 0) { GET_ALL = "SELECT "; if (TOP.length() != 0) { GET_ALL += "TOP " + TOP; } GET_ALL += "* FROM Users "; if (WHERE.length() != 0) { GET_ALL += "WHERE " + WHERE; } if (ORDER.length() != 0) { GET_ALL += "ORDER BY" + ORDER; } } try { getConnect(); PreparedStatement ps = conn.prepareStatement(GET_ALL); ResultSet rs = ps.executeQuery(); if (rs != null) { while (rs.next()) { User nv = new User(); nv.setUser(rs.getString("User")); nv.setMaNhanVien(rs.getString("MaNhanVien")); nv.setMatKhauMoi(rs.getString("MatKhauMoi")); nv.setQuyen(rs.getString("Quyen")); objs.add(nv); } getClose(); } } catch (SQLException ex) { Logger.getLogger(UserDAL.class.getName()).log(Level.SEVERE, null, ex); } GET_ALL = "SELECT * FROM dbo.Users"; return objs; } // private final String ADD_DATA = "INSERT INTO dbo.Users(User, MaNhanVien, MatKhauMoi, Quyen" // + "VALUES (?,?,?,?)"; public boolean AddData(User nv) { boolean check = false; try { getConnect(); PreparedStatement ps = conn.prepareStatement(ADD_DATA); ps.setString(1, nv.getUser()); ps.setString(2, nv.getMaNhanVien()); ps.setString(3, nv.getMatKhauMoi()); ps.setString(4, nv.getQuyen()); int rs = ps.executeUpdate(); if (rs > 0) { check = true; } getClose(); } catch (Exception e) { } return check; } public boolean updateData(User nv) { boolean check = false; try { getConnect(); PreparedStatement ps = conn.prepareCall(UPDATE); //"UPDATE dbo.User SET [DienThoai] = ? ,[TenUser] = ? ,[NgaySinh] = ? ,[GioiTinh] = ?,[DiaChi]=?, [Chucvu]=?,[LuongCoBan]=?,[Ngayvaolam]=?,[Luong]=?" // + "WHERE [MaUser] = ?"; ps.setString(1, nv.getMaNhanVien()); ps.setString(2, nv.getMatKhauMoi()); ps.setString(3, nv.getQuyen()); ps.setString(4, nv.getUser()); int rs = ps.executeUpdate(); if (rs > 0) { check = true; } getClose(); } catch (Exception e) { e.printStackTrace(); } return check; } public boolean getLogin(String u, String p) { boolean check = false; try { getConnect(); PreparedStatement ps = conn.prepareStatement(GET_LOGIN); ps.setString(1, u); ps.setString(2, p); ResultSet rs = ps.executeQuery(); if (rs != null && rs.next()) { check = true; } getClose(); } catch (Exception e) { e.printStackTrace(); } return check; } public boolean update_Password(User nv) { boolean check = false; try { getConnect(); PreparedStatement ps = conn.prepareCall(UPDATE_Password); //UPDATE = "UPDATE dbo.Users SET [NgayNhap] = ? ,[MaUser] = ? ,[MaNhaCungCap] = ? " // + " WHERE [MaPN] = ?"; ps.setString(1, nv.getMatKhauMoi()); ps.setString(2, nv.getUser()); int rs = ps.executeUpdate(); if (rs > 0) { check = true; } getClose(); } catch (Exception e) { e.printStackTrace(); } return check; } public String Get_MaNhanVien(String Users) throws SQLException { String MaNV = ""; Statement stmt = null; getConnect(); String query = "SELECT MaNhanVien FROM Users where [User]='" + Users + "' "; stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(query); while (rs.next()) { MaNV = rs.getString("MaNhanVien"); } return MaNV; } public String Get_Quyen(String Users) throws SQLException { String Quyen = ""; Statement stmt = null; getConnect(); String query = "SELECT Quyen FROM Users where [User]='" + Users + "' "; stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(query); while (rs.next()) { Quyen = rs.getString("Quyen"); } return Quyen; } }
903ca9b55492e8ac3e5ce4972a32cf2550843296
6f20ff6de3115b21b3730fc5f24570ba40d33d51
/OfertaPaquete11-EJB/ejbModule/com/ofertaPaq/integraciones/OfertasProductor.java
4bea9c09b66dc7eb57cb17cba3bb2e1ee865acd8
[]
no_license
JonyMedina/OfertaPaquete11
885f30f367a76106a91891ec64b07636036b8723
28feeb1b2a8270c23ab3b80d1b85d74eccbacb50
refs/heads/master
2020-03-19T16:04:52.344938
2018-06-16T03:19:15
2018-06-16T03:19:15
136,699,553
0
0
null
null
null
null
WINDOWS-1250
Java
false
false
4,390
java
package com.ofertaPaq.integraciones; import java.util.Properties; import javax.ejb.LocalBean; import javax.ejb.Stateless; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Destination; import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.Context; import javax.naming.InitialContext; @Stateless @LocalBean public class OfertasProductor { public void sendMessage1(String messageText) { Context context; try { final Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); env.put(Context.PROVIDER_URL, System.getProperty(Context.PROVIDER_URL, "http-remoting://192.168.1.81:8080")); env.put(Context.SECURITY_PRINCIPAL, System.getProperty("username", "paquete")); env.put(Context.SECURITY_CREDENTIALS, System.getProperty("password", "paquete")); context = new InitialContext(env); // Perform the JNDI lookups String connectionFactoryString = System.getProperty("connection.factory", "jms/RemoteConnectionFactory"); ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup(connectionFactoryString); String destinationString = System.getProperty("destination", "jms/queue/ofertapaquete"); Destination destination = (Destination) context.lookup(destinationString); // Create the JMS connection, session, producer, and consumer Connection connection = connectionFactory.createConnection(System.getProperty("username", "paquete"), System.getProperty("password", "paquete")); Session session = ((javax.jms.Connection) connection).createSession(false, Session.AUTO_ACKNOWLEDGE); // consumer = session.createConsumer(destination); connection.start(); // crear un producer para enviar mensajes usando la session MessageProducer producer = session.createProducer((Destination) destination); // crear un mensaje de tipo text y setearle el contenido TextMessage message = session.createTextMessage(); message.setText(messageText); // enviar el mensaje producer.send(message); // TODO: recordar cerrar la session y la connection en un bloque “finally” connection.close(); } catch (Exception e) { // TODO Auto-generated catch block System.out.println("Mensaje enviado 1"); } } public void sendMessage2(String messageText) { Context context; try { final Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); env.put(Context.PROVIDER_URL, System.getProperty(Context.PROVIDER_URL, "http-remoting://192.168.1.69:8080")); env.put(Context.SECURITY_PRINCIPAL, System.getProperty("username", "paquete")); env.put(Context.SECURITY_CREDENTIALS, System.getProperty("password", "paquete")); context = new InitialContext(env); // Perform the JNDI lookups String connectionFactoryString = System.getProperty("connection.factory", "jms/RemoteConnectionFactory"); ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup(connectionFactoryString); String destinationString = System.getProperty("destination", "jms/queue/ofertapaquete"); Destination destination = (Destination) context.lookup(destinationString); // Create the JMS connection, session, producer, and consumer Connection connection = connectionFactory.createConnection(System.getProperty("username", "paquete"), System.getProperty("password", "paquete")); Session session = ((javax.jms.Connection) connection).createSession(false, Session.AUTO_ACKNOWLEDGE); // consumer = session.createConsumer(destination); connection.start(); // crear un producer para enviar mensajes usando la session MessageProducer producer = session.createProducer((Destination) destination); // crear un mensaje de tipo text y setearle el contenido TextMessage message = session.createTextMessage(); message.setText(messageText); // enviar el mensaje producer.send(message); // TODO: recordar cerrar la session y la connection en un bloque “finally” connection.close(); } catch (Exception e) { System.out.println("Mensaje enviado 2"); } } }
992e58df64f9a1f6ce0e3f2ada621ea27b3c49a9
72383cff5d2d711ea86c8b434f1e3fe875467804
/src/main/java/com/mavuno/famers/union/mavuno/models/ApiMpesaB2cReq.java
ee59d109c615ed7ffee94f538235ac821298d2fb
[]
no_license
KIbanyu/MavunoFarmersUnion-
ea63ef361e087c7f6f7c266d353d872a433ae09d
8e71c6ea1d84fcc3addfaac8bfe15b1611577d11
refs/heads/main
2023-01-13T18:09:19.639667
2020-11-12T11:49:21
2020-11-12T11:49:21
312,247,804
0
0
null
null
null
null
UTF-8
Java
false
false
554
java
package com.mavuno.famers.union.mavuno.models; import com.sun.istack.NotNull; import java.math.BigDecimal; public class ApiMpesaB2cReq { @NotNull private String phoneNumber; @NotNull private BigDecimal amount; public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } public BigDecimal getAmount() { return amount; } public void setAmount(BigDecimal amount) { this.amount = amount; } }
b28306315a3897dc9d22a52c67983c8244babc6d
18d3bb5f5b90e20787055620188384d04acf977f
/src/main/java/com/scopic/antiqueauction/domain/entity/Sale.java
8f5eb9c4a445a0dc308ab00658bfcb8c1880dcfc
[ "MIT" ]
permissive
berkaltug/Antique-Auction-Project
345607915a9d7738af38bda9715eb365a2399a24
20da62fdc116db54cdbd156679c76be00dbdda34
refs/heads/master
2022-12-30T13:46:58.430981
2020-10-23T12:58:43
2020-10-23T12:58:43
301,093,608
0
0
null
null
null
null
UTF-8
Java
false
false
2,237
java
package com.scopic.antiqueauction.domain.entity; import javax.persistence.*; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.Objects; @Entity public class Sale { @Id @GeneratedValue(strategy= GenerationType.AUTO) private Integer id; @ManyToOne(fetch = FetchType.LAZY) private Antique antique; private BigDecimal price; @ManyToOne(fetch = FetchType.LAZY) private User buyer; private LocalDateTime date; public Sale(Antique antique, BigDecimal price, User buyer, LocalDateTime date) { this.antique = antique; this.price = price; this.buyer = buyer; this.date = date; } public Sale() { } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Antique getAntique() { return antique; } public void setAntique(Antique antique) { this.antique = antique; } public BigDecimal getPrice() { return price; } public void setPrice(BigDecimal price) { this.price = price; } public User getBuyer() { return buyer; } public void setBuyer(User buyer) { this.buyer = buyer; } public LocalDateTime getDate() { return date; } public void setDate(LocalDateTime date) { this.date = date; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Sale sale = (Sale) o; return Objects.equals(id, sale.id) && Objects.equals(antique, sale.antique) && Objects.equals(price, sale.price) && Objects.equals(buyer, sale.buyer) && Objects.equals(date, sale.date); } @Override public int hashCode() { return Objects.hash(id, antique, price, buyer, date); } @Override public String toString() { return "Sale{" + "id=" + id + ", antique=" + antique + ", price=" + price + ", buyer=" + buyer + ", date=" + date + '}'; } }
03cfbe12a2e408b7692a4a23fc6895b599c927f8
9d4dfd6d9a47d69582a95b5e1733ec6c3b56ad4a
/algorithm/src/main/java/org/anonymous/loop/LinkedListDeleter.java
f91122841c76a32ce06b75244512b7b438de1312
[]
no_license
MacleZhou/child-s-notes
bee5979c351b2c4bab4cbda04168daa8f4877cee
951255a3c11797874ca13f28833ed0e590acd097
refs/heads/master
2023-04-14T00:11:56.906785
2020-06-23T06:23:11
2020-06-23T06:23:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
822
java
package org.anonymous.loop; import org.anonymous.Node; /** * ~~ Talk is cheap. Show me the code. ~~ :-) * * @author MiaoOne * @since 2020/6/4 13:32 */ public class LinkedListDeleter { public Node deleteIfEquals(Node head, int value) { /*if (head.getValue() == value) { head = head.getNext(); }*/ while (head != null && head.getValue() == value) { head = head.getNext(); } if (head == null) { return null; } Node prev = head; while (prev.getNext() != null) { if (prev.getNext().getValue() == value) { // delete it prev.setNext(prev.getNext().getNext()); } else { prev = prev.getNext(); } } return head; } }
5efddd5f4d30f81bba8705b496f0903f8a71265c
797b00c62f8eefc196cf23b28342ef00181fb025
/app/src/main/java/com/quantag/geofenceapp/connectivity/ConnectivityEventsReceiver.java
39d5ce789f347557247156bb723b53382df24c9f
[]
no_license
VasylT/GeofenceMonitor
241454cca604493779b167e58e2013842f30f294
5f1e772f062053ab4d9a96ea16cb119692009943
refs/heads/master
2020-06-24T05:34:29.874214
2017-07-13T10:16:04
2017-07-13T10:16:04
96,921,939
0
0
null
null
null
null
UTF-8
Java
false
false
1,830
java
package com.quantag.geofenceapp.connectivity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.support.v4.content.LocalBroadcastManager; import com.quantag.geofenceapp.utilities.Constants; public class ConnectivityEventsReceiver extends BroadcastReceiver { private boolean isRegistered = false; public interface IConnectivityReceiver { void onConnected(String extraInfo, boolean isNewWiFi); void onDisconnected(); } private IConnectivityReceiver mListener; public ConnectivityEventsReceiver(IConnectivityReceiver listener) { mListener = listener; } @Override public void onReceive(Context context, Intent intent) { int message = intent.getIntExtra(Constants.ARG_MESSAGE, 0); switch (message) { case Constants.MSG_CONNECTED: String extraInfo = intent.getStringExtra(Constants.ARG_STRING); boolean isNewWiFi = intent.getBooleanExtra(Constants.ARG_BOOLEAN, false); mListener.onConnected(extraInfo, isNewWiFi); break; case Constants.MSG_DISCONNECTED: mListener.onDisconnected(); break; default: } } public void register(Context context) { if (!isRegistered) { IntentFilter filter = new IntentFilter(Constants.ACTION_CONNECTIVITY); LocalBroadcastManager.getInstance(context).registerReceiver(this, filter); isRegistered = true; } } public void unregister(Context context) { if (isRegistered) { LocalBroadcastManager.getInstance(context).unregisterReceiver(this); isRegistered = false; } } }
64bd97a7274b4f3fc34f3db23d78c7b91897f369
007b0d8f3f4857282c0de67071b366ff1e9a3383
/Car Detail.java
3f5a172a8ae03049b1ef15f9b46d1d352507f98d
[]
no_license
Anuj-negi2207/Java-Code-Repository
fe96aea6c740e05081fa5aec8851d764358a2ee7
0a726d281f7ffa0702624c77e2f104606827fd61
refs/heads/main
2023-07-08T21:14:28.377284
2021-08-14T06:41:18
2021-08-14T06:41:18
395,913,605
0
0
null
null
null
null
UTF-8
Java
false
false
1,347
java
import java.util.*; interface Vehicle { double s = 0; //static in nature String vtype = "HatchBack"; //static in nature void speed(); //abstract in nature } class Car implements Vehicle { String cname; double milage, price; Engine e; Car() { cname = new String(); e = new Engine(); milage = price = 0; } Car(String cname, double price, double milage) { this.cname = cname; this.price = price; this.milage = milage; e = new Engine(); } public void speed() { System.out.println("Speed = " + this.s); System.out.println("Vehicle Type = " + this.vtype); } public void getCarSpecs() { System.out.println("Here are your Car Specs: \n"); System.out.println("cname = " + cname); System.out.println("milage = " + milage + "km/L"); System.out.println("price = " + price + " rupees"); getEngineSpecs(); } } class Engine extends Car { String etype; double weight; Engine(String etype, double weight) { this.etype = etype; this.weight = weight; } void getEngineSpecs() { System.out.println("Engine = " + etype + ", Weight = " + weight); } } class MainClass { public static void main(String[] args) { Car c = new Car(); Car d = new Car("FX600", 952000, 12); c.getCarSpecs(); d.getEngineSpecs(); } }
68cc565b41f84f7beeebc3c9e2afc07c145b403f
e5105f826dd507c5e0c9f5324281d9cdd6952f75
/ConsultasSQL.java
1b01799b41f1abb5807c8414c3fe98c89da4d015
[]
no_license
Devil-boy21/Lectura-de-datos-en-sql-con-java
b4a83ad1ebb1267da4917040ec69207fc45c3793
fe44fa2521e24f3abcf1b5665a98fa57433a8f38
refs/heads/main
2023-08-11T14:33:11.742800
2021-10-14T18:50:07
2021-10-14T18:50:07
417,227,245
0
0
null
null
null
null
UTF-8
Java
false
false
2,098
java
package Conex; import java.sql.*; import java.util.ArrayList; import java.util.Scanner; public class ConsultasSQL { Scanner entrada = new Scanner(System.in); public void consultasDatos() { Connection conexion = null; Conexion c = new Conexion(); try { Class.forName("com.mysql.jdbc.Driver"); conexion = DriverManager.getConnection(c.URL, c.user, c.password); System.out.println("Conexion establecida"); // metodo para consulta datos String sentenciaSql = "SELECT * FROM clientes;"; // String sentenciaSql = "SELECT * FROM clientes WHERE id LIKE '%" + c + "'"; Statement st = conexion.createStatement(); ResultSet rs = st.executeQuery(sentenciaSql); while (rs.next()) { // String cedula = rs.getString("cedula"); // String nom = rs.getString("nombre"); // String apellido = rs.getString("apellido"); // String direccion = rs.getString("direccion"); //Metodo para buscar String cedula = rs.getString("cedula"); String nom = rs.getString("nombre"); String apellido = rs.getString("apellido"); String direccion = rs.getString("direccion"); // ArrayList<Persona> listaNombres = new ArrayList<Persona>(); // String nombre = rs.getNString("nombre"); // String apellido = rs.getNString("apellido"); // String id = rs.getNString("id"); // print the results // System.out.format("%s, %s, %s, %s\n", cedula, nom, apellido, direccion); System.out.format("%s, %s, %s, %s\n", cedula, nom, apellido, direccion); } st.close(); conexion.close(); } catch (Exception ex) { System.err.println("Error en la matrix"); System.err.println(ex.getMessage()); // } } }
f82f3b22f57c6dee51b1d9164647a2fefd6556b1
162ad880702a58a709a96cb9ad47fa164222e6ac
/src/main/java/com/training/Upload.java
35320dbdd8249417659dc348b3551ffb76f276bf
[]
no_license
mannepallirakesh/Book_Hibernate
5298e802c0d1b9470e3fe85c4b041e1cb0504033
ded9cd72ad3d9f6e4a18342fccf534cd0da63ce0
refs/heads/master
2021-04-30T16:34:54.955969
2017-01-26T00:15:00
2017-01-26T00:15:00
80,071,289
0
0
null
null
null
null
UTF-8
Java
false
false
2,775
java
package com.training; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Scanner; import oracle.jdbc.driver.OracleDriver; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.lang.*; import java.sql.Driver; import java.sql.Statement; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.hibernate.*; import org.hibernate.cfg.Configuration; import java.util.List; import org.hibernate.*; import org.hibernate.cfg.Configuration; import com.training.Mem; import oracle.jdbc.driver.OracleDriver; public class Upload extends HttpServlet { public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String bookName = req.getParameter("bookName"); String authorName = req.getParameter("authorName"); int prIce = Integer.parseInt(req.getParameter("prIce")); res.setContentType("text/html"); PrintWriter out = res.getWriter(); try { System.out.println("enter try"); Session session = getSessionFactory().openSession(); Transaction transaction = session.getTransaction(); transaction.begin(); Books bk = new Books(); bk.setName(bookName); bk.setAuthor(authorName); bk.setPrice(prIce); session.save(bk); transaction.commit(); out.println("<HTML><HEAD><TITLE>Success</TITLE></HEAD>"); out.println(); out.println("<BODY>"); out.println("Congrats! You Uploaded a Book Successfully"); out.println(); out.println("<BR>"); out.println("</BR>"); out.println(); out.println("<BR>"); out.println("</BR>"); out.println(); out.println("<BR>"); out.println("</BR>"); out.println("Click here for homepage<br></br><A HREF=\"" + req.getContextPath() +"/Home\">HOME</A>"); out.println("</BODY></HTML>"); out.println("</BODY>"); out.println("</HTML>"); } catch (Exception ex) { System.out.println("Unknown exception."); } finally { } } private static SessionFactory getSessionFactory() { try { // Create the SessionFactory from hibernate.cfg.xml return new Configuration().configure("hibernate-example1.cfg.xml") .buildSessionFactory(); } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } }
8f13e67e9bec25bdc9e8bbc2d2bebb0954bc664e
da488ecf85205273ef3a0d9fd24aba24544cbd9d
/src/com/sharedcab/batchcar/GooglePlaces.java
928a9f3ddfd2380b01f8dd0f191a51cfb7118c1d
[]
no_license
kailIII/taxi-android-app
a3314886aecaa400075c7502551a2549ca66bc8d
3502da96614806caebc9c7e184535eefc38234cb
refs/heads/master
2020-03-07T07:04:19.496160
2015-01-04T17:31:18
2015-01-04T17:31:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,446
java
package com.sharedcab.batchcar; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLEncoder; import java.util.ArrayList; import java.util.HashMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.util.Log; public class GooglePlaces { private static final String LOG_TAG = "Batchcar"; private static final String PLACES_API_BASE = "https://maps.googleapis.com/maps/api/place"; private static final String TYPE_AUTOCOMPLETE = "/autocomplete"; private static final String TYPE_DETAILS = "/details"; private static final String OUT_JSON = "/json"; private String apiKey; public GooglePlaces(String apiKey) { this.apiKey = apiKey; } public ArrayList<HashMap<String,String>> autocomplete(String input) { ArrayList<HashMap<String,String>> resultList = null; StringBuilder sb = new StringBuilder(PLACES_API_BASE + TYPE_AUTOCOMPLETE + OUT_JSON); sb.append("?sensor=true&key=" + apiKey); sb.append("&components=country:in"); sb.append("&location=19.1167,72.8333&radius=50000"); sb.append("&components=country:in"); try { sb.append("&input=" + URLEncoder.encode(input, "utf8")); } catch (UnsupportedEncodingException e) { Log.e(LOG_TAG, "Error connecting to Places API", e); return resultList; } try { JSONObject jsonObj = new JSONObject(downloadStuff(sb.toString())); JSONArray predsJsonArray = jsonObj.getJSONArray("predictions"); resultList = new ArrayList<HashMap<String,String>>(predsJsonArray.length()); for (int i = 0; i < predsJsonArray.length(); i++) { JSONObject item = predsJsonArray.getJSONObject(i); HashMap<String, String> newhm = new HashMap<String, String>(); newhm.put("description", item.getString("description")); newhm.put("reference", item.getString("reference")); resultList.add(newhm); } } catch (JSONException e) { Log.e(LOG_TAG, "Cannot process JSON results", e); } return resultList; } public CustomAddress location(String reference) { JSONObject json = details(reference); try { JSONObject result = json.getJSONObject("result"); JSONObject location = result.getJSONObject("geometry").getJSONObject("location"); String name = result.getString("formatted_address"); String lat = Double.toString(location.getDouble("lat")); String lng = Double.toString(location.getDouble("lng")); return new CustomAddress(name, lat, lng); } catch (JSONException e) { Log.e(LOG_TAG, "Cannot process JSON results", e); } return null; } public JSONObject details(String reference) { StringBuilder sb = new StringBuilder(PLACES_API_BASE + TYPE_DETAILS + OUT_JSON); sb.append("?sensor=true&key=" + apiKey); sb.append("&reference=" + reference); try { return new JSONObject(downloadStuff(sb.toString())); } catch (JSONException e) { Log.e(LOG_TAG, "Cannot process JSON results", e); } return null; } private static String downloadStuff(String uri) { HttpURLConnection conn = null; StringBuilder jsonResults = new StringBuilder(); try { URL url = new URL(uri); conn = (HttpURLConnection) url.openConnection(); InputStreamReader in = new InputStreamReader(conn.getInputStream()); int read; char[] buff = new char[1024]; while ((read = in.read(buff)) != -1) { jsonResults.append(buff, 0, read); } } catch (MalformedURLException e) { Log.e(LOG_TAG, "Error processing Places API URL", e); return null; } catch (IOException e) { Log.e(LOG_TAG, "Error connecting to Places API", e); return null; } finally { if (conn != null) { conn.disconnect(); } } return jsonResults.toString(); } }
2a34cb0e511d7452c4ede09804251c445a99444e
d2d86bc8321c2430515bfd54afd5d38a9298dd0d
/src/main/java/math/complex/MComplex.java
419b118963bf672c7453493274afae707c20eb5d
[]
no_license
stefan-zobel/wip
c27cde4e9be1aead994bf157cfe1ba791c36953b
aa13736f2466dbf7a54e0b55ac19fb0769a91829
refs/heads/master
2023-08-08T04:00:35.742724
2023-08-07T13:54:59
2023-08-07T13:54:59
219,505,362
2
2
null
2022-10-04T23:58:31
2019-11-04T13:14:57
Java
UTF-8
Java
false
false
4,409
java
/* * Copyright 2018 Stefan Zobel * * 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 math.complex; /** * Mutable {@link IComplex} implementation. */ public final class MComplex extends AComplex implements IComplex { private double re; private double im; public double re() { return re; } public double im() { return im; } public MComplex(double re) { this(re, 0.0); } public MComplex(double re, double im) { this.re = re; this.im = im; } public MComplex(IComplex that) { this.re = that.re(); this.im = that.im(); } public void setRe(double re) { this.re = re; } public void setIm(double im) { this.im = im; } public MComplex copy() { return new MComplex(re, im); } public boolean isMutable() { return true; } public IComplex add(IComplex that) { re += that.re(); im += that.im(); return this; } public IComplex sub(IComplex that) { re -= that.re(); im -= that.im(); return this; } public IComplex mul(IComplex that) { if (isInfinite() || that.isInfinite()) { re = Double.POSITIVE_INFINITY; im = Double.POSITIVE_INFINITY; return this; } double this_re = re; double that_re = that.re(); re = this_re * that_re - im * that.im(); im = im * that_re + this_re * that.im(); return this; } public IComplex div(IComplex that) { double c = that.re(); double d = that.im(); if (c == 0.0 && d == 0.0) { re = Double.NaN; im = Double.NaN; return this; } if (that.isInfinite() && !this.isInfinite()) { re = 0.0; im = 0.0; return this; } // limit overflow/underflow if (Math.abs(c) < Math.abs(d)) { double q = c / d; double denom = c * q + d; double real = re; re = (real * q + im) / denom; im = (im * q - real) / denom; } else { double q = d / c; double denom = d * q + c; double real = re; re = (im * q + real) / denom; im = (im - real * q) / denom; } return this; } public IComplex inv() { if (re == 0.0 && im == 0.0) { re = Double.POSITIVE_INFINITY; im = Double.POSITIVE_INFINITY; return this; } if (isInfinite()) { re = 0.0; im = 0.0; return this; } double scale = re * re + im * im; re = re / scale; im = -im / scale; return this; } public IComplex ln() { double abs = abs(); double phi = arg(); re = Math.log(abs); im = phi; return this; } public IComplex exp() { ComplexFun.exp(this, true, true); return this; } public IComplex pow(double exponent) { return ln().scale(exponent).exp(); } public IComplex pow(IComplex exponent) { return ln().mul(exponent).exp(); } public IComplex scale(double alpha) { if (isInfinite() || Double.isInfinite(alpha)) { re = Double.POSITIVE_INFINITY; im = Double.POSITIVE_INFINITY; return this; } re = alpha * re; im = alpha * im; return this; } public IComplex conj() { im = -im; return this; } public IComplex neg() { re = -re; im = -im; return this; } }
b434bf52ecdbc56d7d4417e9d70302b99ca3aa91
fa2604277be063f4cc246eadf0c8134c331a8b77
/src/bytebybyte/ClockAngle.java
8820ad92c4773423c78fe0aef962530ada8462ae
[]
no_license
nannareshkumar/sample
ae42f86c580cf65abf8626e531c151d801a92801
1e3c2b957510f69ebe3df928f85e2116de094679
refs/heads/master
2023-07-29T02:35:19.984542
2021-08-31T10:29:26
2021-08-31T10:29:26
295,343,461
0
0
null
null
null
null
UTF-8
Java
false
false
1,274
java
package bytebybyte;/* * Title: Clock Angle * * Given two integers, an hour and a minute, write a function to * calculate the angle between the two hands on a clock representing * that time. * * Execution: javac ClockAngle.java && java ClockAngle * For more details, check out http://www.byte-by-byte.com/clockangle */ public class ClockAngle { public static double clockAngle(int hour, int minutes) { final double MINUTES_PER_HOUR = 60; final double DEGREES_PER_MINUTE = 360 / MINUTES_PER_HOUR; final double DEGREES_PER_HOUR = 360 / 12; double minuteAngle = minutes * DEGREES_PER_MINUTE; double hourAngle = hour * DEGREES_PER_HOUR + (minutes / MINUTES_PER_HOUR) * DEGREES_PER_HOUR; double diff = Math.abs(minuteAngle - hourAngle); if (diff > 180) { return 360 - diff; } return diff; } // threads.Sample test cases public static void main(String[] args) { assert clockAngle(3, 40) == 130: "3:40 is 130 degrees"; assert clockAngle(1, 20) == 80: "1:20 is 80 degrees"; assert clockAngle(5, 15) == 67.5: "5:15 is 67.5 degrees"; System.out.println("Passed all test cases"); } }
18caddbaca8eeebe8b69f9fb64b3cc9eeb4c7797
5ff6b4da08a3b7105e29a0cdbbffe2c5103f69fc
/src/Medium/PartitionList.java
bfd34c94a858f42b1d4ab117c85956653c8ab799
[]
no_license
Haydes/My_Leetcode_Solutions
64dcda9a3598bcc6b5c95c8e9b8c6cacbba4d3e8
f5e5cf62bcba4f8fa866bac0a1d48e96e08afcfe
refs/heads/master
2023-03-12T23:18:16.824448
2021-02-26T17:22:22
2021-02-26T17:22:22
341,530,270
0
0
null
null
null
null
UTF-8
Java
false
false
2,257
java
package Medium; import utils.ListNode; /** * 86. Partition List * * Given the head of a linked list and a value x, partition it such that all * nodes less than x come before nodes greater than or equal to x. * * You should preserve the original relative order of the nodes in each of the * two partitions. * * Constraints: * * The number of nodes in the list is in the range [0, 200]. * * -100 <= Node.val <=100 * * -200 <= x <= 200 */ public class PartitionList { public static void main(String[] args) { ListNode head = new ListNode(1, new ListNode(4, new ListNode(3, new ListNode(2, new ListNode(5, new ListNode(2)))))); System.out.println(head); ListNode partition = partition2(head, 3); System.out.println(partition); } /** * 链表内调换位置 * * 0 ms, faster than 100.00% * * @param head * @param x * @return */ public static ListNode partition(ListNode head, int x) { ListNode dummy = new ListNode(); dummy.next = head; ListNode pre = dummy; ListNode current = dummy.next; // 插入的位置在insertPos的下一个 ListNode insertPos = dummy; while (current != null) { // 如果当前值比x小,则移动到当前需要插入的位置 if (current.val < x) { // 前一个的下一个为当前的下一个 pre.next = current.next; // 当前的下一个为insertPos的下一个 current.next = insertPos.next; // 然后要插入的下一个位置变为current insertPos.next = current; insertPos = current; } pre = current; current = current.next; } return dummy.next; } /** * 小的全部放第一个链表,大的全部放第二个,然后第一个第二个链表连起来 * * 0 ms, faster than 100.00% * * @param head * @param x * @return */ public static ListNode partition2(ListNode head, int x) { ListNode node1 = new ListNode(); ListNode node2 = new ListNode(); ListNode n1 = node1; ListNode n2 = node2; ListNode current = head; while (current != null) { if (current.val < x) { n1.next = current; n1 = n1.next; } else { n2.next = current; n2 = n2.next; } current = current.next; } n2.next = null; n1.next = node2.next; return node1.next; } }
c1bb1dd560d2a4f3edb08e8cb1fd7120520378ea
4ca31990d64db950951e50139f01f6e6f70f525c
/litchi-comsumer-movie-ribbon-properties-customizing/src/main/java/org/litchi/cloud/movie/ConsumperMovieRibbonPropertiesApplication.java
e010f463e957d2e2a1cea315d3c96c3d4f95b66d
[]
no_license
lyl616/litchi-cloud
6c6752b17b5f426cfd7f063c0196b3b01ce70ae3
f55b65b85d4c759b99ce78f992d49f64315f09f6
refs/heads/master
2021-01-24T08:47:57.055564
2018-03-20T10:29:29
2018-03-20T10:29:29
122,995,043
0
0
null
null
null
null
UTF-8
Java
false
false
715
java
package org.litchi.cloud.movie; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.loadbalancer.LoadBalanced; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.context.annotation.Bean; import org.springframework.web.client.RestTemplate; @SpringBootApplication @EnableEurekaClient public class ConsumperMovieRibbonPropertiesApplication { @Bean @LoadBalanced public RestTemplate restTemplate() { return new RestTemplate(); } public static void main(String[] args) { SpringApplication.run(ConsumperMovieRibbonPropertiesApplication.class, args); } }
1b2c056dd610d55e70e936db40f3811ee9143f51
89d191392632bbd7d29d4ab18f15848ece9f4951
/app/src/main/java/me/tsukanov/counter/infrastructure/BroadcastHelper.java
cf04a7d86ccb7855fce8d8305fd03aba28cf5b22
[ "Apache-2.0" ]
permissive
nafraf/Simple-Counter
4c873cbaaf7a6f7401faedab831902fc9f4406c1
ce6ef2f06479e91b00dbd0fa0705eceaa80d1d09
refs/heads/master
2023-08-09T00:11:24.094568
2023-05-16T03:16:13
2023-05-16T03:18:20
37,788,930
0
0
Apache-2.0
2019-01-14T02:33:15
2015-06-20T22:56:52
Java
UTF-8
Java
false
false
1,341
java
package me.tsukanov.counter.infrastructure; import android.content.Context; import android.content.Intent; import androidx.annotation.NonNull; import android.util.Log; import me.tsukanov.counter.CounterApplication; public class BroadcastHelper { public static final String EXTRA_COUNTER_NAME = String.format("%s.EXTRA_COUNTER_NAME", CounterApplication.PACKAGE_NAME); private static final String TAG = BroadcastHelper.class.getSimpleName(); @NonNull private final Context context; public BroadcastHelper(@NonNull final Context context) { this.context = context; } private void sendBroadcast(@NonNull final Intent intent) { this.context.sendBroadcast(intent); } public void sendBroadcast(@NonNull final Actions action) { final Intent intent = new Intent(); intent.setAction(action.getActionName()); intent.addCategory(Intent.CATEGORY_DEFAULT); sendBroadcast(intent); } public void sendSelectCounterBroadcast(@NonNull final String counterName) { final Intent intent = new Intent(); intent.setAction(Actions.SELECT_COUNTER.getActionName()); intent.putExtra(EXTRA_COUNTER_NAME, counterName); intent.addCategory(Intent.CATEGORY_DEFAULT); sendBroadcast(intent); Log.d(TAG, String.format("Sending counter selection broadcast [counterName=%s]", counterName)); } }
bd6e2bf9f73365ccd1910f052d28b7ea7b421c99
542cf6fffa070ce283c2c437c556cc5fd8eb5b51
/src/com/lq/po/Page.java
9884b9f6be65ae210a4e1e4d2343ac6911e09749
[]
no_license
daqingdie/job
799a754b125a96113dfbdf558d8316ee76c74a2f
febf541cd4045f86e5c76932e94eda7f90b143db
refs/heads/master
2022-06-21T20:15:28.808030
2020-05-06T06:51:24
2020-05-06T06:51:24
261,675,529
0
0
null
null
null
null
UTF-8
Java
false
false
1,940
java
package com.lq.po; import java.io.Serializable; public class Page implements Serializable { private static final long serialVersionUID = -3198048449643774660L; private int pageNow = 1; // 当前页数 private int pageSize = 12; // 每页显示记录的条数 private int totalCount; // 总的记录条数 private int totalPageCount; // 总的页数 @SuppressWarnings("unused") private int startPos; // 开始位置,从0开始 /** * 通过构造函数 传入 总记录数 和 当前页 * @param totalCount * @param pageNow */ public Page(int totalCount, int pageNow) { this.totalCount = totalCount; this.pageNow = pageNow; } /** * 取得总页数,总页数=总记录数/每页显示记录的条数 * @return */ public int getTotalPageCount() { totalPageCount = getTotalCount() / getPageSize(); return (totalCount % pageSize == 0) ? totalPageCount //总页数 : totalPageCount + 1; } public void setTotalPageCount(int totalPageCount) { this.totalPageCount = totalPageCount; } public int getPageNow() { return pageNow; } public void setPageNow(int pageNow) { this.pageNow = pageNow; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public int getTotalCount() { return totalCount; } public void setTotalCount(int totalCount) { this.totalCount = totalCount; } /** * 取得选择记录的初始位置 * @return */ public int getStartPos() { return (pageNow - 1) * pageSize; } public void setStartPos(int startPos) { this.startPos = startPos; } }
69a4184311681e1386a758b0751c13bc3e4e0f16
14869f69d7add442927190e07510367f1309bb67
/xyg-library/src/main/java/com/bumptech/glide/load/resource/gif/GifFrameLoader.java
3b823a9758cf53e8ddac9b56ce62ecd4e8d34620
[ "Apache-2.0" ]
permissive
droidranger/xygapp
35dc74d13773df9ce24937cabeed5b40c5aab3aa
193c60a53d5f1654d99e98286cf086e96c1cef3b
refs/heads/master
2021-01-19T08:48:25.527616
2017-12-12T01:10:54
2017-12-12T01:10:54
87,680,560
0
0
null
null
null
null
UTF-8
Java
false
false
7,043
java
package com.bumptech.glide.load.resource.gif; import android.content.Context; import android.graphics.Bitmap; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.os.SystemClock; import com.bumptech.glide.GenericRequestBuilder; import com.bumptech.glide.Glide; import com.bumptech.glide.gifdecoder.GifDecoder; import com.bumptech.glide.load.Encoder; import com.bumptech.glide.load.Key; import com.bumptech.glide.load.Transformation; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; import com.bumptech.glide.load.resource.NullEncoder; import com.bumptech.glide.request.animation.GlideAnimation; import com.bumptech.glide.request.target.SimpleTarget; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.util.UUID; class GifFrameLoader { private final FrameCallback callback; private final GifDecoder gifDecoder; private final Handler handler; private boolean isRunning = false; private boolean isLoadPending = false; private GenericRequestBuilder<GifDecoder, GifDecoder, Bitmap, Bitmap> requestBuilder; private DelayTarget current; private boolean isCleared; public interface FrameCallback { void onFrameReady(int index); } public GifFrameLoader(Context context, FrameCallback callback, GifDecoder gifDecoder, int width, int height) { this(callback, gifDecoder, null, getRequestBuilder(context, gifDecoder, width, height, Glide.get(context).getBitmapPool())); } GifFrameLoader(FrameCallback callback, GifDecoder gifDecoder, Handler handler, GenericRequestBuilder<GifDecoder, GifDecoder, Bitmap, Bitmap> requestBuilder) { if (handler == null) { handler = new Handler(Looper.getMainLooper(), new FrameLoaderCallback()); } this.callback = callback; this.gifDecoder = gifDecoder; this.handler = handler; this.requestBuilder = requestBuilder; } @SuppressWarnings("unchecked") public void setFrameTransformation(Transformation<Bitmap> transformation) { if (transformation == null) { throw new NullPointerException("Transformation must not be null"); } requestBuilder = requestBuilder.transform(transformation); } public void start() { if (isRunning) { return; } isRunning = true; isCleared = false; loadNextFrame(); } public void stop() { isRunning = false; } public void clear() { stop(); if (current != null) { Glide.clear(current); current = null; } isCleared = true; // test. } public Bitmap getCurrentFrame() { return current != null ? current.getResource() : null; } private void loadNextFrame() { if (!isRunning || isLoadPending) { return; } isLoadPending = true; long targetTime = SystemClock.uptimeMillis() + gifDecoder.getNextDelay(); gifDecoder.advance(); DelayTarget next = new DelayTarget(handler, gifDecoder.getCurrentFrameIndex(), targetTime); requestBuilder .signature(new FrameSignature()) .into(next); } // Visible for testing. void onFrameReady(DelayTarget delayTarget) { if (isCleared) { handler.obtainMessage(FrameLoaderCallback.MSG_CLEAR, delayTarget).sendToTarget(); return; } DelayTarget previous = current; current = delayTarget; callback.onFrameReady(delayTarget.index); if (previous != null) { handler.obtainMessage(FrameLoaderCallback.MSG_CLEAR, previous).sendToTarget(); } isLoadPending = false; loadNextFrame(); } private class FrameLoaderCallback implements Handler.Callback { public static final int MSG_DELAY = 1; public static final int MSG_CLEAR = 2; @Override public boolean handleMessage(Message msg) { if (msg.what == MSG_DELAY) { DelayTarget target = (DelayTarget) msg.obj; onFrameReady(target); return true; } else if (msg.what == MSG_CLEAR) { DelayTarget target = (DelayTarget) msg.obj; Glide.clear(target); } return false; } } // Visible for testing. static class DelayTarget extends SimpleTarget<Bitmap> { private final Handler handler; private final int index; private final long targetTime; private Bitmap resource; public DelayTarget(Handler handler, int index, long targetTime) { this.handler = handler; this.index = index; this.targetTime = targetTime; } public Bitmap getResource() { return resource; } @Override public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { this.resource = resource; Message msg = handler.obtainMessage(FrameLoaderCallback.MSG_DELAY, this); handler.sendMessageAtTime(msg, targetTime); } } private static GenericRequestBuilder<GifDecoder, GifDecoder, Bitmap, Bitmap> getRequestBuilder(Context context, GifDecoder gifDecoder, int width, int height, BitmapPool bitmapPool) { GifFrameResourceDecoder frameResourceDecoder = new GifFrameResourceDecoder(bitmapPool); GifFrameModelLoader frameLoader = new GifFrameModelLoader(); Encoder<GifDecoder> sourceEncoder = NullEncoder.get(); return Glide.with(context) .using(frameLoader, GifDecoder.class) .load(gifDecoder) .as(Bitmap.class) .sourceEncoder(sourceEncoder) .decoder(frameResourceDecoder) .skipMemoryCache(true) .diskCacheStrategy(DiskCacheStrategy.NONE) .override(width, height); } // Visible for testing. static class FrameSignature implements Key { private final UUID uuid; public FrameSignature() { this(UUID.randomUUID()); } // VisibleForTesting. FrameSignature(UUID uuid) { this.uuid = uuid; } @Override public boolean equals(Object o) { if (o instanceof FrameSignature) { FrameSignature other = (FrameSignature) o; return other.uuid.equals(uuid); } return false; } @Override public int hashCode() { return uuid.hashCode(); } @Override public void updateDiskCacheKey(MessageDigest messageDigest) throws UnsupportedEncodingException { throw new UnsupportedOperationException("Not implemented"); } } }
d1dff7640369e8f4a73914879e7c4637cd2e6a00
fb6a18d4fc7a90b77d6307f640727021b98664b7
/src/main/java/tv/seei/manage/ais/dao/DataLinkManagementRepository.java
7180d6e5aa74f99623b15c320c95878575f23911
[]
no_license
zDream/springboot
b370b4a04e97f7462a492f4291b8574df6c699f6
8362b6960214758612aebd827ff19c38054811cc
refs/heads/master
2021-05-11T10:24:05.229443
2018-06-25T02:23:52
2018-06-25T02:23:52
118,102,426
1
0
null
null
null
null
UTF-8
Java
false
false
475
java
package tv.seei.manage.ais.dao; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import tv.seei.manage.ais.entity.DataLinkManagement; import java.io.Serializable; public interface DataLinkManagementRepository extends JpaRepository<DataLinkManagement,Long>,Serializable, JpaSpecificationExecutor<DataLinkManagement> { // DataLinkManagement findByName(String name); }
1a1ee4be632d664a5871f5f91fef5b064fd4adf0
b5c1d0c55c5234f34ad3278f4d641f12f4ea881f
/src/main/java/com/example/sunilrestdemo/entity/Book.java
76afd911068717dc74d961f03daa9fb6d537e722
[]
no_license
sunilmore690/spring-rest-book
08f0a81f1a8050a0fe63dec91887ec5612900eaa
d3c8a39a3d6c807d84c4477e72a49985e88b93c5
refs/heads/master
2023-04-01T22:50:13.359355
2021-04-10T15:01:37
2021-04-10T15:01:37
354,554,671
0
0
null
null
null
null
UTF-8
Java
false
false
1,120
java
package com.example.sunilrestdemo.entity; import org.hibernate.annotations.GenericGenerator; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class Book { @Id @GeneratedValue(generator = "UUID") @GenericGenerator( name = "UUID", strategy = "org.hibernate.id.UUIDGenerator" ) @Column(updatable = false, nullable = false) private String id; private String name; private String author; private String category; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public String getId() { return id; } public void setId(String id) { this.id = id; } }
166c159bc89d97d24ee5d1e222e62bd153e91fb2
3a5a5aa4b24365afd672c08223ac4c993059d32a
/src/main/java/ru/job4j/utils/SqlRuDateTimeParser.java
85e78a8f446f0e57b3d4c0b5a5aef94d1ab42c50
[]
no_license
k2250427/job4j_grabber
8f7fa273af9b2a9abf883db4fe6f84b8c0f35166
6c96b219300fa967e84e6f39c6a372a4a945afa0
refs/heads/master
2023-07-02T22:41:09.818603
2021-08-10T17:17:43
2021-08-10T17:17:43
392,389,572
0
0
null
null
null
null
UTF-8
Java
false
false
2,276
java
package ru.job4j.utils; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import static java.util.Map.entry; public class SqlRuDateTimeParser implements DateTimeParser { @SuppressWarnings("checkstyle:ConstantName") private static final Map<String, String> MONTHTONUMBER = Map.ofEntries( entry("янв", "01"), entry("фев", "02"), entry("мар", "03"), entry("апр", "04"), entry("май", "05"), entry("июн", "06"), entry("июл", "07"), entry("авг", "08"), entry("сен", "09"), entry("окт", "10"), entry("ноя", "11"), entry("дек", "12") ); @Override public LocalDateTime parse(String parse) { String[] buffer = parse.replace(",", "").split(" "); String[] dateParts = new String[4]; if (buffer.length == 2) { LocalDate date; if (buffer[0].equals("сегодня")) { date = LocalDate.now(); } else if (buffer[0].equals("вчера")) { date = LocalDate.now().minusDays(1L); } else { throw new IllegalArgumentException(); } dateParts[0] = String.valueOf(date.getDayOfMonth()); dateParts[1] = String.format("%02d", date.getMonthValue()); dateParts[2] = String.valueOf(date.getYear()); dateParts[3] = buffer[1]; } else { buffer[1] = MONTHTONUMBER.get(buffer[1]); int year = Integer.parseInt(buffer[2]); if (year < 2000) { buffer[2] = String.valueOf(year + 2000); } dateParts = Arrays.copyOf(buffer, 4); } String sb = String.join(" ", dateParts[0], dateParts[1], dateParts[2], dateParts[3]); return LocalDateTime.parse(sb, DateTimeFormatter.ofPattern("d MM yyyy HH:mm")); } public static void main(String[] args) { SqlRuDateTimeParser dtp = new SqlRuDateTimeParser(); LocalDateTime dt = dtp.parse("13 дек 21, 10:51"); } }
55bc3492e9719fb5cfd834a68134c155ca2886d4
5bd806fe2f4d7060aaf37ff3c9509f6a7790df96
/laboratory/java/office-document/sword-laboratory-easyexcel/src/test/java/com/alibaba/excel/EasyExcelTest.java
d4e49e463c4707d9e5ad7e10ad91bbc65a306689
[ "MIT" ]
permissive
bluesword12350/sword-laboratory
f3eb04012e565821b138e33f62139c29670a8fa0
8086a56933cc3ac8fac6f571224a90a86b791990
refs/heads/master
2023-08-20T12:57:47.600045
2023-08-09T01:58:11
2023-08-09T01:58:11
192,196,809
0
0
MIT
2023-07-14T02:40:23
2019-06-16T13:53:44
Java
UTF-8
Java
false
false
366
java
package com.alibaba.excel; import org.junit.jupiter.api.Test; import top.bluesword.model.DemoData; import java.util.List; class EasyExcelTest { @Test void simpleWrite() { String fileName = "write" + System.currentTimeMillis() + ".xlsx"; EasyExcel.write(fileName, DemoData.class).sheet("模板").doWrite(List.of(new DemoData())); } }
6fe1645286ad7707eafe70945832a9c1410249c4
dbe24984b40f745218b87ccbbe5cfd0ed9d174d9
/src/main/java/com/rajesh/HibDemo/DTO/Laptop.java
5f60b9a3f8e3396b4591f389565c97b0109abb42
[]
no_license
rajeshpanda796/Hibernate
5c18704458ae055b818d8659a3f5b17aec80b473
8267e25462b42448e0a433c4ccecbde309f1ba90
refs/heads/master
2023-04-18T03:22:03.680535
2021-04-22T14:27:50
2021-04-22T14:27:50
358,959,834
0
0
null
null
null
null
UTF-8
Java
false
false
493
java
package com.rajesh.HibDemo.DTO; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name="Laptop") public class Laptop { @Id private int lid; private String lname; //@OneToOne(mappedBy = "rollno") //private int rollno; public int getLid() { return lid; } public void setLid(int lid) { this.lid = lid; } public String getLname() { return lname; } public void setLname(String lname) { this.lname = lname; } }
912dee1826dff59f5c78320481224673353e9520
c75effa001db5a11b8a6deb8dde85d4333f736cb
/app/src/main/java/com/example/a16/MainActivity.java
235b7563382770f783d4168697b6d3ebf936cad6
[]
no_license
qp759/16-listview
b98ae4fb444f93b71061ec8eba6dfc4dbbf1f2c6
525a418dcb09cf7cb40a9676fa10e914bedc328b
refs/heads/master
2020-12-03T02:56:00.320559
2020-01-01T07:25:36
2020-01-01T07:25:36
231,187,407
0
0
null
null
null
null
UTF-8
Java
false
false
1,275
java
package com.example.a16; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; public class MainActivity extends AppCompatActivity { private TextView tv; private ListView lv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv = findViewById(R.id.tv); lv = findViewById(R.id.lv); ArrayAdapter<CharSequence> arrAdapRegion = ArrayAdapter.createFromResource(getApplication(), R.array.list, android.R.layout.simple_list_item_1); lv.setAdapter(arrAdapRegion); lv.setOnItemClickListener(listViewRegionOnItemClick); } private AdapterView.OnItemClickListener listViewRegionOnItemClick = new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { String s = getString(R.string.selected); tv.setText(s + ((TextView) view).getText()); } }; }
41b0126f072954a4f291aec93c8822c56223481b
892fe5a92536d6da7500eca91f95c9d3091bc5d5
/EvenOddLL.java
49aa4e2bf520f11d423555caec51977ea0b8b442
[]
no_license
mannat123/DS-Assignments
f26b7a412050daa9fdc146a3ee9c741cb68862c4
7b59484d5b0fabacd1c70764f669fd6c16a23242
refs/heads/master
2020-09-10T21:24:40.111765
2020-03-06T17:30:16
2020-03-06T17:30:16
221,838,530
0
0
null
null
null
null
UTF-8
Java
false
false
1,201
java
import java.util.*; public class EvenOddLL { Node head; static class Node{ int data; Node next; Node(int d){ data=d; next=null; } } public static EvenOddLL insert(EvenOddLL li,int data){ Node newNode=new Node(data); newNode.next=null; if(li.head==null) { li.head=newNode; } else { Node last=li.head; while(last.next!=null) { last=last.next; } last.next=newNode; } return li; } public static void evenOdd(EvenOddLL li) { int count=0; int sum=0; Node current=li.head; while(current!=null) { sum=sum+current.data; current=current.next; count++; } sum=sum/count; if(sum%2==0) { System.out.println("Even Linked List"); } else if(sum%2!=0) { System.out.println("Odd Linked List"); } } public static void main(String arg[]) { EvenOddLL list=new EvenOddLL(); Scanner sc=new Scanner(System.in); System.out.println("Enter the no. of elements to be added in linked list"); int n=sc.nextInt(); System.out.println("Enter the elements in the linked list"); for(int i=0;i<n;i++) { list.insert(list,sc.nextInt()); } list.evenOdd(list); } }
9fa49b56ac74657386ced319da8f60cc39a759a1
c35d218a96ffb4797883ef8ffad6c37b14b2df71
/eva-accession-release/src/main/java/uk/ac/ebi/eva/accession/release/configuration/readers/MergedVariantMongoReaderConfiguration.java
6ea88526aeca40127127f2284a0fc436be93ae5e
[ "Apache-2.0" ]
permissive
108krohan/eva-accession
085350c622e6e2c562e62f85cdd13d3017631af8
0fed0c8b5e8694027c6d81479328b40f4bf4e461
refs/heads/master
2020-06-07T12:04:07.711039
2019-08-09T12:26:04
2019-08-09T12:26:04
193,018,339
0
0
Apache-2.0
2019-07-23T04:13:24
2019-06-21T02:42:10
Java
UTF-8
Java
false
false
2,537
java
/* * Copyright 2019 EMBL - European Bioinformatics Institute * * 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 uk.ac.ebi.eva.accession.release.configuration.readers; import com.mongodb.MongoClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.configuration.annotation.StepScope; import org.springframework.batch.item.ItemStreamReader; import org.springframework.boot.autoconfigure.mongo.MongoProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import uk.ac.ebi.eva.accession.core.configuration.MongoConfiguration; import uk.ac.ebi.eva.accession.release.io.MergedVariantMongoReader; import uk.ac.ebi.eva.accession.release.parameters.InputParameters; import uk.ac.ebi.eva.commons.batch.io.UnwindingItemStreamReader; import uk.ac.ebi.eva.commons.core.models.pipeline.Variant; import static uk.ac.ebi.eva.accession.release.configuration.BeanNames.MERGED_VARIANT_READER; @Configuration @Import({MongoConfiguration.class}) public class MergedVariantMongoReaderConfiguration { private static final Logger logger = LoggerFactory.getLogger(MergedVariantMongoReaderConfiguration.class); @Bean(MERGED_VARIANT_READER) @StepScope public ItemStreamReader<Variant> unwindingReader(MergedVariantMongoReader mergedVariantMongoReader) { return new UnwindingItemStreamReader<>(mergedVariantMongoReader); } @Bean @StepScope MergedVariantMongoReader mergedVariantMongoReader(InputParameters parameters, MongoClient mongoClient, MongoProperties mongoProperties) { logger.info("Injecting MergedVariantMongoReader with parameters: {}", parameters); return new MergedVariantMongoReader(parameters.getAssemblyAccession(), mongoClient, mongoProperties.getDatabase(), parameters.getChunkSize()); } }
6a61b37957202fcaa9f98460d42c6e56313e28ae
b9a6beda6ec3da22a6e14158794de96701a9c271
/src/main/java/com/mykolabs/apple/pageobjects/InstructionsPage.java
11a33ec95b79c5ea78d5e45afa38a61c842e4701
[]
no_license
nikprix/webdriver-demo
e1ec716a16c1111ee72e47511001eea90365fc1f
a78d16499bfc9470b62e3e133c7a8a8fb3ab76f7
refs/heads/master
2021-01-20T14:18:51.427863
2017-05-25T04:52:54
2017-05-25T04:52:54
90,585,497
0
0
null
null
null
null
UTF-8
Java
false
false
260
java
package com.mykolabs.apple.pageobjects; /** * * @author nikprix */ public interface InstructionsPage { String INSTRUCTIONS_PAGE_TITLE = "Unsubscribing from Apple email subscriptions - Apple Support"; void loadEmailSubscriptions(); }
e538953357243685d224bbcf257226961d86557f
de4c47f20dd597da1d42e9b1c4355e26d92bdb02
/src/main/java/com/smart/aspectj/fun/Waiter.java
6990eb42d1310ff3ab8d20f3d696d58c7c48c115
[]
no_license
leozhiyu/spring
513f0982cc47c9a130931cc07adc1f7fe4b25cb4
efcf69add3a914194d49e96554e0db664b57f458
refs/heads/master
2020-03-21T04:10:48.287006
2018-06-24T11:47:24
2018-06-24T11:47:24
138,095,207
0
0
null
null
null
null
UTF-8
Java
false
false
180
java
package com.smart.aspectj.fun; import com.smart.aspectj.anno.NeedTest; public interface Waiter { @NeedTest void greetTo(String clientName); void serveTo(String clientName); }
7fb2c41b4cee5930157ba4f6bfcbe3ede227b7f2
a63f73a0c0be8bbb7b9b591769b2a5ad26779c9d
/Ex3/Q4Test.java
b1eaf8bf5767b8bff6743c108014a19d9bf2a340
[]
no_license
ItamarAsulin/JAVA-Intro-Assignments
8517e22e24cbb1f212eb8794e52891c456be63eb
4078ede25a01960a7990b7ef15e98f611840e49c
refs/heads/main
2023-02-26T15:42:34.157299
2021-01-30T12:11:34
2021-01-30T12:11:34
334,167,489
0
0
null
null
null
null
UTF-8
Java
false
false
616
java
package ex3; import org.junit.jupiter.api.Test; import java.util.Arrays; import static org.junit.jupiter.api.Assertions.*; class Q4Test { @Test void sumOfNeighboursTest() { int[][] mat = {{3,5,7,5},{-4,2,10,11},{9,-50,3,60}}; int[][] summedMat = Q4.sumOfNeighbours(mat); int [][] expectedResult = {{3, 18, 33, 28}, {-31, -17, 43, 85}, {-52, 20, 33, 24}}; for (int i = 0; i < expectedResult.length; i++) { for (int j = 0; j < expectedResult[i].length ; j++) { assertEquals(summedMat[i][j], expectedResult[i][j]); } } } }
7ddc9494659fe654390c37d31d8a5378f2b7a087
3556f83a930b05526a8e4356c2d95dab5e94a22b
/src/main/java/org/ssh/pm/common/webservice/rs/server/impl/HzWebServiceImpl.java
d721a84af84c46e036dad50a3e39f9cf8c91ad4e
[]
no_license
yangjiandong/sshapp-mobileServer
2b2893a962fabde67b954b29dcf6c3e49fd4f147
e60b2135265187afc812ed3552e6c975823b1eaa
refs/heads/master
2023-04-28T01:14:15.817459
2012-08-17T00:31:47
2012-08-17T00:31:47
4,972,064
1
0
null
2023-04-14T20:07:46
2012-07-10T09:53:46
Java
UTF-8
Java
false
false
3,678
java
package org.ssh.pm.common.webservice.rs.server.impl; import java.util.List; import javax.jws.WebService; import org.dozer.DozerBeanMapper; import org.hibernate.ObjectNotFoundException; import org.perf4j.StopWatch; import org.perf4j.aop.Profiled; import org.perf4j.slf4j.Slf4JStopWatch; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.Assert; import org.ssh.pm.common.webservice.rs.server.HzWebService; import org.ssh.pm.common.webservice.rs.server.WsConstants; import org.ssh.pm.common.webservice.rs.server.dto.HzDTO; import org.ssh.pm.common.webservice.rs.server.result.GetAllHzResult; import org.ssh.pm.common.webservice.rs.server.result.GetHzResult; import org.ssh.pm.common.webservice.rs.server.result.WSResult; import org.ssh.sys.entity.Hz; import org.ssh.sys.service.HzService; import com.google.common.collect.Lists; /** * HzWebService服务端实现类. * * @author yangjiandong */ //serviceName与portName属性指明WSDL中的名称, endpointInterface属性指向Interface定义类. @WebService(serviceName = "HzService", portName = "HzServicePort", endpointInterface = "org.ssh.pm.common.webservice.rs.server.HzWebService", targetNamespace = WsConstants.NS) public class HzWebServiceImpl implements HzWebService { private static Logger logger = LoggerFactory.getLogger(HzWebServiceImpl.class); @Autowired private HzService hzService; @Autowired private DozerBeanMapper dozer; @Override @Profiled(tag = "GetAllHzResult") public GetAllHzResult getAllHz() { try { List<Hz> allHzList = this.hzService.getAllHzOnMethodCache(); List<HzDTO> allHzDTOList = Lists.newArrayList(); for (Hz hz : allHzList) { allHzDTOList.add(dozer.map(hz, HzDTO.class)); } GetAllHzResult result = new GetAllHzResult(); result.setHzList(allHzDTOList); return result; } catch (RuntimeException e) { logger.error(e.getMessage(), e); return WSResult.buildDefaultErrorResult(GetAllHzResult.class); } } @Override public GetHzResult getHz(String hz) { StopWatch totalStopWatch = new Slf4JStopWatch(); //校验请求参数 try { Assert.notNull(hz, "hz参数为空"); } catch (IllegalArgumentException e) { logger.error(e.getMessage()); return WSResult.buildResult(GetHzResult.class, WSResult.PARAMETER_ERROR, e.getMessage()); } //获取用户 try { StopWatch dbStopWatch = new Slf4JStopWatch("GetHzResult.fetchDB"); Hz oneHz = this.hzService.getHz(hz); dbStopWatch.stop(); HzDTO dto = dozer.map(oneHz, HzDTO.class); GetHzResult result = new GetHzResult(); result.setHz(dto); totalStopWatch.stop("GerHz.total.success"); return result; } catch (ObjectNotFoundException e) { String message = "用户不存在(id:" + hz + ")"; logger.error(message, e); totalStopWatch.stop("GerHz.total.failure"); return WSResult.buildResult(GetHzResult.class, WSResult.PARAMETER_ERROR, message); } catch (RuntimeException e) { logger.error(e.getMessage(), e); totalStopWatch.stop("GerHz.total.failure"); return WSResult.buildDefaultErrorResult(GetHzResult.class); } } }
70bffbac85b543b98dd8f6e88117fdbd4c673773
5b4d8bbbc2d5fc8355cfb1d6f31e32f2c6354ac0
/app/src/main/java/com/niupai_xxr_lqtj/myui/view/RecyclerViewBaseOnPullToRefresh.java
7e40a75c5fc29d0490489b6ee5087d2422fbfa66
[]
no_license
heroxu/Final_Project_Xxr
0218530e717e1024c57f38e3739904aa9abee760
d62cad2150cf3f8dcc53bf419b19e3865f75703f
refs/heads/master
2023-05-01T12:28:14.578026
2016-05-14T05:17:32
2016-05-14T05:17:32
58,790,076
1
1
null
null
null
null
UTF-8
Java
false
false
1,897
java
package com.niupai_xxr_lqtj.myui.view; /** * Created by xuxiarong on 16/5/5. */ import android.content.Context; import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; import android.view.View; import com.handmark.pulltorefresh.library.PullToRefreshBase; public class RecyclerViewBaseOnPullToRefresh extends PullToRefreshBase<RecyclerView> { public RecyclerViewBaseOnPullToRefresh(Context context) { super(context); } public RecyclerViewBaseOnPullToRefresh(Context context, AttributeSet attrs) { super(context, attrs); } public RecyclerViewBaseOnPullToRefresh(Context context, Mode mode) { super(context, mode); } public RecyclerViewBaseOnPullToRefresh(Context context, Mode mode, AnimationStyle animStyle) { super(context, mode, animStyle); } //重写4个方法 //1 滑动方向 @Override public Orientation getPullToRefreshScrollDirection() { return Orientation.VERTICAL; } //重写4个方法 //2 滑动的View @Override protected RecyclerView createRefreshableView(Context context, AttributeSet attrs) { RecyclerView view = new RecyclerView(context, attrs); return view; } //重写4个方法 //3 是否滑动到底部 @Override protected boolean isReadyForPullEnd() { View view = getRefreshableView().getChildAt(getRefreshableView().getChildCount() - 1); if (null != view) { return getRefreshableView().getBottom() >= view.getBottom(); } return false; } //重写4个方法 //4 是否滑动到顶部 @Override protected boolean isReadyForPullStart() { View view = getRefreshableView().getChildAt(0); if (view != null) { return view.getTop() >= getRefreshableView().getTop(); } return false; } }
a01a0f7d56a23b976508ea2d85d943bc71a19163
e85236402ee7e29535ba5ac6a2f7ba81b6d0c183
/technology_code/admin-plus/admin-core/src/main/java/com/finance/core/act/service/impl/ActicleServiceImpl.java
d9bec52cf1a503a23b336f952f4d8cdf2b331fdf
[ "Apache-2.0" ]
permissive
xiaotaowei1992/Working
78f95c06c6cf59247ede22a8ad4e1d3dea674bf1
b311ef4bd67af1c5be63b82cd662f7f7bfbdfaaf
refs/heads/master
2022-12-11T00:19:47.003256
2019-07-19T03:06:46
2019-07-19T03:06:46
136,190,476
0
0
null
2022-12-06T00:43:03
2018-06-05T14:33:12
Java
UTF-8
Java
false
false
2,620
java
package com.finance.core.act.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.finance.common.constant.ApiResultEnum; import com.finance.common.constant.Result; import com.finance.common.dto.PageDto; import com.finance.common.exception.TryAgainException; import com.finance.core.act.entity.Acticle; import com.finance.core.act.mapper.ActicleMapper; import com.finance.core.act.service.IActicleService; import com.finance.core.aspect.IsTryAgain; import org.springframework.stereotype.Service; import javax.servlet.http.HttpSession; /** * <p> * 服务实现类 * </p> * * @author rstyro * @since 2019-03-26 */ @Service public class ActicleServiceImpl extends ServiceImpl<ActicleMapper, Acticle> implements IActicleService{ @Override public Result getList(PageDto dto) throws Exception { IPage<Acticle> page = new Page<>(); if(dto.getPageNo() != null){ page.setCurrent(dto.getPageNo()); } if(dto.getPageSize() != null){ page.setSize(dto.getPageSize()); } QueryWrapper<Acticle> queryWrapper = new QueryWrapper(); // if(!StringUtils.isEmpty(dto.getKeyword())){ // queryWrapper.lambda() // .like(Acticle::getAuther,dto.getKeyword()) // .like(Acticle::getContent,dto.getKeyword()) // .like(Acticle::getTitle,dto.getKeyword()); // } IPage<Acticle> iPage = this.page(page, queryWrapper); return Result.ok(iPage); } @Override public Result add(Acticle item, HttpSession session) throws Exception { this.save(item); return Result.ok(); } /** * 更新失败就重试 * @param item * @param session * @return * @throws Exception */ @IsTryAgain public Result edit(Acticle item, HttpSession session) throws Exception { if(!this.updateById(item)){ throw new TryAgainException(ApiResultEnum.ERROR); } return Result.ok(); } @Override public Result del(Long id, HttpSession session) throws Exception { this.removeById(id); return Result.ok(); } @Override public Result getDetail(Long id) throws Exception { Acticle item = this.getOne(new QueryWrapper<Acticle>().lambda().eq(Acticle::getId,id)); return Result.ok(item); } }
5221438602f75a6bc7f5c32eca3a510cfa5d7c4f
6224ededa3950f9f6245c5564ab693d51c3e30ba
/dönüştürücü/app/src/test/java/com/ma/MiniProje_Donusturucu/ExampleUnitTest.java
8a3f302928bb46185049fd293bfcf08228c91654
[]
no_license
klonesa/AndroidProjeler
8ecd803911fab494a3b2a9472b507ccd68407e7f
311daebb4fcef0761dc2745d755f726700bc7174
refs/heads/master
2023-02-05T12:05:17.498164
2020-12-25T09:47:32
2020-12-25T09:47:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
389
java
package com.ma.MiniProje_Donusturucu; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
52d6eda50a85b3611b207228743c7f8a31e55176
762ee945a7842465e29344921aa8f53a5e42ad36
/src/main/java/com/example/test/moder/User.java
4f47ea25cd8dfead68293396018e6c27bbd5d8b7
[]
no_license
zhuzhiwenzzw/zzw-springboot
a0ec59f7df7b53a29e892278ba949904dedc17bd
473b66616298b5a06d1b04ef60ffa2dcf7ee14f9
refs/heads/master
2020-08-28T22:49:17.504122
2019-10-27T15:41:59
2019-10-27T15:41:59
217,844,255
0
0
null
null
null
null
UTF-8
Java
false
false
1,078
java
package com.example.test.moder; import javax.persistence.*; @Entity @Table(name = "t_user") public class User { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; private String username; private String password; private int age; 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 String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } @Override public String toString() { return "User{" + "id=" + id + ", username='" + username + '\'' + ", password='" + password + '\'' + ", age=" + age + '}'; } }
a1f6b410bebc88fd8690ce7d810805fbfef17b29
16a2d81173489185c41c73d7ac463dcd90081539
/basic java/logic1.java
6b6edbe327c1bc45bf8e8c37c3a36a4a067fe9b1
[]
no_license
bmansk8/random-java-txt-files
6dc08c6f21e1818a5097345d4f5f179b318d14c1
3077a1a21d10befa7069ba1ce7633c3d11b32809
refs/heads/master
2020-05-30T08:00:18.760678
2019-05-31T14:52:56
2019-05-31T14:52:56
189,610,102
0
0
null
null
null
null
UTF-8
Java
false
false
431
java
import java.util.Scanner; public class logic1 { public static void main (String[] args){ System.out.println("hi can u drive? <true/false>"); Scanner scan = new Scanner(System.in); boolean answear = scan.nextBoolean(); if(answear == true){ System.out.println("take me to yolo ville"); }else{ System.out.println("k dont take me to yolo ville"); } } }
dae379e81d3c45609b872ac572af53a11a836fd3
a4e456c0d748a4a6717b18be3ed1bbea511e35a4
/src/main/java/com/yusei/model/dto/SubFieldDto.java
5cea199448016cf564b72415927dba0b24ebe2ce
[]
no_license
lutwwp/my-custom-flow
cf1da13e9e9c3c92fd4b8f0870797180df5af783
5eb4a0e8f9ae85e1bb3fe8208e04f2e6d5f5b889
refs/heads/master
2023-06-02T10:26:35.533546
2021-06-24T04:21:38
2021-06-24T04:21:38
379,801,731
0
0
null
null
null
null
UTF-8
Java
false
false
1,236
java
package com.yusei.model.dto; import com.fasterxml.jackson.annotation.JsonFormat; import com.yusei.model.param.ExtendDataParam; import com.yusei.model.param.ExtendRuleParam; import com.yusei.model.param.LinkFilterAddParam; import lombok.Data; import java.util.List; /** * @author liuqiang * @TOTD * @date 2020/9/2 18:03 */ @Data public class SubFieldDto { @JsonFormat(shape = JsonFormat.Shape.STRING) private Long fieldId; @JsonFormat(shape = JsonFormat.Shape.STRING) private Long formId; private String fieldCode; private String fieldName; private String fieldType; @JsonFormat(shape = JsonFormat.Shape.STRING) private Long linkFormId; private String linkFormName; @JsonFormat(shape = JsonFormat.Shape.STRING) private Long linkFieldId; private String linkFieldName; private String defaultValueType; private String defaultValue; private Boolean necessary; private Boolean allowRepeated; private Boolean showField; private Boolean editField; private List<LinkFieldDetailDto> linkFields; private List<LinkFilterDetailDto> linkFilters; private List<ExtendDataDto> extendDatas; private List<ExtendRuleDto> extendRules; }
3a9a0273d30b4ae08728c392d4f9eaff19283564
868ff684c4981f0608c1f2ff9f36e9433464cb37
/src/client/Client.java
8caf052b127f80239c706020d0242c924299b94d
[]
no_license
Obsir/ChatRoom
f9bc960fc5e596f714abae901fc8ff173f3cd8f2
6c8fb59edf030d43cfb90b70752b2180d68969af
refs/heads/master
2021-01-20T13:50:06.283990
2017-05-07T12:23:42
2017-05-07T12:23:42
90,529,688
1
0
null
null
null
null
UTF-8
Java
false
false
12,329
java
package client; import bean.User; import listener.MessageListener; import protocol.Protocol; import utils.Utils; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.*; import java.net.Socket; /** * Created by Obser on 2017/5/2. */ public class Client { private JTextArea textArea; private JTextField textField; private JTextField txt_port; private JTextField txt_hostIp; private JButton btn_start; private JButton btn_stop; private JButton btn_send; private DefaultListModel listModel; private JList userList; private JPanel northPanel; private JScrollPane rightScroll; private JPanel southPanel; private JScrollPane leftScroll; private JSplitPane centerSplit; private JFrame frame; private boolean isConnected; private Socket socket; private PrintWriter out; private BufferedReader in; private MessageThread messageThread; private User user; private JComboBox<String> comboBox; private static final String ALL = "所有人"; private MessageListener messageListener; public Client(User user, MessageThread messageThread){ initData(user, messageThread); initView(); initListener(); } private void initData(User user, MessageThread messageThread){ isConnected = true; this.user = user; this.messageThread = messageThread; this.in = messageThread.getIn(); this.out = messageThread.getOut(); this.socket = messageThread.getSocket(); } private void initView() { textArea = new JTextArea(); textArea.setEnabled(false); textField = new JTextField(); txt_port = new JTextField("6666"); txt_hostIp = new JTextField("127.0.0.1"); btn_start = new JButton("连接"); btn_stop = new JButton("断开"); btn_send = new JButton("发送"); listModel = new DefaultListModel(); userList = new JList(listModel); comboBox = new JComboBox<>(); comboBox.addItem(ALL); refreshButton(!isConnected); northPanel = new JPanel(); northPanel.setLayout(new GridLayout(1, 7)); northPanel.add(new JLabel("端口")); northPanel.add(txt_port); northPanel.add(new JLabel("服务器IP")); northPanel.add(txt_hostIp); northPanel.add(btn_start); northPanel.add(btn_stop); northPanel.setBorder(BorderFactory.createTitledBorder("连接信息")); rightScroll = new JScrollPane(textArea); rightScroll.setBorder(BorderFactory.createTitledBorder("消息显示区")); leftScroll = new JScrollPane(userList); leftScroll.setBorder(BorderFactory.createTitledBorder("在线用户")); southPanel = new JPanel(new BorderLayout()); southPanel.add(comboBox, BorderLayout.WEST); southPanel.add(textField, BorderLayout.CENTER); southPanel.add(btn_send, BorderLayout.EAST); southPanel.setBorder(BorderFactory.createTitledBorder("写消息")); centerSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftScroll, rightScroll); centerSplit.setDividerLocation(100); frame = new JFrame(user.getName()); frame.setLayout(new BorderLayout()); frame.add(northPanel, BorderLayout.NORTH); frame.add(centerSplit, BorderLayout.CENTER); frame.add(southPanel, BorderLayout.SOUTH); frame.setSize(600, 400); int screen_width = Toolkit.getDefaultToolkit().getScreenSize().width; int screen_height = Toolkit.getDefaultToolkit().getScreenSize().height; frame.setLocation((screen_width - frame.getWidth()) / 2, (screen_height - frame.getHeight()) / 2); frame.setVisible(true); } private void initListener() { messageListener = new MessageListener() { @Override public void onReceiveAll(Protocol.Message message) { appendText("\t" + message.getTime() + "\r\n"); appendText("[所有人] " + message.getName() + " 说:\r\n" + message.getMessage() + "\r\n"); } @Override public void onClose() throws Exception { close(); appendText("服务器已关闭!\r\n"); } @Override public void onConnect(Protocol.Message message) { appendText("与端口号为:" + txt_port.getText().trim() + " IP地址为:" + txt_hostIp.getText().trim() + "的服务器连接成功!" + "\r\n"); listModel.removeAllElements(); } @Override public void onReceiveList(Protocol.Message message) { refreshListModel(message); } @Override public void onReceivePrivate(Protocol.Message message, boolean flag) { appendText("\t" + message.getTime() + "\r\n"); if(flag) appendText("[悄悄话] " + message.getName() + " 对 你 说:\r\n" + message.getMessage() + "\r\n"); else appendText("[悄悄话] 你 对 " +message.getToUser() + " 说:\r\n" + message.getMessage() + "\r\n"); } @Override public void onFailed(Protocol.Message message) { } }; messageThread.setMessageListener(messageListener); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { if(isConnected){ try { closeConnection();//关闭连接 } catch (Exception e1) { e1.printStackTrace(); } } System.exit(0); } }); btn_start.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int port; try{ try{ port = Integer.parseInt(txt_port.getText().trim()); } catch(NumberFormatException e1){ throw new Exception("端口号不符合要求!端口号为整数"); } String hostIp = txt_hostIp.getText().trim(); if(Utils.isEmpty(hostIp)){ throw new Exception("服务器IP不能为空!"); } connectServer(port, hostIp); //反馈 } catch (Exception exc){ JOptionPane.showMessageDialog(frame, exc.getMessage(), "错误", JOptionPane.ERROR_MESSAGE); } refreshButton(!isConnected); } }); btn_stop.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try{ closeConnection();//断开连接 }catch (Exception exc){ JOptionPane.showMessageDialog(frame, exc.getMessage(), "错误", JOptionPane.ERROR_MESSAGE); } refreshButton(!isConnected); } }); //写消息的文本框中按回车键时事件 textField.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if(comboBox.getSelectedItem().equals(ALL)){ send("", Protocol.MSG_ALL); } else { send((String)comboBox.getSelectedItem(), Protocol.MSG_PRIVATE_TO); } } }); //单击发送按钮时事件 btn_send.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if(comboBox.getSelectedItem().equals(ALL)) send("", Protocol.MSG_ALL); else send((String) comboBox.getSelectedItem(), Protocol.MSG_PRIVATE_TO); } }); } /** * 客户端断开连接 * @throws Exception */ private void closeConnection() throws Exception{ Protocol.Message message = new Protocol.Message(Protocol.CLOSE); sendMessage(Protocol.packMessage(message));//发送断开连接的命令给服务器 close(); } /** * 断开连接 * @throws Exception */ private synchronized void close() throws Exception{ try{ // messageThread.stop();//停止接收消息的线程 messageThread.setFlag(false);//停止接收消息的线程 //释放资源 if(in != null){ in.close(); } if(out != null){ out.close(); } if(socket != null){ socket.close(); } isConnected = false; listModel.removeAllElements(); } catch (IOException e1){ e1.printStackTrace(); isConnected = true; throw new Exception("断开连接发生异常!"); } finally { refreshButton(!isConnected); } } /** * 发送消息 * @param message */ private void sendMessage(String message) { out.println(message); out.flush(); } /** * 执行发送 */ private void send(String toUser, String id){ if(!isConnected){ JOptionPane.showMessageDialog(frame, "还没有连接服务器,无法发送消息", "错误", JOptionPane.ERROR_MESSAGE); return ; } String message = textField.getText().trim(); if(Utils.isEmpty(message)){ return ; } Protocol.Message msg = new Protocol.Message(user.getName(), user.getIp(), toUser, message, id); sendMessage(Protocol.packMessage(msg)); textField.setText(""); } /** * 连接服务器 * @param port 端口号 * @param hostIp 主机地址 * @throws Exception */ public void connectServer(int port, String hostIp) throws Exception{ try { socket = new Socket(hostIp, port);//根据端口号和服务器ip建立连接 in = new BufferedReader(new InputStreamReader(socket.getInputStream())); out = new PrintWriter(socket.getOutputStream()); //发送客户端基本用户信息 Protocol.Message message = new Protocol.Message(user.getName(), user.getIp(), Protocol.INIT); message.setPassword(user.getPassword()); sendMessage(Protocol.packMessage(message)); //开启接收消息的线程 messageThread = new MessageThread(in, out, socket); messageThread.setMessageListener(messageListener); messageThread.start(); isConnected = true;//已经连接上 } catch (IOException e) { isConnected = false;//未连接上 appendText("与端口号为:" + port + " IP地址为:" + hostIp + "的服务器连接失败!" + "\r\n"); throw new Exception("与服务器连接失败!"); } } /** * 更新textArea * @param text */ private void appendText(String text){ textArea.append(text); textArea.setCaretPosition(textArea.getText().length()); } /** * 刷新列表 * @param message */ private void refreshListModel(Protocol.Message message){ listModel.removeAllElements(); comboBox.removeAllItems(); comboBox.addItem(ALL); for(String name : message.getNameList()){ listModel.addElement(name); if(name.equals(user.getName())) continue; comboBox.addItem(name); } } /** * 刷新按钮 * @param flag */ private void refreshButton(boolean flag){ btn_start.setEnabled(flag); btn_stop.setEnabled(!flag); txt_hostIp.setEnabled(flag); txt_port.setEnabled(flag); } }
c1ba80dd8f8e8b298b70d80e9c09c16ddd8a7dd9
761e5c89536bc8e30fb5f0c3a280cd03e95620c9
/src/com/xinyuan/dao/CardsDAO.java
4d36e18dbee442ec45ffbc35a1215afbcdbd88c1
[]
no_license
suchavision/ERPWebServer
81c86f9b44c19ff6566040bd49c45363e1f27d9e
b53b440ff48bf9954c2a7f57ad3c4460b8d30a34
refs/heads/master
2021-01-10T19:59:41.544377
2014-11-21T07:18:14
2014-11-21T07:18:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
57
java
package com.xinyuan.dao; public interface CardsDAO { }
0db93fc905d65c0392b7627a2cf31b52faf497d5
f83a867eba9bad28bd31b746f05f86480d8c7155
/src/gfg/stringclass/stringToInt.java
11b16f249102caf33766489eb49a811cd3196961
[]
no_license
shekhar88085/java1
25f3654584648788ebebb365ff7342fc10338392
2432d7dd5aa4e3ae54881e6bc15bdd4c799d5d63
refs/heads/master
2023-02-26T03:11:06.651570
2021-02-03T04:54:43
2021-02-03T04:54:43
335,511,028
0
0
null
null
null
null
UTF-8
Java
false
false
490
java
package gfg.stringclass; import static java.lang.System.*; public class stringToInt { public static void main(String [] dd){ String s="1234"; //using Integer.parseInt(String); int sa=Integer.parseInt(s); System.out.println(sa); //radix sa=Integer.parseInt(s,16); System.out.println(sa); //using Integer.valueOf(String); sa=Integer.valueOf(s); System.out.println(sa); out.println("wdfghj"); } }
baa1495758a0becd538e3edc0d1b7823ed47b677
62e334192393326476756dfa89dce9f0f08570d4
/ztk_code/ztk-arena-parent/arena-dubbo-api/src/main/java/com/huatu/ztk/arena/dubbo/ArenaDubboService.java
1b8e42654d90c048165f193948850cecb0363e36
[]
no_license
JellyB/code_back
4796d5816ba6ff6f3925fded9d75254536a5ddcf
f5cecf3a9efd6851724a1315813337a0741bd89d
refs/heads/master
2022-07-16T14:19:39.770569
2019-11-22T09:22:12
2019-11-22T09:22:12
223,366,837
1
2
null
2022-06-30T20:21:38
2019-11-22T09:15:50
Java
UTF-8
Java
false
false
497
java
package com.huatu.ztk.arena.dubbo; import com.huatu.ztk.arena.bean.ArenaRoom; import org.springframework.data.mongodb.core.query.Update; /** * Created by shaojieyue * Created time 2016-10-08 19:57 */ public interface ArenaDubboService { /** * 根据id查询房间 * @param id * @return */ ArenaRoom findById(long id); /** * 根据id 更新指定房间的数据 * @param id * @param update */ void updateById(long id, Update update); }
289940a20b878890ad861114bc1992f3e3ed6ce6
66bf7a7cfeaf5a8c6042d97e3f739af49a7bac2d
/Test1/src/com/zsy/frame/lib/net/http/volley/toolbox/Authenticator.java
5d6adbe89fe2ca799aca6bb6438db63efcc38542
[]
no_license
shengyouzhang/test1
f82b13c6abca36dd286041b30df94aed02cbc5a7
739d11cb449b4a3fcef96b9665048458254e6963
refs/heads/master
2020-04-14T11:47:48.051788
2015-03-16T15:13:07
2015-03-16T15:13:07
31,312,684
0
0
null
null
null
null
UTF-8
Java
false
false
1,091
java
/* * Copyright (C) 2011 The Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.zsy.frame.lib.net.http.volley.toolbox; import com.zsy.frame.lib.net.http.volley.AuthFailureError; /** * An interface for interacting with auth tokens. */ public interface Authenticator { /** * Synchronously retrieves an auth token. * * @throws AuthFailureError If authentication did not succeed */ public String getAuthToken() throws AuthFailureError; /** * Invalidates the provided auth token. */ public void invalidateAuthToken(String authToken); }
4b1030589f460387f2fa1e95c758fa41ee152956
c299e4ddf144b7281789f79df38308d1809cc1d1
/app/src/main/java/com/example/webtextselect/MainActivity.java
5690b8d8047dd0bd074234e33f70c66a8e7f9612
[]
no_license
deaboway/AndroidWebViewTextSelect
0b7d2060c02061c2e2c31abed2c23eea2412ef11
4fd24db1a4a35864bb4deb10722e8e71476cfe03
refs/heads/master
2021-08-29T16:15:57.895242
2017-12-14T09:15:41
2017-12-14T09:15:41
114,217,756
4
0
null
null
null
null
UTF-8
Java
false
false
995
java
package com.example.webtextselect; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
db9b219f29d78f182a33587516f8a97cc5430fe6
e5107dc23b7fdede75f72d2df8da9e4684086cd9
/Iteracion3/Implementación/Diaketas/src/Visual/AniadirSolicitante.java
0c032e78eee9f995090cf49f07dc1189ea45aa22
[]
no_license
olmo/ISIII
083e85187534581b02cc67bd4251849e0f312d57
271a61a2d40517ce791fb9f40187fde8e86d2bfa
refs/heads/master
2021-01-22T05:21:04.519705
2012-06-10T20:47:12
2012-06-10T20:47:12
3,629,810
1
1
null
null
null
null
UTF-8
Java
false
false
9,267
java
package Visual; import java.awt.Choice; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.JCheckBox; import GestionOfertas.ControladorOfertas; import GestionPersona.Persona; import GestionPersona.PersonaDB; import GestionSolicitante.Solicitante.tipo_permiso; import GestionSolicitante.Solicitante.tipo_disp; public class AniadirSolicitante extends JPanel { private static final long serialVersionUID = 1L; private VentanaPrincipal padre; private PanelInicio ini; private JTextField txtDNI; private JTextField txtnombre; private JTextField txtfechanac; private JTextField txtcodpostal; private JTextField txtemail; private JTextField txtapellidos; private JTextField txtlugarnac; private JTextField txtdireccion; private JTextField txttelefono; private JTextField txtestudios; private JTextField txtexperiencia; private JTextField txttiempoincor; private JTextArea txtcurriculum; private JTextField txtapellidos2; private Choice textpermisoconduc; private JCheckBox checkVehiculo; private Choice txtDisponibilidad; private ControladorOfertas controladorOfertas = new ControladorOfertas(); private Persona unaPersonaSolicitante; public AniadirSolicitante(VentanaPrincipal p, PanelInicio pIni) { this.ini = pIni; padre = p; setSize(PanelInicio.tamanoPaneles); setLayout(null); txtDNI = new JTextField(); txtDNI.setBounds(296, 82, 180, 20); add(txtDNI); txtDNI.setColumns(10); FocusListener listenerDNI = new FocusListener() { public void focusGained(FocusEvent e) { } public void focusLost(FocusEvent e) { unaPersonaSolicitante = new Persona(); unaPersonaSolicitante = PersonaDB.getDatos(txtDNI.getText()); if (unaPersonaSolicitante != null) cargarInfoPersona(); else cargarInfo(false); // no carga el dni } }; txtDNI.addFocusListener(listenerDNI); txtnombre = new JTextField(); txtnombre.setBounds(296, 113, 180, 20); add(txtnombre); txtnombre.setColumns(10); textpermisoconduc = new Choice(); textpermisoconduc.setBounds(296, 370, 180, 20); for (int i = 0; i < tipo_permiso.values().length; i++) textpermisoconduc.add(tipo_permiso.values()[i].toString()); add(textpermisoconduc); txtfechanac = new JTextField(); txtfechanac.setBounds(296, 144, 180, 20); add(txtfechanac); txtfechanac.setColumns(10); txtcodpostal = new JTextField(); txtcodpostal.setBounds(296, 216, 180, 20); add(txtcodpostal); txtcodpostal.setColumns(10); txtemail = new JTextField(); txtemail.setBounds(690, 216, 180, 20); add(txtemail); txtemail.setColumns(10); txtapellidos = new JTextField(); txtapellidos.setColumns(10); txtapellidos.setBounds(690, 82, 180, 20); add(txtapellidos); txtlugarnac = new JTextField(); txtlugarnac.setColumns(10); txtlugarnac.setBounds(690, 148, 180, 20); add(txtlugarnac); txtdireccion = new JTextField(); txtdireccion.setColumns(10); txtdireccion.setBounds(690, 185, 180, 20); add(txtdireccion); txtcurriculum = new JTextArea(); txtcurriculum.setBounds(690, 278, 372, 162); add(txtcurriculum); JLabel lblDNI = new JLabel("DNI"); lblDNI.setBounds(181, 85, 46, 14); add(lblDNI); JLabel lblNombre = new JLabel("Nombre"); lblNombre.setBounds(181, 116, 46, 14); add(lblNombre); JLabel lblFecha = new JLabel("Fecha nacimiento"); lblFecha.setBounds(181, 140, 89, 28); add(lblFecha); JLabel lblTelefono = new JLabel("Telefono"); lblTelefono.setBounds(181, 179, 46, 14); add(lblTelefono); JLabel lblcodpostal = new JLabel("C\u00F3digo postal"); lblcodpostal.setBounds(181, 219, 75, 14); add(lblcodpostal); JLabel lblemail = new JLabel("Email"); lblemail.setBounds(577, 219, 46, 14); add(lblemail); JLabel lblapellidos = new JLabel("Apellido 1"); lblapellidos.setBounds(577, 85, 46, 14); add(lblapellidos); JLabel lbllugarnac = new JLabel("Lugar nacimiento"); lbllugarnac.setBounds(577, 151, 89, 14); add(lbllugarnac); JLabel lbldir = new JLabel("Direcci\u00F3n"); lbldir.setBounds(577, 188, 46, 14); add(lbldir); JLabel lbltiempoincor = new JLabel("Tiempo Incorporaci\u00F3n"); lbltiempoincor.setBounds(577, 248, 103, 14); add(lbltiempoincor); JLabel lblcurriculum = new JLabel("Curriculum"); lblcurriculum.setBounds(577, 283, 61, 14); add(lblcurriculum); JButton btnVolver = new JButton("Volver"); btnVolver.setBounds(427, 482, 89, 23); add(btnVolver); JButton btnGuardar = new JButton("Guardar"); btnGuardar.setBounds(562, 482, 89, 23); add(btnGuardar); txttelefono = new JTextField(); txttelefono.setColumns(10); txttelefono.setBounds(296, 175, 180, 20); add(txttelefono); JLabel lblpermisocond = new JLabel("Permiso Conducir"); lblpermisocond.setBounds(181, 373, 89, 14); add(lblpermisocond); JLabel lblestudios = new JLabel("Estudios"); lblestudios.setBounds(181, 293, 60, 14); add(lblestudios); JLabel lblexperiencia = new JLabel("Experiencia"); lblexperiencia.setBounds(181, 324, 73, 14); add(lblexperiencia); txtestudios = new JTextField(); txtestudios.setColumns(10); txtestudios.setBounds(296, 290, 180, 20); add(txtestudios); txtexperiencia = new JTextField(); txtexperiencia.setColumns(10); txtexperiencia.setBounds(296, 321, 180, 20); add(txtexperiencia); JLabel lbldisponibilidad = new JLabel("Disponibilidad"); lbldisponibilidad.setBounds(181, 254, 89, 14); add(lbldisponibilidad); txttiempoincor = new JTextField(); txttiempoincor.setColumns(10); txttiempoincor.setBounds(691, 247, 180, 20); add(txttiempoincor); JLabel lblapellidos2 = new JLabel("Apellido 2"); lblapellidos2.setBounds(577, 116, 46, 14); add(lblapellidos2); txtapellidos2 = new JTextField(); txtapellidos2.setColumns(10); txtapellidos2.setBounds(690, 113, 180, 20); add(txtapellidos2); txtDisponibilidad = new Choice(); txtDisponibilidad.setBounds(296, 248, 180, 20); for (int i = 0; i < tipo_disp.values().length; i++) txtDisponibilidad.add(tipo_disp.values()[i].toString()); add(txtDisponibilidad); checkVehiculo = new JCheckBox("Veh\u00EDculo propio"); checkVehiculo.setBounds(181, 417, 103, 23); add(checkVehiculo); btnVolver.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ini.setPanelOnTab(ini.gestion_solicitante, PanelInicio.DEMANDAS); } }); btnGuardar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (!txtDNI.getText().isEmpty() && !txtnombre.getText().isEmpty() && !txtapellidos.getText().isEmpty() && !txtapellidos2.getText().isEmpty() && !txtfechanac.getText().isEmpty() && !txttelefono.getText().isEmpty() && !txtlugarnac.getText().isEmpty() && !txtdireccion.getText().isEmpty() && !txtcodpostal.getText().isEmpty() && !txtemail.getText().isEmpty() && !txtestudios.getText().isEmpty() && !txtexperiencia.getText().isEmpty() && !txtcurriculum.getText().isEmpty() && !txttiempoincor.getText().isEmpty()) { controladorOfertas.registrarSolicitante(txtDNI.getText(), txtnombre.getText(), txtapellidos.getText(), txtapellidos2.getText(), txtfechanac.getText(), Integer.parseInt(txttelefono.getText()), txtlugarnac.getText(), txtdireccion.getText(), Integer.parseInt(txtcodpostal.getText()), true, txtemail.getText(), txtestudios.getText(), txtexperiencia.getText(), txtcurriculum.getText(), tipo_permiso.values()[textpermisoconduc .getSelectedIndex()], checkVehiculo .isSelected(), tipo_disp.values()[txtDisponibilidad .getSelectedIndex()], Integer .parseInt(txttiempoincor.getText())); ini.gestion_solicitante.refrescar(); ini.setPanelOnTab(ini.gestion_solicitante, PanelInicio.DEMANDAS); } } }); } public void cargarInfo(boolean dni) { if (dni) txtDNI.setText(""); txtnombre.setText(""); // textpermisoconduc.select(); txtfechanac.setText(""); txtcodpostal.setText(""); txtemail.setText(""); txtapellidos.setText(""); txtlugarnac.setText(""); txtdireccion.setText(""); txtcurriculum.setText(""); txttelefono.setText(""); txtestudios.setText(""); txtexperiencia.setText(""); txttiempoincor.setText(""); txtapellidos2.setText(""); // txtDisponibilidad.select(); checkVehiculo.setSelected(false); } public void cargarInfoPersona() { txtnombre.setText(unaPersonaSolicitante.getNombre()); txtfechanac.setText(unaPersonaSolicitante.getfNacimiento()); txtcodpostal.setText(unaPersonaSolicitante.getCp().toString()); txtemail.setText(unaPersonaSolicitante.getemail()); txtapellidos.setText(unaPersonaSolicitante.getApellido1()); txtlugarnac.setText(unaPersonaSolicitante.getLugarNacimiento()); txtdireccion.setText(unaPersonaSolicitante.getDomicilio()); txttelefono.setText(unaPersonaSolicitante.getTelefono().toString()); txtapellidos2.setText(unaPersonaSolicitante.getApellido2()); } }
95acaea80db6cd921351befced6b437feead12b4
be4b91fda464ed768b20a0b6a7870b5cdcf36c37
/crazy-eights/src/test/java/student/crazyeights/GameEngineTest.java
e8a698c8f81b9693ca7604fc7f434df8a20fc5f8
[]
no_license
richwellp/Software-Design-Studio
d2337d73ba83c77f0c5a3f29a47523f7d044882a
2ebb69579846804c592a159e77a298ccdc295b54
refs/heads/master
2023-05-03T13:28:35.447335
2021-05-21T06:36:33
2021-05-21T06:36:33
369,434,874
1
0
null
null
null
null
UTF-8
Java
false
false
2,407
java
package student.crazyeights; import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import java.io.ByteArrayOutputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.logging.SimpleFormatter; import static org.junit.Assert.assertEquals; public class GameEngineTest { private List<Card> deck; private List<Card> gameDeck; private List<PlayerStrategy> players; private ByteArrayOutputStream outputStream; private GameEngine game; @Before public void setUp() { outputStream = new ByteArrayOutputStream(); players = new ArrayList<PlayerStrategy>(); game = new GameEngine(); SimplePlayer player1 = new SimplePlayer(); SimplePlayer player2 = new SimplePlayer(); ComplexPlayer player3 = new ComplexPlayer(); ComplexPlayer player4 = new ComplexPlayer(); players.add(player1); players.add(player2); players.add(player3); players.add(player4); deck = Card.getDeck(); game.setUpGame(players, outputStream); gameDeck = game.getGameDeck(); } @Test public void testCardShuffled() { boolean isShuffled = false; for (int i = 0; i < deck.size(); i++) { if (!gameDeck.get(i).equals(deck.get(i))) { isShuffled = true; break; } } Assert.assertTrue(isShuffled); } @Test public void testPlayerReceiveInitialCards() { boolean passed = true; for (Integer numberOfCards: game.getNumberOfPlayerCards()) { if (numberOfCards != 5) { passed = false; } } Assert.assertTrue(passed); } @Test public void testTournament() { String output = outputStream.toString(); game.playTournament(); Assert.assertThat(output, CoreMatchers.containsString("Tournament ended.")); } @Test public void testCheating() { String output = outputStream.toString(); game.playRound(); Assert.assertThat(output, CoreMatchers.containsString("Cheat")); } @Test public void testGame() { String output = outputStream.toString(); game.playGame(); Assert.assertThat(output, CoreMatchers.containsString("Game ended.")); } }
d931552de4aab59eb0b2a8007442d8db5b3fc666
4e08fcee1a748c31fd18fa49ea77acbba11db0e9
/src/testSpace/TestInfoSetSpecificByIndex_Insert.java
83615bbdf292e0bff3b255ab560b3611b993c8d5
[]
no_license
181847/DataStructCourseDesign2015
c695e67d7cf12900405a69e7b696a39c32e903b4
6f3ada5f941d881fe4ea68f49be8a6b12d6c6032
refs/heads/master
2020-05-27T13:22:19.002679
2018-01-26T02:31:03
2018-01-26T02:31:03
82,553,792
0
0
null
null
null
null
UTF-8
Java
false
false
658
java
package testSpace; import collegeComponent.tool.traverser.StudentTraverser; import info.InfoWithContainer; import info.infoTool.AllTrueFilter; import infoSet.InfoSetSpecificByIndex; public class TestInfoSetSpecificByIndex_Insert extends Test { public static void main(String[] args){ prepare(); InfoSetSpecificByIndex issbi = new InfoSetSpecificByIndex(); System.out.println(issbi.insertInfo(new InfoWithContainer(stus[0]))); System.out.println(issbi.insertInfo(new InfoWithContainer(stus[0]))); System.out.println(issbi.insertInfo(new InfoWithContainer(stus[5]))); issbi.traverseInfo(new StudentTraverser(), new AllTrueFilter()); } }
94b27f78c18f016b2fcd100d81858d42569b0ff0
6e6e5324f7060c202c4482c84caf93c23ec99c8f
/java/typecasting/src/com/ust_global/typecasting/refferenced/Pen.java
bea9f3411fcd7bda76b1fe972a3ea3cf5d7ac4fe
[]
no_license
Rehan-007/USTGlobal-16sept-19-anwar-rehan
f68a447f49f0577f60c1679a9d7296b08bd01bb3
7beb4f93fc880bc752313286f2dd23ebd11016a3
refs/heads/master
2023-01-11T18:59:10.545806
2019-12-22T03:57:08
2019-12-22T03:57:08
215,536,631
0
0
null
2023-01-07T13:03:10
2019-10-16T11:56:14
Java
UTF-8
Java
false
false
157
java
package com.ust_global.typecasting.refferenced; public class Pen { public int cost; void write() { System.out.println("pen write() method"); } }
bc8816ae65171b3f913d0a6409de306f65880797
73364c57427e07e90d66692a3664281d5113177e
/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/comparator/IntervalLowValueAscComparator.java
1696afdb8b1d158216879d00893cf8ca9a62180e
[ "BSD-3-Clause" ]
permissive
abyot/sun-pmt
4681f008804c8a7fc7a75fe5124f9b90df24d44d
40add275f06134b04c363027de6af793c692c0a1
refs/heads/master
2022-12-28T09:54:11.381274
2019-06-10T15:47:21
2019-06-10T15:47:21
55,851,437
0
1
BSD-3-Clause
2022-12-16T12:05:12
2016-04-09T15:21:22
Java
UTF-8
Java
false
false
2,080
java
package org.hisp.dhis.mapgeneration.comparator; /* * Copyright (c) 2004-2017, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * Neither the name of the HISP project nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import java.util.Comparator; import org.hisp.dhis.mapgeneration.Interval; /** * @author Lars Helge Overland */ public class IntervalLowValueAscComparator implements Comparator<Interval> { public static final IntervalLowValueAscComparator INSTANCE = new IntervalLowValueAscComparator(); @Override public int compare( Interval i1, Interval i2 ) { return new Double( i1.getValueLow() ).compareTo( new Double( i2.getValueLow() ) ); } }
fc191c45184ede5816f0acf55c5748cc23920914
b34a4472e08b3f98c64328e179cfe6f61f796843
/app/src/main/java/com/deploy/livesdk/com/microsoft/live/OAuthRequestObserver.java
4bd8d36eedf114291c0fb966e947058abb1dbbdb
[]
no_license
TechieSouls/gooday-android
40073c2e90034975df7f37ff5f08c56cf201a691
5756a677fdb86a720b9e0d1939b59d8adfe38754
refs/heads/master
2020-04-11T18:10:27.336540
2020-01-03T17:09:06
2020-01-03T17:09:06
161,988,496
0
0
null
null
null
null
UTF-8
Java
false
false
1,800
java
// ------------------------------------------------------------------------------ // Copyright (c) 2014 Microsoft Corporation // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // ------------------------------------------------------------------------------ package com.deploy.livesdk.com.microsoft.live; /** * An observer of an OAuth Request. It will be notified of an Exception or of a Response. */ interface OAuthRequestObserver { /** * Callback used on an exception. * * @param exception */ public void onException(LiveAuthException exception); /** * Callback used on a response. * * @param response */ public void onResponse(OAuthResponse response); }
c31af6d8ee4e1e97b62610b156fcc7894e726ad9
69d8f4ac55d544e73f72381504cc785fd6625729
/app/src/main/java/com/dihanov/musiq/ui/detail/detail_fragments/ArtistSpecificsBiography.java
136c03dbd0cdef24f99c4404c78af19330aeae2f
[ "LicenseRef-scancode-free-unknown", "Apache-2.0" ]
permissive
gabynnette/musiQ
82077ab3913ec2ae6a5b94c92204999c3e96d60a
a81f9c6e405bd30b9f42e66d85c4d47a215db09a
refs/heads/master
2020-03-17T23:43:07.624083
2018-05-19T12:17:17
2018-05-19T12:17:17
134,057,178
0
0
Apache-2.0
2018-05-19T12:15:23
2018-05-19T11:49:30
Java
UTF-8
Java
false
false
3,359
java
package com.dihanov.musiq.ui.detail.detail_fragments; import android.content.Context; import android.os.Bundle; import android.os.Handler; import android.support.annotation.Nullable; import android.text.Html; import android.text.method.LinkMovementMethod; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ProgressBar; import android.widget.TextView; import com.dihanov.musiq.R; import butterknife.BindView; import butterknife.ButterKnife; /** * Created by dimitar.dihanov on 9/29/2017. */ //this needs no presenter, because it is a simple fragment that only displays text public class ArtistSpecificsBiography extends ArtistSpecifics { public static final String TITLE = "biography"; @BindView(R.id.biography_progress_bar) ProgressBar progressBar; @BindView(R.id.artist_details_biography) TextView biographyTextView; private String biography; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRetainInstance(true); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(TITLE, this.biography); } public static ArtistSpecificsBiography newInstance(){ Bundle args = new Bundle(); ArtistSpecificsBiography artistDetailsBiographyFragment = new ArtistSpecificsBiography(); artistDetailsBiographyFragment.setArguments(args); return artistDetailsBiographyFragment; } @Override public void onAttach(Context context) { super.onAttach(context); if(this.biography == null){ this.biography = this.artistDetailsActivity.getArtistBiography(); } } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.artist_details_biography_fragment, container, false); ButterKnife.bind(this, view); progressBar.setVisibility(View.VISIBLE); Handler handler = new Handler(); new Thread(() -> { String modifiedBio = formatText(biography); handler.post(() -> { progressBar.setVisibility(View.GONE); biographyTextView.setText(Html.fromHtml(modifiedBio)); biographyTextView.setMovementMethod(LinkMovementMethod.getInstance()); }); }).run(); this.artistDetailsFragmentPresenter.takeView(this); return view; } private String formatText(String biography) { String result = biography; result = result.replaceAll("<a href=\"https://www.last.fm/music/Red\">Read more on Last.fm</a>. User-contributed text is available under the Creative Commons By-SA License; additional terms may apply.", "\n<a href=\"https://www.last.fm/music/Red\">Read more on Last.fm</a>. User-contributed text is available under the Creative Commons By-SA License; additional terms may apply."); result = result.replaceAll("\\n", "<br>"); return result; } public String getBiography() { return biography; } public void setBiography(String biography) { this.biography = biography; } }
3a9f055935b475e7d0702b8899a73542061af69a
995f73d30450a6dce6bc7145d89344b4ad6e0622
/DVC-AN20_EMUI10.1.1/src/main/java/android/animation/Keyframe.java
9e31f8e3f9703ba98321039d53b4a2a66fe0691f
[]
no_license
morningblu/HWFramework
0ceb02cbe42585d0169d9b6c4964a41b436039f5
672bb34094b8780806a10ba9b1d21036fd808b8e
refs/heads/master
2023-07-29T05:26:14.603817
2021-09-03T05:23:34
2021-09-03T05:23:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,884
java
package android.animation; public abstract class Keyframe implements Cloneable { float mFraction; boolean mHasValue; private TimeInterpolator mInterpolator = null; Class mValueType; boolean mValueWasSetOnStart; @Override // java.lang.Object public abstract Keyframe clone(); public abstract Object getValue(); public abstract void setValue(Object obj); public static Keyframe ofInt(float fraction, int value) { return new IntKeyframe(fraction, value); } public static Keyframe ofInt(float fraction) { return new IntKeyframe(fraction); } public static Keyframe ofFloat(float fraction, float value) { return new FloatKeyframe(fraction, value); } public static Keyframe ofFloat(float fraction) { return new FloatKeyframe(fraction); } public static Keyframe ofObject(float fraction, Object value) { return new ObjectKeyframe(fraction, value); } public static Keyframe ofObject(float fraction) { return new ObjectKeyframe(fraction, null); } public boolean hasValue() { return this.mHasValue; } /* access modifiers changed from: package-private */ public boolean valueWasSetOnStart() { return this.mValueWasSetOnStart; } /* access modifiers changed from: package-private */ public void setValueWasSetOnStart(boolean valueWasSetOnStart) { this.mValueWasSetOnStart = valueWasSetOnStart; } public float getFraction() { return this.mFraction; } public void setFraction(float fraction) { this.mFraction = fraction; } public TimeInterpolator getInterpolator() { return this.mInterpolator; } public void setInterpolator(TimeInterpolator interpolator) { this.mInterpolator = interpolator; } public Class getType() { return this.mValueType; } static class ObjectKeyframe extends Keyframe { Object mValue; ObjectKeyframe(float fraction, Object value) { this.mFraction = fraction; this.mValue = value; this.mHasValue = value != null; this.mValueType = this.mHasValue ? value.getClass() : Object.class; } @Override // android.animation.Keyframe public Object getValue() { return this.mValue; } @Override // android.animation.Keyframe public void setValue(Object value) { this.mValue = value; this.mHasValue = value != null; } @Override // android.animation.Keyframe, android.animation.Keyframe, java.lang.Object public ObjectKeyframe clone() { ObjectKeyframe kfClone = new ObjectKeyframe(getFraction(), hasValue() ? this.mValue : null); kfClone.mValueWasSetOnStart = this.mValueWasSetOnStart; kfClone.setInterpolator(getInterpolator()); return kfClone; } } static class IntKeyframe extends Keyframe { int mValue; IntKeyframe(float fraction, int value) { this.mFraction = fraction; this.mValue = value; this.mValueType = Integer.TYPE; this.mHasValue = true; } IntKeyframe(float fraction) { this.mFraction = fraction; this.mValueType = Integer.TYPE; } public int getIntValue() { return this.mValue; } @Override // android.animation.Keyframe public Object getValue() { return Integer.valueOf(this.mValue); } @Override // android.animation.Keyframe public void setValue(Object value) { if (value != null && value.getClass() == Integer.class) { this.mValue = ((Integer) value).intValue(); this.mHasValue = true; } } @Override // android.animation.Keyframe, android.animation.Keyframe, java.lang.Object public IntKeyframe clone() { IntKeyframe kfClone; if (this.mHasValue) { kfClone = new IntKeyframe(getFraction(), this.mValue); } else { kfClone = new IntKeyframe(getFraction()); } kfClone.setInterpolator(getInterpolator()); kfClone.mValueWasSetOnStart = this.mValueWasSetOnStart; return kfClone; } } static class FloatKeyframe extends Keyframe { float mValue; FloatKeyframe(float fraction, float value) { this.mFraction = fraction; this.mValue = value; this.mValueType = Float.TYPE; this.mHasValue = true; } FloatKeyframe(float fraction) { this.mFraction = fraction; this.mValueType = Float.TYPE; } public float getFloatValue() { return this.mValue; } @Override // android.animation.Keyframe public Object getValue() { return Float.valueOf(this.mValue); } @Override // android.animation.Keyframe public void setValue(Object value) { if (value != null && value.getClass() == Float.class) { this.mValue = ((Float) value).floatValue(); this.mHasValue = true; } } @Override // android.animation.Keyframe, android.animation.Keyframe, java.lang.Object public FloatKeyframe clone() { FloatKeyframe kfClone; if (this.mHasValue) { kfClone = new FloatKeyframe(getFraction(), this.mValue); } else { kfClone = new FloatKeyframe(getFraction()); } kfClone.setInterpolator(getInterpolator()); kfClone.mValueWasSetOnStart = this.mValueWasSetOnStart; return kfClone; } } }
dd418183ac45e776069507957c18bc4628d41f6d
78648c09159c9e225fd6b35a0f602f8814c7853e
/practice_15/src/main/java/utility/PlayerDatabase.java
67007a6ab0d36fe243c4af004b61fd9f0047fc2b
[]
no_license
dblanari/tekwill_oca
c0355afe5203a94e3e5828b5ebda7cd5e6d0db8c
ea5128a5865238e1642023b7d3243d5ea7c812dd
refs/heads/master
2021-05-07T01:09:03.416177
2018-03-30T16:46:07
2018-03-30T16:46:07
110,218,901
0
1
null
2018-01-29T18:04:45
2017-11-10T07:52:45
Java
UTF-8
Java
false
false
2,125
java
/* Copyright © 2016 Oracle and/or its affiliates. All rights reserved. */ package utility; import java.util.ArrayList; import java.util.StringTokenizer; import soccer.Player; public class PlayerDatabase { private ArrayList <Player> players; public PlayerDatabase(){ StringTokenizer authorTokens = new StringTokenizer(authorList, ","); players = new ArrayList(); while (authorTokens.hasMoreTokens()){ players.add(new Player(authorTokens.nextToken())); } } public Player[] getTeam(int numberOfPlayers){ Player[] teamPlayers = new Player[numberOfPlayers]; for (int i = 0; i < numberOfPlayers; i++){ int playerIndex = (int) (Math.random() * players.size()); teamPlayers[i] = players.get(playerIndex); players.remove(playerIndex); } return teamPlayers; } String authorList = "Agatha Christie," + "Alan Patton," + "Alexander Solzhenitsyn," + "Arthur Conan Doyle," + "Anthony Trollope," + "Baroness Orczy," + "Brendan Behan," + "Brian Moore," + "Boris Pasternik," + "Charles Dickens," + "Charlotte Bronte," + "Dorothy Parker," + "Emile Zola," + "Frank O'Connor," + "Geoffrey Chaucer," + "George Eliot," + "G. K. Chesterton," + "Graham Green," + "Henry James," + "James Joyce," + "J. M. Synge," + "J. R. Tolkien," + "Jane Austin," + "Leo Tolstoy," + "Liam O'Flaherty," + "Marcel Proust," + "Mark Twain," + "Oscar Wilde," + "O. Henry," + "Samuel Beckett," + "Sean O'Casey," + "William Shakespeare," + "William Makepeace Thackeray," + "W. B. Yeats," + "Wilkie Collins"; }
215aaaf8b47ddc18ca26b74b81392d857cd6b895
56684c261856a727f8804b2c852029dc5faba9a7
/fa-server/src/main/java/nl/tudelft/fa/server/helper/jackson/CarParametersMixin.java
97fbcac477d2a83c68dcfbcbcdfbc94b3fa869a5
[ "MIT" ]
permissive
fabianishere/formula-andy
757d0e943fecb5cdaa260fdb9206adcadb089faa
ac73ea2766b8f25ec97e2e7d0c58c938f89a81be
refs/heads/master
2021-03-16T08:35:54.932321
2018-12-18T16:27:08
2018-12-18T16:27:08
74,035,424
4
0
null
null
null
null
UTF-8
Java
false
false
2,230
java
/* * The MIT License (MIT) * * Copyright (c) 2017 Fabian Mastenbroek, Christian Slothouber, * Laetitia Molkenboer, Nikki Bouman, Nils de Beukelaar * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package nl.tudelft.fa.server.helper.jackson; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import nl.tudelft.fa.core.race.CarParameters; import nl.tudelft.fa.core.team.inventory.Tire; /** * Mix-in for the {@link CarParameters} class. * * @author Fabian Mastenbroek */ public abstract class CarParametersMixin { /** * Construct a {@link CarParameters} instance. * * @param mechanicalRisk The risk of the car setup. * @param aerodynamicRisk The risk of the car design. * @param strategicRisk The risk of the strategy. * @param tire The tire that is being used. */ @JsonCreator public CarParametersMixin(@JsonProperty("mechanicalRisk") int mechanicalRisk, @JsonProperty("aerodynamicRisk") int aerodynamicRisk, @JsonProperty("strategicRisk") int strategicRisk, @JsonProperty("tire") Tire tire) {} }
948979473700c801f208a7c45c48b97b83015b79
a821bafdb7fbfd124cc8ead0982ab676a80a5370
/src/main/java/fi/hh/movies/domain/Category.java
3683a44f10282eb758d87483eada19c56052c1ff
[]
no_license
Quinsan/Movies
a458983f051a5bc8ea9b763e1de5d835418649bd
37eff0c496bceca215c2da55f66f6f07d3fedb04
refs/heads/master
2021-05-17T01:09:00.162633
2020-03-27T14:19:04
2020-03-27T14:19:04
250,549,766
0
0
null
null
null
null
UTF-8
Java
false
false
1,256
java
package fi.hh.movies.domain; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; @Entity public class Category { @Id @GeneratedValue(strategy=GenerationType.AUTO) private long categoryid; private String name; //linkataan leffaan, tässä onetomany, koska voi olla useampi. mappedBy linkaa millä nimellä moviessa tämä on, tärkeä, pitää olla sama siis @OneToMany(cascade = CascadeType.ALL, mappedBy = "category") //linkattu entity on nyt lista, kun voi olla useita leffoja private List<Movie> movies; public Category() { super(); } public Category(String name) { super(); this.name = name; } public long getCategoryid() { return categoryid; } public void setCategoryid(long categoryid) { this.categoryid = categoryid; } public String getName() { return name; } public void setName(String name) { this.name = name; } public List<Movie> getMovies() { return movies; } public void setMovies(List<Movie> movies) { this.movies = movies; } }
2126a2c757b277db41041bf03c19ee89eddbd897
6c6402133b0a98ee08b9f069128563bf915597f8
/forum/src/main/java/br/com/alura/forum/controller/dto/DetalhesDoTopicoDto.java
a9fc777e4fb0ce09425fee43f82be9ef43fa969f
[]
no_license
MonielleB/spring-boot-alura
3cfc9c61828000510b8c422a563ca997b186eeae
420ba62a7dd1a650247fa65633f589d03bdc4804
refs/heads/master
2023-05-28T07:22:00.539806
2021-06-11T15:19:48
2021-06-11T15:19:48
376,066,239
0
0
null
null
null
null
UTF-8
Java
false
false
1,511
java
package br.com.alura.forum.controller.dto; import br.com.alura.forum.modelo.Resposta; import br.com.alura.forum.modelo.StatusTopico; import br.com.alura.forum.modelo.Topico; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; public class DetalhesDoTopicoDto { private Long id; private String titulo; private String mensagem; private LocalDateTime dataCriacao; private String nomeAutor; private StatusTopico status; private List<RespostaDto> respostas; public DetalhesDoTopicoDto(Topico topico) { this.id = topico.getId(); this.titulo = topico.getTitulo(); this.mensagem = topico.getMensagem(); this.dataCriacao = topico.getDataCriacao(); this.nomeAutor = topico.getAutor().getNome(); this.status = topico.getStatus(); this.respostas = new ArrayList<>(); this.respostas.addAll(topico.getRespostas().stream().map(RespostaDto::new).collect(Collectors.toList())); } public Long getId() { return id; } public String getTitulo() { return titulo; } public String getMensagem() { return mensagem; } public LocalDateTime getDataCriacao() { return dataCriacao; } public String getNomeAutor() { return nomeAutor; } public StatusTopico getStatus() { return status; } public List<RespostaDto> getRespostas() { return respostas; } }
8341b0919baa7e9008ebb30384f2cce92c75a73e
f0241ac2e7c3f001b4d0d3ec69219869c6c9b946
/module1/Task3/src/test/java/it/academy/TestClassTest.java
14b00c927ad47492430762570fb05631ae024ef6
[]
no_license
aleksey0koval/jd2_hw
b3ceeca9815258210f874ceac6bd3e2bbc02a4bf
989e600da1d05c2102b3c373ad27f8f4a6d46a70
refs/heads/master
2023-03-20T03:10:34.771827
2021-03-02T21:48:47
2021-03-02T21:48:47
320,006,762
0
0
null
null
null
null
UTF-8
Java
false
false
405
java
package it.academy; import org.junit.Test; import java.util.Arrays; import java.util.List; import static org.junit.Assert.assertEquals; public class TestClassTest { @Test public void testClassTest() { List<Integer> list = Arrays.asList(1, 2,null, null); double actual = TestClass.average(list); double expected = 1.5; assertEquals(expected, actual, 0); } }
e50e712dd35d8bfca1d135deeba6c48f9cef23bf
8b96417ea286f9b2d3ec7d448e1a31c0ba8d57cb
/entitybroker/api/src/java/org/sakaiproject/entitybroker/entityprovider/extension/RequestStorageWrite.java
e63480f80ab946a01fa2e14fc5fd69b6a0fd9308
[ "ECL-2.0" ]
permissive
deemsys/Deemsys_Learnguild
d5b11c5d1ad514888f14369b9947582836749883
606efcb2cdc2bc6093f914f78befc65ab79d32be
refs/heads/master
2021-01-15T16:16:12.036004
2013-08-13T12:13:45
2013-08-13T12:13:45
12,083,202
0
1
null
null
null
null
UTF-8
Java
false
false
3,277
java
/** * $Id: RequestStorageWrite.java 59674 2009-04-03 23:05:58Z [email protected] $ * $URL: https://source.sakaiproject.org/svn/entitybroker/tags/entitybroker-1.5.2/api/src/java/org/sakaiproject/entitybroker/entityprovider/extension/RequestStorageWrite.java $ * RequestStorage.java - entity-broker - Jul 24, 2008 1:55:12 PM - azeckoski ************************************************************************** * Copyright (c) 2008, 2009 The Sakai Foundation * * Licensed under the Educational Community 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.osedu.org/licenses/ECL-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.sakaiproject.entitybroker.entityprovider.extension; import java.util.Locale; import java.util.Map; /** * This allows write access to values which are stored in the current request thread, * these values are inaccessible outside of a request and will be destroyed * when the thread ends<br/> * This also "magically" exposes all the values in the request (attributes and params) * as if they were stored in the map as well, if there are conflicts then locally stored data always wins * over data from the request<br/> * Standard reserved keys have values that are always available:<br/> * <ul> * <li><b>_locale</b> : {@link Locale}</li> * <li><b>_requestEntityReference</b> : String</li> * <li><b>_requestActive</b> : [true,false]</li> * <li><b>_requestOrigin</b> : ['REST','EXTERNAL','INTERNAL']</li> * </ul> * * @author Aaron Zeckoski (azeckoski @ gmail.com) */ public interface RequestStorageWrite extends RequestStorage { /** * Store a value in the request storage with an associated key * @param key a key for a stored value * @param value an object to store * @throws IllegalArgumentException if the key OR value are null, * also if an attempt is made to change a reserved value (see {@link RequestStorageWrite}) */ public void setStoredValue(String key, Object value); /** * Place all these params into the request storage * @param params map of string -> value params * @throws IllegalArgumentException if the key OR value are null, * also if an attempt is made to change a reserved value (see {@link RequestStorageWrite}) */ public void setRequestValues(Map<String, Object> params); /** * Allows user to set the value of a key directly, including reserved keys * @param key the name of the value * @param value the value to store * @throws IllegalArgumentException if the key OR value are null, * also if an attempt is made to change a reserved value (see {@link RequestStorageWrite}) */ public void setRequestValue(String key, Object value); /** * Clear all values in the request storage (does not wipe the values form the request itself) */ public void reset(); }
16e325432631b94148f4afc65ffdd8b3828be87b
eb5f5353f49ee558e497e5caded1f60f32f536b5
/org/omg/DynamicAny/NameDynAnyPairHelper.java
196b5e51ccbdd84c36c587a1114c1a48c950b57e
[]
no_license
mohitrajvardhan17/java1.8.0_151
6fc53e15354d88b53bd248c260c954807d612118
6eeab0c0fd20be34db653f4778f8828068c50c92
refs/heads/master
2020-03-18T09:44:14.769133
2018-05-23T14:28:24
2018-05-23T14:28:24
134,578,186
0
2
null
null
null
null
UTF-8
Java
false
false
2,563
java
package org.omg.DynamicAny; import org.omg.CORBA.Any; import org.omg.CORBA.ORB; import org.omg.CORBA.StructMember; import org.omg.CORBA.TypeCode; import org.omg.CORBA.portable.InputStream; import org.omg.CORBA.portable.OutputStream; public abstract class NameDynAnyPairHelper { private static String _id = "IDL:omg.org/DynamicAny/NameDynAnyPair:1.0"; private static TypeCode __typeCode = null; private static boolean __active = false; public NameDynAnyPairHelper() {} public static void insert(Any paramAny, NameDynAnyPair paramNameDynAnyPair) { OutputStream localOutputStream = paramAny.create_output_stream(); paramAny.type(type()); write(localOutputStream, paramNameDynAnyPair); paramAny.read_value(localOutputStream.create_input_stream(), type()); } public static NameDynAnyPair extract(Any paramAny) { return read(paramAny.create_input_stream()); } public static synchronized TypeCode type() { if (__typeCode == null) { synchronized (TypeCode.class) { if (__typeCode == null) { if (__active) { return ORB.init().create_recursive_tc(_id); } __active = true; StructMember[] arrayOfStructMember = new StructMember[2]; TypeCode localTypeCode = null; localTypeCode = ORB.init().create_string_tc(0); localTypeCode = ORB.init().create_alias_tc(FieldNameHelper.id(), "FieldName", localTypeCode); arrayOfStructMember[0] = new StructMember("id", localTypeCode, null); localTypeCode = DynAnyHelper.type(); arrayOfStructMember[1] = new StructMember("value", localTypeCode, null); __typeCode = ORB.init().create_struct_tc(id(), "NameDynAnyPair", arrayOfStructMember); __active = false; } } } return __typeCode; } public static String id() { return _id; } public static NameDynAnyPair read(InputStream paramInputStream) { NameDynAnyPair localNameDynAnyPair = new NameDynAnyPair(); id = paramInputStream.read_string(); value = DynAnyHelper.read(paramInputStream); return localNameDynAnyPair; } public static void write(OutputStream paramOutputStream, NameDynAnyPair paramNameDynAnyPair) { paramOutputStream.write_string(id); DynAnyHelper.write(paramOutputStream, value); } } /* Location: C:\Program Files (x86)\Java\jre1.8.0_151\lib\rt.jar!\org\omg\DynamicAny\NameDynAnyPairHelper.class * Java compiler version: 8 (52.0) * JD-Core Version: 0.7.1 */
25810df7aeb0de481edd7e4734411bbf6fdac987
6cfb69c19b2be30c3fdcd62ba70de617cfeedff8
/backend/psp-db/src/main/java/com/yf/psp/db/util/plugin/SqlInjectCheck.java
eb9b5ce5d7457c644fca38bcaeda04bb1fab8647
[]
no_license
yuxin6052/psp
f7367e265d8d6d6fedd80acf378b6ee44eaabf28
c9dceada2d9ed7603efdb7aa2eb6dd412b996c94
refs/heads/master
2020-04-17T10:34:06.580556
2019-02-20T08:01:03
2019-02-20T08:01:03
166,505,586
0
0
null
null
null
null
UTF-8
Java
false
false
1,397
java
package com.yf.psp.db.util.plugin; import java.util.Collection; import java.util.Map; public class SqlInjectCheck { /*** * @完成参数校验 */ public static void check(Object param) { if(param==null) { return ; } if(param instanceof Map.Entry) { Map.Entry en = (Map.Entry)param; check(en.getKey()); check(en.getValue()); }else if(param instanceof Map) { Map<String,Object> map = (Map<String,Object>)param; for(Map.Entry<String,Object> it : map.entrySet()) { check(it); } }else if (param instanceof String) { checkString((String) param); }else if (param instanceof Page) { checkPage((Page) param); }else if(param instanceof Collection) { Collection cl = (Collection)param; for(Object it : cl) { check(it); } } //... } private static void checkString(String param) { //TODO:根据业务一步步来完善 检查 逻辑 if(param.contains("'")) { throw new IllegalArgumentException(param + " has sql inject risk"); } } private static void checkPage(Page param) { check(param.getParams()); if (param instanceof PageByPageNo) { }else if(param instanceof PageByInstId) { PageByInstId page = (PageByInstId)param; if(page.getPrimaryKey()!=null && page.getPrimaryKey().trim().contains(" ")) { throw new IllegalArgumentException(page.getPrimaryKey() + " has sql inject risk"); } } } }
f5d2197d3192a9a5ec2d76867049637bd47f2670
c5113811cb94f4639177a4420ec968f62cc440c1
/app/src/main/java/com/wiryawan/retrofittutorial/adapter/ShowtimeListAdapter.java
d0665d6bd5310d3eea7f998097487609551cb258
[]
no_license
wiryawan46/RetrofitTutorial
a86f754e50f7a2939e91371cfc2df9cc32ed25ad
2ce2bdf0c2b15fd782de74605dd3d11c12595a42
refs/heads/master
2021-01-22T07:39:20.401991
2017-02-13T15:30:15
2017-02-13T15:30:15
81,839,614
0
0
null
null
null
null
UTF-8
Java
false
false
2,925
java
package com.wiryawan.retrofittutorial.adapter; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.wiryawan.retrofittutorial.R; import com.wiryawan.retrofittutorial.model.ShowTime; import com.wiryawan.retrofittutorial.util.FlowLayout; import java.util.ArrayList; import java.util.List; /** * Created by wiryawan on 1/13/17. */ public class ShowtimeListAdapter extends RecyclerView.Adapter<ShowtimeListAdapter.ShowtimeViewHolder> { private List<ShowTime> showTimeList; private Context context; public ShowtimeListAdapter(Context context) { this.context = context; showTimeList = new ArrayList<>(); } public void add(ShowTime item) { showTimeList.add(item); notifyItemInserted(showTimeList.size() - 1); } public void addAll(List<ShowTime> showTimeList) { for (ShowTime showTime : showTimeList) { add(showTime); } } public void remove(ShowTime item) { int position = showTimeList.indexOf(item); if (position > -1) { showTimeList.remove(position); notifyItemRemoved(position); } } public void clear() { while (getItemCount() > 0) { remove(getItem(0)); } } public ShowTime getItem(int position) { return showTimeList.get(position); } @Override public ShowtimeViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_showtime, parent, false); return new ShowtimeViewHolder(view); } @Override public void onBindViewHolder(ShowtimeViewHolder holder, int position) { final ShowTime showTime = showTimeList.get(position); holder.theater.setText(showTime.getBioskop()); for (int i = 0; i < showTime.getJam().size(); i++) { View view = LayoutInflater.from(context).inflate(R.layout.list_item_time, holder.lytime, false); TextView time = (TextView) view.findViewById(R.id.time); time.setText(showTime.getJam().get(i)); holder.lytime.addView(view); } holder.price.setText(showTime.getHarga()); } @Override public int getItemCount() { return showTimeList.size(); } static class ShowtimeViewHolder extends RecyclerView.ViewHolder { TextView theater; FlowLayout lytime; TextView price; public ShowtimeViewHolder(View itemView) { super(itemView); theater = (TextView) itemView.findViewById(R.id.theater); lytime = (FlowLayout) itemView.findViewById(R.id.lyTime); price = (TextView) itemView.findViewById(R.id.price); } } }
293d76f17f4ad90faff1226eeb282104ca2e4b8e
816c46fa90e4c66e4017cc6745148329877b29d2
/app/src/test/java/com/shangxiazuoyou/advancedslidelayout/ExampleUnitTest.java
a4a59939b62ff66652dc43de83106e141142166a
[ "Apache-2.0" ]
permissive
shangxiazuoyou/AdvancedSlideLayout
361e47f61b088cfe6ee3a2f928bcf3b12b737594
50075102e79d250da0887cbdb612c41dea57de5e
refs/heads/master
2021-08-24T04:40:03.270769
2017-12-08T02:57:27
2017-12-08T02:57:27
113,518,719
0
0
null
null
null
null
UTF-8
Java
false
false
416
java
package com.shangxiazuoyou.advancedslidelayout; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
d9ea3507566e9194eb12f4a25555c9c86ebd4746
3dd35c0681b374ce31dbb255b87df077387405ff
/generated/com/guidewire/_generated/entity/GL7SublnSchedCondItemCostInternalAccess.java
9e236c861326bfaf65de366ece5b93ae39093979
[]
no_license
walisashwini/SBTBackup
58b635a358e8992339db8f2cc06978326fed1b99
4d4de43576ec483bc031f3213389f02a92ad7528
refs/heads/master
2023-01-11T09:09:10.205139
2020-11-18T12:11:45
2020-11-18T12:11:45
311,884,817
0
0
null
null
null
null
UTF-8
Java
false
false
937
java
package com.guidewire._generated.entity; @javax.annotation.Generated(value = "com.guidewire.pl.metadata.codegen.Codegen", comments = "GL7SublnSchedCondItemCost.eti;GL7SublnSchedCondItemCost.eix;GL7SublnSchedCondItemCost.etx") @java.lang.SuppressWarnings(value = {"deprecation", "unchecked"}) public class GL7SublnSchedCondItemCostInternalAccess { public static final com.guidewire.pl.system.internal.FriendAccessor<com.guidewire.pl.persistence.code.InstantiableEntityFriendAccess<entity.GL7SublnSchedCondItemCost, com.guidewire._generated.entity.GL7SublnSchedCondItemCostInternal>> FRIEND_ACCESSOR = new com.guidewire.pl.system.internal.FriendAccessor<com.guidewire.pl.persistence.code.InstantiableEntityFriendAccess<entity.GL7SublnSchedCondItemCost, com.guidewire._generated.entity.GL7SublnSchedCondItemCostInternal>>(entity.GL7SublnSchedCondItemCost.class); private GL7SublnSchedCondItemCostInternalAccess() { } }
3d21471258a346d48124384cd8c9f3e8252cf307
1cf5e199a68fd7f69107ab547225fe64e28909a2
/common/src/main/java/com/gamerole/common/rxbus2/SubscriberMethod.java
ac0ad724423d8f0086667a7c94b91a540b118f6e
[]
no_license
lvzhihao100/DDRoleBase
94d807baa7f682561ca6d43e1ef9e4ff5650e68f
789921d9545747d44d89ec7f7c28fd5d9f221652
refs/heads/master
2020-03-13T13:31:23.764200
2018-04-26T10:37:58
2018-04-26T10:37:58
129,202,317
0
0
null
null
null
null
UTF-8
Java
false
false
1,182
java
package com.gamerole.common.rxbus2; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /** * Created by lvzhihao on 17-7-25. */ public class SubscriberMethod { public Method method; public ThreadMode threadMode; public Class<?> eventType; public Object subscriber; public int code; public SubscriberMethod(Object subscriber, Method method, Class<?> eventType, int code, ThreadMode threadMode) { this.method = method; this.threadMode = threadMode; this.eventType = eventType; this.subscriber = subscriber; this.code = code; } public void invoke(Object o) { try { Class[] e = this.method.getParameterTypes(); if (e != null && e.length == 1) { this.method.invoke(this.subscriber, new Object[]{o}); } else if (e == null || e.length == 0) { this.method.invoke(this.subscriber, new Object[0]); } } catch (IllegalAccessException var3) { var3.printStackTrace(); } catch (InvocationTargetException var4) { var4.printStackTrace(); } } }
bc3ab3c53e454ef15b537b75af7bff872dad636f
f843788f75b1ff8d5ff6d24fd7137be1b05d1aa6
/src/ac/biu/nlp/nlp/instruments/parse/tree/dependency/basic/xmldom/TreeAndSentence.java
31083137ad31048e56487bdfde7e9da9b5549658
[]
no_license
oferbr/biu-infrastructure
fe830d02defc7931f9be239402931cfbf223c05e
051096636b705ffe7756f144f58c384a56a7fcc3
refs/heads/master
2021-01-19T08:12:33.484302
2013-02-05T16:08:58
2013-02-05T16:08:58
6,156,024
2
0
null
2012-11-18T09:42:20
2012-10-10T11:02:33
Java
UTF-8
Java
false
false
772
java
package ac.biu.nlp.nlp.instruments.parse.tree.dependency.basic.xmldom; import java.io.Serializable; import ac.biu.nlp.nlp.instruments.parse.tree.dependency.basic.BasicNode; /** * Holds a tree and a sentence (from which that tree was created). * * @author Asher Stern * @since October 2, 2012 * */ public class TreeAndSentence implements Serializable { private static final long serialVersionUID = -6342877867677633913L; public TreeAndSentence(String sentence, BasicNode tree) { super(); this.sentence = sentence; this.tree = tree; } public String getSentence() { return sentence; } public BasicNode getTree() { return tree; } private final String sentence; private final BasicNode tree; }
51445a02af8817cf000a3e4425289642c008f1ce
a36486c878ed15ba156a9f8500bdcf60e60dcf9c
/spring-cloud-core/src/main/java/com/springcloud/base/core/config/exception/WebExceptionConfiguration.java
69a4bd9b9ab99c08c1218850d1047942ca260e13
[ "Apache-2.0" ]
permissive
debugsw/springcloud
6cc6129c3dc2ba769453b29a8f9bd40978c75480
9cec564a6f00711f98f0d73c0516e64626a160f9
refs/heads/master
2023-08-02T15:30:44.451788
2023-07-24T01:13:24
2023-07-24T01:13:24
134,233,051
5
3
Apache-2.0
2023-06-21T03:10:22
2018-05-21T07:18:40
Java
UTF-8
Java
false
false
415
java
package com.springcloud.base.core.config.exception; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; /** * @Author: ls * @Date: 2019/8/9 * @Description: web相关配置 **/ @Slf4j @Configuration @Import({WebExceptionProperties.class, WebApiExceptionHandler.class}) public class WebExceptionConfiguration { }
4cf89a224f176d4d9b17d7c0ccfb6f6cb4406b6c
deb80cb2f0f70fbcd6e8c8b4d44266c43e529bd9
/looper/src/androidTest/java/ru/mirea/evteev/looper/ExampleInstrumentedTest.java
e5056a5784cab12a2388076adaf78bef851794cb
[]
no_license
Rabotayvmake/practice4
8e004cc4f32f91162bcd8804c2c1f1ae89664afc
6d7a490dc95d1dec09e06505a6fabd106807a140
refs/heads/master
2023-05-08T06:05:35.999876
2021-06-01T15:02:46
2021-06-01T15:02:46
372,852,919
0
0
null
null
null
null
UTF-8
Java
false
false
758
java
package ru.mirea.evteev.looper; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("ru.mirea.evteev.looper", appContext.getPackageName()); } }
59af1547b41ee424a66dc406b109af6d4e9568ac
56c1e410f5c977fedce3242e92a1c6496e205af8
/lib/sources/dolphin-mybatis-generator/main/java/com/freetmp/mbg/plugin/page/OraclePaginationPlugin.java
ab37c4eb208f4eb4e15dcdd40a4732fee16acf3b
[ "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
1,454
java
package com.freetmp.mbg.plugin.page; import org.mybatis.generator.api.IntrospectedTable; import org.mybatis.generator.api.dom.xml.Attribute; import org.mybatis.generator.api.dom.xml.TextElement; import org.mybatis.generator.api.dom.xml.XmlElement; import java.util.List; /** * Created by LiuPin on 2015/2/3. */ public class OraclePaginationPlugin extends AbstractPaginationPlugin { public OraclePaginationPlugin() { super(); } @Override public boolean sqlMapSelectByExampleWithoutBLOBsElementGenerated(XmlElement element, IntrospectedTable introspectedTable) { // 使用select语句包裹住原始的sql语句 XmlElement checkIfPageable = new XmlElement("if"); checkIfPageable.addAttribute(new Attribute("test", "limit != null and limit>=0 and offset != null")); TextElement prefix = new TextElement("select * from ( select tmp_page.*, rownum row_id from ( "); checkIfPageable.addElement(prefix); element.addElement(0, checkIfPageable); checkIfPageable = new XmlElement("if"); checkIfPageable.addAttribute(new Attribute("test", "limit != null and limit>=0 and offset != null")); TextElement suffix = new TextElement("<![CDATA[ ) tmp_page where rownum <= #{limit} + #{offset} ) where row_id > #{offset} ]]>"); checkIfPageable.addElement(suffix); element.addElement(checkIfPageable); return true; } @Override public boolean validate(List<String> warnings) { return true; } }
f5407f053b9bd3623dcae436446f187d019859cb
23ec6adce704bff40d04cd6fc0ba446375405b68
/March_Leetcode_Challenge_2021/encode_and_decode_tinyurl-15.java
10f99edc79cfa62dafb4bceffefb7dfbf69cea29
[]
no_license
amoghrajesh/Coding
1845be9ea8df2d13d2a21ebef9ee6de750c8831d
a7dc41a4963f97dfb62ee4b1cab5ed80043cfdef
refs/heads/master
2023-08-31T10:10:48.948129
2023-08-30T15:04:02
2023-08-30T15:04:02
267,779,618
0
0
null
null
null
null
UTF-8
Java
false
false
1,068
java
public class Codec { HashMap<String, String> longToShort = new HashMap<String, String>(); HashMap<String, String> shortToLong = new HashMap<String, String>(); String seed = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; int nextid = 0; // Encodes a URL to a shortened URL. public String encode(String longUrl) { if (longToShort.containsKey(longUrl)) { return longToShort.get(longUrl); } StringBuilder sb = new StringBuilder(); int id = nextid; for (int i = 0; i < 6; i ++) { int j = id % 62; id = id / 62; sb.insert(0, seed.charAt(j)); } String res = sb.toString(); shortToLong.put(res, longUrl); longToShort.put(longUrl, res); nextid ++; return res; } // Decodes a shortened URL to its original URL. public String decode(String shortUrl) { if (!shortToLong.containsKey(shortUrl)) { return null; } return shortToLong.get(shortUrl); } }
2b734ab856d168d01a88fe9e207d2d9ea10a9cc7
dd7317323464414956b2b29624684d9ba07c8f6e
/core/gramar/src/main/java/org/gramar/base/function/UppercaseFunction.java
510ca4c30897cc6ff5846bd576033836a8c1919b
[ "Apache-2.0" ]
permissive
chrisGerken/gramar
82706760646748640bd77fee6df8f012b0a80f2c
70e5be69594003c678e1690143620ba611f2b3de
refs/heads/master
2020-12-29T02:21:49.372793
2017-12-15T02:22:36
2017-12-15T02:22:36
31,465,230
6
2
null
null
null
null
UTF-8
Java
false
false
805
java
package org.gramar.base.function; import java.util.List; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathFunction; import javax.xml.xpath.XPathFunctionException; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class UppercaseFunction implements XPathFunction { public UppercaseFunction() { } @Override public Object evaluate(List args) throws XPathFunctionException { String original = null; Object val = args.get(0); if (val instanceof String) { original = (String) val; } else if (val instanceof NodeList) { NodeList nl = (NodeList) val; Node item = nl.item(0); if (item == null) { throw new XPathFunctionException("argument for upper-case() is null"); } original = item.getNodeValue(); } return original.toUpperCase(); } }
5f09b388201ab921954790805aa3f31b2d06d09f
e56c0c78a24d37e80d507fb915e66d889c58258d
/seeds-io/src/main/java/net/tribe7/common/io/BaseEncoding.java
a4ac0e7dd50b5f1f91dac7f865855081bb5f6ce3
[]
no_license
jjzazuet/seeds-libraries
d4db7f61ff3700085a36eec77eec0f5f9a921bb5
87f74a006632ca7a11bff62c89b8ec4514dc65ab
refs/heads/master
2021-01-23T20:13:04.801382
2014-03-23T21:51:46
2014-03-23T21:51:46
8,710,960
30
2
null
null
null
null
UTF-8
Java
false
false
29,695
java
/* * Copyright (C) 2012 The Guava Authors * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package net.tribe7.common.io; import static java.math.RoundingMode.CEILING; import static java.math.RoundingMode.FLOOR; import static java.math.RoundingMode.UNNECESSARY; import static net.tribe7.common.base.Preconditions.checkArgument; import static net.tribe7.common.base.Preconditions.checkNotNull; import static net.tribe7.common.base.Preconditions.checkPositionIndexes; import static net.tribe7.common.base.Preconditions.checkState; import static net.tribe7.common.io.GwtWorkarounds.asCharInput; import static net.tribe7.common.io.GwtWorkarounds.asCharOutput; import static net.tribe7.common.io.GwtWorkarounds.asInputStream; import static net.tribe7.common.io.GwtWorkarounds.asOutputStream; import static net.tribe7.common.io.GwtWorkarounds.stringBuilderOutput; import static net.tribe7.common.math.IntMath.divide; import static net.tribe7.common.math.IntMath.log2; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; import java.io.Writer; import java.util.Arrays; import javax.annotation.CheckReturnValue; import javax.annotation.Nullable; import net.tribe7.common.annotations.Beta; import net.tribe7.common.annotations.GwtCompatible; import net.tribe7.common.annotations.GwtIncompatible; import net.tribe7.common.base.Ascii; import net.tribe7.common.base.CharMatcher; import net.tribe7.common.io.GwtWorkarounds.ByteInput; import net.tribe7.common.io.GwtWorkarounds.ByteOutput; import net.tribe7.common.io.GwtWorkarounds.CharInput; import net.tribe7.common.io.GwtWorkarounds.CharOutput; /** * A binary encoding scheme for reversibly translating between byte sequences and printable ASCII * strings. This class includes several constants for encoding schemes specified by <a * href="http://tools.ietf.org/html/rfc4648">RFC 4648</a>. For example, the expression: * * <pre> {@code * BaseEncoding.base32().encode("foo".getBytes(Charsets.US_ASCII))}</pre> * * <p>returns the string {@code "MZXW6==="}, and <pre> {@code * byte[] decoded = BaseEncoding.base32().decode("MZXW6===");}</pre> * * <p>...returns the ASCII bytes of the string {@code "foo"}. * * <p>By default, {@code BaseEncoding}'s behavior is relatively strict and in accordance with * RFC 4648. Decoding rejects characters in the wrong case, though padding is optional. * To modify encoding and decoding behavior, use configuration methods to obtain a new encoding * with modified behavior: * * <pre> {@code * BaseEncoding.base16().lowerCase().decode("deadbeef");}</pre> * * <p>Warning: BaseEncoding instances are immutable. Invoking a configuration method has no effect * on the receiving instance; you must store and use the new encoding instance it returns, instead. * * <pre> {@code * // Do NOT do this * BaseEncoding hex = BaseEncoding.base16(); * hex.lowerCase(); // does nothing! * return hex.decode("deadbeef"); // throws an IllegalArgumentException}</pre> * * <p>It is guaranteed that {@code encoding.decode(encoding.encode(x))} is always equal to * {@code x}, but the reverse does not necessarily hold. * * <p> * <table> * <tr> * <th>Encoding * <th>Alphabet * <th>{@code char:byte} ratio * <th>Default padding * <th>Comments * <tr> * <td>{@link #base16()} * <td>0-9 A-F * <td>2.00 * <td>N/A * <td>Traditional hexadecimal. Defaults to upper case. * <tr> * <td>{@link #base32()} * <td>A-Z 2-7 * <td>1.60 * <td>= * <td>Human-readable; no possibility of mixing up 0/O or 1/I. Defaults to upper case. * <tr> * <td>{@link #base32Hex()} * <td>0-9 A-V * <td>1.60 * <td>= * <td>"Numerical" base 32; extended from the traditional hex alphabet. Defaults to upper case. * <tr> * <td>{@link #base64()} * <td>A-Z a-z 0-9 + / * <td>1.33 * <td>= * <td> * <tr> * <td>{@link #base64Url()} * <td>A-Z a-z 0-9 - _ * <td>1.33 * <td>= * <td>Safe to use as filenames, or to pass in URLs without escaping * </table> * * <p> * All instances of this class are immutable, so they may be stored safely as static constants. * * @author Louis Wasserman * @since 14.0 */ @Beta @GwtCompatible(emulated = true) public abstract class BaseEncoding { // TODO(user): consider adding encodeTo(Appendable, byte[], [int, int]) BaseEncoding() {} /** * Exception indicating invalid base-encoded input encountered while decoding. * * @author Louis Wasserman * @since 15.0 */ public static final class DecodingException extends IOException { DecodingException(String message) { super(message); } DecodingException(Throwable cause) { super(cause); } } /** * Encodes the specified byte array, and returns the encoded {@code String}. */ public String encode(byte[] bytes) { return encode(checkNotNull(bytes), 0, bytes.length); } /** * Encodes the specified range of the specified byte array, and returns the encoded * {@code String}. */ public final String encode(byte[] bytes, int off, int len) { checkNotNull(bytes); checkPositionIndexes(off, off + len, bytes.length); CharOutput result = stringBuilderOutput(maxEncodedSize(len)); ByteOutput byteOutput = encodingStream(result); try { for (int i = 0; i < len; i++) { byteOutput.write(bytes[off + i]); } byteOutput.close(); } catch (IOException impossible) { throw new AssertionError("impossible"); } return result.toString(); } /** * Returns an {@code OutputStream} that encodes bytes using this encoding into the specified * {@code Writer}. When the returned {@code OutputStream} is closed, so is the backing * {@code Writer}. */ @GwtIncompatible("Writer,OutputStream") public final OutputStream encodingStream(Writer writer) { return asOutputStream(encodingStream(asCharOutput(writer))); } /** * Returns a {@code ByteSink} that writes base-encoded bytes to the specified {@code CharSink}. */ @GwtIncompatible("ByteSink,CharSink") public final ByteSink encodingSink(final CharSink encodedSink) { checkNotNull(encodedSink); return new ByteSink() { @Override public OutputStream openStream() throws IOException { return encodingStream(encodedSink.openStream()); } }; } // TODO(user): document the extent of leniency, probably after adding ignore(CharMatcher) private static byte[] extract(byte[] result, int length) { if (length == result.length) { return result; } else { byte[] trunc = new byte[length]; System.arraycopy(result, 0, trunc, 0, length); return trunc; } } /** * Decodes the specified character sequence, and returns the resulting {@code byte[]}. * This is the inverse operation to {@link #encode(byte[])}. * * @throws IllegalArgumentException if the input is not a valid encoded string according to this * encoding. */ public final byte[] decode(CharSequence chars) { try { return decodeChecked(chars); } catch (DecodingException badInput) { throw new IllegalArgumentException(badInput); } } /** * Decodes the specified character sequence, and returns the resulting {@code byte[]}. * This is the inverse operation to {@link #encode(byte[])}. * * @throws DecodingException if the input is not a valid encoded string according to this * encoding. */ final byte[] decodeChecked(CharSequence chars) throws DecodingException { chars = padding().trimTrailingFrom(chars); ByteInput decodedInput = decodingStream(asCharInput(chars)); byte[] tmp = new byte[maxDecodedSize(chars.length())]; int index = 0; try { for (int i = decodedInput.read(); i != -1; i = decodedInput.read()) { tmp[index++] = (byte) i; } } catch (DecodingException badInput) { throw badInput; } catch (IOException impossible) { throw new AssertionError(impossible); } return extract(tmp, index); } /** * Returns an {@code InputStream} that decodes base-encoded input from the specified * {@code Reader}. The returned stream throws a {@link DecodingException} upon decoding-specific * errors. */ @GwtIncompatible("Reader,InputStream") public final InputStream decodingStream(Reader reader) { return asInputStream(decodingStream(asCharInput(reader))); } /** * Returns a {@code ByteSource} that reads base-encoded bytes from the specified * {@code CharSource}. */ @GwtIncompatible("ByteSource,CharSource") public final ByteSource decodingSource(final CharSource encodedSource) { checkNotNull(encodedSource); return new ByteSource() { @Override public InputStream openStream() throws IOException { return decodingStream(encodedSource.openStream()); } }; } // Implementations for encoding/decoding abstract int maxEncodedSize(int bytes); abstract ByteOutput encodingStream(CharOutput charOutput); abstract int maxDecodedSize(int chars); abstract ByteInput decodingStream(CharInput charInput); abstract CharMatcher padding(); // Modified encoding generators /** * Returns an encoding that behaves equivalently to this encoding, but omits any padding * characters as specified by <a href="http://tools.ietf.org/html/rfc4648#section-3.2">RFC 4648 * section 3.2</a>, Padding of Encoded Data. */ @CheckReturnValue public abstract BaseEncoding omitPadding(); /** * Returns an encoding that behaves equivalently to this encoding, but uses an alternate character * for padding. * * @throws IllegalArgumentException if this padding character is already used in the alphabet or a * separator */ @CheckReturnValue public abstract BaseEncoding withPadChar(char padChar); /** * Returns an encoding that behaves equivalently to this encoding, but adds a separator string * after every {@code n} characters. Any occurrences of any characters that occur in the separator * are skipped over in decoding. * * @throws IllegalArgumentException if any alphabet or padding characters appear in the separator * string, or if {@code n <= 0} * @throws UnsupportedOperationException if this encoding already uses a separator */ @CheckReturnValue public abstract BaseEncoding withSeparator(String separator, int n); /** * Returns an encoding that behaves equivalently to this encoding, but encodes and decodes with * uppercase letters. Padding and separator characters remain in their original case. * * @throws IllegalStateException if the alphabet used by this encoding contains mixed upper- and * lower-case characters */ @CheckReturnValue public abstract BaseEncoding upperCase(); /** * Returns an encoding that behaves equivalently to this encoding, but encodes and decodes with * lowercase letters. Padding and separator characters remain in their original case. * * @throws IllegalStateException if the alphabet used by this encoding contains mixed upper- and * lower-case characters */ @CheckReturnValue public abstract BaseEncoding lowerCase(); private static final BaseEncoding BASE64 = new StandardBaseEncoding( "base64()", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", '='); /** * The "base64" base encoding specified by <a * href="http://tools.ietf.org/html/rfc4648#section-4">RFC 4648 section 4</a>, Base 64 Encoding. * (This is the same as the base 64 encoding from <a * href="http://tools.ietf.org/html/rfc3548#section-3">RFC 3548</a>.) * * <p>The character {@code '='} is used for padding, but can be {@linkplain #omitPadding() * omitted} or {@linkplain #withPadChar(char) replaced}. * * <p>No line feeds are added by default, as per <a * href="http://tools.ietf.org/html/rfc4648#section-3.1"> RFC 4648 section 3.1</a>, Line Feeds in * Encoded Data. Line feeds may be added using {@link #withSeparator(String, int)}. */ public static BaseEncoding base64() { return BASE64; } private static final BaseEncoding BASE64_URL = new StandardBaseEncoding( "base64Url()", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", '='); /** * The "base64url" encoding specified by <a * href="http://tools.ietf.org/html/rfc4648#section-5">RFC 4648 section 5</a>, Base 64 Encoding * with URL and Filename Safe Alphabet, also sometimes referred to as the "web safe Base64." * (This is the same as the base 64 encoding with URL and filename safe alphabet from <a * href="http://tools.ietf.org/html/rfc3548#section-4">RFC 3548</a>.) * * <p>The character {@code '='} is used for padding, but can be {@linkplain #omitPadding() * omitted} or {@linkplain #withPadChar(char) replaced}. * * <p>No line feeds are added by default, as per <a * href="http://tools.ietf.org/html/rfc4648#section-3.1"> RFC 4648 section 3.1</a>, Line Feeds in * Encoded Data. Line feeds may be added using {@link #withSeparator(String, int)}. */ public static BaseEncoding base64Url() { return BASE64_URL; } private static final BaseEncoding BASE32 = new StandardBaseEncoding("base32()", "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", '='); /** * The "base32" encoding specified by <a * href="http://tools.ietf.org/html/rfc4648#section-6">RFC 4648 section 6</a>, Base 32 Encoding. * (This is the same as the base 32 encoding from <a * href="http://tools.ietf.org/html/rfc3548#section-5">RFC 3548</a>.) * * <p>The character {@code '='} is used for padding, but can be {@linkplain #omitPadding() * omitted} or {@linkplain #withPadChar(char) replaced}. * * <p>No line feeds are added by default, as per <a * href="http://tools.ietf.org/html/rfc4648#section-3.1"> RFC 4648 section 3.1</a>, Line Feeds in * Encoded Data. Line feeds may be added using {@link #withSeparator(String, int)}. */ public static BaseEncoding base32() { return BASE32; } private static final BaseEncoding BASE32_HEX = new StandardBaseEncoding("base32Hex()", "0123456789ABCDEFGHIJKLMNOPQRSTUV", '='); /** * The "base32hex" encoding specified by <a * href="http://tools.ietf.org/html/rfc4648#section-7">RFC 4648 section 7</a>, Base 32 Encoding * with Extended Hex Alphabet. There is no corresponding encoding in RFC 3548. * * <p>The character {@code '='} is used for padding, but can be {@linkplain #omitPadding() * omitted} or {@linkplain #withPadChar(char) replaced}. * * <p>No line feeds are added by default, as per <a * href="http://tools.ietf.org/html/rfc4648#section-3.1"> RFC 4648 section 3.1</a>, Line Feeds in * Encoded Data. Line feeds may be added using {@link #withSeparator(String, int)}. */ public static BaseEncoding base32Hex() { return BASE32_HEX; } private static final BaseEncoding BASE16 = new StandardBaseEncoding("base16()", "0123456789ABCDEF", null); /** * The "base16" encoding specified by <a * href="http://tools.ietf.org/html/rfc4648#section-8">RFC 4648 section 8</a>, Base 16 Encoding. * (This is the same as the base 16 encoding from <a * href="http://tools.ietf.org/html/rfc3548#section-6">RFC 3548</a>.) This is commonly known as * "hexadecimal" format. * * <p>No padding is necessary in base 16, so {@link #withPadChar(char)} and * {@link #omitPadding()} have no effect. * * <p>No line feeds are added by default, as per <a * href="http://tools.ietf.org/html/rfc4648#section-3.1"> RFC 4648 section 3.1</a>, Line Feeds in * Encoded Data. Line feeds may be added using {@link #withSeparator(String, int)}. */ public static BaseEncoding base16() { return BASE16; } private static final class Alphabet extends CharMatcher { private final String name; // this is meant to be immutable -- don't modify it! private final char[] chars; final int mask; final int bitsPerChar; final int charsPerChunk; final int bytesPerChunk; private final byte[] decodabet; private final boolean[] validPadding; Alphabet(String name, char[] chars) { this.name = checkNotNull(name); this.chars = checkNotNull(chars); try { this.bitsPerChar = log2(chars.length, UNNECESSARY); } catch (ArithmeticException e) { throw new IllegalArgumentException("Illegal alphabet length " + chars.length, e); } /* * e.g. for base64, bitsPerChar == 6, charsPerChunk == 4, and bytesPerChunk == 3. This makes * for the smallest chunk size that still has charsPerChunk * bitsPerChar be a multiple of 8. */ int gcd = Math.min(8, Integer.lowestOneBit(bitsPerChar)); this.charsPerChunk = 8 / gcd; this.bytesPerChunk = bitsPerChar / gcd; this.mask = chars.length - 1; byte[] decodabet = new byte[Ascii.MAX + 1]; Arrays.fill(decodabet, (byte) -1); for (int i = 0; i < chars.length; i++) { char c = chars[i]; checkArgument(CharMatcher.ASCII.matches(c), "Non-ASCII character: %s", c); checkArgument(decodabet[c] == -1, "Duplicate character: %s", c); decodabet[c] = (byte) i; } this.decodabet = decodabet; boolean[] validPadding = new boolean[charsPerChunk]; for (int i = 0; i < bytesPerChunk; i++) { validPadding[divide(i * 8, bitsPerChar, CEILING)] = true; } this.validPadding = validPadding; } char encode(int bits) { return chars[bits]; } boolean isValidPaddingStartPosition(int index) { return validPadding[index % charsPerChunk]; } int decode(char ch) throws IOException { if (ch > Ascii.MAX || decodabet[ch] == -1) { throw new DecodingException("Unrecognized character: " + ch); } return decodabet[ch]; } private boolean hasLowerCase() { for (char c : chars) { if (Ascii.isLowerCase(c)) { return true; } } return false; } private boolean hasUpperCase() { for (char c : chars) { if (Ascii.isUpperCase(c)) { return true; } } return false; } Alphabet upperCase() { if (!hasLowerCase()) { return this; } else { checkState(!hasUpperCase(), "Cannot call upperCase() on a mixed-case alphabet"); char[] upperCased = new char[chars.length]; for (int i = 0; i < chars.length; i++) { upperCased[i] = Ascii.toUpperCase(chars[i]); } return new Alphabet(name + ".upperCase()", upperCased); } } Alphabet lowerCase() { if (!hasUpperCase()) { return this; } else { checkState(!hasLowerCase(), "Cannot call lowerCase() on a mixed-case alphabet"); char[] lowerCased = new char[chars.length]; for (int i = 0; i < chars.length; i++) { lowerCased[i] = Ascii.toLowerCase(chars[i]); } return new Alphabet(name + ".lowerCase()", lowerCased); } } @Override public boolean matches(char c) { return CharMatcher.ASCII.matches(c) && decodabet[c] != -1; } @Override public String toString() { return name; } } static final class StandardBaseEncoding extends BaseEncoding { // TODO(user): provide a useful toString private final Alphabet alphabet; @Nullable private final Character paddingChar; StandardBaseEncoding(String name, String alphabetChars, @Nullable Character paddingChar) { this(new Alphabet(name, alphabetChars.toCharArray()), paddingChar); } StandardBaseEncoding(Alphabet alphabet, @Nullable Character paddingChar) { this.alphabet = checkNotNull(alphabet); checkArgument(paddingChar == null || !alphabet.matches(paddingChar), "Padding character %s was already in alphabet", paddingChar); this.paddingChar = paddingChar; } @Override CharMatcher padding() { return (paddingChar == null) ? CharMatcher.NONE : CharMatcher.is(paddingChar.charValue()); } @Override int maxEncodedSize(int bytes) { return alphabet.charsPerChunk * divide(bytes, alphabet.bytesPerChunk, CEILING); } @Override ByteOutput encodingStream(final CharOutput out) { checkNotNull(out); return new ByteOutput() { int bitBuffer = 0; int bitBufferLength = 0; int writtenChars = 0; @Override public void write(byte b) throws IOException { bitBuffer <<= 8; bitBuffer |= b & 0xFF; bitBufferLength += 8; while (bitBufferLength >= alphabet.bitsPerChar) { int charIndex = (bitBuffer >> (bitBufferLength - alphabet.bitsPerChar)) & alphabet.mask; out.write(alphabet.encode(charIndex)); writtenChars++; bitBufferLength -= alphabet.bitsPerChar; } } @Override public void flush() throws IOException { out.flush(); } @Override public void close() throws IOException { if (bitBufferLength > 0) { int charIndex = (bitBuffer << (alphabet.bitsPerChar - bitBufferLength)) & alphabet.mask; out.write(alphabet.encode(charIndex)); writtenChars++; if (paddingChar != null) { while (writtenChars % alphabet.charsPerChunk != 0) { out.write(paddingChar.charValue()); writtenChars++; } } } out.close(); } }; } @Override int maxDecodedSize(int chars) { return (int) ((alphabet.bitsPerChar * (long) chars + 7L) / 8L); } @Override ByteInput decodingStream(final CharInput reader) { checkNotNull(reader); return new ByteInput() { int bitBuffer = 0; int bitBufferLength = 0; int readChars = 0; boolean hitPadding = false; final CharMatcher paddingMatcher = padding(); @Override public int read() throws IOException { while (true) { int readChar = reader.read(); if (readChar == -1) { if (!hitPadding && !alphabet.isValidPaddingStartPosition(readChars)) { throw new DecodingException("Invalid input length " + readChars); } return -1; } readChars++; char ch = (char) readChar; if (paddingMatcher.matches(ch)) { if (!hitPadding && (readChars == 1 || !alphabet.isValidPaddingStartPosition(readChars - 1))) { throw new DecodingException("Padding cannot start at index " + readChars); } hitPadding = true; } else if (hitPadding) { throw new DecodingException( "Expected padding character but found '" + ch + "' at index " + readChars); } else { bitBuffer <<= alphabet.bitsPerChar; bitBuffer |= alphabet.decode(ch); bitBufferLength += alphabet.bitsPerChar; if (bitBufferLength >= 8) { bitBufferLength -= 8; return (bitBuffer >> bitBufferLength) & 0xFF; } } } } @Override public void close() throws IOException { reader.close(); } }; } @Override public BaseEncoding omitPadding() { return (paddingChar == null) ? this : new StandardBaseEncoding(alphabet, null); } @Override public BaseEncoding withPadChar(char padChar) { if (8 % alphabet.bitsPerChar == 0 || (paddingChar != null && paddingChar.charValue() == padChar)) { return this; } else { return new StandardBaseEncoding(alphabet, padChar); } } @Override public BaseEncoding withSeparator(String separator, int afterEveryChars) { checkNotNull(separator); checkArgument(padding().or(alphabet).matchesNoneOf(separator), "Separator cannot contain alphabet or padding characters"); return new SeparatedBaseEncoding(this, separator, afterEveryChars); } private transient BaseEncoding upperCase; private transient BaseEncoding lowerCase; @Override public BaseEncoding upperCase() { BaseEncoding result = upperCase; if (result == null) { Alphabet upper = alphabet.upperCase(); result = upperCase = (upper == alphabet) ? this : new StandardBaseEncoding(upper, paddingChar); } return result; } @Override public BaseEncoding lowerCase() { BaseEncoding result = lowerCase; if (result == null) { Alphabet lower = alphabet.lowerCase(); result = lowerCase = (lower == alphabet) ? this : new StandardBaseEncoding(lower, paddingChar); } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder("BaseEncoding."); builder.append(alphabet.toString()); if (8 % alphabet.bitsPerChar != 0) { if (paddingChar == null) { builder.append(".omitPadding()"); } else { builder.append(".withPadChar(").append(paddingChar).append(')'); } } return builder.toString(); } } static CharInput ignoringInput(final CharInput delegate, final CharMatcher toIgnore) { checkNotNull(delegate); checkNotNull(toIgnore); return new CharInput() { @Override public int read() throws IOException { int readChar; do { readChar = delegate.read(); } while (readChar != -1 && toIgnore.matches((char) readChar)); return readChar; } @Override public void close() throws IOException { delegate.close(); } }; } static CharOutput separatingOutput( final CharOutput delegate, final String separator, final int afterEveryChars) { checkNotNull(delegate); checkNotNull(separator); checkArgument(afterEveryChars > 0); return new CharOutput() { int charsUntilSeparator = afterEveryChars; @Override public void write(char c) throws IOException { if (charsUntilSeparator == 0) { for (int i = 0; i < separator.length(); i++) { delegate.write(separator.charAt(i)); } charsUntilSeparator = afterEveryChars; } delegate.write(c); charsUntilSeparator--; } @Override public void flush() throws IOException { delegate.flush(); } @Override public void close() throws IOException { delegate.close(); } }; } static final class SeparatedBaseEncoding extends BaseEncoding { private final BaseEncoding delegate; private final String separator; private final int afterEveryChars; private final CharMatcher separatorChars; SeparatedBaseEncoding(BaseEncoding delegate, String separator, int afterEveryChars) { this.delegate = checkNotNull(delegate); this.separator = checkNotNull(separator); this.afterEveryChars = afterEveryChars; checkArgument( afterEveryChars > 0, "Cannot add a separator after every %s chars", afterEveryChars); this.separatorChars = CharMatcher.anyOf(separator).precomputed(); } @Override CharMatcher padding() { return delegate.padding(); } @Override int maxEncodedSize(int bytes) { int unseparatedSize = delegate.maxEncodedSize(bytes); return unseparatedSize + separator.length() * divide(Math.max(0, unseparatedSize - 1), afterEveryChars, FLOOR); } @Override ByteOutput encodingStream(final CharOutput output) { return delegate.encodingStream(separatingOutput(output, separator, afterEveryChars)); } @Override int maxDecodedSize(int chars) { return delegate.maxDecodedSize(chars); } @Override ByteInput decodingStream(final CharInput input) { return delegate.decodingStream(ignoringInput(input, separatorChars)); } @Override public BaseEncoding omitPadding() { return delegate.omitPadding().withSeparator(separator, afterEveryChars); } @Override public BaseEncoding withPadChar(char padChar) { return delegate.withPadChar(padChar).withSeparator(separator, afterEveryChars); } @Override public BaseEncoding withSeparator(String separator, int afterEveryChars) { throw new UnsupportedOperationException("Already have a separator"); } @Override public BaseEncoding upperCase() { return delegate.upperCase().withSeparator(separator, afterEveryChars); } @Override public BaseEncoding lowerCase() { return delegate.lowerCase().withSeparator(separator, afterEveryChars); } @Override public String toString() { return delegate.toString() + ".withSeparator(\"" + separator + "\", " + afterEveryChars + ")"; } } }
072cc1971e6fec2e0153447eaeff663317c178ce
1b0c79bcd4ea7d2f3d4ff5d8c87d2bdbe4b1d3d0
/src/main/java/com/urantia/teams/service/OrdersService.java
f307ef53b1124ca62f4366819630e176fd195410
[]
no_license
BulkSecurityGeneratorProject/UrantiApp
d9e825461561a8a27ef7b388eb0f3acd5750c295
6f933ac474025fdd6ca9e1993fb2c2eacc911aae
refs/heads/master
2022-12-22T00:47:36.970588
2018-03-09T22:33:44
2018-03-09T22:33:44
296,586,059
0
0
null
2020-09-18T10:13:32
2020-09-18T10:13:31
null
UTF-8
Java
false
false
886
java
package com.urantia.teams.service; import com.urantia.teams.service.dto.OrdersDTO; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; /** * Service Interface for managing Orders. */ public interface OrdersService { /** * Save a orders. * * @param ordersDTO the entity to save * @return the persisted entity */ OrdersDTO save(OrdersDTO ordersDTO); /** * Get all the orders. * * @param pageable the pagination information * @return the list of entities */ Page<OrdersDTO> findAll(Pageable pageable); /** * Get the "id" orders. * * @param id the id of the entity * @return the entity */ OrdersDTO findOne(String id); /** * Delete the "id" orders. * * @param id the id of the entity */ void delete(String id); }
eac89032614db5d345cf02a02ab9f671b03033d8
91d280521dfc59d58832d160487b125ee833f351
/src/com/scf/news/bean/News.java
fcb830a3d5a17be0850bdcf65b06e0bbda5de7c2
[]
no_license
schumali/SCF
346192925ce34de2c133b54684b8a84acbaa55f8
5b8e86b80c9dafadb924a4444c3cf8ef0386ecde
refs/heads/master
2020-05-25T19:36:48.757826
2019-05-22T04:00:03
2019-05-22T04:00:03
187,955,308
0
0
null
null
null
null
UTF-8
Java
false
false
633
java
package com.scf.news.bean; public class News { private String id; private String ntitle; private String ndate; private String ncontent; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getNtitle() { return ntitle; } public void setNtitle(String ntitle) { this.ntitle = ntitle; } public String getNdate() { return ndate; } public void setNdate(String ndate) { this.ndate = ndate; } public String getNcontent() { return ncontent; } public void setNcontent(String ncontent) { this.ncontent = ncontent; } }
23c0de0c4cd5b335db8e5ab694e411fb463c5c11
ec1fb584bd49a625c2f899fedd6392bd71bb0d7b
/src/main/java/RandomizedCollection.java
ea0f90014b7cb3c1374f714114db56b90806c326
[]
no_license
uniquews/CodePractice
a0ef1929a6263bbc9e6224194e565d563b330fa6
06bd5bc5f1e403b6410c645215ead3cd0194382e
refs/heads/master
2021-08-29T18:22:28.099694
2017-12-14T15:45:11
2017-12-14T15:45:11
63,659,531
4
0
null
2017-12-14T15:45:13
2016-07-19T04:08:23
Java
UTF-8
Java
false
false
1,805
java
import java.util.*; public class RandomizedCollection { Map<Integer, Set<Integer>> map; List<Integer> list; Random rand; public RandomizedCollection() { list = new ArrayList<>(); map = new HashMap<>(); rand = new Random(); } /** Inserts a value to the collection. Returns true if the collection did not already contain the specified element. */ public boolean insert(int val) { boolean result = false; if (!map.containsKey(val)) { result = true; } int size = list.size(); Set<Integer> indices = map.getOrDefault(val, new HashSet<>()); indices.add(size); map.put(val, indices); list.add(val); return result; } /** Removes a value from the collection. Returns true if the collection contained the specified element. */ public boolean remove(int val) { if (!map.containsKey(val)) { return false; } int index1 = map.get(val).iterator().next(); int index2 = list.size() - 1; int num1 = val; int num2 = list.get(list.size() - 1); swap(index1, index2); map.get(num1).remove(index1); map.get(num2).remove(index2); map.get(num1).add(index2); map.get(num2).add(index1); map.get(num1).remove(index2); if (map.get(num1).size() == 0) { map.remove(num1); } list.remove(list.size() - 1); return true; } private void swap(int i, int j) { int tmp = list.get(i); list.set(i, list.get(j)); list.set(j, tmp); } /** Get a random element from the collection. */ public int getRandom() { int pos = rand.nextInt(list.size()); return list.get(pos); } }
c03b0b6644bf8e9faa991e5fc5d37724e65a72f3
27a5642c8e0ddf3c89c12d0734dd2e2fdb68999f
/multisource/src/main/java/com/fm/multisource/web/ParameterBasedRouter.java
a2b59f8ee06bfb3938ec0d5150c162ca127bbbec
[]
no_license
beku8/multisource
8dd8f11d85c9089c85dee61cc9e0da7962f53cbf
fbdab4b5f18c9d47a812fffd4fe86197f12c3320
refs/heads/master
2016-09-05T13:17:14.075523
2012-12-15T16:15:53
2012-12-15T16:15:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,120
java
package com.fm.multisource.web; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import com.fm.multisource.dao.hibernate.ItemDao; import com.fm.multisource.datasource.CustomerContextHolder; @Controller @RequestMapping("/param") public class ParameterBasedRouter { @Autowired private ItemDao itemDao; @Autowired private UserDetailsService userDetailsService; private Logger logger = LoggerFactory.getLogger(getClass()); @RequestMapping public String get(@RequestParam(value="source", defaultValue="1") Integer source, Model model){ CustomerContextHolder.setCustomerType(source); logger.debug("setting source to {}", source); model.addAttribute("items", itemDao.findAll()); model.addAttribute("source", source); return "param"; } @RequestMapping("/switch") public String get(){ String username = SecurityContextHolder.getContext().getAuthentication().getName(); logger.debug("switching for user {}", username); UserDetails userDetails; if(username.equalsIgnoreCase("koala")){ userDetails = userDetailsService.loadUserByUsername("admin"); } else{ userDetails = userDetailsService.loadUserByUsername("koala"); } Authentication authentication = new UsernamePasswordAuthenticationToken(userDetails.getUsername(), userDetails.getPassword(), userDetails.getAuthorities()); logger.debug("re-authenticating..."); SecurityContextHolder.getContext().setAuthentication(authentication); return "redirect:/user"; } }
7b6be2cb330d7ab08739ac2bf8ce08af455e90b6
57074e4aef4971b3c48a3ce81f42b6affb51d7a9
/src/bs/util/web/tool/eclipse/ProjectPropertiesDeal.java
d3211e121ab37d2675d13c3b578bf605c9736c1c
[ "Apache-2.0" ]
permissive
iqiancheng/common_gui_tools
355e0177729ddc03c537b12cf2058bcc27f49f9b
a4defdb11c1aacfda36a667c113beac18074461f
refs/heads/master
2021-01-15T08:31:40.982284
2014-10-17T01:37:06
2014-10-17T01:37:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,957
java
package bs.util.web.tool.eclipse; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import java.util.Properties; import javax.swing.JTextArea; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; /** * Eclipse Project Properties Deal. * * @author baishui2004 * @version 1.1 * @date 2013-4-5 */ public class ProjectPropertiesDeal implements ProjectPropertiesDealInterface { /** * Eclipse的Java Project、Dynamic Web Project或者MyEclipse的Web Project绝对路径地址. */ private String projectPath; /** * 解析文件'.project'以获取Project Name, 此种方法要求'.project'文件根节点的第一个name子节点即是Project Name. */ private String projectNameFile = "/.project"; /** * 解析文件'.settings/org.eclipse.jdt.core.prefs'以获取compileSource以及compileTarget. */ private String compilePropsFile = "/.settings/org.eclipse.jdt.core.prefs"; /** * 如果没有'.settings/org.eclipse.jdt.core.prefs'文件,则解析文件'.settings/org.eclipse.wst.common.project.facet.core.xml'以"installed java facet version". */ private String projectFacetCoreFile = "/.settings/org.eclipse.wst.common.project.facet.core.xml"; /** * 解析文件'.classpath'以获取javaSourcesPath以及outputPath. */ private String classpathFile = "/.classpath"; /** * 解析文件'.settings/.jsdtscope'以获取webappPath. */ private String webappPropsFile = "/.settings/.jsdtscope"; /** * Project Name. */ private String projectName; /** * Java Compile Source. */ private String compileSource; /** * Java Compile Target. */ private String compileTarget; /** * Java Sources path. */ private String[] javaSourcesPath; /** * Output classes path. */ private String outputPath; /** * 是否是Java Web Project. */ private boolean javaWebProject; /** * Project Webapp path. */ private String webappPath; /** * Main入口. * * <pre> * 只接受传入一个参数, 即Eclipse的Java Project、Dynamic Web Project或者MyEclipse的Web Project绝对路径地址. * </pre> */ public static void main(String[] args) throws IOException { if (args.length != 1) { throw new IllegalArgumentException("Parameters error."); } ProjectPropertiesDealInterface propertiesDeal = new ProjectPropertiesDeal(); propertiesDeal.deal(args[0]); } /** * 解析属性文件获得Project相关属性. */ public void deal(String projectPath) throws IOException { setProjectPath(projectPath); if (!isJavaOrJavaWebEclipseProject(projectPath)) { throw new IllegalArgumentException("The Path: \'" + projectPath + "\' not has a Eclipse Java Project, Dynamic Web Project or MyEclipse Web Project."); } dealProjectName(); dealCompileSourceAndTarget(); dealSourceAndOutput(); if (isJavaWebProject()) { dealWebappPath(); } print("************ Project properties Start ************"); print("Project Path: " + projectPath); print("Project Name: " + getProjectName()); print("Java Compile Source: " + getCompileSource()); print("Java Compile Target: " + getCompileTarget()); String[] javaSourcesPath = getJavaSourcesPath(); if (javaSourcesPath != null) { for (int i = 0; i < javaSourcesPath.length; i++) { print("Sources Path: " + javaSourcesPath[i]); } } print("Output Path: " + getOutputPath()); print("Is Java Web Project: " + isJavaWebProject()); if (isJavaWebProject()) { print("Webapp Path: " + getWebappPath()); } print("************ Project properties End ************\n"); } /** * 运行日志输出文本域. */ private JTextArea runLogTextArea; public void setRunLogTextArea(JTextArea runLogTextArea) { this.runLogTextArea = runLogTextArea; } /** * 输出. */ private void print(String log) { if (runLogTextArea != null) { runLogTextArea.append(log + "\n"); } else { System.out.print(log + "\n"); } } /** * 是否是Eclipse 的Java Project、Dynamic Web Project或者MyEclipse的Web Project. */ public boolean isJavaOrJavaWebEclipseProject(String projectPath) { if (!new File(projectPath + this.projectNameFile).exists()) { return false; } else if (!new File(projectPath + this.compilePropsFile).exists() && !new File(projectPath + this.projectFacetCoreFile).exists()) { return false; } else if (!new File(projectPath + this.classpathFile).exists()) { return false; } if (!new File(this.projectPath + this.webappPropsFile).exists()) { javaWebProject = false; } else { javaWebProject = true; } return true; } public boolean isJavaWebProject() { return this.javaWebProject; } public String getProjectPath() { return this.projectPath; } public void setProjectPath(String projectPath) { this.projectPath = projectPath; } public String getProjectName() { return this.projectName; } public String getCompileSource() { return this.compileSource; } public String getCompileTarget() { return this.compileTarget; } public String[] getJavaSourcesPath() { return this.javaSourcesPath; } public String getOutputPath() { return this.outputPath; } public String getWebappPath() { return this.webappPath; } /** * 解析文件'.project'以获取Project Name, 此种方法要求'.project'文件根节点的第一个name子节点即是Project Name. */ private void dealProjectName() throws FileNotFoundException { String xmlPath = this.projectPath + this.projectNameFile; parseXmlProperties(xmlPath, new XmlParse() { @Override public void parse(XMLStreamReader reader) throws XMLStreamException { boolean pdFlag = false; boolean pnFlag = false; while (reader.hasNext()) { int i = reader.next(); if (i == XMLStreamConstants.START_ELEMENT) { String elementName = reader.getLocalName(); if ("projectDescription".equals(elementName)) { pdFlag = true; } if (pdFlag && "name".equals(elementName)) { pnFlag = true; } } if (pnFlag && reader.hasText()) { projectName = reader.getText().trim(); break; } } } }); } /** * 解析文件'.settings/org.eclipse.jdt.core.prefs'以获取compileSource以及compileTarget. * 如果没有'.settings/org.eclipse.jdt.core.prefs'文件,则解析文件'.settings/org.eclipse.wst.common.project.facet.core.xml'以获取"installed java facet version". */ private void dealCompileSourceAndTarget() throws IOException { String filePath = this.projectPath + this.compilePropsFile; if (new File(filePath).exists()) { Properties properties = new Properties(); InputStream in = null; try { in = new FileInputStream(new File(filePath)); properties.load(in); } finally { if (in != null) { in.close(); } } compileSource = properties.getProperty("org.eclipse.jdt.core.compiler.source"); compileTarget = properties.getProperty("org.eclipse.jdt.core.compiler.compliance"); } else { String xmlPath = this.projectPath + this.projectFacetCoreFile; parseXmlProperties(xmlPath, new XmlParse() { @Override public void parse(XMLStreamReader reader) throws XMLStreamException { while (reader.hasNext()) { int i = reader.next(); if (i == XMLStreamConstants.START_ELEMENT) { String elementName = reader.getLocalName(); if ("installed".equals(elementName)) { String kind = reader.getAttributeValue(null, "facet"); if ("java".equals(kind)) { compileSource = reader.getAttributeValue(null, "version"); compileTarget = compileSource; } } } } } }); } } /** * 解析文件'.classpath'以获取javaSourcesPath以及outputPath. */ private void dealSourceAndOutput() throws FileNotFoundException { String xmlPath = this.projectPath + this.classpathFile; parseXmlProperties(xmlPath, new XmlParse() { @Override public void parse(XMLStreamReader reader) throws XMLStreamException { List<String> javaSourcesPaths = new ArrayList<String>(); while (reader.hasNext()) { int i = reader.next(); if (i == XMLStreamConstants.START_ELEMENT) { String elementName = reader.getLocalName(); if ("classpathentry".equals(elementName)) { String kind = reader.getAttributeValue(null, "kind"); String path = reader.getAttributeValue(null, "path"); if ("src".equals(kind)) { javaSourcesPaths.add(path); } else if ("output".equals(kind)) { outputPath = path; } } } } javaSourcesPath = new String[javaSourcesPaths.size()]; for (int i = 0; i < javaSourcesPath.length; i++) { javaSourcesPath[i] = javaSourcesPaths.get(i); } } }); } /** * 解析文件'.settings/.jsdtscope'以获取webappPath. */ private void dealWebappPath() throws FileNotFoundException { String xmlPath = this.projectPath + this.webappPropsFile; parseXmlProperties(xmlPath, new XmlParse() { @Override public void parse(XMLStreamReader reader) throws XMLStreamException { while (reader.hasNext()) { int i = reader.next(); if (i == XMLStreamConstants.START_ELEMENT) { String elementName = reader.getLocalName(); if ("classpathentry".equals(elementName)) { String kind = reader.getAttributeValue(null, "kind"); if ("src".equals(kind)) { webappPath = reader.getAttributeValue(null, "path"); } } } } } }); } /** * 解析XML接口. */ private interface XmlParse { void parse(XMLStreamReader reader) throws XMLStreamException; } /** * 解析XML. */ private static void parseXmlProperties(String xmlPath, XmlParse xmlParse) throws FileNotFoundException { XMLInputFactory factory = XMLInputFactory.newInstance(); InputStream stream = null; XMLStreamReader reader = null; try { stream = new FileInputStream(new File(xmlPath)); reader = factory.createXMLStreamReader(stream); xmlParse.parse(reader); } catch (XMLStreamException e) { e.printStackTrace(); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { e.printStackTrace(); } finally { if (reader != null) { try { reader.close(); } catch (XMLStreamException e) { e.printStackTrace(); } } } } } } }
a4f62d82ccfdde2b0648fcb85fc4dbcfe2747172
161abfbf639ca57742cd54f351b760ecccdfc78a
/src/main/java/com/example/demo/cmm/domain/Pagination.java
3ccfd0b6c2004340aa9f9c2e382046825ced52a5
[]
no_license
ElinWonyoungPARK/finalProject-be
ca962c30fcf67b030a1b6338b5891d6af12ee235
a82a3489b9fce7c9f2545bebb769b54683ca247a
refs/heads/master
2023-03-28T15:00:44.503012
2021-03-26T00:49:51
2021-03-26T00:49:51
351,618,297
0
0
null
null
null
null
UTF-8
Java
false
false
2,398
java
package com.example.demo.cmm.domain; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import lombok.Data; @Component("page") @Data @Lazy public class Pagination { private int totalCount, startRow, endRow, pageCount, pageSize, startPage, endPage, pageNum, blockCount, prevBlock, nextBlock, blockNum; public final int BLOCK_SIZE = 5; private String tname; private boolean existPrev, existNext; public Pagination(){} // SQL 방식 public Pagination(String tname, int pageSize, int pageNum, int count) { this.tname = tname; this.pageSize = pageSize; this.pageNum = pageNum; this.totalCount = count; this.pageCount = (totalCount % pageSize != 0) ? totalCount / pageSize + 1: totalCount / pageSize; this.blockCount = (pageCount % BLOCK_SIZE != 0) ? pageCount / BLOCK_SIZE + 1: pageCount / BLOCK_SIZE; this.startRow = (pageNum - 1) * pageSize; this.endRow = (pageCount != pageNum) ? startRow + pageSize - 1 : totalCount - 1; this.blockNum = (pageNum - 1) / BLOCK_SIZE; this.startPage = blockNum * BLOCK_SIZE + 1; this.endPage = ((blockNum + 1) != blockCount) ? startPage + (BLOCK_SIZE - 1) : pageCount; this.existPrev = blockNum != 0; this.existNext = (blockNum + 1) != blockCount; this.nextBlock = startPage + BLOCK_SIZE; this.prevBlock = startPage - BLOCK_SIZE; } // POJO 방식을 위한 생성자 오버로드 public Pagination(int pageSize, int pageNum, int count) { this.pageSize = pageSize; this.pageNum = pageNum; this.totalCount = count; this.pageCount = (totalCount % pageSize != 0) ? totalCount / pageSize + 1: totalCount / pageSize; this.blockCount = (pageCount % BLOCK_SIZE != 0) ? pageCount / BLOCK_SIZE + 1: pageCount / BLOCK_SIZE; this.startRow = (pageNum - 1) * pageSize; this.endRow = (pageCount != pageNum) ? startRow + pageSize - 1 : totalCount - 1; this.blockNum = (pageNum - 1) / BLOCK_SIZE; this.startPage = blockNum * BLOCK_SIZE + 1; this.endPage = ((blockNum + 1) != blockCount) ? startPage + (BLOCK_SIZE - 1) : pageCount; this.existPrev = blockNum != 0; this.existNext = (blockNum + 1) != blockCount; this.nextBlock = startPage + BLOCK_SIZE; this.prevBlock = startPage - BLOCK_SIZE; } }
1c067dbf9fadb777adc4ff4e3c78ec0581e348fe
110db981699883f838f1ac81c2fa440ffaa90dbe
/src/main/java/blackjack/Hand.java
a245d9d05302e2564b7cde917763ee2c989ec97f
[]
no_license
kguy090597/COMP3004BlackJack
8baad2ce0f3339c9604a054d116013f5d2545089
ff8730dd88f2fec71dd497081bd9c2fde8716640
refs/heads/master
2020-03-28T15:09:32.522294
2018-09-19T18:10:28
2018-09-19T18:10:28
148,561,921
0
0
null
null
null
null
UTF-8
Java
false
false
4,324
java
package blackjack; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; /** * Hand class that contains the cards in the hand * * @author Kevin Guy * Date: September 15th, 2018 */ public class Hand { //The list containing the cards in the hand private ArrayList<Card> hand; /** * The constructor class for the Hand class */ Hand(){ hand = new ArrayList<Card>(); } /** * Adds a card to the hand * * @param card The card to be added to the hand */ public void add(Card card) { hand.add(card); } /** * Sorts the cards in the hand by value from lowest to highest to help with summation * * @param hand The hand that is to be sorted */ private void sort(ArrayList<Card> hand) { Comparator<Card> compare = (Card a, Card b) -> { return a.getValue() - (b.getValue()); }; Collections.sort(hand, compare); } /** * Returns whether or not the hand has a blackjack * * @return true if hand == 21 or false otherwise */ public boolean isBlackJack() { return sumHand() == 21; } /** * Returns whether or not the hand is over 21 * * @return true if hand > 21 or false otherwise */ public boolean isOver() { return sumHand() > 21; } /** * Adds up all the cards in the hand and returns the value * * @return The value of all the cards in the hand */ public int sumHand() { //The temporary hand so the real hand order does not change ArrayList<Card> tmpHand = hand; //Sorts the temporary hand sort(tmpHand); //Keeps track of the total sum int sum = 0; //Boolean indicating if an ace was previously added boolean prevAce = false; //loops through the hand and adds the value to the sum for(int i = 0; i < tmpHand.size(); i++) { //if the last card in the hand is an ace if(tmpHand.get(i).getRank().equals("A") && i == tmpHand.size() - 1) { //checks to see if an ace was played previously and a blackjack can be achieved by the ace value being 1 if (sum + 1 == 21 && prevAce) { sum += 1; } //checks to see if an ace has been played previously and if the sum would be greater than 21 if the ace value was 11 else if(sum + 11 > 21 && prevAce) { //subtracts 10 from the sum so the previous ace is considered a value of 1 sum -= 10; sum += 1; } //checks to see if the sum would be greater than 21 if the ace value was 11 else if (sum + 11 > 21) { sum += 1; } else { sum += tmpHand.get(i).getValue(); } } //if the ace is not the last card in the hand else if (tmpHand.get(i).getRank().equals("A")) { //checks to see if the sum would be greater than 21 if the ace value was 11 if (sum + 11 > 21) { sum += 1; } else { sum += tmpHand.get(i).getValue(); } prevAce = true; } else { sum += tmpHand.get(i).getValue(); } } return sum; } /** * Returns whether or not the hand is a soft 17 (Ace is 11 and other cards sum to 6) * * @return whether or not the hand is a soft 17 */ public boolean isSoft17() { //The temporary hand so the real hand order does not change ArrayList<Card> tmpHand = hand; //The temporary sum that adds up the cards that aren't Aces int tmpSum = 0; //Sorts the temporary hand by value (from least to greatest) sort(tmpHand); //Checks if the sum is 17 if (sumHand()==17) { //Goes through the cards in the hand for (int i = 0; i < tmpHand.size(); i++) { //Checks to see if the card is an Ace if(tmpHand.get(i).getRank().equals("A")) { //If the sum of the cards before the Ace are 6 then it is a soft 17 if(tmpSum==6) { return true; } //Sum of cards that aren't Aces is not 6 else { return false; } } else { tmpSum+=tmpHand.get(i).getValue(); } } } //Sum of hand is not 17 else { return false; } return false; } /** * Returns the cards in the hand as a list * * @return the cards in the hand */ public ArrayList<Card> getHand(){ return hand; } /** * Returns the hand as a string with cards separated by spaces (" ") */ public String toString() { String cards = ""; for (int i = 0; i < hand.size(); i++) { cards += hand.get(i).toString() + " "; } return cards.trim(); } }
9cefe5811b6f49cbc75ba6cfefe5092ed10e5057
129f58086770fc74c171e9c1edfd63b4257210f3
/src/testcases/CWE190_Integer_Overflow/CWE190_Integer_Overflow__long_max_square_01.java
60926a977945dd233bb51a93b998f7978e451c97
[]
no_license
glopezGitHub/Android23
1bd0b6a6c7ce3c7439a74f1e4dcef2c4c0fac4ba
6215d0684c4fbdc7217ccfbedfccfca69824cc5e
refs/heads/master
2023-03-07T15:14:59.447795
2023-02-06T13:59:49
2023-02-06T13:59:49
6,856,387
0
3
null
2023-02-06T18:38:17
2012-11-25T22:04:23
Java
UTF-8
Java
false
false
2,866
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE190_Integer_Overflow__long_max_square_01.java Label Definition File: CWE190_Integer_Overflow.label.xml Template File: sources-sinks-01.tmpl.java */ /* * @description * CWE: 190 Integer Overflow * BadSource: max Set data to the max value for long * GoodSource: A hardcoded non-zero, non-min, non-max, even number * Sinks: square * GoodSink: Ensure there will not be an overflow before squaring data * BadSink : Square data, which can lead to overflow * Flow Variant: 01 Baseline * * */ package testcases.CWE190_Integer_Overflow; import testcasesupport.*; import java.sql.*; import javax.servlet.http.*; import java.lang.Math; public class CWE190_Integer_Overflow__long_max_square_01 extends AbstractTestCase { public void bad() throws Throwable { long data; /* POTENTIAL FLAW: Use the maximum size of the data type */ data = Long.MAX_VALUE; /* POTENTIAL FLAW: if (data*data) > Long.MAX_VALUE, this will overflow */ long result = (long)(data * data); IO.writeLine("result: " + result); } public void good() throws Throwable { goodG2B(); goodB2G(); } /* goodG2B() - use goodsource and badsink */ private void goodG2B() throws Throwable { long data; /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */ data = 2; /* POTENTIAL FLAW: if (data*data) > Long.MAX_VALUE, this will overflow */ long result = (long)(data * data); IO.writeLine("result: " + result); } /* goodB2G() - use badsource and goodsink */ private void goodB2G() throws Throwable { long data; /* POTENTIAL FLAW: Use the maximum size of the data type */ data = Long.MAX_VALUE; /* FIX: Add a check to prevent an overflow from occurring */ /* NOTE: Math.abs of the minimum int or long will return that same value, so we must check for it */ if ((data != Integer.MIN_VALUE) && (data != Long.MIN_VALUE) && (Math.abs(data) <= (long)Math.sqrt(Long.MAX_VALUE))) { long result = (long)(data * data); IO.writeLine("result: " + result); } else { IO.writeLine("data value is too large to perform squaring."); } } /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException { mainFromParent(args); } }
aa4e2838e6b3a11447bd360f932a6c060bd389af
396b41de70768f638f969c5651786f3b7164ac76
/app/src/main/java/istia/ei4/pm/ia/IEndCondition.java
eafe383ffbae571063db4aca2d7a437394a40255
[]
no_license
imefGames/ProjetEi4_Android
bf4f34461d07250bf0eebff9d3a9d5b0d3c158bf
882bc4416f6dd8142feccb176f5f51259c755350
refs/heads/master
2021-05-02T10:32:41.252980
2015-04-17T10:26:51
2015-04-17T10:26:51
32,866,419
1
1
null
2016-02-01T21:18:06
2015-03-25T13:31:29
Java
UTF-8
Java
false
false
156
java
package istia.ei4.pm.ia; /** * * @author Pierre Michel */ public interface IEndCondition { public boolean checkEnd(AWorld world, AGameState state); }
5c9466a3c07409a60861e4b6afc2df74fc172a11
30eec04eea70527b9803e5147437db9e7f9062a2
/app/src/main/java/main/inventoryapp/st1nger13/me/inventoryapp/CustomListAdapter.java
18a8a9835bb008c277cc881d2fd783dc26e97e4a
[]
no_license
St1nger13/udacity-android-beginners-inventoryapp
f8b46e8fd3d5ac9d2287acc5f2122ae51007d44d
3c320bd7a41a6328a55ba06f3800810bef5c8eba
refs/heads/master
2021-01-17T20:27:42.458214
2016-07-12T16:23:48
2016-07-12T16:23:48
62,442,985
0
0
null
null
null
null
UTF-8
Java
false
false
2,365
java
package main.inventoryapp.st1nger13.me.inventoryapp; import android.app.Activity; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.TextView; import java.util.List; /** * Created by St1nger13 on 29.06.2016. */ public class CustomListAdapter extends ArrayAdapter<Product> { private List<Product> items ; private int layoutResourceId ; private Context context ; public CustomListAdapter(Context context, int layoutResourceId, List<Product> items) { super(context, layoutResourceId, items) ; this.layoutResourceId = layoutResourceId ; this.context = context ; this.items = items ; } @Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView ; InventoryElementHolder holder = null ; LayoutInflater inflater = ((Activity) context).getLayoutInflater() ; row = inflater.inflate(layoutResourceId, parent, false) ; holder = new InventoryElementHolder() ; holder.element = items.get(position) ; holder.saleButton = (Button) row.findViewById(R.id.listItemSale) ; holder.saleButton.setTag(holder.element) ; holder.detailsButton = (Button) row.findViewById(R.id.listItemTitle) ; holder.detailsButton.setTag(holder.element) ; holder.title = (Button) row.findViewById(R.id.listItemTitle) ; holder.quantity = (TextView) row.findViewById(R.id.listItemQuantityView) ; holder.price = (TextView) row.findViewById(R.id.listItemPriceView) ; row.setTag(holder) ; setupItem(holder) ; return row ; } private void setupItem(InventoryElementHolder holder) { holder.title.setText(holder.element.getTitle().trim()) ; holder.quantity.setText(context.getString(R.string.quantity) + " " + holder.element.getQuantity()) ; holder.price.setText(context.getString(R.string.price) + " " + holder.element.getPrice()); } public static class InventoryElementHolder { Product element ; Button title ; TextView quantity ; TextView price ; Button saleButton ; Button detailsButton ; } }
1a1664ed506c3917e35c3ce1416d7d02edc9a2f5
49ad4ee85a6c17d7973b57c9b5195fc01500b433
/app/src/test/java/com/android/byc/servicebestpractice/ExampleUnitTest.java
8da0f917e8fb974b3e59bf6cf879b413923d4c28
[]
no_license
YuMENGQI/ServiceBestPractice
90ca81fe66070959b70bc041e71469433d82114c
f1983c3e24e5eb00248039f819250355185bcc80
refs/heads/master
2020-04-17T20:56:43.387696
2019-01-22T04:30:46
2019-01-22T04:30:46
166,927,372
0
0
null
null
null
null
UTF-8
Java
false
false
396
java
package com.android.byc.servicebestpractice; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
ae66bcea5ed3690d6d29f67c4b93970fb03100ab
bb9140f335d6dc44be5b7b848c4fe808b9189ba4
/Extra-DS/Corpus/norm-class/aspectj/2641.java
1003c5691b53adaba4f26c34bdbe2e226ee7184a
[]
no_license
masud-technope/EMSE-2019-Replication-Package
4fc04b7cf1068093f1ccf064f9547634e6357893
202188873a350be51c4cdf3f43511caaeb778b1e
refs/heads/master
2023-01-12T21:32:46.279915
2022-12-30T03:22:15
2022-12-30T03:22:15
186,221,579
5
3
null
null
null
null
UTF-8
Java
false
false
1,178
java
mode jde tab width indent tabs mode nil basic offset file debugger core tools aspect j aspectj programming language http aspectj org contents file subject mozilla license version license file compliance license copy license http mozilla org mpl http aspectj org mpl software distributed license distributed basis warranty kind express implied license specific language governing rights limitations license original code aspect j aspectj initial developer original code xerox corporation portions created xerox corporation copyright xerox corporation rights reserved org aspectj tools doclets standard sun javadoc class doc classdoc sun javadoc program element doc programelementdoc abstract sub writer aj abstractsubwriteraj print crosscuts printcrosscuts class doc classdoc program element doc programelementdoc member print summary crosscuts printsummarycrosscuts class doc classdoc program element doc programelementdoc member has crosscuts hascrosscuts class doc classdoc program element doc programelementdoc member print introduced summary anchor printintroducedsummaryanchor class doc classdoc print introduced summary label printintroducedsummarylabel class doc classdoc
42d498782f2eb1d0e711718ded78f609cc4d95ff
b9d27e62be1377c519d9f328f8b26c6e4b1ebd02
/app/src/main/java/abaco_digital/freedom360/Video.java
07df345f76b2e1427ebc294271c63020eee4f8d8
[]
no_license
SMalpica/Freedom360
21e5643ff0cdb4570bddd5a4a8f349296da59c43
a95bd370a0f70f383615d2bcfb272ddb719abbaa
refs/heads/master
2016-09-11T09:04:54.335627
2015-09-01T10:57:07
2015-09-01T10:57:07
37,458,572
3
0
null
null
null
null
UTF-8
Java
false
false
1,606
java
package abaco_digital.freedom360; import android.content.Context; import android.util.Log; import java.io.FileDescriptor; /** * Autor: Sandra Malpica Mallo * * Fecha: 23/06/2015 * * Clase: Video.java * * Comments: abstraction of a video. Used in the listview adapter to take * the information needed in the row views */ public class Video { private String imagen; private String path; private FileDescriptor fileDescriptor; private Context context; private int id; private String url; public Video(String img, Context context){ this.imagen = img; this.context=context; } public void setPath(String p){ this.path=p; } public String getPath(){ return this.path; } public void crearFrameSample(){ //make sure that the image exists. If not, create one with the first video image int imgId = auxiliar.existeImagen(this.imagen); Log.e("FRAMSE_SAMPLE", "img id " + imgId); if(imgId == 0){ //img was not found auxiliar.crearImagen(this,context);//create image sample } } public String getImagen(){ return this.imagen; } public void setImagen(String nuevaImg){ this.imagen= nuevaImg; } public void setFD(FileDescriptor fd){ this.fileDescriptor = fd; } public FileDescriptor getFD(){ return this.fileDescriptor;} public void setID(int id){this.id = id;} public int getID(){return this.id;} public void setURL (String url){ this.url = url; } public String getURL (){ return this.url;} }
63590c244e5db61cfd525b73922ab35db43fc817
b1acadb7c1a77667c37931b28374c26dc97dbcdc
/service/src/main/java/com/ifish/ms/core/biz/service/EncryptService.java
0c837395b2c3765cc211a71d3cd83d9c57f055e8
[]
no_license
ifishlam/ifish-ms
3847c566c98e4cb88a89ce701074d7333138a6a2
e6eeec4788c5321de4ea70e9dd6cf9b485613452
refs/heads/master
2021-05-15T20:20:41.243102
2018-01-31T10:50:42
2018-01-31T10:50:42
105,801,285
0
0
null
null
null
null
UTF-8
Java
false
false
491
java
/* * Copyright (c) 2017. iFish Studio. * * Licensed under the Apache License, Version 2.0 (the "License"); * * @author Angus Lam * @date 2017/11/24 * * */ package com.ifish.ms.core.biz.service; import com.ifish.ms.core.exception.ApplicationException; public interface EncryptService { /** * Encrypt the string by MD5 * * @param str * @return * @throws ApplicationException */ String encryptByMd5(String str) throws ApplicationException; }
97e9223bec99af4804d41aa67906c631a2bf8f18
ecc1e3fcc6562518f6b1062ad978c633f3024947
/app/src/test/java/com/example/biodatakel10/ExampleUnitTest.java
02ecabdf9a834a6c9faa56b5b59abfb3bc697f16
[]
no_license
rwarrrrr/BiodataKel10
ffde3c26649fa5975aec45eb27b4c835c56e15fa
b9e0b2d00df74d6f3e0899ab437ddbfc0e372989
refs/heads/master
2023-08-31T07:47:02.911045
2019-08-30T15:56:32
2019-08-30T15:56:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
385
java
package com.example.biodatakel10; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
4bc21af1ca387ce2d99e4edfb240edac4f25b7a3
cf24f669d1113cc967d246f35586c9a6e0f125f2
/Treevie/src/com/treevie/TreevieServlet.java
f099ef3c39ae11ad8fbd0d331f8a8355bf3cbd23
[]
no_license
ishener/treevy
f282167fc3531dff44aa7a5865aa6dbe32a6edac
6cdc162ac5492cf948a59d07537cfb2471282bc5
refs/heads/master
2020-04-22T08:22:06.478119
2012-10-29T11:18:19
2012-10-29T11:18:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
905
java
package com.treevie; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @SuppressWarnings("serial") public class TreevieServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { // resp.setContentType("text/plain"); // Date nowdate = new Date(); // resp.getWriter().println(nowdate); Question newq = new Question (); // newq.addWrongAnswer("answer 1624"); // newq.addWrongAnswer("answer 1925"); // newq.persist(true); req.setAttribute("question", newq); try { getServletContext().getRequestDispatcher("/show-main-question.jsp").forward(req, resp); } catch (ServletException e) { System.out.println (e.getMessage()); } } }
[ "moshe@MININT-TGCNQDK" ]
moshe@MININT-TGCNQDK
1e3c7dfff148a2373569ad1df8986566449c0d5b
729c851198dc513eabbb91f6fd805eb6f1b5cd28
/src/com/metamolecular/mx/test/ReducerTest.java
d2f37b5135d1569dd604b5fba4ba6ff3d616a2f5
[ "MIT" ]
permissive
rapodaca/mx
12a361742d96bdf95850b142cc43e1b3fc20d8ca
2aa0e27ae9b1012eb3b6fca55d36dc33794c654c
refs/heads/master
2021-01-17T22:51:18.463350
2009-07-20T20:28:24
2009-07-20T20:28:24
79,979
1
0
null
null
null
null
UTF-8
Java
false
false
4,427
java
/* * MX - Essential Cheminformatics * * Copyright (c) 2007-2009 Metamolecular, LLC * * http://metamolecular.com/mx * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.metamolecular.mx.test; import com.metamolecular.mx.io.Molecules; import com.metamolecular.mx.model.Atom; import com.metamolecular.mx.model.Bond; import com.metamolecular.mx.model.Reducer; import com.metamolecular.mx.model.Molecule; import java.util.HashMap; import java.util.Map; import junit.framework.TestCase; /** * @author Richard L. Apodaca <rapodaca at metamolecular.com> */ public class ReducerTest extends TestCase { private Reducer reducer; private Map<Atom, Integer> reductions; @Override protected void setUp() throws Exception { reducer = new Reducer(); reductions = new HashMap(); } public void testItCanReduceNonstereoHydrogen() { Molecule propane = createBlockedPropane(); assertTrue(reducer.canReduce(propane.getAtom(3))); } public void testItCanNotReduceStereoHydrogen() { Molecule propane = createChiralBlockedPropane(); assertFalse(reducer.canReduce(propane.getAtom(3))); } public void testItCanNotReduceIsotopicHydrogen() { Molecule propane = createIsotopeBlockedPropane(); assertFalse(reducer.canReduce(propane.getAtom(3))); } public void testItReducesBlockedPropaneToThreeAtoms() { Molecule propane = createBlockedPropane(); reducer.reduce(propane, reductions); assertEquals(3, propane.countAtoms()); } public void testItRemovesVirtualizableHydrogensFromBlockedPropane() { Molecule propane = createBlockedPropane(); reducer.reduce(propane, reductions); boolean found = false; for (int i = 0; i < propane.countAtoms(); i++) { if (reducer.canReduce(propane.getAtom(i))) { found = true; break; } } assertFalse(found); } public void testItReportsReductionForBlockedPropane() { Molecule propane = createBlockedPropane(); reducer.reduce(propane, reductions); assertEquals(1, reductions.get(propane.getAtom(1)).intValue()); } public void testItReportsDoubleReductionForDoubleBlockedPropane() { Molecule propane = createDoubleBlockedPropane(); reducer.reduce(propane, reductions); assertEquals(2, reductions.get(propane.getAtom(1)).intValue()); } public void testDoesntThrowWithNullMap() { Molecule propane = createBlockedPropane(); boolean pass = false; try { reducer.reduce(propane, null); pass = true; } catch (NullPointerException e) { } assertTrue(pass); } private Molecule createBlockedPropane() { Molecule result = Molecules.createPropane(); result.connect(result.getAtom(1), result.addAtom("H"), 1); return result; } private Molecule createDoubleBlockedPropane() { Molecule result = createBlockedPropane(); result.connect(result.getAtom(1), result.addAtom("H"), 1); return result; } private Molecule createChiralBlockedPropane() { Molecule result = createBlockedPropane(); Bond bond = result.getBond(result.getAtom(1), result.getAtom(3)); bond.setStereo(1); return result; } private Molecule createIsotopeBlockedPropane() { Molecule result = createBlockedPropane(); Atom h = result.getAtom(3); h.setIsotope(1); return result; } }
d6896c97a11b025bc3c1ca5403446d96c91a68a4
a6168a4a265128f290c330155c683959ff4090db
/playerGeneric/src/vikdev/com/BaseballPlayer.java
57199c4d64e3390579f7599b82d2a92c37e14770
[]
no_license
vikaskaushik17/Java-Programs
d5331eb4566db80ca2e32fab14b27981478de708
571dc87ff86bb8c7b555d079ee73a8ff5a016d70
refs/heads/master
2022-04-17T21:04:06.548456
2020-04-13T04:37:16
2020-04-13T04:37:16
255,116,024
1
0
null
null
null
null
UTF-8
Java
false
false
144
java
package vikdev.com; public class BaseballPlayer extends Player { public BaseballPlayer(String name){ super(name); } }
6afcf7ce3340e5ed89222a31a1c5ff2c0d8db7d7
ff73ce588c954e3fed033e462d37a37ef76fbc92
/YoutubeAPI/app/src/main/java/com/wannaone/elice/youtubeapi/module/TAcademyGlideModule.java
105885251844cc4eb87ec02f92a17f0254e1bd5f
[]
no_license
Elice-kim/YoutubeAPI
0077dd9e2eb71f90b4ae83829114d4be6905c81c
226392aeec27fe1bf0e843379be76c6d6fa72c10
refs/heads/master
2020-12-02T18:13:31.481629
2017-07-10T04:33:11
2017-07-10T04:33:11
96,491,116
0
0
null
null
null
null
UTF-8
Java
false
false
1,940
java
package com.wannaone.elice.youtubeapi.module; import android.content.Context; import com.bumptech.glide.Glide; import com.bumptech.glide.GlideBuilder; import com.bumptech.glide.load.DecodeFormat; import com.bumptech.glide.load.engine.bitmap_recycle.LruBitmapPool; import com.bumptech.glide.load.engine.cache.LruResourceCache; import com.bumptech.glide.load.engine.cache.MemorySizeCalculator; import com.bumptech.glide.module.GlideModule; /** * Created by elice.kim on 2017. 7. 7.. */ public class TAcademyGlideModule implements GlideModule { @Override public void applyOptions(Context context, GlideBuilder builder) { //전체 메모리사이즈 MemorySizeCalculator calculator = new MemorySizeCalculator(context); int defaultMemoryCacheSize = calculator.getMemoryCacheSize(); int defaultBitmapPoolSize = calculator.getBitmapPoolSize(); /** 현재 Glide이 관리하는 캐쉬사이즈에 10%를 증가한다. 사진을 많이 다루는 것들은 20% 증가해도됨 */ int customMemoryCacheSize = (int) (1.1 * defaultMemoryCacheSize); int customBitmapPoolSize = (int) (1.1 * defaultBitmapPoolSize); builder.setMemoryCache(new LruResourceCache(customMemoryCacheSize)); builder.setBitmapPool(new LruBitmapPool(customBitmapPoolSize)); /**더 선명하게 보여줄 팀은 DecodeFormat.PREFER_ARGB_8888로 설정(메모리소모많음)*/ builder.setDecodeFormat(DecodeFormat.PREFER_RGB_565); // 디스크캐쉬 설정방법 /* String downloadDirectoryPath = Environment.getDownloadCacheDirectory().getPath(); int diskCacheSize = 1024 * 1024 * 100; //100 메가 builder.setDiskCache( new DiskLruCacheFactory(downloadDirectoryPath, diskCacheSize) );*/ } @Override public void registerComponents(Context context, Glide glide) { } }
927c2bab1b7ce9fc0908f26fb4d010c9ddd21a0a
592deac6ff18254cac6fd7726629f5b26ae772d0
/src/main/java/com/ntels/avocado/exception/ExceptionController.java
71103623f0312cb5f62690dca3f62d54c42504cc
[]
no_license
Ntels-sup/SRC_ATOM_FE
9d0d93a1c900e72fe459a8aa9fd885df11aa2efc
8d68dc8e9089420e17c145c8386d6591282fe71d
refs/heads/master
2021-01-20T17:20:04.635060
2016-05-28T08:57:52
2016-05-28T08:57:52
59,884,228
0
0
null
null
null
null
UTF-8
Java
false
false
1,424
java
package com.ntels.avocado.exception; import javax.servlet.http.HttpServletRequest; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.servlet.ModelAndView; @ControllerAdvice @RequestMapping(value = "/exception") public class ExceptionController { /** * JSTL Exception 처리 * @return */ @RequestMapping(value = "jstlexception") public String jstlexception() throws Exception { return "exception/jstlexception"; } /** * JSTL Exception 처리 * @return */ @RequestMapping(value = "notfound") public String notfound(HttpServletRequest request) throws Exception { return "exception/notfound"; } /** * 자바 모든 Exception 처리 * @param e * @return */ @ResponseStatus(value = HttpStatus.NOT_FOUND) @ExceptionHandler(value = {Exception.class, RuntimeException.class}) public ModelAndView defaultErrorHandler(Exception e) { e.printStackTrace(); ModelAndView mv = new ModelAndView("exception.controller"); //tiles name 선언 mv.addObject("errorMsg", e); return mv; } }
062ced9f85bad4ca5a3c90968c78c71ada7ef8a3
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/20/20_b0889c5057172ba0ffbe7a57ba27803cc07bf7d9/SharedPoolDataSource/20_b0889c5057172ba0ffbe7a57ba27803cc07bf7d9_SharedPoolDataSource_t.java
53d75e270428e9078abf2464787bc2fc28d4720c
[]
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
9,724
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.commons.dbcp.datasources; import java.io.IOException; import java.io.ObjectInputStream; import java.sql.Connection; import java.sql.SQLException; import java.util.Map; import javax.naming.NamingException; import javax.naming.Reference; import javax.naming.StringRefAddr; import javax.sql.ConnectionPoolDataSource; import org.apache.commons.pool.KeyedObjectPool; import org.apache.commons.pool.impl.GenericKeyedObjectPool; import org.apache.commons.pool.impl.GenericObjectPool; import org.apache.commons.dbcp.SQLNestedException; /** * A pooling <code>DataSource</code> appropriate for deployment within * J2EE environment. There are many configuration options, most of which are * defined in the parent class. All users (based on username) share a single * maximum number of Connections in this datasource. * * @author John D. McNally * @version $Revision$ $Date$ */ public class SharedPoolDataSource extends InstanceKeyDataSource { private final Map userKeys = new LRUMap(10); private int maxActive = GenericObjectPool.DEFAULT_MAX_ACTIVE; private int maxIdle = GenericObjectPool.DEFAULT_MAX_IDLE; private int maxWait = (int)Math.min((long)Integer.MAX_VALUE, GenericObjectPool.DEFAULT_MAX_WAIT); private KeyedObjectPool pool = null; /** * Default no-arg constructor for Serialization */ public SharedPoolDataSource() { } /** * Close pool being maintained by this datasource. */ public void close() throws Exception { if (pool != null) { pool.close(); } InstanceKeyObjectFactory.removeInstance(instanceKey); } // ------------------------------------------------------------------- // Properties /** * The maximum number of active connections that can be allocated from * this pool at the same time, or non-positive for no limit. */ public int getMaxActive() { return (this.maxActive); } /** * The maximum number of active connections that can be allocated from * this pool at the same time, or non-positive for no limit. * The default is 8. */ public void setMaxActive(int maxActive) { assertInitializationAllowed(); this.maxActive = maxActive; } /** * The maximum number of active connections that can remain idle in the * pool, without extra ones being released, or negative for no limit. */ public int getMaxIdle() { return (this.maxIdle); } /** * The maximum number of active connections that can remain idle in the * pool, without extra ones being released, or negative for no limit. * The default is 8. */ public void setMaxIdle(int maxIdle) { assertInitializationAllowed(); this.maxIdle = maxIdle; } /** * The maximum number of milliseconds that the pool will wait (when there * are no available connections) for a connection to be returned before * throwing an exception, or -1 to wait indefinitely. Will fail * immediately if value is 0. * The default is -1. */ public int getMaxWait() { return (this.maxWait); } /** * The maximum number of milliseconds that the pool will wait (when there * are no available connections) for a connection to be returned before * throwing an exception, or -1 to wait indefinitely. Will fail * immediately if value is 0. * The default is -1. */ public void setMaxWait(int maxWait) { assertInitializationAllowed(); this.maxWait = maxWait; } // ---------------------------------------------------------------------- // Instrumentation Methods /** * Get the number of active connections in the pool. */ public int getNumActive() { return (pool == null) ? 0 : pool.getNumActive(); } /** * Get the number of idle connections in the pool. */ public int getNumIdle() { return (pool == null) ? 0 : pool.getNumIdle(); } // ---------------------------------------------------------------------- // Inherited abstract methods protected synchronized PooledConnectionAndInfo getPooledConnectionAndInfo(String username, String password) throws SQLException { if (pool == null) { try { registerPool(username, password); } catch (NamingException e) { throw new SQLNestedException("RegisterPool failed", e); } } PooledConnectionAndInfo info = null; try { info = (PooledConnectionAndInfo) pool .borrowObject(getUserPassKey(username, password)); } catch (SQLException ex) { // Remove bad UserPassKey if ((userKeys != null) && (userKeys.containsKey(username))) { userKeys.remove(username); } throw new SQLNestedException( "Could not retrieve connection info from pool", ex); } catch (Exception e) { throw new SQLNestedException( "Could not retrieve connection info from pool", e); } return info; } /** * Returns a <code>SharedPoolDataSource</code> {@link Reference}. * * @since 1.2.2 */ public Reference getReference() throws NamingException { Reference ref = new Reference(getClass().getName(), SharedPoolDataSourceFactory.class.getName(), null); ref.add(new StringRefAddr("instanceKey", instanceKey)); return ref; } private UserPassKey getUserPassKey(String username, String password) { UserPassKey key = (UserPassKey) userKeys.get(username); if (key == null) { key = new UserPassKey(username, password); userKeys.put(username, key); } return key; } private void registerPool( String username, String password) throws javax.naming.NamingException, SQLException { ConnectionPoolDataSource cpds = testCPDS(username, password); // Create an object pool to contain our PooledConnections GenericKeyedObjectPool tmpPool = new GenericKeyedObjectPool(null); tmpPool.setMaxActive(getMaxActive()); tmpPool.setMaxIdle(getMaxIdle()); tmpPool.setMaxWait(getMaxWait()); tmpPool.setWhenExhaustedAction(whenExhaustedAction(maxActive, maxWait)); tmpPool.setTestOnBorrow(getTestOnBorrow()); tmpPool.setTestOnReturn(getTestOnReturn()); tmpPool.setTimeBetweenEvictionRunsMillis( getTimeBetweenEvictionRunsMillis()); tmpPool.setNumTestsPerEvictionRun(getNumTestsPerEvictionRun()); tmpPool.setMinEvictableIdleTimeMillis(getMinEvictableIdleTimeMillis()); tmpPool.setTestWhileIdle(getTestWhileIdle()); pool = tmpPool; // Set up the factory we will use (passing the pool associates // the factory with the pool, so we do not have to do so // explicitly) new KeyedCPDSConnectionFactory(cpds, pool, getValidationQuery(), isRollbackAfterValidation()); } protected void setupDefaults(Connection con, String username) throws SQLException { boolean defaultAutoCommit = isDefaultAutoCommit(); if (con.getAutoCommit() != defaultAutoCommit) { con.setAutoCommit(defaultAutoCommit); } int defaultTransactionIsolation = getDefaultTransactionIsolation(); if (defaultTransactionIsolation != UNKNOWN_TRANSACTIONISOLATION) { con.setTransactionIsolation(defaultTransactionIsolation); } boolean defaultReadOnly = isDefaultReadOnly(); if (con.isReadOnly() != defaultReadOnly) { con.setReadOnly(defaultReadOnly); } } /** * Supports Serialization interface. * * @param in a <code>java.io.ObjectInputStream</code> value * @exception IOException if an error occurs * @exception ClassNotFoundException if an error occurs */ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { try { in.defaultReadObject(); SharedPoolDataSource oldDS = (SharedPoolDataSource) new SharedPoolDataSourceFactory() .getObjectInstance(getReference(), null, null, null); this.pool = oldDS.pool; } catch (NamingException e) { throw new IOException("NamingException: " + e); } } }
aeaabde93086ee7d55f710342b71de033ccec22a
4eb43b54006ccbddbdbe5f88d77c656b251cc18b
/GUIeventHandling/src/EventHandlingClass.java
77b1ed86e3b7e194967aff7e76b6a2e7d729bffe
[]
no_license
sauravprakashgupta/java-Problems-Solved
c196b1217b2351c22ea15b1d2ddcf2280b4f02e0
96857328ebb1ff9b1bcd54cf83c159a42acfb390
refs/heads/master
2020-03-21T21:01:57.821123
2018-07-22T17:58:45
2018-07-22T17:58:45
139,042,850
0
0
null
null
null
null
UTF-8
Java
false
false
1,843
java
import java.awt.FlowLayout; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JFrame; import javax.swing.JTextField; import javax.swing.JPasswordField; import javax.swing.JOptionPane; public class EventHandlingClass extends JFrame{ private JTextField item1; private JTextField item2; private JTextField item3; private JPasswordField passwordField; public EventHandlingClass(){ super("The title"); setLayout(new FlowLayout()); item1 = new JTextField(10); item2 = new JTextField("Enter text Here"); item3 = new JTextField("UnEditable",20); item3.setEditable(false); add(item1); add(item2); add(item3); passwordField = new JPasswordField("myPassword"); add(passwordField); MyHandlerClass handlerObj = new MyHandlerClass(); item1.addActionListener(handlerObj); item2.addActionListener(handlerObj); item3.addActionListener(handlerObj); passwordField.addActionListener(handlerObj); } private class MyHandlerClass implements ActionListener{ public void actionPerformed(ActionEvent event){ String myString = ""; if(event.getSource()==item1){ myString=String.format("field 1 is %s", event.getActionCommand()); } else if(event.getSource()==item2){ myString=String.format("field 2 is %s", event.getActionCommand()); } else if(event.getSource()==item3){ myString=String.format("field 3 is %s", event.getActionCommand()); } else if(event.getSource() == passwordField){ myString = String.format("password field is : %s",event.getActionCommand()); } } } }
9fb2ea468b3dccee8dc8fc225dd94505dbddae1c
a46306fc7beb404754407ed3df63ba6519bcbd3e
/java-advanced/src/main/java/com/bucur/oop/ex1/GradedCourse.java
da2f59f38962bfc174e99b2cd5aeba95b86ca882
[]
no_license
cosminbucur/sda-course-gradle
a17a7a91b9177425fae62dea3437e46a57912c61
4c3648d11be5205e91a397ac9fa07bbb6b3694f0
refs/heads/master
2022-11-27T03:33:14.960068
2020-08-07T12:01:26
2020-08-07T12:01:26
285,763,951
1
0
null
null
null
null
UTF-8
Java
false
false
281
java
package com.bucur.oop.ex1; public class GradedCourse extends Course { private int grade; public GradedCourse(String name, int grade) { super(name); this.grade = grade; } @Override public boolean passed() { return grade >= 5; } }
234b77a98a6d08db1d39e2cefed5c956bf9c36b1
220671ecc3661c5ca6a76aa61514bd5b0789812b
/target/classes/com/coretree/defaultconfig/main/controller/OrganizationController.java
eae22f1f8bc3081f0ca290d58e178a40a889d023
[]
no_license
coretree011/webcrmEIT
30b075434cc7bc45b2a3bf30913aa1d7769cbe4a
c36f4db5958eed0a179a87f5ce6cb5af7c6e8505
refs/heads/master
2020-04-21T18:41:32.467369
2016-09-01T09:47:01
2016-09-01T09:47:01
66,639,523
0
0
null
null
null
null
UTF-8
Java
false
false
3,732
java
package com.coretree.defaultconfig.main.controller; import java.util.List; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; import com.coretree.defaultconfig.main.mapper.OrganizationMapper; import com.coretree.defaultconfig.main.model.Organization; /** * Test를 위한 컨트롤러 클래스 * * @author hsw * */ @RestController public class OrganizationController { @Autowired OrganizationMapper organizationMapper; /** * customer counter 정보를 조회한다. * * @param condition * @return */ /* @RequestMapping(path = "/login/actionLogin", method = RequestMethod.POST) public @ResponseBody long checkLogin(@RequestBody Users paramUsers) { long result = 0; Users users = usersMapper.checkLogin(paramUsers); if(users != null){ long nCount = users.getExistCount(); String realPassword = users.getPassword(); if(nCount == 0){ result = 0; }else if(nCount == 1 && realPassword.equals(paramUsers.getPassword())){ result = 1; }else if(nCount == 1 && !realPassword.equals(paramUsers.getPassword())){ result = 2; } } return result; }*/ @RequestMapping(path = "/login/actionLogin", method = RequestMethod.GET) public ModelAndView checkLogin(@RequestParam("userName") String test, HttpSession session) { long result = 0; Organization paramUsers = new Organization(); paramUsers.setEmpNo(test); Organization users = organizationMapper.checkLogin(paramUsers); if(users != null){ long nCount = users.getExistCount(); String realPassword = users.getPassword(); if(nCount == 0){ result = 0; }else if(nCount == 1){ session.setAttribute("empNo", users.getEmpNo()); session.setAttribute("empNm", users.getEmpNm()); session.setAttribute("extensionNo", users.getExtensionNo()); result = 1; }else if(nCount == 1 && !realPassword.equals(paramUsers.getPassword())){ result = 2; } } ModelAndView view = new ModelAndView(); view.setViewName("/index"); return view; } @RequestMapping(path = "/login/updatePwd", method = RequestMethod.POST) public String updatePwd(@RequestBody Organization paramUsers, HttpSession session) { session.setAttribute("test123", paramUsers); return "redirect:/login/updatePwd2"; } @RequestMapping(path = "/login/updatePwd2", method = RequestMethod.POST) public long updatePwd2(HttpSession session) { long result = 0; Organization paramUsers = (Organization) session.getAttribute("test123"); Organization users = organizationMapper.checkLogin(paramUsers); if(users != null){ if(paramUsers.getPassword().equals(users.getPassword())){ organizationMapper.updatePwd(paramUsers); result = 1; }else{ result = 0; } } return result; } @RequestMapping(path = "/empList", method = RequestMethod.POST) public List<Organization> empList() throws Exception { List<Organization> emp = organizationMapper.empList(); return emp; } @RequestMapping(path = "/main/usersState", method = RequestMethod.POST) public List<Organization> usersState() throws Exception { List<Organization> emp = organizationMapper.usersState(); return emp; } }
[ "Admin@hnlee-PC" ]
Admin@hnlee-PC
5abfd2c093ca25aee3004c946af5ef745a4bbf31
1b59a5dde466ed3f59b67f55adfe7d80f999e778
/SemesterprøveJuni2018/src/application/model/PraktikOpgave.java
62fb5ac19b989c55fb27035c49d9911246a6f593
[]
no_license
TutteG/EAAA-PRO1
a2038539f34ccd1fbbb8bfd9b0e6e17edeab06a0
654cf59de53768368ebb1b1bc3eeb40b04e4f4e1
refs/heads/master
2020-03-09T10:15:59.927274
2018-09-10T06:58:32
2018-09-10T06:58:32
128,733,201
0
0
null
null
null
null
UTF-8
Java
false
false
591
java
package application.model; public abstract class PraktikOpgave { private String navn; private int semester; public PraktikOpgave(String navn, int semester) { this.navn = navn; this.semester = semester; } public String getNavn() { return navn; } public int getSemester() { return semester; } public void setNavn(String navn) { this.navn = navn; } public void setSemester(int semester) { this.semester = semester; } @Override public String toString() { // TODO Auto-generated method stub return navn + " " + semester; } }
1f178c0dc9b67529e726ed79ff23416e9d1ab327
0d6ac13791a001e749ff3137a41ddfd99219eeeb
/reverseFlat-ejb/src/java/com/reverseFlat/ejb/commons/valueobjects/CreditCardServer.java
a30b2bb895bc6b19574f133a4aecfb48d151ff54
[]
no_license
lfgiraldo/reverseflat
688b52c3e6b1fe77cf5dc0f0801cb14ff7f293fa
7ae50185c86d13fc9f360773acf9e47e66595700
refs/heads/master
2020-03-30T05:50:50.768644
2009-07-30T22:10:36
2009-07-30T22:10:36
32,351,222
0
0
null
null
null
null
UTF-8
Java
false
false
1,387
java
package com.reverseFlat.ejb.commons.valueobjects; import java.io.Serializable; public class CreditCardServer implements Serializable { private String creditCardType; private String creditCardNumber; private String expdateMonth; private String expdateYear; private String cvv2Number; private String idCombo; private String currency; public String getCreditCardType() { return creditCardType; } public void setCreditCardType(String creditCardType) { this.creditCardType = creditCardType; } public String getCreditCardNumber() { return creditCardNumber; } public void setCreditCardNumber(String creditCardNumber) { this.creditCardNumber = creditCardNumber; } public String getExpdateMonth() { return expdateMonth; } public void setExpdateMonth(String expdateMonth) { this.expdateMonth = expdateMonth; } public String getExpdateYear() { return expdateYear; } public void setExpdateYear(String expdateYear) { this.expdateYear = expdateYear; } public String getCvv2Number() { return cvv2Number; } public void setCvv2Number(String cvv2Number) { this.cvv2Number = cvv2Number; } public String getIdCombo() { return idCombo; } public void setIdCombo(String idCombo) { this.idCombo = idCombo; } public String getCurrency() { return currency; } public void setCurrency(String currency) { this.currency = currency; } }
[ "lfgiraldo@5366fab2-50f4-11de-b90f-197667375a34" ]
lfgiraldo@5366fab2-50f4-11de-b90f-197667375a34
2b71399df22d3ba21280d01cf7e9f9c86d0d31f8
9099d8901dbfd8bbc8f2f06c86ead72ae51e584e
/src/main/java/net/wesjd/towny/ngin/command/framework/argument/provider/ArgumentProvider.java
99b52986a691f2afcf717244d24f48628fd21906
[]
no_license
CyberFlameGO/towny-ngin
07da5d3deeb75951454d5c464417a202991b8745
12922f12c0814440e8a10b62cd63c3d9f5176d63
refs/heads/master
2023-08-17T05:25:58.773944
2017-10-28T02:22:15
2017-10-28T02:22:15
487,011,295
0
0
null
2023-08-11T21:14:43
2022-04-29T14:55:24
null
UTF-8
Java
false
false
535
java
package net.wesjd.towny.ngin.command.framework.argument.provider; import net.wesjd.towny.ngin.command.framework.argument.Arguments; import java.lang.reflect.Parameter; /** * Provides a value for a command argument */ public interface ArgumentProvider<T> { /** * Called to get the parameter value for the argument * * @param parameter The parameter of the method * @param arguments The command's arguments * @return The generated object */ T get(Parameter parameter, Arguments arguments); }
eb1008f49a2565d616aefb2a3b60e91ed5d272da
daa4b23209554c156439e1060e6e776f0fac3b9c
/src/main/java/com/siifi/infos/service/maney/ManeyImagesService.java
5822a09a60bc4a1c2dd288ac376f721c3ef618d6
[]
no_license
dutianyuzz/infos
7f5a6a5c8523c743dff7a394344724cf5a4f68dc
b2e6b04c9eb872e7d339ab7a4339e58995a35faf
refs/heads/master
2020-05-04T08:13:59.729787
2019-04-28T08:33:23
2019-04-28T08:33:23
144,229,473
2
0
null
null
null
null
UTF-8
Java
false
false
390
java
package com.siifi.infos.service.maney; import com.siifi.infos.entity.ManeysImage; import java.util.List; public interface ManeyImagesService { public List<ManeysImage> getManey(); public ManeysImage getManeyById(int maneyId); public void saveManey(ManeysImage maneysImage); public void editManey(ManeysImage maneysImage); public void deleteManey(int maneyId); }
72925538bbe964876faa79862e0f480dfd4e40a5
3a94c222f3b9a8b9755e57f9a1a8b2ac20580833
/src/main/java/biuro/podrozy/projekt/ProjektApplication.java
8da1f281085a48264d0c8cb39b06fc165d58fba5
[]
no_license
MountLee98/BiuroPodrozy
1fc05f66360a64d08e079e499e5800f6aef3210f
0e285e7e40804f0703eaf14ee2813c61b45623ed
refs/heads/master
2023-06-08T08:58:55.289848
2021-06-14T18:38:13
2021-06-14T18:38:13
376,365,382
0
0
null
null
null
null
UTF-8
Java
false
false
743
java
package biuro.podrozy.projekt; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import biuro.podrozy.projekt.storage.StorageService; import springfox.documentation.swagger2.annotations.EnableSwagger2; @SpringBootApplication @EnableSwagger2 public class ProjektApplication { public static void main(String[] args) { SpringApplication.run(ProjektApplication.class, args); } @Bean CommandLineRunner init(StorageService storageService) { return (args) -> { storageService.deleteAll(); storageService.init(); }; } }
7284a5392b17fdce63c56b74073f194ea7eee45b
3a3815e5db671d7cd69fa4e8349f94c348ef63f7
/app/src/main/java/sg/edu/rp/c346/contactslist/Contacts.java
18404e89c3876d40d66303065bfdef3d4e179f0b
[]
no_license
Dhurgesh/ContactList
f5314c9cdd57f7ee17390d429cf3a120a4e760de
2e28f212fa3db1bddff115189ffb1805e254326f
refs/heads/master
2020-03-23T19:00:42.775979
2018-07-23T01:55:39
2018-07-23T01:55:39
141,948,140
0
0
null
null
null
null
UTF-8
Java
false
false
808
java
package sg.edu.rp.c346.contactslist; /** * Created by 16033265 on 7/23/2018. */ public class Contacts { private String name; private int countryCode; private int phoneNum; public Contacts(String name, int countryCode, int phoneNum) { this.name = name; this.countryCode = countryCode; this.phoneNum = phoneNum; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getCountryCode() { return countryCode; } public void setCountryCode(int countryCode) { this.countryCode = countryCode; } public int getPhoneNum() { return phoneNum; } public void setPhoneNum(int phoneNum) { this.phoneNum = phoneNum; } }