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
afc4a1cee993c687a2a137abbff4f2b74d3f3ce7
a0057d39de1afca5ce23584a8e1d9d67a5f756cb
/src/main/java/twopointers/MajorityElementII.java
7d1c079704f9ae6c411d255b67ce31d6514c5af5
[]
no_license
JasonHub5/algorithmLearning
e4deef492a5eaf9b59d5815a63338c32df5aa2ae
5f3b753470c7879649ec7927f4147a59b428db27
refs/heads/master
2021-07-18T09:40:48.276689
2019-12-27T09:28:34
2019-12-27T09:28:34
220,367,762
0
0
null
null
null
null
UTF-8
Java
false
false
1,536
java
/* 229. 求众数 II 中等 给定一个大小为 n 的数组,找出其中所有出现超过 ⌊ n/3 ⌋ 次的元素。 说明: 要求算法的时间复杂度为 O(n),空间复杂度为 O(1)。 示例 1: 输入: [3,2,3] 输出: [3] 示例 2: 输入: [1,1,1,3,3,2,2,2] 输出: [1,2] */ package twopointers; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class MajorityElementII { public static List<Integer> majorityElement(int[] nums) { int major1 = 0, count1 = 0, major2 = 0, count2 = 0; for (int num : nums) { if (num == major1) { count1++; } else if (num == major2) { count2++; } else { if (count1 == 0) { major1 = num; count1++; } else if (count2 == 0) { major2 = num; count2++; } else { count1--; count2--; } } } List<Integer> result = new ArrayList<>(); count1 = 0; count2 = 0; for (int num : nums) { if (num == major1) { count1++; } if (num == major2) { count2++; } } if (count1 > nums.length / 3) { result.add(major1); } if (count2 > nums.length / 3) { result.add(major2); } return result; } }
9d82c6701255e752591c90187db66769547a04fb
84de269bca55372c86f0c89f04b29aedb4cf6990
/app/src/main/java/com/example/huxianming/smsdemo/SmsReceiver.java
183bbee47bf713137db6104bb23b33275556dc16
[]
no_license
hxm1114/SmsDemo
13174dfb01f77ebb18cd4699ebbc2d36c5130327
7877a2f6c1e34b1cd22f2865ab7e002c9115c887
refs/heads/master
2021-01-01T06:44:59.646495
2015-07-03T06:31:26
2015-07-03T06:31:26
38,475,183
0
0
null
null
null
null
UTF-8
Java
false
false
1,070
java
package com.example.huxianming.smsdemo; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.telephony.SmsMessage; public class SmsReceiver extends BroadcastReceiver { public SmsReceiver() { } @Override public void onReceive(Context context, Intent intent) { Bundle bundle = intent.getExtras(); Object messages[] = (Object[]) bundle.get("pdus"); SmsMessage smsMessage[] = new SmsMessage[messages.length]; for (int n = 0; n < messages.length; n++) { smsMessage[n] = SmsMessage.createFromPdu((byte[]) messages[n]); } String from = smsMessage[0].getDisplayOriginatingAddress(); String content = smsMessage[0].getMessageBody(); Intent intent1 = new Intent(context,ReceiveMessageActivity.class); intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent1.putExtra("from",from); intent1.putExtra("content",content); context.startActivity(intent1); } }
901c94745f0d1f982a2c63b34f8382ab2b9691c8
18b8c6d2a4aa9b095215ff35157480e60285dd51
/src/main/java/com/certification/ocp/lambda/BinaryOperatorInterfaces.java
1e3358c32a82211cf054f2fc3170c72f2904638f
[]
no_license
mouhamed-ali/ocaja8-ocajp8-preparation
a261460230157dba31ddf811b37ca0a0ac4bfefc
51e8a009e14f6a2dac8fb6b2880c85814ac8d520
refs/heads/main
2023-05-06T16:35:27.608691
2021-05-31T19:17:29
2021-05-31T19:17:29
361,118,310
0
0
null
null
null
null
UTF-8
Java
false
false
1,818
java
package com.certification.ocp.lambda; import java.util.function.BinaryOperator; import java.util.function.DoubleBinaryOperator; import java.util.function.LongBinaryOperator; public class BinaryOperatorInterfaces { public static void main(String[] args) { // The binary operator is a specialization of BiFunction representing an operation upon two operands of the same type // and producing a result of the same type of operands // BinaryOperator is a sub interface of BiFunction, it inherits all members of the BiFunction interface including abstract // and default methods // BinaryOperator has three specializations including IntBinaryOperator, LongBinaryOperator and DoubleBinaryOperator // BinaryOperator<T> : T apply(T left, T right) // XBinaryOperator : x applyAsX(x left, x right) BinaryOperator<String> binaryOperator = (s1,s2) -> s1.concat(".").concat(s2); System.out.println(binaryOperator.apply("google", "com")); LongBinaryOperator longBinaryOperator = (l1, l2) -> l1 + l2; System.out.println(longBinaryOperator.applyAsLong(12,7)); BinaryOperator<Double> operator = (d1,d2) -> d1*d2; //double result = operator.apply(1,2); // the code above does not compile !!! // the operator accepts objects of type Double and thanks to autoboxing it can accepts only primitives of type double // event this will not work : double result = operator.apply(1.0f,2.0f); // these works because the input is a primitive double and you can easily cast a primitive float or int to double DoubleBinaryOperator operatorDouble = (d1,d2) -> d1*d2; double result = operatorDouble.applyAsDouble(1,2); result = operatorDouble.applyAsDouble(1.0f,2.0f); } }
f9a0f9cac2538ee28ff61ac49cc421da6f8e885f
147ad2ffd1848cf532ab7b075832779b6d1a7c9b
/src/controller/TicketMachineSearchInfo.java
f40b5944a4a715cd991dffe9198a1daa60dbe55c
[]
no_license
Samir692/TicketMachine
778857de5d76d0bafaa8129e436542ef9369a9ec
e91a3576c4e28b13e6ab6a8dbb5fd0d20472f6a9
refs/heads/master
2021-07-15T04:07:26.839449
2017-10-09T19:33:09
2017-10-09T19:33:09
106,326,986
0
0
null
null
null
null
UTF-8
Java
false
false
553
java
package controller; public class TicketMachineSearchInfo { public TicketMachineSearchInfo(){} private String location; private int district; public String getLocation() { return location; } public void setLocation(String location) throws Exception { if(!location.isEmpty()) this.location = location; else throw new Exception(); } public int getDistrict() { return district; } public void setDistrict(int district) throws Exception { if(district > 0) this.district = district; else throw new Exception(); } }
74259183f67b736f6cd8b8ef294eaa232b85f331
b963d14089cf2eea4955210ef4f3b899904d1779
/HRService/src/main/java/com/ebit/hrmanagement/service/EmpSalaryService.java
7070ce163522e65aa7749a1db95e0613109fcc7d
[]
no_license
saurabhsharmaj/HRManagement
d3b990c71e9bacba4be862f77e89aeaa9be29d10
f49c20b395e7160918e9025b17173598b987586a
refs/heads/main
2023-06-26T20:45:37.220731
2021-08-02T08:13:51
2021-08-02T08:13:51
390,319,521
0
0
null
null
null
null
UTF-8
Java
false
false
75
java
package com.ebit.hrmanagement.service; public class EmpSalaryService { }
86ffdb9849e78572e25f4a2525b96d4869c2d9de
10c36d05f34582dcaa6181d549477b8932abe813
/src/java/daos/ProductoDAO.java
e820e387cf64ad3e5eb82780c4251a0264d9b0bb
[]
no_license
ctec105/WebServiceReealoTomcat
48e37554e2b175452f1394fd98c66f562f4ae641
d10867e14ef70ed6f1d6b39f53626106cebd7f9a
refs/heads/master
2020-12-05T15:42:55.450004
2020-01-06T18:21:04
2020-01-06T18:21:04
232,159,335
0
0
null
null
null
null
UTF-8
Java
false
false
6,016
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 daos; import entidades.Producto; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; /** * * @author XxkokoxXT */ public class ProductoDAO { public List<Producto> listarProductos() { List<Producto> productosList = new ArrayList<Producto>(); try { Connection cn = Dao.getConnection(); String query = "SELECT * FROM productos"; PreparedStatement ps = cn.prepareCall(query); ResultSet rs = ps.executeQuery(); Producto p; while (rs.next()) { p = new Producto(rs.getString(1), rs.getString(2), rs.getString(3), rs.getInt(4), rs.getDouble(5), rs.getString(6)); productosList.add(p); } } catch (SQLException e) { System.out.println("SQLException: " + e.getMessage()); } return productosList; } public String obtenerCodProd() { String cod = "image"; try { Connection cn = Dao.getConnection(); String query = "SELECT 'P' + RIGHT('000' + CONVERT(varchar(3), MAX(CONVERT(int, RIGHT(codProd, 3))) + 1), 3) FROM productos"; PreparedStatement ps = cn.prepareCall(query); ResultSet rs = ps.executeQuery(); if (rs.next()){ cod = rs.getString(1); } } catch (SQLException e) { System.out.println("SQLException: " + e.getMessage()); } return cod; } public int registrarProducto(String descripcion, String detalle, Integer stock, Double precio, String imagen) { int resultado = 0; String sql = "INSERT INTO productos (codProd, descripcion, detalle, stock, precio, imagen) " + "VALUES ( (SELECT 'P' + RIGHT('000' + CONVERT(varchar(3), MAX(CONVERT(int, RIGHT(codProd, 3))) + 1), 3) FROM productos), ?, ?, ?, ?, ? )"; Connection cn = Dao.getConnection(); try { PreparedStatement ps = cn.prepareStatement(sql); ps.setString(1, descripcion); ps.setString(2, detalle); ps.setInt(3, stock); ps.setDouble(4, precio); ps.setString(5, imagen); resultado = ps.executeUpdate(); ps.close(); } catch (SQLException e) { System.out.println("Error al intentar almacenar la información: " + e); } finally { try { if (cn != null) { cn.close(); } } catch (SQLException ex) { System.out.println("Error al intentar cerrar la conexión: " + ex.getMessage()); } } return resultado; } public int actualizarProducto(String codigo, String descripcion, String detalle, Integer stock, Double precio, String imagen) { int resultado = 0; String sql = "UPDATE productos set descripcion = ?, detalle = ?, stock = ?, precio = ?, imagen = ? where codProd = ?"; Connection cn = Dao.getConnection(); try { PreparedStatement ps = cn.prepareStatement(sql); ps.setString(1, descripcion); ps.setString(2, detalle); ps.setInt(3, stock); ps.setDouble(4, precio); ps.setString(5, imagen); ps.setString(6, codigo); resultado = ps.executeUpdate(); ps.close(); } catch (SQLException e) { System.out.println("Error al intentar almacenar la información: " + e); } finally { try { if (cn != null) { cn.close(); } } catch (SQLException ex) { System.out.println("Error al intentar cerrar la conexión: " + ex.getMessage()); } } return resultado; } public List<Producto> validarProducto(String codigo) { List<Producto> productosList = new ArrayList<Producto>(); try { Connection cn = Dao.getConnection(); String query = "SELECT * FROM productos WHERE codProd = '" + codigo + "'"; PreparedStatement ps = cn.prepareCall(query); ResultSet rs = ps.executeQuery(); Producto p; while (rs.next()) { p = new Producto(rs.getString(1), rs.getString(2), rs.getString(3), rs.getInt(4), rs.getDouble(5), rs.getString(6)); productosList.add(p); } } catch (SQLException e) { System.out.println("SQLException: " + e.getMessage()); } return productosList; } public int eliminarProducto(String codigo) { int resultado = 0; String sql = "DELETE productos where codProd = '" + codigo + "'"; Connection cn = Dao.getConnection(); try { PreparedStatement ps = cn.prepareStatement(sql); resultado = ps.executeUpdate(); ps.close(); } catch (SQLException e) { System.out.println("Error al intentar eliminar la información: " + e); } finally { try { if (cn != null) { cn.close(); } } catch (SQLException ex) { System.out.println("Error al intentar cerrar la conexión: " + ex.getMessage()); } } return resultado; } }
4b941a9bc31a370aa155fe06a004782e9e6f48cc
288d6e277409f801eb0f0856663c46b877a46da4
/JavaFuns/src/code/io/ByteBufferEx.java
e0e7a7ea938ac2cba82d4dc10d246dd8def9151f
[]
no_license
idlelearner/algoprobs
31cff55a939251a229c2133cb27661c52db77dc3
862460554a07ce329e58978af9ad2e0daacf7bb1
refs/heads/master
2020-12-25T17:36:24.696385
2016-08-08T03:52:47
2016-08-08T03:52:47
12,516,398
0
0
null
null
null
null
UTF-8
Java
false
false
480
java
package code.io; import java.nio.ByteBuffer; public class ByteBufferEx { public static void main(String[] args) { String msg = "This is a log message not so small that you can use to test. I hope you have fun and it works well!"; byte[] msgBytes = msg.getBytes(); ByteBuffer bb = ByteBuffer.allocate(1024); long start = System.nanoTime(); bb.put(msgBytes); long end = System.nanoTime(); System.out.println("Time: " + (end - start)); } }
[ "Idlelearner@Dhass" ]
Idlelearner@Dhass
49f1223495f779b4c7a5ca84867c7d31610b8cee
d6182a7fa3e760ce587f4ecdd17d885e123b9c38
/src/spring/aopannotation/SayDemo.java
ccf6a90d0bc0eb84ab6d2cd99dac13caf3140ac0
[]
no_license
hanbing2019/java
df246559dfd3084e03f15e8b141c0fe0a89ffa4f
37ee9546757b0e5d9b74b17b68a2ef73920311f7
refs/heads/master
2021-02-11T19:12:03.684244
2020-03-03T01:46:16
2020-03-03T01:46:16
244,521,323
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
312
java
package spring.aopannotation; import org.springframework.stereotype.Component; @Component public class SayDemo { public void say() { System.out.println("hello world !!"); // throw new RuntimeException("--Òì³£--"); } public void count(int count) { System.out.println("get num :" + count); } }
967486de416cba239aaae2611f1320e6018701e4
9b0d8022e3c224afcb917adfd835b71bdabe14c2
/src/main/java/com/java/improve/callBack/Testb.java
560dee5d222cd30266c9bfa3f6418a62948a01c0
[]
no_license
gongchunru/effectiveJava
46efab4e0fc25827e7ea1dbff2c761798781cb25
5909a88de7672f449f0eca00eac5956f685ac4ce
refs/heads/master
2021-01-19T10:08:55.232041
2019-02-27T16:24:37
2019-02-27T16:24:37
82,163,537
0
0
null
null
null
null
UTF-8
Java
false
false
665
java
package com.java.improve.callBack; /** * @author gongchunru * @Package com.java.improve.callBack * @date 16/9/15 17:14 */ public class Testb implements ICall { protected static String aa = "这是一个字符串"; @Override public void method(String a) { aa = a; System.out.println(" 中间值 "+aa); } public static void main(String[] args) { Caller caller = new Caller(); String a = caller.setcallFun(new Testb()); System.out.println("" + "输出步骤中间值" + aa); System.out.println("输出最终值: " + a); caller.call("这是一个值"); } }
b261b55f8d0f426c2aa55274fc68b12ffec9d196
23cd28281c9310913d03144b6829ca252a9fdbf1
/src/admin/action/MemberGradeManagementAction.java
72d45aabb4f332d0d5d0233abb9505b25206dc23
[]
no_license
kiiooxx/JHJ
9fe853d8db863b8cadcf26c7fad16e607a9c458f
ecb681f1e48e396b7fa97c59ef3156cfa0652df4
refs/heads/master
2020-12-28T00:46:57.488960
2020-04-26T00:37:39
2020-04-26T00:37:39
237,856,583
0
0
null
null
null
null
UTF-8
Java
false
false
1,606
java
package admin.action; import java.io.PrintWriter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import action.Action; import admin.svc.MemberGradeManagementSvc; import vo.ActionForward; import vo.Member; public class MemberGradeManagementAction implements Action { @Override public ActionForward execute(HttpServletRequest request, HttpServletResponse response) throws Exception { // TODO Auto-generated method stub ActionForward forward = null; String user_id[] = request.getParameter("user_id").split(","); System.out.println("아이디 : " + request.getParameter("user_id")); String grade = request.getParameter("membergrade"); System.out.println("등급 : " + grade); MemberGradeManagementSvc membergrademanagementsvc = new MemberGradeManagementSvc(); boolean isUpdateMember = false; isUpdateMember = membergrademanagementsvc.updateGrade(grade, user_id); if(!isUpdateMember) { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); out.println("<script>"); out.println("alert('수정 실패')"); out.println("history.back()"); out.println("</script>"); }else { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); out.println("<script>"); out.println("alert('등급변경이 완료되었습니다.')"); out.println("location.href='memberList.ad'"); out.println("</script>"); } return forward; } }
4e80659e63d6973238d9c9424d4f5de315660103
c27a6c1e69cbc878666647420f9955ee3f664592
/context/src/main/java/com/zqkh/archive/context/configuration/MQConfiguration.java
601993e84d5132f8bc9162c5299e6cccde3fff4a
[]
no_license
mathcompelte/microservice-archive
54966b2981a708a7d714c06aad6a49ee5c237729
0dff4fc46bd64c4cccf588da7e7ce885e59876c2
refs/heads/master
2021-09-18T17:07:49.139007
2018-07-17T10:06:55
2018-07-17T10:06:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,017
java
package com.zqkh.archive.context.configuration; import com.jovezhao.nest.amq.AMQChannelProvider; import com.jovezhao.nest.amq.AMQProviderConfig; import com.jovezhao.nest.ddd.event.ChannelProvider; import com.jovezhao.nest.ddd.event.EventConfigItem; import com.zqkh.gene.event.dto.GeneOrderStatusEventDto; import com.zqkh.user.event.dto.UserAuthEventDto; import com.zqkh.user.event.dto.UserFirstLoginEventDto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** * @author * @date 2017/12/4 0004 15:30 */ @Configuration public class MQConfiguration { @Autowired private CloudConfigProperties cloudConfigProperties; @Bean public AMQProviderConfig getAMQProvider() { AMQProviderConfig providerConfig = new AMQProviderConfig(); providerConfig.setSecretId(cloudConfigProperties.getAmq().getSecretId()); providerConfig.setSecretKey(cloudConfigProperties.getAmq().getSecretKey()); providerConfig.setEndpoint(cloudConfigProperties.getAmq().getEndpoint()); return providerConfig; } @Bean public AMQChannelProvider getAMQChannelProvider(AMQProviderConfig providerConfig) { AMQChannelProvider channelProvider = new AMQChannelProvider(providerConfig); return channelProvider; } @Bean public EventConfigItem getUserAuthEvent(ChannelProvider provider) { EventConfigItem eventConfigItem = new EventConfigItem(); eventConfigItem.setChannelProvider(provider); eventConfigItem.setEventName(UserAuthEventDto.EVENT_NAME); return eventConfigItem; } @Bean public EventConfigItem editGeneOrderStatus(ChannelProvider provider){ EventConfigItem eventConfigItem = new EventConfigItem(); eventConfigItem.setChannelProvider(provider); eventConfigItem.setEventName(GeneOrderStatusEventDto.EVENT_NAME); return eventConfigItem; } }
964405633ad22efbcc926b4e659bedd16a7c4204
735005f6541e7a66fd57a7fc5c574ac1fc444db6
/src/com/shastram/web8085/client/pattern/SignalSlot.java
17d2f6c03adea523b385eea9f41bc67b7f4cac8b
[]
no_license
selfmodify/web8085
1a11b81ed16831c87d85e115c70bc14c8b2d99cd
969c886fc38275cf4a1b2793b32b65daaaa96e9a
refs/heads/master
2021-05-28T13:12:06.231726
2015-05-05T04:33:30
2015-05-05T04:33:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,284
java
package com.shastram.web8085.client.pattern; import java.util.ArrayList; import java.util.HashMap; public class SignalSlot extends Observable { public static enum Signals { EXAMPLE_SOURCE_CODE_AVAILABLE } private HashMap<Signals, ArrayList<Observer>> observerMap = new HashMap<SignalSlot.Signals, ArrayList<Observer>>(); public static class SignalData { public Signals signal; public HashMap<String, Object> mapData = new HashMap<String, Object>(); public Object singleData; public SignalData(Signals signal, HashMap<String, Object> mapData) { this.signal = signal; this.mapData = mapData; } public SignalData(Signals signal, Object singleData) { this.signal = signal; this.singleData = singleData; } } // This static singleton is converted to JS, so there are no MT issues public static SignalSlot instance = new SignalSlot(); public void notiyAbout(Signals signal, Object data) { SignalData signalData = new SignalData(signal, data); notifyObservers(signalData); } public void notifyAbout(Signals signal, Object... keyValues) { HashMap<String, Object> dataMap = new HashMap<String, Object>(); for (int i = 0; i < keyValues.length;) { String key = (String) keyValues[i]; ++i; if (i < keyValues.length) { dataMap.put(key, keyValues[i]); } ++i; } SignalData signalData = new SignalData(signal, dataMap); notifyObservers(signalData); } private void notifyObservers(SignalData signalData) { ArrayList<Observer> observers = observerMap.get(signalData.signal); if (observers != null) { for (Observer o : observers) { o.update(signalData); } } } public void addObserver(Signals signal, Observer observer) { ArrayList<Observer> observers = observerMap.get(signal); if (observers == null) { observers = new ArrayList<Observer>(); observerMap.put(signal, observers); } if (!observers.contains(observer)) { observers.add(observer); } } }
2e1c864cabe189ef6aed2fa6add08e4165c881c0
da0e9bf0093127459a08a77597d0cfbc806b7124
/rosjava_tf/rosjava_android_gps/android_src/org/ros/rosjava/android/views/RosImageView.java
9e2a6245e12f2eeb82200c0e8d91a5d2451c3ffd
[]
no_license
nickarmstrongcrews/hl-ros-pkg
d8b93fb3a6a145e7eb48d81511a9df8a28da7cba
6866d91182c25c59aa65646f469a392fc5c73343
refs/heads/master
2016-09-05T11:17:47.415840
2011-09-24T23:45:52
2011-09-24T23:45:52
32,208,671
0
0
null
null
null
null
UTF-8
Java
false
false
2,651
java
/* * Copyright (C) 2011 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package org.ros.rosjava.android.views; import com.google.common.base.Preconditions; import android.content.Context; import android.graphics.Bitmap; import android.util.AttributeSet; import android.widget.ImageView; import org.ros.message.MessageListener; import org.ros.node.DefaultNodeFactory; import org.ros.node.Node; import org.ros.node.NodeConfiguration; import org.ros.node.NodeMain; import org.ros.rosjava.android.MessageCallable; /** * A camera node that publishes images and camera_info * * @author [email protected] (Ethan Rublee) * @author [email protected] (Damon Kohler) */ public class RosImageView<T> extends ImageView implements NodeMain { private String topicName; private String messageType; private MessageCallable<Bitmap, T> callable; private Node node; public RosImageView(Context context) { super(context); } public RosImageView(Context context, AttributeSet attrs) { super(context, attrs); } public RosImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setTopicName(String topicName) { this.topicName = topicName; } public void setMessageType(String messageType) { this.messageType = messageType; } public void setMessageToBitmapCallable(MessageCallable<Bitmap, T> callable) { this.callable = callable; } @Override public void main(NodeConfiguration nodeConfiguration) throws Exception { Preconditions.checkState(node == null); node = new DefaultNodeFactory().newNode("android/image_view", nodeConfiguration); node.newSubscriber(topicName, messageType, new MessageListener<T>() { @Override public void onNewMessage(final T message) { post(new Runnable() { @Override public void run() { setImageBitmap(callable.call(message)); } }); postInvalidate(); } }); } @Override public void shutdown() { Preconditions.checkNotNull(node); node.shutdown(); node = null; } }
[ "[email protected]@cd5f99c4-7c93-92ea-9161-56830371f3b7" ]
[email protected]@cd5f99c4-7c93-92ea-9161-56830371f3b7
73cf6b99d0d1c81b61eb06555f70c4699a8dfb91
f883ec7c0d48efef769633256cbd8cfc9ca68a14
/web/src/main/java/by/estore/web/tag/PaginationTag.java
71e2708090adf8f41c18080b69337536d08d8cc9
[]
no_license
pallid4m/jwd-final-project
7a3c7d2ff9954e603ab5a68c5dd889706d6237ee
43280bcb694914a08fa4ac0c768bb49a2c66a701
refs/heads/master
2023-02-02T17:56:55.240499
2020-12-20T15:55:02
2020-12-20T15:55:02
300,156,139
0
0
null
null
null
null
UTF-8
Java
false
false
3,402
java
package by.estore.web.tag; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.tagext.SimpleTagSupport; import java.io.Writer; public class PaginationTag extends SimpleTagSupport { private String uri; private int offset; private int count; private int max = 10; private int steps = 5; private String previous = "Previous"; private String next = "Next"; private Writer getWriter() { JspWriter out = getJspContext().getOut(); return out; } @Override public void doTag() throws JspException { Writer out = getWriter(); try { out.write("<nav>"); out.write("<ul class=\"pagination justify-content-end\">"); if (offset < steps) { out.write(constructLink(1, previous, "page-item disabled", true)); } else { out.write(constructLink(offset - steps, previous, "page-item", false)); } for (int itr = 0; itr < count; itr += steps) { if (offset == itr) { out.write(constructLink((itr / 5 + 1) - 1 * steps, String.valueOf(itr / 5 + 1), "page-item active", true)); } else { out.write(constructLink(itr / 5 * steps, String.valueOf(itr / 5 + 1), "page-item", false)); } } if (offset + steps > count) { out.write(constructLink(offset + steps, next, "page-item disabled", true)); } else { out.write(constructLink(offset + steps, next, "page-item", false)); } out.write("</ul>"); out.write("</nav>"); } catch (java.io.IOException ex) { throw new JspException("Error in Paginator tag", ex); } } private String constructLink(int page, String text, String className, boolean disabled) { StringBuilder link = new StringBuilder("<li"); if (className != null) { link.append(" class=\""); link.append(className); link.append("\""); } if (disabled) { link.append(">").append("<a class=\"page-link\" href=\"#\">" + text + "</a></li>"); } else { page = page / 5 + 1; link.append(">").append("<a class=\"page-link\" href=\"" + uri + "&page=" + page + "\">" + text + "</a></li>"); } return link.toString(); } public String getUri() { return uri; } public void setUri(String uri) { this.uri = uri; } public int getOffset() { return offset; } public void setOffset(int offset) { this.offset = offset; } public int getCount() { return count; } public void setCount(int count) { this.count = count; } public int getMax() { return max; } public void setMax(int max) { this.max = max; } public String getPrevious() { return previous; } public void setPrevious(String previous) { this.previous = previous; } public String getNext() { return next; } public void setNext(String next) { this.next = next; } public int getSteps() { return steps; } public void setSteps(int steps) { this.steps = steps; } }
a2f59023b24ed3e609c311cfcc134ef046c6f482
424ae9748e73719a8f21ca487cc55a5ee8b59d92
/app/src/test/java/com/ed/androidxdemo/ExampleUnitTest.java
95971710bbb6df7da022c4389f1082cedf7cd359
[]
no_license
liujianguangnice/androidx_gradle
3e22ee7a83a58ffdc34ac630ea22209abbaf524b
ddc7232069ac691e09fbffc06c95118abb884d30
refs/heads/master
2022-11-22T16:55:31.704606
2020-07-29T14:52:47
2020-07-29T14:52:47
283,156,101
0
0
null
null
null
null
UTF-8
Java
false
false
380
java
package com.ed.androidxdemo; 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); } }
ea53983cee02d62ee195a277adee735167199bee
d9f27405cb6aa662adbfde4dece259bf5588e132
/app/src/main/java/com/example/anggi/anggi_priatna_1202150042_modul6/model/Comment.java
9650d3a4cacd49c091aa1b3b0a8301c325919b93
[]
no_license
Priatnaanggi/ANGGI-PRIATNA_1202150042_MODUL6
0580afc15468351ee1b98bd29102cc2250aca4bc
aa7afa3a6e6090a91d9d2fb63979b351b37fb025
refs/heads/master
2020-03-07T18:43:10.968526
2018-04-01T16:32:45
2018-04-01T16:32:45
127,649,425
0
0
null
null
null
null
UTF-8
Java
false
false
793
java
package com.example.anggi.anggi_priatna_1202150042_modul6.model; /** * Created by Anggi on 4/1/2018. */ public class Comment { String id; String username; String comment; public Comment(){} public Comment(String id, String username, String comment) { this.id = id; this.username = username; this.comment = comment; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getComment() { return comment; } public void setComment(String comment) { this.comment = comment; } }
0182a09360fd944905827caeac93bc400b5b77c6
d32fc624979d92d9bb9217801c50b8089d78845d
/Monopoly/.settings/src/monopoly/game/Bank.java
ac70e9e6830cbaacd8f81805e08c57e17add6a62
[]
no_license
IanScott/University-Projects
bcd7e3b01201c573c6fe6df9ce3ff0bfd7de4930
08175eff3830bf04064948ed2735220421990a57
refs/heads/master
2021-01-17T06:09:03.493956
2016-07-26T10:54:57
2016-07-26T10:54:57
51,010,749
0
0
null
null
null
null
UTF-8
Java
false
false
1,445
java
package monopoly.game; /** * Class is responsible the management of the houses and hotels. * @author Ian van Nieuwkoop * */ public class Bank { private static final int MAXHOUSES = 32; private static final int MAXHOTELS = 12; private int houses = MAXHOUSES; private int hotels = MAXHOTELS; /** * Constructor. */ public Bank(){} /** * Method returns the available houses. * @return the available houses */ public int getHouses(){ return houses; } /** * Method checks if a player can add a house. * @return if a player can add a house or not */ public boolean canAddHouse(){ return (houses>=1); } /** * Method check if a player can add a hotel. * @return if a player can add a hotel or not */ public boolean canAddHotel(){ return (hotels>=1); } /** * Returns a house. */ public void returnHouse(){ houses++; } /** * Returns multiple houses. * @param hs the amount of houses to return */ public void returnHouses(int hs){ houses= houses +hs; } /** * Returns a hotel. */ public void returnHotel(){ hotels++; } /** * Takes a house. */ public void takeHouse(){ houses--; } /** * Takes multiple houses. * @param hs the amount of houses to return */ public void takeHouses(int hs){ houses= houses-hs; } /** * Takes a hotel. */ public void takeHotel(){ hotels--; } }
f1e5a9f374c8fdb06a978f400fb5724c17410f96
264bb62356f8aaeb9eba8d4275a0f5379d72a9e8
/limits-service/src/main/java/br/com/bcp/limitsservice/AppLimits.java
108789527a43971d0adf1401ddd713b778047833
[]
no_license
bproenca/spring-cloud-bcp
dd50794b752e99b1e31d6b7cee882ee208aea91a
e54bf190a3c775ac28b2bedb5d04f4a7576e402a
refs/heads/master
2022-12-07T15:58:48.306816
2020-04-12T18:20:38
2020-04-12T18:20:38
250,657,714
0
0
null
2022-11-24T09:17:33
2020-03-27T22:01:03
Java
UTF-8
Java
false
false
627
java
package br.com.bcp.limitsservice; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.netflix.hystrix.EnableHystrix; @SpringBootApplication @EnableDiscoveryClient @EnableHystrix public class AppLimits { public static void main(String[] args) { System.out.println("*** " + System.getProperty("java.version") + " ***"); System.out.println("*** " + System.getProperty("java.vendor") + " ***"); SpringApplication.run(AppLimits.class, args); } }
884c0e28ab6da076b6fec35630e8d1dd1cff6a01
c23d004d5ba7ba24948e766ce2e2bae65ac806fe
/app/src/main/java/com/example/animesh/kudos/activity/DriverSettingsActivity.java
aeea7b777a92671a87d53e9b93c4a88a81e6ff51
[]
no_license
animesh2411/Kudos-android-app
11d2c0223beb7462f05f41e92d8dfc9c067d921b
863346331e32076d949e111672b2d0e076b818df
refs/heads/master
2020-03-14T03:47:38.343365
2018-04-28T17:00:03
2018-04-28T17:00:03
131,427,508
1
1
null
null
null
null
UTF-8
Java
false
false
7,892
java
package com.example.animesh.kudos.activity; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.RadioButton; import android.widget.RadioGroup; import com.bumptech.glide.Glide; import com.example.animesh.kudos.R; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import com.google.firebase.storage.UploadTask; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.HashMap; import java.util.Map; public class DriverSettingsActivity extends AppCompatActivity { private EditText mNameField, mPhoneField, mCarField; private Button mBack, mConfirm; private ImageView mProfileImage; private FirebaseAuth mAuth; private DatabaseReference mDriverDatabase; private String userID; private String mName; private String mPhone; private String mCar; private String mService; private String mProfileImageUrl; private Uri resultUri; private RadioGroup mRadioGroup; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_driver_settings); mNameField = (EditText) findViewById(R.id.name); mPhoneField = (EditText) findViewById(R.id.phone); mCarField = (EditText) findViewById(R.id.car); mProfileImage = (ImageView) findViewById(R.id.profileImage); mRadioGroup = (RadioGroup) findViewById(R.id.radioGroup); mBack = (Button) findViewById(R.id.back); mConfirm = (Button) findViewById(R.id.confirm); mAuth = FirebaseAuth.getInstance(); userID = mAuth.getCurrentUser().getUid(); mDriverDatabase = FirebaseDatabase.getInstance().getReference().child("Users").child("Drivers").child(userID); getUserInfo(); mProfileImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); startActivityForResult(intent, 1); } }); mConfirm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { saveUserInformation(); } }); mBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); return; } }); } private void getUserInfo(){ mDriverDatabase.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if(dataSnapshot.exists() && dataSnapshot.getChildrenCount()>0){ Map<String, Object> map = (Map<String, Object>) dataSnapshot.getValue(); if(map.get("name")!=null){ mName = map.get("name").toString(); mNameField.setText(mName); } if(map.get("phone")!=null){ mPhone = map.get("phone").toString(); mPhoneField.setText(mPhone); } if(map.get("car")!=null){ mCar = map.get("car").toString(); mCarField.setText(mCar); } if(map.get("service")!=null){ mService = map.get("service").toString(); switch (mService){ case"UberX": mRadioGroup.check(R.id.UberX); break; case"UberBlack": mRadioGroup.check(R.id.UberBlack); break; case"UberXl": mRadioGroup.check(R.id.UberXl); break; } } if(map.get("profileImageUrl")!=null){ mProfileImageUrl = map.get("profileImageUrl").toString(); Glide.with(getApplication()).load(mProfileImageUrl).into(mProfileImage); } } } @Override public void onCancelled(DatabaseError databaseError) { } }); } private void saveUserInformation() { mName = mNameField.getText().toString(); mPhone = mPhoneField.getText().toString(); mCar = mCarField.getText().toString(); int selectId = mRadioGroup.getCheckedRadioButtonId(); final RadioButton radioButton = (RadioButton) findViewById(selectId); if (radioButton.getText() == null){ return; } mService = radioButton.getText().toString(); Map userInfo = new HashMap(); userInfo.put("name", mName); userInfo.put("phone", mPhone); userInfo.put("car", mCar); userInfo.put("service", mService); mDriverDatabase.updateChildren(userInfo); if(resultUri != null) { StorageReference filePath = FirebaseStorage.getInstance().getReference().child("profile_images").child(userID); Bitmap bitmap = null; try { bitmap = MediaStore.Images.Media.getBitmap(getApplication().getContentResolver(), resultUri); } catch (IOException e) { e.printStackTrace(); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 20, baos); byte[] data = baos.toByteArray(); UploadTask uploadTask = filePath.putBytes(data); uploadTask.addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { finish(); return; } }); uploadTask.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { Uri downloadUrl = taskSnapshot.getDownloadUrl(); Map newImage = new HashMap(); newImage.put("profileImageUrl", downloadUrl.toString()); mDriverDatabase.updateChildren(newImage); finish(); return; } }); }else{ finish(); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(requestCode == 1 && resultCode == Activity.RESULT_OK){ final Uri imageUri = data.getData(); resultUri = imageUri; mProfileImage.setImageURI(resultUri); } } }
43b1822c4a085a47afd54ec82277375415964ad0
b89ac156bd3e5231599ef0c708bba19419e77e18
/app/src/main/java/com/wangdaye/mysplash/main/view/fragment/SearchFragment.java
277b83f681018665a4711e76fb6919f056d0781f
[]
no_license
dainguyen2193/Mysplash
fe8c409d0290fc353be74dbb1032e5d92a164844
9f7722f35e62131f1b1cdef553e4614ed743920f
refs/heads/master
2020-12-25T23:19:56.920176
2016-09-15T03:05:28
2016-09-15T03:05:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,826
java
package com.wangdaye.mysplash.main.view.fragment; import android.content.Context; import android.os.Bundle; import android.os.Message; import android.support.design.widget.CoordinatorLayout; import android.support.v4.app.Fragment; import android.support.v7.widget.Toolbar; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import com.wangdaye.mysplash.R; import com.wangdaye.mysplash._common.i.model.SearchBarModel; import com.wangdaye.mysplash._common.i.presenter.MessageManagePresenter; import com.wangdaye.mysplash._common.i.presenter.PopupManagePresenter; import com.wangdaye.mysplash._common.i.presenter.SearchBarPresenter; import com.wangdaye.mysplash._common.utils.NotificationUtils; import com.wangdaye.mysplash._common.utils.ThemeUtils; import com.wangdaye.mysplash._common.utils.TypefaceUtils; import com.wangdaye.mysplash._common.utils.ValueUtils; import com.wangdaye.mysplash._common.i.view.MessageManageView; import com.wangdaye.mysplash._common.i.view.PopupManageView; import com.wangdaye.mysplash._common.i.view.SearchBarView; import com.wangdaye.mysplash.main.model.fragment.SearchBarObject; import com.wangdaye.mysplash.main.presenter.activity.MessageManageImplementor; import com.wangdaye.mysplash.main.presenter.fragment.SearchBarImplementor; import com.wangdaye.mysplash.main.presenter.fragment.SearchFragmentPopupManageImplementor; import com.wangdaye.mysplash.main.view.activity.MainActivity; import com.wangdaye.mysplash._common.ui.widget.StatusBarView; import com.wangdaye.mysplash.main.view.widget.SearchPhotosView; import com.wangdaye.mysplash._common.utils.SafeHandler; import java.util.Timer; import java.util.TimerTask; /** * Search Fragment. * */ public class SearchFragment extends Fragment implements SearchBarView, MessageManageView, PopupManageView, View.OnClickListener, Toolbar.OnMenuItemClickListener, EditText.OnEditorActionListener, NotificationUtils.SnackbarContainer, SafeHandler.HandlerContainer { // model. private SearchBarModel searchBarModel; // view. private CoordinatorLayout container; private EditText editText; private TextView orientationTxt; private ImageView menuIcon; private SearchPhotosView contentView; private SafeHandler<SearchFragment> handler; // presenter. private SearchBarPresenter searchBarPresenter; private MessageManagePresenter messageManagePresenter; private PopupManagePresenter popupManagePresenter; /** <br> life cycle. */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_search, container, false); initModel(); initView(view); initPresenter(); messageManagePresenter.sendMessage(1, null); return view; } @Override public void onDestroy() { super.onDestroy(); searchBarPresenter.hideKeyboard(); handler.removeCallbacksAndMessages(null); contentView.cancelRequest(); } /** <br> presenter. */ private void initPresenter() { this.searchBarPresenter = new SearchBarImplementor(searchBarModel, this); this.messageManagePresenter = new MessageManageImplementor(this); this.popupManagePresenter = new SearchFragmentPopupManageImplementor(this); } /** <br> view. */ // init. private void initView(View v) { this.handler = new SafeHandler<>(this); StatusBarView statusBar = (StatusBarView) v.findViewById(R.id.fragment_search_statusBar); if (ThemeUtils.getInstance(getActivity()).isNeedSetStatusBarMask()) { statusBar.setMask(true); } this.container = (CoordinatorLayout) v.findViewById(R.id.fragment_search_container); Toolbar toolbar = (Toolbar) v.findViewById(R.id.fragment_search_toolbar); if (ThemeUtils.getInstance(getActivity()).isLightTheme()) { toolbar.inflateMenu(R.menu.fragment_search_toolbar_light); toolbar.setNavigationIcon(R.drawable.ic_toolbar_back_light); } else { toolbar.inflateMenu(R.menu.fragment_search_toolbar_dark); toolbar.setNavigationIcon(R.drawable.ic_toolbar_back_dark); } toolbar.setOnMenuItemClickListener(this); toolbar.setNavigationOnClickListener(this); this.editText = (EditText) v.findViewById(R.id.fragment_search_editText); TypefaceUtils.setTypeface(getActivity(), editText); editText.setOnEditorActionListener(this); editText.setFocusable(true); editText.requestFocus(); FrameLayout orientationContainer = (FrameLayout) v.findViewById(R.id.fragment_search_orientationContainer); orientationContainer.setOnClickListener(this); RelativeLayout orientationMenu = (RelativeLayout) v.findViewById(R.id.fragment_search_orientationMenu); orientationMenu.setOnClickListener(this); this.menuIcon = (ImageView) v.findViewById(R.id.fragment_search_menuIcon); if (ThemeUtils.getInstance(getActivity()).isLightTheme()) { menuIcon.setImageResource(R.drawable.ic_menu_down_light); } else { menuIcon.setImageResource(R.drawable.ic_menu_down_dark); } this.orientationTxt = (TextView) v.findViewById(R.id.fragment_search_nowTxt); TypefaceUtils.setTypeface(getActivity(), orientationTxt); orientationTxt.setText(ValueUtils.getOrientationName(getActivity(), searchBarModel.getOrientation())); this.contentView = (SearchPhotosView) v.findViewById(R.id.fragment_search_contentView); contentView.setActivity(getActivity()); contentView.setOnClickListener(this); } // interface. public void pagerBackToTop() { contentView.pagerScrollToTop(); } /** <br> model. */ // init. private void initModel() { this.searchBarModel = new SearchBarObject(); } // interface. public boolean needPagerBackToTop() { return contentView.needPagerBackToTop(); } /** <br> interface. */ // on click listener. @Override public void onClick(View view) { switch (view.getId()) { case -1: searchBarPresenter.touchNavigatorIcon(); break; case R.id.fragment_search_orientationContainer: searchBarPresenter.touchSearchBar(); case R.id.fragment_search_orientationMenu: searchBarPresenter.touchOrientationIcon(); break; case R.id.fragment_search_contentView: searchBarPresenter.hideKeyboard(); break; } } // on menu item click listener. @Override public boolean onMenuItemClick(MenuItem item) { searchBarPresenter.touchMenuItem(item.getItemId()); return true; } // on editor action clickListener. @Override public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { String text = textView.getText().toString(); if (!text.equals("")) { searchBarPresenter.submitSearchInfo(text); } searchBarPresenter.hideKeyboard(); return true; } // snackbar container. @Override public View getSnackbarContainer() { return container; } // handler. @Override public void handleMessage(Message message) { messageManagePresenter.responseMessage(message.what, message.obj); } // view. // search bar view. @Override public void touchNavigatorIcon() { ((MainActivity) getActivity()).removeFragment(); } @Override public void touchMenuItem(int itemId) { switch (itemId) { case R.id.action_clear_text: editText.setText(""); break; } } @Override public void touchOrientationIcon() { popupManagePresenter.showPopup(getActivity(), menuIcon, searchBarModel.getOrientation(), 0); } @Override public void touchSearchBar() { contentView.pagerScrollToTop(); } @Override public void showKeyboard() { InputMethodManager manager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); manager.showSoftInput(editText, 0); } @Override public void hideKeyboard() { InputMethodManager manager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); manager.hideSoftInputFromWindow(editText.getWindowToken(), 0); } @Override public void submitSearchInfo(String text, String orientation) { contentView.doSearch(text, orientation); } // message manage view. @Override public void sendMessage(final int what, final Object o) { new Timer().schedule(new TimerTask() { @Override public void run() { handler.obtainMessage(what, o).sendToTarget(); } }, 400); } @Override public void responseMessage(int what, Object o) { switch (what) { case 1: showKeyboard(); break; } } // popup manage view. @Override public void responsePopup(String value, int position) { searchBarPresenter.setOrientation(value); orientationTxt.setText(ValueUtils.getOrientationName(getActivity(), value)); } }
f891af285f20501c9e4d554f722664a934f7ab2b
d253c9173e484d88431817ca6430105c613e4312
/dina-datamodel/target/generated-sources/annotations/se/nrm/dina/datamodel/Fieldnotebookattachment_.java
b1bce4a80e52d9864d56af8f23a14865ef3e4c56
[]
no_license
idahjli/dina-project
d59e5281aaaa3fdcf9a0e10a2443fd901482d111
975cbfd1b5dfcb83e618b03ed593f22c6448fc24
refs/heads/master
2021-01-10T09:41:52.493365
2016-03-23T13:57:51
2016-03-23T13:57:51
54,889,548
0
0
null
null
null
null
UTF-8
Java
false
false
1,156
java
package se.nrm.dina.datamodel; import javax.annotation.Generated; import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.StaticMetamodel; import se.nrm.dina.datamodel.Agent; import se.nrm.dina.datamodel.Attachment; import se.nrm.dina.datamodel.Fieldnotebook; @Generated(value="EclipseLink-2.6.0.v20130922-rNA", date="2016-03-21T11:14:44") @StaticMetamodel(Fieldnotebookattachment.class) public class Fieldnotebookattachment_ extends BaseEntity_ { public static volatile SingularAttribute<Fieldnotebookattachment, Fieldnotebook> fieldNotebookID; public static volatile SingularAttribute<Fieldnotebookattachment, Integer> fieldNotebookAttachmentId; public static volatile SingularAttribute<Fieldnotebookattachment, Agent> modifiedByAgentID; public static volatile SingularAttribute<Fieldnotebookattachment, Agent> createdByAgentID; public static volatile SingularAttribute<Fieldnotebookattachment, Attachment> attachmentID; public static volatile SingularAttribute<Fieldnotebookattachment, String> remarks; public static volatile SingularAttribute<Fieldnotebookattachment, Integer> ordinal; }
742271f23965f9e22021f5c469ae85c1702d2148
2ce59c376166d736a9653b52780a57918886ecca
/javacore/studentapp/src/com/ustglobal/studentapp/qspiders/TestB.java
ed788867edeb3f3b05ca271b96cd6586d16cdd2a
[]
no_license
reshuvishwa1705/USTGlobal_Training_Codes
bbb2f8f3f14699cf2c5fe458c8fe2f7631618cfa
321c895a506e0dec51845521bf0b6a5ee50c41ea
refs/heads/master
2022-06-27T11:23:37.364973
2019-11-26T09:56:23
2019-11-26T09:56:23
223,371,010
0
0
null
null
null
null
UTF-8
Java
false
false
295
java
package com.ustglobal.studentapp.qspiders; import static com.ustglobal.studentapp.jspiders.Remote.*; import com.ustglobal.studentapp.jspiders.Remote; public class TestB { public static void main(String[] args) { on(); System.out.println(num); StringBuffer sf=new StringBuffer(); } }
f1dd8bcdadb5b1404a2128b09b35c9f821b8ebe2
f0e1abb62bb035b42d77e92d0e7d40898f4e6de7
/src/main/java/com/vs/kafka/model/MyEntitySchema.java
3d5fb43dc431fb12e1c20ca84f0e9b89d370ae40
[]
no_license
BohdanZhezlo/kafka-connector
b0d5ffa30d936a29022c36dd007e3a4913517924
4641c093bab8a3b09b17e58255ea098ddb2a4a80
refs/heads/master
2021-06-25T05:13:34.758690
2019-10-31T13:00:41
2019-10-31T13:00:41
218,763,703
0
0
null
2021-03-31T21:30:28
2019-10-31T12:44:31
Java
UTF-8
Java
false
false
1,025
java
package com.vs.kafka.model; import org.apache.kafka.connect.data.Schema; import org.apache.kafka.connect.data.SchemaBuilder; import org.apache.kafka.connect.data.Struct; public class MyEntitySchema { private static final String INT_FIELD = "intField"; private static final String STRING_FIELD = "stringField"; private static final Schema SCHEMA = SchemaBuilder.struct() .name(MyEntitySchema.class.getSimpleName()) .field(INT_FIELD, Schema.INT32_SCHEMA) .field(STRING_FIELD, Schema.STRING_SCHEMA) .build(); public static Schema myEntityVectorSchema() { return SCHEMA; } public static Struct toStruct(MyEntity myEntity) { return new Struct(myEntityVectorSchema()) .put(INT_FIELD, myEntity.intValue) .put(STRING_FIELD, myEntity.stringValue); } public static MyEntity fromStruct(Struct struct) { return new MyEntity(struct.getInt32(INT_FIELD), struct.getString(STRING_FIELD)); } }
c25636e8b438831e4f0f68f2d8709a5809e8ac18
4638c49d1e494bcc243c0e7b6278d7b1615f825e
/src/main/java/clone/CloneTest.java
ef9d9b7b3630c07abaab0121118c92806d3eebba
[ "Apache-2.0" ]
permissive
pczx/interview_code
8bbdbca82b4a9aeffd6cc2809fb07d13efeaea88
39d306853e0147cca08f5bb0f25548c07e02cbd6
refs/heads/master
2023-05-03T08:32:27.342113
2021-05-13T02:55:30
2021-05-13T02:55:30
305,874,515
0
0
null
2021-05-13T02:54:52
2020-10-21T01:22:31
Java
UTF-8
Java
false
false
542
java
package clone; public class CloneTest { public static void main(String[] args) { try { Employee original = new Employee("John Q. Public", 50000); original.setHireDay(2000, 1, 1); Employee copy = original.clone(); copy.raiseSalary(10); copy.setHireDay(2002, 12, 31); System.out.println("original=" + original); System.out.println("copy=" + copy); } catch (CloneNotSupportedException e) { e.printStackTrace(); } } }
0d92ddb642439c3b58c4cb5ebd57cc92537219bc
0d8b562ac93f7d13109579bccdb485b5c1350c0b
/rapla-source-1.8.2/src/org/rapla/storage/CachableStorageOperatorCommand.java
21ff3f4ac813f02651ccd54fd2ccca8c4e5174bf
[]
no_license
jcoona/Rapla
ccc67de07983ea2e4a9a74ef4ae8085a5376e14c
9ba6108fa855b2f867fdd461be8c3d76bd43d803
refs/heads/master
2020-12-30T11:39:59.608805
2015-12-22T02:48:11
2015-12-22T02:48:11
91,515,608
0
0
null
null
null
null
UTF-8
Java
false
false
194
java
package org.rapla.storage; import org.rapla.framework.RaplaException; public interface CachableStorageOperatorCommand { public void execute( LocalCache cache) throws RaplaException; }
8ab32be35266614037a73bff34854237caa2d8b6
9ed3d264f0bb8962849700fad541712936dec558
/day46/src/Offer9.java
71487548b05aec871cab7ab6293d219e7e3a847a
[]
no_license
GourdWa/LeetCode
2fce8b7537ffe9683295acda7effd7fd91a86e7c
c3c58d4417ae797bca51e672ace2b167866907e3
refs/heads/master
2023-01-29T19:36:13.714254
2020-12-05T09:27:06
2020-12-05T09:27:06
266,662,025
1
0
null
null
null
null
UTF-8
Java
false
false
1,800
java
import java.util.Deque; import java.util.LinkedList; import java.util.Queue; import java.util.Stack; /** * @author Zixiang Hu * @description 剑指 Offer 09. 用两个栈实现队列 * @create 2020-06-30-10:51 */ public class Offer9 { //非最优解答 /* class CQueue { private Stack<Integer> stack1; private Stack<Integer> stack2; public CQueue() { stack1 = new Stack<>(); stack2 = new Stack<>(); } public void appendTail(int value) { stack1.push(value); } public int deleteHead() { int ans = -1; while (stack1.size() > 1) stack2.push(stack1.pop()); if (stack1.size() == 1) ans = stack1.pop(); while (!stack2.isEmpty()) stack1.push(stack2.pop()); return ans; } }*/ class CQueue { private Deque<Integer> stack1 = new LinkedList<>(); private Deque<Integer> stack2 = new LinkedList<>(); private int size = 0; public CQueue() { } public void appendTail(int value) { stack1.push(value); size++; } public int deleteHead() { int ans = -1; if (size != 0) { if (stack2.isEmpty()) { while (!stack1.isEmpty()) stack2.push(stack1.pop()); } ans = stack2.pop(); size--; } return ans; } } public static void main(String[] args) { CQueue cQueue = new Offer9().new CQueue(); cQueue.appendTail(3); System.out.println(cQueue.deleteHead()); System.out.println(cQueue.deleteHead()); } }
bf11ac92a6a3c8e6f191ab83a225bc702a0f8448
c1329dc71a40cedca8e5a3217b2b7507953c1cc3
/Structural Design Patterns/Flyweight Pattern/Shape.java
5f081e54752459e3a7f03e66a0fa2ea245bcbf67
[]
no_license
Chris-Slattery/Design-Patterns
30809c948103c99661409d62ed695b46242fbf9d
6012ae8c46d903c636a0ab0e7b405cd1cdbc4630
refs/heads/main
2023-07-28T13:06:51.454763
2021-09-09T15:18:27
2021-09-09T15:18:27
404,764,610
0
0
null
null
null
null
UTF-8
Java
false
false
130
java
/** * @(#)Shape.java * * * @author * @version 1.00 2021/7/21 */ public interface Shape { void draw(); }
5e71497b42972d272ebfe791bd514b00f9d20349
56fe53e612720292dc30927072e6f76c2eea6567
/onvif/src/org/onvif/ver10/schema/Defogging.java
c3386c3e7d94110c3ca99ceba9929d2a35c710c6
[]
no_license
guishijin/onvif4java
f0223e63cda3a7fcd44e49340eaae1d7e5354ad0
9b15dba80f193ee4ba952aad377dda89a9952343
refs/heads/master
2020-04-08T03:22:51.810275
2019-10-23T11:16:46
2019-10-23T11:16:46
124,234,334
1
1
null
null
null
null
UTF-8
Java
false
false
3,145
java
package org.onvif.ver10.schema; import java.util.HashMap; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; /** * <p> * Java class for Defogging complex type. * * <p> * The following schema fragment specifies the expected content contained within * this class. * * <pre> * &lt;complexType name="Defogging"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="Mode" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="Level" type="{http://www.w3.org/2001/XMLSchema}float" minOccurs="0"/> * &lt;element name="Extension" type="{http://www.onvif.org/ver10/schema}DefoggingExtension" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Defogging", propOrder = { "mode", "level", "extension" }) public class Defogging { @XmlElement(name = "Mode", required = true) protected String mode; @XmlElement(name = "Level") protected Float level; @XmlElement(name = "Extension") protected DefoggingExtension extension; @XmlAnyAttribute private Map<QName, String> otherAttributes = new HashMap<QName, String>(); /** * Gets the value of the mode property. * * @return possible object is {@link String } * */ public String getMode() { return mode; } /** * Sets the value of the mode property. * * @param value * allowed object is {@link String } * */ public void setMode(String value) { this.mode = value; } /** * Gets the value of the level property. * * @return possible object is {@link Float } * */ public Float getLevel() { return level; } /** * Sets the value of the level property. * * @param value * allowed object is {@link Float } * */ public void setLevel(Float value) { this.level = value; } /** * Gets the value of the extension property. * * @return possible object is {@link DefoggingExtension } * */ public DefoggingExtension getExtension() { return extension; } /** * Sets the value of the extension property. * * @param value * allowed object is {@link DefoggingExtension } * */ public void setExtension(DefoggingExtension value) { this.extension = value; } /** * Gets a map that contains attributes that aren't bound to any typed * property on this class. * * <p> * the map is keyed by the name of the attribute and the value is the string * value of the attribute. * * the map returned by this method is live, and you can add new attribute by * updating the map directly. Because of this design, there's no setter. * * * @return always non-null */ public Map<QName, String> getOtherAttributes() { return otherAttributes; } }
c26e32b53212c32e35856cfc80aa22a5e98329de
95793049fcd04f87a220083b480a062d5da7b1da
/src/main/java/com/spiderrobotman/Gamemode4Engine/command/NickCommand.java
9c974031ced4fb3175820960255692fe5aabc111
[ "MIT" ]
permissive
SpiderRobotMan/Gamemode4Engine
233f6b48b85af5da2f536113940a1ca35af09aac
695a5a0c4e66cd50982ba813b6f4348dedac7246
refs/heads/master
2021-01-12T13:54:13.725651
2016-07-04T01:15:45
2016-07-04T01:15:45
54,951,468
2
4
null
2016-07-04T01:15:48
2016-03-29T06:28:31
Java
UTF-8
Java
false
false
9,442
java
package com.spiderrobotman.Gamemode4Engine.command; import com.spiderrobotman.Gamemode4Engine.main.Gamemode4Engine; import com.spiderrobotman.Gamemode4Engine.util.TextUtil; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.OfflinePlayer; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; /** * Project: Gamemode4Engine * Author: SpiderRobotMan * Date: May 17 2016 * Website: http://www.spiderrobotman.com */ public class NickCommand implements CommandExecutor { public static Map<UUID, String> nicks = new ConcurrentHashMap<>(); private static String getFullName(Player p) { String fin = getPrefix(p) + getNickName(p); return fin.replace("&", "§") + ChatColor.RESET; } private static String getNickName(Player p) { String nick = ""; String nick_pre = "~"; if (!Bukkit.getServer().isPrimaryThread()) { nick = Gamemode4Engine.nicks.get().getString(p.getUniqueId().toString()); nick_pre = Gamemode4Engine.config.get().getString("nickname_prefix"); } else { if (nicks.containsKey(p.getUniqueId())) { nick = nicks.get(p.getUniqueId()); } } if (nick != null && !nick.isEmpty() && !nick.equalsIgnoreCase(p.getName())) { nicks.put(p.getUniqueId(), nick); return (nick_pre + nick).replace("&", "§"); } else { return p.getName(); } } public static void loadNickNameFromUUID(UUID uuid) { if (!Bukkit.getServer().isPrimaryThread()) { String nick = Gamemode4Engine.nicks.get().getString(uuid.toString()); if (nick != null && !nick.isEmpty()) { nicks.put(uuid, nick); } } } public static void updatePlayerName(Player p) { p.setDisplayName(getFullName(p)); p.setPlayerListName(getFullName(p)); } private static String getPrefix(Player p) { YamlConfiguration cf = Gamemode4Engine.config.get(); String prefix = cf.getString("default_prefix"); if (p.hasPermission("gm4.rank.admin")) { prefix += cf.getString("admin_prefix"); } else if (p.hasPermission("gm4.rank.mod")) { prefix += cf.getString("mod_prefix"); } else if (p.hasPermission("gm4.rank.cmod")) { prefix += cf.getString("cmod_prefix"); } if (p.hasPermission("gm4.rank.patreon")) { prefix += cf.getString("patreon_prefix"); } return prefix.replace("&", "§"); } private static List<String> getPossiblePlayerNames(Player exclude) { List<String> names = new ArrayList<>(); for (org.bukkit.World world : Bukkit.getServer().getWorlds()) { String worldname = world.getName(); File playersFolder = new File(worldname + "/playerdata/"); String[] arr = playersFolder.list((f, s) -> s.endsWith(".dat")); for (String a : arr) { UUID uuid = UUID.fromString(a.replaceAll(".dat$", "")); if (!uuid.equals(exclude.getUniqueId())) { OfflinePlayer p = Bukkit.getOfflinePlayer(uuid); if (p != null) { names.add(p.getName()); String nick1 = nicks.get(p.getUniqueId()); if (nick1 != null) { String nick = ChatColor.stripColor(nick1.replace("&", "§")); if (!nick.isEmpty()) names.add(nick); } } } } } return names; } private static boolean nameMatch(String name, Player exclude) { name = ChatColor.stripColor(name.replace("&", "§")).replace("§", ""); int length = name.length(); for (String pn : getPossiblePlayerNames(exclude)) { if (name.toLowerCase().contains(pn.toLowerCase())) { int diff = length - pn.length(); if (!(diff >= 5) || !(diff <= -5)) { return true; } } } return false; } @Override public boolean onCommand(CommandSender cs, Command command, String alias, String[] args) { if (cs instanceof Player) { Player sender = (Player) cs; if (sender.isOp() || sender.hasPermission("gm4.nickname")) { if (args.length <= 0) { TextUtil.sendCommandFormatError(sender, "/" + alias + " <nick [-reset]> [<player>]"); return true; } Gamemode4Engine.plugin().getServer().getScheduler().runTaskAsynchronously(Gamemode4Engine.plugin(), () -> { boolean cont = true; Player target = null; if (args.length >= 1) { String test = ChatColor.stripColor(args[0].toLowerCase().replace("&", "§")).replace("§", ""); int color_count = args[0].length() - test.length(); int length = args[0].length() - color_count; boolean match = false; if (length < 0) length = 0; if (args.length == 1 && nameMatch(args[0], sender)) match = true; if (args.length == 2) { target = Bukkit.getPlayerExact(args[1]); if (target != null && nameMatch(args[0], target)) match = true; } if (!args[0].matches("\\A\\p{ASCII}*\\z")) { sender.sendMessage(ChatColor.RED + "A nickname can only contain ASCII characters!"); cont = false; } else if (length > 15) { sender.sendMessage(ChatColor.RED + "A nickname can only be 15 visible characters long! Yours is " + length + "."); cont = false; } else if (length < 3) { sender.sendMessage(ChatColor.RED + "A nickname must have atleast 3 visible characters! Yours has " + length + "."); cont = false; } else if (!args[0].equalsIgnoreCase("-reset") && match) { sender.sendMessage(ChatColor.RED + "This nickname is too similar to another player!"); cont = false; } } if (cont) { if (args.length == 1) { setNickName(sender, args[0]); } if (args.length == 2) { if (args[1].equalsIgnoreCase(sender.getName())) { setNickName(sender, args[0]); } else if (sender.hasPermission("gm4.nickname.others")) { if (target != null) { setNickName(target, args[0]); if (!target.hasPermission("gm4.nickname.color")) { sender.sendMessage(ChatColor.GREEN + "Their nickname has been set to: " + ChatColor.RESET + ChatColor.stripColor(args[0].replace("&", "§")).replace("§", "")); } else { sender.sendMessage(ChatColor.GREEN + "Their nickname has been set to: " + ChatColor.RESET + args[0].replace("&", "§")); } } else { sender.sendMessage(ChatColor.RED + "Player " + ChatColor.GOLD + args[1] + ChatColor.RED + " not found!"); } } else { sender.sendMessage(ChatColor.RED + "You don't have permission to give others nicknames!"); } } } }); } } return true; } private void setNickName(Player p, String nickname) { if (!nickname.equalsIgnoreCase("-reset")) { String nick = nickname.replace("&", "§"); if (!p.hasPermission("gm4.nickname.color")) { nick = ChatColor.stripColor(nick).replace("§", ""); } nick = nick.replace("§", "&"); Gamemode4Engine.nicks.get().set(p.getUniqueId().toString(), nick); nicks.put(p.getUniqueId(), nick); p.sendMessage(ChatColor.GREEN + "Your nickname has been set to: " + ChatColor.RESET + nick.replace("&", "§")); } else { Gamemode4Engine.nicks.get().set(p.getUniqueId().toString(), ""); nicks.put(p.getUniqueId(), ""); p.sendMessage(ChatColor.GREEN + "Your nickname has been reset to: " + ChatColor.RESET + p.getName()); } Gamemode4Engine.nicks.save(); updatePlayerName(p); } }
1acd8a576e26166abbed48085cd5891e7efb2cbf
b7936f9a99afb096bc6d68448c32631d7416e177
/build/tmp/recompileMc/sources/net/minecraft/command/CommandTime.java
c6f55b8e1db287fa3de154e4e2e6f7ede4b90401
[]
no_license
AlphaWolf21/JATMA
ff786893893879d1f158a549659bbf13a5e0763c
93cf49cca9e23fa1660099999b2b46ce26fb3bbb
refs/heads/master
2021-01-19T02:43:34.989869
2016-11-07T04:06:16
2016-11-07T04:06:16
73,483,501
2
0
null
2016-11-11T14:20:06
2016-11-11T14:20:05
null
UTF-8
Java
false
false
4,326
java
package net.minecraft.command; import java.util.Collections; import java.util.List; import javax.annotation.Nullable; import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; import net.minecraft.world.WorldServer; public class CommandTime extends CommandBase { /** * Gets the name of the command */ public String getCommandName() { return "time"; } /** * Return the required permission level for this command. */ public int getRequiredPermissionLevel() { return 2; } /** * Gets the usage string for the command. */ public String getCommandUsage(ICommandSender sender) { return "commands.time.usage"; } /** * Callback for when the command is executed */ public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (args.length > 1) { if ("set".equals(args[0])) { int i1; if ("day".equals(args[1])) { i1 = 1000; } else if ("night".equals(args[1])) { i1 = 13000; } else { i1 = parseInt(args[1], 0); } this.setAllWorldTimes(server, i1); notifyCommandListener(sender, this, "commands.time.set", new Object[] {Integer.valueOf(i1)}); return; } if ("add".equals(args[0])) { int l = parseInt(args[1], 0); this.incrementAllWorldTimes(server, l); notifyCommandListener(sender, this, "commands.time.added", new Object[] {Integer.valueOf(l)}); return; } if ("query".equals(args[0])) { if ("daytime".equals(args[1])) { int k = (int)(sender.getEntityWorld().getWorldTime() % 24000L); sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, k); notifyCommandListener(sender, this, "commands.time.query", new Object[] {Integer.valueOf(k)}); return; } if ("day".equals(args[1])) { int j = (int)(sender.getEntityWorld().getWorldTime() / 24000L % 2147483647L); sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, j); notifyCommandListener(sender, this, "commands.time.query", new Object[] {Integer.valueOf(j)}); return; } if ("gametime".equals(args[1])) { int i = (int)(sender.getEntityWorld().getTotalWorldTime() % 2147483647L); sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, i); notifyCommandListener(sender, this, "commands.time.query", new Object[] {Integer.valueOf(i)}); return; } } } throw new WrongUsageException("commands.time.usage", new Object[0]); } public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos) { return args.length == 1 ? getListOfStringsMatchingLastWord(args, new String[] {"set", "add", "query"}): (args.length == 2 && "set".equals(args[0]) ? getListOfStringsMatchingLastWord(args, new String[] {"day", "night"}): (args.length == 2 && "query".equals(args[0]) ? getListOfStringsMatchingLastWord(args, new String[] {"daytime", "gametime", "day"}): Collections.<String>emptyList())); } protected void setAllWorldTimes(MinecraftServer server, int time) { for (int i = 0; i < server.worldServers.length; ++i) { server.worldServers[i].setWorldTime((long)time); } } protected void incrementAllWorldTimes(MinecraftServer server, int amount) { for (int i = 0; i < server.worldServers.length; ++i) { WorldServer worldserver = server.worldServers[i]; worldserver.setWorldTime(worldserver.getWorldTime() + (long)amount); } } }
77f5cd099117bd4a225caac0976d42c852c9d9f1
431c8f6b34deab0fcb0f55c8551e21e694b4ec3c
/qywx_ms/src/com/grgbanking/core/entity/workorder/WsSjTypeOptionsBean.java
f38e9c7e312d41adf587a4ecbc93dbf01c823046
[]
no_license
beclever/qywx_ms
763a07c9fcdcbaea1256acfc2b7a62b0625a0681
98aa893b21bb9972bd37bbf7765f11fec125e0fc
refs/heads/master
2016-08-11T21:54:56.708501
2016-03-29T09:15:20
2016-03-29T09:15:20
54,962,390
0
4
null
null
null
null
UTF-8
Java
false
false
815
java
package com.grgbanking.core.entity.workorder; //巡检类型选项信息 public class WsSjTypeOptionsBean { private WsOptionsBean firstType;// 第一个选项 N 数据结构(Y),详见5.1.21 private WsOptionsBean secondType;// 第二个选项 Y 数据结构(Y),详见5.1.21构详见5.1.21 private String explain;// 说明 Y String(N) public WsOptionsBean getFirstType() { return firstType; } public void setFirstType(WsOptionsBean firstType) { this.firstType = firstType; } public WsOptionsBean getSecondType() { return secondType; } public void setSecondType(WsOptionsBean secondType) { this.secondType = secondType; } public String getExplain() { return explain; } public void setExplain(String explain) { this.explain = explain; } }
c49cc7a994a36fda585de952c9c1489571bc3338
51de9cded5c0c7cf4d231a69bb5e9e1d6b075e49
/src/main/java/aplikasi/service/ServiceBarang.java
4e08c86966f89c057635e6e2733eea3441f089e2
[]
no_license
dhanggas/tugas_PBO
c11c86a0c34c841631c21a1f7795354f48ea2fe0
9c7599883b0e40bc00067ba0bcaae350c97af107
refs/heads/master
2020-03-16T08:51:51.145970
2018-05-08T12:36:27
2018-05-08T12:36:27
132,603,806
0
0
null
null
null
null
UTF-8
Java
false
false
6,141
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 aplikasi.service; import aplikasi.entity.Barang; import aplikasi.entity.KategoriBarang; import aplikasi.repository.RepoBarang; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import javax.sql.DataSource; /** * * @author dimmaryanto */ public class ServiceBarang implements RepoBarang { private DataSource ds; public ServiceBarang(DataSource ds) { this.ds = ds; } @Override public Barang save(Barang b) throws SQLException { String sql = "INSERT INTO barang (kode, id_kategori, nama, harga_jual, harga_beli, paket)\n" + "VALUES (?,?,?,?,?,?)"; KategoriBarang kb = b.getKategori(); List<Barang> listBarangByKategori = findByKategoriKode(kb.getKode()); b.setKode(kb.getKode() + String.format("%02d", listBarangByKategori.size() + 1)); Connection connect = ds.getConnection(); PreparedStatement ps = connect.prepareStatement(sql); ps.setString(1, b.getKode()); ps.setInt(2, kb.getId()); ps.setString(3, b.getNama()); ps.setDouble(4, b.getHargaJual()); ps.setDouble(5, b.getHargaBeli()); ps.setBoolean(6, b.getPaket()); ps.executeUpdate(); ps.close(); connect.close(); return b; } @Override public Barang update(Barang b) throws SQLException { String sql = "UPDATE barang SET id_kategori = ?, nama = ?, harga_jual = ?, harga_beli = ?, paket = ? WHERE kode = ?"; Connection connect = ds.getConnection(); PreparedStatement ps = connect.prepareStatement(sql); ps.setInt(1, b.getKategori().getId()); ps.setString(2, b.getNama()); ps.setDouble(3, b.getHargaJual()); ps.setDouble(4, b.getHargaBeli()); ps.setBoolean(5, b.getPaket()); ps.setString(6, b.getKode()); ps.executeUpdate(); ps.close(); connect.close(); return b; } @Override public List<Barang> findAll() throws SQLException { String sql = "SELECT * FROM v_barang"; List<Barang> list = new ArrayList<>(); Connection connect = ds.getConnection(); Statement st = connect.createStatement(); ResultSet rs = st.executeQuery(sql); while (rs.next()) { Barang brg = new Barang(); brg.setKode(rs.getString("kode_barang")); brg.setNama(rs.getString("nama_barang")); brg.setHargaJual(rs.getDouble("harga_jual_barang")); brg.setHargaBeli(rs.getDouble("harga_beli_barang")); brg.setJumlah(rs.getInt("stok_barang")); brg.setPaket(rs.getBoolean("barang_paketan")); KategoriBarang k = new KategoriBarang(); k.setId(rs.getInt("id_kategori")); k.setKode(rs.getString("kode_kategori")); k.setNama(rs.getString("nama_kategori_barang")); brg.setKategori(k); list.add(brg); } st.close(); rs.close(); connect.close(); return list; } @Override public Barang findOne(String id) throws SQLException { String sql = "SELECT * FROM v_barang WHERE kode_barang = ?"; Connection connect = ds.getConnection(); PreparedStatement ps = connect.prepareStatement(sql); ps.setString(1, id); ResultSet rs = ps.executeQuery(); Barang brg = null; if (rs.next()) { brg = new Barang(); brg.setKode(rs.getString("kode_barang")); brg.setNama(rs.getString("nama_barang")); brg.setHargaJual(rs.getDouble("harga_jual_barang")); brg.setHargaBeli(rs.getDouble("harga_beli_barang")); brg.setJumlah(rs.getInt("stok_barang")); brg.setPaket(rs.getBoolean("barang_paketan")); KategoriBarang k = new KategoriBarang(); k.setId(rs.getInt("id_kategori")); k.setKode(rs.getString("kode_kategori")); k.setNama(rs.getString("nama_kategori_barang")); brg.setKategori(k); } ps.close(); rs.close(); connect.close(); return brg; } @Override public Boolean exists(String id) throws SQLException { return findOne(id) != null; } @Override public void delete(String id) throws SQLException { String sql = "DELETE FROM barang WHERE kode = ?"; Connection connect = ds.getConnection(); PreparedStatement ps = connect.prepareStatement(sql); ps.setString(1, id); ps.executeUpdate(); ps.close(); connect.close(); } @Override public List<Barang> findByKategoriKode(String kode) throws SQLException { String sql = "SELECT * FROM v_barang WHERE kode_kategori = ?"; List<Barang> list = new ArrayList<>(); Connection connect = ds.getConnection(); PreparedStatement ps = connect.prepareStatement(sql); ps.setString(1, kode); ResultSet rs = ps.executeQuery(); while (rs.next()) { Barang brg = new Barang(); brg.setKode(rs.getString("kode_barang")); brg.setNama(rs.getString("nama_barang")); brg.setHargaJual(rs.getDouble("harga_jual_barang")); brg.setHargaBeli(rs.getDouble("harga_beli_barang")); brg.setJumlah(rs.getInt("stok_barang")); brg.setPaket(rs.getBoolean("barang_paketan")); KategoriBarang k = new KategoriBarang(); k.setId(rs.getInt("id_kategori")); k.setKode(rs.getString("kode_kategori")); k.setNama(rs.getString("nama_kategori_barang")); brg.setKategori(k); list.add(brg); } ps.close(); rs.close(); connect.close(); return list; } }
30743d3788d7bfa991880b93a9f408ada85a0998
35b81561e4e568da279426f55f0471d312cc21c3
/android/app/src/main/java/com/firetactoe/generated/BasePackageList.java
c28cc4007b84057644e67bee05cb632a0bc27473
[]
no_license
srianbury/fire-tac-toe
dfa6b5ee8012baeca9324cc1c16e95f9c3e982cf
b213263751245fc365cda0517ee2a4a205ca4b69
refs/heads/master
2022-12-09T09:46:26.470673
2020-09-14T03:17:36
2020-09-14T03:17:36
295,285,399
0
0
null
null
null
null
UTF-8
Java
false
false
929
java
package com.firetactoe.generated; import java.util.Arrays; import java.util.List; import org.unimodules.core.interfaces.Package; public class BasePackageList { public List<Package> getPackageList() { return Arrays.<Package>asList( new expo.modules.constants.ConstantsPackage(), new expo.modules.errorrecovery.ErrorRecoveryPackage(), new expo.modules.filesystem.FileSystemPackage(), new expo.modules.font.FontLoaderPackage(), new expo.modules.imageloader.ImageLoaderPackage(), new expo.modules.keepawake.KeepAwakePackage(), new expo.modules.lineargradient.LinearGradientPackage(), new expo.modules.location.LocationPackage(), new expo.modules.permissions.PermissionsPackage(), new expo.modules.splashscreen.SplashScreenPackage(), new expo.modules.sqlite.SQLitePackage(), new expo.modules.updates.UpdatesPackage() ); } }
2dd604ef261e29f011acd39075477db0353c9f57
87cb582539377c162ca3cd2d38d15740293f0966
/spring-web/src/main/java/org/springframework/web/context/support/AnnotationConfigWebApplicationContext.java
dbb437cba6c68b23524db45ab90327049d05e2a2
[ "Apache-2.0" ]
permissive
TACHAI/study_spring_source
37723b9d63c303063f4cb72f28dd36984f96593b
ca59f2e922aaebe0de4fd5dea112dbe6daa5bfe9
refs/heads/master
2022-11-07T15:39:02.557035
2020-06-17T13:08:17
2020-06-17T13:08:17
272,933,657
0
0
null
null
null
null
UTF-8
Java
false
false
12,790
java
/* * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.web.context.support; import java.util.Collections; import java.util.LinkedHashSet; import java.util.Set; import org.springframework.beans.factory.support.BeanNameGenerator; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.context.annotation.AnnotatedBeanDefinitionReader; import org.springframework.context.annotation.AnnotationConfigRegistry; import org.springframework.context.annotation.AnnotationConfigUtils; import org.springframework.context.annotation.ClassPathBeanDefinitionScanner; import org.springframework.context.annotation.ScopeMetadataResolver; import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; import org.springframework.web.context.ContextLoader; /** * {@link org.springframework.web.context.WebApplicationContext WebApplicationContext} * implementation which accepts annotated classes as input - in particular * {@link org.springframework.context.annotation.Configuration @Configuration}-annotated * classes, but also plain {@link org.springframework.stereotype.Component @Component} * classes and JSR-330 compliant classes using {@code javax.inject} annotations. Allows * for registering classes one by one (specifying class names as config location) as well * as for classpath scanning (specifying base packages as config location). * * <p>This is essentially the equivalent of * {@link org.springframework.context.annotation.AnnotationConfigApplicationContext * AnnotationConfigApplicationContext} for a web environment. * * <p>To make use of this application context, the * {@linkplain ContextLoader#CONTEXT_CLASS_PARAM "contextClass"} context-param for * ContextLoader and/or "contextClass" init-param for FrameworkServlet must be set to * the fully-qualified name of this class. * * <p>As of Spring 3.1, this class may also be directly instantiated and injected into * Spring's {@code DispatcherServlet} or {@code ContextLoaderListener} when using the * new {@link org.springframework.web.WebApplicationInitializer WebApplicationInitializer} * code-based alternative to {@code web.xml}. See its Javadoc for details and usage examples. * * <p>Unlike {@link XmlWebApplicationContext}, no default configuration class locations * are assumed. Rather, it is a requirement to set the * {@linkplain ContextLoader#CONFIG_LOCATION_PARAM "contextConfigLocation"} * context-param for {@link ContextLoader} and/or "contextConfigLocation" init-param for * FrameworkServlet. The param-value may contain both fully-qualified * class names and base packages to scan for components. See {@link #loadBeanDefinitions} * for exact details on how these locations are processed. * * <p>As an alternative to setting the "contextConfigLocation" parameter, users may * implement an {@link org.springframework.context.ApplicationContextInitializer * ApplicationContextInitializer} and set the * {@linkplain ContextLoader#CONTEXT_INITIALIZER_CLASSES_PARAM "contextInitializerClasses"} * context-param / init-param. In such cases, users should favor the {@link #refresh()} * and {@link #scan(String...)} methods over the {@link #setConfigLocation(String)} * method, which is primarily for use by {@code ContextLoader}. * * <p>Note: In case of multiple {@code @Configuration} classes, later {@code @Bean} * definitions will override ones defined in earlier loaded files. This can be leveraged * to deliberately override certain bean definitions via an extra Configuration class. * * @author Chris Beams * @author Juergen Hoeller * @since 3.0 * @see org.springframework.context.annotation.AnnotationConfigApplicationContext */ public class AnnotationConfigWebApplicationContext extends AbstractRefreshableWebApplicationContext implements AnnotationConfigRegistry { @Nullable private BeanNameGenerator beanNameGenerator; @Nullable private ScopeMetadataResolver scopeMetadataResolver; private final Set<Class<?>> annotatedClasses = new LinkedHashSet<>(); private final Set<String> basePackages = new LinkedHashSet<>(); /** * Set a custom {@link BeanNameGenerator} for use with {@link AnnotatedBeanDefinitionReader} * and/or {@link ClassPathBeanDefinitionScanner}. * <p>Default is {@link org.springframework.context.annotation.AnnotationBeanNameGenerator}. * @see AnnotatedBeanDefinitionReader#setBeanNameGenerator * @see ClassPathBeanDefinitionScanner#setBeanNameGenerator */ public void setBeanNameGenerator(@Nullable BeanNameGenerator beanNameGenerator) { this.beanNameGenerator = beanNameGenerator; } /** * Return the custom {@link BeanNameGenerator} for use with {@link AnnotatedBeanDefinitionReader} * and/or {@link ClassPathBeanDefinitionScanner}, if any. */ @Nullable protected BeanNameGenerator getBeanNameGenerator() { return this.beanNameGenerator; } /** * Set a custom {@link ScopeMetadataResolver} for use with {@link AnnotatedBeanDefinitionReader} * and/or {@link ClassPathBeanDefinitionScanner}. * <p>Default is an {@link org.springframework.context.annotation.AnnotationScopeMetadataResolver}. * @see AnnotatedBeanDefinitionReader#setScopeMetadataResolver * @see ClassPathBeanDefinitionScanner#setScopeMetadataResolver */ public void setScopeMetadataResolver(@Nullable ScopeMetadataResolver scopeMetadataResolver) { this.scopeMetadataResolver = scopeMetadataResolver; } /** * Return the custom {@link ScopeMetadataResolver} for use with {@link AnnotatedBeanDefinitionReader} * and/or {@link ClassPathBeanDefinitionScanner}, if any. */ @Nullable protected ScopeMetadataResolver getScopeMetadataResolver() { return this.scopeMetadataResolver; } /** * Register one or more annotated classes to be processed. * <p>Note that {@link #refresh()} must be called in order for the context * to fully process the new classes. * @param annotatedClasses one or more annotated classes, * e.g. {@link org.springframework.context.annotation.Configuration @Configuration} classes * @see #scan(String...) * @see #loadBeanDefinitions(DefaultListableBeanFactory) * @see #setConfigLocation(String) * @see #refresh() */ public void register(Class<?>... annotatedClasses) { Assert.notEmpty(annotatedClasses, "At least one annotated class must be specified"); Collections.addAll(this.annotatedClasses, annotatedClasses); } /** * Perform a scan within the specified base packages. * <p>Note that {@link #refresh()} must be called in order for the context * to fully process the new classes. * @param basePackages the packages to check for annotated classes * @see #loadBeanDefinitions(DefaultListableBeanFactory) * @see #register(Class...) * @see #setConfigLocation(String) * @see #refresh() */ public void scan(String... basePackages) { Assert.notEmpty(basePackages, "At least one base package must be specified"); Collections.addAll(this.basePackages, basePackages); } /** * Register a {@link org.springframework.beans.factory.config.BeanDefinition} for * any classes specified by {@link #register(Class...)} and scan any packages * specified by {@link #scan(String...)}. * <p>For any values specified by {@link #setConfigLocation(String)} or * {@link #setConfigLocations(String[])}, attempt first to load each location as a * class, registering a {@code BeanDefinition} if class loading is successful, * and if class loading fails (i.e. a {@code ClassNotFoundException} is raised), * assume the value is a package and attempt to scan it for annotated classes. * <p>Enables the default set of annotation configuration post processors, such that * {@code @Autowired}, {@code @Required}, and associated annotations can be used. * <p>Configuration class bean definitions are registered with generated bean * definition names unless the {@code value} attribute is provided to the stereotype * annotation. * @param beanFactory the bean factory to load bean definitions into * @see #register(Class...) * @see #scan(String...) * @see #setConfigLocation(String) * @see #setConfigLocations(String[]) * @see AnnotatedBeanDefinitionReader * @see ClassPathBeanDefinitionScanner */ @Override protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) { AnnotatedBeanDefinitionReader reader = getAnnotatedBeanDefinitionReader(beanFactory); ClassPathBeanDefinitionScanner scanner = getClassPathBeanDefinitionScanner(beanFactory); BeanNameGenerator beanNameGenerator = getBeanNameGenerator(); if (beanNameGenerator != null) { reader.setBeanNameGenerator(beanNameGenerator); scanner.setBeanNameGenerator(beanNameGenerator); beanFactory.registerSingleton(AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR, beanNameGenerator); } ScopeMetadataResolver scopeMetadataResolver = getScopeMetadataResolver(); if (scopeMetadataResolver != null) { reader.setScopeMetadataResolver(scopeMetadataResolver); scanner.setScopeMetadataResolver(scopeMetadataResolver); } if (!this.annotatedClasses.isEmpty()) { if (logger.isInfoEnabled()) { logger.info("Registering annotated classes: [" + StringUtils.collectionToCommaDelimitedString(this.annotatedClasses) + "]"); } reader.register(ClassUtils.toClassArray(this.annotatedClasses)); } if (!this.basePackages.isEmpty()) { if (logger.isInfoEnabled()) { logger.info("Scanning base packages: [" + StringUtils.collectionToCommaDelimitedString(this.basePackages) + "]"); } scanner.scan(StringUtils.toStringArray(this.basePackages)); } String[] configLocations = getConfigLocations(); if (configLocations != null) { for (String configLocation : configLocations) { try { Class<?> clazz = ClassUtils.forName(configLocation, getClassLoader()); if (logger.isInfoEnabled()) { logger.info("Successfully resolved class for [" + configLocation + "]"); } reader.register(clazz); } catch (ClassNotFoundException ex) { if (logger.isDebugEnabled()) { logger.debug("Could not load class for config location [" + configLocation + "] - trying package scan. " + ex); } int count = scanner.scan(configLocation); if (logger.isInfoEnabled()) { if (count == 0) { logger.info("No annotated classes found for specified class/package [" + configLocation + "]"); } else { logger.info("Found " + count + " annotated classes in package [" + configLocation + "]"); } } } } } } /** * Build an {@link AnnotatedBeanDefinitionReader} for the given bean factory. * <p>This should be pre-configured with the {@code Environment} (if desired) * but not with a {@code BeanNameGenerator} or {@code ScopeMetadataResolver} yet. * @param beanFactory the bean factory to load bean definitions into * @since 4.1.9 * @see #getEnvironment() * @see #getBeanNameGenerator() * @see #getScopeMetadataResolver() */ protected AnnotatedBeanDefinitionReader getAnnotatedBeanDefinitionReader(DefaultListableBeanFactory beanFactory) { return new AnnotatedBeanDefinitionReader(beanFactory, getEnvironment()); } /** * Build a {@link ClassPathBeanDefinitionScanner} for the given bean factory. * <p>This should be pre-configured with the {@code Environment} (if desired) * but not with a {@code BeanNameGenerator} or {@code ScopeMetadataResolver} yet. * @param beanFactory the bean factory to load bean definitions into * @since 4.1.9 * @see #getEnvironment() * @see #getBeanNameGenerator() * @see #getScopeMetadataResolver() */ protected ClassPathBeanDefinitionScanner getClassPathBeanDefinitionScanner(DefaultListableBeanFactory beanFactory) { return new ClassPathBeanDefinitionScanner(beanFactory, true, getEnvironment()); } }
27dc1258e5021840216025089cbcf0dbfc774d23
b0c8ace9e7d75445aba26266211adeadd5415d0f
/src/main/java/com/glv/org/controller/CarController.java
be47d6a678850fdc046535894b673ebe37500c34
[]
no_license
seifeldinne/GestionLocationVoiture
18ea2f5ef78f67d7e34abb1ceee28e7e0baba8a3
fc3dbada49ed2b4a2f5ea9d4db720768489237ff
refs/heads/master
2020-07-02T08:58:24.723724
2019-08-10T11:54:25
2019-08-10T11:54:25
201,478,893
0
0
null
null
null
null
UTF-8
Java
false
false
1,650
java
package com.glv.org.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.glv.org.entite.Car; import com.glv.org.service.ICarService; @RestController @CrossOrigin(origins = "http://localhost:4200") @RequestMapping(value = "/car") public class CarController { @Autowired private ICarService Carservice; @PostMapping("save-Car") public boolean saveCar(@RequestBody Car Car) { return Carservice.saveCar(Car); } @GetMapping("Cars-list") public List<Car> allCars() { return Carservice.getCars(); } @DeleteMapping("delete-Car/{Car_id}") public boolean deleteCar(@PathVariable("Car_id") Long Car_id, Car Car) { Car.setIdCar(Car_id); return Carservice.deleteCar(Car); } @GetMapping("Car/{Car_id}") public List<Car> allCarByID(@PathVariable("Car_id") Long Car_id, Car Car) { Car.setIdCar(Car_id); return Carservice.getCarByID(Car); } @PostMapping("update-Car/{Car_id}") public boolean updateCar(@RequestBody Car Car, @PathVariable("Car_id") Long Car_id) { Car.setIdCar(Car_id); return Carservice.updateCar(Car); } }
0d7072273c284e8bf352d2f4121e90b27cfb50e9
99db6b2f7a5067f5c2eefa658df838cabec2ca5d
/blelib/src/main/java/com/czjk/blelib/model/BleDevice.java
70301b8c8b18d08a28ae2a8ed6f9f52841911f5c
[]
no_license
zhourenjun/BleLib
c8e133ddb458bfa1675638d3f4bb704e43f877f7
e6853edd1216e194a157d739f8c7dccf263cb792
refs/heads/master
2021-06-11T12:19:07.379917
2016-12-02T10:06:04
2016-12-02T10:06:04
75,375,641
0
1
null
null
null
null
UTF-8
Java
false
false
1,631
java
package com.czjk.blelib.model; import android.bluetooth.BluetoothDevice; import android.os.Parcel; import android.os.Parcelable; /** * 设备实体 */ public class BleDevice implements Parcelable { private final BluetoothDevice mDevice; private final byte[] mScanRecord; private int mCurrentRssi; public BleDevice(final BluetoothDevice device, final int rssi, final byte[] scanRecord) { mDevice = device; mCurrentRssi = rssi; mScanRecord = scanRecord; } public String getAddress() { return mDevice.getAddress(); } public BluetoothDevice getDevice() { return mDevice; } public String getName() { return mDevice.getName(); } public int getRssi() { return mCurrentRssi; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeParcelable(this.mDevice, flags); dest.writeByteArray(this.mScanRecord); dest.writeInt(this.mCurrentRssi); } protected BleDevice(Parcel in) { this.mDevice = in.readParcelable(BluetoothDevice.class.getClassLoader()); this.mScanRecord = in.createByteArray(); this.mCurrentRssi = in.readInt(); } public static final Creator<BleDevice> CREATOR = new Creator<BleDevice>() { @Override public BleDevice createFromParcel(Parcel source) { return new BleDevice(source); } @Override public BleDevice[] newArray(int size) { return new BleDevice[size]; } }; }
f4ad0f2b3ddcf3c671b6319412e1892488025b02
4044dada17fbdf243098e4318a91d941b11839d6
/barracksWars/data/UnitRepository.java
31b165d68323b3e9f708cee260e638d3d6886ded
[]
no_license
Chris-Mk/Reflection-and-Annotation
0eafea37daf4a889542dc595e6a3597060e75cad
494ab48bcc37b23c759baf24473e61c09963799d
refs/heads/master
2020-06-25T10:04:17.677245
2019-07-28T11:37:57
2019-07-28T11:37:57
199,279,548
0
0
null
null
null
null
UTF-8
Java
false
false
1,420
java
package barracksWars.data; import barracksWars.interfaces.Repository; import barracksWars.interfaces.Unit; import java.util.Map; import java.util.TreeMap; public class UnitRepository implements Repository { private Map<String, Integer> amountOfUnits; public UnitRepository() { this.amountOfUnits = new TreeMap<>(); } public void addUnit(Unit unit) { String unitType = unit.getClass().getSimpleName(); if (!this.amountOfUnits.containsKey(unitType)) { this.amountOfUnits.put(unitType, 0); } int newAmount = this.amountOfUnits.get(unitType) + 1; this.amountOfUnits.put(unitType, newAmount); } public String getStatistics() { StringBuilder statBuilder = new StringBuilder(); for (Map.Entry<String, Integer> entry : amountOfUnits.entrySet()) { String formatedEntry = String.format("%s -> %d%n", entry.getKey(), entry.getValue()); statBuilder.append(formatedEntry); } statBuilder.setLength( statBuilder.length() - System.lineSeparator().length()); return statBuilder.toString(); } public void removeUnit(String unitType) { if (!this.amountOfUnits.containsKey(unitType) || this.amountOfUnits.get(unitType) == 0) { throw new IllegalArgumentException("No such units in repository."); } int count = this.amountOfUnits.get(unitType) - 1; if (count == -1) { this.amountOfUnits.remove(unitType); } else { this.amountOfUnits.put(unitType, count); } } }
c9fa2dd0fa9301c982d1c431291ff84bbdad5a1f
dbc68bee3c9400712414e07c639efde4f38f47e9
/src/main/java/com/wxy/service/IService.java
d2398d3412fef59c93cf3324c6fb19d0c8cf4a43
[]
no_license
benmo0116/weread
69d9b7f48ecbb5f87f07e22f7b0184c9ca639a5d
b91a88db731be126661d41abeb440e1ad55d6a71
refs/heads/master
2021-01-25T11:20:18.234830
2018-03-05T11:01:30
2018-03-05T11:01:30
123,375,759
0
1
null
2018-03-01T04:39:43
2018-03-01T03:16:45
null
UTF-8
Java
false
false
407
java
package com.wxy.service; import com.wxy.model.User; import java.util.List; /** * @author wxy * @create 2018-01-12 10:27 * @desc ${DESCRIPTION} **/ public interface IService<T> { List<T> findAll(int pageNum, int pageSize); int insertOne(T t); int deleteOneByPrimaryKey(Integer userid); int updateOne(T t); T selectOneByPrimaryKey(Integer userid); boolean exist(int id); }
6e31c71e0c28b45c2d2eca41de3fb3b5262c8657
40155deb7a4bdbdfa38b389c37c2efd160b7c91a
/webapp-template/src/main/java/com/uc/web/service/CodeService.java
fd26bfdbb5188b5cf47797245fab01d68a7d6b40
[]
no_license
guohong365/webapp-template
ff8ffd23d0c989e5f8e21464f2c38b792ef70f9d
4bfbfcbfac7e1d2155467867ac1f1722a04b20db
refs/heads/master
2021-01-10T10:57:44.743154
2017-05-02T17:27:21
2017-05-02T17:27:21
53,136,254
0
0
null
null
null
null
UTF-8
Java
false
false
208
java
package com.uc.web.service; import com.uc.web.domain.system.CodeDetail; import com.uc.web.forms.system.CodeQueryForm; public interface CodeService extends AppService<CodeQueryForm, CodeDetail> { }
ffd28f92289fee224aff372405a2329df567c3c9
449f1655d0b243ec6a57d0fbcf4fd6bd323e5fd3
/app/src/main/java/com/example/crisis/pruebamapaubicacion/loginVr2.java
ceef2c5633672845259368417354808a6c9b2924
[]
no_license
Crisis12/x_vrUrban03
bc211c76da9305270fe4db0e2680a8ca1e0c50ed
4b7752443889cbb387e4eea128ebbbffc6aa3b27
refs/heads/master
2021-01-13T14:56:34.511877
2016-12-16T19:07:31
2016-12-16T19:07:31
76,678,257
0
0
null
null
null
null
UTF-8
Java
false
false
1,560
java
package com.example.crisis.pruebamapaubicacion; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.MotionEvent; import android.view.View; import android.widget.AutoCompleteTextView; import android.widget.FrameLayout; import android.widget.ImageButton; public class loginVr2 extends AppCompatActivity { private FrameLayout layoutUrb; private AutoCompleteTextView cel; private ImageButton siguiente; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login_vr2); layoutUrb=(FrameLayout)findViewById(R.id.layoutUrban); cel=(AutoCompleteTextView)findViewById(R.id.tvcel); cel.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { v.setFocusable(true); v.setFocusableInTouchMode(true); layoutUrb.setVisibility(View.GONE); return false; } }); siguiente=(ImageButton)findViewById(R.id.btnSig); siguiente.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String celS= cel.getText().toString(); Intent intent; intent = new Intent(loginVr2.this,LoginBienvenida.class); intent.putExtra("celular", celS); } }); } }
8f724db27d63a9d6b908b9828de7804ba66aeca4
f3f9a636376e4a0cf381adf1e68bc559a6311a03
/src/main/java/at/ac/tuwien/sepm/musicplayer/layerCommunication/entity/info/InfoOwner.java
564506735fda1b7616282a1ce9e1ea1127934814
[]
no_license
salmir/bTunes
c4ee9df172d552378aceb8e0afc0ef492a55b897
99ef70a086f7298ff5c9dd9e02afa893b5a7fbbd
refs/heads/master
2021-01-10T03:55:22.203087
2015-12-17T12:55:30
2015-12-17T12:55:30
48,174,114
0
0
null
null
null
null
UTF-8
Java
false
false
865
java
package at.ac.tuwien.sepm.musicplayer.layerCommunication.entity.info; import at.ac.tuwien.sepm.musicplayer.layerCommunication.entity.Entity; import at.ac.tuwien.sepm.musicplayer.layerCommunication.entity.type.EntityType; import at.ac.tuwien.sepm.musicplayer.layerCommunication.entity.type.InfoType; import at.ac.tuwien.sepm.musicplayer.layerCommunication.entity.type.OwnerType; /** * Created by Lena Lenz. * * An InfoOwner is an owner of Infos * */ public interface InfoOwner extends Entity{ public OwnerType<? extends InfoOwner> getOwnerType(); public void set(Info info); public <B extends Info> B get(InfoType<B> toGet); public <B extends Info> boolean has(InfoType<B> infoType); public void remove(InfoType toGet); @Override public default EntityType<? extends Entity> getEntityType(){ return getOwnerType(); } }
6d3cc9cda16584a84fdbf29332824b6027914ed7
6e39449e9c287f21124d421595f0174402de11e4
/Session8/src/StringAPIs.java
d8c883a2d2485e9e3d643be7d30f58251dcf64d9
[]
no_license
ishantk/AuriJavaAug19
32b57a229153073bb19c6149c5295bcf38a33113
f19da5c62d0ddad0eb245250d7b03b41116cb52c
refs/heads/master
2020-06-29T19:36:51.807157
2019-09-24T10:10:15
2019-09-24T10:10:15
200,605,481
2
0
null
null
null
null
UTF-8
Java
false
false
2,194
java
public class StringAPIs { public static void main(String[] args) { // Interned Way String s1 = "Hello"; String s2 = "Hello"; // Object Way String s3 = new String("Hello"); String s4 = new String("Hello"); if(s1 == s2){ System.out.println(">> s1 == s2"); }else{ System.out.println(">> s1 != s2"); } if(s3 == s4){ System.out.println(">> s3 == s4"); }else{ System.out.println(">> s3 != s4"); } if(s1.equals(s2)){ System.out.println(">> s1 equals s2"); }else{ System.out.println(">> s1 not equals s2"); } if(s3.equals(s4)){ System.out.println(">> s3 equals s4"); }else{ System.out.println(">> s3 not equals s4"); } String email = "[email protected]"; String password = "john123"; if(email.equals("[email protected]") && password.equals("john123")){ System.out.println(">> Email ands Password are Correct"); }else{ System.out.println(">> Incorrect Email or Password"); } String names = "John, Jennie, Jim, Jack, Joe"; System.out.println(">> names is: "+names); System.out.println(">> names length is: "+names.length()); // 28 System.out.println(">> Character at 3 is: "+names.charAt(3)); // n System.out.println("char is: "+names.charAt(names.length()-1)); // e // Strings are IMMUTABLE // Manipulation on Strings ill give a new String and old will not be changed String newNames = names.toUpperCase(); System.out.println(">> names now is: "+names); System.out.println(">> newNames is: "+newNames); String subName = names.substring(3, 7); // start from 3 less than 7 i.e. till 6 System.out.println(">> subName is: "+subName); String toSearch = "oe"; System.out.println(toSearch+" found "+names.contains(toSearch)); System.out.println(toSearch+" found from beginning "+names.startsWith(toSearch)); System.out.println(toSearch+" found from ending "+names.endsWith(toSearch)); String[] allNames = names.split(","); for(int i=0;i<allNames.length;i++){ System.out.println(">> "+allNames[i].trim()); // trim removes sapce from front and end } // PS : Explore more String APIs (Application Programming Interfaces - Built In Codes) } }
bd8fa6de31de06d9637cf4e3d497d533f03a1363
026d9354091c2a62e0308b8ebbcd18f81c59dfb9
/app/src/main/java/com/arushiappdev/socialapp/SignupActivity.java
d5b3f6bb60aedddeecf2edf8c9243e744a0181a4
[]
no_license
arushinarayan/LoginApp
21f0503df7d9b78a6354eba3cdaf0a5f00a0becd
98c6b7d6bf8b2c7a2ebbd4de9d44ab7644830e27
refs/heads/master
2023-01-05T17:25:35.500423
2020-11-06T06:59:44
2020-11-06T06:59:44
310,516,793
0
0
null
null
null
null
UTF-8
Java
false
false
5,292
java
package com.arushiappdev.socialapp; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.firestore.DocumentReference; import com.google.firebase.firestore.FirebaseFirestore; import java.util.HashMap; import java.util.Map; public class SignupActivity extends AppCompatActivity { public static final String TAG = "TAG"; EditText emailid, pwd, name, age, ph; Button btnsignup; TextView logintext; ProgressBar progb; FirebaseAuth mFireAuth; FirebaseFirestore fstore; String userID; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_signup); emailid= findViewById(R.id.signupemailtext); pwd= findViewById(R.id.signuppasswordtext); name= findViewById(R.id.signupnametext); age= findViewById(R.id.signupagetext); ph= findViewById(R.id.signupnumtext); btnsignup= findViewById(R.id.signupbtn); logintext= findViewById(R.id.signuplogintext); progb= findViewById(R.id.progbar); mFireAuth= FirebaseAuth.getInstance(); fstore= FirebaseFirestore.getInstance(); btnsignup.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final String email= emailid.getText().toString(); String pswd= pwd.getText().toString().trim(); final String nm= name.getText().toString(); final String ag= age.getText().toString(); final String phonenum= ph.getText().toString(); if (TextUtils.isEmpty(pswd)){ pwd.setError("Password is required"); return; } if (pswd.length() <6){ pwd.setError("Password should be 6 or more characters"); return; } if (TextUtils.isEmpty(nm)){ name.setError("Name is required"); return; } if (TextUtils.isEmpty(ag)){ age.setError("Age is required"); return; } if (TextUtils.isEmpty(phonenum)){ ph.setError("Phone number is required"); return; } if (phonenum.length() != 10){ ph.setError("Phone number is invalid"); return; } if (TextUtils.isEmpty(email)){ emailid.setError("Email is required"); return; } progb.setVisibility(View.VISIBLE); //Register user Firebase mFireAuth.createUserWithEmailAndPassword(email, pswd).addOnCompleteListener(new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()){ Toast.makeText(SignupActivity.this, "User Registered Successfully", Toast.LENGTH_SHORT).show(); userID=mFireAuth.getCurrentUser().getUid(); DocumentReference documentReference= fstore.collection("users").document(userID); Map<String,Object> user= new HashMap<>(); user.put("Name", nm); user.put("Email", email); user.put("Phone Number", phonenum); user.put("Age", ag); documentReference.set(user).addOnSuccessListener(new OnSuccessListener<Void>() { @Override public void onSuccess(Void aVoid) { Log.d(TAG, "User profile is created for "+ userID); } }); startActivity(new Intent(getApplicationContext(), HomeActivity.class)); }else { Toast.makeText(SignupActivity.this, "Error!" + task.getException().getMessage(), Toast.LENGTH_SHORT).show(); progb.setVisibility(View.GONE); } } }); } }); logintext.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(getApplicationContext(), MainActivity.class)); } }); } }
136440c92f8db5b3aed1e1b954f347494a01c013
3a6edcae97e660be37f6c7be6eda252f1269df23
/mylibrary/src/main/java/com/xiaolu/mylibrary/log/BaseLog.java
d4d58015d4271c169675b05917eb6b6226c4ec69
[]
no_license
xiaolu3550/MyLibraryTool
0a07f25b5546d591a7bdb3015e9c94d12ac7e556
b8d81d23697d14e22db74aea99f07e8470fe4880
refs/heads/master
2021-09-16T23:39:26.703978
2021-09-16T01:52:14
2021-09-16T01:52:14
246,189,894
2
0
null
null
null
null
UTF-8
Java
false
false
1,749
java
package com.xiaolu.mylibrary.log; import android.util.Log; /** * ================================================ * * @ProjectName: MyLibraryTool * @Package: com.xiaolu.mylibrary.log * @ClassName: BaseLog * @Description: java类作用描述 * @Author: xiaol * @CreateDate: 2021/1/16 17:22 * @UpdateUser: xiaol * @UpdateDate: 2021/1/16 17:22 * @UpdateRemark: 更新说明 * @Version: 1.0 * ================================================ */ public class BaseLog { private static final int MAX_LENGTH = 4000; public static void printDefault(int type, String tag, String msg) { int index = 0; int length = msg.length(); int countOfSub = length / MAX_LENGTH; if (countOfSub > 0) { for (int i = 0; i < countOfSub; i++) { String sub = msg.substring(index, index + MAX_LENGTH); printSub(type, tag, sub); index += MAX_LENGTH; } printSub(type, tag, msg.substring(index, length)); } else { printSub(type, tag, msg); } } private static void printSub(int type, String tag, String sub) { switch (type) { case LogUtil.V: Log.v(tag, sub); break; case LogUtil.D: Log.d(tag, sub); break; case LogUtil.I: Log.i(tag, sub); break; case LogUtil.W: Log.w(tag, sub); break; case LogUtil.E: Log.e(tag, sub); break; case LogUtil.A: Log.wtf(tag, sub); break; default: break; } } }
a0d6ab200df400b1156c87d00d2057cf260b3c16
553d2ae5680d895f08fece1976359feaf7ddbd94
/app/src/main/java/com/aprido/cintabogor/object/Banner.java
536129d9e0e31629190ed3da73d37932af246719
[]
no_license
ksandyasa/cintabogor-android
0315169ee15745edae993c08d5f0534f5a9e6384
b8a8b4278acc1a0de82a525d95af716e484f056a
refs/heads/master
2021-01-23T14:14:40.129286
2017-09-07T02:09:50
2017-09-07T02:09:50
102,679,678
0
0
null
null
null
null
UTF-8
Java
false
false
783
java
package com.aprido.cintabogor.object; /** * Created by apridosandyasa on 6/29/17. */ public class Banner { private String name; private String picture; private String link; public Banner() { } public Banner(String name, String picture, String link) { this.name = name; this.picture = picture; this.link = link; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPicture() { return picture; } public void setPicture(String picture) { this.picture = picture; } public String getLink() { return link; } public void setLink(String link) { this.link = link; } }
ae08e31a5bbd053be5fd4979e0ea8fde12fa3121
6bebf2f8257da6729ca67ee0cefc2bfae8ba5d3c
/PVenta/src/Controlador/Permisos/PermisoV.java
6ebceeab30860e1e97e6ad2cf7d462c7815063bd
[]
no_license
landrygears3/Pieles
c0bb0ba8c3af5387cde8636265e27da3ee3f8dcf
3b2cbbe88df427052d11b73987d3745bf1af8aa8
refs/heads/master
2020-03-19T06:53:40.519048
2018-08-25T21:34:13
2018-08-25T21:34:13
136,039,648
0
0
null
null
null
null
UTF-8
Java
false
false
1,547
java
package Controlador.Permisos; import Modelo.Conexion; import java.sql.ResultSet; import java.util.ArrayList; public class PermisoV { Conexion c = new Conexion(); Object o[][] = null; public boolean respn(String t, String t2, String t3) { ResultSet r = c.getConsulta(t, "*", ""); ArrayList<ArrayList> arr = new ArrayList<ArrayList>(); try { while (r.next()) { ResultSet r3 = c.getConsulta(t3, "*", "where ID_Empleado = " + r.getString(2)); ResultSet r2 = c.getConsulta(t2, "*", "where ID_TipoPermiso = " + r.getString(3)); while (r2.next() && r3.next()) { arr.add(new ArrayList()); arr.get(arr.size() - 1).add(r.getString(1)); arr.get(arr.size() - 1).add(r3.getString(2)); arr.get(arr.size() - 1).add(r2.getString(2)); arr.get(arr.size() - 1).add(r.getString(4)); arr.get(arr.size() - 1).add(r.getString(5)); } } } catch (Exception e) { } o = new Object[arr.size()][5]; for (int i = 0; i < arr.size(); i++) { for (int j = 0; j < arr.get(i).size(); j++) { o[i][j] = arr.get(i).get(j); } } if (o.length != 0) { return true; } else { return false; } } public Object[][] getDatos() { return o; } }
a66b718adb6508efb131766ec091a8d6b01870e8
f95c160dab6b089e0b0947037df96bb84f16370b
/src/main/java/com/cinema/equipment/exceptions/ApplicationError.java
b11e30c0bfcb89f762e9ab9d66e0cb383741dc1b
[]
no_license
slyns/equipment-list
52e8ff58dc39bba7a88dc6b249bf22aa4d2072b8
34dac096e8acbb28fb486a43e9c4fc3a256b1317
refs/heads/master
2021-01-19T19:22:51.547573
2017-03-08T21:10:25
2017-03-08T21:10:25
83,724,957
0
0
null
null
null
null
UTF-8
Java
false
false
306
java
package com.cinema.equipment.exceptions; /** * @author slyns * @version 3/7/17. */ public class ApplicationError extends RuntimeException { public ApplicationError(Exception cause) { super(cause); } public ApplicationError(String message, Exception cause) { super(message, cause); } }
1746a544149db03a1f81cb18c196d07be47a03b5
4f9f10ff3d630c9257b740446cad51719b9d7436
/src/com/xxx/VariableTest.java
6f04ccfd9771da2cbf355ab17003ea4baaefa310
[]
no_license
LiZhecheng/JavaTest
6e951da81be08ba74430314b644324bbd0a995f9
8455af116d3a367f197f5ed365bf0ccd531d5575
refs/heads/master
2020-04-04T13:29:44.354064
2018-11-03T08:18:13
2018-11-03T08:18:13
155,963,638
0
0
null
null
null
null
UTF-8
Java
false
false
470
java
package com.xxx; public class VariableTest { public static void main(String[] args) { // TODO Auto-generated method stub int i1 = 1; int i2 = 2; int i3 = 3; // int i1,i2,i3; //上面因為資料型態相同可以改成這樣 int i4,i5,i6 = 6; //只有i6有值 i4 = 5; i4 = 6; //i4的值會被改成6 int i7 = 7,i8 = 8; //也可以這樣宣告 final int i9 = 5; // i9 = 6; //final不可在改其值 } }
[ "Java@DESKTOP-TQ00GH9" ]
Java@DESKTOP-TQ00GH9
9291e2c1f6c1b13263c66876c5fae907380e3600
e03c0539dba90987c8f27a02167d663ce5f42f46
/src/main/java/org/khmeracademy/akd/configuration/security/RESTAuthenticationEntryPoint.java
12e30583396f6a98df7566d8eefbb039ae0bae05
[]
no_license
AKDDevelopers/KD_AKD_API_V1.1
2d81e4ab005a669522bc9c5ce783b9dc215db4bc
21cb9cecb3384fb2640bb73a33cd07cb100116af
refs/heads/master
2021-01-13T04:05:27.273284
2017-12-25T03:59:21
2017-12-25T03:59:21
77,417,486
0
0
null
null
null
null
UTF-8
Java
false
false
773
java
package org.khmeracademy.akd.configuration.security; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.stereotype.Component; @Component("RESTAuthenticationEntryPoint") public class RESTAuthenticationEntryPoint implements AuthenticationEntryPoint{ @Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { response.getWriter().write("MESSAGE==>" + authException.getMessage()); } }
679b8488f612719b100bcc1615cdf262a0479cd5
5aed5db296f731ace7f28eddb4e3ee09be9e7cf1
/app/src/main/java/com/example/newsapp/activity/MainActivity.java
267db86d4594ab6d7493bcedb27f0df87b173d04
[]
no_license
tufailsher/news-app
e0d5a833f6c4a800271be462bd8eff83d154b379
0c18d08332d6e031c46fd00c8ac609293ebbb59a
refs/heads/master
2023-01-19T15:19:31.960920
2020-11-19T09:51:53
2020-11-19T09:51:53
314,203,729
1
0
null
null
null
null
UTF-8
Java
false
false
2,644
java
package com.example.newsapp.activity; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import android.view.View; import com.example.newsapp.R; import com.example.newsapp.adapter.MainDatumAdapter; import com.example.newsapp.model.Datum; import com.example.newsapp.model.Example; import com.example.newsapp.model.Example; import com.example.newsapp.rests.APIInterface; import com.example.newsapp.rests.ApiClient; import com.example.newsapp.utils.OnReclerViewItemClickListener; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class MainActivity extends AppCompatActivity implements OnReclerViewItemClickListener { private Call<Example> call; // private static final String API_KEY = "b0b1e8e13a1d4089ba2bf142ade2fb21"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final RecyclerView mainRecycler = findViewById(R.id.activity_main_rv); final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager .VERTICAL,false); mainRecycler.setLayoutManager(linearLayoutManager); final APIInterface apiService = ApiClient.getClient().create(APIInterface.class); Call<Example> call = apiService.getLatestNews(); call.enqueue(new Callback<Example>() { @Override public void onResponse(Call<Example> call, Response<Example> response) { // if (response.body().getCjobTitle().equals("ok")) { List<Datum> articleList = response.body().getData(); if (articleList.size() > 0) { final MainDatumAdapter mainDatumAdapter = new MainDatumAdapter(articleList); mainDatumAdapter.setOnRecyclerViewItemClickListener(MainActivity.this); mainRecycler.setAdapter(mainDatumAdapter); } } @Override public void onFailure(Call<Example> call, Throwable t) { Log.e("out", t.toString()); } }); } @Override public void onItemClick(int position, View view) { switch (view.getId()) { case R.id.article_adapter_ll_parent: break; } } }
72ef758adb9dd4a2bf5acfe490aec653e97ebbc5
5180ad2c72feaf9370f7679b5830961d63ca908d
/src/test.java
7f7bf6589c9203f0160327f6f2690cad458ed9f7
[]
no_license
JeffGilles/Tracking
474b36dfe89ae2a9f0b5ed9a2782c55ad2028222
6fc7ce0fbda76abbd1fe9c3b9e068c6763a96f67
refs/heads/master
2020-03-09T11:09:10.078888
2018-05-04T16:35:09
2018-05-04T16:35:09
128,754,243
0
0
null
null
null
null
UTF-8
Java
false
false
568
java
import ij.ImageJ; import java.io.File; /** * Cette classe permet de lancer ImageJ en utilisant le répertoire où a été créée * la distribution courante du greffon en tant que répertoire "plugins" par défaut. * @author fab */ public class test { /** * @param args the command line arguments */ public static void main(String[] args) { System.getProperties().setProperty("plugins.dir", System.getProperty("user.dir")+File.separator+"dist"+File.separator); ImageJ ij=new ImageJ(); ij.exitWhenQuitting(true); } }
d5c57ff0acf25e26e47e0354b0739f77b8213c05
3113f371d6856018c5df776c1feadbe7ed9d7ebe
/autoMATE_server/test/com/automate/server/messaging/handlers/MessageHandlerSuite.java
fbe68557ac4a74d9a7a1d55d5da58e4321bdc761
[]
no_license
jhbertra/autoMATE_server
e3eb93d977cecc4c12f2e371cb832c97c21e9b81
f0a5eab942227011b2dbb1ece3f32284d2e89212
refs/heads/master
2016-09-05T20:31:34.592157
2014-04-08T13:05:58
2014-04-08T13:05:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
707
java
package com.automate.server.messaging.handlers; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; @RunWith(Suite.class) @SuiteClasses(value = { AuthenticationMessageHandlerTest.class, ClientCommandMessageHandlerTest.class, ClientStatusUpdateMessageHandlerTest.class, ClientToNodeMessageHandlerTest.class, ClientWarningMessageHandlerTest.class, NodeCommandMessageHandlerTest.class, NodeListMessageHandlerTest.class, NodeStatusUpdateMessageHandlerTest.class, NodeToClientMessageHandlerTest.class, NodeWarningMessageHandlerTest.class, PingMessageHandlerTest.class}) public class MessageHandlerSuite { }
17adf805276d044250e92b51b24b4ae0058c69b2
d8aecd76d8b9128b8599f2ce3e9ecdc44448836c
/Programacion/src/main/java/Reto/VUResultado.java
4d2ef864a52fcbbb8fb963836c5665a545861d68
[ "Apache-2.0" ]
permissive
Ekaitzdam/grupo4-dam
d9fef64b21a4d5c9edcdebcc67235ff6656b8adc
2741fcee4e7f5739b0d8073befe14bb6a7346e67
refs/heads/master
2020-03-13T08:46:43.084275
2018-05-22T18:12:54
2018-05-22T18:12:54
131,050,493
0
1
null
2018-04-25T18:53:48
2018-04-25T18:53:47
null
UTF-8
Java
false
false
803
java
package Reto; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class VUResultado { private JPanel VUResultado; private JButton salirButton; private JTable tabla; public VUResultado() { JFrame frame = new JFrame("VUResultado"); frame.setContentPane(VUResultado); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); tabla.setModel(new TablaClasificacionModel()); salirButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { frame.dispose(); } }); } }
02e29dcf32a089f0bcad6ee7488001928aab7c00
d31e0b420a6681524f00c607475fbf5c6063158c
/src/main/java/gov/hhs/acf/cb/nytd/service/impl/InterRptPdCheckServiceImpl.java
b748dc87732f4c21e569e01fdca30353e58e48e7
[]
no_license
MichaelKilleenSandbox/nytd-incremental
5dd5b851e91b2be8822f4455aeae4abf6bb8c64f
517f57420af7452d123d92f2d78d7b31d8f6f944
refs/heads/master
2023-07-18T23:47:15.871204
2021-08-27T20:32:07
2021-08-27T20:32:07
400,630,077
0
0
null
null
null
null
UTF-8
Java
false
false
27,718
java
package gov.hhs.acf.cb.nytd.service.impl; import gov.hhs.acf.cb.nytd.dao.*; import gov.hhs.acf.cb.nytd.models.*; import gov.hhs.acf.cb.nytd.models.helper.FileAdvisoryAcrossReportPeriodId; import gov.hhs.acf.cb.nytd.models.helper.FileAdvisoryAcrossReportPeriods; import gov.hhs.acf.cb.nytd.models.helper.FileComparisonAcrossReportPeriods; import gov.hhs.acf.cb.nytd.service.DataExtractionService; import gov.hhs.acf.cb.nytd.service.InterRptPdCheckService; import gov.hhs.acf.cb.nytd.util.Constants; import gov.hhs.acf.cb.nytd.util.InterRptPdCheckText; import org.springframework.transaction.annotation.Transactional; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; /** * Implements InterRptPdCheckService * @author Adam Russell (18816) * @see InterRptPdCheckService */ @Transactional public class InterRptPdCheckServiceImpl extends BaseServiceImpl implements InterRptPdCheckService { private final RecordForFileComparisonAcrossReportPeriodDAO recordForFileComparisonAcrossReportPeriodDAO; private final TransmissionDAO transmissionDAO; private final SubmissionDAO submissionDAO; private final TransmissionRecordDAO transmissionRecordDAO; private final FullRecordDAO fullRecordDAO; private final ReportingPeriodDAO reportingPeriodDAO; private final ElementDAO elementDAO; private final DataExtractionService dataExtractionService; private final String genericProblemDescriptionTemplate; public InterRptPdCheckServiceImpl(RecordForFileComparisonAcrossReportPeriodDAO recordForFileComparisonAcrossReportPeriodDAO, TransmissionDAO transmissionDAO, SubmissionDAO submissionDAO, TransmissionRecordDAO transmissionRecordDAO, FullRecordDAO fullRecordDAO, ReportingPeriodDAO reportingPeriodDAO, ElementDAO elementDAO, DataExtractionService dataExtractionService) { super(); this.recordForFileComparisonAcrossReportPeriodDAO = recordForFileComparisonAcrossReportPeriodDAO; this.transmissionDAO = transmissionDAO; this.submissionDAO = submissionDAO; this.transmissionRecordDAO = transmissionRecordDAO; this.fullRecordDAO = fullRecordDAO; this.reportingPeriodDAO = reportingPeriodDAO; this.elementDAO = elementDAO; this.dataExtractionService = dataExtractionService; this.genericProblemDescriptionTemplate = InterRptPdCheckText.GENERIC; } /** * @author Adam Russell (18816) * @see InterRptPdCheckService#getTransmissionWithId(Long) */ @Override public Transmission getTransmissionWithId(Long id) { return transmissionDAO.getTransmissionWithId(id); } /** * @author Adam Russell (18816) * @see InterRptPdCheckService#getCommonCrossReportPeriodAdvisoriesForYouth(RecordToExport, RecordToExport) */ @Override public Collection<FileAdvisoryAcrossReportPeriods> getCommonCrossReportPeriodAdvisoriesForYouth( RecordToExport currentRecord, RecordToExport previousRecord) { assert(currentRecord != null); assert(previousRecord != null); Set<FileAdvisoryAcrossReportPeriods> resultSet = new HashSet<FileAdvisoryAcrossReportPeriods>(); // For data of birth (element 4), note any change. if (currentRecord.getE4() == null || (currentRecord.getE4() != null && !currentRecord.getE4().equals(previousRecord.getE4()))) { addAdvisoryToSet(resultSet, previousRecord, "4", currentRecord.getE4(), previousRecord.getE4()); } // For sex (element 5), note a change from male to female or female to male. if (previousRecord.getE5() != null && currentRecord.getE5() != null && ((previousRecord.getE5().equals("male") && currentRecord.getE5().equals("female")) || (previousRecord.getE5().equals("female") && currentRecord.getE5().equals("male")))) { addAdvisoryToSet(resultSet, previousRecord, "5", currentRecord.getE5(), previousRecord.getE5()); } // For race (elements 6-11), note a change from no to yes or yes to no. // Changes to and from blank are always allowed for race, since it is acceptable to decline at any point. String[] elements = {"6", "7", "8", "9", "10", "11"}; for (String element : Arrays.asList(elements)) { if (previousRecord.getElementValue(element) != null && currentRecord.getElementValue(element) != null && ((previousRecord.getElementValue(element).equals("yes") && currentRecord.getElementValue(element).equals("no")) || (previousRecord.getElementValue(element).equals("no") && currentRecord.getElementValue(element).equals("yes")))) { addAdvisoryToSet(resultSet, previousRecord, element, currentRecord.getElementValue(element), previousRecord.getElementValue(element)); } } // For Hispanic or Latino Ethnicity (element 13), note these changes: // // + No -> Yes // + No -> Unknown // + Yes -> No // + Yes -> Unknown if (previousRecord.getE13() != null && currentRecord.getE13() != null && ((previousRecord.getE13().equals("no") && currentRecord.getE13().equals("yes")) || (previousRecord.getE13().equals("no") && currentRecord.getE13().equals("unknown")) || (previousRecord.getE13().equals("yes") && currentRecord.getE13().equals("no")) || (previousRecord.getE13().equals("yes") && currentRecord.getE13().equals("unknown")))) { addAdvisoryToSet(resultSet, previousRecord, "13", currentRecord.getE13(), previousRecord.getE13()); } return resultSet; } /** * @author Adam Russell (18816) * @see InterRptPdCheckService#getCrossReportPeriodAdvisoriesForServedYouth(RecordToExport, State) */ @Override public Collection<FileAdvisoryAcrossReportPeriods> getCrossReportPeriodAdvisoriesForServedYouth( RecordToExport record, State state) { /*assert(record != null); assert(record.getTransmissionRecord().getServedPopulation() != null); Set<FileAdvisoryAcrossReportPeriods> resultSet = new HashSet<FileAdvisoryAcrossReportPeriods>(); TransmissionRecord previousTransmissionRecord = transmissionRecordDAO.getPreviousRecordForServedYouth( record.getTransmissionRecord(), state); RecordToExport previousRecord = fullRecordDAO.getFullRecord(previousTransmissionRecord); if (previousRecord == null) { return resultSet; } // Get advisories related to common elements. resultSet.addAll(getCommonCrossReportPeriodAdvisoriesForYouth(record, previousRecord)); // For Federally-Recognized Tribe (element 16), note any change. if ((record.getE16() == null && previousRecord.getE16() != null) || (record.getE16() != null && !record.getE16().equals(previousRecord.getE16()))) { addAdvisoryToSet(resultSet, previousRecord, "16", record.getE16(), previousRecord.getE16()); } // For Adjudicated Delinquent (element 17), note any change. if ((record.getE17() == null && previousRecord.getE17() != null) || (record.getE17() != null && !record.getE17().equals(previousRecord.getE17()))) { addAdvisoryToSet(resultSet, previousRecord, "17", record.getE17(), previousRecord.getE17()); } // For Education Level (element 18), note any decrease. Map<String, Integer> educationLevelValues = new HashMap<String, Integer>(10); Integer currentEducationLevel; Integer previousEducationLevel; educationLevelValues.put("under 6", 1); educationLevelValues.put("6", 2); educationLevelValues.put("7", 3); educationLevelValues.put("8", 4); educationLevelValues.put("9", 5); educationLevelValues.put("10", 6); educationLevelValues.put("11", 7); educationLevelValues.put("12", 8); educationLevelValues.put("post secondary", 9); educationLevelValues.put("college", 10); currentEducationLevel = educationLevelValues.get(record.getE18()); previousEducationLevel = educationLevelValues.get(previousRecord.getE18()); if (!(currentEducationLevel == null && previousEducationLevel == null) && ((currentEducationLevel == null && previousEducationLevel != null) || (currentEducationLevel != null && previousEducationLevel == null) || (currentEducationLevel.compareTo(previousEducationLevel) < 0))) { addAdvisoryToSet(resultSet, previousRecord, "18", record.getE18(), previousRecord.getE18()); } return resultSet;*/ return null; } /** * @author Adam Russell (18816) * @see InterRptPdCheckService#getCrossReportPeriodAdvisoriesForBaselineYouth(RecordToExport, ReportingPeriod, State) */ @Override public Collection<FileAdvisoryAcrossReportPeriods> getCrossReportPeriodAdvisoriesForBaselineYouth( RecordToExport record, ReportingPeriod reportPeriod, State state) { /* assert(record != null); assert(reportPeriod != null); assert(record.getTransmissionRecord().getOutcomePopulation() != null); assert(record.getTransmissionRecord().getOutcomePopulation().getName().equalsIgnoreCase("Baseline")); Set<FileAdvisoryAcrossReportPeriods> resultSet = new HashSet<FileAdvisoryAcrossReportPeriods>(); RecordToExport nextRecord; boolean birthdayInBaselineBuffer = false; // If birthday categorizes youth as potential pre buffer, // check the ensuing report period for a post buffer record. try { birthdayInBaselineBuffer = isBirthdayInBaselineBuffer(record, record.getTransmission().getReportingPeriod()); } catch (ParseException e) { birthdayInBaselineBuffer = true; } if (birthdayInBaselineBuffer) { nextRecord = fullRecordDAO.getFullRecord(transmissionRecordDAO.getPostBufferRecordForBaselineYouth( record.getTransmissionRecord(), reportPeriod, state)); if (nextRecord != null) { String recordNumber = nextRecord.getE3RecordNumber(); String problemDescription = InterRptPdCheckText.PRE_TO_POSTBUFFER_BASELINE_DUPLICATE; problemDescription = String.format(problemDescription, recordNumber, nextRecord.getReportingPeriod()); FileAdvisoryAcrossReportPeriods advisory = new FileAdvisoryAcrossReportPeriods(); advisory.setRecordNumber(recordNumber); advisory.setReportPeriodName(nextRecord.getReportingPeriod()); advisory.setTransmissionId(nextRecord.getTransmission().getId().toString()); advisory.setElementName("N/A"); advisory.setProblemDescription(problemDescription); resultSet.add(advisory); } } return resultSet; */ return null; } /** * @author Adam Russell (18816) * @see InterRptPdCheckService#getCrossReportPeriodAdvisoriesForPreBufferBaselineYouth(TransmissionRecord, Transmission) */ @Override public Collection<FileAdvisoryAcrossReportPeriods> getCrossReportPeriodAdvisoriesForPreBufferBaselineYouth( TransmissionRecord transmissionRecord, Transmission nextTransmission) { /* assert(transmissionRecord != null); assert(nextTransmission != null); assert(transmissionRecord.getOutcomePopulation() != null); assert(transmissionRecord.getOutcomePopulation().getName().equalsIgnoreCase("Pre-buffer")); Set<FileAdvisoryAcrossReportPeriods> resultSet = new HashSet<FileAdvisoryAcrossReportPeriods>(); RecordToExport preBufferRecord = fullRecordDAO.getFullRecord(transmissionRecord); TransmissionRecord postBufferTransmissionRecord = transmissionRecordDAO .getPostBufferRecordForPreBufferYouth(transmissionRecord, nextTransmission); if (postBufferTransmissionRecord == null) { String recordNumber = preBufferRecord.getE3RecordNumber(); String problemDescription = InterRptPdCheckText.MISSING_POSTBUFFER; problemDescription = String.format(problemDescription, recordNumber, preBufferRecord.getReportingPeriod()); FileAdvisoryAcrossReportPeriods advisory = new FileAdvisoryAcrossReportPeriods(); advisory.setRecordNumber(recordNumber); advisory.setReportPeriodName(preBufferRecord.getReportingPeriod()); advisory.setTransmissionId(preBufferRecord.getTransmission().getId().toString()); advisory.setElementName("N/A"); advisory.setProblemDescription(problemDescription); resultSet.add(advisory); } return resultSet;*/ return null; } /** * @author Adam Russell (18816) * @see InterRptPdCheckService#getCrossReportPeriodAdvisoriesForPostBufferBaselineYouth(RecordToExport, ReportingPeriod, State) */ @Override public Collection<FileAdvisoryAcrossReportPeriods> getCrossReportPeriodAdvisoriesForPostBufferBaselineYouth( RecordToExport record, ReportingPeriod reportPeriod, State state) { /*assert(record != null); assert(reportPeriod != null); assert(record.getTransmissionRecord().getOutcomePopulation() != null); assert(record.getTransmissionRecord().getOutcomePopulation().getName().equalsIgnoreCase("Post-buffer")); Set<FileAdvisoryAcrossReportPeriods> resultSet = new HashSet<FileAdvisoryAcrossReportPeriods>(); TransmissionRecord previousTransmissionRecord = transmissionRecordDAO .getPreviousRecordForPostBufferYouthComparison(record.getTransmissionRecord(), reportPeriod, state); RecordToExport previousRecord = fullRecordDAO.getFullRecord(previousTransmissionRecord); try { if (!isBirthdayInReportPeriod(record, reportPeriod)) { String recordNumber = record.getE3RecordNumber(); String problemDescription = InterRptPdCheckText.UNTIMELY_BUFFER; problemDescription = String.format(problemDescription, recordNumber, reportPeriod.getName()); FileAdvisoryAcrossReportPeriods advisory = new FileAdvisoryAcrossReportPeriods(); advisory.setRecordNumber(recordNumber); advisory.setReportPeriodName(reportPeriod.getName()); if (previousRecord != null) { advisory.setTransmissionId(previousRecord.getTransmission().getId().toString()); } else { String fileNumber = submissionDAO.getSubmissionFileNumberOfReportPeriod(state, reportPeriod); advisory.setTransmissionId(fileNumber); } advisory.setElementName("N/A"); advisory.setProblemDescription(problemDescription); resultSet.add(advisory); } } catch (ParseException e) { log.error(e.getMessage()); } return resultSet;*/ return null; } /** * @author Adam Russell (18816) * @see InterRptPdCheckService#getCrossReportPeriodAdvisoriesForFollowup19Youth(RecordToExport, ReportingPeriod, State) */ @Override public Collection<FileAdvisoryAcrossReportPeriods> getCrossReportPeriodAdvisoriesForFollowup19Youth( RecordToExport record, ReportingPeriod previousOutcomesReportPeriod, State state) { /*assert(record != null); assert(previousOutcomesReportPeriod != null); assert(record.getTransmissionRecord().getOutcomePopulation() != null); assert(record.getTransmissionRecord().getOutcomePopulation().getName().equalsIgnoreCase("Follow-up 19")); Set<FileAdvisoryAcrossReportPeriods> resultSet = new HashSet<FileAdvisoryAcrossReportPeriods>(); TransmissionRecord previousRecord = transmissionRecordDAO .getBaselineRecordForFollowup19YouthComparison(record.getTransmissionRecord(), previousOutcomesReportPeriod, state); getCrossReportPeriodAdvisoriesForFollowupYouth(record, previousRecord, previousOutcomesReportPeriod, state, resultSet); return resultSet;*/ return null; } /** * @author Adam Russell (18816) * @see InterRptPdCheckService#getCrossReportPeriodAdvisoriesForFollowup21Youth(RecordToExport, ReportingPeriod, State) */ @Override public Collection<FileAdvisoryAcrossReportPeriods> getCrossReportPeriodAdvisoriesForFollowup21Youth( RecordToExport record, ReportingPeriod previousOutcomesReportPeriod, State state) { /*assert (record != null); assert (previousOutcomesReportPeriod != null); assert (record.getTransmissionRecord().getOutcomePopulation() != null); assert (record.getTransmissionRecord().getOutcomePopulation().getName() .equalsIgnoreCase("Follow-up 21")); Set<FileAdvisoryAcrossReportPeriods> resultSet = new HashSet<FileAdvisoryAcrossReportPeriods>(); TransmissionRecord previousRecord = transmissionRecordDAO .getFollowup19RecordForFollowup21YouthComparison(record.getTransmissionRecord(), previousOutcomesReportPeriod, state); getCrossReportPeriodAdvisoriesForFollowupYouth(record, previousRecord, previousOutcomesReportPeriod, state, resultSet); return resultSet;*/ return null; } /** * @author Adam Russell (18816) * @see InterRptPdCheckService#getFileComparisonAcrossReportPeriods(Transmission) */ @Override public FileComparisonAcrossReportPeriods getFileComparisonAcrossReportPeriods(Transmission targetFile) { /*assert(targetFile != null); List<RecordToExport> targetRecords = fullRecordDAO.getFullRecordsForTransmission(targetFile); FileComparisonAcrossReportPeriods fileComparison = new FileComparisonAcrossReportPeriods(); ReportingPeriod currentReportPeriod = targetFile.getReportingPeriod(); ReportingPeriod previousOutcomesReportingPeriod = null; State state = targetFile.getState(); if (currentReportPeriod.getOutcomeAge() != null) { previousOutcomesReportingPeriod = reportingPeriodDAO .getPreviousOutcomesReportingPeriod(currentReportPeriod); } ReportingPeriod precedingReportPeriod = reportingPeriodDAO .getPrecedingReportPeriod(currentReportPeriod); ReportingPeriod ensuingReportPeriod = reportingPeriodDAO.getEnsuingReportPeriod(currentReportPeriod); for (RecordToExport currentRecord : targetRecords) { TransmissionRecord currentTransmissionRecord = currentRecord.getTransmissionRecord(); if (currentTransmissionRecord.getServedPopulation() != null) { fileComparison.addAll(getCrossReportPeriodAdvisoriesForServedYouth(currentRecord, state)); } if (currentTransmissionRecord.getOutcomePopulation() != null) { String populationType = currentTransmissionRecord.getOutcomePopulation().getName(); if (populationType.equalsIgnoreCase("Baseline") && ensuingReportPeriod != null && (targetFile.getTransmissionType().getName().equalsIgnoreCase("Subsequent") || targetFile.getTransmissionType().getName().equalsIgnoreCase("Corrected"))) { fileComparison.addAll(getCrossReportPeriodAdvisoriesForBaselineYouth( currentRecord, ensuingReportPeriod, state)); } else if (populationType.equalsIgnoreCase("Post-buffer") && precedingReportPeriod != null) { fileComparison.addAll(getCrossReportPeriodAdvisoriesForPostBufferBaselineYouth( currentRecord, precedingReportPeriod, state)); } else if (populationType.equalsIgnoreCase("Follow-up 19") && previousOutcomesReportingPeriod != null) { fileComparison.addAll(getCrossReportPeriodAdvisoriesForFollowup19Youth( currentRecord, previousOutcomesReportingPeriod, state)); } else if (populationType.equalsIgnoreCase("Follow-up 21") && previousOutcomesReportingPeriod != null) { fileComparison.addAll(getCrossReportPeriodAdvisoriesForFollowup21Youth( currentRecord, previousOutcomesReportingPeriod, state)); } } } if (precedingReportPeriod != null) { List<TransmissionRecord> previousPreBufferRecords; previousPreBufferRecords = transmissionRecordDAO.getPreviousBufferCaseRecords(precedingReportPeriod, state); for (TransmissionRecord previousPreBufferRecord : previousPreBufferRecords) { fileComparison.addAll(getCrossReportPeriodAdvisoriesForPreBufferBaselineYouth( previousPreBufferRecord, targetFile)); } } return fileComparison;*/ return null; } private boolean isBirthdayInBaselineBuffer(RecordToExport fullRecord, ReportingPeriod reportPeriod) throws ParseException { assert(fullRecord != null); assert(reportPeriod != null); // Determine start and end of buffer period. Calendar bufferEndDate = (Calendar) reportPeriod.getEndReportingDate().clone(); Calendar bufferStartDate = (Calendar) bufferEndDate.clone(); // bufferStartDate is 45 days before bufferEndDate bufferStartDate.add(Calendar.DAY_OF_YEAR, -1 * Constants.BUFFER_PERIOD_LENGTH); // Convert birthday specified in fullRecord DateFormat e4Format = new SimpleDateFormat("yyyy-MM-dd"); assert(fullRecord.getE4() != null); // Baseline youth must have valid birthday! Date birthDate = e4Format.parse(fullRecord.getE4()); Calendar birthday = new GregorianCalendar(); birthday.setTime(birthDate); // Advance age of youth in record 17 years. birthday.add(Calendar.YEAR, 17); // Determine if birthday falls in buffer range. return (birthday.after(bufferStartDate) && birthday.before(bufferEndDate)); } private boolean isBirthdayInReportPeriod(RecordToExport fullRecord, ReportingPeriod reportPeriod) throws ParseException { assert(fullRecord != null); assert(reportPeriod != null); // Determine start and end of report period. Calendar endDate = (Calendar) reportPeriod.getEndReportingDate().clone(); Calendar startDate = (Calendar) reportPeriod.getStartReportingDate().clone(); // Convert birthday specified in fullRecord DateFormat e4Format = new SimpleDateFormat("yyyy-MM-dd"); assert(fullRecord.getE4() != null); // Baseline youth must have valid birthday! Date birthDate = e4Format.parse(fullRecord.getE4()); Calendar birthday = new GregorianCalendar(); birthday.setTime(birthDate); // Advance age of youth in record 17 years. birthday.add(Calendar.YEAR, 17); // Determine if birthday falls in buffer range. return (birthday.after(startDate) && birthday.before(endDate)); } private void getCrossReportPeriodAdvisoriesForFollowupYouth( RecordToExport currentRecord, TransmissionRecord previousTransmissionRecord, ReportingPeriod previousOutcomesReportPeriod, State state, Set<FileAdvisoryAcrossReportPeriods> advisorySet) { assert(currentRecord != null); assert(previousOutcomesReportPeriod != null); RecordToExport previousRecord = fullRecordDAO.getFullRecord(previousTransmissionRecord); if (previousRecord == null) { return; } // Get advisories related to common elements. advisorySet.addAll(getCommonCrossReportPeriodAdvisoriesForYouth( currentRecord, previousRecord)); // For Highest educational certification received (element 46), note any decrease. Map<String, Integer> educationLevelValues = new HashMap<String, Integer>(6); Integer currentEducationLevel; Integer previousEducationLevel; educationLevelValues.put("high school", 1); educationLevelValues.put("vocational certificate", 2); educationLevelValues.put("vocational license", 2); educationLevelValues.put("associate", 4); educationLevelValues.put("bachelor", 5); educationLevelValues.put("higher degree", 6); currentEducationLevel = educationLevelValues.get(currentRecord.getE46()); previousEducationLevel = educationLevelValues.get(previousRecord.getE46()); if (!(currentEducationLevel == null && previousEducationLevel == null) && ((currentEducationLevel == null && previousEducationLevel != null) || (currentEducationLevel != null && previousEducationLevel == null) || (currentEducationLevel.compareTo(previousEducationLevel) < 0))) { addAdvisoryToSet(advisorySet, previousRecord, "46", currentRecord.getE46(), previousRecord.getE46()); } } private void addAdvisoryToSet(Collection<FileAdvisoryAcrossReportPeriods> set, RecordToExport previousRecord, String elementNumber, String currentValue, String previousValue) { assert(previousRecord != null); String recordNumber = previousRecord.getE3RecordNumber(); if (currentValue == null) { currentValue = "blank"; } if (previousValue == null) { previousValue = "blank"; } Element element = elementDAO.getElementByName(elementNumber); String elementDescription = element.getDescription(); String problemDescription = String.format(genericProblemDescriptionTemplate, recordNumber, currentValue, getElementLabel(elementNumber), previousRecord.getReportingPeriod(), previousValue); FileAdvisoryAcrossReportPeriods advisory2 = new FileAdvisoryAcrossReportPeriods(); FileAdvisoryAcrossReportPeriodId advisory = new FileAdvisoryAcrossReportPeriodId(); advisory.setRecordNumber(recordNumber); advisory.setReportPeriodName(previousRecord.getReportingPeriod()); // advisory.setTransmissionId(previousRecord.getTransmission().getId().toString()); advisory.setTransmissionId(previousRecord.getTransId().toString()); advisory.setElementName(elementNumber); advisory2.setId(advisory); advisory2.setElementDescription(elementDescription); advisory2.setProblemDescription(problemDescription); advisory2.setRecordNumber(recordNumber); advisory2.setTransmissionId(previousRecord.getTransId().toString()); //set.add(advisory); set.add(advisory2); } /** * @author Adam Russell (18816) * @see DataExtractionService#getElementLabel(Integer) */ private String getElementLabel(String elementNumber) { // Map<String, String> fields = dataExtractionService.getFields(); // return dataExtractionService.getElementLabel(fields, elementNumber); return dataExtractionService.getElementLabel(elementNumber); } /** * @see InterRptPdCheckService#getFileAdvisoriesAcrossReportPeriods(String) */ @Override public List<FileAdvisoryAcrossReportPeriods> getFileAdvisoriesAcrossReportPeriods( String transmissionId,long siteUserId) { List<FileAdvisoryAcrossReportPeriods> fileAdvisoryList = null; Map<String,String> elementDescriptionMap = new HashMap<String, String>(); FileAdvisoryAcrossReportPeriods fileAdvisory = null; String elementDesc = null; String elementId = null; String probDesc = null; fileAdvisoryList = recordForFileComparisonAcrossReportPeriodDAO.getRecordsForFileComparisonAcrossReportPeriod(Long.valueOf(transmissionId), siteUserId); log.debug("Received records for file comparison. Categorizing them now..."); // get session associated with current thread //Session dbSession = getSessionFactory().getCurrentSession(); //EntityManager em = dbSession.getEntityManagerFactory().createEntityManager(); //StoredProcedureQuery qry = em.createNamedStoredProcedureQuery("spCrossReportPdCompare"); //Query qry = session.getNamedQuery("crossReportPdCompare"); //qry.setParameter(2, Long.parseLong(TransmissionId)); //qry.setParameter(3, siteUserId); System.out.println("Transmission ID: "+transmissionId+"siteUserId: "+siteUserId); long l1 = System.currentTimeMillis(); //fileAdvisoryList = qry.getResultList(); long l2 = System.currentTimeMillis(); System.out.println("*****Time taken for Cross file check across report periods: "+(l2-l1)+" millisecs *****"); Iterator<FileAdvisoryAcrossReportPeriods> fileAdvisoryItr = fileAdvisoryList.iterator(); while(fileAdvisoryItr.hasNext()) { fileAdvisory = fileAdvisoryItr.next(); //elementId = fileAdvisory.getElementName(); elementId = fileAdvisory.getId().getElementName(); System.out.println("elementID: "+elementId); elementDescriptionMap.put("N/A", "N/A"); if(!elementDescriptionMap.containsKey(elementId)) { System.out.println("getting element description for element"+elementId); Element element = elementDAO.getElementByName(elementId); elementDesc = element.getDescription(); elementDescriptionMap.put(elementId, elementDesc); } else { elementDesc = elementDescriptionMap.get(elementId); } fileAdvisory.setElementDescription(elementDesc); probDesc = fileAdvisory.getProblemDescription(); probDesc = String.format(probDesc, fileAdvisory.getId().getRecordNumber(), fileAdvisory.getId().getSelectedValue(), getElementLabel(elementId), fileAdvisory.getId().getReportPeriodName(), fileAdvisory.getId().getTargetValue()); fileAdvisory.setProblemDescription(probDesc); } return fileAdvisoryList; } }
3c79c34086d904e0eda2cd742affa994fa1c0f28
7069d229c97024fddd25fae9c7a9ae17bfa61e6a
/library/common/src/main/java/com/dph/common/security/CodeSecurity.java
f901a364ef2cedba150b9fa633dcede8506a6369
[]
no_license
huatianjiajia/AndroidFireMe
5159ee167257400a4e39feab7406acfb98d63ddd
35f0107beb0519e5e3d0c340c7365a10a0357f08
refs/heads/master
2020-06-19T04:42:24.391931
2017-06-28T03:11:53
2017-06-28T03:11:53
94,177,172
0
0
null
null
null
null
UTF-8
Java
false
false
1,182
java
package com.dph.common.security; /** * 加解密方法的封装类 * Created by Administrator on 2015/12/10 0010. */ public class CodeSecurity { public static final String desEncode(String str){ return DESBase64Util.encodeInfo(str); } public static final String desDecodeInfo(String str){ return DESBase64Util.decodeInfo(str); } /** * AES解码 * @param str * @return */ public static final String aesDecodeInfo(String str){ String result = ""; try { result = AESUtil.Decrypt(str); } catch (Exception e) { e.printStackTrace(); } return result; } /** * AES编码 * @param str * @return */ public static final String aesEncode(String str){ String result = ""; try { result = AESUtil.Encrypt(str); } catch (Exception e) { e.printStackTrace(); } return result; } public static final String myEncode(String str){ return aesEncode(str); } public static final String myDecode(String str){ return aesDecodeInfo(str); } }
e93a2e0b78debea62ecccf550ff74a3dd4e9b2d0
c246f536185d73b5bf2b115c2ab0076a01b89a77
/core/src/main/java/com/carrefour/shopping/paymentmanagement/logic/impl/PaymentmanagementImpl.java
7c141f9d795abfffd89b242a90d8a283af1cec26
[]
no_license
manoj40/test
83e250c67e045e694e3d33d8f1e107de87dfec07
a5ebbfe247ddd6d243c2a17096cf82ab84e7df2d
refs/heads/master
2023-06-21T12:30:50.174806
2021-06-03T04:51:55
2021-06-03T04:51:55
43,813,088
0
0
null
2023-06-14T22:37:14
2015-10-07T12:05:29
Java
UTF-8
Java
false
false
1,743
java
package com.carrefour.shopping.paymentmanagement.logic.impl; import javax.inject.Inject; import javax.inject.Named; import org.springframework.data.domain.Page; import com.carrefour.shopping.general.logic.base.AbstractComponentFacade; import com.carrefour.shopping.paymentmanagement.logic.api.Paymentmanagement; import com.carrefour.shopping.paymentmanagement.logic.api.to.PaymentCto; import com.carrefour.shopping.paymentmanagement.logic.api.to.PaymentEto; import com.carrefour.shopping.paymentmanagement.logic.api.to.PaymentSearchCriteriaTo; import com.carrefour.shopping.paymentmanagement.logic.api.usecase.UcFindPayment; import com.carrefour.shopping.paymentmanagement.logic.api.usecase.UcManagePayment; /** * Implementation of component interface of paymentmanagement */ @Named public class PaymentmanagementImpl extends AbstractComponentFacade implements Paymentmanagement { @Inject private UcFindPayment ucFindPayment; @Inject private UcManagePayment ucManagePayment; @Override public PaymentEto findPayment(long id) { return this.ucFindPayment.findPayment(id); } @Override public Page<PaymentEto> findPayments(PaymentSearchCriteriaTo criteria) { return this.ucFindPayment.findPayments(criteria); } @Override public PaymentEto savePayment(PaymentEto payment) { return this.ucManagePayment.savePayment(payment); } @Override public boolean deletePayment(long id) { return this.ucManagePayment.deletePayment(id); } @Override public PaymentCto findPaymentCto(long id) { return ucFindPayment.findPaymentCto(id); } @Override public Page<PaymentCto> findPaymentCtos(PaymentSearchCriteriaTo criteria) { return ucFindPayment.findPaymentCtos(criteria); } }
e2ec5eec17ce8d099eb16c4676dd812af6ec5f0b
be06139ea6e22f2524e714d436109645654464aa
/src/ingestion/ConfigProvider.java
01896d562689ec77962dccb71568b73aed9ec85b
[]
no_license
Luke-Mason/rmit-database-systems-assignment-1
0ffd7d9100ad71b8d336a2958af10e7988350661
a136b6685d44a188de6acab9fc19e882a0cf75e1
refs/heads/master
2023-08-09T17:04:34.490321
2019-04-09T13:42:26
2019-04-09T13:42:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,887
java
package ingestion; import java.io.*; import java.util.Properties; public class ConfigProvider { public static final String MONGO_CONFIG = "mongoConfig.properties"; public static final String DERBY_CONFIG = "derbyConfig.properties"; public static final String DERBY_TABLES = "derbyTables.sql"; public static final String DERBY = "derby"; public static final String MONGO = "mongo"; private static ConfigProvider configProvider = null; private static String configDirectory = "../config/"; private ConfigProvider() { } public static ConfigProvider getConfigProvider() { if (configProvider == null) { configProvider = new ConfigProvider(); } return configProvider; } /** * Gets the property file and loads in the properties into the property object. * * @param propertyFileName The property file to read. * @return The Properties. * @throws DatabaseException thrown if an issue occurred in finding the file or loading in the properties in the file. */ Properties getPropertyFile(String propertyFileName) throws DatabaseException { try (InputStream input = new FileInputStream(configDirectory + propertyFileName)) { Properties properties = new Properties(); properties.load(input); return properties; } catch (FileNotFoundException e) { throw new DatabaseException("Could not find the '" + propertyFileName + "' file - " + e); } catch (IOException e) { throw new DatabaseException("Could not load in '" + propertyFileName + "' file - " + e); } } /** * Returns the file specified form the config directory. * * @param filename * @return */ File getFile(String filename) { return new File(configDirectory + filename); } }
87a44a0dc487d8d6ea3c157d33b6ce3f3d6128a2
0dd0a96fdb282e96e908e6dc2b70971e80e0243a
/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java
625d4e4653c14daaf659f45b608cba06e907c669
[ "Apache-2.0" ]
permissive
jovi521/ruoyi-springboot-vue-update
7bef9a0d7f22b5a26d0b974d8b5cc5aa0fdb0ff5
2a5af6e9a571389051dedb302507c3be0b26f710
refs/heads/master
2022-12-12T16:46:45.723101
2020-09-14T05:52:31
2020-09-14T05:52:31
294,637,203
0
0
null
null
null
null
UTF-8
Java
false
false
3,698
java
package com.ruoyi.common.utils; import org.apache.commons.lang3.time.DateFormatUtils; import java.lang.management.ManagementFactory; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; /** * 时间工具类 * * @author ruoyi */ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { private static final String[] parsePatterns = { "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; public static String YYYY = "yyyy"; public static String YYYY_MM = "yyyy-MM"; public static String YYYY_MM_DD = "yyyy-MM-dd"; public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; /** * 获取当前Date型日期 * * @return Date() 当前日期 */ public static Date getNowDate() { return new Date(); } /** * 获取当前日期, 默认格式为yyyy-MM-dd * * @return String */ public static String getDate() { return dateTimeNow(YYYY_MM_DD); } public static String getTime() { return dateTimeNow(YYYY_MM_DD_HH_MM_SS); } public static String dateTimeNow() { return dateTimeNow(YYYYMMDDHHMMSS); } public static String dateTimeNow(final String format) { return parseDateToStr(format, new Date()); } public static String dateTime(final Date date) { return parseDateToStr(YYYY_MM_DD, date); } public static String parseDateToStr(final String format, final Date date) { return new SimpleDateFormat(format).format(date); } public static Date dateTime(final String format, final String ts) { try { return new SimpleDateFormat(format).parse(ts); } catch (ParseException e) { throw new RuntimeException(e); } } /** * 日期路径 即年/月/日 如2018/08/08 */ public static String datePath() { Date now = new Date(); return DateFormatUtils.format(now, "yyyy/MM/dd"); } /** * 日期路径 即年/月/日 如20180808 */ public static String dateTime() { Date now = new Date(); return DateFormatUtils.format(now, "yyyyMMdd"); } /** * 日期型字符串转化为日期 格式 */ public static Date parseDate(Object str) { if (str == null) { return null; } try { return parseDate(str.toString(), parsePatterns); } catch (ParseException e) { return null; } } /** * 获取服务器启动时间 */ public static Date getServerStartDate() { long time = ManagementFactory.getRuntimeMXBean().getStartTime(); return new Date(time); } /** * 计算两个时间差 */ public static String getDatePoor(Date endDate, Date nowDate) { long nd = 1000 * 24 * 60 * 60; long nh = 1000 * 60 * 60; long nm = 1000 * 60; // long ns = 1000; // 获得两个时间的毫秒时间差异 long diff = endDate.getTime() - nowDate.getTime(); // 计算差多少天 long day = diff / nd; // 计算差多少小时 long hour = diff % nd / nh; // 计算差多少分钟 long min = diff % nd % nh / nm; // 计算差多少秒//输出结果 // long sec = diff % nd % nh % nm / ns; return day + "天" + hour + "小时" + min + "分钟"; } }
bac245cbd198a53225541760c734aa32393e9d36
8db24d03576d0e5f83431d0bc8bd0136e1fd9543
/Core java - Programmes/javprgs/nitin.java
7e5f0dc6d2c47a59f0d95599c2c422a78c6edf94
[]
no_license
nileshkadam222/Core-Java
bb9b269421276d5372dc6c99afdec27055e450dd
1f3cc0e19b66bca41d3b7d871bf13cefcf763162
refs/heads/master
2021-07-10T22:02:52.763294
2021-02-21T16:10:13
2021-02-21T16:10:13
229,524,477
0
0
null
null
null
null
UTF-8
Java
false
false
688
java
import java.awt.*; import java.awt.event.*; import javax.swing.*; class nitin extends Frame implements ActionListener { JPanel p=new JPanel(); JButton b=new JButton("r"); JButton n=new JButton("r1"); JButton a=new JButton("r2"); nitin() { setTitle("res"); setSize(300,300); p.add(b); p.add(n); p.add(a); b.addActionListener(this); n.addActionListener(this); a.addActionListener(this); add(p); } public void actionPerformed(ActionEvent e) { String s=e.getActionCommand(); if(s=="r") { p.setBackground(Color.red); } else if(s=="r1") { p.setBackground(Color.blue); } else { p.setBackground(Color.pink); } } public static void main(String ar[]) { nitin t=new nitin(); t.setVisible(true); } }
0bdcb8517f87297a00ef01640323cf2e94e3d22b
c0eb8b323aa96841249ebdf397559dcde1f4fce9
/app/src/main/java/com/example/pie/custompiechart/MainActivity.java
71506658e2c3fc4b4de0a5bbfafa635eaad2088f
[]
no_license
ArunaMahaGamage/Custom_Pie_Chart
11429cce9732d8e737ef92776c88d058082ecbee
5540de53c77061765383af0e25fe9342f5eff1a3
refs/heads/master
2020-03-28T18:11:44.568796
2018-09-15T02:01:28
2018-09-15T02:01:28
148,859,913
0
0
null
null
null
null
UTF-8
Java
false
false
1,542
java
package com.example.pie.custompiechart; import android.graphics.Color; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.LinearLayout; public class MainActivity extends ActionBarActivity { PieChart pieChart; LinearLayout linearLayout; //int[] data={6,5,8,4,7,6}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); int[] data={5,5,5,5,5,5}; int[] color={Color.RED,Color.BLUE,Color.CYAN,Color.GREEN,Color.MAGENTA, Color.GREEN}; linearLayout=(LinearLayout)findViewById(R.id.linearLayout); linearLayout.addView(new PieChart(this,6,data,color)); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
6419a26a05b305f1a46f3891fc6540fa4794d7c3
7d71b7065f8455e81c65618b6eb6aaf41623a876
/aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/transform/DescribeImportSnapshotTasksRequestMarshaller.java
f4485e0fc969a90b1402859e657698fcc544d97c
[ "JSON", "Apache-2.0" ]
permissive
norbertkorodi/aws-sdk-java
1472206972425e6a306dddc9c2a104334b4cd804
304e8d6d106b554d07914bd28df44548fedd345f
refs/heads/master
2020-12-24T20:09:41.546535
2016-03-15T21:13:39
2016-03-15T21:13:39
52,344,325
0
0
null
2016-02-23T08:44:59
2016-02-23T08:44:59
null
UTF-8
Java
false
false
4,650
java
/* * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights * Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.ec2.model.transform; import java.util.HashMap; import java.util.List; import java.util.Map; import com.amazonaws.AmazonClientException; import com.amazonaws.Request; import com.amazonaws.DefaultRequest; import com.amazonaws.http.HttpMethodName; import com.amazonaws.services.ec2.model.*; import com.amazonaws.transform.Marshaller; import com.amazonaws.util.StringUtils; /** * DescribeImportSnapshotTasksRequest Marshaller */ public class DescribeImportSnapshotTasksRequestMarshaller implements Marshaller<Request<DescribeImportSnapshotTasksRequest>, DescribeImportSnapshotTasksRequest> { public Request<DescribeImportSnapshotTasksRequest> marshall( DescribeImportSnapshotTasksRequest describeImportSnapshotTasksRequest) { if (describeImportSnapshotTasksRequest == null) { throw new AmazonClientException( "Invalid argument passed to marshall(...)"); } Request<DescribeImportSnapshotTasksRequest> request = new DefaultRequest<DescribeImportSnapshotTasksRequest>( describeImportSnapshotTasksRequest, "AmazonEC2"); request.addParameter("Action", "DescribeImportSnapshotTasks"); request.addParameter("Version", "2015-10-01"); request.setHttpMethod(HttpMethodName.POST); com.amazonaws.internal.SdkInternalList<String> importTaskIdsList = (com.amazonaws.internal.SdkInternalList<String>) describeImportSnapshotTasksRequest .getImportTaskIds(); if (!importTaskIdsList.isEmpty() || !importTaskIdsList.isAutoConstruct()) { int importTaskIdsListIndex = 1; for (String importTaskIdsListValue : importTaskIdsList) { if (importTaskIdsListValue != null) { request.addParameter("ImportTaskId." + importTaskIdsListIndex, StringUtils.fromString(importTaskIdsListValue)); } importTaskIdsListIndex++; } } if (describeImportSnapshotTasksRequest.getNextToken() != null) { request.addParameter("NextToken", StringUtils .fromString(describeImportSnapshotTasksRequest .getNextToken())); } if (describeImportSnapshotTasksRequest.getMaxResults() != null) { request.addParameter("MaxResults", StringUtils .fromInteger(describeImportSnapshotTasksRequest .getMaxResults())); } com.amazonaws.internal.SdkInternalList<Filter> filtersList = (com.amazonaws.internal.SdkInternalList<Filter>) describeImportSnapshotTasksRequest .getFilters(); if (!filtersList.isEmpty() || !filtersList.isAutoConstruct()) { int filtersListIndex = 1; for (Filter filtersListValue : filtersList) { if (filtersListValue.getName() != null) { request.addParameter("Filters." + filtersListIndex + ".Name", StringUtils.fromString(filtersListValue.getName())); } com.amazonaws.internal.SdkInternalList<String> valuesList = (com.amazonaws.internal.SdkInternalList<String>) filtersListValue .getValues(); if (!valuesList.isEmpty() || !valuesList.isAutoConstruct()) { int valuesListIndex = 1; for (String valuesListValue : valuesList) { if (valuesListValue != null) { request.addParameter("Filters." + filtersListIndex + ".Value." + valuesListIndex, StringUtils.fromString(valuesListValue)); } valuesListIndex++; } } filtersListIndex++; } } return request; } }
b1eb8fb38289b1404862f6289ca4e11df1205ecd
af2cdd8fbda32340b361f7a07a0e73e84f77723d
/src/main/java/com/woniu/service/impl/UpkeepplanServiceImpl.java
05f6b0528f94c1b9899c8a3c7951e5289cc9e43b
[]
no_license
xjh565880408/shop
d44532c9db62a6141d4e92ac57e46a68bc1307c4
197241ee216f6f3f548bce33d0cd5ef8983a972c
refs/heads/master
2020-04-14T16:56:35.761782
2019-03-15T08:09:44
2019-03-15T08:09:44
163,965,539
0
0
null
null
null
null
UTF-8
Java
false
false
1,200
java
package com.woniu.service.impl; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.woniu.dao.UpkeepplanMapper; import com.woniu.domain.Upkeepplan; import com.woniu.service.IUpkeepplanService; @Service public class UpkeepplanServiceImpl implements IUpkeepplanService { @Resource private UpkeepplanMapper mapper; @Override public void save(Upkeepplan upkeepplan) { // TODO Auto-generated method stub mapper.insert(upkeepplan); } @Override public void delete(Integer upkeepid) { // TODO Auto-generated method stub mapper.deleteByPrimaryKey(upkeepid); } @Override public void update(Upkeepplan upkeepplan) { // TODO Auto-generated method stub mapper.updateByPrimaryKeySelective(upkeepplan); } @Override public Upkeepplan findOne(Integer upkeepid) { // TODO Auto-generated method stub Upkeepplan upkeepplan = mapper.selectByPrimaryKey(upkeepid); return upkeepplan; } @Override public List<Upkeepplan> findAll() { // TODO Auto-generated method stub List<Upkeepplan> upkeepplans = mapper.selectByExample(null); return upkeepplans; } }
ae6b7490735997a05107e6e13ee434728e5cc62a
bf6e6d64652d86f5366fad88aa26bb8d5276d7f6
/Decorator/Main.java
e79aa192007654f0691092318f477112247bc8f1
[]
no_license
brenoam/DesignPatterns
6f44b287eec887ccc9be552f870fbec7db88edd6
5f9f9c05f2ae78486d95dbe393c0e427396dafe5
refs/heads/master
2020-05-09T19:47:26.150297
2019-04-15T03:05:39
2019-04-15T03:05:39
181,388,087
0
0
null
null
null
null
UTF-8
Java
false
false
1,034
java
class Main{ public static void main(String[] args) { Channel tcpChannel = new TCPChannel(); Channel udpChannel = new UDPChannel(); Channel zluChannel = new ZipChannel(new LogChannel(udpChannel)); Channel bluChannel = new BufferChannel(new LogChannel(udpChannel)); Channel bltChannel = new BufferChannel(new LogChannel(tcpChannel)); Channel zbluChannel = new ZipChannel(new BufferChannel(new LogChannel(udpChannel))); Channel zbltChannel = new ZipChannel(new BufferChannel(new LogChannel(tcpChannel))); System.out.println(">> Zip Log UDP Channel"); zluChannel.send("Test"); zluChannel.recv(); System.out.println("\n>> Buffer Log UDP Channel"); bluChannel.send("Test"); bluChannel.recv(); System.out.println("\n>> Buffer Log TCP Channel"); bltChannel.send("Test"); bltChannel.recv(); System.out.println("\n>> Zip Buffer Log UDP Channel"); zbluChannel.send("Test"); zbluChannel.recv(); System.out.println("\n>> Zip Buffer Log TCP Channel"); zbltChannel.send("Test"); zbltChannel.recv(); } }
8c7d08efd3fdfe6a69f740442fafbebef1cad59e
e66a39f17167a0bb0876ebaa9b1076206a9ab16b
/src/com/AustinShootTheJ/Main.java
cadb058791baa4b4685d8c0617514a0605e40517
[]
no_license
austinjmccune/Java-Arrays
b1905bebf4cb9f355022db757b5bd0385bece0e5
818de41f746bb0eaf54044f5d6d23c1338b432ac
refs/heads/master
2021-09-09T21:52:35.084352
2018-03-19T22:53:11
2018-03-19T22:53:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,964
java
package com.AustinShootTheJ; import java.util.Scanner; public class Main { private static Scanner scanner = new Scanner(System.in); public static void main(String[] args) { // creates an array and initilizes it with user input by calling the getIntergers method. int[] myIntegers = getIntegers(5); System.out.println("The average is " + getAverage(myIntegers)); for(int i=0; i<myIntegers.length; i++){ System.out.println("Element " + i + ", typed value was " + myIntegers[i]); } // creates an int array with an index of 10. int[] myIntArray = new int[10]; // creates an int array with an index of 5 and sets initial values. int[] myIntArray2 = {1,2,3,4,5}; int[] myIntArray3 = new int [10]; // assign array values using a for loop and the .length method. for (int i = 0; i < myIntArray3.length; i++) { myIntArray3[i] = i*10; } // sets value at index 4 to 50. myIntArray[5] = 50; // printArray(myIntArray); } // retrives ints from user input. and returns an array with those values. public static int[] getIntegers(int number){ System.out.println("Enter " + number + " integer values.\r"); int[] values = new int[number]; for(int i=0; i<values.length; i++){ values[i] = scanner.nextInt(); } return values; } //calculates the average of the array. public static double getAverage(int[] array){ int sum = 0; for(int i=0; i<array.length; i++){ sum += array[i]; } return (double)sum / (double)array.length; } public static void printArray(int[] array){ for(int i = 0; i<array.length; i++){ System.out.println("element " + i + " value is " + array[i]); } } }
4f6560b7f3dba3a97594d53e592cd1c383403f39
43a6186a4e745d5f75cb7f7ae7855c7362a1c84a
/src/java/selenium_cucumber/selenium_cucumber/general/Setup.java
c8f8733e7956a2714b279c1b3b70dbdbaab57d06
[]
no_license
gsi-alena/Homework-3
e2193cfee6c1f74b67f180a365d3efce2e3c2fe0
aae785c19ef83c9e13c375bfab06a0a63f4eb4b8
refs/heads/master
2023-07-30T06:44:15.566419
2021-10-06T21:51:30
2021-10-06T21:51:30
414,347,805
0
0
null
null
null
null
UTF-8
Java
false
false
1,969
java
package selenium_cucumber.selenium_cucumber.general; import io.cucumber.java.After; import io.cucumber.java.Before; import java.util.HashMap; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.interactions.Actions; //import org.openqa.selenium.remote.DesiredCapabilities; public final class Setup { private static WebDriver driver; private static HashMap<String, Object> store = new HashMap(); private static JavascriptExecutor jsExecutor; private static Actions actions; private static WaitingObject waitingObject; private static String defaultURL = "https://webgoheavy-testing.gsoftinnovation.net/admin"; @Before public void InitSetup() { String browser = System.getProperty("browser"); System.setProperty("webdriver.chrome.driver", "D://Documents//QA-Automation//Google//chromedriver.exe"); ChromeOptions options = new ChromeOptions(); driver = new ChromeDriver(options); initObject(); } private static void initObject() { waitingObject = new WaitingObject(driver); actions = new Actions(driver); System.setProperty("defaultURL", defaultURL); } public static WebDriver getDriver() { return driver; } /** * * @param key * @return */ public static Object getValueStore(String key) { return store.get(key); } /** * * @return Return an instance of wait. */ public static WaitingObject getWait() { return waitingObject; } /** * * @param key * @param value */ public static void setKeyValueStore(String key, Object value) { store.put(key, value); } /** * Open new url * * @param url */ public static void openUrl(String url) { driver.get(url); waitingObject.waitForLoading(3600); } @After public void close() { driver.close(); } }
7b2a7af9939caf6a9b8ccc7ac52ae5e89910c8a0
4544bc1e10b0562d4241e6d1719187a95fcd928a
/src/main/java/communication/factory/AbstractFactoryCommand.java
da566bf7219b6c7f745aa287738658d49d759520
[]
no_license
dronava/HIL-V2X-Simulation-with-SUMO-Support
840bea4cc81f097aa8b9d5037c74ed7243c39921
2e1a40bc0876089494f65aabe5533359be731981
refs/heads/master
2021-09-04T14:23:25.022872
2018-01-19T13:23:24
2018-01-19T13:23:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,182
java
package communication.factory; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import communication.command.AbstractCommand; import communication.command.CommandEnum; import communication.command.navigation.*; import communication.message.*; import java.io.IOException; import java.util.Optional; public abstract class AbstractFactoryCommand { public abstract Optional<AbstractCommand> createCommand(String messageJSON, CommandEnum command) throws IOException; public static CommandEnum getCommandType(String messageJSON) { ObjectMapper objectMapper = new ObjectMapper(); try { JsonNode rootNode = objectMapper.readTree(messageJSON.getBytes()); JsonNode commandNode = rootNode.path("command"); return CommandEnum.getNameByValue(commandNode.asText()); } catch (IOException e) { return CommandEnum.UNDEFINED; } } protected <M extends MessageCommon> M createMessage( String messageJSON, Class<M> messageClass) throws IOException { return new ObjectMapper().readValue(messageJSON, messageClass); } /** * Command factory functions */ protected Optional<AbstractCommand> createReRouteCommand(String messageJSON) throws IOException { MessageRouteState messageRouteState = createMessage(messageJSON, MessageRouteState.class); return Optional.of(new CommandReRoute(messageRouteState)); } protected Optional<AbstractCommand> createSpeedCommand(String messageJSON) throws IOException { MessageSpeed messageSpeed = createMessage(messageJSON,MessageSpeed.class);//new ObjectMapper().readValue(messageJSON, MessageSpeed.class); System.out.println("Create Command Speed Change"); return Optional.of(new CommandSpeed(messageSpeed)); } protected Optional<AbstractCommand> createNewDestinationCommand(String messageJSON) throws IOException { MessageDestination messageDestination = createMessage(messageJSON,MessageDestination.class); System.out.println("Create Command Destination Change"); return Optional.of(new CommandNewDestination(messageDestination)); } protected Optional<AbstractCommand> createCongestionDetailCommand(String messageJSON) throws IOException { MessageRoute messageRoute = createMessage(messageJSON,MessageRoute.class);//new ObjectMapper().readValue(messageJSON, MessageRoute.class); return Optional.of(new CommandCongestionDetails(messageRoute)); } protected Optional<AbstractCommand> createGetRouteCommand(String messageJSON) throws IOException { MessageCommon messageCommon = createMessage(messageJSON, MessageCommon.class); return Optional.of(new CommandGetRoute(messageCommon)); } protected Optional<AbstractCommand> createReRouteByBlocking(String messageJSON) throws IOException { MessageDestination messageDestination = createMessage(messageJSON, MessageDestination.class); return Optional.of(new CommandBlockingPosition(messageDestination)); } }
e0b684e511417ad12097eb79c4c64b7b03e52cca
ec3af72f13473d31d7744dea3fb49e1cb1483f37
/Array_3d.java
a54420fc25a61f0cf944d9b8febe86c5274f49db
[]
no_license
srikanth-15121/new
75bb820f913d1086d7a9893d438cc82063c6a144
13028ad56b717b98601838e035c28314ec248b78
refs/heads/master
2020-12-30T04:51:10.908880
2020-02-07T07:29:00
2020-02-07T07:29:00
238,866,434
0
0
null
null
null
null
UTF-8
Java
false
false
856
java
import java.util.Scanner; class Array_3d { public static void main(String[] args) { int a[][][]=new int[3][3][2]; Scanner sc=new Scanner(System.in); System.out.println("Enter the number of students in each class: "); for(int i=0;i<=a.length-1;i++) { for(int j=0;j<=a[i].length-1;j++) { for(int k=0;k<=a[i][j].length-1;k++) { System.out.println("Enter the details of school "+i+" class "+j+" students "+k+""); a[i][j][k]=sc.nextInt(); } } } System.out.println("Number of the students in each class: "); { for(int i=0;i<=a.length-1;i++) { for(int j=0;j<=a[i].length-1;j++) { for(int k=0;k<=a[i][j].length-1;k++) { System.out.println(a[i][j][k]); } } } } } }
230839b0d43d2a4dce987bcc716abfff48403c44
cfcb7b0269464539c5717a2d5258d2122be8a433
/test/TestBmi160StepDetectorData.dart
c2d543a151042fe3579ecee8280515793623e8df
[]
no_license
pollend/flutter_metawear
b707852c610a128c745497f8033d17dc60578fb9
660e8e867edd0ded67c5f6b7961968fd853f2d86
refs/heads/master
2020-04-26T07:47:26.937226
2019-05-03T01:32:45
2019-05-03T01:32:45
173,404,082
2
3
null
2019-04-18T04:20:53
2019-03-02T04:43:06
Java
UTF-8
Java
false
false
4,003
dart
/* * Copyright 2014-2015 MbientLab Inc. All rights reserved. * * IMPORTANT: Your use of this Software is limited to those specific rights granted under the terms of a software * license agreement between the user who downloaded the software, his/her employer (which must be your * employer) and MbientLab Inc, (the "License"). You may not use this Software unless you agree to abide by the * terms of the License which can be found at www.mbientlab.com/terms. The License limits your use, and you * acknowledge, that the Software may be modified, copied, and distributed when used in conjunction with an * MbientLab Inc, product. Other than for the foregoing purpose, you may not use, reproduce, copy, prepare * derivative works of, modify, distribute, perform, display or sell this Software and/or its documentation for any * purpose. * * YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, * NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MBIENTLAB OR ITS LICENSORS BE LIABLE OR * OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE * THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, * PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, * SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS. * * Should you have any questions regarding your right to use this Software, contact MbientLab via email: * [email protected]. */ package com.mbientlab.metawear; import com.mbientlab.metawear.module.AccelerometerBmi160; import org.junit.Before; import org.junit.Test; import bolts.Capture; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; /** * Created by etsai on 11/14/16. */ public class TestBmi160StepDetectorData extends UnitTestBase { private AccelerometerBmi160.StepDetectorDataProducer detector; @Before public void setup() throws Exception { junitPlatform.boardInfo = new MetaWearBoardInfo(AccelerometerBmi160.class); connectToBoard(); detector = mwBoard.getModule(AccelerometerBmi160.class).stepDetector(); } @Test public void subscribe() { byte[] expected = new byte[] {0x3, 0x19, 0x1}; detector.addRouteAsync(source -> source.stream(null)); assertArrayEquals(expected, junitPlatform.getLastCommand()); } @Test public void unsubscribe() { byte[] expected = new byte[] {0x3, 0x19, 0x0}; detector.addRouteAsync(source -> source.stream(null)).continueWith(task -> { task.getResult().unsubscribe(0); return null; }); assertArrayEquals(expected, junitPlatform.getLastCommand()); } @Test public void enable() { byte[] expected= new byte[] {0x03, 0x17, 0x01, 0x00}; detector.start(); assertArrayEquals(expected, junitPlatform.getLastCommand()); } @Test public void disable() { byte[] expected= new byte[] {0x03, 0x17, 0x00, 0x01}; detector.stop(); assertArrayEquals(expected, junitPlatform.getLastCommand()); } @Test public void handleResponse() { final Capture<Byte> actual = new Capture<>(); byte expected = 1; detector.addRouteAsync(source -> source.stream((data, env) -> ((Capture<Byte>) env[0]).set(data.value(Byte.class)))) .continueWith(task -> { task.getResult().setEnvironment(0, actual); return null; }); sendMockResponse(new byte[] {0x03, 0x19, 0x01}); assertEquals(expected, actual.get().byteValue()); } }
27a14ce17c1afd60591f7d1247022c9534934215
b200d37e86b6361c51a9e32822219708084d023b
/core/src/main/java/com/adobe/aem/guides/yamato/core/models/content/HeroImage.java
b8859474b1d68221c1a643d7209aedd717a34c66
[]
no_license
kano-yamato/training-site
05ca4c468c58bb05627e094f7a706a4e467c0697
3ef5628894bfaff77de566cc456b448334323dc7
refs/heads/master
2022-09-10T10:04:21.368583
2021-10-07T01:36:23
2021-10-07T01:36:23
245,097,863
1
4
null
2022-08-11T15:57:47
2020-03-05T07:35:33
CSS
UTF-8
Java
false
false
1,051
java
package com.adobe.aem.guides.yamato.core.models.content; import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.annotation.PostConstruct; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.models.annotations.DefaultInjectionStrategy; import org.apache.sling.models.annotations.Model; import org.apache.sling.models.annotations.injectorspecific.ValueMapValue; @Model( adaptables = {SlingHttpServletRequest.class}, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL ) public class HeroImage { @ValueMapValue private List<String> items; private List<Image> heroImages = new ArrayList<Image>(); @PostConstruct public void init() { if (items == null) items = Collections.emptyList(); items.stream().forEach(item -> { heroImages.add(new Image(item)); }); } public List<Image> getHeroImages() { return heroImages; } public boolean isEmpty() { return heroImages.isEmpty(); } }
73b498ac7c5966927a197228b652ae5c53214eed
03789e50ccc92401ae8c5ecb5c6b42ca4b822819
/Codigos/4_PracticaHerencia/src/practicaherencia/Circle.java
4e0077e3b4005e2334f76c8ce99e7ea923290e07
[]
no_license
psatencio/DataStructures
990fe6c80bc6c31e18159013ced0f30123869dcf
db691d42d59b2e5f7d85679fd1d2ca304a6749ed
refs/heads/master
2020-04-21T09:47:55.334196
2019-05-29T22:00:27
2019-05-29T22:00:27
169,463,187
0
0
null
null
null
null
UTF-8
Java
false
false
951
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 practicaherencia; //import Java.lang.Math.*; /** * * @author cornelius */ public class Circle extends GeometricFigure{ private double radio; public Circle(){ this(1); //default circle with radio 1 } public Circle(double radio){ this(radio, 0, 0); //llamado al constructor mas complejo con parametros por defecto } public Circle(double radio, double x, double y){ this.radio = radio; this.x = x; this.y = y; calc_area(); calc_perimeter(); } @Override protected void calc_area(){ this.area = Math.PI * Math.pow(this.radio, 2); } @Override protected void calc_perimeter(){ this.perimeter = 2.0 * Math.PI * this.radio; } }
c00e179f5a8f847f6ee897f621fb4b8402ae64d8
09593337807bd040b82cd8096053498ee7babc28
/src/module3/MathExpressions2.java
3e7cec40e349dd27df5a68c88f69e6413aaf6eb2
[]
no_license
danlaihk/java-practise
cc3264b98aeff692602f7325a31904e55e7e7892
20f2d1fb5de633f6188b1c5747430103f5d4375a
refs/heads/master
2022-11-08T20:37:49.377545
2020-06-21T00:09:53
2020-06-21T00:09:53
269,906,676
0
0
null
2020-06-21T00:09:55
2020-06-06T07:37:11
Java
UTF-8
Java
false
false
150
java
package module3; public class MathExpressions2 { public static void main(String[] args){ System.out.println(Math.min(3.0, 2.0)); } }
83480cb087bba1726d63cf92df59c0003db1778e
806d5b01d23daeeb869f488d05f21978d7f93640
/src/main/java/com/n26/transaction/model/Transaction.java
ebfc8f0620e4b6f0661a40751225274f29b600dc
[]
no_license
philipjohn007/n26
6dcef345b019f2d1bfa8cf0102d078bfa69eff9a
023220eea72bc815ad8b78bd2ff189b810d8b2fa
refs/heads/master
2020-03-17T11:19:17.916140
2018-05-16T16:15:16
2018-05-16T16:15:16
133,546,999
0
0
null
null
null
null
UTF-8
Java
false
false
500
java
package com.n26.transaction.model; public class Transaction { private Double amount; private Long timestamp; public Transaction() {} public Transaction(Double amount, Long timestamp) { this.amount = amount; this.timestamp = timestamp; } public Double getAmount() { return amount; } public void setAmount(Double amount) { this.amount = amount; } public Long getTimestamp() { return timestamp; } public void setTimestamp(Long timestamp) { this.timestamp = timestamp; } }
21531565cb41ba837f1b88b5056c4faf5b6600a7
7ffda65693460972b2956120cd88480afe99338e
/AbstratasInterfaceArquivo/Questao1/Triangulo.java
051cee77347787d7bb94ffdf4fbf8b85c15742ef
[]
no_license
dariomousinho/POOUFF
b2e6012befc6228c71534bdfb9483ba252af3fbb
4865d4a891a74d9580cbe699e31cbba931eab1c4
refs/heads/main
2023-04-30T23:41:18.018400
2021-05-10T23:53:38
2021-05-10T23:53:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
308
java
package questao1; public class Triangulo extends FormaGeometrica { public void calcularArea(int base, int altura){ this.setArea((base*altura)/2); } public void calcularPerimetro(int lado1, int lado2, int lado3){ this.setPerimetro(lado1 + lado2 + lado3); } }
7703786315841fe6857117e77bae9ea7b608343c
dd83c90ac50ee3556afd5d986d34075f98ce1ece
/src/coreutils/Eatable.java
34ef31dd56306a06b2b369968d4332f54fe1a5f5
[ "MIT" ]
permissive
XessWaffle/agario
a468fea81e4100f15b8cb7d143a2edc2e8ceca14
d8aa56d9016a645100d6f9fe6d0ea0b7e85bcfdb
refs/heads/main
2023-07-18T11:55:01.156891
2021-09-02T07:10:44
2021-09-02T07:10:44
401,953,538
0
0
null
null
null
null
UTF-8
Java
false
false
68
java
package coreutils; public interface Eatable { public int eat(); }
3719bce5200d4d8eef6f973feb2a3aef91983382
a78e998b0cb3c096a6d904982bb449da4003ff8b
/app/src/main/java/com/alipay/api/domain/AlipayUserNewbenefitModifyModel.java
358283fefa3003017a111d9f2c516c646941ba1c
[ "Apache-2.0" ]
permissive
Zhengfating/F2FDemo
4b85b598989376b3794eefb228dfda48502ca1b2
8654411f4269472e727e2230e768051162a6b672
refs/heads/master
2020-05-03T08:30:29.641080
2019-03-30T07:50:30
2019-03-30T07:50:30
178,528,073
0
0
null
null
null
null
UTF-8
Java
false
false
4,132
java
package com.alipay.api.domain; import java.util.List; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; import com.alipay.api.internal.mapping.ApiListField; /** * 蚂蚁会员V3权益修改接口 * * @author auto create * @since 1.0, 2017-06-15 15:43:39 */ public class AlipayUserNewbenefitModifyModel extends AlipayObject { private static final long serialVersionUID = 7198148668765871422L; /** * 权益关联的专区码 ,需要联系蚂蚁会员平台的业务负责人进行专区码分配 */ @ApiField("area_code") private String areaCode; /** * 权益Id,用于定位需要编辑的权益,通过权益创建接口获取得到,调用创建接口后,将权益Id妥善存储,编辑时传入 */ @ApiField("benefit_id") private Long benefitId; /** * 权益的名称,由商户自行定义 */ @ApiField("benefit_name") private String benefitName; /** * 权益的副标题,用于补充描述权益 */ @ApiField("benefit_sub_title") private String benefitSubTitle; /** * 权益详情描述 */ @ApiField("description") private String description; /** * 当权益为非差异化时,该字段生效,用于控制允许兑换权益的等级 */ @ApiField("eligible_grade_desc") private String eligibleGradeDesc; /** * 权益展示结束时间,使用Date.getTime()。结束时间必须大于起始时间。 */ @ApiField("end_dt") private Long endDt; /** * 兑换规则以及不满足该规则后给用户的提示文案,规则id和文案用:分隔;可配置多个,多个之间用,分隔。(分隔符皆是英文半角字符)规则id联系蚂蚁会员pd或运营提供 */ @ApiField("exchange_rule_ids") private String exchangeRuleIds; /** * 权益等级配置 */ @ApiListField("grade_config") @ApiField("benefit_grade_config") private List<BenefitGradeConfig> gradeConfig; /** * 权益展示时的图标地址,由商户上传图片到合适的存储平台,然后将图片的地址传入 */ @ApiField("icon_url") private String iconUrl; /** * 需要被移除的等级配置 */ @ApiField("remove_grades") private String removeGrades; /** * 权益展示的起始时间戳,使用Date.getTime()获得 */ @ApiField("start_dt") private Long startDt; public String getAreaCode() { return this.areaCode; } public void setAreaCode(String areaCode) { this.areaCode = areaCode; } public Long getBenefitId() { return this.benefitId; } public void setBenefitId(Long benefitId) { this.benefitId = benefitId; } public String getBenefitName() { return this.benefitName; } public void setBenefitName(String benefitName) { this.benefitName = benefitName; } public String getBenefitSubTitle() { return this.benefitSubTitle; } public void setBenefitSubTitle(String benefitSubTitle) { this.benefitSubTitle = benefitSubTitle; } public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } public String getEligibleGradeDesc() { return this.eligibleGradeDesc; } public void setEligibleGradeDesc(String eligibleGradeDesc) { this.eligibleGradeDesc = eligibleGradeDesc; } public Long getEndDt() { return this.endDt; } public void setEndDt(Long endDt) { this.endDt = endDt; } public String getExchangeRuleIds() { return this.exchangeRuleIds; } public void setExchangeRuleIds(String exchangeRuleIds) { this.exchangeRuleIds = exchangeRuleIds; } public List<BenefitGradeConfig> getGradeConfig() { return this.gradeConfig; } public void setGradeConfig(List<BenefitGradeConfig> gradeConfig) { this.gradeConfig = gradeConfig; } public String getIconUrl() { return this.iconUrl; } public void setIconUrl(String iconUrl) { this.iconUrl = iconUrl; } public String getRemoveGrades() { return this.removeGrades; } public void setRemoveGrades(String removeGrades) { this.removeGrades = removeGrades; } public Long getStartDt() { return this.startDt; } public void setStartDt(Long startDt) { this.startDt = startDt; } }
91795927a1df405c8bd9f7d0aa792b852477ea15
92c814e9c9b02750d398c1fa8b1f63d303655a2b
/app/src/main/java/ndroid/google/com/instahelp/core/register/RegisterPresenter.java
1d5d935b7a692c103b061362f49f64a4585c1da5
[]
no_license
zohaib319/Instahelp
fcd0e9ef051ffba90b28dc405581b2e3f965175f
c5a5f7f6c2b2926056c8def2d83c879829ae4b49
refs/heads/master
2020-03-23T02:58:55.396793
2018-07-30T07:13:41
2018-07-30T07:13:41
141,002,519
0
0
null
null
null
null
UTF-8
Java
false
false
960
java
package ndroid.google.com.instahelp.core.register; import android.app.Activity; import com.google.firebase.auth.FirebaseUser; public class RegisterPresenter implements RegisterContract.Presenter, RegisterContract.OnRegistrationListener { private RegisterContract.View mRegisterView; private RegisterInteractor mRegisterInteractor; public RegisterPresenter(RegisterContract.View registerView) { this.mRegisterView = registerView; mRegisterInteractor = new RegisterInteractor(this); } @Override public void register(Activity activity, String email, String password) { mRegisterInteractor.performFirebaseRegistration(activity, email, password); } @Override public void onSuccess(FirebaseUser firebaseUser) { mRegisterView.onRegistrationSuccess(firebaseUser); } @Override public void onFailure(String message) { mRegisterView.onRegistrationFailure(message); } }
5ba6e0ac43b51129a55182a04c518f8759e20cb7
572071ee133309caf78e076b669f9b33a868d60c
/org.activebpel.rt.bpel/src/org/activebpel/rt/bpel/impl/IAeManagerVisitor.java
967167820f6849227b292439f13f4c7135b52afb
[]
no_license
deib-polimi/DyBPEL
3809bb3f9f453750db52bc1ce1ffd5af412a2c8b
7043cec7032858cfd889c9022e935c946e130a6e
refs/heads/master
2021-01-20T12:21:50.392988
2014-12-18T15:07:24
2014-12-18T15:07:24
28,188,077
0
1
null
null
null
null
UTF-8
Java
false
false
2,244
java
// $Header: /gestionale/org.activebpel.rt.bpel/src/org/activebpel/rt/bpel/impl/IAeManagerVisitor.java,v 1.1 2009/09/23 13:08:33 zampognaro Exp $ ///////////////////////////////////////////////////////////////////////////// // PROPRIETARY RIGHTS STATEMENT // The contents of this file represent confidential information that is the // proprietary property of Active Endpoints, Inc. Viewing or use of // this information is prohibited without the express written consent of // Active Endpoints, Inc. Removal of this PROPRIETARY RIGHTS STATEMENT // is strictly forbidden. Copyright (c) 2002-2004 All rights reserved. ///////////////////////////////////////////////////////////////////////////// package org.activebpel.rt.bpel.impl; /** * Visitor interface for managers. */ public interface IAeManagerVisitor { /** Visitor that calls the create method */ public static final IAeManagerVisitor CREATE = new IAeManagerVisitor() { public void visit(IAeManager aManager) throws Exception { aManager.create(); } }; /** Visitor that calls the prepareToStart method */ public static final IAeManagerVisitor PREPARE = new IAeManagerVisitor() { public void visit(IAeManager aManager) throws Exception { aManager.prepareToStart(); } }; /** Visitor that calls the start method */ public static final IAeManagerVisitor START = new IAeManagerVisitor() { public void visit(IAeManager aManager) throws Exception { aManager.start(); } }; /** Visitor that calls the stop method */ public static final IAeManagerVisitor STOP = new IAeManagerVisitor() { public void visit(IAeManager aManager) throws Exception { aManager.stop(); } }; /** Visitor that calls the destroy method */ public static final IAeManagerVisitor DESTROY = new IAeManagerVisitor() { public void visit(IAeManager aManager) throws Exception { aManager.destroy(); } }; /** * Visitor method for managers. * @param aManager */ public void visit(IAeManager aManager) throws Exception; }
86fdcaaa5adcc7a4954432b528be8a629d6c3934
703a3e94606e31664aee2ca1e20b19fedb017ae1
/src/java/org/fstrf/stanfordAsiInterpreter/resistance/grammar/node/TBlank.java
f0bd1a3bcd97b1ae75262a9268dca70825168b63
[ "Apache-2.0" ]
permissive
kylelambert5/asi_interpreter
36f17354cbe58ccee46c1e849dbbb49f47e54a95
17f741f69502ce926a4786592065bcb0e5b932bf
refs/heads/master
2020-05-05T04:15:18.984157
2019-04-05T15:37:45
2019-04-05T15:37:45
173,947,216
0
0
Apache-2.0
2019-03-05T13:00:44
2019-03-05T13:00:43
null
UTF-8
Java
false
false
1,775
java
/** Copyright 2017 Frontier Science & Technology Research Foundation 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. ADDITIONAL DISCLAIMER: In addition to the standard warranty exclusions and limitations of liability set forth in sections 7, 8 and 9 of the Apache 2.0 license that governs the use and development of this software, Frontier Science & Technology Research Foundation disclaims any liability for use of this software for patient care or in clinical settings. This software was developed solely for use in medical and public health research, and was not intended, designed, or validated to guide patient care. */ /* This file was generated by SableCC (http://www.sablecc.org/). */ package org.fstrf.stanfordAsiInterpreter.resistance.grammar.node; import org.fstrf.stanfordAsiInterpreter.resistance.grammar.analysis.*; public final class TBlank extends Token { public TBlank(String text) { setText(text); } public TBlank(String text, int line, int pos) { setText(text); setLine(line); setPos(pos); } public Object clone() { return new TBlank(getText(), getLine(), getPos()); } public void apply(Switch sw) { ((Analysis) sw).caseTBlank(this); } }
47bc0acb96f44b1c486afe1b20a28e116effdb30
ffcacc5964921662c184ae602dc78f04904a59b0
/10spring4_aop2/src/com/bao/service/userservice.java
f8443f90b2ef69ebeb584606cdc79884771495ba
[]
no_license
baoshanliang/myfirst
8ecfdb58c354761435f56c8ef5345ccb2b9a5fb0
ac69411e1a9db9ef57989559784e1dd3f86b7e17
refs/heads/master
2021-01-11T00:13:12.178593
2016-10-11T09:22:08
2016-10-11T09:22:08
70,575,163
0
0
null
null
null
null
UTF-8
Java
false
false
162
java
package com.bao.service; public interface userservice { public void add(int i); public void delete(); public void update(); public void seacher(); }
db9da176d87a13ff8136f9defad1dc7338c9f6d2
e2c03ef317f03f0f24823e958674b0917815aab9
/src/main/java/jp/co/forthelocal/template/spring/domain/repositories/UserRepository.java
ef5e37a40b2d4258d3b3215e3979bed84703a4dd
[]
no_license
ft-labo/spring-testing-sample
df239d235ddf309bca29357e5d6e51f490f1239a
76c89ebd8ff400e756e52b9eefabaae6605f059e
refs/heads/master
2021-09-20T11:59:26.193034
2018-08-09T08:41:41
2018-08-09T08:41:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
525
java
package jp.co.forthelocal.template.spring.domain.repositories; import jp.co.forthelocal.template.spring.domain.entities.User; import org.apache.ibatis.annotations.*; import java.util.List; @Mapper public interface UserRepository { @Select("SELECT * FROM user WHERE name = #{name} limit 1") User findByName(@Param("name") String name); @Select("SELECT * FROM user") List<User> findAll(); @Insert("insert into user(name, email) values(#{name}, #{email})") @Options(useGeneratedKeys = true) int insert(User user); }
c0d697a9894792efd7226d8dd90d5765ff24688a
dd001e205daf8eca87d51c49d62be2797d67a8c7
/design/src/me/sungbin/design/proxy/ProxyTest.java
4051fd48129079c68d1c12364b02e77ef13173d0
[]
no_license
SungbinYang/SpringStart
5bda1e5f8da040dbbc4f02f5869aee9b0354f321
4da5a6836a467c74a3d34997751681b26218c167
refs/heads/main
2023-07-08T03:57:09.055529
2021-08-14T14:38:10
2021-08-14T14:38:10
391,612,154
0
0
null
null
null
null
UTF-8
Java
false
false
452
java
package me.sungbin.design.proxy; public class ProxyTest { public static void main(String[] args) { // Chrome chrome = new Chrome("www.naver.com"); // chrome.show(); // chrome.show(); // chrome.show(); // chrome.show(); Browser browser = new BrowserProxy("www.naver.com"); browser.show(); browser.show(); browser.show(); browser.show(); browser.show(); } }
0c0bfdf4c8f9990e200dfb8e9a751a5297f87158
8eb059ab34cb24751e9d9a04d49c4cd5d53d20ce
/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1075/remoteonly/RemoteInterfaceOnly21Bean.java
59660a3b31020f1658a85340ea1dbfab6e4d0a7a
[]
no_license
wolfc/jboss-ejb3.obsolete
0109c9f12100e0983333cb11803d18b073b0dbb5
4df1234e2f81312b3ff608f9965f9a6ad4191c92
refs/heads/master
2020-04-07T03:03:19.723537
2009-12-02T11:37:57
2009-12-02T11:37:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
829
java
/* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ package org.jboss.ejb3.test.ejbthree1075.remoteonly; import javax.ejb.Stateless; import org.jboss.ejb3.annotation.RemoteBinding; import org.jboss.ejb3.test.ejbthree1075.homeonly.RemoteHomeOnly21Business; /** * A RemoteOnly21Bean. * * This EJB should fail deployment as a remote interface is defined, but no remote home is. * * @author <a href="[email protected]">ALR</a> * @version $Revision: $ */ @Stateless @javax.ejb.Remote( {RemoteInterfaceOnly21.class, RemoteInterfaceOnly21Business.class}) @RemoteBinding(jndiBinding = RemoteHomeOnly21Business.JNDI_NAME_REMOTE) public class RemoteInterfaceOnly21Bean implements RemoteInterfaceOnly21Business { public void test() { } }
7403568c603eec2b3f0dc46c95549766f27c2297
ca14ff8ad04b1c88e609ee375798d27ae3bd5385
/app/src/main/java/flux/lastbus/com/easysobuy/utils/StringUtils.java
4234ad6d4fb8491cd649817ac72fbd56683e1979
[]
no_license
yuhanghate/FluxDemo
fd6e82aef02409b3c40244db7323d0e75fe4e581
11a3b229dcf8e34d0321a70bc7cb915992b0b14a
refs/heads/master
2020-04-06T06:55:46.570366
2018-04-03T10:28:56
2018-04-03T10:28:56
64,353,008
1
0
null
null
null
null
UTF-8
Java
false
false
3,038
java
package flux.lastbus.com.easysobuy.utils; /** * Created by yuhang on 16-7-27. */ public class StringUtils { /** * 解析UniCode编码 * @param theString * @return */ public static String decodeUnicode(String theString) { char aChar; int len = theString.length(); StringBuffer outBuffer = new StringBuffer(len); for (int x = 0; x < len;) { aChar = theString.charAt(x++); if (aChar == '\\') { aChar = theString.charAt(x++); if (aChar == 'u') { // Read the xxxx int value = 0; for (int i = 0; i < 4; i++) { aChar = theString.charAt(x++); switch (aChar) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': value = (value << 4) + aChar - '0'; break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': value = (value << 4) + 10 + aChar - 'a'; break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': value = (value << 4) + 10 + aChar - 'A'; break; default: throw new IllegalArgumentException( "Malformed \\uxxxx encoding."); } } outBuffer.append((char) value); } else { if (aChar == 't') aChar = '\t'; else if (aChar == 'r') aChar = '\r'; else if (aChar == 'n') aChar = '\n'; else if (aChar == 'f') aChar = '\f'; outBuffer.append(aChar); } } else outBuffer.append(aChar); } return outBuffer.toString(); } /** * 判断字符串是否无效 * @param str * @return */ public boolean isEmpty(String... str){ for(String s : str){ if(s == null || s.trim().equals("")) return false; } return true; } }
bd0e6e34560f883286fdc65e17361bc280081865
b113d14dbf69e7dedda97dfc295a62dbfad85eaf
/src/chapter3/Invoice.java
208a91aa5154b008369c482e3c073f36fb90c687
[]
no_license
atharvajpatel/Mission_College-Java_Codes
e5c7e785877da938a0cc5958f3367f1dd7f23efe
109183e8998336df436ae69f7b92566dac7edb39
refs/heads/master
2022-11-29T08:03:38.941197
2020-08-15T23:37:00
2020-08-15T23:37:00
271,620,910
0
0
null
null
null
null
UTF-8
Java
false
false
2,230
java
package chapter3; import java.util.Scanner; public class Invoice { private String part; private String partD; private int quantity; private double price; public Invoice(String part, String partD, int quantity, double price){ this.part = part; this.partD = partD; this.quantity = quantity; this.price = price; } public void setPart(String part){ this.part = part; } public String getPart(){ return this.part; } public void setPartD(String partD){ this.part = partD; } public String getPartD(){ return this.partD; } public void setQuantity(int quantity){ if (price<=0){ this.quantity = 0; } else{ this.quantity = quantity; } } public int getQuantity(){ return this.quantity; } public void setPrice(double price){ if (price<=0){ this.price = 0; } else{ this.price = price; } } public double getPrice(){ return this.price; } public double InvoiceAmount(double price, int quantity){ double invoice = price * quantity; return invoice; } public static void main(String[] args){ System.out.println("Original Invoice information"); Scanner pART = new Scanner(System.in); System.out.print("Part number: "); String part = pART.nextLine(); Scanner partd = new Scanner(System.in); System.out.print("Description: "); String partD = partd.nextLine(); Scanner quant = new Scanner(System.in); System.out.print("Quantity: "); int quantity = quant.nextInt(); Scanner prICE = new Scanner(System.in); System.out.print("Price: "); double price = prICE.nextDouble(); Invoice invoice_test = new Invoice(part, partD, quantity, price); if(price <= 0) { price = 0; System.out.println(price); } if(quantity <= 0) { quantity = 0; System.out.println(quantity); } System.out.println("Invoice: " + invoice_test.InvoiceAmount(price,quantity)); } }
0e457272734d60124c185d86f5aebddaf1fb7e75
f08af2166baa9240aa1f33a604c9f00de42de906
/1499-Max_Value_of_Equation.java
fdff65be23e5fa6a70c7f17a24a573804e516531
[]
no_license
sirius206/LeetCode
69d23a2b2585951593591d7fea7f5849b2f14056
331072373a7ae7909bdcd80ccd98407dee7ca847
refs/heads/master
2021-10-26T03:42:58.319146
2021-10-13T20:22:12
2021-10-13T20:22:12
211,740,083
0
0
null
null
null
null
UTF-8
Java
false
false
1,721
java
/* Because xi < xj, yi + yj + |xi - xj| = (yi - xi) + (yj + xj) So for each pair of (xj, yj), we have xj + yj, and we only need to find out the maximum yi - xi. To find out the maximum element in a sliding window, we can use priority queue or stack. */ //1. Priority Queue, Time O(NlogN), Space O(N) class Solution { public int findMaxValueOfEquation(int[][] points, int k) { PriorityQueue<Pair<Integer, Integer>> pq = new PriorityQueue<>((a, b) -> (a.getKey() == b.getKey() ? a.getValue() - b.getValue() : b.getKey() - a.getKey())); int res = Integer.MIN_VALUE; for (int[] point : points) { while (!pq.isEmpty() && point[0] - pq.peek().getValue() > k) { pq.poll(); } if (!pq.isEmpty()) { //because i < j res = Math.max(res, pq.peek().getKey() + point[0] + point[1]); } pq.offer(new Pair<>(point[1] - point[0], point[0])); } return res; } } //2 Deque Time O(N), Space O(N) public int findMaxValueOfEquation(int[][] points, int k) { Deque<Pair<Integer, Integer>> ms = new ArrayDeque<>(); int res = Integer.MIN_VALUE; for (int[] point : points) { while (!ms.isEmpty() && point[0] - ms.peekFirst().getValue() > k) { ms.pollFirst(); } if (!ms.isEmpty()) { res = Math.max(res, ms.peekFirst().getKey() + point[0] + point[1]); } while (!ms.isEmpty() && point[1] - point[0] > ms.peekLast().getKey()) { ms.pollLast(); } ms.offerLast(new Pair<>(point[1] - point[0], point[0])); } return res; }
500cb27ad25c076aaa363beab1d653299b30184d
357b67c38b3ae9025194fad81173a1ec3b13f0fb
/Item.java
3067d2f5f5c6317c7589a35e911f357aa8b64706
[]
no_license
benjamin-korobkin/Dungeon-Adventure
f16ed5e3bcde80550590ae2dda0fcc2a4f90c6c9
5fee760ac406c874b1fcc733124e1831ab454265
refs/heads/master
2020-04-16T20:04:10.509729
2020-04-14T19:32:32
2020-04-14T19:32:32
165,885,771
0
0
null
null
null
null
UTF-8
Java
false
false
1,184
java
package realzork; public class Item { private String name; private int weight; private String description; public boolean taken; public Item(String name, int weight, String desc) { this.name = name; this.weight = weight; this.description = desc; taken = false; } public Item(String name, String desc) { this(name, 0, desc); } public String toString(Item item) { return item.getName(); } /** * @return the name */ public String getName() { return name; } /** * @return the weight */ public int getWeight() { return weight; } /** * @param weight the weight to set */ public void setWeight(int weight) { this.weight = weight; } /** * @return the description */ public String getDescription() { return description; } /** * @param description the description to set */ public void setDescription(String description) { this.description = description; } }
86333295e5c0967d43c8e2a997f2d0d5c874c08d
a8ee32ec4db6b5edbcb91c4fa2110034917884aa
/Lesson4Java2/src/Chat/ChatController.java
2bf5b0ff9f38de6e720bd8f32e5e4fad01bdb50f
[]
no_license
ElinaFemida/Homeworks_GB
00ebf88a2f4e84dc01bf2a15d682ce65a280d37e
253daee7abaedf6fa02ddc68ea961789c2452d17
refs/heads/master
2023-02-26T15:13:40.389919
2021-02-05T18:12:33
2021-02-05T18:12:33
323,238,828
0
0
null
2020-12-21T06:22:27
2020-12-21T05:24:26
Java
UTF-8
Java
false
false
1,317
java
package Chat; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.control.Button; import javafx.scene.control.ListView; import javafx.scene.control.TextField; import javafx.scene.control.Tooltip; import javafx.scene.input.MouseEvent; public class ChatController { public ListView<String> listView; public TextField input; public Button delete; public void send(ActionEvent actionEvent) { String message = input.getText(); input.clear(); //если строка пустая - в listView ничего не передается if (!message.isEmpty()) { listView.getItems().add(message); } } //обработка нажатия мыши на listView public void click(MouseEvent mouseEvent) { listView.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { System.out.println("MOUSE_CLICKED"); } }); } public void clear(ActionEvent actionEvent) { input.clear(); Tooltip tooltip = new Tooltip(); // подсказка при наведении мыши tooltip.setText("You can clear the field"); delete.setTooltip(tooltip); } }
c70a1ca0a20855dd453dd072129930aa4e3afac0
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/5/5_5bf27ca281445d667fad19cd1a211da412faa58d/SpotSceneManager/5_5bf27ca281445d667fad19cd1a211da412faa58d_SpotSceneManager_t.java
a52825bd82b4ef40e6f682c6ff4e04d9d9bdae25
[]
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
18,375
java
// // $Id: SpotSceneManager.java,v 1.35 2003/03/27 16:04:26 mdb Exp $ package com.threerings.whirled.spot.server; import java.awt.Point; import java.util.Iterator; import com.samskivert.util.ArrayIntSet; import com.samskivert.util.HashIntMap; import com.samskivert.util.IntIntMap; import com.samskivert.util.StringUtil; import com.threerings.presents.dobj.DObject; import com.threerings.presents.dobj.Subscriber; import com.threerings.presents.dobj.ObjectAccessException; import com.threerings.presents.server.InvocationException; import com.threerings.crowd.chat.SpeakProvider; import com.threerings.crowd.data.BodyObject; import com.threerings.crowd.data.OccupantInfo; import com.threerings.crowd.server.CrowdServer; import com.threerings.whirled.server.SceneManager; import com.threerings.whirled.spot.Log; import com.threerings.whirled.spot.data.Cluster; import com.threerings.whirled.spot.data.ClusterObject; import com.threerings.whirled.spot.data.ClusteredBodyObject; import com.threerings.whirled.spot.data.Location; import com.threerings.whirled.spot.data.Portal; import com.threerings.whirled.spot.data.SceneLocation; import com.threerings.whirled.spot.data.SpotCodes; import com.threerings.whirled.spot.data.SpotScene; import com.threerings.whirled.spot.data.SpotSceneModel; import com.threerings.whirled.spot.data.SpotSceneObject; /** * Handles the movement of bodies between locations in the scene and * creates the necessary distributed objects to allow bodies in clusters * to chat with one another. */ public class SpotSceneManager extends SceneManager implements SpotCodes { /** * Move the specified body to the default portal, if possible. */ public static void moveBodyToDefaultPortal (BodyObject body) { SpotSceneManager mgr = (SpotSceneManager) CrowdServer.plreg.getPlaceManager(body.location); if (mgr != null) { SpotScene scene = (SpotScene)mgr.getScene(); try { Location eloc = scene.getDefaultEntrance().getLocation(); mgr.handleChangeLoc(body, eloc); } catch (InvocationException ie) { Log.warning("Could not move user to default portal " + "[where=" + mgr.where() + ", who=" + body.who() + ", error=" + ie + "]."); } } } /** * Assigns a starting location for an entering body. This will happen * before the body is made to "occupy" the scene (defined by their * having an occupant info record). So when they do finally occupy the * scene, the client will know where to render them. */ public void mapEnteringBody (BodyObject body, int portalId) { _enterers.put(body.getOid(), portalId); } /** * Called if a body failed to enter our scene after we assigned them * an entering position. */ public void clearEnteringBody (BodyObject body) { _enterers.remove(body.getOid()); } /** * This is called when a user requests to traverse a portal from this * scene to another scene. The manager may return an error code string * that will be reported back to the caller explaining the failure or * <code>null</code> indicating that it is OK for the caller to * traverse the portal. */ public String mayTraversePortal (BodyObject body, Portal portal) { return null; } // documentation inherited protected void didStartup () { // get a casted reference to our place object (we need to do this // before calling super.didStartup() because that will call // sceneManagerDidResolve() which may start letting people into // the scene) _ssobj = (SpotSceneObject)_plobj; super.didStartup(); } // documentation inherited protected void gotSceneData () { super.gotSceneData(); // keep a casted reference around to our scene _sscene = (SpotScene)_scene; } // documentation inherited protected void bodyLeft (int bodyOid) { super.bodyLeft(bodyOid); // clear out their location information _ssobj.removeFromOccupantLocs(new Integer(bodyOid)); // clear any cluster they may occupy removeFromCluster(bodyOid); } // documentation inherited protected void populateOccupantInfo (OccupantInfo info, BodyObject body) { super.populateOccupantInfo(info, body); // we don't actually populate their occupant info, but instead // assign them their starting location in the scene int portalId = _enterers.remove(body.getOid()); Portal entry; if (portalId != -1) { entry = _sscene.getPortal(portalId); if (entry == null) { Log.warning("Body mapped at invalid portal [where=" + where() + ", who=" + body.who() + ", portalId=" + portalId + "]."); entry = _sscene.getDefaultEntrance(); } } else { entry = _sscene.getDefaultEntrance(); } // Log.info("Positioning entering body [who=" + body.who() + // ", where=" + entry.getOppLocation() + "]."); // create a scene location for them located on the entrance portal // but facing the opposite direction _ssobj.addToOccupantLocs( new SceneLocation(entry.getOppLocation(), body.getOid())); } /** * Called by the {@link SpotProvider} when we receive a request by a * user to occupy a particular location. * * @param source the body to be moved. * @param loc the location to which to move the body. * @param cluster if zero, a new cluster will be created and assigned * to the moving user; if -1, the moving user will be removed from any * cluster they currently occupy and not made to occupy a new cluster; * if the bodyOid of another user, the moving user will be made to * join the other user's cluster. * * @exception InvocationException thrown with a reason code explaining * the failure if there is a problem processing the request. */ protected void handleChangeLoc (BodyObject source, Location loc) throws InvocationException { // make sure they are in our scene if (!_ssobj.occupants.contains(source.getOid())) { Log.warning("Refusing change loc from non-scene occupant " + "[where=" + where() + ", who=" + source.who() + ", loc=" + loc + "]."); throw new InvocationException(INTERNAL_ERROR); } // let our derived classes decide if this is an OK place to stand if (!validateLocation(source, loc)) { throw new InvocationException(INVALID_LOCATION); } // update the user's location information in the scene which will // indicate to the client that their avatar should be moved from // its current position to their new position updateLocation(source, loc); // remove them from any cluster as they've departed removeFromCluster(source.getOid()); } /** * Derived classes can override this method and validate that the * specified body can stand in the requested location. The default * implementation returns <code>true</code> in all circumstances; * stand where ye may! */ protected boolean validateLocation (BodyObject source, Location loc) { return true; } /** * Updates the location of the specified body. */ protected void updateLocation (BodyObject source, Location loc) { SceneLocation sloc = new SceneLocation(loc, source.getOid()); if (!_ssobj.occupantLocs.contains(sloc)) { // complain if they don't already have a location configured Log.warning("Changing loc for occupant without previous loc " + "[where=" + where() + ", who=" + source.who() + ", nloc=" + loc + "]."); _ssobj.addToOccupantLocs(sloc); } else { _ssobj.updateOccupantLocs(sloc); } } /** * Called by the {@link SpotProvider} when we receive a request by a * user to join a particular cluster. * * @param joiner the body to be moved. * @param targetOid the bodyOid of another user or the oid of an * existing cluster; the moving user will be made to join the other * user's cluster. * * @exception InvocationException thrown with a reason code explaining * the failure if there is a problem processing the request. */ protected void handleJoinCluster (BodyObject joiner, int targetOid) throws InvocationException { // if the cluster already exists, add this user and be done ClusterRecord clrec = (ClusterRecord)_clusters.get(targetOid); if (clrec != null) { clrec.addBody(joiner); return; } // otherwise see if they sent us the user's oid DObject tobj = CrowdServer.omgr.getObject(targetOid); if (!(tobj instanceof BodyObject)) { Log.warning("Can't join cluster, missing target " + "[creator=" + joiner.who() + ", targetOid=" + targetOid + "]."); throw new InvocationException(NO_SUCH_CLUSTER); } // see if the friend is already in a cluster BodyObject friend = (BodyObject)tobj; clrec = getCluster(friend.getOid()); if (clrec != null) { clrec.addBody(joiner); return; } // otherwise we create a new cluster and add our charter members! clrec = new ClusterRecord(); clrec.addBody(friend); clrec.addBody(joiner); } /** * Removes the specified user from any cluster they occupy. */ protected void removeFromCluster (int bodyOid) { ClusterRecord clrec = getCluster(bodyOid); if (clrec != null) { clrec.removeBody(bodyOid); } } /** * Fetches the cluster record for the specified body. */ protected ClusterRecord getCluster (int bodyOid) { ClusteredBodyObject bobj = (ClusteredBodyObject) CrowdServer.omgr.getObject(bodyOid); return (bobj == null) ? null : (ClusterRecord)_clusters.get(bobj.getClusterOid()); } /** * Called by the {@link SpotProvider} when we receive a cluster speak * request. */ protected void handleClusterSpeakRequest ( int sourceOid, String source, String bundle, String message, byte mode) { ClusterRecord clrec = getCluster(sourceOid); if (clrec == null) { Log.warning("Non-clustered user requested cluster speak " + "[where=" + where() + ", chatter=" + source + " (" + sourceOid + "), msg=" + message + "]."); } else { SpeakProvider.sendSpeak(clrec.getClusterObject(), source, bundle, message, mode); } } /** * Returns the location of the specified body or null if they have no * location in this scene. */ protected SceneLocation locationForBody (int bodyOid) { return (SceneLocation)_ssobj.occupantLocs.get(new Integer(bodyOid)); } /** * Verifies that the specified cluster can be expanded to include * another body. */ protected boolean canAddBody (ClusterRecord clrec, BodyObject body) { return true; } /** * Called when a user is added to a cluster. The scene manager * implementation should take this opportunity to rearrange everyone * in the cluster appropriately for the new size. */ protected void bodyAdded (ClusterRecord clrec, BodyObject body) { } /** * Called when a user is removed from a cluster. The scene manager * implementation should take this opportunity to rearrange everyone * in the cluster appropriately for the new size. */ protected void bodyRemoved (ClusterRecord clrec, BodyObject body) { } /** * Used to manage clusters which are groups of users that can chat to * one another. */ protected class ClusterRecord extends HashIntMap implements Subscriber { public ClusterRecord () { CrowdServer.omgr.createObject(ClusterObject.class, this); } public boolean addBody (BodyObject body) { if (!(body instanceof ClusteredBodyObject)) { Log.warning("Refusing to add non-clustered body to cluster " + "[cloid=" + _clobj.getOid() + ", size=" + size() + ", who=" + body.who() + "]."); return false; } // if they're already in the cluster, do nothing if (containsKey(body.getOid())) { return false; } // make sure we can add this body if (!canAddBody(this, body)) { Log.info("Cluster full, refusing growth " + this + "."); return false; } put(body.getOid(), body); try { body.startTransaction(); _ssobj.startTransaction(); bodyAdded(this, body); // do the hokey pokey if (_clobj != null) { ((ClusteredBodyObject)body).setClusterOid( _clobj.getOid()); _clobj.addToOccupants(body.getOid()); _ssobj.updateClusters(_cluster); } } finally { body.commitTransaction(); _ssobj.commitTransaction(); } Log.info("Added " + body.who() + " to "+ this + "."); return true; } public void removeBody (int bodyOid) { BodyObject body = (BodyObject)remove(bodyOid); if (body == null) { Log.warning("Requested to remove unknown body from cluster " + "[cloid=" + _clobj.getOid() + ", size=" + size() + ", who=" + bodyOid + "]."); return; } try { body.startTransaction(); _ssobj.startTransaction(); ((ClusteredBodyObject)body).setClusterOid(-1); bodyRemoved(this, body); // do the hokey pokey if (_clobj != null) { _clobj.removeFromOccupants(bodyOid); _ssobj.updateClusters(_cluster); } } finally { _ssobj.commitTransaction(); body.commitTransaction(); } Log.info("Removed " + bodyOid + " from "+ this + "."); // if we've removed our last body; stick a fork in ourselves if (size() == 0) { destroy(); } } public ClusterObject getClusterObject () { return _clobj; } public Cluster getCluster () { return _cluster; } public void objectAvailable (DObject object) { // keep this feller around _clobj = (ClusterObject)object; _clusters.put(_clobj.getOid(), this); // let any mapped users know about our cluster Iterator iter = values().iterator(); while (iter.hasNext()) { ClusteredBodyObject body = (ClusteredBodyObject)iter.next(); body.setClusterOid(_clobj.getOid()); _clobj.addToOccupants(((BodyObject)body).getOid()); } // configure our cluster record and publish it _cluster.clusterOid = _clobj.getOid(); _ssobj.addToClusters(_cluster); // if we didn't manage to add our creating user when we first // started up, there's no point in our sticking around if (size() == 0) { destroy(); } } public void requestFailed (int oid, ObjectAccessException cause) { Log.warning("Aiya! Failed to create cluster object " + "[cause=" + cause + ", penders=" + size() + "]."); // let any mapped users know that we're hosed Iterator iter = values().iterator(); while (iter.hasNext()) { ClusteredBodyObject body = (ClusteredBodyObject)iter.next(); body.setClusterOid(-1); } } public String toString () { return "[cluster=" + _cluster + ", size=" + size() + "]"; } protected void destroy () { Log.info("Cluster empty, going away " + "[cloid=" + _clobj.getOid() + "]."); _ssobj.removeFromClusters(_cluster.getKey()); _clusters.remove(_clobj.getOid()); CrowdServer.omgr.destroyObject(_clobj.getOid()); } protected ClusterObject _clobj; protected Cluster _cluster = new Cluster(); } /** A casted reference to our place object. */ protected SpotSceneObject _ssobj; /** A casted reference to our scene instance. */ protected SpotScene _sscene; /** Records with information on all clusters in this scene. */ protected HashIntMap _clusters = new HashIntMap(); /** A mapping of entering bodies to portal ids. */ protected IntIntMap _enterers = new IntIntMap(); }
c7644260d4e65e90287dbb0f229498a60ee0b55f
9b5ca743c5965db47b7956b8d078c91dd4400d1b
/trunk/UniDroid-1.0_20-08-13/gen/br/com/bigdogsoftware/unidroid/R.java
3ea0a3d235855062e7679092bddd3e34ff10a744
[]
no_license
BGCX067/fact-net-svn-to-git
ef85260e3e7bb9e32c1f5fb994f43fee20a5e9e0
abe9f4c0ef881bc2c6aa044b8b28e80835341749
refs/heads/master
2016-09-01T08:55:49.151284
2015-12-28T14:26:54
2015-12-28T14:26:54
48,758,349
0
0
null
null
null
null
UTF-8
Java
false
false
2,841
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package br.com.bigdogsoftware.unidroid; public final class R { public static final class attr { } public static final class dimen { /** Default screen margins, per the Android Design guidelines. Customize dimensions originally defined in res/values/dimens.xml (such as screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. */ public static final int activity_horizontal_margin=0x7f040000; public static final int activity_vertical_margin=0x7f040001; } public static final class drawable { public static final int ic_launcher=0x7f020000; } public static final class id { public static final int action_settings=0x7f080006; public static final int btnCadastrar=0x7f080005; public static final int btnLogin=0x7f080004; public static final int lblMatricula=0x7f080000; public static final int lblSenha=0x7f080002; public static final int txtMatricula=0x7f080001; public static final int txtSenha=0x7f080003; } public static final class layout { public static final int activity_main=0x7f030000; } public static final class menu { public static final int main=0x7f070000; } public static final class string { public static final int action_settings=0x7f050001; public static final int app_name=0x7f050000; public static final int hello_world=0x7f050002; } public static final class style { /** Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. API 11 theme customizations can go here. Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. API 14 theme customizations can go here. */ public static final int AppBaseTheme=0x7f060000; /** Application theme. All customizations that are NOT specific to a particular API-level can go here. */ public static final int AppTheme=0x7f060001; } }
5a7de284a4267e37bd6631b35e3322540ca3c69b
9a028282395b902f261fdf058139092ddba00ba0
/src/main/java/com/arcosoft/arcLogChef/dto/GenericResponse.java
a6d05d71b6780f0c61964a7ad42c0ee7290b18fc
[]
no_license
prince-gupta/arcLogChef
763ce9e731ef01f5531fc48fd036d64183fbfc5f
659309b5b6b907860b12c3538acc1d11accb1a97
refs/heads/master
2021-09-01T04:31:05.701717
2017-12-06T20:46:33
2017-12-06T20:46:33
111,462,648
0
0
null
null
null
null
UTF-8
Java
false
false
506
java
package com.arcosoft.arcLogChef.dto; import java.util.HashMap; import java.util.Map; /** * Created by princegupta on 19/11/17. */ public class GenericResponse { String status; Map data = new HashMap(); public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public Map getData() { return data; } public void addData(String key, Object data) { this.data.put(key, data); } }
e7d2a018bd06a45927633142a0996b3bb398eaf5
eab084584e34ec065cd115139c346180e651c1c2
/src/test/java/v1/t0/T87Test.java
13f323744399629d65411685e0796836191164c7
[]
no_license
zhouyuan93/leetcode
5396bd3a01ed0f127553e1e175bb1f725d1c7919
cc247bc990ad4d5aa802fc7a18a38dd46ed40a7b
refs/heads/master
2023-05-11T19:11:09.322348
2023-05-05T09:12:53
2023-05-05T09:12:53
197,735,845
0
0
null
2020-04-05T09:17:34
2019-07-19T08:38:17
Java
UTF-8
Java
false
false
1,342
java
package v1.t0; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; class T87Test { T87 t; @BeforeEach void setUp() { t = new T87(); } @Test void test_1() { String s1 = "great"; String s2 = "rgeat"; boolean actual = t.isScramble(s1, s2); boolean expected = true; assertEquals(expected,actual); } @Test void test_2() { String s1 = "abcde"; String s2 = "caebd"; boolean actual = t.isScramble(s1, s2); boolean expected = false; assertEquals(expected,actual); } @Test void test_3() { String s1 = "a"; String s2 = "a"; boolean actual = t.isScramble(s1, s2); boolean expected = true; assertEquals(expected,actual); } @Test void test_4() { String s1 = "a"; String s2 = "b"; boolean actual = t.isScramble(s1, s2); boolean expected = false; assertEquals(expected, actual); } @Test void test_5() { String s1 = "eebaacbcbcadaaedceaaacadccd"; String s2 = "eadcaacabaddaceacbceaabeccd"; boolean actual = t.isScramble(s1, s2); boolean expected = false; assertEquals(expected, actual); } }
1e67839433dea96ab71dd42f53c965a0958f8762
e096c758789d6091351d922a8f30f6f6fa5ed60c
/src/com/nv/youNeverWait/user/bl/impl/AppointmentListOfToday.java
6f3ce7d931ffb80b950bc3aba9c3c17987475bde
[]
no_license
netvarth/netmdportal
0487f5221bdc6f7a0e9156f96d122dcea42ff191
a60171d76e82b02fbf074db4a7dd2814a10d0866
refs/heads/master
2021-03-16T09:54:50.043949
2016-08-04T10:53:34
2016-08-04T10:53:34
63,756,828
0
0
null
null
null
null
UTF-8
Java
false
false
1,658
java
/** * AppointmentListOfToday.java */ package com.nv.youNeverWait.user.bl.impl; import java.util.ArrayList; import java.util.List; import com.nv.youNeverWait.pl.entity.PatientAppointmentTbl; import com.nv.youNeverWait.rs.dto.AppointmentsDTO; import com.nv.youNeverWait.user.bl.service.AppointmentGroup; import com.nv.youNeverWait.user.pl.dao.AppointmentDao; public class AppointmentListOfToday implements AppointmentGroup { private AppointmentDao appointmentDao; /** * get name of the appointment type */ @Override public String getName() { return "AppointmentListOfToday"; } /** * get appointment list * @return AppointmentsDTO list */ @Override public List<AppointmentsDTO> getAppointmentList(String patientId) { List<PatientAppointmentTbl> patientAppointmentTblList = appointmentDao .getAppointmentsForTheDay(patientId); return getAppointmentList(patientAppointmentTblList); } private List<AppointmentsDTO> getAppointmentList( List<PatientAppointmentTbl> patientAppointmentTblList) { List<AppointmentsDTO> appointmentDTOList = new ArrayList<AppointmentsDTO>(); for (PatientAppointmentTbl patientAppointmentTbl : patientAppointmentTblList) { appointmentDTOList.add(new AppointmentsDTO(patientAppointmentTbl)); } return appointmentDTOList; } /** * @return the appointmentDao */ public AppointmentDao getAppointmentDao() { return appointmentDao; } /** * @param appointmentDao the appointmentDao to set */ public void setAppointmentDao(AppointmentDao appointmentDao) { this.appointmentDao = appointmentDao; } }
[ "manikandan@33b5678d-7e6b-764b-8695-d616d715c8b5" ]
manikandan@33b5678d-7e6b-764b-8695-d616d715c8b5
32b70955df0604fe2a68cad615a7bd3723875d3a
1b7f926440ec06ee9aa12e1d2058433c3d69e5b9
/src/main/java/com/vaadin/chartwebinar/backend/TemperatureReading.java
c97b7d4187bb5257cdb9aa644a9e815dd8a5813d
[]
no_license
mstahv/chartswebinar-feb-2014
3a922a46605d456cd67b97cab7f0061d6d50f159
4c67cc5847c9ea81b1abf7541875bfb77252d4a1
refs/heads/master
2021-01-19T22:02:04.380246
2014-02-12T18:53:45
2014-02-12T18:53:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
898
java
package com.vaadin.chartwebinar.backend; import java.util.Date; import javax.enterprise.context.ApplicationScoped; @ApplicationScoped public class TemperatureReading { private Date date; private Integer temperature; private MeasurementPlace place; public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } public Integer getTemperature() { return temperature; } public void setTemperature(Integer temperature) { this.temperature = temperature; } public MeasurementPlace getPlace() { return place; } public void setPlace(MeasurementPlace place) { this.place = place; } @Override public String toString() { return "TemperatureReading{" + "date=" + date + ", temperature=" + temperature + ", place=" + place + '}'; } }
1acc188becf2d0af52187fcffc8b220c672af891
68a6eb56e5c32b1ef2bf27b8fbd2f73f68195816
/MovieManagement/src/controllers/Movie_Details_pt2.java
89f9488fa8eb5b0d5a715848400257fbf92e234b
[]
no_license
kedar700/dexprojects
d14ea0b733344943c31ebde054c702b94ef6fa9a
9a1921c671d80917ddd32fa6d6d83127d3df7b92
refs/heads/master
2021-01-09T06:33:46.210127
2017-12-17T06:10:05
2017-12-17T06:10:05
81,008,816
1
0
null
null
null
null
UTF-8
Java
false
false
1,045
java
package controllers; import javafx.beans.property.SimpleDoubleProperty; import javafx.beans.property.SimpleStringProperty; /** * * @author Kedar Naresh Naik * @since 2016-12-02 * */ public class Movie_Details_pt2 { private final SimpleStringProperty movie_name; private final SimpleStringProperty movie_desc; private final SimpleDoubleProperty movie_rating; // private final SimpleStringProperty movie_date; // private final SimpleStringProperty movie_Time; /** * * @param name the name of the movie. * @param descrip the description of the movie. * @param rating the rating for the movie. */ Movie_Details_pt2(String name, String descrip, Double rating) { this.movie_name = new SimpleStringProperty(name); this.movie_desc = new SimpleStringProperty(descrip); this.movie_rating = new SimpleDoubleProperty(rating); } public String getMovie_name() { return movie_name.get(); } public String getMovie_desc() { return movie_desc.get(); } public double getMovie_rating() { return movie_rating.get(); } }
e737b8927b3c1effe22418ab74c824529b0d3909
44579db3e94e99e5f2762a36d03f4c67b8120578
/app/src/main/java/com/example/gabarty/medicineapplication/Interfaces/EditSupplierInterface.java
58c40dacc24c64becf49510d3a824b5597b6408e
[]
no_license
OmarNabiiil/MedicineApplication
d39cf0122a6b490f9cd7a0875eb43e1560220fa9
11ca7d57d376d42427c132e007b5fd17ea6e6b31
refs/heads/master
2020-04-13T19:44:10.636590
2018-12-28T13:04:22
2018-12-28T13:04:22
163,411,334
0
0
null
null
null
null
UTF-8
Java
false
false
218
java
package com.example.gabarty.medicineapplication.Interfaces; import com.example.gabarty.medicineapplication.classes.Supplier; public interface EditSupplierInterface { public void onEditClick(Supplier s); }
cb0e6016fd941093cdf4bdd7721048b9cf22afe1
b68cd54c142ca8328bec3b6f68218efa66b52af4
/src/gloop/graphics/data/models/VertexBufferManager.java
b1fb509e6bf68432258a86931232e844bb74cffb
[]
no_license
leefogg/GLOOP
99f374a405f79de4196f95c54b3d82e82f3423f6
4d66ff5c48863c07c99d953e78065d6a0b84a373
refs/heads/master
2021-04-03T10:30:43.571974
2020-11-14T22:01:34
2020-11-14T22:01:34
124,439,619
3
0
null
2018-05-31T20:37:38
2018-03-08T19:42:52
Java
UTF-8
Java
false
false
828
java
package gloop.graphics.data.models; import org.lwjgl.BufferUtils; import org.lwjgl.opengl.GL15; import java.nio.IntBuffer; import java.util.HashSet; public abstract class VertexBufferManager { private static final HashSet<VertexBuffer> VBOS = new HashSet<>(); static void register(VertexBuffer vbo) { VBOS.add(vbo); } static void unregister(VertexBuffer vbo) { VBOS.remove(vbo); } static void deleteVBO(int ID) { GL15.glDeleteBuffers(ID); } public static int getVBOCount() { return VBOS.size(); } public static void cleanup() { System.out.println("Deleting " + VBOS.size() + " VBOs.."); IntBuffer vaoIDs = BufferUtils.createIntBuffer(VBOS.size()); for (VertexBuffer vao : VBOS) vaoIDs.put(vao.getID()); vaoIDs.flip(); GL15.glDeleteBuffers(vaoIDs); VBOS.clear(); // Unregister all } }
dd9e13d108cb8a67a3bf86ed44eb95d61cfe9f9b
6f1725745d215ec703a7df13f234d041047283e2
/giraph-core/src/main/java/org/apache/giraph/comm/netty/handler/.svn/text-base/RequestEncoder.java.svn-base
4e739cb1a32d8e1c2869d701845a57029f2ba238
[ "Apache-2.0" ]
permissive
huangshengbin426/subgraph-listing
b8fab259ea3b33d667ba610ff66d5d7cf5078a1e
cd9d87f21454a7c96acfffee53d464d8417970f6
refs/heads/master
2021-01-19T21:58:06.017848
2017-02-20T11:26:18
2017-02-20T11:26:18
82,549,667
0
1
null
null
null
null
UTF-8
Java
false
false
4,726
/* * 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.giraph.comm.netty.handler; import org.apache.giraph.comm.requests.WritableRequest; import org.apache.giraph.conf.GiraphConfiguration; import org.apache.giraph.conf.GiraphConstants; import org.apache.giraph.time.SystemTime; import org.apache.giraph.time.Time; import org.apache.giraph.time.Times; import org.apache.log4j.Logger; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBufferOutputStream; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; import org.jboss.netty.handler.codec.oneone.OneToOneEncoder; /** * Requests have a request type and an encoded request. */ public class RequestEncoder extends OneToOneEncoder { /** Time class to use */ private static final Time TIME = SystemTime.get(); /** Class logger */ private static final Logger LOG = Logger.getLogger(RequestEncoder.class); /** Holds the place of the message length until known */ private static final byte[] LENGTH_PLACEHOLDER = new byte[4]; /** Buffer starting size */ private final int bufferStartingSize; /** Whether or not to use direct byte buffers */ private final boolean useDirectBuffers; /** Start nanoseconds for the encoding time */ private long startEncodingNanoseconds = -1; /** * Constructor. * * @param conf Giraph configuration */ public RequestEncoder(GiraphConfiguration conf) { bufferStartingSize = conf.getInt( GiraphConstants.NETTY_REQUEST_ENCODER_BUFFER_SIZE, GiraphConstants.NETTY_REQUEST_ENCODER_BUFFER_SIZE_DEFAULT); useDirectBuffers = conf.getBoolean( GiraphConstants.NETTY_REQUEST_ENCODER_USE_DIRECT_BUFFERS, GiraphConstants.NETTY_REQUEST_ENCODER_USE_DIRECT_BUFFERS_DEFAULT); } @Override protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { if (!(msg instanceof WritableRequest)) { throw new IllegalArgumentException( "encode: Got a message of type " + msg.getClass()); } // Encode the request if (LOG.isDebugEnabled()) { startEncodingNanoseconds = TIME.getNanoseconds(); } WritableRequest writableRequest = (WritableRequest) msg; int requestSize = writableRequest.getSerializedSize(); ChannelBuffer channelBuffer; if (requestSize == WritableRequest.UNKNOWN_SIZE) { channelBuffer = ChannelBuffers.dynamicBuffer( bufferStartingSize, ctx.getChannel().getConfig().getBufferFactory()); } else { requestSize += LENGTH_PLACEHOLDER.length + 1; channelBuffer = useDirectBuffers ? ChannelBuffers.directBuffer(requestSize) : ChannelBuffers.buffer(requestSize); } ChannelBufferOutputStream outputStream = new ChannelBufferOutputStream(channelBuffer); outputStream.write(LENGTH_PLACEHOLDER); outputStream.writeByte(writableRequest.getType().ordinal()); try { writableRequest.write(outputStream); } catch (IndexOutOfBoundsException e) { LOG.error("encode: Most likely the size of request was not properly " + "specified - see getSerializedSize() in " + writableRequest.getType().getRequestClass()); throw new IllegalStateException(e); } outputStream.flush(); outputStream.close(); // Set the correct size at the end ChannelBuffer encodedBuffer = outputStream.buffer(); encodedBuffer.setInt(0, encodedBuffer.writerIndex() - 4); if (LOG.isDebugEnabled()) { LOG.debug("encode: Client " + writableRequest.getClientId() + ", " + "requestId " + writableRequest.getRequestId() + ", size = " + encodedBuffer.writerIndex() + ", " + writableRequest.getType() + " took " + Times.getNanosSince(TIME, startEncodingNanoseconds) + " ns"); } return encodedBuffer; } }
d85239d9d36182b1233c20caf54ed176cf2e7eec
3c2739ebd6c02956728a6516b9a9dbe1aad4c557
/app/src/test/java/com/example/billsplitter/ExampleUnitTest.java
ba7c4c7f2ad5dbfe8369d75bb5dba4e279ade0d6
[]
no_license
Andrew-Cutlip/Bill-Splitter
9a456389e069ef03b7ecd98f902d1ccb9571cb65
c46820634febf59ddd353337fae02ac98b0b5a12
refs/heads/master
2022-11-29T07:58:57.155803
2020-08-02T04:39:13
2020-08-02T04:39:13
284,391,553
1
0
null
null
null
null
UTF-8
Java
false
false
385
java
package com.example.billsplitter; 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); } }
c06eb4c3fe183bd9797b6d5e7bb1b6e391289fc5
5f442d2acfbf4473448dec9de6cf4e6cac364880
/src/main/java/edu/upc/eetac/dsa/acouceiro/libros/api/MediaType.java
432a8fa6a30277030637d03aa61757b67b22032b
[]
no_license
adricouci/libros
5f9b472f2b479132010fa7fcf7737363bf23dc3c
9ecae5f5882bf0a617061c8a806f8fabba6a839c
refs/heads/master
2020-06-04T05:39:03.363140
2015-03-24T11:02:02
2015-03-24T11:02:02
32,793,274
0
0
null
null
null
null
UTF-8
Java
false
false
863
java
package edu.upc.eetac.dsa.acouceiro.libros.api; public class MediaType { public final static String LIBRO_API_USUARIOS = "application/vnd.libros.api.usuarios+json"; public final static String LIBRO_API_LIBROS = "application/vnd.libros.api.libros+json"; public final static String LIBRO_API_LIBROS_COLLECTION = "application/vnd.libros.api.libros.collection+json"; public final static String LIBRO_API_AUTORES = "application/vnd.libros.api.autores+json"; public final static String LIBRO_API_AUTORES_COLLECTION = "application/vnd.libros.api.autores.collection+json"; public final static String LIBRO_API_RESENA = "application/vnd.libros.api.resena+json"; public final static String LIBRO_API_RESENA_COLLECTION = "application/vnd.libros.api.resena.collection+json"; public final static String LIBRO_API_ERROR = "application/vnd.dsa.libros.error+json"; }
[ "K55@Asus" ]
K55@Asus
7e174228d1e3677bc8029aeea83e8d46f361a300
bff449a67bde60eb42d58b6e81d592bccada40e5
/InventoryBusiness/srv-impl/com/viettel/bccs/inventory/service/BaseIsdn/BaseStockIsdnExpService.java
c0521c873519b3750ba8875df6e4daa94dfc80b2
[]
no_license
tiendat182/IM_UNITTEST
923be43427e2c47446462fef2c0d944bb7f9acce
2eb4b9c11e236d09044b41dabf9529dc295cb476
refs/heads/master
2021-07-19T09:36:51.341386
2017-10-25T14:26:33
2017-10-25T14:26:33
108,283,748
0
0
null
null
null
null
UTF-8
Java
false
false
19,282
java
package com.viettel.bccs.inventory.service.BaseIsdn; import com.google.common.collect.Lists; import com.viettel.bccs.im1.service.StockIsdnIm1Service; import com.viettel.bccs.inventory.common.Const; import com.viettel.bccs.inventory.dto.*; import com.viettel.bccs.inventory.repo.StockTransRepo; import com.viettel.bccs.inventory.service.BaseStock.BaseStockService; import com.viettel.bccs.inventory.service.BaseStock.BaseValidateService; import com.viettel.bccs.inventory.service.*; import com.viettel.fw.Exception.LogicException; import com.viettel.fw.common.util.DataUtil; import com.viettel.fw.common.util.DbUtil; import com.viettel.fw.common.util.ErrorCode; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; import java.math.BigInteger; import java.util.List; /** * Created by thetm1 on 9/12/2015. * Description Xuat kho (da lap phieu xuat) * Detail + Update stock_trans * + Khong luu stock_trans_detail (-) * + Insert stock_trans_action * + Khong luu stock_trans_serial (-) * + Khong cap nhat stock_total (-) * + Khong cap nhat chi tiet serial (doSaveStockGoods) (-) */ @Service public class BaseStockIsdnExpService extends BaseStockService { public static final Logger logger = Logger.getLogger(BaseStockIsdnExpService.class); @PersistenceContext(unitName = Const.PERSISTENT_UNIT.BCCS_IM) private EntityManager em; @PersistenceContext(unitName = Const.PERSISTENT_UNIT.BCCS_IM_LIB) private EntityManager em1; @Autowired private OptionSetValueService optionSetValueService; @Autowired private BaseValidateService baseValidateService; @Autowired private ReasonService reasonService; @Autowired private ShopService shopService; @Autowired private NumberActionService numberActionService; @Autowired private NumberActionDetailService numberActionDetailService; @Autowired private StockIsdnTransService stockIsdnTransService; @Autowired private StockIsdnTransDetailService stockIsdnTransDetailService; @Autowired private StockTransService stockTransService; @Autowired private StockTransRepo stockTransRepo; @Autowired private StockIsdnIm1Service stockIsdnIm1Service; @Override public void doPrepareData(StockTransDTO stockTransDTO, StockTransActionDTO stockTransActionDTO, FlagStockDTO flagStockDTO) throws Exception { //Cap nhat trang thai giao dich la lap lenh xuat // sinhhv sua theo anh bac chuyen tu 3 -> 6 stockTransDTO.setStatus(Const.STOCK_TRANS_STATUS.IMPORTED); stockTransActionDTO.setStatus(Const.STOCK_TRANS_STATUS.IMPORTED); stockTransDTO.setIsAutoGen(null); stockTransDTO.setTransport(null); //cap nhat kho xuat stock_number flagStockDTO.setOldStatus(Const.STOCK_GOODS.STATUS_NEW); flagStockDTO.setNewStatus(Const.STOCK_GOODS.STATUS_NEW); //xoa note trong xuat kho stockTransDTO.setNote(null); } @Override public void doValidate(StockTransDTO stockTransDTO, StockTransActionDTO stockTransActionDTO, List<StockTransDetailDTO> lstStockTransDetail) throws LogicException, Exception { //Validate cac truong trong giao dich doOrderValidate(stockTransDTO); //Validate ky voffice baseValidateService.doSignVofficeValidate(stockTransDTO); } public void doOrderValidate(StockTransDTO stockTransDTO) throws LogicException, Exception { //1. Validate kho xuat if (DataUtil.isNullOrZero(stockTransDTO.getFromOwnerId()) || DataUtil.isNullOrZero(stockTransDTO.getFromOwnerType())) { throw new LogicException(ErrorCode.ERROR_USER.ERROR_USER_INVALID_FORMAT, "transfer.isdn.from.stock.not.null"); } ShopDTO fromShop = shopService.findOne(stockTransDTO.getFromOwnerId()); if (DataUtil.isNullObject(fromShop) || !fromShop.getStatus().equals(Const.STATUS_ACTIVE)) { throw new LogicException(ErrorCode.ERROR_USER.ERROR_USER_INVALID_FORMAT, "transfer.isdn.from.stock.invalid"); } if (DataUtil.isNullObject(fromShop.getChannelTypeId())) { throw new LogicException(ErrorCode.ERROR_USER.ERROR_USER_INVALID_FORMAT, "transfer.isdn.deliver.stock.chanel.null"); } //2. Validate kho nhan if (DataUtil.isNullOrZero(stockTransDTO.getToOwnerId()) || DataUtil.isNullOrZero(stockTransDTO.getToOwnerType())) { throw new LogicException(ErrorCode.ERROR_USER.ERROR_USER_INVALID_FORMAT, "transfer.isdn.to.stock.not.null"); } ShopDTO toShop = shopService.findOne(stockTransDTO.getToOwnerId()); if (DataUtil.isNullObject(toShop) || !toShop.getStatus().equals(Const.STATUS_ACTIVE)) { throw new LogicException(ErrorCode.ERROR_USER.ERROR_USER_INVALID_FORMAT, "transfer.isdn.to.stock.invalid"); } // // List<VShopStaffDTO> importShopList = shopService.getListShopStaff(stockTransDTO.getToOwnerId(), stockTransDTO.getToOwnerType().toString(), Const.VT_UNIT.VT); // if (DataUtil.isNullOrEmpty(importShopList)) { // throw new LogicException(ErrorCode.ERROR_USER.ERROR_USER_INVALID_FORMAT, "stockTrans.validate.toStock.notExists"); // } if (DataUtil.safeEqual(stockTransDTO.getFromOwnerId(), stockTransDTO.getToOwnerId())) { throw new LogicException(ErrorCode.ERROR_USER.ERROR_USER_INVALID_FORMAT, "stockTrans.validate.fromtoStock.equal"); } //4. kiem tra ly do co ton tai khong if (DataUtil.isNullOrZero(stockTransDTO.getReasonId())) { throw new LogicException(ErrorCode.ERROR_USER.ERROR_USER_INVALID_FORMAT, "create.note.reason.export.require.msg"); } ReasonDTO reason = reasonService.findOne(stockTransDTO.getReasonId()); if (DataUtil.isNullObject(reason) || DataUtil.isNullOrZero(reason.getReasonId())) { throw new LogicException(ErrorCode.ERROR_USER.ERROR_USER_INVALID_FORMAT, "stockTrans.validate.reason.notExists"); } //5. kiem tra ghi chu co thoa man khong if (!DataUtil.isNullOrEmpty(stockTransDTO.getNote()) && stockTransDTO.getNote().length() > 500) { throw new LogicException(ErrorCode.ERROR_USER.ERROR_USER_INVALID_FORMAT, "stockTrans.validate.note.overLength"); } //6. kiem tra trang thai phieu StockTransDTO stockCheck = stockTransService.findOne(stockTransDTO.getStockTransId()); if (DataUtil.isNullObject(stockCheck) || DataUtil.isNullObject(stockCheck.getStatus()) || !stockCheck.getStatus().equals(Const.STOCK_TRANS_STATUS.EXPORT_NOTE)) { throw new LogicException(ErrorCode.ERROR_USER.ERROR_USER_INVALID_FORMAT, "transfer.isdn.status.invalid"); } } @Override public void doSaveStockTransDetail(StockTransDTO stockTransDTO, List<StockTransDetailDTO> lstStockTransDetail) throws Exception { } @Override public void doSaveStockTransSerial(StockTransDTO stockTransDTO, List<StockTransDetailDTO> lstStockTransDetail) throws Exception { } @Override public void doSaveStockTotal(StockTransDTO stockTransDTO, List<StockTransDetailDTO> lstStockTransDetailDTO, FlagStockDTO flagStockDTO, StockTransActionDTO stockTransActionDTO) throws Exception { } @Override public void doSaveStockGoods(StockTransDTO stockTransDTO, List<StockTransDetailDTO> lstStockTransDetail, FlagStockDTO flagStockDTO) throws LogicException, Exception { if (DataUtil.isNullOrZero(flagStockDTO.getOldStatus()) || DataUtil.isNullOrZero(flagStockDTO.getNewStatus())) { return; } int count; BigInteger fromIsdn; BigInteger toIsdn; List<StockIsdnTransDTO> lstStockTransIsdn = Lists.newArrayList(); List<StockIsdnTransDetailDTO> lstStockTransIsdnDetail = Lists.newArrayList(); for (StockTransDetailDTO stockTransDetail : lstStockTransDetail) { String tableName = stockTransDetail.getTableName(); if (DataUtil.isNullOrEmpty(tableName)) { continue; } //them vao bang stock_isdn_trans StockIsdnTransDTO stockIsdnTransDTO = new StockIsdnTransDTO(); Long stockIsdnTransId = DbUtil.getSequence(em, "STOCK_ISDN_TRANS_SEQ"); String code = genCode(stockIsdnTransId); stockIsdnTransDTO.setStockIsdnTransCode(code); stockIsdnTransDTO.setFromOwnerType(DataUtil.safeToLong(stockTransDTO.getFromOwnerType())); stockIsdnTransDTO.setFromOwnerId(DataUtil.safeToLong(stockTransDTO.getFromOwnerId())); stockIsdnTransDTO.setFromOwnerCode(stockTransDTO.getFromOwnerCode()); stockIsdnTransDTO.setFromOwnerName(stockTransDTO.getFromOwnerName()); stockIsdnTransDTO.setToOwnerType(stockTransDTO.getToOwnerType()); stockIsdnTransDTO.setToOwnerId(stockTransDTO.getToOwnerId()); stockIsdnTransDTO.setToOwnerName(stockTransDTO.getToOwnerName()); stockIsdnTransDTO.setToOwnerCode(stockTransDTO.getToOwnerCode()); stockIsdnTransDTO.setStatus(DataUtil.safeToLong(Const.STATUS_ACTIVE)); stockIsdnTransDTO.setReasonId(stockTransDTO.getReasonId()); stockIsdnTransDTO.setQuantity(stockTransDetail.getQuantity()); stockIsdnTransDTO.setStockTypeId(stockTransDetail.getProdOfferTypeId()); stockIsdnTransDTO.setStockTypeName(stockTransDetail.getTableName()); stockIsdnTransDTO.setReasonName(stockTransDTO.getReasonName()); stockIsdnTransDTO.setReasonCode(stockTransDTO.getReasonCode()); stockIsdnTransDTO.setCreatedTime(DbUtil.getSysDate(em)); stockIsdnTransDTO.setCreatedUserId(stockTransDTO.getStaffId()); stockIsdnTransDTO.setCreatedUserCode(stockTransDTO.getUserCreate()); stockIsdnTransDTO.setCreatedUserName(stockTransDTO.getUserName()); stockIsdnTransDTO.setCreatedUserIp(stockTransDTO.getCreateUserIpAdress()); stockIsdnTransDTO.setLastUpdatedTime(DbUtil.getSysDate(em)); stockIsdnTransDTO.setLastUpdatedUserId(stockTransDTO.getStaffId()); stockIsdnTransDTO.setLastUpdatedUserCode(stockTransDTO.getUserCreate()); stockIsdnTransDTO.setLastUpdatedUserName(stockTransDTO.getUserName()); stockIsdnTransDTO.setLastUpdatedUserIp(stockTransDTO.getCreateUserIpAdress()); stockIsdnTransDTO = stockIsdnTransService.create(stockIsdnTransDTO); StringBuilder sqlUpdate = new StringBuilder(""); sqlUpdate.append("UPDATE stock_number "); sqlUpdate.append(" SET "); sqlUpdate.append(" owner_type = #newOwnerType "); sqlUpdate.append(" ,owner_id = #newOwnerId "); sqlUpdate.append(" ,last_update_user = #last_update_user "); sqlUpdate.append(" ,last_update_ip_address = #last_update_ip_address "); sqlUpdate.append(" ,last_update_time = sysdate "); sqlUpdate.append(" WHERE prod_offer_id = #prod_offer_id "); sqlUpdate.append(" AND owner_type = #oldOwnerType "); sqlUpdate.append(" AND owner_id = #oldOwnerId "); sqlUpdate.append("AND to_number(isdn) >= #fromIsdn "); sqlUpdate.append("AND to_number(isdn) <= #toIsdn "); sqlUpdate.append("AND status = #status "); List<StockTransSerialDTO> lstStockTransSerial = stockTransDetail.getLstStockTransSerial(); if (!DataUtil.isNullOrEmpty(lstStockTransSerial)) { for (StockTransSerialDTO stockTransSerial : lstStockTransSerial) { fromIsdn = new BigInteger(stockTransSerial.getFromSerial()); toIsdn = new BigInteger(stockTransSerial.getToSerial()); //cap nhat stock_number Query query = em.createNativeQuery(sqlUpdate.toString()); query.setParameter("newOwnerType", stockTransDTO.getToOwnerType()); query.setParameter("newOwnerId", stockTransDTO.getToOwnerId()); query.setParameter("last_update_user", stockTransDTO.getUserCreate()); query.setParameter("last_update_ip_address", stockTransDTO.getCreateUserIpAdress()); query.setParameter("prod_offer_id", stockTransDetail.getProdOfferId()); query.setParameter("oldOwnerType", stockTransDTO.getFromOwnerType()); query.setParameter("oldOwnerId", stockTransDTO.getFromOwnerId()); query.setParameter("fromIsdn", fromIsdn); query.setParameter("toIsdn", toIsdn); query.setParameter("status", Const.STATUS_ACTIVE); count = query.executeUpdate(); //them log vao number_action NumberActionDTO action = new NumberActionDTO(); action.setFromIsdn(fromIsdn.toString()); action.setTelecomServiceId(stockTransDetail.getProdOfferTypeId()); action.setToIsdn(toIsdn.toString()); action.setActionType(Const.NUMBER_ACTION_TYPE.DISTRIBUTE); action.setUserCreate(stockTransDTO.getUserCreate()); action.setUserIpAddress(stockTransDTO.getCreateUserIpAdress()); action.setReasonId(stockTransDTO.getReasonId()); action.setNote(stockTransDTO.getNote()); action.setCreateDate(DbUtil.getSysDate(em)); NumberActionDTO numberAction = numberActionService.create(action); //them log thay doi owner_type vao number_action_detail NumberActionDetailDTO detailOwnerType = new NumberActionDetailDTO(); detailOwnerType.setNumberActionId(numberAction.getNumberActionId()); detailOwnerType.setColumnName("OWNER_TYPE"); detailOwnerType.setOldValue(stockTransDTO.getFromOwnerType().toString()); detailOwnerType.setNewValue(stockTransDTO.getToOwnerType().toString()); detailOwnerType.setOldDetailValue(stockTransDTO.getFromOwnerType().toString()); detailOwnerType.setNewDetailValue(stockTransDTO.getToOwnerType().toString()); //them log thay doi owner_id vao number_action_detail numberActionDetailService.create(detailOwnerType); NumberActionDetailDTO detailOwnerId = new NumberActionDetailDTO(); detailOwnerId.setNumberActionId(numberAction.getNumberActionId()); detailOwnerId.setColumnName("OWNER_ID"); detailOwnerId.setOldValue(stockTransDTO.getFromOwnerId().toString()); detailOwnerId.setNewValue(stockTransDTO.getToOwnerId().toString()); detailOwnerId.setOldDetailValue(stockTransDTO.getFromOwnerCode() + "-" + stockTransDTO.getFromOwnerName()); detailOwnerId.setNewDetailValue(stockTransDTO.getToOwnerCode() + "-" + stockTransDTO.getToOwnerName()); numberActionDetailService.create(detailOwnerId); //them vao bang stock_isdn_trans_detail StockIsdnTransDetailDTO stockIsdnTransDetailDTO = new StockIsdnTransDetailDTO(); stockIsdnTransDetailDTO.setStockIsdnTransId(stockIsdnTransDTO.getStockIsdnTransId()); stockIsdnTransDetailDTO.setFromIsdn(fromIsdn.toString()); stockIsdnTransDetailDTO.setToIsdn(toIsdn.toString()); stockIsdnTransDetailDTO.setQuantity(stockTransSerial.getQuantity()); stockIsdnTransDetailDTO.setCreatedTime(DbUtil.getSysDate(em)); stockIsdnTransDetailService.create(stockIsdnTransDetailDTO); //clone bean StockIsdnTransDetailDTO to sync im1 StockIsdnTransDetailDTO stockIsdnTransDetailDTO1 = DataUtil.cloneBean(stockIsdnTransDetailDTO); stockIsdnTransDetailDTO1.setStockIsdnTransId(stockIsdnTransId); lstStockTransIsdnDetail.add(stockIsdnTransDetailDTO1); if (count != (toIsdn.subtract(fromIsdn).intValue() + 1)) { throw new LogicException(ErrorCode.ERROR_USER.ERROR_USER_INVALID_FORMAT, "stockTrans.validate.quantity.serial.detail"); } } } StockIsdnTransDTO stockIsdnTransDTO1 = DataUtil.cloneBean(stockIsdnTransDTO); //clone bean StockIsdnTransDetailDTO to sync im1 stockIsdnTransDTO1.setStockIsdnTransId(stockIsdnTransId); if (!DataUtil.isNullObject(stockTransDetail.getProdOfferTypeId())) { if (stockTransDetail.getProdOfferTypeId().equals(Const.PRODUCT_OFFER_TYPE.MOBILE)) { stockIsdnTransDTO1.setStockTypeName("STOCK_ISDN_MOBILE"); } else if (stockTransDetail.getProdOfferTypeId().equals(Const.PRODUCT_OFFER_TYPE.HP)) { stockIsdnTransDTO1.setStockTypeName("STOCK_ISDN_HOMEPHONE"); } else { stockIsdnTransDTO1.setStockTypeName("STOCK_ISDN_PSTN"); } } else { throw new LogicException("", "export.isdn.has.error.im1"); } lstStockTransIsdn.add(stockIsdnTransDTO1); } //dong bo voi im1 try { List<OptionSetValueDTO> lstConfigEnableBccs1 = optionSetValueService.getByOptionSetCode("ENABLE_UPDATE_BCCS1"); if (!DataUtil.isNullOrEmpty(lstConfigEnableBccs1) && !DataUtil.isNullObject(lstConfigEnableBccs1.get(0).getValue())) { if (Const.ENABLE_UPDATE_BCCS1.equals(DataUtil.safeToLong(lstConfigEnableBccs1.get(0).getValue()))) { stockIsdnIm1Service.doSaveStockIsdn(lstStockTransIsdn, lstStockTransDetail, lstStockTransIsdnDetail); } } } catch (LogicException ex) { logger.error(ex.getMessage(), ex); throw ex; } catch (Exception ex) { logger.error(ex.getMessage(), ex); throw ex; } } @Override public void doUnlockUser(StockTransDTO stockTransDTO) throws Exception { stockTransRepo.unlockUserInfo(stockTransDTO.getStockTransId()); } @Override public StockTransActionDTO doSaveStockTransAction(StockTransDTO stockTransDTO, StockTransActionDTO stockTransActionDTO) throws Exception { StockTransActionDTO stockTransActionClone = DataUtil.cloneBean(stockTransActionDTO); stockTransActionClone.setStatus(Const.STOCK_TRANS_STATUS.EXPORTED); super.doSaveStockTransAction(stockTransDTO, stockTransActionClone); return super.doSaveStockTransAction(stockTransDTO, stockTransActionDTO); } private String genCode(Long id) { String transCode = String.format("GD%011d", id); return transCode; } }