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
08e266dd33d92720fa2a4fa02add1adf5b3080bb
d613dc2ef35d5f13ad3654b787431cc6f6369c34
/project1/src/java/servlets/updatepass.java
e926aecfb6248f710b24663cf48b36a4b78f9071
[]
no_license
anmoltayal/college-application-approval
6afad596acca240ada120a670c8082510521a8c4
34f2af610742871166211a6ad40ec4a58e73c889
refs/heads/master
2020-04-06T15:38:07.316936
2018-11-30T16:41:49
2018-11-30T16:41:49
157,586,523
0
0
null
null
null
null
UTF-8
Java
false
false
1,540
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package servlets; import java.io.IOException; import java.io.PrintWriter; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author Anmol Tayal */ public class updatepass extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String id=request.getParameter("id"); String npass = request.getParameter("newpass"); String cpass=request.getParameter("conpass"); RecordCheck rs = new RecordCheck(); try{ if (npass.equals(cpass)) { rs.updatePass(id,npass); out.print("Done!"); } else{ out.print("Passwords donot match!"); } } catch (ClassNotFoundException ex) { Logger.getLogger(check.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(check.class.getName()).log(Level.SEVERE, null, ex); } } }
37f4230883706f325dec35854bf8b393e6f42dc6
4248a5ec7c349dcc96af010728b35ce29840f0c9
/src/com/nmea/obj/GgaNmeaObject.java
0b0407af9ec0036bb9fb17a0234beb977806772f
[]
no_license
SHhua/nmea
108396adf12dba142fb805d271423a5ed3a63cfb
34c6aca6b6cc1d1d4de4ed04f9093509f29849d5
refs/heads/master
2020-06-03T18:50:50.780320
2015-03-15T06:23:37
2015-03-15T06:23:37
32,247,985
2
0
null
null
null
null
UTF-8
Java
false
false
3,325
java
package com.nmea.obj; import org.apache.commons.lang.StringUtils; public class GgaNmeaObject extends AbstractNmeaObject { public GgaNmeaObject() { this.objType = GGA_PROTOL; } //1.UTC时间,格式为hhmmss.sss private String utc_Time; //2.纬度,格式为ddmm.mmmm(第一位是零也将传送); private char latitude; //3.纬度半球,N或S(北纬或南纬) private String lat_direction; //4.经度,格式为dddmm.mmmm(第一位零也将传送); private String longitude; //5.经度半球,E或W(东经或西经) private char long_direction; //6.定位质量指示,0=定位无效,1=定位有效; private int gpa_flag; //7.使用卫星数量,从00到12(第一个零也将传送) private String count; //8.水平精确度,0.5到99.9 private float horizontal; //9.天线离海平面的高度,-9999.9到9999.9米 private float high_1; //10.M 米 //11.大地水准面高度,-9999.9到9999.9米 private float high_2; //12.M 米 //13.差分GPS数据期限(RTCM SC-104),最后设立RTCM传送的秒数量 private String expired; //14.差分参考基站标号,从0000到1023(首位0也将传送) private String code; /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { if(this.msgFields == null || this.msgFields.size()< 15){ return "数据格式有误"; } StringBuffer str = new StringBuffer(); str.append("GGA消息:"); str.append("定位点的UTC时间:"); String time = this.msgFields.get(1); str.append(time.substring(0, 2)+"时"); str.append(time.substring(2, 4)+"分"); str.append(time.substring(4)+"秒"); if("N".equals(this.msgFields.get(3))){ str.append(",北纬"); } if("S".equals(this.msgFields.get(3))){ str.append(",南纬"); } String latitude = this.msgFields.get(2); str.append(latitude.substring(0, 2)+"度"); str.append(latitude.substring(2)+"分"); if("W".equals(this.msgFields.get(5))){ str.append(",西经"); } if("E".equals(this.msgFields.get(5))){ str.append(",东经"); } String longitude = this.msgFields.get(4); str.append(longitude.substring(0, 3)+"度"); str.append(longitude.substring(3)+"分"); str.append(",GPS定位状态指示:"); if("0".equals(this.msgFields.get(6))){ str.append("未定位"); } if("1".equals(this.msgFields.get(6))){ str.append("无差分,SPS模式,定位有效"); } if("2".equals(this.msgFields.get(6))){ str.append("带差分,SPS模式,定位有效"); } if("3".equals(this.msgFields.get(6))){ str.append("PPS模式,定位有效"); } str.append(",使用卫星数量:"); str.append(this.msgFields.get(7)); str.append(",水平精度衰减因子:"); str.append(this.msgFields.get(8)); str.append(",海平面高度:"); str.append(this.msgFields.get(9)); str.append("米"); str.append(",大地椭球面相对海平面的高度:"); str.append(this.msgFields.get(11)); str.append("米"); if(!StringUtils.isEmpty(this.msgFields.get(13))){ str.append(",差分修订时间:"); str.append(this.msgFields.get(13)+"秒"); } if(!StringUtils.isEmpty(this.msgFields.get(14))){ str.append(",差分参考基站ID号:"); str.append(this.msgFields.get(14)); } return str.toString(); } }
94259b35f6de7c700e946eb846373093a7051178
76ce08ba47f4d6998d95db0c1c03dccae9f2df2d
/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/ArkhamTele/ConceptTensorFlowObjectDetectionWebcam.java
26cab7080adfd1502257bc9a433107af6ec6b1e7
[ "BSD-3-Clause" ]
permissive
FTC10641/RR1-Arkham
791d8d680afdda3a29cba351c6a33b28998960cc
3c3ac2ed260981d6ab34fc42b3b813fbcdafc069
refs/heads/master
2020-04-01T05:32:52.219264
2019-09-16T06:18:15
2019-09-16T06:18:15
152,908,394
0
0
null
null
null
null
UTF-8
Java
false
false
8,722
java
/* Copyright (c) 2018 FIRST. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted (subject to the limitations in the disclaimer below) provided that * the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list * of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * Neither the name of FIRST nor the names of its contributors may be used to endorse or * promote products derived from this software without specific prior written permission. * * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS * LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.firstinspires.ftc.teamcode.ArkhamTele; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import org.firstinspires.ftc.robotcore.external.ClassFactory; import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName; import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer; import org.firstinspires.ftc.robotcore.external.tfod.Recognition; import org.firstinspires.ftc.robotcore.external.tfod.TFObjectDetector; import java.util.List; /** * This 2018-2019 OpMode illustrates the basics of using the TensorFlow Object Detection API to * determine the position of the gold and silver minerals. * * Use Android Studio to Copy this Class, and Paste it into your team's code folder with a new name. * Remove or comment out the @Disabled line to add this opmode to the Driver Station OpMode list. * * IMPORTANT: In order to use this OpMode, you need to obtain your own Vuforia license key as * is explained below. */ @TeleOp(name = "Concept: TensorFlow Object Detection Webcam", group = "Concept") public class ConceptTensorFlowObjectDetectionWebcam extends LinearOpMode { private static final String TFOD_MODEL_ASSET = "RoverRuckus.tflite"; private static final String LABEL_GOLD_MINERAL = "Gold Mineral"; private static final String LABEL_SILVER_MINERAL = "Silver Mineral"; /* * IMPORTANT: You need to obtain your own license key to use Vuforia. The string below with which * 'parameters.vuforiaLicenseKey' is initialized is for illustration only, and will not function. * A Vuforia 'Development' license key, can be obtained free of charge from the Vuforia developer * web site at https://developer.vuforia.com/license-manager. * * Vuforia license keys are always 380 characters long, and look as if they contain mostly * random data. As an example, here is a example of a fragment of a valid key: * ... yIgIzTqZ4mWjk9wd3cZO9T1axEqzuhxoGlfOOI2dRzKS4T0hQ8kT ... * Once you've obtained a license key, copy the string from the Vuforia web site * and paste it in to your code on the next line, between the double quotes. */ private static final String VUFORIA_KEY = "AcHok2f/////AAABmTLStsYPBUamg12w+tt+K+B5j9M06/ft2M0emh7hh4RjvHgdlZJfdEn7l1d6qb1a12mgOTD5qxtVzhfMaEhlYbgtGtQQgGsUTbhG3x1x5pGZ5vgvTU9kl2Qk1hNZy3QuN5B8Ih2R4VWtEIYQ+LqsH99HB14tqFqaMCgJuuqzMBMcT5vAP5kxFPECLQulP3vTeIoHiTgP/dm6AyTzLabb1oV8xLUCbr+x40D7RoNLTu9thQNeBGwMkna1Yvb1u5L8689KH/g53LLH24gjHA7BJnG/IamCQAQ8mI+dIFXH4PHU8TTwZCMrk44M1aFmgDj7eWlOt/YyfnJG14OpfLn0noycKAwM6Y5ZZepblD66Aqgu"; /** * {@link #vuforia} is the variable we will use to store our instance of the Vuforia * localization engine. */ private VuforiaLocalizer vuforia; /** * {@link #tfod} is the variable we will use to store our instance of the Tensor Flow Object * Detection engine. */ private TFObjectDetector tfod; @Override public void runOpMode() { // The TFObjectDetector uses the camera frames from the VuforiaLocalizer, so we create that // first. initVuforia(); if (ClassFactory.getInstance().canCreateTFObjectDetector()) { initTfod(); } else { telemetry.addData("Sorry!", "This device is not compatible with TFOD"); } /** Wait for the game to begin */ telemetry.addData(">", "Press Play to start tracking"); telemetry.update(); waitForStart(); if (opModeIsActive()) { /** Activate Tensor Flow Object Detection. */ if (tfod != null) { tfod.activate(); } while (opModeIsActive()) { if (tfod != null) { // getUpdatedRecognitions() will return null if no new information is available since // the last time that call was made. List<Recognition> updatedRecognitions = tfod.getUpdatedRecognitions(); if (updatedRecognitions != null) { telemetry.addData("# Object Detected", updatedRecognitions.size()); if (updatedRecognitions.size() == 3) { int goldMineralX = -1; int silverMineral1X = -1; int silverMineral2X = -1; for (Recognition recognition : updatedRecognitions) { if (recognition.getLabel().equals(LABEL_GOLD_MINERAL)) { goldMineralX = (int) recognition.getLeft(); } else if (silverMineral1X == -1) { silverMineral1X = (int) recognition.getLeft(); } else { silverMineral2X = (int) recognition.getLeft(); } } if (goldMineralX != -1 && silverMineral1X != -1 && silverMineral2X != -1) { if (goldMineralX < silverMineral1X && goldMineralX < silverMineral2X) { telemetry.addData("Gold Mineral Position", "Left"); } else if (goldMineralX > silverMineral1X && goldMineralX > silverMineral2X) { telemetry.addData("Gold Mineral Position", "Right"); } else { telemetry.addData("Gold Mineral Position", "Center"); } } } telemetry.update(); } } } } if (tfod != null) { tfod.shutdown(); } } /** * Initialize the Vuforia localization engine. */ private void initVuforia() { /* * Configure Vuforia by creating a Parameter object, and passing it to the Vuforia engine. */ VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters(); parameters.vuforiaLicenseKey = VUFORIA_KEY; parameters.cameraName = hardwareMap.get(WebcamName.class, "Webcam 1"); // Instantiate the Vuforia engine vuforia = ClassFactory.getInstance().createVuforia(parameters); // Loading trackables is not necessary for the Tensor Flow Object Detection engine. } /** * Initialize the Tensor Flow Object Detection engine. */ private void initTfod() { int tfodMonitorViewId = hardwareMap.appContext.getResources().getIdentifier( "tfodMonitorViewId", "id", hardwareMap.appContext.getPackageName()); TFObjectDetector.Parameters tfodParameters = new TFObjectDetector.Parameters(tfodMonitorViewId); tfod = ClassFactory.getInstance().createTFObjectDetector(tfodParameters, vuforia); tfod.loadModelFromAsset(TFOD_MODEL_ASSET, LABEL_GOLD_MINERAL, LABEL_SILVER_MINERAL); } }
3e85a899b4d272722a60b0fd152c0cc2ed0896c5
b3e57903cf48ea151ca42ecf4e92a0a739eb8a2b
/src/main/java/com/uniquelry/jgs/controller/admin/CustomerAdminController.java
9d90ff27da9baf2cb132a1055496c340b121d978
[]
no_license
yunwenlong/JXC
22c91531ab56274598bd1246a4d7ae728050318a
0fc1a2c71b129e9f536cb1d4db3b793164bc4e31
refs/heads/master
2022-10-26T06:00:17.395526
2019-06-21T11:18:10
2019-06-21T11:18:10
158,378,878
0
0
null
2022-10-12T20:20:10
2018-11-20T11:27:56
JavaScript
UTF-8
Java
false
false
3,571
java
package com.uniquelry.jgs.controller.admin; import com.uniquelry.jgs.entity.Customer; import com.uniquelry.jgs.entity.Log; import com.uniquelry.jgs.service.CustomerService; import com.uniquelry.jgs.service.LogService; import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.data.domain.Sort.Direction; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @Description 后台管理客户Controller * @Author uniquelry * @Email [email protected] * @Date 2018/10/18 22:24 * @Version V1.0 */ @RestController @RequestMapping("/admin/customer") public class CustomerAdminController { @Resource private CustomerService customerService; @Resource private LogService logService; /** * 分页查询客户信息 * @param customer * @param page * @param rows * @return * @throws Exception */ @RequestMapping("/list") @RequiresPermissions(value = { "客户管理" }) public Map<String,Object> list(Customer customer,@RequestParam(value="page",required=false)Integer page,@RequestParam(value="rows",required=false)Integer rows)throws Exception{ List<Customer> customerList=customerService.list(customer, page, rows, Direction.ASC, "id"); Long total=customerService.getCount(customer); Map<String, Object> resultMap = new HashMap<>(); resultMap.put("rows", customerList); resultMap.put("total", total); logService.save(new Log(Log.SEARCH_ACTION,"查询客户信息")); // 写入日志 return resultMap; } /** * 下拉框模糊查询 * @param q * @return * @throws Exception */ @ResponseBody @RequestMapping("/comboList") @RequiresPermissions(value = {"销售出库","客户退货","销售单据查询","客户退货查询"},logical=Logical.OR) public List<Customer> comboList(String q)throws Exception{ if(q==null){ q=""; } return customerService.findByName("%"+q+"%"); } /** * 添加或者修改客户信息 * @param customer * @return * @throws Exception */ @RequestMapping("/save") @RequiresPermissions(value = { "客户管理" }) public Map<String,Object> save(Customer customer)throws Exception{ if(customer.getId()!=null){ // 写入日志 logService.save(new Log(Log.UPDATE_ACTION,"更新客户信息"+customer)); }else{ logService.save(new Log(Log.ADD_ACTION,"添加客户信息"+customer)); } Map<String, Object> resultMap = new HashMap<>(); customerService.save(customer); resultMap.put("success", true); return resultMap; } /** * 删除客户信息 * @param id * @param response * @return * @throws Exception */ @RequestMapping("/delete") @RequiresPermissions(value = { "客户管理" }) public Map<String,Object> delete(String ids)throws Exception{ Map<String, Object> resultMap = new HashMap<>(); String []idsStr=ids.split(","); for(int i=0;i<idsStr.length;i++){ int id=Integer.parseInt(idsStr[i]); logService.save(new Log(Log.DELETE_ACTION,"删除客户信息"+customerService.findById(id))); // 写入日志 customerService.delete(id); } resultMap.put("success", true); return resultMap; } }
c71c546345e539ccdd1a3d06ff8901dd4ee7a876
3c5da1f39f5fe1153dd6dd8c62e1931beb21dcc8
/multidex/src/jellybean4_3/BaseDexClassLoader.java
67160cab8d174d2ae42d865fc7b33080187193f5
[]
no_license
AlexMahao/google-android-support-source-analyze
dfa57e2c6d77f5a3f5925c187ecd77d66a2be7f7
dd71f3032605fb2ebd700d918928fba733fffaf4
refs/heads/master
2020-03-22T00:08:37.577240
2018-07-05T08:50:35
2018-07-05T08:50:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,647
java
/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package jellybean4_3; import java.io.File; import java.net.URL; import java.util.Enumeration; /** * Base class for common functionality between various dex-based * {@link ClassLoader} implementations. */ public class BaseDexClassLoader extends ClassLoader { private final DexPathList pathList; /** * Constructs an instance. * * @param dexPath the list of jar/apk files containing classes and * resources, delimited by {@code File.pathSeparator}, which * defaults to {@code ":"} on Android * @param optimizedDirectory directory where optimized dex files * should be written; may be {@code null} * @param libraryPath the list of directories containing native * libraries, delimited by {@code File.pathSeparator}; may be * {@code null} * @param parent the parent class loader */ public BaseDexClassLoader(String dexPath, File optimizedDirectory, String libraryPath, ClassLoader parent) { super(parent); this.pathList = new DexPathList(this, dexPath, libraryPath, optimizedDirectory); } @Override protected Class<?> findClass(String name) throws ClassNotFoundException { Class c = pathList.findClass(name); if (c == null) { throw new ClassNotFoundException("Didn't find class \"" + name + "\" on path: " + pathList); } return c; } @Override protected URL findResource(String name) { return pathList.findResource(name); } @Override protected Enumeration<URL> findResources(String name) { return pathList.findResources(name); } @Override public String findLibrary(String name) { return pathList.findLibrary(name); } /** * Returns package information for the given package. * Unfortunately, instances of this class don't really have this * information, and as a non-secure {@code ClassLoader}, it isn't * even required to, according to the spec. Yet, we want to * provide it, in order to make all those hopeful callers of * {@code myClass.getPackage().getName()} happy. Thus we construct * a {@code Package} object the first time it is being requested * and fill most of the fields with dummy values. The {@code * Package} object is then put into the {@code ClassLoader}'s * package cache, so we see the same one next time. We don't * create {@code Package} objects for {@code null} arguments or * for the default package. * * <p>There is a limited chance that we end up with multiple * {@code Package} objects representing the same package: It can * happen when when a package is scattered across different JAR * files which were loaded by different {@code ClassLoader} * instances. This is rather unlikely, and given that this whole * thing is more or less a workaround, probably not worth the * effort to address. * * @param name the name of the class * @return the package information for the class, or {@code null} * if there is no package information available for it */ @Override protected synchronized Package getPackage(String name) { if (name != null && !name.isEmpty()) { Package pack = super.getPackage(name); if (pack == null) { pack = definePackage(name, "Unknown", "0.0", "Unknown", "Unknown", "0.0", "Unknown", null); } return pack; } return null; } /** * @hide */ public String getLdLibraryPath() { StringBuilder result = new StringBuilder(); for (File directory : pathList.getNativeLibraryDirectories()) { if (result.length() > 0) { result.append(':'); } result.append(directory); } return result.toString(); } @Override public String toString() { return getClass().getName() + "[" + pathList + "]"; } }
947f3ffdf6f26f4a8c63b445c1175ae5a718b287
128eb90ce7b21a7ce621524dfad2402e5e32a1e8
/laravel-converted/src/main/java/com/project/convertedCode/includes/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/file_ObjectProphecyException_php.java
eacb9bc6b6b43c8a6b288707a817d2dd2d39848c
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
RuntimeConverter/RuntimeConverterLaravelJava
657b4c73085b4e34fe4404a53277e056cf9094ba
7ae848744fbcd993122347ffac853925ea4ea3b9
refs/heads/master
2020-04-12T17:22:30.345589
2018-12-22T10:32:34
2018-12-22T10:32:34
162,642,356
0
0
null
null
null
null
UTF-8
Java
false
false
2,205
java
package com.project.convertedCode.includes.vendor.phpspec.prophecy.src.Prophecy.Exception.Prophecy; import com.runtimeconverter.runtime.RuntimeStack; import com.runtimeconverter.runtime.interfaces.ContextConstants; import com.runtimeconverter.runtime.includes.RuntimeIncludable; import com.runtimeconverter.runtime.includes.IncludeEventException; import com.runtimeconverter.runtime.classes.RuntimeClassBase; import com.runtimeconverter.runtime.RuntimeEnv; import com.runtimeconverter.runtime.interfaces.UpdateRuntimeScopeInterface; import com.runtimeconverter.runtime.arrays.ZPair; /* Converted with The Runtime Converter (runtimeconverter.com) vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/ObjectProphecyException.php */ public class file_ObjectProphecyException_php implements RuntimeIncludable { public static final file_ObjectProphecyException_php instance = new file_ObjectProphecyException_php(); public final void include(RuntimeEnv env, RuntimeStack stack) throws IncludeEventException { Scope2456 scope = new Scope2456(); stack.pushScope(scope); this.include(env, stack, scope); stack.popScope(); } public final void include(RuntimeEnv env, RuntimeStack stack, Scope2456 scope) throws IncludeEventException { // Namespace import was here // Conversion Note: class named ObjectProphecyException was here in the source code env.addManualClassLoad("Prophecy\\Exception\\Prophecy\\ObjectProphecyException"); } private static final ContextConstants runtimeConverterContextContantsInstance = new ContextConstants() .setDir("/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy") .setFile( "/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/ObjectProphecyException.php"); public ContextConstants getContextConstants() { return runtimeConverterContextContantsInstance; } private static class Scope2456 implements UpdateRuntimeScopeInterface { public void updateStack(RuntimeStack stack) {} public void updateScope(RuntimeStack stack) {} } }
82b6b43c47e31d92b3fe2cb7151b47276114c6cf
10904dcdeaa3965aad05ea4b8536f00fbabe3bd7
/src/main/java/home/blackharold/aop/aspect/CloudLogAsyncAspect.java
961bc67152b8b6b84eb91e0cb31c214c15721ea6
[]
no_license
BlackHarold/aspectJ
9bc15ea9a845196c4102b7a015610281426e0d68
7423abee7b92a80815d0786c9f6dd54439ad42b6
refs/heads/master
2020-12-09T22:39:10.287244
2020-01-12T18:45:01
2020-01-12T18:45:01
233,437,181
0
0
null
null
null
null
UTF-8
Java
false
false
487
java
package home.blackharold.aop.aspect; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; @Aspect @Component @Order(1) public class CloudLogAsyncAspect { @Before("home.blackharold.aop.aspect.AopExpressions.forDAOPackageNoGetterSetter())") public void logToCloudAsync() { System.out.println("====> method logToCloudAsync() 1"); } }
410210324ff18142a58326454ddbd5825b8a3307
6ef4bb59f556e2110415e487d700e41100f78e4f
/app/src/main/java/com/example/aml/newsapps/New.java
1a8c60c54017b05a02aa701870befa9fb7bc82b3
[]
no_license
AmlHanfy/NewsApps
70469a04d43b1fc4913fb93ac101f5ea41378ecc
30a9e5d1b963da83a665bc72ec5081fe80726a7c
refs/heads/master
2020-03-23T08:46:44.762184
2018-07-17T21:22:33
2018-07-17T21:22:33
141,344,896
0
0
null
null
null
null
UTF-8
Java
false
false
895
java
package com.example.aml.newsapps; public class New { private String webTitle; private String sectionName; private String webPublicationDate; private String webUrl; private String authorName; public New(String sectionName, String webTitle, String webUrl, String webPublicationDate,String authorName) { this.sectionName = sectionName; this.webPublicationDate = webPublicationDate; this.webTitle = webTitle; this.authorName=authorName; this.webUrl = webUrl; } public String getSectionName() { return sectionName; } public String getWebPublicationDate() { return webPublicationDate; } public String getAuthorName() { return authorName; } public String getWebUrl() { return webUrl; }public String getWebTitle() { return webTitle; } }
4076d5b81f4c74e9ed2541108f8aee983cdea2e3
2008b62ea2a0b7aed5008084d63255fded86b202
/src/main/java/com/epam/university/java/core/task004/Task004Impl.java
11d4baa43940fe9cf83aee79f7d5e03720ef387a
[]
no_license
gun-pi/epam-java-cources
323cb30c836212410baab73de4882380e775d6d1
f5dd5c4f9cf2f7592ed441077ebbb5552d084901
refs/heads/master
2023-01-14T08:50:12.654535
2020-11-25T11:20:11
2020-11-25T11:20:11
288,532,323
0
0
null
2020-08-18T18:24:58
2020-08-18T18:24:57
null
UTF-8
Java
false
false
1,654
java
package com.epam.university.java.core.task004; import java.util.HashSet; import java.util.Set; import java.util.Arrays; import java.util.LinkedHashSet; public class Task004Impl implements Task004 { /** * Find intersection of two arrays. * * @param first first array * @param second second array * @return array of common elements * @throws IllegalArgumentException if parameters not provided */ @Override public String[] intersection(String[] first, String[] second) { if (first == null || second == null) { throw new IllegalArgumentException(); } Set<String> firstSet = new HashSet<String>(Arrays.asList(first)); Set<String> secondSet = new HashSet<String>(Arrays.asList(second)); firstSet.retainAll(secondSet); return firstSet.toArray(new String[firstSet.size()]); } /** * Find union of two arrays. * * @param first first array * @param second second array * @return array of all elements of array * @throws IllegalArgumentException if parameters not provided */ @Override public String[] union(String[] first, String[] second) { if (first == null || second == null) { throw new IllegalArgumentException(); } Set<String> result = new LinkedHashSet<>(); Set<String> firstSet = new LinkedHashSet<String>(Arrays.asList(first)); Set<String> secondSet = new LinkedHashSet<String>(Arrays.asList(second)); result.addAll(firstSet); result.addAll(secondSet); return result.toArray(new String[firstSet.size()]); } }
1dc49ea979f0d1ff23808462fb5b2b025f7f2ec2
53e92a8a14c7c67b37c4a409b69db4578e109229
/app/src/main/java/com/slotsonlinego/apprel/Main.java
6cafee807dcbcb9882f7920b16e18f9373e6fcd7
[]
no_license
VulkanMoneyMaker/com.slotsonlinego.apprel
1bb6b99090bcb6e2b3122eff259ef436a6402e61
302b26657e0c2ca8ddb60fa4bb406801de404587
refs/heads/master
2021-05-02T08:50:19.776491
2018-02-08T20:47:10
2018-02-08T20:47:10
120,815,891
0
0
null
null
null
null
UTF-8
Java
false
false
4,778
java
package com.slotsonlinego.apprel; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.webkit.WebResourceRequest; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ProgressBar; import com.slotsonlinego.apprel.data.ItemGame; import java.util.ArrayList; import java.util.List; import java.util.UUID; public class Main extends AppCompatActivity { private static final String TAG = Main.class.getSimpleName(); private static final int MAX_COUNT = 10; private static final String STATE_RESULT_CODE = "result_code"; private static final String STATE_RESULT_DATA = "result_data"; private List<ItemGame> itemGames; private String data; private String key; private ProgressBar progressBar; private int mResultCode; private Intent mResultData; @Override public void onStart() { super.onStart(); if (itemGames == null) { itemGames = new ArrayList<>(); } } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (mResultData != null) { outState.putInt(STATE_RESULT_CODE, mResultCode); outState.putParcelable(STATE_RESULT_DATA, mResultData); } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "onCreate"); setContentView(R.layout.activity_main); if (savedInstanceState != null) { mResultCode = savedInstanceState.getInt(STATE_RESULT_CODE, -1); mResultData = savedInstanceState.getParcelable(STATE_RESULT_DATA); } data = getString(R.string.opening_url); // don't change value id key = getString(R.string.key_redirecting); // don't change value id itemGames = generateItems(); progressBar = findViewById(R.id.progress); progressBar.setVisibility(View.VISIBLE); openWebView(); } @Override public void onDestroy() { itemGames = null; super.onDestroy(); } private List<ItemGame> generateItems() { List<ItemGame> itemGames = new ArrayList<>(); for (int i = 0; i < MAX_COUNT; ++i) { itemGames.add(new ItemGame(UUID.randomUUID().toString())); } return itemGames; } @SuppressLint("SetJavaScriptEnabled") private void openWebView() { Log.d(TAG, "openWebView"); progressBar.setVisibility(View.GONE); WebView webView = findViewById(R.id.web_view); webView.setWebViewClient(client()); settings(webView.getSettings()); webView.loadUrl(data); for(ItemGame item : itemGames) { item.setName("Local user"); item.setTotal(mResultCode); } } @NonNull public static Intent getMainActivityIntent(Context context) { return new Intent(context, Main.class); } @Override public void onStop() { super.onStop(); } private void openScreenGame() { Log.d(TAG, "openScreenGame"); progressBar.setVisibility(View.GONE); startActivity(Game.getGameActivityIntent(this)); overridePendingTransition(0,0); finish(); } @SuppressLint("SetJavaScriptEnabled") private void settings(@NonNull WebSettings webSettings) { webSettings.setBuiltInZoomControls(true); webSettings.setSupportZoom(true); webSettings.setJavaScriptEnabled(true); webSettings.setAllowFileAccess(true); } @NonNull private WebViewClient client() { return new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (!url.contains(key)) { view.loadUrl(url); } else { openScreenGame(); } return true; } @RequiresApi(Build.VERSION_CODES.N) @Override public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) { if (!request.getUrl().toString().contains(key)) { view.loadUrl(request.getUrl().toString()); } else { openScreenGame(); } return true; } }; } }
cb6deda2c9985bdb40d8ac5b618073794c8dc1c6
a52fd88f404d02e51ff281ed5800f522a7dd42df
/技术点demo示例/demo1/src/main/java/com/example/demo/config/DynamicDataSource.java
16d19dd402053b02721cbb5cc41699d08f76a644
[]
no_license
xwwxit/data
5814ab7a135b4733412faa7afc1b57661696b760
bbdbcb91ce58fb7a80978e785ed81dd788e71f7f
refs/heads/master
2022-07-01T21:50:32.806618
2019-07-02T02:28:28
2019-07-02T02:28:28
190,321,616
1
0
null
2022-06-17T03:30:19
2019-06-05T03:44:55
Java
UTF-8
Java
false
false
549
java
package com.example.demo.config; import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; /** * @Description: 动态数据源 * @Author: zhangtao * @CreateDate: 2019/6/11 9:34 * @Version: 1.0 */ public class DynamicDataSource extends AbstractRoutingDataSource { @Override protected Object determineCurrentLookupKey() { System.out.println("DynamicDataSource数据源选择:" + DataSourceContextHolder.getDataSource()); return DataSourceContextHolder.getDataSource(); } }
9cc48c63a7cb55016993dee8f2dec46c142f35f4
b31120cefe3991a960833a21ed54d4e10770bc53
/modules/org.clang.codegen/src/org/clang/codegen/CodeGen/impl/CodeGenModule_CGCall.java
db221bd2ca5e89b53acab56af31182902885205a
[]
no_license
JianpingZeng/clank
94581710bd89caffcdba6ecb502e4fdb0098caaa
bcdf3389cd57185995f9ee9c101a4dfd97145442
refs/heads/master
2020-11-30T05:36:06.401287
2017-10-26T14:15:27
2017-10-26T14:15:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
31,646
java
/** * This file was converted to Java from the original LLVM source file. The original * source file follows the LLVM Release License, outlined below. * * ============================================================================== * LLVM Release License * ============================================================================== * University of Illinois/NCSA * Open Source License * * Copyright (c) 2003-2017 University of Illinois at Urbana-Champaign. * All rights reserved. * * Developed by: * * LLVM Team * * University of Illinois at Urbana-Champaign * * http://llvm.org * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal with * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimers. * * * Redistributions in binary form must reproduce the above copyright notice * this list of conditions and the following disclaimers in the * documentation and/or other materials provided with the distribution. * * * Neither the names of the LLVM Team, University of Illinois at * Urbana-Champaign, nor the names of its contributors may be used to * endorse or promote products derived from this Software without specific * prior written permission. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE * SOFTWARE. * * ============================================================================== * Copyrights and Licenses for Third Party Software Distributed with LLVM: * ============================================================================== * The LLVM software contains code written by third parties. Such software will * have its own individual LICENSE.TXT file in the directory in which it appears. * This file will describe the copyrights, license, and restrictions which apply * to that code. * * The disclaimer of warranty in the University of Illinois Open Source License * applies to all code in the LLVM Distribution, and nothing in any of the * other licenses gives permission to use the names of the LLVM Team or the * University of Illinois to endorse or promote products derived from this * Software. * * The following pieces of software have additional or alternate copyrights, * licenses, and/or restrictions: * * Program Directory * ------- --------- * Autoconf llvm/autoconf * llvm/projects/ModuleMaker/autoconf * Google Test llvm/utils/unittest/googletest * OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex} * pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT} * ARM contributions llvm/lib/Target/ARM/LICENSE.TXT * md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h */ package org.clang.codegen.CodeGen.impl; import org.clank.java.*; import org.clank.support.*; import org.clank.support.aliases.*; import org.clank.support.JavaDifferentiators.*; import static org.clank.java.std.*; import static org.llvm.support.llvm.*; import static org.clank.support.NativePointer.*; import static org.clank.support.Native.*; import static org.clank.support.Unsigned.*; import org.llvm.support.*; import org.llvm.adt.*; import org.llvm.adt.aliases.*; import org.clang.ast.*; import org.llvm.ir.*; import org.clang.codegen.impl.*; import org.clang.codegen.CodeGen.*; import org.clang.basic.target.TargetInfo; import static org.clang.ast.java.AstDeclarationsRTTI.*; import static org.clang.codegen.impl.CGCallStatics.AddAttributesFromFunctionProtoType; //<editor-fold defaultstate="collapsed" desc="static type CodeGenModule_CGCall"> @Converted(kind = Converted.Kind.AUTO, NM="org.clang.codegen.CodeGen.impl.CodeGenModule_CGCall", cmd="jclank.sh -java-options=${SPUTNIK}/contrib/JConvert/llvmToClankType -print -java-options=${SPUTNIK}/modules/org.clang.codegen/llvmToClangType -split-class=clang::CodeGen::CodeGenModule@this -extends=CodeGenModule_CGCXX ${LLVM_SRC}/llvm/tools/clang/lib/CodeGen/CGCall.cpp -nm=_ZN5clang7CodeGen13CodeGenModule18ReturnTypeUsesSRetERKNS0_14CGFunctionInfoE;_ZN5clang7CodeGen13CodeGenModule19ReturnTypeUsesFPRetENS_8QualTypeE;_ZN5clang7CodeGen13CodeGenModule20ReturnTypeUsesFP2RetENS_8QualTypeE;_ZN5clang7CodeGen13CodeGenModule22ConstructAttributeListEN4llvm9StringRefERKNS0_14CGFunctionInfoENS0_12CGCalleeInfoERNS2_11SmallVectorINS2_12AttributeSetELj8EEERjb;_ZN5clang7CodeGen13CodeGenModule28ReturnSlotInterferesWithArgsERKNS0_14CGFunctionInfoE; -static-type=CodeGenModule_CGCall -package=org.clang.codegen.CodeGen.impl") //</editor-fold> public abstract class CodeGenModule_CGCall extends CodeGenModule_CGCXX { private final /*split clang::CodeGen::CodeGenModule*/ CodeGenModule $this() { return (CodeGenModule)this; } /// Return true iff the given type uses 'sret' when used as a return type. // namespace /***/ //<editor-fold defaultstate="collapsed" desc="clang::CodeGen::CodeGenModule::ReturnTypeUsesSRet"> @Converted(kind = Converted.Kind.AUTO, source = "${LLVM_SRC}/llvm/tools/clang/lib/CodeGen/CGCall.cpp", line = 1423, FQN="clang::CodeGen::CodeGenModule::ReturnTypeUsesSRet", NM="_ZN5clang7CodeGen13CodeGenModule18ReturnTypeUsesSRetERKNS0_14CGFunctionInfoE", cmd="jclank.sh -java-options=${SPUTNIK}/modules/org.clang.codegen/llvmToClangType -split-class=clang::CodeGen::CodeGenModule@this ${LLVM_SRC}/llvm/tools/clang/lib/CodeGen/CGCall.cpp -nm=_ZN5clang7CodeGen13CodeGenModule18ReturnTypeUsesSRetERKNS0_14CGFunctionInfoE") //</editor-fold> public final boolean ReturnTypeUsesSRet(final /*const*/ CGFunctionInfo /*&*/ FI) { return FI.getReturnInfo$Const().isIndirect(); } /// Return true iff the given type uses an argument slot when 'sret' is used /// as a return type. //<editor-fold defaultstate="collapsed" desc="clang::CodeGen::CodeGenModule::ReturnSlotInterferesWithArgs"> @Converted(kind = Converted.Kind.AUTO, source = "${LLVM_SRC}/llvm/tools/clang/lib/CodeGen/CGCall.cpp", line = 1427, FQN="clang::CodeGen::CodeGenModule::ReturnSlotInterferesWithArgs", NM="_ZN5clang7CodeGen13CodeGenModule28ReturnSlotInterferesWithArgsERKNS0_14CGFunctionInfoE", cmd="jclank.sh -java-options=${SPUTNIK}/modules/org.clang.codegen/llvmToClangType -split-class=clang::CodeGen::CodeGenModule@this ${LLVM_SRC}/llvm/tools/clang/lib/CodeGen/CGCall.cpp -nm=_ZN5clang7CodeGen13CodeGenModule28ReturnSlotInterferesWithArgsERKNS0_14CGFunctionInfoE") //</editor-fold> public final boolean ReturnSlotInterferesWithArgs(final /*const*/ CGFunctionInfo /*&*/ FI) { return $this().ReturnTypeUsesSRet(FI) && $this().getTargetCodeGenInfo().doesReturnSlotInterfereWithArgs(); } /// Return true iff the given type uses 'fpret' when used as a return type. //<editor-fold defaultstate="collapsed" desc="clang::CodeGen::CodeGenModule::ReturnTypeUsesFPRet"> @Converted(kind = Converted.Kind.AUTO, source = "${LLVM_SRC}/llvm/tools/clang/lib/CodeGen/CGCall.cpp", line = 1432, FQN="clang::CodeGen::CodeGenModule::ReturnTypeUsesFPRet", NM="_ZN5clang7CodeGen13CodeGenModule19ReturnTypeUsesFPRetENS_8QualTypeE", cmd="jclank.sh -java-options=${SPUTNIK}/modules/org.clang.codegen/llvmToClangType -split-class=clang::CodeGen::CodeGenModule@this ${LLVM_SRC}/llvm/tools/clang/lib/CodeGen/CGCall.cpp -nm=_ZN5clang7CodeGen13CodeGenModule19ReturnTypeUsesFPRetENS_8QualTypeE") //</editor-fold> public final boolean ReturnTypeUsesFPRet(QualType ResultType) { { /*const*/ BuiltinType /*P*/ BT = ResultType.$arrow().getAs$BuiltinType(); if ((BT != null)) { switch (BT.getKind()) { default: return false; case Float: return $this().getTarget().useObjCFPRetForRealType(TargetInfo.RealType.Float); case Double: return $this().getTarget().useObjCFPRetForRealType(TargetInfo.RealType.Double); case LongDouble: return $this().getTarget().useObjCFPRetForRealType(TargetInfo.RealType.LongDouble); } } } return false; } /// Return true iff the given type uses 'fp2ret' when used as a return type. //<editor-fold defaultstate="collapsed" desc="clang::CodeGen::CodeGenModule::ReturnTypeUsesFP2Ret"> @Converted(kind = Converted.Kind.AUTO, source = "${LLVM_SRC}/llvm/tools/clang/lib/CodeGen/CGCall.cpp", line = 1449, FQN="clang::CodeGen::CodeGenModule::ReturnTypeUsesFP2Ret", NM="_ZN5clang7CodeGen13CodeGenModule20ReturnTypeUsesFP2RetENS_8QualTypeE", cmd="jclank.sh -java-options=${SPUTNIK}/modules/org.clang.codegen/llvmToClangType -split-class=clang::CodeGen::CodeGenModule@this ${LLVM_SRC}/llvm/tools/clang/lib/CodeGen/CGCall.cpp -nm=_ZN5clang7CodeGen13CodeGenModule20ReturnTypeUsesFP2RetENS_8QualTypeE") //</editor-fold> public final boolean ReturnTypeUsesFP2Ret(QualType ResultType) { { /*const*/ ComplexType /*P*/ CT = ResultType.$arrow().getAs(ComplexType.class); if ((CT != null)) { { /*const*/ BuiltinType /*P*/ BT = CT.getElementType().$arrow().getAs$BuiltinType(); if ((BT != null)) { if (BT.getKind() == BuiltinType.Kind.LongDouble) { return $this().getTarget().useObjCFP2RetForComplexLongDouble(); } } } } } return false; } /// Get the LLVM attributes and calling convention to use for a particular /// function type. /// /// \param Name - The function name. /// \param Info - The function type information. /// \param CalleeInfo - The callee information these attributes are being /// constructed for. If valid, the attributes applied to this decl may /// contribute to the function attributes and calling convention. /// \param PAL [out] - On return, the attribute list to use. /// \param CallingConv [out] - On return, the LLVM calling convention to use. //<editor-fold defaultstate="collapsed" desc="clang::CodeGen::CodeGenModule::ConstructAttributeList"> @Converted(kind = Converted.Kind.MANUAL_COMPILATION, source = "${LLVM_SRC}/llvm/tools/clang/lib/CodeGen/CGCall.cpp", line = 1620, FQN="clang::CodeGen::CodeGenModule::ConstructAttributeList", NM="_ZN5clang7CodeGen13CodeGenModule22ConstructAttributeListEN4llvm9StringRefERKNS0_14CGFunctionInfoENS0_12CGCalleeInfoERNS2_11SmallVectorINS2_12AttributeSetELj8EEERjb", cmd="jclank.sh -java-options=${SPUTNIK}/modules/org.clang.codegen/llvmToClangType -split-class=clang::CodeGen::CodeGenModule@this ${LLVM_SRC}/llvm/tools/clang/lib/CodeGen/CGCall.cpp -nm=_ZN5clang7CodeGen13CodeGenModule22ConstructAttributeListEN4llvm9StringRefERKNS0_14CGFunctionInfoENS0_12CGCalleeInfoERNS2_11SmallVectorINS2_12AttributeSetELj8EEERjb") //</editor-fold> public final void ConstructAttributeList(StringRef Name, final /*const*/ CGFunctionInfo /*&*/ FI, CGCalleeInfo CalleeInfo, final SmallVector<AttributeSet> /*&*/ PAL, final uint$ref/*uint &*/ CallingConv, boolean AttrOnCallSite) { AttrBuilder FuncAttrs = null; AttrBuilder RetAttrs = null; ClangToLLVMArgMapping IRFunctionArgs = null; try { FuncAttrs/*J*/= new AttrBuilder(); RetAttrs/*J*/= new AttrBuilder(); boolean HasOptnone = false; CallingConv.$set(FI.getEffectiveCallingConvention()); if (FI.isNoReturn()) { FuncAttrs.addAttribute(Attribute.AttrKind.NoReturn); } // If we have information about the function prototype, we can learn // attributes form there. AddAttributesFromFunctionProtoType($this().getContext(), FuncAttrs, CalleeInfo.getCalleeFunctionProtoType()); /*const*/ Decl /*P*/ TargetDecl = CalleeInfo.getCalleeDecl(); boolean HasAnyX86InterruptAttr = false; // FIXME: handle sseregparm someday... if ((TargetDecl != null)) { if (TargetDecl.hasAttr(ReturnsTwiceAttr.class)) { FuncAttrs.addAttribute(Attribute.AttrKind.ReturnsTwice); } if (TargetDecl.hasAttr(NoThrowAttr.class)) { FuncAttrs.addAttribute(Attribute.AttrKind.NoUnwind); } if (TargetDecl.hasAttr(NoReturnAttr.class)) { FuncAttrs.addAttribute(Attribute.AttrKind.NoReturn); } if (TargetDecl.hasAttr(NoDuplicateAttr.class)) { FuncAttrs.addAttribute(Attribute.AttrKind.NoDuplicate); } { /*const*/ FunctionDecl /*P*/ Fn = dyn_cast_FunctionDecl(TargetDecl); if ((Fn != null)) { AddAttributesFromFunctionProtoType($this().getContext(), FuncAttrs, Fn.getType().$arrow().getAs(FunctionProtoType.class)); // Don't use [[noreturn]] or _Noreturn for a call to a virtual function. // These attributes are not inherited by overloads. /*const*/ CXXMethodDecl /*P*/ MD = dyn_cast_CXXMethodDecl(Fn); if (Fn.isNoReturn() && !(AttrOnCallSite && (MD != null) && MD.isVirtual())) { FuncAttrs.addAttribute(Attribute.AttrKind.NoReturn); } } } // 'const', 'pure' and 'noalias' attributed functions are also nounwind. if (TargetDecl.hasAttr(ConstAttr.class)) { FuncAttrs.addAttribute(Attribute.AttrKind.ReadNone); FuncAttrs.addAttribute(Attribute.AttrKind.NoUnwind); } else if (TargetDecl.hasAttr(PureAttr.class)) { FuncAttrs.addAttribute(Attribute.AttrKind.ReadOnly); FuncAttrs.addAttribute(Attribute.AttrKind.NoUnwind); } else if (TargetDecl.hasAttr(NoAliasAttr.class)) { FuncAttrs.addAttribute(Attribute.AttrKind.ArgMemOnly); FuncAttrs.addAttribute(Attribute.AttrKind.NoUnwind); } if (TargetDecl.hasAttr(RestrictAttr.class)) { RetAttrs.addAttribute(Attribute.AttrKind.NoAlias); } if (TargetDecl.hasAttr(ReturnsNonNullAttr.class)) { RetAttrs.addAttribute(Attribute.AttrKind.NonNull); } HasAnyX86InterruptAttr = TargetDecl.hasAttr(AnyX86InterruptAttr.class); HasOptnone = TargetDecl.hasAttr(OptimizeNoneAttr.class); } // OptimizeNoneAttr takes precedence over -Os or -Oz. No warning needed. if (!HasOptnone) { if (($2bits_uint2uint($this().CodeGenOpts.OptimizeSize) != 0)) { FuncAttrs.addAttribute(Attribute.AttrKind.OptimizeForSize); } if ($2bits_uint2uint($this().CodeGenOpts.OptimizeSize) == 2) { FuncAttrs.addAttribute(Attribute.AttrKind.MinSize); } } if ($this().CodeGenOpts.DisableRedZone) { FuncAttrs.addAttribute(Attribute.AttrKind.NoRedZone); } if ($this().CodeGenOpts.NoImplicitFloat) { FuncAttrs.addAttribute(Attribute.AttrKind.NoImplicitFloat); } if ($this().CodeGenOpts.EnableSegmentedStacks && !((TargetDecl != null) && TargetDecl.hasAttr(NoSplitStackAttr.class))) { FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"split-stack")); } if (AttrOnCallSite) { // Attributes that should go on the call site only. if (!$this().CodeGenOpts.SimplifyLibCalls || $this().CodeGenOpts.isNoBuiltinFunc(Name.data())) { FuncAttrs.addAttribute(Attribute.AttrKind.NoBuiltin); } if (!$this().CodeGenOpts.TrapFuncName.empty()) { FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"trap-func-name"), new StringRef($this().CodeGenOpts.TrapFuncName)); } } else { // Attributes that should go on the function, but not the call site. if (!$this().CodeGenOpts.DisableFPElim) { FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"no-frame-pointer-elim"), new StringRef(/*KEEP_STR*/$false)); } else if ($this().CodeGenOpts.OmitLeafFramePointer) { FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"no-frame-pointer-elim"), new StringRef(/*KEEP_STR*/$false)); FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"no-frame-pointer-elim-non-leaf")); } else { FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"no-frame-pointer-elim"), new StringRef(/*KEEP_STR*/$true)); FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"no-frame-pointer-elim-non-leaf")); } boolean DisableTailCalls = $this().CodeGenOpts.DisableTailCalls || HasAnyX86InterruptAttr || ((TargetDecl != null) && TargetDecl.hasAttr(DisableTailCallsAttr.class)); FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"disable-tail-calls"), llvm.toStringRef(DisableTailCalls)); FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"less-precise-fpmad"), llvm.toStringRef($this().CodeGenOpts.LessPreciseFPMAD)); FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"no-infs-fp-math"), llvm.toStringRef($this().CodeGenOpts.NoInfsFPMath)); FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"no-nans-fp-math"), llvm.toStringRef($this().CodeGenOpts.NoNaNsFPMath)); FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"unsafe-fp-math"), llvm.toStringRef($this().CodeGenOpts.UnsafeFPMath)); FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"use-soft-float"), llvm.toStringRef($this().CodeGenOpts.SoftFloat)); FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"stack-protector-buffer-size"), new StringRef(llvm.utostr($uint2ulong($this().CodeGenOpts.SSPBufferSize)))); FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"no-signed-zeros-fp-math"), llvm.toStringRef($this().CodeGenOpts.NoSignedZeros)); if ($this().CodeGenOpts.StackRealignment) { FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"stackrealign")); } if ($this().CodeGenOpts.Backchain) { FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"backchain")); } // Add target-cpu and target-features attributes to functions. If // we have a decl for the function and it has a target attribute then // parse that and add it to the feature set. StringRef TargetCPU = new StringRef($this().getTarget().getTargetOpts().CPU); /*const*/ FunctionDecl /*P*/ FD = dyn_cast_or_null_FunctionDecl(TargetDecl); if ((FD != null) && FD.hasAttr(TargetAttr.class)) { StringMapBool FeatureMap = null; std.vectorString Features = null; std.pair<std.vectorString, StringRef> ParsedAttr = null; try { FeatureMap/*J*/= new StringMapBool(false); $this().getFunctionFeatureMap(FeatureMap, FD); // Produce the canonical string for this set of features. Features/*J*/= new std.vectorString(std.string.EMPTY); for (StringMapIteratorBool it = new StringMapIteratorBool(JD$Move.INSTANCE, FeatureMap.begin()), ie = new StringMapIteratorBool(JD$Move.INSTANCE, FeatureMap.end()); it.$noteq(ie); it.$preInc()) { Features.push_back_T$RR($add_T$C$P_string((it.$arrow().second ? $PLUS : $MINUS), it.$arrow().first().str())); } // Now add the target-cpu and target-features to the function. // While we populated the feature map above, we still need to // get and parse the target attribute so we can get the cpu for // the function. /*const*/ TargetAttr /*P*/ TD = FD.getAttr(TargetAttr.class); ParsedAttr = TD.parse(); if ($noteq_StringRef(/*NO_COPY*/ParsedAttr.second, /*STRINGREF_STR*/"")) { TargetCPU.$assign(ParsedAttr.second); } if ($noteq_StringRef(/*NO_COPY*/TargetCPU, /*STRINGREF_STR*/"")) { FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"target-cpu"), new StringRef(TargetCPU)); } if (!Features.empty()) { std.sort(Features.begin(), Features.end()); FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"target-features"), new StringRef(llvm.join(Features.begin(), Features.end(), new StringRef(/*KEEP_STR*/$COMMA)))); } } finally { if (ParsedAttr != null) { ParsedAttr.$destroy(); } if (Features != null) { Features.$destroy(); } if (FeatureMap != null) { FeatureMap.$destroy(); } } } else { // Otherwise just add the existing target cpu and target features to the // function. final std.vectorString/*&*/ Features = $this().getTarget().getTargetOpts().Features; if ($noteq_StringRef(/*NO_COPY*/TargetCPU, /*STRINGREF_STR*/"")) { FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"target-cpu"), new StringRef(TargetCPU)); } if (!Features.empty()) { std.sort(Features.begin(), Features.end()); FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"target-features"), new StringRef(llvm.join(Features.begin(), Features.end(), new StringRef(/*KEEP_STR*/$COMMA)))); } } } if ($this().getLangOpts().CUDA && $this().getLangOpts().CUDAIsDevice) { // Conservatively, mark all functions and calls in CUDA as convergent // (meaning, they may call an intrinsically convergent op, such as // __syncthreads(), and so can't have certain optimizations applied around // them). LLVM will remove this attribute where it safely can. FuncAttrs.addAttribute(Attribute.AttrKind.Convergent); // Respect -fcuda-flush-denormals-to-zero. if ($this().getLangOpts().CUDADeviceFlushDenormalsToZero) { FuncAttrs.addAttribute(new StringRef(/*KEEP_STR*/"nvptx-f32ftz"), new StringRef(/*KEEP_STR*/$true)); } } IRFunctionArgs/*J*/= new ClangToLLVMArgMapping($this().getContext(), FI); QualType RetTy = FI.getReturnType().$QualType(); final /*const*/ ABIArgInfo /*&*/ RetAI = FI.getReturnInfo$Const(); switch (RetAI.getKind()) { case Extend: if (RetTy.$arrow().hasSignedIntegerRepresentation()) { RetAttrs.addAttribute(Attribute.AttrKind.SExt); } else if (RetTy.$arrow().hasUnsignedIntegerRepresentation()) { RetAttrs.addAttribute(Attribute.AttrKind.ZExt); } case Direct: // FALL THROUGH if (RetAI.getInReg()) { RetAttrs.addAttribute(Attribute.AttrKind.InReg); } break; case Ignore: break; case InAlloca: case Indirect: { // inalloca and sret disable readnone and readonly FuncAttrs.removeAttribute(Attribute.AttrKind.ReadOnly). removeAttribute(Attribute.AttrKind.ReadNone); break; } case CoerceAndExpand: break; case Expand: throw new llvm_unreachable("Invalid ABI kind for return argument"); } { /*const*/ ReferenceType /*P*/ RefTy = RetTy.$arrow().getAs(ReferenceType.class); if ((RefTy != null)) { QualType PTy = RefTy.getPointeeType(); if (!PTy.$arrow().isIncompleteType() && PTy.$arrow().isConstantSizeType()) { RetAttrs.addDereferenceableAttr($this().getContext().getTypeSizeInChars(/*NO_COPY*/PTy). getQuantity()); } else if ($this().getContext().getTargetAddressSpace(new QualType(PTy)) == 0) { RetAttrs.addAttribute(Attribute.AttrKind.NonNull); } } } // Attach return attributes. if (RetAttrs.hasAttributes()) { PAL.push_back(AttributeSet.get($this().getLLVMContext(), AttributeSet.AttrIndex.ReturnIndex.getValue(), RetAttrs)); } boolean hasUsedSRet = false; // Attach attributes to sret. if (IRFunctionArgs.hasSRetArg()) { AttrBuilder SRETAttrs = null; try { SRETAttrs/*J*/= new AttrBuilder(); SRETAttrs.addAttribute(Attribute.AttrKind.StructRet); hasUsedSRet = true; if (RetAI.getInReg()) { SRETAttrs.addAttribute(Attribute.AttrKind.InReg); } PAL.push_back(AttributeSet.get($this().getLLVMContext(), IRFunctionArgs.getSRetArgNo() + 1, SRETAttrs)); } finally { if (SRETAttrs != null) { SRETAttrs.$destroy(); } } } // Attach attributes to inalloca argument. if (IRFunctionArgs.hasInallocaArg()) { AttrBuilder Attrs = null; try { Attrs/*J*/= new AttrBuilder(); Attrs.addAttribute(Attribute.AttrKind.InAlloca); PAL.push_back(AttributeSet.get($this().getLLVMContext(), IRFunctionArgs.getInallocaArgNo() + 1, Attrs)); } finally { if (Attrs != null) { Attrs.$destroy(); } } } /*uint*/int ArgNo = 0; for (type$ptr</*const*/ CGFunctionInfoArgInfo /*P*/ > I = $tryClone(FI.arg_begin$Const()), /*P*/ E = $tryClone(FI.arg_end$Const()); $noteq_ptr(I, E); I.$preInc() , ++ArgNo) { AttrBuilder Attrs = null; try { QualType ParamType = I./*->*/$star().type.$QualType(); final /*const*/ ABIArgInfo /*&*/ AI = I./*->*/$star().info; Attrs/*J*/= new AttrBuilder(); // Add attribute for padding argument, if necessary. if (IRFunctionArgs.hasPaddingArg(ArgNo)) { if (AI.getPaddingInReg()) { PAL.push_back(AttributeSet.get_LLVMContext_uint_ArrayRef$AttrKind($this().getLLVMContext(), IRFunctionArgs.getPaddingArgNo(ArgNo) + 1, new ArrayRef<Attribute.AttrKind>(Attribute.AttrKind.InReg))); } } // 'restrict' -> 'noalias' is done in EmitFunctionProlog when we // have the corresponding parameter variable. It doesn't make // sense to do it here because parameters are so messed up. switch (AI.getKind()) { case Extend: if (ParamType.$arrow().isSignedIntegerOrEnumerationType()) { Attrs.addAttribute(Attribute.AttrKind.SExt); } else if (ParamType.$arrow().isUnsignedIntegerOrEnumerationType()) { if ($this().getTypes().getABIInfo().shouldSignExtUnsignedType(new QualType(ParamType))) { Attrs.addAttribute(Attribute.AttrKind.SExt); } else { Attrs.addAttribute(Attribute.AttrKind.ZExt); } } case Direct: // FALL THROUGH if (ArgNo == 0 && FI.isChainCall()) { Attrs.addAttribute(Attribute.AttrKind.Nest); } else if (AI.getInReg()) { Attrs.addAttribute(Attribute.AttrKind.InReg); } break; case Indirect: { if (AI.getInReg()) { Attrs.addAttribute(Attribute.AttrKind.InReg); } if (AI.getIndirectByVal()) { Attrs.addAttribute(Attribute.AttrKind.ByVal); } CharUnits Align = AI.getIndirectAlign(); // In a byval argument, it is important that the required // alignment of the type is honored, as LLVM might be creating a // *new* stack object, and needs to know what alignment to give // it. (Sometimes it can deduce a sensible alignment on its own, // but not if clang decides it must emit a packed struct, or the // user specifies increased alignment requirements.) // // This is different from indirect *not* byval, where the object // exists already, and the align attribute is purely // informative. assert (!Align.isZero()); // For now, only add this when we have a byval argument. // TODO: be less lazy about updating test cases. if (AI.getIndirectByVal()) { Attrs.addAlignmentAttr($long2uint(Align.getQuantity())); } // byval disables readnone and readonly. FuncAttrs.removeAttribute(Attribute.AttrKind.ReadOnly). removeAttribute(Attribute.AttrKind.ReadNone); break; } case Ignore: case Expand: case CoerceAndExpand: break; case InAlloca: // inalloca disables readnone and readonly. FuncAttrs.removeAttribute(Attribute.AttrKind.ReadOnly). removeAttribute(Attribute.AttrKind.ReadNone); continue; } { /*const*/ ReferenceType /*P*/ RefTy = ParamType.$arrow().getAs(ReferenceType.class); if ((RefTy != null)) { QualType PTy = RefTy.getPointeeType(); if (!PTy.$arrow().isIncompleteType() && PTy.$arrow().isConstantSizeType()) { Attrs.addDereferenceableAttr($this().getContext().getTypeSizeInChars(/*NO_COPY*/PTy). getQuantity()); } else if ($this().getContext().getTargetAddressSpace(new QualType(PTy)) == 0) { Attrs.addAttribute(Attribute.AttrKind.NonNull); } } } switch (FI.getExtParameterInfo(ArgNo).getABI()) { case Ordinary: break; case SwiftIndirectResult: { // Add 'sret' if we haven't already used it for something, but // only if the result is void. if (!hasUsedSRet && RetTy.$arrow().isVoidType()) { Attrs.addAttribute(Attribute.AttrKind.StructRet); hasUsedSRet = true; } // Add 'noalias' in either case. Attrs.addAttribute(Attribute.AttrKind.NoAlias); // Add 'dereferenceable' and 'alignment'. QualType PTy = ParamType.$arrow().getPointeeType(); if (!PTy.$arrow().isIncompleteType() && PTy.$arrow().isConstantSizeType()) { std.pairTypeType<CharUnits, CharUnits> info = $this().getContext().getTypeInfoInChars(new QualType(PTy)); Attrs.addDereferenceableAttr(info.first.getQuantity()); Attrs.addAttribute(Attribute.getWithAlignment($this().getLLVMContext(), info.second.getQuantity())); } break; } case SwiftErrorResult: Attrs.addAttribute(Attribute.AttrKind.SwiftError); break; case SwiftContext: Attrs.addAttribute(Attribute.AttrKind.SwiftSelf); break; } if (Attrs.hasAttributes()) { //std.tie(FirstIRArg, NumIRArgs).$assign(tmp); final pairUIntUInt tmp = IRFunctionArgs.getIRArgs(ArgNo); /*uint*/int FirstIRArg = tmp.first; /*uint*/int NumIRArgs = tmp.second; for (/*uint*/int i = 0; $less_uint(i, NumIRArgs); i++) { PAL.push_back(AttributeSet.get($this().getLLVMContext(), FirstIRArg + i + 1, Attrs)); } } } finally { if (Attrs != null) { Attrs.$destroy(); } } } assert (ArgNo == FI.arg_size()); if (FuncAttrs.hasAttributes()) { PAL.push_back(AttributeSet.get($this().getLLVMContext(), AttributeSet.AttrIndex.FunctionIndex.getValue(), FuncAttrs)); } } finally { if (IRFunctionArgs != null) { IRFunctionArgs.$destroy(); } if (RetAttrs != null) { RetAttrs.$destroy(); } if (FuncAttrs != null) { FuncAttrs.$destroy(); } } } } // END OF class CodeGenModule_CGCall
207ab269b3a9b47484cc1cefa0e2cb31a99b5370
eb4139a95da63d9e79c0989b2a6a13f87f7ac30e
/2/p2/ad/NinjaManager.java
a6f0bf204f0c703770136ee3a7e364d2095a7239
[]
no_license
takahyon/Programming-Funmdamental2
8a629c53bb7eebc40331971067ee0663c1a74cc4
a9a01cfca8e4285486c85afc2fc190b40735b4f4
refs/heads/master
2021-01-10T23:28:44.184209
2016-10-18T08:59:33
2016-10-18T08:59:33
70,604,256
0
0
null
2016-10-18T08:59:33
2016-10-11T14:53:17
Java
UTF-8
Java
false
false
424
java
class NinjaManager{ public static void main(String args[]){ Ninja hanzo =new Ninja(); hanzo.setHitPoint(700); hanzo.setLoyalty(300.0); Ninja jouun = new Ninja(); jouun.setHitPoint(400); jouun.setLoyalty(-50.0); System.out.println(hanzo.getHitPoint()); System.out.println(hanzo.getLoyalty()); System.out.println(jouun.getHitPoint()); System.out.println(jouun.getLoyalty()); } }
[ "Takamasa Iijima" ]
Takamasa Iijima
bf4e8f3be380cbab423523ea6683cc34e25b5db2
2761b3950e814de258c993e22c05e4750f52fa44
/app/src/main/java/com/example/admin/leiyun_ic/HomePage/IntegralSuperiorityActivity.java
1edb63ccd44e18fc41521ee83357c9cb6f7466e8
[]
no_license
yanghaizhou0807/leiyun
ad532e17b2ce06f4a387fb8662f5380ed4de8c63
aeb9cf351a6a072324aebedc9a093f900904a479
refs/heads/master
2020-05-31T08:19:02.479191
2019-06-14T10:51:26
2019-06-14T10:51:26
190,186,294
1
0
null
null
null
null
UTF-8
Java
false
false
557
java
package com.example.admin.leiyun_ic.HomePage; import android.os.Bundle; import android.support.annotation.Nullable; import com.example.admin.leiyun_ic.Base.BaseActivity; import com.example.admin.leiyun_ic.R; import qiu.niorgai.StatusBarCompat; public class IntegralSuperiorityActivity extends BaseActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.integral_superiority_acty); StatusBarCompat.translucentStatusBar(this); } }
b247c26f17f537b486227359238416b97498f2ca
7b3636ba54e7b2c39eecaec5e0568cefe42ac89a
/src/main/java/com/exacttarget/fuelsdk/annotations/InternalProperty.java
ec95b9156f8176db1a4f1c4f5212fa54b6d092ea
[ "BSD-3-Clause" ]
permissive
AndrewJMiller/fuel-java
7c8f2f0aab3d4f568261c5fa64b6bd47f940186d
eba9f88a63d9b34b92b492b025c3f76da4f3740f
refs/heads/master
2021-01-15T20:14:13.693341
2015-04-20T17:48:35
2015-04-20T17:48:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,970
java
// // This file is part of the Fuel Java client library. // // Copyright (c) 2013, 2014, 2015, ExactTarget, Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // * Neither the name of ExactTarget, Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // package com.exacttarget.fuelsdk.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) public @interface InternalProperty { String value(); }
91006f34e7be2372b8e5917bf53098fa4e4e0ba6
a9d3e99c238a5c723f8f7e170884b54ea797bcb2
/src/main/java/com/natth/FixitWebservice/model/Technicians.java
fa2ca4906e280755a967bcc1de6958c55abdc67d
[]
no_license
Natthawarapon/FixitWebService
840ba908d73600836b6c431543703d83237d6885
4e0e343d69148b33980773e77ed33a579eb13daa
refs/heads/master
2022-04-25T23:34:22.701371
2020-04-29T17:45:02
2020-04-29T17:45:02
259,995,775
0
0
null
null
null
null
UTF-8
Java
false
false
2,636
java
package com.natth.FixitWebservice.model; import javax.persistence.*; import java.io.Serializable; import java.util.Objects; @Entity @Table(schema = "fixitdb" , name = "users") public class Technicians implements Serializable { private static final long serialVersionUID = 422078653576733017L; private int idTechnicians; private String nameStore; private String nameOwn; private String email; private String numberphone; private String latitude; private String longitude; private String password; private String lastUpdate; private String address; @Id @Column(name = "id_technicians") @GeneratedValue(strategy=GenerationType.IDENTITY) public int getIdTechnicians() { return idTechnicians; } public void setIdTechnicians(int idTechnicians) { this.idTechnicians = idTechnicians; } @Basic @Column(name = "name_store") public String getNameStore() { return nameStore; } public void setNameStore(String nameStore) { this.nameStore = nameStore; } @Basic @Column(name = "name_own") public String getNameOwn() { return nameOwn; } public void setNameOwn(String nameOwn) { this.nameOwn = nameOwn; } @Basic @Column(name = "email") public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @Basic @Column(name = "tel") public String getNumberphone() { return numberphone; } public void setNumberphone(String numberphone) { this.numberphone = numberphone; } @Basic @Column(name = "latitude") public String getLatitude() { return latitude; } public void setLatitude(String latitude) { this.latitude = latitude; } @Basic @Column(name = "longitude") public String getLongitude() { return longitude; } public void setLongitude(String longitude) { this.longitude = longitude; } @Basic @Column(name = "password") public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @Basic @Column(name = "last_update") public String getLastUpdate() { return lastUpdate; } public void setLastUpdate(String lastUpdate) { this.lastUpdate = lastUpdate; } @Basic @Column(name = "address") public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } }
ff1ce0b1e1b62eeceec6b2c898686da985361fe1
85bf94726cc7862d4013312ad4ba1465aab7f4b9
/mvc/src/main/java/gx/web/mvc/verticles/InitHttpRoute.java
48049fdfbc8036d9a90bd718e4340fd70c501b31
[]
no_license
xiaochenge/java
c5e5026b36c0c5b685ef816a92e3bc4f5558d3ae
485d4e7a5599dc1e0f84abfd55f19dbe2249745f
refs/heads/master
2020-03-26T01:52:34.364205
2019-03-01T16:47:21
2019-03-01T16:47:21
144,386,780
0
0
null
null
null
null
UTF-8
Java
false
false
6,614
java
/*package gx.web.mvc.verticles; import java.io.File; import java.io.FileFilter; import java.io.IOException; import java.net.URL; import java.net.URLDecoder; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; import gx.common.annotation.HttpRoute; import gx.common.annotation.RouteController; public class InitHttpRoute { public static Map<String,Class<?>> InitHttpRoute(String scanningPath) throws Exception { // 包下面的类 Set<Class<?>> classes = getClasses(scanningPath); Map<String,Class<?>> map=null; if (classes == null || classes.size()==0) { System.out.printf("null"); } else { //获取符合规范controller对象 map= getByInterface(classes); } return map; } *//** * 从包package中获取所有的Class * * @param pack * @return *//* public static Set<Class<?>> getClasses(String pack) { // 第一个class类的集合 Set<Class<?>> classes = new LinkedHashSet<Class<?>>(); // 是否循环迭代 boolean recursive = true; // 获取包的名字 并进行替换 String packageName = pack; String packageDirName = packageName.replace(".", File.separator); // 定义一个枚举的集合 并进行循环来处理这个目录下的things Enumeration<URL> dirs; try { dirs = Thread.currentThread().getContextClassLoader().getResources( packageDirName); // 循环迭代下去 while (dirs.hasMoreElements()) { // 获取下一个元素 URL url = dirs.nextElement(); // 得到协议的名称 String protocol = url.getProtocol(); // 如果是以文件的形式保存在服务器上 if ("file".equals(protocol)) { System.err.println("file类型的扫描"); // 获取包的物理路径 String filePath = URLDecoder.decode(url.getFile(), "UTF-8"); // 以文件的方式扫描整个包下的文件 并添加到集合中 findAndAddClassesInPackageByFile(packageName, filePath, recursive, classes); } } } catch (IOException e) { e.printStackTrace(); } return classes; } *//** * 以文件的形式来获取包下的所有Class * * @param packageName * @param packagePath * @param recursive * @param classes *//* public static void findAndAddClassesInPackageByFile(String packageName, String packagePath, final boolean recursive, Set<Class<?>> classes) { // 获取此包的目录 建立一个File File dir = new File(packagePath); // 如果不存在或者 也不是目录就直接返回 if (!dir.exists() || !dir.isDirectory()) { // log.warn("用户定义包名 " + packageName + " 下没有任何文件"); return; } // 如果存在 就获取包下的所有文件 包括目录 File[] dirfiles = dir.listFiles(new FileFilter() { // 自定义过滤规则 如果可以循环(包含子目录) 或则是以.class结尾的文件(编译好的java类文件) public boolean accept(File file) { return (recursive && file.isDirectory()) || (file.getName().endsWith(".class")); } }); // 循环所有文件 for (File file : dirfiles) { // 如果是目录 则继续扫描 if (file.isDirectory()) { findAndAddClassesInPackageByFile(packageName + "." + file.getName(), file.getAbsolutePath(), recursive, classes); } else { // 如果是java类文件 去掉后面的.class 只留下类名 String className = file.getName().substring(0, file.getName().length() - 6); try { // 添加到集合中去 //classes.add(Class.forName(packageName + '.' + className)); //经过回复同学的提醒,这里用forName有一些不好,会触发static方法,没有使用classLoader的load干净 classes.add(Thread.currentThread().getContextClassLoader().loadClass(packageName + '.' + className)); } catch (ClassNotFoundException e) { // log.error("添加用户自定义视图类错误 找不到此类的.class文件"); e.printStackTrace(); } } } } *//** * 返回所有符合条件对象 * @param classesAll * @return *//* private static Map<String,Class<?>> getByInterface( Set<Class<?>> classesAll) { Class<?> cls=null; Map<String,Class<?>> map=new HashMap<>(); Set<String> set=new HashSet<>(); //获取指定接口的实现类 try { *//** * 循环判断路径下的所有类是否继承了指定类 * 并且排除父类自己 *//* Iterator<Class<?>> iterator = classesAll.iterator(); while (iterator.hasNext()) { cls = iterator.next(); //此类包含RouteController注解 if(cls.isAnnotationPresent(RouteController.class)) { //获取所有注解 HttpRoute annotation = cls.getAnnotation(HttpRoute.class); //判断类上的注解value是否重复 if(set.add(annotation.value())){ String className = cls.toString().substring(6); map.put(className, Class.forName(className)); }else { //一旦重复抛出异常 throw new RuntimeException(); } } } } catch(RuntimeException e) { System.out.println(cls.getName()+"此对象HttpRoute注解的value重复"); }catch (Exception e) { System.out.println(cls.getName()+"此对象添加RouteControlle注解必须同时使用HttpRoute注解"); } return map; } } */
[ "chenwu123" ]
chenwu123
7688cc75788dd40284de2e1deb7282fda10530ed
fd9a36eb029002b755b1903b051757748727c567
/_06DesarrolloClases/src/_03ejercicios/_01gestionempleados/TestEmpleado.java
8f2fb4685e90b1571693dfce8d58a3f5aadfe680
[]
no_license
hik4ru/PRO.Eclipse
75fde55fd6c5dec8e37f275af15e4d9819da700d
3f6472307d996da630db03e216e7cb5fcb60358f
refs/heads/master
2016-09-16T04:10:58.247827
2015-05-14T15:14:27
2015-05-14T15:14:27
29,671,113
0
0
null
null
null
null
UTF-8
Java
false
false
1,203
java
package _03ejercicios._01gestionempleados; import java.util.Scanner; public class TestEmpleado { public static void main(String[] args) { Empleado e1 = leerEmpleado(); Empleado e2 = leerEmpleado(); if (e1.getSueldoBruto()>e2.getSueldoBruto()) e2.IncrementarSueldo(20); else if (e2.getSueldoBruto()>e1.getSueldoBruto()) e1.IncrementarSueldo(20); if (e1.Antiguedad()>e2.Antiguedad()) e1.IncrementarSueldo(10); else if (e2.Antiguedad()>e1.Antiguedad()) e2.IncrementarSueldo(10); System.out.println(Empleado.calcularIRPF(e1.getSueldoBruto())); System.out.println(Empleado.calcularIRPF(e2.getSueldoBruto())); } public static Empleado leerEmpleado (){ Scanner tec = new Scanner(System.in); System.out.println("Introduce Nombre del Empleado"); String nombre = tec.nextLine(); System.out.println("Introduce DNI del Empleado"); String dni = tec.nextLine(); System.out.println("Introduce anyo de ingreso del Empleado"); int anyo = tec.nextInt(); System.out.println("Introduce sueldo bruto del Empleado"); double sueldo = tec.nextDouble(); Empleado e = new Empleado(nombre,dni,anyo,sueldo); return e; } }
[ "Hikaru@Hikarito-PC" ]
Hikaru@Hikarito-PC
d66fc2f0e4e2aa2a9ed3ae6da3e0874e12565750
ad9af72fbc6c371143dd4177e269e2d4abca70a7
/util/bi.java
292f5b9470592084632eb603503945ff9792ad8c
[]
no_license
Abhisheksnair/tempr
c7051f2b495b8d0edd3a6d6d235744c99cc0e0bf
ba55407648c682a1ff412566332eaea755bef121
refs/heads/master
2020-04-02T13:17:10.446365
2018-10-24T09:35:56
2018-10-24T09:35:56
154,474,886
0
0
null
null
null
null
UTF-8
Java
false
false
36,348
java
package com.whatsapp.util; import a.a.a.a.a.a.d; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.TransitionDrawable; import android.os.Handler; import android.os.Looper; import android.support.v4.f.f; import android.widget.ImageView; import java.io.File; import java.io.IOException; import java.util.Stack; public final class bi { private static final Bitmap a = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); private final f<String, Bitmap> b; private d[] c; private o d; private final Object e = new Object(); private final File f; private final long g; private final e h = new e((byte)0); private final Drawable i; private final Drawable j; private final int k; private boolean l = false; private final Handler m = new Handler(Looper.getMainLooper()); private bi(b paramb) { this.j = paramb.d; this.i = paramb.c; this.k = paramb.f; this.f = paramb.a; this.g = paramb.b; this.c = new d[paramb.e]; int n = 0; while (n < paramb.e) { this.c[n] = new d(0); this.c[n].setPriority(4); n += 1; } this.b = new f((int)(Runtime.getRuntime().maxMemory() / 8192L)) {}; } /* Error */ private Bitmap a(c paramc) { // Byte code: // 0: aload_1 // 1: getfield 145 com/whatsapp/util/bi$c:a Ljava/lang/String; // 4: invokestatic 150 com/whatsapp/r:a (Ljava/lang/String;)Ljava/lang/String; // 7: astore 10 // 9: aload_0 // 10: getfield 65 com/whatsapp/util/bi:e Ljava/lang/Object; // 13: astore 7 // 15: aload 7 // 17: monitorenter // 18: aload_0 // 19: getfield 152 com/whatsapp/util/bi:d Lcom/whatsapp/util/o; // 22: ifnull +13 -> 35 // 25: aload_0 // 26: getfield 152 com/whatsapp/util/bi:d Lcom/whatsapp/util/o; // 29: invokevirtual 157 com/whatsapp/util/o:a ()Z // 32: ifeq +91 -> 123 // 35: aload_0 // 36: getfield 101 com/whatsapp/util/bi:f Ljava/io/File; // 39: invokevirtual 162 java/io/File:exists ()Z // 42: ifne +45 -> 87 // 45: aload_0 // 46: getfield 101 com/whatsapp/util/bi:f Ljava/io/File; // 49: invokevirtual 165 java/io/File:mkdirs ()Z // 52: ifne +35 -> 87 // 55: aload_0 // 56: getfield 101 com/whatsapp/util/bi:f Ljava/io/File; // 59: invokevirtual 162 java/io/File:exists ()Z // 62: ifne +25 -> 87 // 65: new 167 java/lang/StringBuilder // 68: dup // 69: ldc -87 // 71: invokespecial 172 java/lang/StringBuilder:<init> (Ljava/lang/String;)V // 74: aload_0 // 75: getfield 101 com/whatsapp/util/bi:f Ljava/io/File; // 78: invokevirtual 176 java/lang/StringBuilder:append (Ljava/lang/Object;)Ljava/lang/StringBuilder; // 81: invokevirtual 180 java/lang/StringBuilder:toString ()Ljava/lang/String; // 84: invokestatic 184 com/whatsapp/util/Log:e (Ljava/lang/String;)V // 87: aload_0 // 88: getfield 101 com/whatsapp/util/bi:f Ljava/io/File; // 91: invokevirtual 187 java/io/File:getUsableSpace ()J // 94: lstore_3 // 95: aload_0 // 96: getfield 105 com/whatsapp/util/bi:g J // 99: lstore 5 // 101: lload_3 // 102: lload 5 // 104: lcmp // 105: ifle +18 -> 123 // 108: aload_0 // 109: aload_0 // 110: getfield 101 com/whatsapp/util/bi:f Ljava/io/File; // 113: aload_0 // 114: getfield 105 com/whatsapp/util/bi:g J // 117: invokestatic 190 com/whatsapp/util/o:a (Ljava/io/File;J)Lcom/whatsapp/util/o; // 120: putfield 152 com/whatsapp/util/bi:d Lcom/whatsapp/util/o; // 123: aload_0 // 124: getfield 65 com/whatsapp/util/bi:e Ljava/lang/Object; // 127: invokevirtual 193 java/lang/Object:notifyAll ()V // 130: aload 7 // 132: monitorexit // 133: aload_0 // 134: aload 10 // 136: invokespecial 196 com/whatsapp/util/bi:a (Ljava/lang/String;)Landroid/graphics/Bitmap; // 139: astore 7 // 141: aload 7 // 143: ifnull +37 -> 180 // 146: aload 7 // 148: areturn // 149: astore 8 // 151: new 167 java/lang/StringBuilder // 154: dup // 155: ldc -58 // 157: invokespecial 172 java/lang/StringBuilder:<init> (Ljava/lang/String;)V // 160: aload 8 // 162: invokevirtual 176 java/lang/StringBuilder:append (Ljava/lang/Object;)Ljava/lang/StringBuilder; // 165: invokevirtual 180 java/lang/StringBuilder:toString ()Ljava/lang/String; // 168: invokestatic 184 com/whatsapp/util/Log:e (Ljava/lang/String;)V // 171: goto -48 -> 123 // 174: astore_1 // 175: aload 7 // 177: monitorexit // 178: aload_1 // 179: athrow // 180: new 167 java/lang/StringBuilder // 183: dup // 184: ldc -56 // 186: invokespecial 172 java/lang/StringBuilder:<init> (Ljava/lang/String;)V // 189: aload_1 // 190: getfield 145 com/whatsapp/util/bi$c:a Ljava/lang/String; // 193: invokevirtual 203 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 196: invokevirtual 180 java/lang/StringBuilder:toString ()Ljava/lang/String; // 199: invokestatic 205 com/whatsapp/util/Log:i (Ljava/lang/String;)V // 202: new 207 org/apache/http/client/methods/HttpGet // 205: dup // 206: aload_1 // 207: getfield 145 com/whatsapp/util/bi$c:a Ljava/lang/String; // 210: invokespecial 208 org/apache/http/client/methods/HttpGet:<init> (Ljava/lang/String;)V // 213: astore 7 // 215: new 210 org/apache/http/params/BasicHttpParams // 218: dup // 219: invokespecial 211 org/apache/http/params/BasicHttpParams:<init> ()V // 222: astore 8 // 224: aload 8 // 226: sipush 15000 // 229: invokestatic 217 org/apache/http/params/HttpConnectionParams:setConnectionTimeout (Lorg/apache/http/params/HttpParams;I)V // 232: aload 8 // 234: sipush 30000 // 237: invokestatic 220 org/apache/http/params/HttpConnectionParams:setSoTimeout (Lorg/apache/http/params/HttpParams;I)V // 240: new 222 org/apache/http/impl/client/DefaultHttpClient // 243: dup // 244: aload 8 // 246: invokespecial 225 org/apache/http/impl/client/DefaultHttpClient:<init> (Lorg/apache/http/params/HttpParams;)V // 249: aload 7 // 251: invokevirtual 229 org/apache/http/impl/client/DefaultHttpClient:execute (Lorg/apache/http/client/methods/HttpUriRequest;)Lorg/apache/http/HttpResponse; // 254: invokeinterface 235 1 0 // 259: astore 7 // 261: aload 7 // 263: ifnull +139 -> 402 // 266: aload 7 // 268: invokeinterface 241 1 0 // 273: astore 11 // 275: aload_0 // 276: getfield 65 com/whatsapp/util/bi:e Ljava/lang/Object; // 279: astore 9 // 281: aload 9 // 283: monitorenter // 284: aload_0 // 285: getfield 152 com/whatsapp/util/bi:d Lcom/whatsapp/util/o; // 288: astore 7 // 290: aload 7 // 292: ifnull +107 -> 399 // 295: aload 11 // 297: ifnull +102 -> 399 // 300: aload_0 // 301: getfield 152 com/whatsapp/util/bi:d Lcom/whatsapp/util/o; // 304: aload 10 // 306: invokevirtual 244 com/whatsapp/util/o:a (Ljava/lang/String;)Lcom/whatsapp/util/o$c; // 309: astore 7 // 311: aload 7 // 313: ifnonnull +258 -> 571 // 316: aload_0 // 317: getfield 152 com/whatsapp/util/bi:d Lcom/whatsapp/util/o; // 320: aload 10 // 322: invokevirtual 247 com/whatsapp/util/o:b (Ljava/lang/String;)Lcom/whatsapp/util/o$a; // 325: astore 8 // 327: aload 8 // 329: ifnull +252 -> 581 // 332: aload 8 // 334: invokevirtual 252 com/whatsapp/util/o$a:a ()Ljava/io/OutputStream; // 337: astore 7 // 339: sipush 1024 // 342: newarray <illegal type> // 344: astore 12 // 346: aload 11 // 348: aload 12 // 350: iconst_0 // 351: sipush 1024 // 354: invokevirtual 258 java/io/InputStream:read ([BII)I // 357: istore_2 // 358: iload_2 // 359: iconst_m1 // 360: if_icmpeq +81 -> 441 // 363: aload 7 // 365: aload 12 // 367: iconst_0 // 368: iload_2 // 369: invokevirtual 264 java/io/OutputStream:write ([BII)V // 372: goto -26 -> 346 // 375: astore 8 // 377: ldc -56 // 379: aload 8 // 381: invokestatic 267 com/whatsapp/util/Log:d (Ljava/lang/String;Ljava/lang/Throwable;)V // 384: aload 7 // 386: ifnull +8 -> 394 // 389: aload 7 // 391: invokevirtual 270 java/io/OutputStream:close ()V // 394: aload 11 // 396: invokevirtual 271 java/io/InputStream:close ()V // 399: aload 9 // 401: monitorexit // 402: aload_0 // 403: aload 10 // 405: invokespecial 196 com/whatsapp/util/bi:a (Ljava/lang/String;)Landroid/graphics/Bitmap; // 408: astore 7 // 410: aload 7 // 412: ifnonnull +26 -> 438 // 415: new 167 java/lang/StringBuilder // 418: dup // 419: ldc_w 273 // 422: invokespecial 172 java/lang/StringBuilder:<init> (Ljava/lang/String;)V // 425: aload_1 // 426: getfield 145 com/whatsapp/util/bi$c:a Ljava/lang/String; // 429: invokevirtual 203 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 432: invokevirtual 180 java/lang/StringBuilder:toString ()Ljava/lang/String; // 435: invokestatic 184 com/whatsapp/util/Log:e (Ljava/lang/String;)V // 438: aload 7 // 440: areturn // 441: aload 8 // 443: getfield 275 com/whatsapp/util/o$a:b Z // 446: ifeq +54 -> 500 // 449: aload 8 // 451: getfield 277 com/whatsapp/util/o$a:c Lcom/whatsapp/util/o; // 454: aload 8 // 456: iconst_0 // 457: invokestatic 280 com/whatsapp/util/o:a (Lcom/whatsapp/util/o;Lcom/whatsapp/util/o$a;Z)V // 460: aload 8 // 462: getfield 277 com/whatsapp/util/o$a:c Lcom/whatsapp/util/o; // 465: aload 8 // 467: getfield 283 com/whatsapp/util/o$a:a Lcom/whatsapp/util/o$b; // 470: getfield 286 com/whatsapp/util/o$b:a Ljava/lang/String; // 473: invokevirtual 289 com/whatsapp/util/o:c (Ljava/lang/String;)Z // 476: pop // 477: aload 7 // 479: ifnull +8 -> 487 // 482: aload 7 // 484: invokevirtual 270 java/io/OutputStream:close ()V // 487: aload 11 // 489: invokevirtual 271 java/io/InputStream:close ()V // 492: goto -93 -> 399 // 495: astore 7 // 497: goto -98 -> 399 // 500: aload 8 // 502: getfield 277 com/whatsapp/util/o$a:c Lcom/whatsapp/util/o; // 505: aload 8 // 507: iconst_1 // 508: invokestatic 280 com/whatsapp/util/o:a (Lcom/whatsapp/util/o;Lcom/whatsapp/util/o$a;Z)V // 511: goto -34 -> 477 // 514: astore 8 // 516: aload 7 // 518: ifnull +8 -> 526 // 521: aload 7 // 523: invokevirtual 270 java/io/OutputStream:close ()V // 526: aload 11 // 528: invokevirtual 271 java/io/InputStream:close ()V // 531: aload 8 // 533: athrow // 534: astore 7 // 536: aload 9 // 538: monitorexit // 539: aload 7 // 541: athrow // 542: astore 7 // 544: new 167 java/lang/StringBuilder // 547: dup // 548: ldc_w 291 // 551: invokespecial 172 java/lang/StringBuilder:<init> (Ljava/lang/String;)V // 554: aload_1 // 555: getfield 145 com/whatsapp/util/bi$c:a Ljava/lang/String; // 558: invokevirtual 203 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 561: invokevirtual 180 java/lang/StringBuilder:toString ()Ljava/lang/String; // 564: aload 7 // 566: invokestatic 267 com/whatsapp/util/Log:d (Ljava/lang/String;Ljava/lang/Throwable;)V // 569: aconst_null // 570: areturn // 571: aload 7 // 573: getfield 296 com/whatsapp/util/o$c:a [Ljava/io/InputStream; // 576: iconst_0 // 577: aaload // 578: invokevirtual 271 java/io/InputStream:close ()V // 581: aconst_null // 582: astore 7 // 584: goto -107 -> 477 // 587: astore 7 // 589: goto -58 -> 531 // 592: astore 8 // 594: aconst_null // 595: astore 7 // 597: goto -81 -> 516 // 600: astore 8 // 602: goto -86 -> 516 // 605: astore 7 // 607: goto -208 -> 399 // 610: astore 8 // 612: aconst_null // 613: astore 7 // 615: goto -238 -> 377 // Local variable table: // start length slot name signature // 0 618 0 this bi // 0 618 1 paramc c // 357 12 2 n int // 94 8 3 l1 long // 99 4 5 l2 long // 13 470 7 localObject1 Object // 495 27 7 localIOException1 IOException // 534 6 7 localObject2 Object // 542 30 7 localException1 Exception // 582 1 7 localObject3 Object // 587 1 7 localIOException2 IOException // 595 1 7 localObject4 Object // 605 1 7 localIOException3 IOException // 613 1 7 localObject5 Object // 149 12 8 localIOException4 IOException // 222 111 8 localObject6 Object // 375 131 8 localException2 Exception // 514 18 8 localObject7 Object // 592 1 8 localObject8 Object // 600 1 8 localObject9 Object // 610 1 8 localException3 Exception // 279 258 9 localObject10 Object // 7 397 10 str String // 273 254 11 localInputStream java.io.InputStream // 344 22 12 arrayOfByte byte[] // Exception table: // from to target type // 108 123 149 java/io/IOException // 18 35 174 finally // 35 87 174 finally // 87 101 174 finally // 108 123 174 finally // 123 133 174 finally // 151 171 174 finally // 175 178 174 finally // 339 346 375 java/lang/Exception // 346 358 375 java/lang/Exception // 363 372 375 java/lang/Exception // 441 477 375 java/lang/Exception // 500 511 375 java/lang/Exception // 482 487 495 java/io/IOException // 487 492 495 java/io/IOException // 339 346 514 finally // 346 358 514 finally // 363 372 514 finally // 441 477 514 finally // 500 511 514 finally // 284 290 534 finally // 389 394 534 finally // 394 399 534 finally // 399 402 534 finally // 482 487 534 finally // 487 492 534 finally // 521 526 534 finally // 526 531 534 finally // 531 534 534 finally // 536 539 534 finally // 180 261 542 java/lang/Exception // 266 284 542 java/lang/Exception // 402 410 542 java/lang/Exception // 415 438 542 java/lang/Exception // 539 542 542 java/lang/Exception // 521 526 587 java/io/IOException // 526 531 587 java/io/IOException // 300 311 592 finally // 316 327 592 finally // 332 339 592 finally // 571 581 592 finally // 377 384 600 finally // 389 394 605 java/io/IOException // 394 399 605 java/io/IOException // 300 311 610 java/lang/Exception // 316 327 610 java/lang/Exception // 332 339 610 java/lang/Exception // 571 581 610 java/lang/Exception } /* Error */ private Bitmap a(String paramString) { // Byte code: // 0: aconst_null // 1: astore 5 // 3: aconst_null // 4: astore 4 // 6: aload_0 // 7: getfield 65 com/whatsapp/util/bi:e Ljava/lang/Object; // 10: astore 7 // 12: aload 7 // 14: monitorenter // 15: aload_0 // 16: getfield 152 com/whatsapp/util/bi:d Lcom/whatsapp/util/o; // 19: astore 6 // 21: aload 6 // 23: ifnull +214 -> 237 // 26: aload_0 // 27: getfield 152 com/whatsapp/util/bi:d Lcom/whatsapp/util/o; // 30: aload_1 // 31: invokevirtual 244 com/whatsapp/util/o:a (Ljava/lang/String;)Lcom/whatsapp/util/o$c; // 34: astore_1 // 35: aload_1 // 36: ifnull +356 -> 392 // 39: aload_1 // 40: getfield 296 com/whatsapp/util/o$c:a [Ljava/io/InputStream; // 43: iconst_0 // 44: aaload // 45: astore_1 // 46: aload_1 // 47: astore 6 // 49: aload_1 // 50: ifnull +240 -> 290 // 53: aload_1 // 54: invokestatic 304 a/a/a/a/d:a (Ljava/io/InputStream;)[B // 57: astore 4 // 59: new 306 android/graphics/BitmapFactory$Options // 62: dup // 63: invokespecial 307 android/graphics/BitmapFactory$Options:<init> ()V // 66: astore 5 // 68: aload 5 // 70: iconst_1 // 71: putfield 310 android/graphics/BitmapFactory$Options:inJustDecodeBounds Z // 74: aload 4 // 76: iconst_0 // 77: aload 4 // 79: arraylength // 80: aload 5 // 82: invokestatic 316 android/graphics/BitmapFactory:decodeByteArray ([BIILandroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap; // 85: pop // 86: aload 5 // 88: getfield 319 android/graphics/BitmapFactory$Options:outWidth I // 91: iflt +11 -> 102 // 94: aload 5 // 96: getfield 322 android/graphics/BitmapFactory$Options:outHeight I // 99: ifge +36 -> 135 // 102: ldc_w 324 // 105: invokestatic 184 com/whatsapp/util/Log:e (Ljava/lang/String;)V // 108: aconst_null // 109: astore 4 // 111: aload 4 // 113: ifnonnull +170 -> 283 // 116: ldc_w 326 // 119: invokestatic 184 com/whatsapp/util/Log:e (Ljava/lang/String;)V // 122: aload_1 // 123: ifnull +7 -> 130 // 126: aload_1 // 127: invokevirtual 271 java/io/InputStream:close ()V // 130: aload 7 // 132: monitorexit // 133: aconst_null // 134: areturn // 135: aload 5 // 137: getfield 319 android/graphics/BitmapFactory$Options:outWidth I // 140: istore_3 // 141: aload 5 // 143: getfield 322 android/graphics/BitmapFactory$Options:outHeight I // 146: istore_2 // 147: aload 5 // 149: iconst_1 // 150: putfield 329 android/graphics/BitmapFactory$Options:inSampleSize I // 153: iload_3 // 154: iconst_2 // 155: idiv // 156: aload_0 // 157: getfield 97 com/whatsapp/util/bi:k I // 160: if_icmpge +13 -> 173 // 163: iload_2 // 164: iconst_2 // 165: idiv // 166: aload_0 // 167: getfield 97 com/whatsapp/util/bi:k I // 170: if_icmplt +79 -> 249 // 173: iload_3 // 174: iconst_2 // 175: idiv // 176: istore_3 // 177: iload_2 // 178: iconst_2 // 179: idiv // 180: istore_2 // 181: aload 5 // 183: aload 5 // 185: getfield 329 android/graphics/BitmapFactory$Options:inSampleSize I // 188: iconst_1 // 189: iadd // 190: putfield 329 android/graphics/BitmapFactory$Options:inSampleSize I // 193: goto -40 -> 153 // 196: astore 5 // 198: aload_1 // 199: astore 4 // 201: aconst_null // 202: astore_1 // 203: new 167 java/lang/StringBuilder // 206: dup // 207: ldc_w 331 // 210: invokespecial 172 java/lang/StringBuilder:<init> (Ljava/lang/String;)V // 213: aload 5 // 215: invokevirtual 176 java/lang/StringBuilder:append (Ljava/lang/Object;)Ljava/lang/StringBuilder; // 218: invokevirtual 180 java/lang/StringBuilder:toString ()Ljava/lang/String; // 221: invokestatic 184 com/whatsapp/util/Log:e (Ljava/lang/String;)V // 224: aload 4 // 226: ifnull +8 -> 234 // 229: aload 4 // 231: invokevirtual 271 java/io/InputStream:close ()V // 234: aload_1 // 235: astore 4 // 237: aload 7 // 239: monitorexit // 240: aload 4 // 242: areturn // 243: astore_1 // 244: aload 7 // 246: monitorexit // 247: aload_1 // 248: athrow // 249: aload 5 // 251: iconst_0 // 252: putfield 310 android/graphics/BitmapFactory$Options:inJustDecodeBounds Z // 255: aload 5 // 257: iconst_1 // 258: putfield 334 android/graphics/BitmapFactory$Options:inPurgeable Z // 261: aload 5 // 263: iconst_1 // 264: putfield 337 android/graphics/BitmapFactory$Options:inInputShareable Z // 267: aload 4 // 269: iconst_0 // 270: aload 4 // 272: arraylength // 273: aload 5 // 275: invokestatic 316 android/graphics/BitmapFactory:decodeByteArray ([BIILandroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap; // 278: astore 4 // 280: goto -169 -> 111 // 283: aload_1 // 284: astore 6 // 286: aload 4 // 288: astore 5 // 290: aload 5 // 292: astore 4 // 294: aload 6 // 296: ifnull -59 -> 237 // 299: aload 6 // 301: invokevirtual 271 java/io/InputStream:close ()V // 304: aload 5 // 306: astore 4 // 308: goto -71 -> 237 // 311: astore_1 // 312: aload 5 // 314: astore 4 // 316: goto -79 -> 237 // 319: astore 4 // 321: aload_1 // 322: astore 4 // 324: goto -87 -> 237 // 327: astore 4 // 329: aconst_null // 330: astore_1 // 331: aload_1 // 332: ifnull +7 -> 339 // 335: aload_1 // 336: invokevirtual 271 java/io/InputStream:close ()V // 339: aload 4 // 341: athrow // 342: astore_1 // 343: goto -213 -> 130 // 346: astore_1 // 347: goto -8 -> 339 // 350: astore 4 // 352: goto -21 -> 331 // 355: astore 5 // 357: aload 4 // 359: astore_1 // 360: aload 5 // 362: astore 4 // 364: goto -33 -> 331 // 367: astore 5 // 369: aconst_null // 370: astore_1 // 371: aconst_null // 372: astore 4 // 374: goto -171 -> 203 // 377: astore 5 // 379: aload 4 // 381: astore 6 // 383: aload_1 // 384: astore 4 // 386: aload 6 // 388: astore_1 // 389: goto -186 -> 203 // 392: aconst_null // 393: astore 6 // 395: goto -105 -> 290 // Local variable table: // start length slot name signature // 0 398 0 this bi // 0 398 1 paramString String // 146 35 2 n int // 140 37 3 i1 int // 4 311 4 localObject1 Object // 319 1 4 localIOException1 IOException // 322 1 4 str String // 327 13 4 localObject2 Object // 350 8 4 localObject3 Object // 362 23 4 localObject4 Object // 1 183 5 localOptions android.graphics.BitmapFactory.Options // 196 78 5 localIOException2 IOException // 288 25 5 localObject5 Object // 355 6 5 localObject6 Object // 367 1 5 localIOException3 IOException // 377 1 5 localIOException4 IOException // 19 375 6 localObject7 Object // 10 235 7 localObject8 Object // Exception table: // from to target type // 53 102 196 java/io/IOException // 102 108 196 java/io/IOException // 135 153 196 java/io/IOException // 153 173 196 java/io/IOException // 173 193 196 java/io/IOException // 249 280 196 java/io/IOException // 15 21 243 finally // 126 130 243 finally // 130 133 243 finally // 229 234 243 finally // 237 240 243 finally // 244 247 243 finally // 299 304 243 finally // 335 339 243 finally // 339 342 243 finally // 299 304 311 java/io/IOException // 229 234 319 java/io/IOException // 26 35 327 finally // 39 46 327 finally // 126 130 342 java/io/IOException // 335 339 346 java/io/IOException // 53 102 350 finally // 102 108 350 finally // 116 122 350 finally // 135 153 350 finally // 153 173 350 finally // 173 193 350 finally // 249 280 350 finally // 203 224 355 finally // 26 35 367 java/io/IOException // 39 46 367 java/io/IOException // 116 122 377 java/io/IOException } public final void a(String arg1, ImageView paramImageView) { paramImageView.setTag(???); ??? = (Bitmap)this.b.a(???); if (??? != null) { if (??? != a) { paramImageView.setImageBitmap((Bitmap)???); } } for (;;) { return; paramImageView.setImageDrawable(this.j); return; paramImageView.setImageDrawable(this.i); a.d.b(); Log.d("tumbloader/queue " + ???); synchronized (this.h.a) { this.h.a(paramImageView); paramImageView = new c(???, paramImageView); } synchronized (this.h.a) { this.h.a.add(0, paramImageView); this.h.a.notify(); if (!this.l) { ??? = this.c; int i1 = ???.length; int n = 0; while (n < i1) { paramImageView = ???[n]; if (paramImageView.getState() == Thread.State.NEW) { paramImageView.start(); } n += 1; continue; ??? = finally; throw ???; } } } } this.l = true; } public final void a(boolean paramBoolean) { ??? = this.c; int i1 = ???.length; int n = 0; while (n < i1) { ???[n].interrupt(); n += 1; } synchronized (this.b) { this.b.a(0); } synchronized (this.e) { o localo = this.d; if ((localo == null) || (paramBoolean)) {} try { this.d.b(); if (!this.d.a()) { this.d.close(); } this.d = null; } catch (IOException localIOException) { for (;;) { Log.e("tumbloader/close " + localIOException); } } this.l = false; return; localObject2 = finally; throw ((Throwable)localObject2); } } final class a implements Runnable { private Bitmap b; private ImageView c; private String d; public a(Bitmap paramBitmap, ImageView paramImageView, String paramString) { this.b = paramBitmap; this.c = paramImageView; this.d = paramString; } public final void run() { if ((this.c.getTag() != null) && (this.c.getTag().equals(this.d))) { if (this.b == null) { break label121; } if (this.c.getDrawable() == null) { TransitionDrawable localTransitionDrawable = new TransitionDrawable(new Drawable[] { new ColorDrawable(0), new BitmapDrawable(this.c.getResources(), this.b) }); localTransitionDrawable.setCrossFadeEnabled(true); localTransitionDrawable.startTransition(200); this.c.setImageDrawable(localTransitionDrawable); } } else { return; } this.c.setImageBitmap(this.b); return; label121: this.c.setImageDrawable(bi.a(bi.this)); } } public static final class b { final File a; long b = 1048576L; public Drawable c; public Drawable d; int e = 4; public int f; public b(File paramFile) { this.a = paramFile; } public final b a() { this.b = 4194304L; return this; } public final bi b() { return new bi(this, (byte)0); } } final class c { public String a; public ImageView b; public c(String paramString, ImageView paramImageView) { this.a = paramString; this.b = paramImageView; } } final class d extends Thread { private d() {} /* Error */ public final void run() { // Byte code: // 0: aload_0 // 1: getfield 13 com/whatsapp/util/bi$d:a Lcom/whatsapp/util/bi; // 4: invokestatic 27 com/whatsapp/util/bi:b (Lcom/whatsapp/util/bi;)Lcom/whatsapp/util/bi$e; // 7: getfield 32 com/whatsapp/util/bi$e:a Ljava/util/Stack; // 10: invokevirtual 38 java/util/Stack:size ()I // 13: ifne +31 -> 44 // 16: aload_0 // 17: getfield 13 com/whatsapp/util/bi$d:a Lcom/whatsapp/util/bi; // 20: invokestatic 27 com/whatsapp/util/bi:b (Lcom/whatsapp/util/bi;)Lcom/whatsapp/util/bi$e; // 23: getfield 32 com/whatsapp/util/bi$e:a Ljava/util/Stack; // 26: astore_2 // 27: aload_2 // 28: monitorenter // 29: aload_0 // 30: getfield 13 com/whatsapp/util/bi$d:a Lcom/whatsapp/util/bi; // 33: invokestatic 27 com/whatsapp/util/bi:b (Lcom/whatsapp/util/bi;)Lcom/whatsapp/util/bi$e; // 36: getfield 32 com/whatsapp/util/bi$e:a Ljava/util/Stack; // 39: invokevirtual 43 java/lang/Object:wait ()V // 42: aload_2 // 43: monitorexit // 44: aload_0 // 45: getfield 13 com/whatsapp/util/bi$d:a Lcom/whatsapp/util/bi; // 48: invokestatic 27 com/whatsapp/util/bi:b (Lcom/whatsapp/util/bi;)Lcom/whatsapp/util/bi$e; // 51: getfield 32 com/whatsapp/util/bi$e:a Ljava/util/Stack; // 54: invokevirtual 38 java/util/Stack:size ()I // 57: ifeq +185 -> 242 // 60: aload_0 // 61: getfield 13 com/whatsapp/util/bi$d:a Lcom/whatsapp/util/bi; // 64: invokestatic 27 com/whatsapp/util/bi:b (Lcom/whatsapp/util/bi;)Lcom/whatsapp/util/bi$e; // 67: getfield 32 com/whatsapp/util/bi$e:a Ljava/util/Stack; // 70: astore_3 // 71: aload_3 // 72: monitorenter // 73: aload_0 // 74: getfield 13 com/whatsapp/util/bi$d:a Lcom/whatsapp/util/bi; // 77: invokestatic 27 com/whatsapp/util/bi:b (Lcom/whatsapp/util/bi;)Lcom/whatsapp/util/bi$e; // 80: getfield 32 com/whatsapp/util/bi$e:a Ljava/util/Stack; // 83: invokevirtual 38 java/util/Stack:size ()I // 86: ifeq +190 -> 276 // 89: aload_0 // 90: getfield 13 com/whatsapp/util/bi$d:a Lcom/whatsapp/util/bi; // 93: invokestatic 27 com/whatsapp/util/bi:b (Lcom/whatsapp/util/bi;)Lcom/whatsapp/util/bi$e; // 96: getfield 32 com/whatsapp/util/bi$e:a Ljava/util/Stack; // 99: invokevirtual 47 java/util/Stack:pop ()Ljava/lang/Object; // 102: checkcast 49 com/whatsapp/util/bi$c // 105: astore_2 // 106: aload_3 // 107: monitorexit // 108: aload_2 // 109: ifnull +133 -> 242 // 112: aload_0 // 113: getfield 13 com/whatsapp/util/bi$d:a Lcom/whatsapp/util/bi; // 116: aload_2 // 117: invokestatic 52 com/whatsapp/util/bi:a (Lcom/whatsapp/util/bi;Lcom/whatsapp/util/bi$c;)Landroid/graphics/Bitmap; // 120: astore 4 // 122: aload_0 // 123: getfield 13 com/whatsapp/util/bi$d:a Lcom/whatsapp/util/bi; // 126: invokestatic 56 com/whatsapp/util/bi:c (Lcom/whatsapp/util/bi;)Landroid/support/v4/f/f; // 129: astore 5 // 131: aload 5 // 133: monitorenter // 134: aload_0 // 135: getfield 13 com/whatsapp/util/bi$d:a Lcom/whatsapp/util/bi; // 138: invokestatic 56 com/whatsapp/util/bi:c (Lcom/whatsapp/util/bi;)Landroid/support/v4/f/f; // 141: astore 6 // 143: aload_2 // 144: getfield 59 com/whatsapp/util/bi$c:a Ljava/lang/String; // 147: astore 7 // 149: aload 4 // 151: ifnull +112 -> 263 // 154: aload 4 // 156: astore_3 // 157: aload 6 // 159: aload 7 // 161: aload_3 // 162: invokevirtual 64 android/support/v4/f/f:a (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; // 165: pop // 166: aload 5 // 168: monitorexit // 169: aload_2 // 170: getfield 67 com/whatsapp/util/bi$c:b Landroid/widget/ImageView; // 173: invokevirtual 72 android/widget/ImageView:getTag ()Ljava/lang/Object; // 176: aload_2 // 177: getfield 59 com/whatsapp/util/bi$c:a Ljava/lang/String; // 180: invokevirtual 76 java/lang/Object:equals (Ljava/lang/Object;)Z // 183: ifeq +59 -> 242 // 186: new 78 com/whatsapp/util/bi$a // 189: dup // 190: aload_0 // 191: getfield 13 com/whatsapp/util/bi$d:a Lcom/whatsapp/util/bi; // 194: aload 4 // 196: aload_2 // 197: getfield 67 com/whatsapp/util/bi$c:b Landroid/widget/ImageView; // 200: aload_2 // 201: getfield 59 com/whatsapp/util/bi$c:a Ljava/lang/String; // 204: invokespecial 81 com/whatsapp/util/bi$a:<init> (Lcom/whatsapp/util/bi;Landroid/graphics/Bitmap;Landroid/widget/ImageView;Ljava/lang/String;)V // 207: astore_3 // 208: new 83 java/lang/StringBuilder // 211: dup // 212: ldc 85 // 214: invokespecial 88 java/lang/StringBuilder:<init> (Ljava/lang/String;)V // 217: aload_2 // 218: getfield 59 com/whatsapp/util/bi$c:a Ljava/lang/String; // 221: invokevirtual 92 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 224: invokevirtual 96 java/lang/StringBuilder:toString ()Ljava/lang/String; // 227: invokestatic 100 com/whatsapp/util/Log:d (Ljava/lang/String;)V // 230: aload_0 // 231: getfield 13 com/whatsapp/util/bi$d:a Lcom/whatsapp/util/bi; // 234: invokestatic 103 com/whatsapp/util/bi:d (Lcom/whatsapp/util/bi;)Landroid/os/Handler; // 237: aload_3 // 238: invokevirtual 109 android/os/Handler:post (Ljava/lang/Runnable;)Z // 241: pop // 242: invokestatic 113 java/lang/Thread:interrupted ()Z // 245: istore_1 // 246: iload_1 // 247: ifeq -247 -> 0 // 250: return // 251: astore_3 // 252: aload_2 // 253: monitorexit // 254: aload_3 // 255: athrow // 256: astore_2 // 257: return // 258: astore_2 // 259: aload_3 // 260: monitorexit // 261: aload_2 // 262: athrow // 263: invokestatic 116 com/whatsapp/util/bi:a ()Landroid/graphics/Bitmap; // 266: astore_3 // 267: goto -110 -> 157 // 270: astore_2 // 271: aload 5 // 273: monitorexit // 274: aload_2 // 275: athrow // 276: aconst_null // 277: astore_2 // 278: goto -172 -> 106 // Local variable table: // start length slot name signature // 0 281 0 this d // 245 2 1 bool boolean // 256 1 2 localInterruptedException InterruptedException // 258 4 2 localObject2 Object // 270 5 2 localObject3 Object // 277 1 2 localObject4 Object // 251 9 3 localObject6 Object // 266 1 3 localBitmap1 Bitmap // 120 75 4 localBitmap2 Bitmap // 141 17 6 localf2 f // 147 13 7 str String // Exception table: // from to target type // 29 44 251 finally // 252 254 251 finally // 0 29 256 java/lang/InterruptedException // 44 73 256 java/lang/InterruptedException // 112 134 256 java/lang/InterruptedException // 169 242 256 java/lang/InterruptedException // 242 246 256 java/lang/InterruptedException // 254 256 256 java/lang/InterruptedException // 261 263 256 java/lang/InterruptedException // 274 276 256 java/lang/InterruptedException // 73 106 258 finally // 106 108 258 finally // 259 261 258 finally // 134 149 270 finally // 157 169 270 finally // 263 267 270 finally // 271 274 270 finally } } static final class e { final Stack<bi.c> a = new Stack(); public final void a(ImageView paramImageView) { int i = 0; while (i < this.a.size()) { if (((bi.c)this.a.get(i)).b == paramImageView) { this.a.remove(i); } else { i += 1; } } } } } /* Location: /home/chaitanya/sandbox/dex2jar-2.0/com.whatsapp-dex2jar.jar!/com/whatsapp/util/bi.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
ef9ef34caf192d564e0b0aa27265178588b46b2f
d20e1c9a6b9d678760a5c7c74a9ee47baf904c99
/number.java
e3e1f944a7d3b215862d762c6f0fece85844e8a1
[]
no_license
ANULOGANATHAN/anu
dd21c56f02dce822ee663ec8655353a67ae5fcf3
b60d1971bd76334ae123cf61e6e6324074f4253c
refs/heads/master
2020-04-02T16:41:26.479464
2016-07-23T04:47:23
2016-07-23T04:47:23
63,851,981
0
0
null
null
null
null
UTF-8
Java
false
false
547
java
# anu package org.ksrce.logic.number; import java.util.Scanner; public class number { public static void main(String[] args) { int[] a = new int[5]; int count = 0;int count1 = 0; Scanner scanner = new Scanner(System.in); for (int i = 0; i < 5; i++) { a[i] = scanner.nextInt(); } for (int j = 0; j < 5; j++) { if (a[j] >= 0) { count++; } else if (a[j] <= -1) { count1++; } } System.out.println(" positive number is " + count); System.out.println("negative number" + count1); } }
7f4a79da5c6f6ef66b7557314b0934ca1dfe1c8f
8c8bb8fa79004e97e37e0e1866a7698d9d16968b
/test/com/slx/surveypark/test/TestSurveyService.java
8715fcfe0d63417a717990865694d2dc4c7d723b
[]
no_license
slxin/surveypark
a3d3a0f6f3b1c2e31a65c984675385e1f5517f52
1dc16bacad2bc3b1df19ae69a2d006ecd181f208
refs/heads/master
2021-01-19T22:10:51.674959
2017-04-19T16:53:15
2017-04-19T16:53:15
88,767,661
0
0
null
null
null
null
UTF-8
Java
false
false
911
java
package com.slx.surveypark.test; import com.slx.surveypark.model.User; import com.slx.surveypark.service.SurveyService; import com.slx.surveypark.service.UserService; import org.junit.BeforeClass; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import java.sql.SQLException; /** * Created by lenovo on 2016/11/26. */ public class TestSurveyService { private static SurveyService surveyService; @BeforeClass public static void iniSurveyService(){ ApplicationContext context=new ClassPathXmlApplicationContext("beans.xml"); surveyService=(SurveyService) context.getBean("surveyService"); } //新建调查 @Test public void newSurvey() throws SQLException { User user=new User(); user.setId(8); surveyService.newSurvey(user); } }
2a2157790a559134085597f0874a776f6855448e
e502b19ad55ca0f7db2d81cae58d49ec735e4295
/library_base/common/src/main/java/com/hubertyoung/common/widget/ImageUtil.java
9b9e9dfb8158c14f7d52cf11e7a82577a580b675
[]
no_license
zyl-me/AcFun-Android
9887ebd274dae7d58daedd4c771ff2d6ba7d9927
f243f834e9ce85f9926e6545870c7dfe61a5cd3d
refs/heads/master
2020-06-09T13:13:05.339157
2018-12-20T01:18:53
2018-12-20T01:18:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,551
java
package com.hubertyoung.common.widget; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.util.Base64; import java.io.ByteArrayOutputStream; import java.io.IOException; public class ImageUtil { /** * bitmap转为base64 * * @param bitmap * @return */ public static String bitmapToBase64( Bitmap bitmap ) { String result = null; ByteArrayOutputStream baos = null; try { if ( bitmap != null ) { baos = new ByteArrayOutputStream(); bitmap.compress( Bitmap.CompressFormat.JPEG, 100, baos ); baos.flush(); baos.close(); byte[] bitmapBytes = baos.toByteArray(); result = Base64.encodeToString( bitmapBytes, Base64.DEFAULT ); } } catch ( IOException e ) { e.printStackTrace(); } finally { try { if ( baos != null ) { baos.flush(); baos.close(); } } catch ( IOException e ) { e.printStackTrace(); } } return result; } /** * base64转为bitmap * * @param base64Data * @return */ public static Bitmap base64ToBitmap( String base64Data ) { byte[] bytes = Base64.decode( base64Data, Base64.DEFAULT ); return BitmapFactory.decodeByteArray( bytes, 0, bytes.length ); } /** * base64转为bitmap * * @param str * @return */ public static Bitmap customBase64ToBitmap( String str ) { try { int indexOf = str.indexOf( "base64," ); if ( indexOf > 0 ) { str = str.substring( indexOf + "base64,".length() ); } return base64ToBitmap( str ); } catch ( Exception e ) { return null; } } }
61fdbc695078e5e89f7d4ef576e889b3f5e65e16
98d313cf373073d65f14b4870032e16e7d5466f0
/gradle-open-labs/example/src/main/java/se/molybden/Class17032.java
7200aacfaefc28a6575ad4da50d16710c43c1118
[]
no_license
Molybden/gradle-in-practice
30ac1477cc248a90c50949791028bc1cb7104b28
d7dcdecbb6d13d5b8f0ff4488740b64c3bbed5f3
refs/heads/master
2021-06-26T16:45:54.018388
2016-03-06T20:19:43
2016-03-06T20:19:43
24,554,562
0
0
null
null
null
null
UTF-8
Java
false
false
110
java
public class Class17032{ public void callMe(){ System.out.println("called"); } }
b4211636282b1545f5cdf47c0ab7d979bf85d349
7c83c9f6ccf5be76662ff43b997874816dfeb234
/src/main/java/com/paris/backend/model/HlShenqing.java
742481f15df16c0e86ffed28198727665e84fc33
[]
no_license
aChenspring/hongliang
c0864df348bb3a142b8bff20620965ca6385a24a
987082cf63430fb4de4bdc9e1fef468dfab94e5d
refs/heads/master
2021-07-02T19:04:49.596900
2017-09-24T03:25:02
2017-09-24T03:25:02
103,618,989
0
0
null
2017-09-24T03:25:03
2017-09-15T05:49:04
JavaScript
UTF-8
Java
false
false
8,929
java
package com.paris.backend.model; import org.hibernate.validator.constraints.Length; import javax.persistence.*; import java.util.Date; /** * Created by HE on 2017/9/21 0021. * 比赛申请表 */ @Entity @Table(name = "hlShenqing") public class HlShenqing { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "sq_id") private int id; @Column(name = "beiming") @Length(min = 1 , max = 100) private String BeiMing; @Column(name = "saizhi") @Length(min = 1 , max = 2) private String SaiZhi; // 1:奥运赛制 2:世锦赛赛制 @Column(name ="tuanti") private int TuanTi; //0 无团体 1 有团体 @Column(name ="danda") private int DanDa; //0 无单打 1 有单打 @Column(name ="shuang") private int Shuang; //0 无双打 1 有双打 @Column(name ="ttjieduan") private int TTJieDuan; //0 团体不区分阶段 1 区分比赛阶段(第一阶段循环,第二阶段淘汰) @Column(name = "ttjieduanlx") private int TTJieDuanLX; //不区分比赛阶段,即单阶段类型 1 循环 2 淘汰 @Column(name ="ttnan") private int TTNan; //团体男子 @Column(name ="ttnanzu") private int TTNanZu; //团体男子区分组别 @Column(name ="ttnv") private int TTNv; //团体女子 @Column(name ="ttnvzu") private int TTNvZu; //团体女子区分组别 @Column(name ="tthun") private int TTHun; //团体混合 @Column(name ="tthunzu") private int TTHunZu; //团体混合区分组别 @Column(name ="ddjieduan") private int DDJieDuan; //0 单打不区分阶段 1 区分比赛阶段(第一阶段循环,第二阶段淘汰) @Column(name = "ddjieduanlx") private int DDJieDuanLX; //不区分比赛阶段,即单阶段类型 1 循环 2 淘汰 @Column(name ="ddnan") private int DDNan; //单打男子 @Column(name ="ddnanzu") private int DDNanZu; //单打男子区分组别 @Column(name ="ddnv") private int DDNv; //单打女子 @Column(name ="ddnvzu") private int DDNvZu; //单打女子区分组别 @Column(name ="sdjieduan") private int SDJieDuan; //0 双打不区分阶段 1 区分比赛阶段(第一阶段循环,第二阶段淘汰) @Column(name = "sdjieduanlx") private int SDJieDuanLX; //不区分比赛阶段,即单阶段类型 1 循环 2 淘汰 @Column(name ="sdnan") private int SDNan; //双打男子 @Column(name ="sdnanzu") private int SDNanZu; //双打男子区分组别 @Column(name ="sdnv") private int SDNv; //双打女子 @Column(name ="sdnvzu") private int SDNvZu; //双打女子区分组别 @Column(name ="sdhun") private int SDHun; //混双 @Column(name ="sdhunzu") private int SDHunZu; //混双区分组别 @Column(name ="sqsj") private Date SQSJ; //申请时间 @Column(name ="sqr") private int SQR; //申请人,是否和User表做外键 @Column(name ="shsj") private Date SHSJ; //审核时间 @Column(name ="shr") private int SHR; //审核人,是否和User表做外键 @Column(name = "status") private int Status; //状态 1 申请 2 审核 3 报告 4编排 5一阶段比赛 6二阶段比赛 9结束 @Column(name ="memo") @Length(min = 2 ,max = 100) private String Memo; @Column(name = "sheng") private String sheng; //省 @Column(name = "shi") private String shi; //市 @OneToOne(cascade = CascadeType.MERGE,orphanRemoval=true,fetch = FetchType.EAGER) @JoinTable(name = "hlShenqing_hlShenqings", joinColumns = @JoinColumn(name = "sq_id"), inverseJoinColumns = @JoinColumn(name = "sqs_id")) private HlShenqings hlShenqings; public HlShenqing() { } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getBeiMing() { return BeiMing; } public void setBeiMing(String beiMing) { BeiMing = beiMing; } public String getSaiZhi() { return SaiZhi; } public void setSaiZhi(String saiZhi) { SaiZhi = saiZhi; } public int getTuanTi() { return TuanTi; } public void setTuanTi(int tuanTi) { TuanTi = tuanTi; } public int getDanDa() { return DanDa; } public void setDanDa(int danDa) { DanDa = danDa; } public int getTTJieDuan() { return TTJieDuan; } public void setTTJieDuan(int TTJieDuan) { this.TTJieDuan = TTJieDuan; } public int getTTJieDuanLX() { return TTJieDuanLX; } public void setTTJieDuanLX(int TTJieDuanLX) { this.TTJieDuanLX = TTJieDuanLX; } public int getTTNan() { return TTNan; } public void setTTNan(int TTNan) { this.TTNan = TTNan; } public int getTTNanZu() { return TTNanZu; } public void setTTNanZu(int TTNanZu) { this.TTNanZu = TTNanZu; } public int getTTNv() { return TTNv; } public void setTTNv(int TTNv) { this.TTNv = TTNv; } public int getTTNvZu() { return TTNvZu; } public void setTTNvZu(int TTNvZu) { this.TTNvZu = TTNvZu; } public int getTTHun() { return TTHun; } public void setTTHun(int TTHun) { this.TTHun = TTHun; } public int getTTHunZu() { return TTHunZu; } public void setTTHunZu(int TTHunZu) { this.TTHunZu = TTHunZu; } public int getDDJieDuan() { return DDJieDuan; } public void setDDJieDuan(int DDJieDuan) { this.DDJieDuan = DDJieDuan; } public int getDDJieDuanLX() { return DDJieDuanLX; } public void setDDJieDuanLX(int DDJieDuanLX) { this.DDJieDuanLX = DDJieDuanLX; } public int getDDNan() { return DDNan; } public void setDDNan(int DDNan) { this.DDNan = DDNan; } public int getDDNanZu() { return DDNanZu; } public void setDDNanZu(int DDNanZu) { this.DDNanZu = DDNanZu; } public int getDDNv() { return DDNv; } public void setDDNv(int DDNv) { this.DDNv = DDNv; } public int getDDNvZu() { return DDNvZu; } public void setDDNvZu(int DDNvZu) { this.DDNvZu = DDNvZu; } public Date getSQSJ() { return SQSJ; } public void setSQSJ(Date SQSJ) { this.SQSJ = SQSJ; } public int getSQR() { return SQR; } public void setSQR(int SQR) { this.SQR = SQR; } public Date getSHSJ() { return SHSJ; } public void setSHSJ(Date SHSJ) { this.SHSJ = SHSJ; } public int getSHR() { return SHR; } public void setSHR(int SHR) { this.SHR = SHR; } public int getStatus() { return Status; } public void setStatus(int status) { Status = status; } public String getMemo() { return Memo; } public void setMemo(String memo) { Memo = memo; } public String getSheng() { return sheng; } public void setSheng(String sheng) { this.sheng = sheng; } public String getShi() { return shi; } public void setShi(String shi) { this.shi = shi; } public HlShenqings getHlShenqings() { return hlShenqings; } public void setHlShenqings(HlShenqings hlShenqings) { this.hlShenqings = hlShenqings; } public int getShuang() { return Shuang; } public void setShuang(int shuang) { Shuang = shuang; } public int getSDJieDuan() { return SDJieDuan; } public void setSDJieDuan(int SDJieDuan) { this.SDJieDuan = SDJieDuan; } public int getSDJieDuanLX() { return SDJieDuanLX; } public void setSDJieDuanLX(int SDJieDuanLX) { this.SDJieDuanLX = SDJieDuanLX; } public int getSDNan() { return SDNan; } public void setSDNan(int SDNan) { this.SDNan = SDNan; } public int getSDNanZu() { return SDNanZu; } public void setSDNanZu(int SDNanZu) { this.SDNanZu = SDNanZu; } public int getSDNv() { return SDNv; } public void setSDNv(int SDNv) { this.SDNv = SDNv; } public int getSDNvZu() { return SDNvZu; } public void setSDNvZu(int SDNvZu) { this.SDNvZu = SDNvZu; } public int getSDHun() { return SDHun; } public void setSDHun(int SDHun) { this.SDHun = SDHun; } public int getSDHunZu() { return SDHunZu; } public void setSDHunZu(int SDHunZu) { this.SDHunZu = SDHunZu; } }
423e713a845544d55e0ffcfc4b788b0d68258d60
062ee646cfe5e69190d3d3def304ade774ad649d
/app/src/main/java/com/angel/present_say/bean/GuideTab.java
a4acfd2d0f942b47815818f45e0ee3ff55f0ef4a
[]
no_license
matio1314520/Present_Say
4a34fe7c175e9f10a4c0c5e4452769e266eacfa0
4dc06f2425c60316e046775adc856d4ee2be5759
refs/heads/master
2021-01-10T07:20:40.990385
2016-03-15T12:15:47
2016-03-15T12:15:47
53,923,303
0
0
null
null
null
null
UTF-8
Java
false
false
2,648
java
package com.angel.present_say.bean; import java.io.Serializable; import java.util.List; /** * Created by Angel on 2016/2/12. */ public class GuideTab implements Serializable { private int code; private GuideTabData data; private String message; public void setCode(int code) { this.code = code; } public void setData(GuideTabData data) { this.data = data; } public void setMessage(String message) { this.message = message; } public int getCode() { return code; } public GuideTabData getData() { return data; } public String getMessage() { return message; } public static class GuideTabData { private List<GuideCandidates> candidates; private List<GuideChannels> channels; public void setCandidates(List<GuideCandidates> candidates) { this.candidates = candidates; } public void setChannels(List<GuideChannels> channels) { this.channels = channels; } public List<GuideCandidates> getCandidates() { return candidates; } public List<GuideChannels> getChannels() { return channels; } public static class GuideCandidates { private boolean editable; private int id; private String name; public void setEditable(boolean editable) { this.editable = editable; } public void setId(int id) { this.id = id; } public void setName(String name) { this.name = name; } public boolean isEditable() { return editable; } public int getId() { return id; } public String getName() { return name; } } public static class GuideChannels { private boolean editable; private int id; private String name; public void setEditable(boolean editable) { this.editable = editable; } public void setId(int id) { this.id = id; } public void setName(String name) { this.name = name; } public boolean isEditable() { return editable; } public int getId() { return id; } public String getName() { return name; } } } }
d44e4af4e68925348bd4e2eb813ad3c9140a4628
43a44be701c94d7d046a1c468b46c6a6b1281e5f
/src/sos/Snake.java
01e83e5c32dd12a3105fb9b707632372ce0c21ce
[]
no_license
Dryra/Sosanimaux
91e78d78bcaede71b9f9f85c6b168be0a083111d
17b024b2638aafb28e46a8a12f9af6bbce7fb5cf
refs/heads/master
2021-01-22T11:54:32.080638
2014-03-09T14:25:54
2014-03-09T14:26:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,864
java
package sos; import javax.swing.*; import java.awt.*; import java.util.*; import java.awt.event.*; public class Snake extends JFrame implements ActionListener { private static final long serialVersionUID = 1733874068071912424L; private static int PANEL_WIDTH = 64; private static int PANEL_HEIGHT = 64; private static Color [] COLORS = new Color [] { Color.GREEN, Color.RED, Color.PINK, Color.BLACK, Color.DARK_GRAY, Color.MAGENTA }; private String direction = "left"; private long scoreval = 0; private boolean scoreflag = true; private boolean wallflag = true; private int snake[][] = { { 2, 3 }, { 2, 4 }, { 2, 5 }, { 2, 6 }, { 2, 7 }, { 2, 8 }, { 2, 9 }, { 2, 10 }, { 2, 11 }, { 2, 12 }, { 2, 13 }, { 2, 14 }, { 2, 15 }, { 2, 16 }, { 2, 17 }, { 2, 18 }, { 2, 19 }, { 2, 20 }, { 2, 21 } }; private int snake_length = snake.length; private int mage_length = 8; private JButton[][] but = null; private JLabel score = null; private JButton restart = null; public Snake(String name) { super(name); this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); KeyboardFocusManager.getCurrentKeyboardFocusManager() .addKeyEventDispatcher(new KeyEventDispatcher() { public boolean dispatchKeyEvent(KeyEvent ke) { String param = ke.paramString(); System.out.println("params :: " + param); if (!param.startsWith("KEY_PRESSED")) { return true; // ignoring key released } switch (ke.getKeyCode()) { case KeyEvent.VK_LEFT: System.out.println("left"); if (!("right".equals(direction))) { direction = "left"; }// end if return true; case KeyEvent.VK_RIGHT: System.out.println("right"); if (!("left".equals(direction))) { direction = "right"; }// end if return true; case KeyEvent.VK_UP: System.out.println("up"); if (!("down".equals(direction))) { direction = "up"; }// end if return true; case KeyEvent.VK_DOWN: System.out.println("down"); if (!("up".equals(direction))) { direction = "down"; }// end if return true; }// end switch return false; }// end method }); //Build game panel buildGamePanel(); //Start snake startSnake(); } private void startSnake() { //the tail pixel is left in white, other are blue for (int i = 0; i < snake_length-1; i++) { this.but[snake[i][0]][snake[i][1]].setBackground(Color.BLUE); }// end for this.but[snake[snake_length - 1][0]][snake[snake_length - 1][1]] .setBackground(Color.WHITE); moveSnake(); generateWalls(); scoreWatcher(); }// end constructor private void buildGamePanel() { this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.getContentPane().setLayout(null); but = new JButton[PANEL_WIDTH][PANEL_HEIGHT]; for (int i = 0; i < PANEL_WIDTH; i++) { for (int j = 0; j < PANEL_HEIGHT; j++) { this.but[i][j] = new JButton(); this.but[i][j].setBounds(j * 5 + 10, i * 5 + 10, 5, 5); this.but[i][j].addActionListener(this); this.but[i][j].setBackground(Color.WHITE); this.getContentPane().add(this.but[i][j]); } }// end for score = new JLabel("score :: 0"); score.setBounds(350, 0, 100, 50); this.getContentPane().add(score); restart = new JButton("restart"); restart.setBounds(350, 40, 80, 30); restart.addActionListener(this); this.getContentPane().add(restart); } public void actionPerformed(ActionEvent ae) { System.out.println(" Source :: " + ae.getSource()); if (ae.getSource() == restart) { restart(); } }// end action method public void moveSnake() { Thread snakeThread = new Thread() { public void run() { while (true) { int hx = 0, hy = 0, tx = 0, ty = 0; synchronized (snake) { changePosition(direction); hx = snake[0][0]; hy = snake[0][1]; tx = snake[snake_length - 1][0]; ty = snake[snake_length - 1][1]; System.out.println(" hx ::" + hx + "hy :: " + hy); System.out.println(" tx ::" + tx + "ty :: " + ty); if (gameOver(hx, hy)) { // System.exit(0); break; } paintSnake(hx, hy, Color.BLUE); paintSnake(tx, ty, Color.WHITE); }// end sync try { Thread.sleep(50); } catch (Exception e) { e.printStackTrace(); } }// end while scoreflag = false; setWallFlag(false); }// end run }; // end thread snakeThread.start(); }// end method private void changePosition(String dir) { int hx = snake[0][0]; int hy = snake[0][1]; //starting the from the while pixel at tail //move all pixel positions to their previous pixel for (int i = snake_length - 1; i > 0; i--) { snake[i][0] = snake[i - 1][0]; snake[i][1] = snake[i - 1][1]; }// moving positions to right in array if ("left".equals(direction)) { hy--; }// end if if ("right".equals(direction)) { hy++; }// end if if ("up".equals(direction)) { hx--; }// end if if ("down".equals(direction)) { hx++; }// end if if (hx < 0) hx = 63; if (hx > 63) hx = 0; if (hy < 0) hy = 63; if (hy > 63) hy = 0; snake[0][0] = hx; snake[0][1] = hy; }// end method private void paintSnake(int x, int y, Color c) { this.but[x][y].setBackground(c); }// end method private void generateWalls() { Runnable ra = new Runnable() { public void run() { Random r = new Random(); Random s = new Random(); int x = 0, y = 0; boolean flag = getWallFlag(); while (flag) { x = Math.abs(r.nextInt()) % 47 + 2; y = Math.abs(s.nextInt()) % 53 + 2; Color wallcol = getRandomWallColor(); for (int i = 0; i < mage_length; i++) { if (x % 2 == 0) { Snake.this.but[x][y + i].setBackground(wallcol); } else { Snake.this.but[x + i][y].setBackground(wallcol); } }// end for int slp = Math.abs(r.nextInt()) % 9 + 4; try { Thread.sleep(slp * 1000); } catch (Exception e) { e.printStackTrace(); } for (int i = 0; i < mage_length; i++) { if (x % 2 == 0) { Snake.this.but[x][y + i].setBackground(Color.WHITE); } else { Snake.this.but[x + i][y].setBackground(Color.WHITE); } }// end for flag = getWallFlag(); }// end while }// end run }; // end thread for (int i = 0; i < 16; i++) { Thread wa = new Thread(ra); wa.start(); }// end for }// end method private Color getRandomWallColor() { Random r = new Random(); int val = Math.abs(r.nextInt()) % COLORS.length; if (val < COLORS.length) { return COLORS[val]; } return Color.CYAN; }// end method //Any other color means collided with wall private boolean gameOver(int x, int y) { if (but[x][y].getBackground().equals(Color.BLUE) || but[x][y].getBackground().equals(Color.WHITE)) { return false; } return true; }// end method private void scoreWatcher() { Thread sc = new Thread() { Random r = new Random(); public void run() { while (scoreflag) { int val = Math.abs(r.nextInt()) % 9; scoreval += val; score.setText("score :: " + scoreval); try { Thread.sleep(400); } catch (Exception e) { e.printStackTrace(); } } } };// end thread sc.start(); }// end method private synchronized boolean getWallFlag() { return wallflag; }// end method private synchronized void setWallFlag(boolean flag) { wallflag = flag; }// end method private void restart() { scoreflag = true; wallflag = true; scoreval = 0; System.out.println("Going to restart"); startSnake(); }// end method public static void main(String a[]) { Snake b = new Snake("BE THE CODER - Snake Game"); b.setSize(450, 380); b.setLocation(50, 50); b.setVisible(true); }// end main }// end class
f6826bf8886eb26786d2683c73450f977002bff3
a561fff8065dd669ee1f6de2374c66fa2f51be99
/src/main/java/com/smartPark/spotPlacement/model/LoginCheck.java
2a717be111ab3d2a76920cc80fc20bbaa6a3f25e
[]
no_license
Bikash18/spotPlacement
63c20933b1decb17ae4bff10c16dbe2be460b00a
f1997876723dc433167644528443b0a39830f557
refs/heads/master
2022-12-29T16:23:41.196407
2020-05-18T15:03:52
2020-05-18T15:03:52
264,977,290
0
0
null
2020-10-13T22:05:16
2020-05-18T15:13:22
Java
UTF-8
Java
false
false
323
java
package com.smartPark.spotPlacement.model; public class LoginCheck { private Boolean isLogin; public LoginCheck(Boolean isLogin) { this.isLogin = isLogin; } public Boolean getLogin() { return isLogin; } public void setLogin(Boolean isLogin) { isLogin = isLogin; } }
a6e670e57c339d9a3daae3271a7695647c79b1f1
224a2c3a5fa8564b9281ee2ee5d221ae50f863f6
/app/src/main/java/com/example/baifan/myapplication/activity/ShareSelectActivity.java
e39fa9b3248ddacdbf1a09e2170a57670f8450f9
[]
no_license
baifan666/MyApplication
71107a4f8bbffe4362924733391df96846e9b4f7
4aebac37299f08c14cd0a30671ddbad360b39127
refs/heads/master
2021-04-30T11:31:40.186591
2018-05-02T15:07:56
2018-05-02T15:07:56
119,686,525
0
0
null
null
null
null
UTF-8
Java
false
false
5,842
java
package com.example.baifan.myapplication.activity; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.view.Display; import android.view.MotionEvent; import android.view.View; import android.view.WindowManager; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.Toast; import com.example.baifan.myapplication.R; import com.example.baifan.myapplication.application.App; import com.example.baifan.myapplication.utils.QQShareUtil; import com.example.baifan.myapplication.utils.WxShareAndLoginUtils; import com.tencent.tauth.IUiListener; import com.tencent.tauth.UiError; import static com.example.baifan.myapplication.common.ServerAddress.SERVER_ADDRESS; public class ShareSelectActivity extends Activity implements View.OnClickListener { private Button btn_cancel; private ImageView pengyouquan,pengyou,qq,qzone; private LinearLayout layout; private Intent intent; private String title,content; private QQShareUtil qqShareUtil = new QQShareUtil(); private String url1,url2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_share_select); //将该Activity添加到App实例中, App.getInstance().addActivity(this); WindowManager m = getWindowManager(); Display d = m.getDefaultDisplay(); // 为获取屏幕宽、高 android.view.WindowManager.LayoutParams p = getWindow().getAttributes(); p.width = (int) (d.getWidth() * 1.0); // 宽度设置为屏幕的1.0 getWindow().setAttributes(p); intent = getIntent(); title = intent.getStringExtra("title"); content = intent.getStringExtra("content"); url1 = intent.getStringExtra("url1"); url2 = intent.getStringExtra("url2"); qq = (ImageView)findViewById(R.id.qq); //qq qzone = (ImageView)findViewById(R.id.qzone); //qq空间 pengyouquan = (ImageView) this.findViewById(R.id.pengyouquan); //微信朋友圈 pengyou = (ImageView) this.findViewById(R.id.pengyou); //微信朋友 btn_cancel = (Button) this.findViewById(R.id.btn_cancel); //取消 layout = (LinearLayout) findViewById(R.id.pop_layout); // 添加选择窗口范围监听可以优先获取触点,即不再执行onTouchEvent()函数,点击其他地方时执行onTouchEvent()函数销毁Activity layout.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Toast.makeText(getApplicationContext(), "提示:点击窗口外部关闭窗口!", Toast.LENGTH_SHORT).show(); } }); qqShareUtil.regToQQ(getApplicationContext());//向QQ终端注册appID // 添加按钮监听 btn_cancel.setOnClickListener(this); pengyouquan.setOnClickListener(this); pengyou.setOnClickListener(this); qq.setOnClickListener(this); qzone.setOnClickListener(this); } // 实现onTouchEvent触屏函数但点击屏幕时销毁本Activity @Override public boolean onTouchEvent(MotionEvent event) { //点击外面退出这activity finish(); return true; } public void onClick(View v) { switch (v.getId()) { case R.id.pengyouquan: //分享到朋友圈 // WxShareAndLoginUtils.WxTextShare(title, WxShareAndLoginUtils.WECHAT_MOMENT); Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher); WxShareAndLoginUtils.WxUrlShare(SERVER_ADDRESS+"/校园二手交易平台.png", title, content, bitmap, WxShareAndLoginUtils.WECHAT_MOMENT); break; case R.id.pengyou: // 分享到朋友 Bitmap bitmap1 = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher); WxShareAndLoginUtils.WxUrlShare(SERVER_ADDRESS+"/校园二手交易平台.png", title, content, bitmap1, WxShareAndLoginUtils.WECHAT_FRIEND); break; case R.id.qq: //分享到qq好友 qqShareUtil.shareToQQ(ShareSelectActivity.this, SERVER_ADDRESS+"/校园二手交易平台.png", title, content, new BaseUiListener()); break; case R.id.qzone: //分享到qq空间 qqShareUtil.shareToQzone(ShareSelectActivity.this, SERVER_ADDRESS+"/校园二手交易平台.png",url1,url2, title, content, new BaseUiListener()); break; case R.id.btn_cancel: finish(); break; default: break; } } private class BaseUiListener implements IUiListener {//QQ和Qzone分享回调 @Override public void onCancel() { Toast.makeText(ShareSelectActivity.this, "分享取消", Toast.LENGTH_SHORT).show(); finish(); } @Override public void onComplete(Object arg0) { Toast.makeText(ShareSelectActivity.this, "分享成功", Toast.LENGTH_SHORT).show(); finish(); } @Override public void onError(UiError arg0) { Toast.makeText(ShareSelectActivity.this, "分享失败", Toast.LENGTH_SHORT).show(); finish(); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); qqShareUtil.getTencent().onActivityResultData(requestCode, resultCode, data, new BaseUiListener()); } }
3aebf02c181dcf7fff179e1693ce798585593c6d
0beec07c800bdfa0be61beb4a2d30cf830043fb2
/app/src/main/java/magosoftware/petprojetos/HorariosFragment.java
bbeb9653ad599d43d8719a38b3861e8c3aee995d
[]
no_license
o-mago/PETProjetos
32a0ac144101d28482983915ae56a3cdb3dddf39
f4fe41c82fb26b67ddb8af78664b28cc3f2f1b87
refs/heads/master
2021-05-01T23:09:11.214162
2018-08-01T20:19:53
2018-08-01T20:19:53
120,919,490
0
0
null
null
null
null
UTF-8
Java
false
false
17,227
java
package magosoftware.petprojetos; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.ColorStateList; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.design.widget.FloatingActionButton; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.util.TypedValue; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.ExpandableListView; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.SearchView; import android.widget.Switch; import android.widget.TextView; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.ValueEventListener; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import java.text.ParseException; import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; public class HorariosFragment extends BaseFragment implements View.OnClickListener, LineAdapterPresenca.OnItemClicked { FirebaseUser user; FirebaseAuth mAuth; private Button okButton; private Button cancelButton; String[] dias; LinkedHashMap<String, List<String>> lstItensGrupo; LinkedHashMap<Integer, List<String>> lstFiltra; List<String> lstGrupo; ExpandableListAdapterCompara adaptador; private List<Presenca> mModels = null; private HashMap<String, Presenca> mModel = null; private LineAdapterPresenca mAdapter; // private LinkedHashMap<String, List<String>> horariosCoordenador; private String reunioesPath; private TextView dataSemanal; private LinearLayout linearLayout; private TextView tvTodos; private TextView tvMelhores; private ColorStateList corPadrao; private ColorStateList corPadraoDiaSemana; private String nomeProjeto; private LinkedHashMap<String, List<String>> horariosCoordenador; private DatabaseReference dbTimePet; public SharedPreferences sharedPref; private String nomePET; private int cont = 0; private int meetCont = 0; private ProgressBar progressBar; private ExpandableListView expandableListView; private FloatingActionButton selecionarPessoas; private RecyclerView mRecyclerView; private boolean primeiro = true; private String opcaoSelecionada = "tudo"; private RelativeLayout mainCompara; private TextView aviso; private String nodePET; public static HorariosFragment newInstance() { HorariosFragment horariosFragment = new HorariosFragment(); return horariosFragment; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mAuth = FirebaseAuth.getInstance(); user = mAuth.getCurrentUser(); sharedPref = getActivity().getSharedPreferences("todoApp", 0); nomePET = sharedPref.getString("nome_meu_pet", null); nodePET = sharedPref.getString("node_meu_pet", null); dbTimePet = mDatabase.child("PETs").child(nodePET).child("time"); return inflater.inflate(R.layout.compara_horarios, container, false); } @Override public void onActivityCreated(Bundle savedIntanceState) { super.onActivityCreated(savedIntanceState); tvTodos = getView().findViewById(R.id.menu_todos); tvMelhores = getView().findViewById(R.id.menu_melhores); corPadrao = tvMelhores.getTextColors(); expandableListView = (ExpandableListView) getView().findViewById(R.id.lista_horarios); selecionarPessoas = getView().findViewById(R.id.selecionar_pessoas); selecionarPessoas.setOnClickListener(this); progressBar = getView().findViewById(R.id.progress_bar); mainCompara = getView().findViewById(R.id.main_compara); verificaPET(); } private void semPet() { mainCompara.removeAllViews(); aviso = new TextView(getActivity()); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); aviso.setLayoutParams(params); aviso.setText("Você ainda não está em um PET"); aviso.setGravity(Gravity.CENTER); aviso.setTextSize(20); mainCompara.addView(aviso); } public void verificaPET() { mDatabase.child("Usuarios").child(user.getUid()).child("pet").child(nodePET).child("situacao").addListenerForSingleValueEvent(new ValueEventListenerSend(this) { @Override public void onDataChange(DataSnapshot dataSnapshot) { if(!dataSnapshot.exists() || dataSnapshot.getValue(String.class).equals("aguardando")) { semPet(); } else { getView().findViewById(R.id.menu_todos_click).setOnClickListener((View.OnClickListener) variavel); getView().findViewById(R.id.menu_melhores_click).setOnClickListener((View.OnClickListener)variavel); horariosCoordenador = new LinkedHashMap<>(); setHorarios(opcaoSelecionada); } } @Override public void onCancelled(DatabaseError databaseError) { } }); } @Override public void onClick(View view) { int id = view.getId(); if(id == R.id.menu_todos_click) { tvTodos.setTextColor(getResources().getColor(R.color.colorSecondary)); tvMelhores.setTextColor(corPadrao); opcaoSelecionada = "tudo"; setHorarios(opcaoSelecionada); // setExpandable(opcaoSelecionada); } if(id == R.id.menu_melhores_click) { tvTodos.setTextColor(corPadrao); tvMelhores.setTextColor(getResources().getColor(R.color.colorSecondary)); opcaoSelecionada = "melhores"; setHorarios(opcaoSelecionada); // setExpandable(opcaoSelecionada); } if(id == R.id.selecionar_pessoas) { linearLayout = (LinearLayout) getLayoutInflater().inflate(R.layout.lista_presenca, null, false); new AlertDialog.Builder(getActivity()) .setTitle("Selecione os petianos") .setView(linearLayout) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { setHorarios(opcaoSelecionada); dialog.dismiss(); } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.dismiss(); } } ).show(); setRecyclerView(); setListaPetianos(); } } @Override public void onItemClick(int position, String nome) { } private void setRecyclerView() { LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); mRecyclerView = linearLayout.findViewById(R.id.lista_presenca); mRecyclerView.setLayoutManager(layoutManager); if(primeiro) { mAdapter = new LineAdapterPresenca(); mModel = new HashMap<>(); mModels = new ArrayList<>(); } mRecyclerView.setAdapter(mAdapter); } private void setListaPetianos() { dbTimePet.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { String situacao = "presente"; for (DataSnapshot listSnapshoot : dataSnapshot.getChildren()) { if(!listSnapshoot.getKey().equals("aguardando")) { for(DataSnapshot subListSnapshot : listSnapshoot.getChildren()) { if(!primeiro) { situacao = mModel.get(subListSnapshot.getKey()).getSituacao(); mModel.remove(subListSnapshot.getKey()); } mModel.put(subListSnapshot.getKey(), new Presenca(subListSnapshot.getKey(), subListSnapshot.getValue(String.class), situacao)); } } } primeiro = false; mAdapter.replaceAll(new ArrayList<Presenca>(mModel.values())); mAdapter.notifyDataSetChanged(); } @Override public void onCancelled(DatabaseError databaseError) { } }); } private void setHorarios(final String opcao) { dbTimePet.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { for(DataSnapshot listSnapshot : dataSnapshot.getChildren()) { if (!listSnapshot.getKey().equals("aguardando")) { for (DataSnapshot subListSnapshot : listSnapshot.getChildren()) { if(mModels==null || mModel.get(subListSnapshot.getKey()).getSituacao().equals("presente")) { cont++; Log.d("DEV/MARCAR", subListSnapshot.getKey()); mDatabase.child("Usuarios").child(subListSnapshot.getKey()).child("horarios") .addListenerForSingleValueEvent(new ValueEventListenerSend(subListSnapshot.getValue(String.class)) { @Override public void onDataChange(DataSnapshot dataSnapshot) { meetCont++; for (DataSnapshot listSnapshot : dataSnapshot.getChildren()) { for (String listHora : listSnapshot.getValue(String.class).split(";")) { String nomeHorario = listSnapshot.getKey() + " " + listHora; Log.d("DEV/HORARIOSFRAG", "nomeHorario: " + nomeHorario); Log.d("DEV/HORARIOSFRAG", "variavel: " + variavel); try { horariosCoordenador.get(nomeHorario).add((String) variavel); } catch (NullPointerException e) { if (!listHora.equals("") && !listHora.contains("<reuniao>")) { horariosCoordenador .put(listSnapshot.getKey() + " " + listHora, new ArrayList<String>()); horariosCoordenador.get(nomeHorario).add((String) variavel); } } } } if (cont == meetCont) { Log.d("DEV/HORARIOSFRAG", "cont == meetCont"); setExpandable(opcao); } } @Override public void onCancelled(DatabaseError databaseError) { } }); } } } } } @Override public void onCancelled(DatabaseError databaseError) { } }); } private void setExpandable(String opcao) { // cria os grupos lstItensGrupo = new LinkedHashMap<>(); lstGrupo = new ArrayList<>(); int quantidade = 0; int maiorQuantidade = 0; if(opcao.equals("tudo")) { for (String key : horariosCoordenador.keySet()) { lstItensGrupo.put(key, horariosCoordenador.get(key)); } lstGrupo.addAll(horariosCoordenador.keySet()); } else if(opcao.equals("melhores")) { lstFiltra = new LinkedHashMap<>(); // lstFiltraNomes = new HashMap<>(); for (String key : horariosCoordenador.keySet()) { if(horariosCoordenador.get(key).size() > quantidade) { maiorQuantidade = horariosCoordenador.get(key).size(); } quantidade = horariosCoordenador.get(key).size(); try { lstFiltra.get(quantidade).add(key); // lstFiltraNomes.get(key).addAll(horariosCoordenador.get(key)); } catch (NullPointerException e) { Log.d("DEV/MARCAR", "Reiniciou a parada"); lstFiltra.put(quantidade, new ArrayList<String>()); lstFiltra.get(quantidade).add(key); // lstFiltraNomes.put(key, new ArrayList<String>()); // lstFiltraNomes.get(key).addAll(horariosCoordenador.get(key)); } } for(String dia : lstFiltra.get(maiorQuantidade)) { Log.d("DEV/MARCAR", "Quantos dias"); lstItensGrupo.put(dia, horariosCoordenador.get(dia)); lstGrupo.add(dia); } } Collections.sort(lstGrupo, dateComparator); // cria um adaptador (BaseExpandableListAdapter) com os dados acima adaptador = new ExpandableListAdapterCompara(getActivity(), lstGrupo, lstItensGrupo); progressBar.setVisibility(View.GONE); // define o apadtador do ExpandableListView expandableListView.setAdapter(adaptador); horariosCoordenador = new LinkedHashMap<>(); } Comparator<String> dateComparator = new Comparator<String>() { @Override public int compare(String s1, String s2) { try{ SimpleDateFormat format = new SimpleDateFormat("EEE", new Locale("pt", "BR")); Date d1 = format.parse(s1); Date d2 = format.parse(s2); if(d1.equals(d2)){ return s1.substring(s1.indexOf(" ") + 1).compareTo(s2.substring(s2.indexOf(" ") + 1)); }else{ Calendar cal1 = Calendar.getInstance(); Calendar cal2 = Calendar.getInstance(); cal1.setTime(d1); cal2.setTime(d2); return cal1.get(Calendar.DAY_OF_WEEK) - cal2.get(Calendar.DAY_OF_WEEK); } }catch(ParseException pe){ throw new RuntimeException(pe); } } }; // @Override // public void onDestroy() { // super.onDestroy(); // // mDatabase.child("PETs").removeEventListener(valueEventListener); // searchView.setOnQueryTextListener(null); // mAdapter.setOnClick(null); // // mRecyclerView = null; // searchView = null; // mAdapter = null; // mModels = null; // storage = null; // storageRef = null; // bitmapDrawablePet = null; // ft = null; // nomePet = null; // perfilRef = null; // valueEventListener = null; // progressBar = null; // } }
f046f2e107608d194799b56fef78fc6e8f37f51c
177fbdf372fc285cdd274f507ad53a171eb79e8e
/redistricter/src/main/java/giants/redistricter/data/ElectionResult.java
4897c68aca1f511fb1fcce0975295b48845eb957
[]
no_license
ParaLogia/redistricter
421a5aba0619849d549ded052443fee022e2f4be
591803584de1411e06fb12ba4e465aa21353ace6
refs/heads/master
2020-04-18T21:09:18.360593
2019-09-03T01:03:13
2019-09-03T01:03:13
167,757,373
3
0
null
null
null
null
UTF-8
Java
false
false
368
java
package giants.redistricter.data; import java.util.Map; public class ElectionResult { Integer year; Integer precinctId; Map<Party,Integer> results; public Integer getYear(){ return year; } public Integer getPrecinctId(){ return precinctId; } public Map<Party, Integer> getResults() { return results; } }
5d3caec05fb640c198a57d3325696b837463d657
eb6e5377dbb05bdde5c10e7adac489875aabfa22
/lib_common/src/main/java/com/d/lib/common/component/glide/GlideRoundTransform.java
686d0cc3c2cc55a1d5f9fcf41c4d0f429a60ad00
[]
no_license
infinte-star/finalproject
c80fb53634fed15b6a65cf572bc2beeb5cec4791
0918618a98817cce26998c6192eb15164abaf23f
refs/heads/master
2020-04-13T10:52:00.850531
2018-12-26T08:36:02
2018-12-26T08:36:02
163,155,748
1
1
null
null
null
null
UTF-8
Java
false
false
2,141
java
package com.d.lib.common.component.glide; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapShader; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.RectF; import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; import java.security.MessageDigest; public class GlideRoundTransform extends BitmapTransformation { private float radius = 0f; Matrix matrix = new Matrix(); public GlideRoundTransform(Context context) { this(context, 7); } public GlideRoundTransform(Context context, int dp) { super(context); this.radius = Resources.getSystem().getDisplayMetrics().density * dp; } @Override protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) { if (toTransform == null) { return null; } Bitmap result = pool.get(outWidth, outHeight, Bitmap.Config.ARGB_8888); int size = Math.min(toTransform.getWidth(), toTransform.getHeight()); int x = (toTransform.getWidth() - size) / 2; int y = (toTransform.getHeight() - size) / 2; float out = outWidth; float scale = out / size; matrix.reset(); matrix.postScale(scale, scale); Bitmap squared = Bitmap.createBitmap(toTransform, x, y, size, size, matrix, true); if (result == null) { result = Bitmap.createBitmap(outWidth, outHeight, Bitmap.Config.ARGB_8888); } Canvas canvas = new Canvas(result); Paint paint = new Paint(); paint.setShader(new BitmapShader(squared, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP)); paint.setAntiAlias(true); RectF rect = new RectF(1, 1, out - 1, out - 1); canvas.drawRoundRect(rect, radius, radius, paint); squared.recycle(); return result; } @Override public void updateDiskCacheKey(MessageDigest messageDigest) { } }
9827b6ae77a8d521404817bcbb31ab6ca9cb7d5e
dc943b149eeeff30575d0fe07222d321ec97cde0
/src/TechProJavaActivities/Day18StaticKeyword.java
6e8dd4f67e68c56fbec419eb8d7ac515bfb13f6c
[]
no_license
Mehmetes012/JavaTechProEd
46cbda3d6ee79d3bdc20a8ed96e313b98954985b
4f47484386dc826cd6d47cab21e4acaf5c736f16
refs/heads/master
2023-01-28T23:55:14.229853
2020-12-07T04:12:41
2020-12-07T04:12:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
68
java
package TechProJavaActivities; public class Day18StaticKeyword { }
538407bb864a233fea77c45870c61cf7fb8c1271
c117dbf2c3c6ea6ce786493909b6944082ffd1dd
/KDA405_Marcus_B/CatGame/src/bader/TestCAt.java
3f749b08e37d4f79177428af51c7bda46fc83f64
[ "Apache-2.0" ]
permissive
Kaoscillator/KDA405_Marcus_B
42af43a6884e448b56462e0535d01ff834c870ad
5bae82e362ad761dbfcc8d2cd6eed54655a26dd5
refs/heads/master
2021-01-10T15:56:30.222195
2016-03-04T10:58:27
2016-03-04T10:58:27
49,978,802
0
0
null
null
null
null
ISO-8859-1
Java
false
false
357
java
package bader; public class TestCAt { public static void main(String[] args) { System.out.println (" Detta är en test för Cat"); System.out.println (" **Start test"); Cat c = new Cat (); Cat a = new Cat ("Brown", "Missen"); System.out.println("One cat: "+ c.getName()+ " and one" + a.getAge()); // TODO Auto-generated method stub } }
816e619d4a878e36b5622fa7b3c7155b0a8823a2
efdf2be327093bc5bf6e01d435471ccaaeea9e5e
/chessGame/hw2/Test.java
ed42f118a24caf61c56dff8e709364cb75ed03cb
[]
no_license
duoweiyang/chessGame
3b7da892e0110d7ddee79bd8956ed0c05522aa3d
eed1c54b875ffab8dc52e338b564672aa1538e47
refs/heads/master
2020-04-07T23:10:36.907159
2020-01-02T00:12:11
2020-01-02T00:12:11
158,801,374
1
0
null
null
null
null
UTF-8
Java
false
false
12,451
java
import java.util.Arrays; import java.util.Comparator; /** * This is a tester class for the fall 2017 CS1331 HW2 assignment * It tests for all points that can be gained or lost * The test cases are not that exhaustive. I may update it in the * future. If you add your own feel free to post an updated file * * @author ssavelyev3 */ public class Test { public static void main(String[] args) { testColor(); System.out.println(); testSquare(); System.out.println(); testPiece(); System.out.println(); testKing(); System.out.println(); testKnight(); System.out.println(); testRook(); System.out.println(); testPawn(); } public static void testColor() { //5 points for Color existing Color whiteColor = Color.WHITE; Color blackColor = Color.BLACK; } public static void testSquare() { //5 points for char constructor Square a1 = new Square('a', '1'); checkB(a1.toString().equals("a1"), "Square.toString()"); try { Object a1Str = "a1"; checkB(!a1.equals(a1Str), "Square.equals(String)"); } catch (ClassCastException e) { System.err.println("Failed test: Square.equals(String)"); System.err.println("\tReason: improperly written equals method"); System.err.println("\thttp://cs1331.gatech.edu/slides/" + "object-superclass.pdf"); e.printStackTrace(); } //5 points for String constructor Object a1String = new Square("a1"); checkB(a1.equals(a1String), "Square.equals(Square)"); } public static void testPiece() { //This is just checking for the ability to compile //It also checks that Piece is storing the color and not the other //classes Piece w = new Piece(Color.WHITE) { @Override public String algebraicName() { return "algebraicName"; } @Override public String fenName() { return "fenName"; } @Override public Square[] movesFrom(Square square) { return new Square[0]; } }; Piece b = new Piece(Color.BLACK) { @Override public String algebraicName() { return "algebraicName"; } @Override public String fenName() { return "fenName"; } @Override public Square[] movesFrom(Square square) { return new Square[0]; } }; checkB(w.getColor() == Color.WHITE && b.getColor() == Color.BLACK, "Piece.getColor()"); //These must compile w.algebraicName(); w.fenName(); w.movesFrom(new Square("a1")); } public static void testKing() { Piece kingW = new King(Color.WHITE); Piece kingB = new King(Color.BLACK); checkB(kingW.getColor() == Color.WHITE && kingB.getColor() == Color.BLACK , "King.getColor()"); checkB(kingW.algebraicName().equals("K") && kingB.algebraicName().equals("K"), "King.algebraicName()"); checkB(kingW.fenName().equals("K") && kingB.fenName().equals("k"), "King.fenName()"); checkB(arraysContainSame(kingW.movesFrom(new Square("a1")), new Square[] { new Square("a2"), new Square("b1"), new Square("b2") }) && arraysContainSame(kingW.movesFrom(new Square("h1")), new Square[] { new Square("h2"), new Square("g1"), new Square("g2") }) && arraysContainSame(kingW.movesFrom(new Square("a8")), new Square[] { new Square("a7"), new Square("b8"), new Square("b7") }) && arraysContainSame(kingW.movesFrom(new Square("b2")), new Square[] { new Square("a1"), new Square("a2"), new Square("a3"), new Square("b1"), new Square("b3"), new Square("c1"), new Square("c2"), new Square("c3") }) && arraysContainSame(kingW.movesFrom(new Square("h8")), new Square[] { new Square("h7"), new Square("g8"), new Square("g7") }), "King.movesFrom(Square)"); } public static void testKnight() { Piece w = new Knight(Color.WHITE); Piece b = new Knight(Color.BLACK); checkB(w.getColor() == Color.WHITE && b.getColor() == Color.BLACK , "Knight.getColor()"); checkB(w.algebraicName().equals("N") && b.algebraicName().equals("N"), "Knight.algebraicName()"); checkB(w.fenName().equals("N") && b.fenName().equals("n"), "Knight.fenName()"); checkB(arraysContainSame(w.movesFrom(new Square("a1")), new Square[] { new Square("b3"), new Square("c2") }) && arraysContainSame(w.movesFrom(new Square("a8")), new Square[] { new Square("b6"), new Square("c7") }) && arraysContainSame(w.movesFrom(new Square("h1")), new Square[] { new Square("g3"), new Square("f2") }) && arraysContainSame(w.movesFrom(new Square("h8")), new Square[] { new Square("g6"), new Square("f7") }) && arraysContainSame(w.movesFrom(new Square("d3")), new Square[] { new Square("c1"), new Square("e1"), new Square("b2"), new Square("f2"), new Square("b4"), new Square("f4"), new Square("c5"), new Square("e5") }), "Knight.movesFrom(Square)"); } public static void testRook() { Piece w = new Rook(Color.WHITE); Piece b = new Rook(Color.BLACK); checkB(w.getColor() == Color.WHITE && b.getColor() == Color.BLACK , "Rook.getColor()"); checkB(w.algebraicName().equals("R") && b.algebraicName().equals("R"), "Rook.algebraicName()"); checkB(w.fenName().equals("R") && b.fenName().equals("r"), "Rook.fenName()"); checkB(arraysContainSame(w.movesFrom(new Square("a1")), new Square[] { new Square("a2"), new Square("a3"), new Square("a4"), new Square("a5"), new Square("a6"), new Square("a7"), new Square("a8"), new Square("b1"), new Square("c1"), new Square("d1"), new Square("e1"), new Square("f1"), new Square("g1"), new Square("h1") }) && arraysContainSame(w.movesFrom(new Square("d3")), new Square[] { new Square("a3"), new Square("b3"), new Square("c3"), new Square("e3"), new Square("f3"), new Square("g3"), new Square("h3"), new Square("d1"), new Square("d2"), new Square("d4"), new Square("d5"), new Square("d6"), new Square("d7"), new Square("d8") }), "Rook.movesFrom(Square)"); } public static void testPawn() { Piece w = new Pawn(Color.WHITE); Piece b = new Pawn(Color.BLACK); checkB(w.getColor() == Color.WHITE && b.getColor() == Color.BLACK , "Pawn.getColor()"); checkB(w.algebraicName().equals("") && b.algebraicName().equals(""), "Pawn.algebraicName()"); checkB(w.fenName().equals("P") && b.fenName().equals("p"), "Pawn.fenName()"); checkB(arraysContainSame(w.movesFrom(new Square("a2")), new Square[] { new Square("a3"), new Square("a4") }) && arraysContainSame(b.movesFrom(new Square("a7")), new Square[] { new Square("a6"), new Square("a5") }) && arraysContainSame(w.movesFrom(new Square("d3")), new Square[] { new Square("d4") }) && arraysContainSame(w.movesFrom(new Square("a8")), new Square[0]) && arraysContainSame(b.movesFrom(new Square("d6")), new Square[] { new Square("d5") }), "Pawn.movesFrom(Square)"); } public static void checkB(boolean result, String testName) { if (result) { System.out.println("Passed test: " + testName); } else { System.err.println("Failed test: " + testName); } } public static boolean arraysContainSame(Square[] a1, Square[] a2) { Comparator<Square> comp = (s1, s2) -> { return s1.toString().compareTo(s2.toString()); }; Arrays.sort(a1, comp); Arrays.sort(a2, comp); boolean output = Arrays.deepEquals(a1, a2); if (!output) { System.err.println("Arrays not equal: " + Arrays.deepToString(a1) + " " + Arrays.deepToString(a2)); } return output; } }
3dbaaaf644bb7d91b32c0d6ba64df07b2730d84f
9758d34f4f27c3d14b34735890f0293cef3e94e7
/src/main/java/org/ospic/platform/infrastructure/app/handlers/PlatformAccessDeniedHandlers.java
80ff46bee53e83ab46d5453b5855805ba7612124
[]
no_license
elirehema/jdbtemplete-routing-discussion
5b3ff3cf86efeb7fe6a666a40b17570d79a2613e
949e2fdac5d45833fa7274fc7c9d9c5704c57b50
refs/heads/master
2023-08-13T00:48:08.230058
2021-10-05T10:08:56
2021-10-05T10:08:56
413,764,696
0
0
null
null
null
null
UTF-8
Java
false
false
3,322
java
package org.ospic.platform.infrastructure.app.handlers; import com.fasterxml.jackson.databind.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.access.AccessDeniedHandler; import org.springframework.stereotype.Component; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Collections; /** * This file was created by eli on 07/02/2021 for org.ospic.platform.infrastructure.app.handlers * -- * -- * 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 * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * 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. */ @Component public class PlatformAccessDeniedHandlers implements AccessDeniedHandler { private Logger logger = LoggerFactory.getLogger(PlatformAccessDeniedHandlers.class); @Override public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); String message; final Exception exception = (Exception) request.getAttribute("exceptions"); logger.info("Is authentication not null: "+ String.valueOf(auth != null)); logger.info("Is Exception not null: "+ String.valueOf(exception != null)); if (auth == null) { message = "User: " + auth.getName() + " attempted to access the protected URL: " + request.getRequestURI(); byte[] body = new ObjectMapper().writeValueAsBytes(Collections.singletonMap("error", message)); response.getOutputStream().write(body); } /** if (exception != null) { byte[] body = new ObjectMapper().writeValueAsBytes(Collections.singletonMap("cause", exception.toString())); response.getOutputStream().write(body); } else { if (accessDeniedException.getCause() != null) { message = accessDeniedException.getCause().toString() + " " + accessDeniedException.getMessage(); } else { message = accessDeniedException.getMessage(); } byte[] body = new ObjectMapper().writeValueAsBytes(Collections.singletonMap("error", message)); response.getOutputStream().write(body); } **/ } }
2e7d703803c7ae5f7f15229a6fb69634d63c659f
c37d2a36312534a55c319b19b61060649c7c862c
/app/src/main/java/com/spongycastle/operator/bc/OperatorUtils.java
058793afb879fafb1d31b528f7ea30e267a8b6b8
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
trwinowiecki/AndroidTexting
f5626ad91a07ea7b3cd3ee75893abf8b1fe7154f
27e84a420b80054e676c390b898705856364b340
refs/heads/master
2020-12-30T23:10:17.542572
2017-02-01T01:46:13
2017-02-01T01:46:13
80,580,124
0
0
null
null
null
null
UTF-8
Java
false
false
530
java
package com.spongycastle.operator.bc; import java.security.Key; import com.spongycastle.operator.GenericKey; class OperatorUtils { static byte[] getKeyBytes(GenericKey key) { if (key.getRepresentation() instanceof Key) { return ((Key)key.getRepresentation()).getEncoded(); } if (key.getRepresentation() instanceof byte[]) { return (byte[])key.getRepresentation(); } throw new IllegalArgumentException("unknown generic key type"); } }
7f568a6deb8014476640f9d658efb6c0ac88d047
8c162ea9d3df3a9d4259490007a9ca5ea88a946c
/vcr4j-examples/src/test/java/org/mbari/vcr4j/examples/AppTest.java
b5532d4633a188cca4499035afe23baa1433bbee
[ "Apache-2.0" ]
permissive
tropicofdan/vcr4j
446352f7c181e94f1181ebb1b6ffc40d437646d8
bba7b41810c6b32a93b95c449944b094cc9dad6c
refs/heads/master
2023-08-01T05:46:19.079635
2021-09-27T11:14:23
2021-09-27T11:14:23
410,829,239
0
0
Apache-2.0
2021-09-27T11:14:23
2021-09-27T09:54:55
null
UTF-8
Java
false
false
652
java
package org.mbari.vcr4j.examples; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
2dd8bfc2a7f1d2fb9613162748dcc12c7e6377f5
63d1316374a8767c28e822f55d8acab7713779cb
/compatibility/src/demo/SessionSingleton.java
29c9220ebc6357a85f8afa74daf33c562b6858f2
[]
no_license
vtchoumatchenko/rap_rcp_video_demo
8fe9031103697cd4aafc2b21446267877051ee2b
ec1f17d781025278d041b1a6be53e4f718e4742d
refs/heads/master
2016-09-07T18:48:31.811536
2012-10-10T12:00:24
2012-10-10T12:00:24
6,087,874
1
0
null
null
null
null
UTF-8
Java
false
false
421
java
package demo; public abstract class SessionSingleton { private static SessionSingleton _instance; public static <T> T getInstance(final Class<T> type) { if (_instance == null) { _instance = ImplementationLoader.newInstance(SessionSingleton.class); } return _instance.abstractGetInstance(type); } protected abstract <T> T abstractGetInstance(final Class<T> type); }
d4fa7553e579856e4ebbdd91b421e30889c67d7a
061c55753912fe3b8f77a39afe03c82f1e19ecc5
/src/com/javarush/test/level17/lesson04/task05/Solution.java
7dc8bd15730005327415ef3423bbf2190db7b1b2
[]
no_license
MaximLinnik/JavaRushHomeWork
bdd16518c898e1547c42f4d5953873b0395d30d0
b513082da95266d122e5c475224c9e0bb1d2c78f
refs/heads/master
2021-01-30T16:02:15.177568
2020-02-27T11:29:10
2020-02-27T11:29:10
243,503,064
0
0
null
null
null
null
UTF-8
Java
false
false
811
java
package com.javarush.test.level17.lesson04.task05; /* МВФ Singleton паттерн - синхронизация в методе IMF - это Международный Валютный Фонд Внутри метода getFund создайте синхронизированный блок Внутри синхронизированного блока инициализируйте переменную imf так, чтобы метод getFund всегда возвращал один и тот же объект */ public class Solution { public static class IMF { private static IMF imf; public static IMF getFund() { synchronized (IMF.class){ imf=new IMF(); } return imf; } private IMF() { } } }
[ "15122466l" ]
15122466l
df065071c721eb38a0dcb066318a3cdd24234e2e
ad698dfda2e917fe669f642a03cd0744179192aa
/DataAnalysisWeb/src/com/ie/common/ApplicationIns.java
544b9565dd24fe2c5da02acbf026e95769427e9b
[]
no_license
MoUoM/DataAnalysisWeb
1c459a87aeb12d5e7deb0c30a13f6ef36c368b81
d9093aef796d8f7e0a5fed1ff341c1df967becaf
refs/heads/master
2021-01-20T05:29:02.486392
2015-04-08T08:13:21
2015-04-08T08:13:21
33,342,188
0
0
null
null
null
null
UTF-8
Java
false
false
628
java
package com.ie.common; import java.io.Serializable; import javax.annotation.Resource; import javax.sql.DataSource; import org.springframework.jdbc.core.JdbcTemplate; @SuppressWarnings("serial") public class ApplicationIns implements Serializable { @Resource(name="dataSource") private DataSource ds; private JdbcTemplate jdbc; //JdbcTemplate扩展类 public void setDataSource(DataSource ds){ this.jdbc = new JdbcTemplate(ds); } public DataSource getDataSource(){ return ds; } public JdbcTemplate getJdbc(){ if(this.jdbc == null){ this.jdbc = new JdbcTemplate(ds); } return this.jdbc; } }
8fae11ec3b478a7832da8d91f1d2621599275cb7
2f8cc78855411cdf71a1411e013b047bb26ca58c
/PhotoAppApiUsers/src/main/java/com/matheusfreitas/photoapp/api/users/data/AlbumsServiceClient.java
60d07a404f8365ed4784794958987d12c6449c6b
[]
no_license
victormf123/estudo-spring-boot-cloud
7b2ab219bb8d0bfd7a0349064c875680906453cd
19596ef972f7d499c16a4ff0b8caa56b70800247
refs/heads/master
2022-10-17T23:16:25.815159
2020-06-11T14:38:52
2020-06-11T14:38:52
271,569,396
0
0
null
null
null
null
UTF-8
Java
false
false
1,695
java
package com.matheusfreitas.photoapp.api.users.data; import java.util.ArrayList; import java.util.List; import javax.security.auth.login.FailedLoginException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import com.matheusfreitas.photoapp.api.users.ui.model.AlbumResponseModel; import feign.FeignException; import feign.hystrix.FallbackFactory; @FeignClient(name="albums-ws", fallbackFactory=AlbumsFallBackFactory.class) public interface AlbumsServiceClient { @GetMapping("/users/{id}/albums") public List<AlbumResponseModel> getAlbums(@PathVariable String id); } @Component class AlbumsFallBackFactory implements FallbackFactory<AlbumsServiceClient> { @Override public AlbumsServiceClient create(Throwable cause) { return new AlbumsServiceClientFallback(cause); } } class AlbumsServiceClientFallback implements AlbumsServiceClient { Logger logger = LoggerFactory.getLogger(this.getClass()); private final Throwable cause; public AlbumsServiceClientFallback(Throwable cause) { this.cause = cause; } @Override public List<AlbumResponseModel> getAlbums(String id) { if(cause instanceof FailedLoginException && ((FeignException) cause).status() == 404) { logger.error("404 error took place when getAlbums was called with userId: " + id + ". Error message: " + cause.getLocalizedMessage()); }else { logger.error("Other error took place: "+ cause.getLocalizedMessage()); } return new ArrayList<>(); } }
73a6aed6c3dc757337cb76f389864280b1a3a6b1
39c60c252405f80ad8ce4878b6e4a1508fe7f8c4
/Project/src/main/java/com/ucv/electrix/validators/annotations/NotNull.java
2795d429d932a1a6bf605b1ed97bbd830f603264
[]
no_license
TanaseAndrei/shopproject
6afce3884f70ff50a700d715668ae3b94c84e977
06614c0d7284e20bb5dade146d8ee67437d3ec7c
refs/heads/master
2023-01-24T08:21:01.338830
2020-11-26T12:03:16
2020-11-26T12:03:16
304,338,174
0
0
null
null
null
null
UTF-8
Java
false
false
533
java
package com.ucv.electrix.validators.annotations; import com.ucv.electrix.validators.implementations.NotNullValidatorImpl; import javax.validation.Constraint; import javax.validation.Payload; import java.lang.annotation.*; @Target({ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @Constraint(validatedBy = NotNullValidatorImpl.class) @Documented public @interface NotNull { String message() default "{categoryDTO.default}"; Class<?>[] groups() default { }; Class<? extends Payload>[] payload() default { }; }
7475437301fdf711333a23b7919ed20f1be8ffa1
0a3d45709e0431f81e0662970a355070b7e222fe
/core/src/com/sylweb/arthur/runner/Dora.java
c8f93ec695b6e570c28f24c644bf4427fafdfadf
[]
no_license
sylweb/RunnerArthur
bd59236d1927fac1a86b9784dd0594ece2f3d3e1
477aa13772b2be13126896c5c991d02ca25e1188
refs/heads/master
2021-08-07T13:47:07.933060
2017-11-08T07:44:39
2017-11-08T07:44:39
109,943,963
0
0
null
null
null
null
UTF-8
Java
false
false
9,261
java
package com.sylweb.arthur.runner; import java.util.ArrayList; import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.InputProcessor; import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.viewport.StretchViewport; import com.badlogic.gdx.utils.viewport.Viewport; public class Dora extends ApplicationAdapter implements InputProcessor { SpriteBatch batch; ShapeRenderer shape; BitmapFont font; Viewport viewport; Background myBack; Player myDora; Player myBabouch; Level lev1; Music mainTheme; public static ArrayList<Item> items = new ArrayList<Item>(); public static OrthographicCamera camera; @Override public void create () { Gdx.input.setCatchBackKey(true); batch = new SpriteBatch(); shape = new ShapeRenderer(); camera= new OrthographicCamera(); viewport = new StretchViewport(1280, 720, camera); viewport.apply(); camera.position.set(viewport.getWorldWidth()/2f, viewport.getWorldWidth()/2f, 0); myBack = new Background(); createDoraPlayer(true); RessourceContainer.loadRessources(1); lev1= new Level(1); font = new BitmapFont(); mainTheme = Gdx.audio.newMusic(Gdx.files.internal("dora_main_theme.ogg")); mainTheme.setLooping(true); mainTheme.play(); } @Override public void render () { update(); //** Camera management camera.update(); batch.setProjectionMatrix(camera.combined); shape.setProjectionMatrix(camera.combined); //** Draw background myBack.render(batch, shape); //** Draw level lev1.render(batch, shape); //** Draw dora myDora.render(batch, shape); //** Draw Babouch if(myBabouch!=null) myBabouch.render(batch, shape); for(int i=0; i < items.size(); i++) { items.get(i).render(batch); } //For debug or HMI batch.begin(); if(GameSettings.DEBUG_MODE) { Vector2 center = new Vector2(); myDora.getPosition().getCenter(center); float x_pos = camera.position.x - camera.viewportWidth/2f; float y_pos = camera.position.y + camera.viewportHeight/2f -10; font.draw(batch, "dora_x = "+center.x,x_pos , y_pos); y_pos -= 30; font.draw(batch, "dora_y = "+center.y,x_pos, y_pos); y_pos -= 20; font.draw(batch, "dora_y_sens = "+myDora.getYDirection(),x_pos,y_pos); y_pos -= 20; font.draw(batch, "dora_x_sens = "+myDora.getXDirection(),x_pos,y_pos); y_pos -= 20; font.draw(batch, "dora_fall = "+myDora.isFalling(),x_pos,y_pos); y_pos -= 20; font.draw(batch, "dora_jump = "+myDora.isJumping(),x_pos,y_pos); y_pos -= 20; font.draw(batch, "cam_x = "+camera.position.x,x_pos,y_pos); y_pos -= 20; font.draw(batch, "cam_y = "+camera.position.y,x_pos,y_pos); y_pos -= 20; font.draw(batch, "accell_x = "+Gdx.input.getAccelerometerX(),x_pos,y_pos); y_pos -= 20; font.draw(batch, "accell_y = "+Gdx.input.getAccelerometerY(),x_pos,y_pos); y_pos -= 20; font.draw(batch, "accell_z = "+Gdx.input.getAccelerometerZ(),x_pos,y_pos); } //** Player HMI batch.draw(RessourceContainer.arrowLeftSprite,camera.position.x - camera.viewportWidth/2f,camera.position.y - camera.viewportHeight/2f -40); batch.draw(RessourceContainer.arrowRightSprite,camera.position.x - camera.viewportWidth/2f + RessourceContainer.arrowLeftSprite.getWidth() + 50 ,camera.position.y - camera.viewportHeight/2f -40); batch.end(); } public void update() { //** Test collision collisionManager(); myBack.update(); //** update character //** allways keep that update first as it moves the camera view myDora.update(); if(myBabouch!=null) myBabouch.update(); //** update level (especially level hitboxes) lev1.update(); testKeys(); } public void collisionManager() { //** level and player collision boolean doraFall = true; boolean babouchFall = true; ArrayList<Rectangle> landHitBoxes = lev1.getHitBoxes(); if(landHitBoxes != null && landHitBoxes.size() > 0){ for(int i=0 ; i < landHitBoxes.size(); i++) { Rectangle recLand = landHitBoxes.get(i); if(myDora.getJumpBox().overlaps(recLand) && !myDora.isJumping()) { doraFall=false; } if(myBabouch != null){ if(myBabouch.getJumpBox().overlaps(recLand) && !myBabouch.isJumping()) { babouchFall=false; } } } } if(doraFall) myDora.fall(); else myDora.stopFall(); if(myBabouch != null) { if(babouchFall) myBabouch.fall(); else myBabouch.stopFall(); } //**ennemies and player collisions ArrayList<Ennemy> e = lev1.getEnnemies(); for(int i=0; i< e.size(); i++){ if(e.get(i).getHitBox().overlaps(myDora.getJumpBox()) && !myDora.isJumping()){ e.get(i).hit(); myDora.stopFall(); myDora.smallBounce(); } } for(int j=0; j < items.size(); j++) { Item temp = items.get(j); if(temp.isVisible()) { if(temp.getPosition().overlaps(myDora.getHitBox())){ temp.setVisible(false); } } } } public void testKeys() { boolean LEFT_TOUCHED = false; boolean RIGHT_TOUCHED = false; boolean JUMP_TOUCHED = false; for(int i=0; i < 3; i++){ if(Gdx.input.isTouched(i) && Gdx.input.getX(i)>0 && Gdx.input.getX(i)<RessourceContainer.arrowLeftSprite.getWidth()) { LEFT_TOUCHED = true; } if(Gdx.input.isTouched(i) && Gdx.input.isTouched() && Gdx.input.getX(i)>RessourceContainer.arrowLeftSprite.getWidth()+50 && Gdx.input.getX(i)<2*RessourceContainer.arrowLeftSprite.getWidth()+50) { RIGHT_TOUCHED = true; } if(Gdx.input.isTouched(i) && Gdx.input.getX(i)>camera.viewportWidth/2.0f){ JUMP_TOUCHED = true; } } if(Gdx.input.isKeyPressed(Keys.LEFT)||LEFT_TOUCHED) { myDora.setXDirection(GameConstants.MOVE_LEFT); } if(Gdx.input.isKeyPressed(Keys.RIGHT)||RIGHT_TOUCHED) { myDora.setXDirection(GameConstants.MOVE_RIGHT); } if(Gdx.input.isKeyPressed(Keys.SPACE)||JUMP_TOUCHED) { myDora.jump(); } if(Gdx.input.isKeyPressed(Keys.N)) { resetGame(); } if(!(Gdx.input.isKeyPressed(Keys.LEFT)||LEFT_TOUCHED)) { if(myDora.getXDirection() == GameConstants.MOVE_LEFT) myDora.setXDirection(GameConstants.MOVE_NOT); } if(!(Gdx.input.isKeyPressed(Keys.RIGHT)||RIGHT_TOUCHED)) { if(myDora.getXDirection() == GameConstants.MOVE_RIGHT) myDora.setXDirection(GameConstants.MOVE_NOT); } //Exit if(Gdx.input.isKeyPressed(Keys.ESCAPE)) { Gdx.app.exit(); } } private void resetGame() { camera.position.set(Gdx.graphics.getWidth()/2f, Gdx.graphics.getHeight()/2f, 0); createDoraPlayer(true); ArrayList<Ennemy> e = lev1.getEnnemies(); for(int i=0; i< e.size(); i++){ e.get(i).reset(1); } } private void createDoraPlayer(boolean isMainPlayer) { myDora = new Player(new Rectangle(0.0f,Gdx.graphics.getHeight(),126,156), "dora_walk_med2.png", "dora_stand_med2.png", "dora_jump_med.png", 12, 5, 8); myDora.setAsMain(true); myDora.setVelocity(GameConstants.SCROLL_VELOCITY_X); myDora.stopJump(); myDora.stopFall(); float x = myDora.getPosition().getX()+45; float y = myDora.getPosition().getY()+20; float w = 50; float h = 5; myDora.setJumpBox(new Rectangle(x,y,w,h)); Vector2 center = new Vector2(); myDora.getPosition().getCenter(center); x = center.x-20; y = center.y-20; w = 40; h = 40; myDora.setHitBox(new Rectangle(x,y,w,h)); } private void createBabouchPlayer(boolean isMainPlayer) { myBabouch = new Player(new Rectangle(0.0f,Gdx.graphics.getHeight(),126,96),"babouch_walk_med.png" , "babouch_stand_med.png", "babouch_jump_med.png", 8, 5, 8); myBabouch.setAsMain(false); myBabouch.setXDirection(GameConstants.MOVE_NOT); myBabouch.setVelocity(GameConstants.SCROLL_VELOCITY_X); myBabouch.stopJump(); myBabouch.stopFall(); float x = 37; float y = 97; float w = 56; float h = 6; myBabouch.setJumpBox(new Rectangle(x,y,w,h)); } @Override public boolean keyDown(int keycode) { if(keycode == Keys.ANY_KEY){ resetGame(); } return false; } @Override public boolean keyUp(int keycode) { // TODO Auto-generated method stub return false; } @Override public boolean keyTyped(char character) { // TODO Auto-generated method stub return false; } @Override public boolean touchDown(int screenX, int screenY, int pointer, int button) { // TODO Auto-generated method stub return false; } @Override public boolean touchUp(int screenX, int screenY, int pointer, int button) { // TODO Auto-generated method stub return false; } @Override public boolean touchDragged(int screenX, int screenY, int pointer) { // TODO Auto-generated method stub return false; } @Override public boolean mouseMoved(int screenX, int screenY) { // TODO Auto-generated method stub return false; } @Override public boolean scrolled(int amount) { // TODO Auto-generated method stub return false; } public void resize(int width, int height) { viewport.update(width, height); } }
4bf57a427654c8fa40cba397f19cc7fe80f0413c
1cba0db77ac8ca05c665a2ab2ca05d65d2dd649f
/src/main/java/it/unimore/dipi/iot/http/api/client/location/UpdateLocationProcess.java
e1627cc93a63a1db0207ad7146a61764298cab28
[]
no_license
AstroBaro-19/http-iot-api-demo
246688ea9a1751986f0bf6830dc258adf778fca8
90a4a3722f0322f839e385cc475ffafdfbd2f7fe
refs/heads/master
2022-12-28T22:53:54.176251
2020-10-07T12:52:18
2020-10-07T12:52:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,318
java
package it.unimore.dipi.iot.http.api.client.location; import com.fasterxml.jackson.databind.ObjectMapper; import it.unimore.dipi.iot.http.api.model.LocationDescriptor; import org.apache.http.HttpHeaders; import org.apache.http.HttpStatus; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPut; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author Marco Picone, Ph.D. - [email protected] * @project http-iot-api-demo * @created 05/10/2020 - 16:53 */ public class UpdateLocationProcess { final static protected Logger logger = LoggerFactory.getLogger(UpdateLocationProcess.class); private CloseableHttpClient httpClient; private ObjectMapper objectMapper; private String baseUrl; public UpdateLocationProcess(String baseUrl){ this.baseUrl = baseUrl; this.objectMapper = new ObjectMapper(); this.httpClient = HttpClients.custom() .build(); } public void updateExistingLocation(LocationDescriptor locationDescriptor){ try{ //Update the URL using the Location Id String targetUrl = String.format("%slocation/%s", this.baseUrl, locationDescriptor.getId()); logger.info("Target Url: {}", targetUrl); String jsonBody = this.objectMapper.writeValueAsString(locationDescriptor); //Create the HTTP PUT Request HttpPut updateLocationRequest = new HttpPut(targetUrl); //Add Content Type Header updateLocationRequest.addHeader(HttpHeaders.CONTENT_TYPE, "application/json"); //Set Payload updateLocationRequest.setEntity(new StringEntity(jsonBody)); //Execute the GetRequest CloseableHttpResponse response = httpClient.execute(updateLocationRequest); if(response != null && response.getStatusLine().getStatusCode() == HttpStatus.SC_NO_CONTENT){ logger.info("Response Code: {}", response.getStatusLine().getStatusCode()); } else { logger.error(String.format("Error executing the request ! Status Code: %d", response != null ? response.getStatusLine().getStatusCode() : -1)); } }catch (Exception e){ e.printStackTrace(); } } public static void main(String[] args) { logger.info("Starting IoT Inventory Create & Update Tester ..."); String baseUrl = "http://127.0.0.1:7070/api/iot/inventory/"; LocationDescriptor mantovaLocation = new LocationDescriptor(); mantovaLocation.setId("000001"); mantovaLocation.setLatitude(45.160217); mantovaLocation.setLongitude(10.7877205); mantovaLocation.setName("Foundation Universita' di Mantova (FUM)"); mantovaLocation.setAddress("Via Angelo Scarsellini, 2, 46100"); mantovaLocation.setCity("Mantova"); mantovaLocation.setCountry("Italy"); UpdateLocationProcess apiLocationProcess = new UpdateLocationProcess(baseUrl); //Update the Location apiLocationProcess.updateExistingLocation(mantovaLocation); } }
332e57545a8a207dc9ff81b3b85ebcb2c5dc141c
9ed8b408348a9fca19ac51ae1337afcfcd9b03db
/weather-forecast/src/main/java/com/ing/weatherforecast/model/openweathermapResponse/Weather.java
9d8146e48910a31f8ab414f0313bd2a5c760becb
[ "MIT" ]
permissive
matteocolacchio/ING
82188858e077443011db5c23638c411a1529add8
346c41c79b0ccc7d4b5346e3b9adc14d9e003bd3
refs/heads/main
2023-04-10T08:17:33.334448
2021-04-25T10:59:25
2021-04-25T10:59:25
361,011,545
0
0
null
null
null
null
UTF-8
Java
false
false
186
java
package com.ing.weatherforecast.model.openweathermapResponse; public class Weather { public int id; public String main; public String description; public String icon; }
ebcfafc15f359988bf766d467bd63e833b3b29cf
6927d9a11530e5a4b3c6ed2d78640e0c10243da9
/rasp-install/java/src/test/java/WindowsTomcatInstallerTest.java
c17b34acdbc1681c3949c4255d02ac2c22e56a4a
[ "Apache-2.0" ]
permissive
baidu/openrasp
a15603ba31b220ac654aa89f77e5b4d55e328045
79ccc0fca707b5a19dd91a5b08ee3c7b533f3ec3
refs/heads/master
2023-08-19T03:56:43.649766
2023-01-04T03:40:17
2023-01-04T03:40:17
99,914,450
2,646
642
Apache-2.0
2023-07-21T03:25:27
2017-08-10T11:09:30
C++
UTF-8
Java
false
false
2,951
java
import com.baidu.rasp.install.windows.TomcatInstaller; import org.apache.commons.io.IOUtils; import org.junit.Test; import static org.junit.Assert.*; import java.io.File; import java.io.FileReader; import java.io.InputStream; import java.lang.reflect.Constructor; /** * @author: anyang * @create: 2019/03/25 15:57 */ public class WindowsTomcatInstallerTest { @Test public void testGetInstallPath() { try { Class clazz = TomcatInstaller.class; Constructor constructor = clazz.getConstructor(String.class, String.class); Object installer = constructor.newInstance("Tomcat", "/Users/anyang/Desktop/jacoco/sum/apache-tomcat-8.5.30/"); String path = Utils.invokeStringMethod(installer, "getInstallPath", new Class[]{String.class}, "/Users/anyang/Desktop/jacoco/sum/apache-tomcat-8.5.30"); assertEquals(path, "/Users/anyang/Desktop/jacoco/sum/apache-tomcat-8.5.30\\rasp"); } catch (Exception e) { // } } @Test public void testGetScript() { try { Class clazz = TomcatInstaller.class; Constructor constructor = clazz.getConstructor(String.class, String.class); Object installer = constructor.newInstance("Tomcat", "/Users/anyang/Desktop/jacoco/sum/apache-tomcat-8.5.30/"); String path = Utils.invokeStringMethod(installer, "getScript", new Class[]{String.class}, "/Users/anyang/Desktop/jacoco/sum/apache-tomcat-8.5.30\\rasp"); assertEquals(path, "/Users/anyang/Desktop/jacoco/sum/apache-tomcat-8.5.30\\rasp\\..\\bin\\catalina.bat"); } catch (Exception e) { // } } @Test public void testModifyStartScript() { try { String content = IOUtils.toString(new FileReader(new File("/Users/anyang/Desktop/jacoco/sum/apache-tomcat-8.5.30/bin/catalina.bat"))); Class clazz = TomcatInstaller.class; Constructor constructor = clazz.getConstructor(String.class, String.class); Object installer = constructor.newInstance("Tomcat", "/Users/anyang/Desktop/jacoco/sum/apache-tomcat-8.5.30/"); Utils.invokeStringMethod(installer, "modifyStartScript", new Class[]{String.class}, content); } catch (Exception e) { // } try { InputStream is = this.getClass().getResourceAsStream("/startWebLogic.sh"); String content = IOUtils.toString(is, "UTF-8"); Class clazz = TomcatInstaller.class; Constructor constructor = clazz.getConstructor(String.class, String.class); Object installer = constructor.newInstance("Tomcat", "/Users/anyang/Desktop/jacoco/sum/apache-tomcat-8.5.30/"); Utils.invokeStringMethod(installer, "modifyStartScript", new Class[]{String.class}, content); } catch (Exception e) { // } } }
4284db07ec0eea2215eb30e74d7fe75f81915380
a61aab1f34144e33205bb16a49953033e4fa5a96
/app/src/main/java/steelkiwi/com/toolbarmenuview/view/builder/ItemBuilder.java
55610349d9af8d928f762555a65dbbf68ac74291
[ "Apache-2.0" ]
permissive
soulyaroslav/ToolbarMenuView
5a17d4d8f12d1639a7dd8d467e470fda16a39076
c865b5a020d7e0fb20b7e1a66d4219291b72b7f4
refs/heads/master
2021-01-23T04:20:24.534403
2017-05-31T09:06:08
2017-05-31T09:06:08
92,926,933
3
0
null
null
null
null
UTF-8
Java
false
false
1,044
java
package steelkiwi.com.toolbarmenuview.view.builder; import android.support.annotation.ColorRes; import android.support.annotation.DrawableRes; import android.support.annotation.StringRes; import steelkiwi.com.toolbarmenuview.view.MenuItem; /** * Created by yaroslav on 5/31/17. */ public final class ItemBuilder { private int itemId; private @ColorRes int background; private @DrawableRes int icon; private @StringRes int title; public ItemBuilder() { } public ItemBuilder setItemId(int itemId) { this.itemId = itemId; return this; } public ItemBuilder setBackground(@ColorRes int background) { this.background = background; return this; } public ItemBuilder setIcon(@DrawableRes int icon) { this.icon = icon; return this; } public ItemBuilder setTitle(@StringRes int title) { this.title = title; return this; } public MenuItem build() { return new MenuItem(itemId, background, icon, title); } }
c63fb9bcbc91c3efa54dd6a4170cdab50d7290bd
63d0daa5095ec14a069e274c647bf0f34ea34d26
/src/main/java/me/jcala/blog/service/inter/FileUploadSer.java
45753c682e03c8b3fa14e1bff9f9c2254af50feb
[ "MIT" ]
permissive
itkang/jcalaBlog
08ddf51ff9154bef4ae92761bf0ed36ce2e3d27e
c0c3b0f3c0fc7ca081e66db71e25729a2818d7e3
refs/heads/master
2021-01-11T01:42:30.763289
2016-10-10T05:37:02
2016-10-10T05:37:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
404
java
package me.jcala.blog.service.inter; import me.jcala.blog.domain.Info; import me.jcala.blog.domain.UploadPic; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; /** * Created by Administrator on 2016/9/25. */ public interface FileUploadSer { UploadPic uploadPic(HttpServletRequest request); Info updateAvatar(HttpServletRequest request); }
add9665f9da7cf14ec3c6cbb899b40bcbcfb00e8
22cd38be8bf986427361079a2f995f7f0c1edeab
/src/main/java/core/erp/pac/service/PACA0022Service.java
f959ede6348899259583b065a5917b34f0615c52
[]
no_license
shaorin62/MIS
97f51df344ab303c85acb2e7f90bb69944f85e0f
a188b02a73f668948246c133cd202fe091aa29c7
refs/heads/master
2021-04-05T23:46:52.422434
2018-03-09T06:41:04
2018-03-09T06:41:04
124,497,033
0
0
null
null
null
null
UTF-8
Java
false
false
1,303
java
/** * core.erp.tmm.service.PACA0022Service.java - <Created by Code Template generator> */ package core.erp.pac.service; import java.util.Map; /** * <pre> * PACA0022Service - 제작 전자세금계산서 인증서관리 * </pre> * * @author 오세훈 * @since 2016.11.08 * @version 1.0 * * <pre> * == Modification Information == * Date Modifier Comment * ==================================================== * 2016.11.08 오세훈 Initial Created. * ==================================================== * </pre> * * Copyright JNF Communication.(C) All right reserved. */ public interface PACA0022Service { /** * <pre> * 제작 전자세금계산서 인증서관리 * </pre> * * @param param - 조회조건 Map * @return 공통코드마스터 목록 * @throws Exception - 조회 시 발생한 예외 */ @SuppressWarnings({ "unchecked","rawtypes"}) public Object processSEARCH00(Map searchVo) throws Exception ; /** * <pre> * 제작 전자세금계산서 인증서 관리 저장 * </pre> * * @param param - 저장, 수정 또는 삭제할 자료 * @return 처리 건수 * @throws Exception - 처리 시 발생한 예외 */ @SuppressWarnings({ "unchecked","rawtypes"}) public int processSAVE00(Map saveData) throws Exception; }
f4650f80bc7afd3dc1554ebe40cb7ad8b19b615f
bd6d4ebf2ade219b0abf39ac8c8771658e1bfd19
/SampleController.java
6f1315e4ffe9cc83c491e943a36705e0a3fd26cc
[]
no_license
soujanya9369/BeautyProject-JDBC-Template
4c9adad3e9d31593bd95d50aaea770c1bf1d5581
a9570d024775d2311042a5cba9c24a4abdb47f04
refs/heads/master
2020-05-04T20:16:23.776151
2019-04-04T05:58:35
2019-04-04T05:58:35
179,430,836
0
0
null
null
null
null
UTF-8
Java
false
false
2,883
java
package trg.talentsprint.sample; import java.sql.SQLException; import java.util.List; import org.apache.log4j.Logger; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; @Controller public class SampleController { private static final Logger logger = Logger.getLogger(SampleController.class); @RequestMapping(value = "/", method = RequestMethod.GET) public ModelAndView printHello2(ModelAndView model) throws ClassNotFoundException, SQLException { if(logger.isDebugEnabled()){ logger.debug("getWelcome is executed!"); } //logs exception // logger.error("This is Error message", new Exception("Testing")); BeautyDao b1 = new BeautyDao(); List<BeautyProdutcs> list = b1.getBeautyProductsList(); model.addObject("bpList", list); model.setViewName("home"); return model; } @RequestMapping(value = "/addform") public String showform(Model m) { m.addAttribute("command", new BeautyProdutcs()); return "addform"; } @RequestMapping(value = "/save", method = RequestMethod.POST) public String save(@ModelAttribute("bpList") BeautyProdutcs bp) { BeautyDao b1 = new BeautyDao(); b1.save(bp); return "redirect:/home"; } @RequestMapping("/home") public String viewemp(Model m) throws ClassNotFoundException, SQLException { BeautyDao b1 = new BeautyDao(); List<BeautyProdutcs> list = b1.getBeautyProductsList(); m.addAttribute("bpList", list); return "home"; } @RequestMapping(value="/editform") public String showeditform(Model m) throws ClassNotFoundException, SQLException { BeautyDao b1 = new BeautyDao(); List<BeautyProdutcs> list = b1.getBeautyProductsList(); m.addAttribute("bpList", list); return "editform"; } @RequestMapping(value="/update/{id}") public String showupdateform(@PathVariable int id, Model m){ BeautyDao bp = new BeautyDao(); BeautyProdutcs b=bp.getBeautyProductsId(id); m.addAttribute("command",b); return "updateform"; } @RequestMapping(value="/editsave",method = RequestMethod.POST) public String editsave(@ModelAttribute("bpList") BeautyProdutcs b){ BeautyDao bp = new BeautyDao(); bp.update(b); return "redirect:/home"; } @RequestMapping(value="/delete/{id}",method = RequestMethod.GET) public String delete(@PathVariable int id){ BeautyDao b1 = new BeautyDao(); b1.delete(id); return "redirect:/home"; } }
aa89372fad935e5c711cc60031bb0e8bdca3c8af
af94d146638458db0a2aea7b366d5f38485770c8
/src/main/java/org/datanucleus/identity/IdentityManager.java
b0338049dabd11453c90373f490041282b41cbb3
[ "Apache-2.0" ]
permissive
datanucleus/datanucleus-core
781b12241d1a551e36ca0f5df20d04f64d1e8f42
081c668cdc661b0b9626411b92b8b97242f27b86
refs/heads/master
2023-09-04T03:45:58.216619
2023-09-01T09:32:21
2023-09-01T09:32:21
15,055,689
115
81
null
2023-09-01T09:34:17
2013-12-09T18:40:29
Java
UTF-8
Java
false
false
3,912
java
/********************************************************************** Copyright (c) 2014 Andy Jefferson and others. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Contributors: ... **********************************************************************/ package org.datanucleus.identity; import org.datanucleus.ClassLoaderResolver; import org.datanucleus.metadata.AbstractClassMetaData; /** * Manager for identity creation etc. */ public interface IdentityManager { public static final String IDENTITY_CLASS_TARGET_CLASS_NAME_FIELD = "targetClassName"; Class getDatastoreIdClass(); /** * Accessor for the current identity string translator to use (if any). * @return Identity string translator instance (or null if persistence property not set) */ IdentityStringTranslator getIdentityStringTranslator(); /** * Accessor for the current identity key translator to use (if any). * @return Identity key translator instance (or null if persistence property not set) */ IdentityKeyTranslator getIdentityKeyTranslator(); /** * Method to return a datastore identity, representing the persistable object with specified class name and key value. * @param className The class name for the persistable * @param value The key value for the persistable * @return The datastore id */ DatastoreId getDatastoreId(String className, Object value); /** * Method to return a datastore-unique datastore identity, with the specified value. * @param value The long value that is unique across the datastore. * @return The datastore id */ DatastoreId getDatastoreId(long value); /** * Method to return a datastore identity, for the specified string which comes from the output of toString(). * @param oidString The toString() value * @return The datastore id */ DatastoreId getDatastoreId(String oidString); /** * Method to return a single-field identity, for the persistable type specified, and for the idType of SingleFieldId. * @param idType Type of the id * @param pcType Type of the Persistable * @param key The value for the identity (the Long, or Int, or ... etc). * @return Single field identity */ SingleFieldId getSingleFieldId(Class idType, Class pcType, Object key); /** * Utility to create a new application identity when you know the metadata for the target class, * and the toString() output of the identity. * @param clr ClassLoader resolver * @param acmd MetaData for the target class * @param keyToString String form of the key * @return The identity */ Object getApplicationId(ClassLoaderResolver clr, AbstractClassMetaData acmd, String keyToString); /** * Method to create a new object identity for the passed object with the supplied MetaData. * Only applies to application-identity cases. * @param pc The persistable object * @param cmd Its metadata * @return The new identity object */ Object getApplicationId(Object pc, AbstractClassMetaData cmd); /** * Method to return a new object identity for the specified class, and key (possibly toString() output). * @param cls Persistable class * @param key form of the object id * @return The object identity */ Object getApplicationId(Class cls, Object key); }
6cdcde2786f67d3b13449821f2a3a470201d0cd1
122b447753a2f7b7b02bc809ceb2b922a3e53b9f
/src/main/java/com/pal/blog/dao/CommentDao.java
72662bf55df3db3cd192f7b83edbf0fd440b4d3a
[]
no_license
cnpal/Blog-mybatis
ebbb594fd4e649cae546f16ecd887007f4286786
82e0bc95f6fc7b002f94ebcc0579679da79255d3
refs/heads/master
2022-11-14T08:43:15.879140
2020-07-15T03:18:46
2020-07-15T03:18:46
279,035,874
2
0
null
null
null
null
UTF-8
Java
false
false
792
java
package com.pal.blog.dao; import com.pal.blog.entity.Comment; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; @Mapper @Repository public interface CommentDao { //查询父级评论 List<Comment> findByBlogIdParentIdNull(@Param("blogId") Long blogId, @Param("blogParentId") Long blogParentId); //查询一级回复 List<Comment> findByBlogIdParentIdNotNull(@Param("blogId") Long blogId, @Param("id") Long id); //查询二级回复 List<Comment> findByBlogIdAndReplayId(@Param("blogId") Long blogId,@Param("childId") Long childId); //添加一个评论 int saveComment(Comment comment); //删除评论 void deleteComment(Long id); }
bf4aad412887f405dbb9f8e9cb16257021ef5a44
82de39a461909b550abf4e63de3d9aa11da11dae
/app/src/main/java/com/softvilla/edusol/Model/FeeInfo.java
7c0ed50064ddbb386e64edac559e1ede28923d91
[]
no_license
hasssanshah7864/EDUSol
ac2f333ffafcadd3cc81cdfa12ddda4b987af9b2
2ee4602c0d9cbc9b80f0007b247ec79ae54d9a8e
refs/heads/master
2021-05-05T18:39:10.518007
2018-01-16T05:17:07
2018-01-16T05:17:07
117,634,636
0
0
null
null
null
null
UTF-8
Java
false
false
209
java
package com.softvilla.edusol.Model; /** * Created by Malik on 04/08/2017. */ public class FeeInfo { public String date, amount, received, remaining, advance,issueDate, expireDate, month, Total, rem; }
ef2fff6b903c05c54f7b8f7a342a7fcc6a29809b
ae3affa92da71991332c75eb397be3a151ed0649
/javaCore/hw5/Opossum.java
ce3999fc6d376dd1f196658037745b62d8db2dfd
[]
no_license
yi2000-asdf/ItsJava
74b4c806ab36c50a19dd55b7836f44ed45b61cc6
6f0edd6a4f3ac596b81270fd2ed3cca726fe69bf
refs/heads/master
2022-12-07T12:52:37.118720
2020-08-22T16:59:22
2020-08-22T16:59:22
278,143,528
0
0
null
null
null
null
UTF-8
Java
false
false
594
java
package ru.itsjava.javaCore.hw5; public class Opossum { final String name; public int height; public Opossum(String name, int height) { this.name = name; this.height = height; } public Opossum(String name) { this.name = name; } public void setHeight(int height) { this.height = height; } public String getName() { return name; } public int getHeight() { return height; } public void sayHakunaMatata(){ System.out.println("My name is " + this.name+" Hakuna Matata"); } }
9ff0772cb9a1c62223336b3f4ec9254745e8095a
aa047f0494e73d022077248f807217258e1d1d0d
/tzhehe/5-6/src/com/tz/viewpager/MainActivity.java
d4e2d6e36dad7971174bb0cef44dad22ef55f8b3
[]
no_license
AbnerChenyi/April_PublicWork
1412bd482113e3bb8729132e14964e0572297f14
5a75c3a8314becf5fe53485f7690c2fad75ab004
refs/heads/master
2021-01-22T13:13:55.540762
2015-07-08T10:11:48
2015-07-08T10:11:48
null
0
0
null
null
null
null
GB18030
Java
false
false
5,578
java
package com.tz.viewpager; import java.util.ArrayList; import com.tz.adapter.MyFragmentPagerAdapter; import com.tz.fragment.TestFragment; import com.tz.viewpager.utils.Constant; import android.R.color; import android.app.Activity; import android.graphics.BitmapFactory; import android.graphics.Color; import android.graphics.Matrix; import android.graphics.drawable.GradientDrawable.Orientation; import android.os.Bundle; import android.provider.ContactsContract.CommonDataKinds.Organization; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.util.DisplayMetrics; import android.util.Log; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.animation.Animation; import android.view.animation.TranslateAnimation; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends FragmentActivity { private ViewPager mPager; private ArrayList<Fragment> fragmentList; private ImageView cursor; private TextView tv_spring, tv_summer, tv_autumn, tv_winter; private int currIndex;//当前页卡编号 private int bmpW;//横线图片宽度 private int offset;//图片移动的偏移量 @Override public boolean onTouchEvent(MotionEvent event) { // TODO Auto-generated method stub return super.onTouchEvent(event); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); InitTextView(); InitImage(); InitViewPager(); } /* * 初始化标签名 */ public void InitTextView(){ tv_spring = (TextView)findViewById(R.id.tv_spring); tv_summer = (TextView)findViewById(R.id.tv_summer); tv_autumn = (TextView)findViewById(R.id.tv_autumn); tv_winter = (TextView)findViewById(R.id.tv_winter); tv_spring.setOnClickListener(new txListener(0)); tv_summer.setOnClickListener(new txListener(1)); tv_autumn.setOnClickListener(new txListener(2)); tv_winter.setOnClickListener(new txListener(3)); } public class txListener implements View.OnClickListener{ private int index=0; public txListener(int i) { index =i; } public void onClick(View v) { // TODO Auto-generated method stub mPager.setCurrentItem(index); } } /* * 初始化图片的位移像素 */ public void InitImage(){ cursor = (ImageView)findViewById(R.id.cursor); bmpW = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher).getWidth(); DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); int screenW = dm.widthPixels; offset = (screenW/4 - bmpW)/2; //imgageview设置平移,使下划线平移到初始位置(平移一个offset) Matrix matrix = new Matrix(); matrix.postTranslate(offset, 0); cursor.setImageMatrix(matrix); } /* * 初始化ViewPager */ public void InitViewPager(){ mPager = (ViewPager)findViewById(R.id.viewpager); fragmentList = new ArrayList<Fragment>(); //春天 Fragment spring = TestFragment.newInstance(R.drawable.spring); //夏天 Fragment summer = TestFragment.newInstance(R.drawable.summer); //秋天 Fragment autumn = TestFragment.newInstance(R.drawable.autumn); //冬天 Fragment winter = TestFragment.newInstance(R.drawable.winter); fragmentList.add(spring); fragmentList.add(summer); fragmentList.add(autumn); fragmentList.add(winter); //给ViewPager设置适配器 mPager.setAdapter(new MyFragmentPagerAdapter(getSupportFragmentManager(), fragmentList)); mPager.setCurrentItem(0);//设置当前显示标签页为第一页 mPager.setOnPageChangeListener(new MyOnPageChangeListener());//页面变化时的监听器 } public class MyOnPageChangeListener implements OnPageChangeListener{ private int one = offset *2 +bmpW;//两个相邻页面的偏移量 public void onPageScrollStateChanged(int arg0) { // TODO Auto-generated method stub } public void onPageScrolled(int arg0, float arg1, int arg2) { // TODO Auto-generated method stub } public void onPageSelected(int arg0) { Toast.makeText(MainActivity.this, "第几个页面"+arg0, Toast.LENGTH_SHORT).show(); Animation animation = new TranslateAnimation(currIndex*one,arg0*one,0,0);//平移动画 currIndex = arg0; animation.setFillAfter(true);//动画终止时停留在最后一帧,不然会回到没有执行前的状态 animation.setDuration(200);//动画持续时间0.2秒 cursor.startAnimation(animation);//是用ImageView来显示动画的 int i = currIndex + 1; } } }
186c8479f963f654093532fa5dd7730e396fa8e7
06d784f52f77580bb8053ad7eb5690a6326dd0fd
/Ecommerce/src/dbAdapter/DBProduct.java
b2849fd0d098894e03864cba000d06cf3cad711c
[]
no_license
tundejulius17/EcommerceWebApplication
17e0080db9a6c685d0cb6151f9c07501ec9b988c
6b160590b21d216c80fc98d1fa729ba1bad07923
refs/heads/master
2020-03-23T06:04:32.619281
2018-07-16T20:28:02
2018-07-16T20:28:02
141,187,114
0
0
null
null
null
null
UTF-8
Java
false
false
3,398
java
package dbAdapter; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityTransaction; import javax.persistence.NoResultException; import javax.persistence.TypedQuery; import appUtil.DBUtil; import dataModel.Product; public class DBProduct { // This inserts product obj into the database. public static void addProduct(Product product) { EntityManager em = DBUtil.getEntityManagerFactory() .createEntityManager(); EntityTransaction entityTrans = em.getTransaction(); entityTrans.begin(); try { em.persist(product); entityTrans.commit(); } catch (Exception e) { entityTrans.rollback(); e.printStackTrace(); } finally { em.close(); } } // This deletes product obj from the database. public static void deleteProduct(Product product) { EntityManager em = DBUtil.getEntityManagerFactory() .createEntityManager(); EntityTransaction entityTrans = em.getTransaction(); entityTrans.begin(); try { em.remove(em.merge(product)); entityTrans.commit(); } catch (Exception e) { entityTrans.rollback(); } finally { em.close(); } } // This updates product obj in the database. public static void updateProduct(Product product) { EntityManager em = DBUtil.getEntityManagerFactory() .createEntityManager(); EntityTransaction entityTrans = em.getTransaction(); entityTrans.begin(); try { em.merge(product); entityTrans.commit(); } catch (Exception e) { // System.out.println(e); entityTrans.rollback(); } finally { em.close(); } } // This retrieves product obj from the database by its id. public static Product getProductById(long id) { EntityManager em = DBUtil.getEntityManagerFactory() .createEntityManager(); try { return em.find(Product.class, id); } finally { em.close(); } } // This retrieves product obj from the database by its code. public static Product getProductByCode(String code) { EntityManager em = DBUtil.getEntityManagerFactory() .createEntityManager(); String query = "SELECT p FROM Product p WHERE p.code = :code"; TypedQuery<Product> q = em.createQuery(query, Product.class); q.setParameter("code", code); Product product = null; try { product = q.getSingleResult(); } catch (NoResultException e) { return null; } finally { em.close(); } return product; } // This retrieves product objects from the database. public static List<Product> getProducts() { EntityManager em = DBUtil.getEntityManagerFactory() .createEntityManager(); String query = "SELECT p FROM Product p ORDER BY p.lastUpdate"; TypedQuery<Product> q = em.createQuery(query, Product.class); List<Product> products; try { products = q.getResultList(); if (products == null || products.isEmpty()) products = null; } finally { em.close(); } return products; } // This retrieves product obj image from the database. public static byte[] getProductImage(long id) { Product product = getProductById(id); return product.getImage(); } // This checks if a product obj already exists in the database. public static boolean productCodeExists(String code) { Product product = getProductByCode(code); return product != null; } }
f3f5412e628b30891b0a3982f1682ac0bb2f93f0
9bb5534d1c84c84402287e7e54afb640764ec7e2
/src/main/java/com/springboot/service/impl/RoleServiceImpl.java
90e5baa588f84ac5d435b0fc228a5dfe80beb582
[]
no_license
dcygody/boot-shiro-crud
0376ad527c41f0dc87173eb73ee0d4ca6482bd68
bafdcf43281f6f138d41a6bbcb7c8869d6b73bec
refs/heads/master
2020-05-21T08:31:29.503242
2019-05-10T12:41:27
2019-05-10T12:41:27
185,983,490
0
0
null
null
null
null
UTF-8
Java
false
false
617
java
package com.springboot.service.impl; import com.springboot.mapper.RoleMapper; import com.springboot.service.RoleService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class RoleServiceImpl implements RoleService { @Autowired private RoleMapper roleMapper; @Override public List<Integer> getRoleIdByRoleName(List<String> roles) { return roleMapper.getRoleIdByRoleName(roles); } @Override public List<String> getRoleList() { return roleMapper.getRoleList(); } }
9778ab070509ce30c56c58215c8e694a8b7bfad6
73968ac7ffe65b7e66277ef6e6b85825bffaba6e
/src/com/xxmodd/interceptor/StudentAuth.java
63011b1071a1288a493517804ca2fed19d9ab500
[]
no_license
Mordan-M/StuManager
26e7776fd0cd26eda44b80d7e0a905b68115d442
709d762767c67ab5a08ff4a655955c21bce752ad
refs/heads/master
2021-06-09T20:45:42.489929
2017-01-08T16:22:02
2017-01-08T16:22:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
617
java
package com.xxmodd.interceptor; import java.util.Map; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionInvocation; import com.opensymphony.xwork2.interceptor.AbstractInterceptor; public class StudentAuth extends AbstractInterceptor{ private static final long serialVersionUID = 1L; @Override public String intercept(ActionInvocation invocation) throws Exception { ActionContext context = invocation.getInvocationContext(); Map<String, Object> session = context.getSession(); if(session.get("student")==null){ return "login"; } return invocation.invoke(); } }
150be44a9c77eb83c7a7c9217a1f55ef961caa97
426ff5d0610dae14b06a1076291139a088894260
/app/src/main/java/com/junior/dwan/draganddraw/Box.java
0f6d3e13df0e66447df282b706fda78a581dc247
[]
no_license
dwanmight/DragAndDraw
b408a2e5e14511d15bf8fa8597c1173da9a9d2e2
20523e4ef3b58c99f9329adc1c21a3a8a937b23f
refs/heads/master
2021-01-11T17:19:20.708662
2017-01-22T20:32:08
2017-01-22T20:32:08
79,743,779
0
0
null
null
null
null
UTF-8
Java
false
false
475
java
package com.junior.dwan.draganddraw; import android.graphics.PointF; /** * Created by Might on 10.01.2017. */ public class Box { private PointF mOrigin; private PointF mCurrent; public Box(PointF origin) { mOrigin = mCurrent = origin; } public void setCurrent(PointF curent) { mCurrent = curent; } public PointF getCurrent() { return mCurrent; } public PointF getOrigin() { return mOrigin; } }
e9f1f7111b8295125110614d385f4ca738b61498
35f5dde79931333ffbbf80aeaa93aa56a19a1105
/src/main/java/cn/tedu/ems/commom/exception/AutoException.java
afc202861a23df20723abbba38e9c106b3138297
[]
no_license
lulin1082/spring_login
bb488dda3c1a2892ecf581b9ceaac84b9777d0b0
a2d4736cc3befc547bd560162c2c9e9717424b47
refs/heads/master
2020-04-20T18:49:29.327609
2019-03-09T15:04:30
2019-03-09T15:04:30
169,032,371
0
0
null
null
null
null
UTF-8
Java
false
false
436
java
package cn.tedu.ems.commom.exception; /** * @Author: lulin * @Date: 3/9/2019 10:43 PM * @Version 1.0 */ public class AutoException extends RuntimeException{ private Integer code; public AutoException(String message, Integer code) { super(message); this.code = code; } public Integer getCode() { return code; } public void setCode(Integer code) { this.code = code; } }
b327164b1501499b9c5b9ce77172347fa98b90bc
a1f63241ae758a13e15fc5a3851b42ffa4fa4857
/bin/custom/training/trainingstorefront/web/src/org/training/storefront/controllers/pages/ProductPageController.java
66823eda97f631744d9fb85c1a292654c5ce35c5
[]
no_license
HybrisExercise/Exercise1
22fa7654c10ea4a51f61e3f5233bfce3be0efd7b
1403bb448aac777dc519c4a4e2e6ef854c0e89e3
refs/heads/master
2020-03-26T18:37:00.836805
2018-08-19T04:01:43
2018-08-19T04:01:43
145,221,163
0
0
null
null
null
null
UTF-8
Java
false
false
22,756
java
/* * [y] hybris Platform * * Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package org.training.storefront.controllers.pages; import de.hybris.platform.acceleratorfacades.futurestock.FutureStockFacade; import de.hybris.platform.acceleratorservices.controllers.page.PageType; import de.hybris.platform.acceleratorstorefrontcommons.breadcrumb.impl.ProductBreadcrumbBuilder; import de.hybris.platform.acceleratorstorefrontcommons.constants.WebConstants; import de.hybris.platform.acceleratorstorefrontcommons.controllers.pages.AbstractPageController; import de.hybris.platform.acceleratorstorefrontcommons.controllers.util.GlobalMessages; import de.hybris.platform.acceleratorstorefrontcommons.forms.FutureStockForm; import de.hybris.platform.acceleratorstorefrontcommons.forms.ReviewForm; import de.hybris.platform.acceleratorstorefrontcommons.forms.validation.ReviewValidator; import de.hybris.platform.acceleratorstorefrontcommons.util.MetaSanitizerUtil; import de.hybris.platform.acceleratorstorefrontcommons.util.XSSFilterUtil; import de.hybris.platform.acceleratorstorefrontcommons.variants.VariantSortStrategy; import de.hybris.platform.cms2.exceptions.CMSItemNotFoundException; import de.hybris.platform.cms2.model.pages.AbstractPageModel; import de.hybris.platform.cms2.servicelayer.services.CMSPageService; import de.hybris.platform.commercefacades.order.data.ConfigurationInfoData; import de.hybris.platform.commercefacades.product.ProductFacade; import de.hybris.platform.commercefacades.product.ProductOption; import de.hybris.platform.commercefacades.product.data.BaseOptionData; import de.hybris.platform.commercefacades.product.data.FutureStockData; import de.hybris.platform.commercefacades.product.data.ImageData; import de.hybris.platform.commercefacades.product.data.ImageDataType; import de.hybris.platform.commercefacades.product.data.ProductData; import de.hybris.platform.commercefacades.product.data.ReviewData; import de.hybris.platform.commerceservices.url.UrlResolver; import de.hybris.platform.core.model.product.ProductModel; import de.hybris.platform.product.ProductService; import de.hybris.platform.servicelayer.exceptions.UnknownIdentifierException; import de.hybris.platform.util.Config; import org.training.storefront.controllers.ControllerConstants; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.google.common.collect.Maps; /** * Controller for product details page */ @Controller @RequestMapping(value = "/**/p") public class ProductPageController extends AbstractPageController { @SuppressWarnings("unused") private static final Logger LOG = Logger.getLogger(ProductPageController.class); /** * We use this suffix pattern because of an issue with Spring 3.1 where a Uri value is incorrectly extracted if it * contains one or more '.' characters. Please see https://jira.springsource.org/browse/SPR-6164 for a discussion on * the issue and future resolution. */ private static final String PRODUCT_CODE_PATH_VARIABLE_PATTERN = "/{productCode:.*}"; private static final String REVIEWS_PATH_VARIABLE_PATTERN = "{numberOfReviews:.*}"; private static final String FUTURE_STOCK_ENABLED = "storefront.products.futurestock.enabled"; private static final String STOCK_SERVICE_UNAVAILABLE = "basket.page.viewFuture.unavailable"; private static final String NOT_MULTISKU_ITEM_ERROR = "basket.page.viewFuture.not.multisku"; @Resource(name = "productDataUrlResolver") private UrlResolver<ProductData> productDataUrlResolver; @Resource(name = "productVariantFacade") private ProductFacade productFacade; @Resource(name = "productService") private ProductService productService; @Resource(name = "productBreadcrumbBuilder") private ProductBreadcrumbBuilder productBreadcrumbBuilder; @Resource(name = "cmsPageService") private CMSPageService cmsPageService; @Resource(name = "variantSortStrategy") private VariantSortStrategy variantSortStrategy; @Resource(name = "reviewValidator") private ReviewValidator reviewValidator; @Resource(name = "futureStockFacade") private FutureStockFacade futureStockFacade; @RequestMapping(value = PRODUCT_CODE_PATH_VARIABLE_PATTERN, method = RequestMethod.GET) public String productDetail(@PathVariable("productCode") final String encodedProductCode, final Model model, final HttpServletRequest request, final HttpServletResponse response) throws CMSItemNotFoundException, UnsupportedEncodingException { final String productCode = decodeWithScheme(encodedProductCode, UTF_8); final List<ProductOption> extraOptions = Arrays.asList(ProductOption.VARIANT_MATRIX_BASE, ProductOption.VARIANT_MATRIX_URL, ProductOption.VARIANT_MATRIX_MEDIA); final ProductData productData = productFacade.getProductForCodeAndOptions(productCode, extraOptions); final String redirection = checkRequestUrl(request, response, productDataUrlResolver.resolve(productData)); if (StringUtils.isNotEmpty(redirection)) { return redirection; } updatePageTitle(productCode, model); populateProductDetailForDisplay(productCode, model, request, extraOptions); model.addAttribute(new ReviewForm()); model.addAttribute("pageType", PageType.PRODUCT.name()); model.addAttribute("futureStockEnabled", Boolean.valueOf(Config.getBoolean(FUTURE_STOCK_ENABLED, false))); final String metaKeywords = MetaSanitizerUtil.sanitizeKeywords(productData.getKeywords()); final String metaDescription = MetaSanitizerUtil.sanitizeDescription(productData.getDescription()); setUpMetaData(model, metaKeywords, metaDescription); return getViewForPage(model); } @RequestMapping(value = PRODUCT_CODE_PATH_VARIABLE_PATTERN + "/orderForm", method = RequestMethod.GET) public String productOrderForm(@PathVariable("productCode") final String encodedProductCode, final Model model, final HttpServletRequest request, final HttpServletResponse response) throws CMSItemNotFoundException { final String productCode = decodeWithScheme(encodedProductCode, UTF_8); final List<ProductOption> extraOptions = Arrays.asList(ProductOption.VARIANT_MATRIX_BASE, ProductOption.VARIANT_MATRIX_PRICE, ProductOption.VARIANT_MATRIX_MEDIA, ProductOption.VARIANT_MATRIX_STOCK, ProductOption.URL); final ProductData productData = productFacade.getProductForCodeAndOptions(productCode, extraOptions); updatePageTitle(productCode, model); populateProductDetailForDisplay(productCode, model, request, extraOptions); if (!model.containsAttribute(WebConstants.MULTI_DIMENSIONAL_PRODUCT)) { return REDIRECT_PREFIX + productDataUrlResolver.resolve(productData); } return ControllerConstants.Views.Pages.Product.OrderForm; } @RequestMapping(value = PRODUCT_CODE_PATH_VARIABLE_PATTERN + "/zoomImages", method = RequestMethod.GET) public String showZoomImages(@PathVariable("productCode") final String encodedProductCode, @RequestParam(value = "galleryPosition", required = false) final String galleryPosition, final Model model) { final String productCode = decodeWithScheme(encodedProductCode, UTF_8); final ProductData productData = productFacade.getProductForCodeAndOptions(productCode, Collections.singleton(ProductOption.GALLERY)); final List<Map<String, ImageData>> images = getGalleryImages(productData); populateProductData(productData, model); if (galleryPosition != null) { try { model.addAttribute("zoomImageUrl", images.get(Integer.parseInt(galleryPosition)).get("zoom").getUrl()); } catch (final IndexOutOfBoundsException | NumberFormatException ex) { if (LOG.isDebugEnabled()) { LOG.debug(ex); } model.addAttribute("zoomImageUrl", ""); } } return ControllerConstants.Views.Fragments.Product.ZoomImagesPopup; } @RequestMapping(value = PRODUCT_CODE_PATH_VARIABLE_PATTERN + "/quickView", method = RequestMethod.GET) public String showQuickView(@PathVariable("productCode") final String encodedProductCode, final Model model, final HttpServletRequest request) { final String productCode = decodeWithScheme(encodedProductCode, UTF_8); final ProductModel productModel = productService.getProductForCode(productCode); final ProductData productData = productFacade.getProductForCodeAndOptions(productCode, Arrays.asList(ProductOption.BASIC, ProductOption.PRICE, ProductOption.SUMMARY, ProductOption.DESCRIPTION, ProductOption.CATEGORIES, ProductOption.PROMOTIONS, ProductOption.STOCK, ProductOption.REVIEW, ProductOption.VARIANT_FULL, ProductOption.DELIVERY_MODE_AVAILABILITY)); sortVariantOptionData(productData); populateProductData(productData, model); getRequestContextData(request).setProduct(productModel); return ControllerConstants.Views.Fragments.Product.QuickViewPopup; } @RequestMapping(value = PRODUCT_CODE_PATH_VARIABLE_PATTERN + "/review", method = { RequestMethod.GET, RequestMethod.POST }) public String postReview(@PathVariable("productCode") final String encodedProductCode, final ReviewForm form, final BindingResult result, final Model model, final HttpServletRequest request, final RedirectAttributes redirectAttrs) throws CMSItemNotFoundException { final String productCode = decodeWithScheme(encodedProductCode, UTF_8); getReviewValidator().validate(form, result); final ProductData productData = productFacade.getProductForCodeAndOptions(productCode, null); if (result.hasErrors()) { updatePageTitle(productCode, model); GlobalMessages.addErrorMessage(model, "review.general.error"); model.addAttribute("showReviewForm", Boolean.TRUE); populateProductDetailForDisplay(productCode, model, request, Collections.emptyList()); storeCmsPageInModel(model, getPageForProduct(productCode)); return getViewForPage(model); } final ReviewData review = new ReviewData(); review.setHeadline(XSSFilterUtil.filter(form.getHeadline())); review.setComment(XSSFilterUtil.filter(form.getComment())); review.setRating(form.getRating()); review.setAlias(XSSFilterUtil.filter(form.getAlias())); productFacade.postReview(productCode, review); GlobalMessages.addFlashMessage(redirectAttrs, GlobalMessages.CONF_MESSAGES_HOLDER, "review.confirmation.thank.you.title"); return REDIRECT_PREFIX + productDataUrlResolver.resolve(productData); } @RequestMapping(value = PRODUCT_CODE_PATH_VARIABLE_PATTERN + "/reviewhtml/" + REVIEWS_PATH_VARIABLE_PATTERN, method = RequestMethod.GET) public String reviewHtml(@PathVariable("productCode") final String encodedProductCode, @PathVariable("numberOfReviews") final String numberOfReviews, final Model model, final HttpServletRequest request) { final String productCode = decodeWithScheme(encodedProductCode, UTF_8); final ProductModel productModel = productService.getProductForCode(productCode); final List<ReviewData> reviews; final ProductData productData = productFacade.getProductForCodeAndOptions(productCode, Arrays.asList(ProductOption.BASIC, ProductOption.REVIEW)); if ("all".equals(numberOfReviews)) { reviews = productFacade.getReviews(productCode); } else { final int reviewCount = Math.min(Integer.parseInt(numberOfReviews), productData.getNumberOfReviews() == null ? 0 : productData.getNumberOfReviews().intValue()); reviews = productFacade.getReviews(productCode, Integer.valueOf(reviewCount)); } getRequestContextData(request).setProduct(productModel); model.addAttribute("reviews", reviews); model.addAttribute("reviewsTotal", productData.getNumberOfReviews()); model.addAttribute(new ReviewForm()); return ControllerConstants.Views.Fragments.Product.ReviewsTab; } @RequestMapping(value = PRODUCT_CODE_PATH_VARIABLE_PATTERN + "/writeReview", method = RequestMethod.GET) public String writeReview(@PathVariable("productCode") final String encodedProductCode, final Model model) throws CMSItemNotFoundException { final String productCode = decodeWithScheme(encodedProductCode, UTF_8); model.addAttribute(new ReviewForm()); setUpReviewPage(model, productCode); return ControllerConstants.Views.Pages.Product.WriteReview; } protected void setUpReviewPage(final Model model, final String productCode) throws CMSItemNotFoundException { final ProductData productData = productFacade.getProductForCodeAndOptions(productCode, null); final String metaKeywords = MetaSanitizerUtil.sanitizeKeywords(productData.getKeywords()); final String metaDescription = MetaSanitizerUtil.sanitizeDescription(productData.getDescription()); setUpMetaData(model, metaKeywords, metaDescription); storeCmsPageInModel(model, getPageForProduct(productCode)); model.addAttribute("product", productFacade.getProductForCodeAndOptions(productCode, Arrays.asList(ProductOption.BASIC))); updatePageTitle(productCode, model); } @RequestMapping(value = PRODUCT_CODE_PATH_VARIABLE_PATTERN + "/writeReview", method = RequestMethod.POST) public String writeReview(@PathVariable("productCode") final String encodedProductCode, final ReviewForm form, final BindingResult result, final Model model, final HttpServletRequest request, final RedirectAttributes redirectAttrs) throws CMSItemNotFoundException { final String productCode = decodeWithScheme(encodedProductCode, UTF_8); getReviewValidator().validate(form, result); final ProductData productData = productFacade.getProductForCodeAndOptions(productCode, null); if (result.hasErrors()) { GlobalMessages.addErrorMessage(model, "review.general.error"); populateProductDetailForDisplay(productCode, model, request, Collections.emptyList()); setUpReviewPage(model, productCode); return ControllerConstants.Views.Pages.Product.WriteReview; } final ReviewData review = new ReviewData(); review.setHeadline(XSSFilterUtil.filter(form.getHeadline())); review.setComment(XSSFilterUtil.filter(form.getComment())); review.setRating(form.getRating()); review.setAlias(XSSFilterUtil.filter(form.getAlias())); productFacade.postReview(productCode, review); GlobalMessages.addFlashMessage(redirectAttrs, GlobalMessages.CONF_MESSAGES_HOLDER, "review.confirmation.thank.you.title"); return REDIRECT_PREFIX + productDataUrlResolver.resolve(productData); } @RequestMapping(value = PRODUCT_CODE_PATH_VARIABLE_PATTERN + "/futureStock", method = RequestMethod.GET) public String productFutureStock(@PathVariable("productCode") final String encodedProductCode, final Model model, final HttpServletRequest request, final HttpServletResponse response) throws CMSItemNotFoundException { final String productCode = decodeWithScheme(encodedProductCode, UTF_8); final boolean futureStockEnabled = Config.getBoolean(FUTURE_STOCK_ENABLED, false); if (futureStockEnabled) { final List<FutureStockData> futureStockList = futureStockFacade.getFutureAvailability(productCode); if (futureStockList == null) { GlobalMessages.addErrorMessage(model, STOCK_SERVICE_UNAVAILABLE); } else if (futureStockList.isEmpty()) { GlobalMessages.addInfoMessage(model, "product.product.details.future.nostock"); } populateProductDetailForDisplay(productCode, model, request, Collections.emptyList()); model.addAttribute("futureStocks", futureStockList); return ControllerConstants.Views.Fragments.Product.FutureStockPopup; } else { return ControllerConstants.Views.Pages.Error.ErrorNotFoundPage; } } @ResponseBody @RequestMapping(value = PRODUCT_CODE_PATH_VARIABLE_PATTERN + "/grid/skusFutureStock", method = { RequestMethod.POST }, produces = MediaType.APPLICATION_JSON_VALUE) public final Map<String, Object> productSkusFutureStock(final FutureStockForm form, final Model model) { final String productCode = form.getProductCode(); final List<String> skus = form.getSkus(); final boolean futureStockEnabled = Config.getBoolean(FUTURE_STOCK_ENABLED, false); Map<String, Object> result = new HashMap<>(); if (futureStockEnabled && CollectionUtils.isNotEmpty(skus) && StringUtils.isNotBlank(productCode)) { final Map<String, List<FutureStockData>> futureStockData = futureStockFacade .getFutureAvailabilityForSelectedVariants(productCode, skus); if (futureStockData == null) { // future availability service is down, we show this to the user result = Maps.newHashMap(); final String errorMessage = getMessageSource().getMessage(NOT_MULTISKU_ITEM_ERROR, null, getI18nService().getCurrentLocale()); result.put(NOT_MULTISKU_ITEM_ERROR, errorMessage); } else { for (final Map.Entry<String, List<FutureStockData>> entry : futureStockData.entrySet()) { result.put(entry.getKey(), entry.getValue()); } } } return result; } @ExceptionHandler(UnknownIdentifierException.class) public String handleUnknownIdentifierException(final UnknownIdentifierException exception, final HttpServletRequest request) { request.setAttribute("message", exception.getMessage()); return FORWARD_PREFIX + "/404"; } protected void updatePageTitle(final String productCode, final Model model) { storeContentPageTitleInModel(model, getPageTitleResolver().resolveProductPageTitle(productCode)); } protected void populateProductDetailForDisplay(final String productCode, final Model model, final HttpServletRequest request, final List<ProductOption> extraOptions) throws CMSItemNotFoundException { final ProductModel productModel = productService.getProductForCode(productCode); getRequestContextData(request).setProduct(productModel); final List<ProductOption> options = new ArrayList<>(Arrays.asList(ProductOption.VARIANT_FIRST_VARIANT, ProductOption.BASIC, ProductOption.URL, ProductOption.PRICE, ProductOption.SUMMARY, ProductOption.DESCRIPTION, ProductOption.GALLERY, ProductOption.CATEGORIES, ProductOption.REVIEW, ProductOption.PROMOTIONS, ProductOption.CLASSIFICATION, ProductOption.VARIANT_FULL, ProductOption.STOCK, ProductOption.VOLUME_PRICES, ProductOption.PRICE_RANGE, ProductOption.DELIVERY_MODE_AVAILABILITY)); options.addAll(extraOptions); final ProductData productData = productFacade.getProductForCodeAndOptions(productCode, options); sortVariantOptionData(productData); storeCmsPageInModel(model, getPageForProduct(productCode)); populateProductData(productData, model); model.addAttribute(WebConstants.BREADCRUMBS_KEY, productBreadcrumbBuilder.getBreadcrumbs(productCode)); if (CollectionUtils.isNotEmpty(productData.getVariantMatrix())) { model.addAttribute(WebConstants.MULTI_DIMENSIONAL_PRODUCT, Boolean.valueOf(CollectionUtils.isNotEmpty(productData.getVariantMatrix()))); } } protected void populateProductData(final ProductData productData, final Model model) { model.addAttribute("galleryImages", getGalleryImages(productData)); model.addAttribute("product", productData); if (productData.getConfigurable()) { final List<ConfigurationInfoData> configurations = productFacade.getConfiguratorSettingsForCode(productData.getCode()); if (CollectionUtils.isNotEmpty(configurations)) { model.addAttribute("configuratorType", configurations.get(0).getConfiguratorType()); } } } protected void sortVariantOptionData(final ProductData productData) { if (CollectionUtils.isNotEmpty(productData.getBaseOptions())) { for (final BaseOptionData baseOptionData : productData.getBaseOptions()) { if (CollectionUtils.isNotEmpty(baseOptionData.getOptions())) { Collections.sort(baseOptionData.getOptions(), variantSortStrategy); } } } if (CollectionUtils.isNotEmpty(productData.getVariantOptions())) { Collections.sort(productData.getVariantOptions(), variantSortStrategy); } } protected List<Map<String, ImageData>> getGalleryImages(final ProductData productData) { final List<Map<String, ImageData>> galleryImages = new ArrayList<>(); if (CollectionUtils.isNotEmpty(productData.getImages())) { final List<ImageData> images = new ArrayList<>(); for (final ImageData image : productData.getImages()) { if (ImageDataType.GALLERY.equals(image.getImageType())) { images.add(image); } } Collections.sort(images, new Comparator<ImageData>() { @Override public int compare(final ImageData image1, final ImageData image2) { return image1.getGalleryIndex().compareTo(image2.getGalleryIndex()); } }); if (CollectionUtils.isNotEmpty(images)) { addFormatsToGalleryImages(galleryImages, images); } } return galleryImages; } protected void addFormatsToGalleryImages(final List<Map<String, ImageData>> galleryImages, final List<ImageData> images) { int currentIndex = images.get(0).getGalleryIndex().intValue(); Map<String, ImageData> formats = new HashMap<String, ImageData>(); for (final ImageData image : images) { if (currentIndex != image.getGalleryIndex().intValue()) { galleryImages.add(formats); formats = new HashMap<>(); currentIndex = image.getGalleryIndex().intValue(); } formats.put(image.getFormat(), image); } if (!formats.isEmpty()) { galleryImages.add(formats); } } protected ReviewValidator getReviewValidator() { return reviewValidator; } protected AbstractPageModel getPageForProduct(final String productCode) throws CMSItemNotFoundException { final ProductModel productModel = productService.getProductForCode(productCode); return cmsPageService.getPageForProduct(productModel); } }
f0c7ec6e5e1859dc427f3fb68a9c0602a4b9c56e
5b14d2cd68dc4c23b33a84729db48288f7163718
/lab3-end/src/main/java/jwd/wafepa/support/ActivityToActivityDTO.java
9054db8649317c9ae0f3293c4221ca49422b7489
[]
no_license
JWD-kurs/jwd27
221be26f80016a544b9f2eb22a361964c8c223ff
690ce7ad88b42e20dfacabe3da822a46d387f545
refs/heads/master
2021-04-30T03:47:54.189962
2018-03-15T01:07:27
2018-03-15T01:07:27
121,522,070
0
0
null
null
null
null
UTF-8
Java
false
false
748
java
package jwd.wafepa.support; import java.util.ArrayList; import java.util.List; import org.springframework.core.convert.converter.Converter; import org.springframework.stereotype.Component; import jwd.wafepa.model.Activity; import jwd.wafepa.web.dto.ActivityDTO; @Component public class ActivityToActivityDTO implements Converter<Activity, ActivityDTO>{ @Override public ActivityDTO convert(Activity activity) { ActivityDTO dto = new ActivityDTO(); dto.setId(activity.getId()); dto.setName(activity.getName()); return dto; } public List<ActivityDTO> convert(List<Activity> activities){ List<ActivityDTO> retVal = new ArrayList<>(); for(Activity a : activities) { retVal.add(convert(a)); } return retVal; } }
ea3d44f82ee8c3195aa4299fb73d49ed6015457b
0a8a4da4ac3785a19769da867fc7f9609e2036ab
/app/src/main/java/kaichi/notepad/database/NoteContentProvider.java
df2a1c650c3cf80856e6d89fe272f8980fdf6c55
[]
no_license
kai-chi/Notepad--
0190d77aac406641284f4566e71f36c5174971e3
e264e83dc61fa63b5097158dbe772cc6a41facca
refs/heads/master
2021-08-20T00:20:51.726520
2017-11-27T19:43:00
2017-11-27T19:43:00
108,239,906
0
0
null
null
null
null
UTF-8
Java
false
false
5,756
java
package kaichi.notepad.database; import android.content.ContentProvider; import android.content.ContentValues; import android.content.UriMatcher; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteQueryBuilder; import android.net.Uri; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import kaichi.notepad.R; import kaichi.notepad.database.NoteDatabaseContract.Note; public class NoteContentProvider extends ContentProvider { private NoteDatabaseHelper mDbHelper; private SQLiteDatabase mDb; //UriMatcher helps ContectProvider determine operation to perform private static final UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); //constants used with UriMatcher to determine operation to perform private static final int ONE_NOTE = 1; //manipulate one note private static final int NOTES = 2; //manipulate notes table static { uriMatcher.addURI(NoteDatabaseContract.AUTHORITY, Note.TABLE_NAME + "/#", ONE_NOTE); //Uri for notes table uriMatcher.addURI(NoteDatabaseContract.AUTHORITY, Note.TABLE_NAME, NOTES); } @Override public boolean onCreate() { mDbHelper = new NoteDatabaseHelper(getContext()); mDb = mDbHelper.getWritableDatabase(); return true; } //query the database @Nullable @Override public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) { SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder(); queryBuilder.setTables(Note.TABLE_NAME); switch (uriMatcher.match(uri)) { case ONE_NOTE: queryBuilder.appendWhere( Note._ID + "=" + uri.getLastPathSegment()); break; case NOTES: break; default: throw new UnsupportedOperationException( getContext().getString(R.string.invalid_query_uri) + uri); } Cursor cursor = queryBuilder.query(mDb, projection, selection, selectionArgs, null, null, sortOrder); cursor.setNotificationUri(getContext().getContentResolver(), uri); return cursor; } //insert a new note @Nullable @Override public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) { Uri newNoteUri = null; switch (uriMatcher.match(uri)) { case NOTES: long rowID = mDb.insert(Note.TABLE_NAME, null, values); //if the note was inserted create an appropriate Uri if (rowID > 0) { newNoteUri = Note.buildNoteUri(rowID); getContext().getContentResolver().notifyChange(uri, null); } else { throw new SQLException(getContext().getString(R.string.insert_failed) + uri); } break; default: throw new UnsupportedOperationException(getContext().getString(R.string.invalid_query_uri) + uri); } return newNoteUri; } @Override public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) { int numbersOfRowsDeleted; switch (uriMatcher.match(uri)) { case ONE_NOTE: String id = uri.getLastPathSegment(); numbersOfRowsDeleted = mDb.delete(Note.TABLE_NAME, Note._ID + "=" + id, selectionArgs); break; default: throw new UnsupportedOperationException(getContext().getString(R.string.invalid_delete) + uri); } if (numbersOfRowsDeleted != 0) { getContext().getContentResolver().notifyChange(uri, null); } return numbersOfRowsDeleted; } @Override public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) { int numberOfRowsUpdated; switch (uriMatcher.match(uri)) { case ONE_NOTE: String id = uri.getLastPathSegment(); numberOfRowsUpdated = mDb.update(Note.TABLE_NAME, values, Note._ID + "=" + id, selectionArgs); break; default: throw new UnsupportedOperationException(getContext().getString(R.string.invalid_update) + uri); } if (numberOfRowsUpdated != 0) { getContext().getContentResolver().notifyChange(uri, null); } return numberOfRowsUpdated; } @Nullable @Override public String getType(@NonNull Uri uri) { return null; } }
f16739b7b0bb8ecdd06eb44e90a669cba07bfdc5
9a0902fafa53cc9d1eaea345a181b41cd5f4c8ae
/src/main/java/com/cos/around/Utils/MyUtils.java
744645794b4b78fc4118801a9f5cefe4d3392f11
[]
no_license
noinel/around
f80ecac52746e7a8dfc6cc6330e56caaeff3a65a
53dc2b49e2bd18791237ddc71e143dd7d848544a
refs/heads/master
2020-05-21T07:36:06.203626
2019-05-22T00:28:39
2019-05-22T00:28:39
185,963,515
0
3
null
2019-06-11T05:54:13
2019-05-10T09:50:44
Java
UTF-8
Java
false
false
436
java
package com.cos.around.Utils; import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Calendar; public class MyUtils { public static Timestamp getCurrentTime() { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); Calendar cal = Calendar.getInstance(); String today = null; today = formatter.format(cal.getTime()); Timestamp ts = Timestamp.valueOf(today); return ts; } }
[ "rainbow0043.naver.com" ]
rainbow0043.naver.com
9dc737c0ccd7cbc6196be1714c99860c6553a825
866ee9cbfb51fa2ec204ffdb1c0707f0de0eb03c
/src/main/java/jetty/TestController.java
43e862d66b680d7aa5a2cfacba28e02919976ab5
[]
no_license
sje309/test
15670b9673a9404150d93a3c7472d06714e10389
d1fa267294f4703f2915bceaa5c731f419d58ed4
refs/heads/master
2022-09-24T14:49:05.049312
2019-05-27T13:28:21
2019-05-27T13:28:21
137,846,029
0
0
null
2022-09-01T22:57:41
2018-06-19T05:53:13
Java
UTF-8
Java
false
false
1,324
java
package jetty; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.handler.AbstractHandler; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; /** * @Author: shuyizhi * @Date: 2018/3/30 10:23 * @Description: */ public class TestController extends AbstractHandler { @Override public void handle(String s, Request request, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException, ServletException { System.out.println(s); httpServletResponse.setContentType("text/html;charset=utf-8"); httpServletResponse.setCharacterEncoding("utf-8"); httpServletResponse.setStatus(HttpServletResponse.SC_OK); request.setHandled(true); PrintWriter out = httpServletResponse.getWriter(); if (s.equals("/favicon.ico")) { System.out.println(1); out.println("404"); } else { System.out.println(2); out.println("hello jetty"); if (httpServletRequest.getParameter("name") != null) { out.println(httpServletRequest.getParameter("name")); } } } }
6ef9b04539bb0bab3a6a765f385b89a59444321c
f22043a1699eb384884f835d8d03a90fd0aca313
/src/test/java/net/bjohannsen/spring/boot/actuator/metrics/jmxexporter/jmx/MBeanAttributeReaderTest.java
2ebc0f136f415a8c9f59b4b90f7f70df43ec7c66
[ "MIT" ]
permissive
bjohannsen/spring-boot-actuator-jmx-metrics-exporter
0761257b3944a6a5202ef856f49b29c484946f71
352fd84f9de00611887be43855b2cd09dfa7825f
refs/heads/master
2020-09-01T16:12:27.485801
2019-11-19T17:04:10
2019-11-19T17:04:10
219,002,180
8
0
null
null
null
null
UTF-8
Java
false
false
4,511
java
package net.bjohannsen.spring.boot.actuator.metrics.jmxexporter.jmx; import javax.management.AttributeNotFoundException; import javax.management.InstanceNotFoundException; import javax.management.MBeanException; import javax.management.MBeanServer; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import javax.management.ReflectionException; import net.bjohannsen.spring.boot.actuator.metrics.jmxexporter.config.JmxAttributeIdentifier; import net.bjohannsen.spring.boot.actuator.metrics.jmxexporter.jmx.parser.AttributeValueParser; import org.junit.Rule; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; import org.mockito.quality.Strictness; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertThat; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; public class MBeanAttributeReaderTest { private static final String M_BEAN_NAME = "net.bjohannsen:name=mBean,type=SomeBean"; private static final JmxAttributeIdentifier ATTRIBUTE_ID = JmxAttributeIdentifier.of("attributeName"); private static final Double VALUE = 19.09d; @Rule public MockitoRule rule = MockitoJUnit.rule().strictness(Strictness.STRICT_STUBS); @Mock private MBeanServer mBeanServerMock; @Mock private AttributeParserRegistry parserRegistryMock; @Mock private AttributeValueParser attributeParserMock; @InjectMocks private MBeanAttributeReader attributeReader; @Test public void thatFindAttributeValueWorks() throws MalformedObjectNameException, AttributeNotFoundException, MBeanException, ReflectionException, InstanceNotFoundException { // given ObjectName objectName = ObjectName.getInstance(M_BEAN_NAME); when(mBeanServerMock.getAttribute(objectName, ATTRIBUTE_ID.getName())).thenReturn(VALUE); when(parserRegistryMock.findParserFor(VALUE)).thenReturn(attributeParserMock); when(attributeParserMock.parseNumericValue(VALUE, ATTRIBUTE_ID)).thenReturn(VALUE); // when double result = attributeReader.findMBeanAttributeValue(M_BEAN_NAME, ATTRIBUTE_ID); // then assertThat(result, equalTo(VALUE)); verify(mBeanServerMock).getAttribute(objectName, ATTRIBUTE_ID.getName()); } @Test(expected = MBeanAttributeReadException.class) public void thatMalformedBeanNameDoesNotReturnAValueOrRaiseException() { // given & when attributeReader.findMBeanAttributeValue("malformedBeanName", ATTRIBUTE_ID); // then -> exception } @Test(expected = MBeanAttributeReadException.class) public void thatNonExistingAttributeDoesNotReturnValueOrRaiseException() throws MalformedObjectNameException, AttributeNotFoundException, MBeanException, ReflectionException, InstanceNotFoundException { // given ObjectName objectName = ObjectName.getInstance(M_BEAN_NAME); when(mBeanServerMock.getAttribute(objectName, ATTRIBUTE_ID.getName())).thenThrow(new AttributeNotFoundException()); // when attributeReader.findMBeanAttributeValue(M_BEAN_NAME, ATTRIBUTE_ID); // then -> exception } @Test(expected = MBeanAttributeReadException.class) public void thatNonExistingMBeanDoesNotReturnValueOrRaiseException() throws MalformedObjectNameException, AttributeNotFoundException, MBeanException, ReflectionException, InstanceNotFoundException { // given ObjectName objectName = ObjectName.getInstance(M_BEAN_NAME); when(mBeanServerMock.getAttribute(objectName, ATTRIBUTE_ID.getName())).thenThrow(new InstanceNotFoundException()); // when attributeReader.findMBeanAttributeValue(M_BEAN_NAME, ATTRIBUTE_ID); // then -> exception } @Test(expected = MBeanAttributeReadException.class) public void thatOtherErrorsAreWrappedAsMBeanAttributeReadingException() throws MalformedObjectNameException, AttributeNotFoundException, MBeanException, ReflectionException, InstanceNotFoundException { // given ObjectName objectName = ObjectName.getInstance(M_BEAN_NAME); when(mBeanServerMock.getAttribute(objectName, ATTRIBUTE_ID.getName())).thenThrow(new ReflectionException(new Exception())); // when attributeReader.findMBeanAttributeValue(M_BEAN_NAME, ATTRIBUTE_ID); // then -> exception } }
b897e545997bd5edade63dbc2de937d549e2d21a
9c8407b7221103e7060889bccca0c75b5784dc5b
/src/main/java/org/jacop/constraints/IfThen.java
9fe66a3b3057579d1c5c27be6dcffd1db0e3195d
[]
no_license
alexkit/jacop
18e822c60319858131d28b0d8184bd17686826fe
93b5e2c53e5e50a8edfee46e0c3e14c5dae51a77
refs/heads/master
2020-05-29T11:51:30.218142
2014-01-05T15:42:10
2014-01-05T15:42:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,725
java
/** * IfThen.java * This file is part of JaCoP. * * JaCoP is a Java Constraint Programming solver. * * Copyright (C) 2000-2008 Krzysztof Kuchcinski and Radoslaw Szymanek * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * Notwithstanding any other provision of this License, the copyright * owners of this work supplement the terms of this License with terms * prohibiting misrepresentation of the origin of this work and requiring * that modified versions of this work be marked in reasonable ways as * different from the original version. This supplement of the license * terms is in accordance with Section 7 of GNU Affero General Public * License version 3. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ package org.jacop.constraints; import java.util.ArrayList; import org.jacop.core.Domain; import org.jacop.core.Store; import org.jacop.core.Var; /** * Constraint if constraint1 then constraint2 * * @author Krzysztof Kuchcinski and Radoslaw Szymanek * @version 4.0 */ public class IfThen extends PrimitiveConstraint { static int counter = 1; /** * It specifies constraint condC in the IfThen constraint. */ public PrimitiveConstraint condC; /** * It specifies constraint condC in the IfThen constraint. */ public PrimitiveConstraint thenC; boolean imposed = false; Store store; /** * It specifies the arguments required to be saved by an XML format as well as * the constructor being called to recreate an object from an XML format. */ public static String[] xmlAttributes = {"condC", "thenC"}; /** * It constructs ifthen constraint. * @param condC the condition of the ifthen constraint. * @param thenC the constraint which must hold if the condition holds. */ public IfThen(PrimitiveConstraint condC, PrimitiveConstraint thenC) { assert (condC != null) : "Constraint cond is null"; assert (thenC != null) : "Constraint then is null"; numberId = counter++; numberArgs = (short) (condC.numberArgs + thenC.numberArgs); this.condC = condC; this.thenC = thenC; } @Override public ArrayList<Var> arguments() { ArrayList<Var> variables = new ArrayList<Var>(1); for (Var V : condC.arguments()) variables.add(V); for (Var V : thenC.arguments()) variables.add(V); return variables; } @Override public void consistency(Store store) { if (condC.satisfied()) thenC.consistency(store); if (imposed && thenC.notSatisfied()) condC.notConsistency(store); } @Override public boolean notSatisfied() { return condC.satisfied() && thenC.notSatisfied(); } @Override public void notConsistency(Store store) { thenC.notConsistency(store); condC.consistency(store); } @Override public int getConsistencyPruningEvent(Var var) { // If consistency function mode if (consistencyPruningEvents != null) { Integer possibleEvent = consistencyPruningEvents.get(var); if (possibleEvent != null) return possibleEvent; } int eventAcross = -1; if (condC.arguments().contains(var)) { int event = condC.getNestedPruningEvent(var, true); if (event > eventAcross) eventAcross = event; } if (condC.arguments().contains(var)) { int event = condC.getNestedPruningEvent(var, false); if (event > eventAcross) eventAcross = event; } if (thenC.arguments().contains(var)) { int event = thenC.getNestedPruningEvent(var, true); if (event > eventAcross) eventAcross = event; } if (thenC.arguments().contains(var)) { int event = thenC.getNestedPruningEvent(var, false); if (event > eventAcross) eventAcross = event; } if (eventAcross == -1) return Domain.NONE; else return eventAcross; } @Override public int getNotConsistencyPruningEvent(Var var) { // If notConsistency function mode if (notConsistencyPruningEvents != null) { Integer possibleEvent = notConsistencyPruningEvents.get(var); if (possibleEvent != null) return possibleEvent; } int eventAcross = -1; if (condC.arguments().contains(var)) { int event = condC.getNestedPruningEvent(var, true); if (event > eventAcross) eventAcross = event; } if (condC.arguments().contains(var)) { int event = condC.getNestedPruningEvent(var, false); if (event > eventAcross) eventAcross = event; } if (thenC.arguments().contains(var)) { int event = thenC.getNestedPruningEvent(var, true); if (event > eventAcross) eventAcross = event; } if (thenC.arguments().contains(var)) { int event = thenC.getNestedPruningEvent(var, false); if (event > eventAcross) eventAcross = event; } if (eventAcross == -1) return Domain.NONE; else return eventAcross; } @Override public int getNestedPruningEvent(Var var, boolean mode) { // If consistency function mode if (mode) { if (consistencyPruningEvents != null) { Integer possibleEvent = consistencyPruningEvents.get(var); if (possibleEvent != null) return possibleEvent; } } // If notConsistency function mode else { if (notConsistencyPruningEvents != null) { Integer possibleEvent = notConsistencyPruningEvents.get(var); if (possibleEvent != null) return possibleEvent; } } int eventAcross = -1; if (condC.arguments().contains(var)) { int event = condC.getNestedPruningEvent(var, true); if (event > eventAcross) eventAcross = event; } if (condC.arguments().contains(var)) { int event = condC.getNestedPruningEvent(var, false); if (event > eventAcross) eventAcross = event; } if (thenC.arguments().contains(var)) { int event = thenC.getNestedPruningEvent(var, true); if (event > eventAcross) eventAcross = event; } if (thenC.arguments().contains(var)) { int event = thenC.getNestedPruningEvent(var, false); if (event > eventAcross) eventAcross = event; } if (eventAcross == -1) return Domain.NONE; else return eventAcross; } @Override public void impose(Store store) { this.store = store; for (Var V : condC.arguments()) V.putModelConstraint(this, getConsistencyPruningEvent(V)); for (Var V : thenC.arguments()) V.putModelConstraint(this, getConsistencyPruningEvent(V)); store.addChanged(this); store.countConstraint(); imposed = true; } @Override public void removeConstraint() { for (Var V : condC.arguments()) V.removeConstraint(this); for (Var V : thenC.arguments()) V.removeConstraint(this); } @Override public boolean satisfied() { if (imposed) { if (condC.satisfied()) { this.removeConstraint(); store.impose(thenC); return false; } return condC.notSatisfied(); } else return (condC.satisfied() && thenC.satisfied()) || (condC.notSatisfied()); } @Override public String toString() { StringBuffer result = new StringBuffer( id() ); result.append(" : IfThen(\n").append( condC ).append( ", \n").append(thenC).append(" )\n"); return result.toString(); } @Override public void increaseWeight() { if (increaseWeight) { condC.increaseWeight(); thenC.increaseWeight(); } } }
e260e5a34149197dad1420405a64a198a5dc397c
89c8dc80e2f1b9f0e3829385cf418b2ac56cc391
/Lego/Martin/idiRallyMartin.java
ef871565343ec3553763de2c27b0417e7f761ce0
[]
no_license
maxschau/TDAT1001-Programmering-Grunnkurs
71e6da987f56bc03016f6748aa838002e6644781
e8ce013e44a340094cb3fcdef0c952224eb99dbc
refs/heads/master
2020-07-24T20:10:53.957490
2019-09-12T11:29:28
2019-09-12T11:29:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,475
java
/* FolgLinje.java GS - 2012-01-20 * Program som gjør at en enkel robot følger en sort linje * Du trenger en enkel robot som kan svinge * en lyssensor koblet til sensor 1 - pekende nedover * en trykksensor koblet til sensor 2 - pekende rett fram i gå retningen */ import lejos.hardware.motor.*; import lejos.hardware.sensor.EV3TouchSensor; import lejos.hardware.sensor.EV3ColorSensor; import lejos.hardware.port.Port; import lejos.hardware.Brick; import lejos.hardware.BrickFinder; import lejos.robotics.SampleProvider; public class idiRallyMartin{ public static void main(String[] arg) throws Exception { // Definerer sensorer: Brick brick = BrickFinder.getDefault(); Port s1 = brick.getPort("S1"); // fargesensor Port s2 = brick.getPort("S2"); // trykksensor EV3ColorSensor fargesensor = new EV3ColorSensor(s1); // ev3-fargesensor SampleProvider fargeLeser = fargesensor.getMode("RGB"); // svart = 0.01.. float[] fargeSample = new float[fargeLeser.sampleSize()]; // tabell som innholder avlest verdi /* Definerer en trykksensor */ SampleProvider trykksensor = new EV3TouchSensor(s2); float[] trykkSample = new float[trykksensor.sampleSize()]; // tabell som inneholder avlest verdi // Setter hastighet på roboten Motor.A.setSpeed(400); Motor.C.setSpeed(400); // Beregn verdi for svart int svart = 0; for (int i = 0; i<100; i++){ fargeLeser.fetchSample(fargeSample, 0); svart += fargeSample[0]* 100; } svart = svart / 100 + 5; System.out.println("Klar, ferdig, gå"); boolean fortsett = true; while (fortsett){ trykksensor.fetchSample(trykkSample, 0); if (trykkSample[0] > 0){ System.out.println("Avslutter"); fortsett = false; } while(fargeSample[0]*100 <= svart){ Motor.A.forward(); Motor.C.forward(); System.out.println("svart, kjører"); fargeLeser.fetchSample(fargeSample, 0); } fargeLeser.fetchSample(fargeSample, 0); //fanger farge while(fargeSample[0]*100 > svart){ //så lenge fargen ikke er sort, sving og se etter sort farge Motor.A.stop(true); Motor.C.forward(); Thread.sleep(300); System.out.println("hvit, svinger til høyre"); fargeLeser.fetchSample(fargeSample, 0); //les inn ny verdi Motor.C.stop(true); Motor.A.forward(); Thread.sleep(600); System.out.println("hvit, svinger til venstre"); fargeLeser.fetchSample(fargeSample, 0); //les inn ny verdi } } } }
c81a5cf17c31f785d6fde4b89c0359e00b7376f6
995f73d30450a6dce6bc7145d89344b4ad6e0622
/Honor5C-7.0/src/main/java/sun/nio/ch/IOVecWrapper.java
7ce346494416e28ddad94ffe64cee8801ff2d605
[]
no_license
morningblu/HWFramework
0ceb02cbe42585d0169d9b6c4964a41b436039f5
672bb34094b8780806a10ba9b1d21036fd808b8e
refs/heads/master
2023-07-29T05:26:14.603817
2021-09-03T05:23:34
2021-09-03T05:23:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,150
java
package sun.nio.ch; import java.nio.ByteBuffer; import sun.misc.Cleaner; class IOVecWrapper { private static final int BASE_OFFSET = 0; private static final int LEN_OFFSET = 0; private static final int SIZE_IOVEC = 0; static int addressSize; private static final ThreadLocal<IOVecWrapper> cached = null; final long address; private final ByteBuffer[] buf; private final int[] position; private final int[] remaining; private final ByteBuffer[] shadow; private final int size; private final AllocatedNativeObject vecArray; private static class Deallocator implements Runnable { private final AllocatedNativeObject obj; Deallocator(AllocatedNativeObject obj) { this.obj = obj; } public void run() { this.obj.free(); } } static { /* JADX: method processing error */ /* Error: jadx.core.utils.exceptions.DecodeException: Load method exception in method: sun.nio.ch.IOVecWrapper.<clinit>():void at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:113) at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:256) at jadx.core.ProcessClass.process(ProcessClass.java:34) at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:281) at jadx.api.JavaClass.decompile(JavaClass.java:59) at jadx.api.JadxDecompiler$1.run(JadxDecompiler.java:161) Caused by: jadx.core.utils.exceptions.DecodeException: in method: sun.nio.ch.IOVecWrapper.<clinit>():void at jadx.core.dex.instructions.InsnDecoder.decodeInsns(InsnDecoder.java:46) at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:98) ... 5 more Caused by: java.lang.IllegalArgumentException: bogus opcode: 00e9 at com.android.dx.io.OpcodeInfo.get(OpcodeInfo.java:1197) at com.android.dx.io.OpcodeInfo.getFormat(OpcodeInfo.java:1212) at com.android.dx.io.instructions.DecodedInstruction.decode(DecodedInstruction.java:72) at jadx.core.dex.instructions.InsnDecoder.decodeInsns(InsnDecoder.java:43) ... 6 more */ /* // Can't load method instructions. */ throw new UnsupportedOperationException("Method not decompiled: sun.nio.ch.IOVecWrapper.<clinit>():void"); } private IOVecWrapper(int size) { this.size = size; this.buf = new ByteBuffer[size]; this.position = new int[size]; this.remaining = new int[size]; this.shadow = new ByteBuffer[size]; this.vecArray = new AllocatedNativeObject(SIZE_IOVEC * size, false); this.address = this.vecArray.address(); } static IOVecWrapper get(int size) { IOVecWrapper wrapper = (IOVecWrapper) cached.get(); if (wrapper != null && wrapper.size < size) { wrapper.vecArray.free(); wrapper = null; } if (wrapper != null) { return wrapper; } wrapper = new IOVecWrapper(size); Cleaner.create(wrapper, new Deallocator(wrapper.vecArray)); cached.set(wrapper); return wrapper; } void setBuffer(int i, ByteBuffer buf, int pos, int rem) { this.buf[i] = buf; this.position[i] = pos; this.remaining[i] = rem; } void setShadow(int i, ByteBuffer buf) { this.shadow[i] = buf; } ByteBuffer getBuffer(int i) { return this.buf[i]; } int getPosition(int i) { return this.position[i]; } int getRemaining(int i) { return this.remaining[i]; } ByteBuffer getShadow(int i) { return this.shadow[i]; } void clearRefs(int i) { this.buf[i] = null; this.shadow[i] = null; } void putBase(int i, long base) { int offset = (SIZE_IOVEC * i) + 0; if (addressSize == 4) { this.vecArray.putInt(offset, (int) base); } else { this.vecArray.putLong(offset, base); } } void putLen(int i, long len) { int offset = (SIZE_IOVEC * i) + LEN_OFFSET; if (addressSize == 4) { this.vecArray.putInt(offset, (int) len); } else { this.vecArray.putLong(offset, len); } } }
905952092b3a4f367bae95b93f5172bfc2473880
3248fd584afbec2a8e1d2c1405b10466238492db
/TeteRisk/src/mhs/eclipse/teterisk/Board.java
6cbbb12359ce4fa8a51938f8885d1b1b66d949ae
[]
no_license
EpistemikJava/mhs
6f59064933493e266228ae32ad0b5d09d6fe4c90
30fa062950e5a8ad74bf34c24942f03ef45716c6
refs/heads/master
2020-03-21T11:14:58.244190
2019-01-04T21:02:50
2019-01-04T21:02:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
20,429
java
/* *************************************************************************************** Mark Sattolo ([email protected]) ----------------------------------------------- mhs.eclipse.teterisk.Board.java Eclipse version created Jan 6, 2012 git version created Apr 26, 2014 This work is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This work is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Copyright (c) 2012-14 Mark Sattolo. All rights reserved. ***************************************************************************************** */ package mhs.eclipse.teterisk; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.Image; import java.awt.Insets; import java.awt.Rectangle; import java.util.Hashtable; import javax.swing.JPanel; /** * A rectangular Tetris board containing a grid of colored squares.<br> * The board is constrained on both sides and at the bottom. * There is no constraint at the top of the board, * although colors assigned to positions above the board are not saved. * * @version 1.1 * @author Mark Sattolo - based on code by <a href="mailto:[email protected]">Per Cederberg</a> */ class Board extends JPanel { /** * Create a new board with the specified size, initially empty. * * @param wd - the width of the board (in squares) * @param ht - the height of the board (in squares) * @param dbg - enable debug mode */ public Board( int wd, int ht, boolean dbg ) { debugMode = dbg ; width = wd ; height = ht ; brdInsets = new Insets( 0, 0, 0, 0 ); matrix = new Color[ ht ][ wd ]; sqrSize = new Dimension( 0, 0 ); bufferRect = new Rectangle(); updateRect = new Rectangle(); lighterColors = new Hashtable<>(); darkerColors = new Hashtable<>(); clear(); }// CONSTRUCTOR /* * M E T H O D S * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /** Set the background and message color. */ void init() { // black background setBackground( Configuration.getColor( "board.background", "#000000" ) ); // red messages messageColor = Configuration.getColor( "board.message", "#ff1111" ); }// init() /** * Check if a specified square is empty, i.e. it is not marked with a color.<br> * If the square is outside the board, false will be returned in all cases except * when the square is directly above the board. * * @param horz - the horizontal position (0 <= x < width) * @param vert - the vertical position (0 <= y < height) * * @return true if the square is empty, false otherwise */ boolean isSquareEmpty( int horz, int vert ) { if( horz < 0 || horz >= width || vert < 0 || vert >= height ) { return horz >= 0 && horz < width && vert < 0 ; } return matrix[vert][horz] == null ; } /** * Check if a specified line is empty, i.e. only contains empty squares.<br> * If the line is outside the board, false will always be returned. * * @param vert - the vertical position (0 <= y < height) * * @return true if the whole line is empty, false otherwise */ boolean isLineEmpty( int vert ) { if( vert < 0 || vert >= height ) { return false ; } for( int x = 0 ; x < width ; x++ ) { if( matrix[vert][x] != null ) { return false ; } } return true ; } /** * Check if a specified line is full, i.e. contains no empty squares.<br> * If the line is outside the board, true will always be returned. * * @param vert - the vertical position (0 <= y < height) * * @return true if the whole line is full, false otherwise */ boolean isLineFull( int vert ) { if( vert < 0 || vert >= height ) { return true ; } for( int x = 0 ; x < width ; x++ ) { if( matrix[vert][x] == null ) { return false ; } } return true ; } /** * @return true if there are full lines on the board, false otherwise */ boolean hasFullLines() { for( int y = height - 1 ; y >= 0 ; y-- ) { if( isLineFull( y ) ) { return true ; } } return false ; } /** * @return the board height in squares */ int getBoardHeight() { return height ;} /** * @return the board width in squares */ int getBoardWidth() { return width ;} /** * @return the number of lines removed since the last clear call */ int getRemovedLines() { return removedLines ;} /** * Return the color of an individual square on the board.<br> * If the square is empty or outside the board, null will be returned. * * @param horz - the horizontal position (0 <= x < width) * @param vert - the vertical position (0 <= y < height) * * @return the square color, or null for none */ Color getSquareColor( int horz, int vert ) { if( horz < 0 || horz >= width || vert < 0 || vert >= height ) { return null ; } return matrix[vert][horz]; } /** * Change the color of an individual square on the board.<br> * The square will be marked as in need of a repaint, * but the graphical component will NOT be repainted until {@link #update()} is called. * * @param horz - the horizontal position (0 <= x < width) * @param vert - the vertical position (0 <= y < height) * @param clr - the new square color, or null for empty */ void setSquareColor( int horz, int vert, Color clr ) { if( horz < 0 || horz >= width || vert < 0 || vert >= height ) { return ; } matrix[vert][horz] = clr ; invalidateSquare( horz, vert ); } /** * Set a message to display on the square board.<br> * <b>This should ONLY be used when the board is NOT being used for active drawing, * as it slows down the drawing considerably.</b> * * @param msg - a message to display, or null to remove a previous message */ void setMessage( String msg ) { message = msg ; redrawAll(); } /** * Clear the board, i.e. removes all the colored squares.<br> * Also, the number of removed lines will be reset to zero, and the component will be repainted. */ void clear() { removedLines = 0 ; for( int y = 0 ; y < height ; y++ ) { for( int x = 0 ; x < width ; x++ ) { this.matrix[y][x] = null ; } } redrawAll(); }// clear() /** * Remove all full lines. All lines above a removed line will be moved down one step, * and a new empty line will be added at the top. After removing all full lines, the component will be repainted. * * @return number of lines removed * * @see #hasFullLines() */ int removeFullLines() { boolean repaint = false ; int base = removedLines ; // remove full lines for( int y=height-1; y >= 0 ; y-- ) { if( isLineFull(y) ) { removeLine( y ); removedLines++ ; y++ ; repaint = true ; } } // repaint if necessary if( repaint ) { redrawAll(); } int result = removedLines - base ; if( debugMode ) System.out.println( "Removed " + result + " lines." ); return result ; }// removeFullLines() /** * Remove a single line. All lines above are moved down one step, and a new empty line * is added at the top. No repainting will be done after removing the line. * * @param vert - the vertical position (0 <= y < height) */ private void removeLine( int vert ) { int y = vert; if( y < 0 || y >= height ) { return ; } int x ; for( ; y > 0 ; y-- ) { for( x = 0 ; x < width ; x++ ) { matrix[y][x] = matrix[y - 1][x]; } } for( x = 0 ; x < width ; x++ ) { matrix[0][x] = null ; } }// removeLine() /** * Updates the graphical component.<br> * Any squares previously changed will be repainted by this method. */ void update() { redraw(); } /** * @return true as this component is double buffered */ public boolean isDoubleBuffered() { return true ;} /** * @return the preferred size of this component */ public Dimension getPreferredSize() { return new Dimension( width * SQUARE_SIDE_LENGTH_PX, height * SQUARE_SIDE_LENGTH_PX ); } /** * @return the minimum size of this component */ public Dimension getMinimumSize() { return getPreferredSize(); } /** * @return the maximum size of this component */ public Dimension getMaximumSize() { return getPreferredSize(); } /* * G R A P H I C S * * = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ /** * Add a square to the set of squares in need of redrawing. * * @param horz - the horizontal position (0 <= x < width) * @param vert - the vertical position (0 <= y < height) */ private void invalidateSquare( int horz, int vert ) { if( updated ) { updated = false ; updateRect.x = horz ; updateRect.y = vert ; updateRect.width = 0 ; updateRect.height = 0 ; } else { if( horz < updateRect.x ) { updateRect.width += updateRect.x - horz ; updateRect.x = horz ; } else if( horz > updateRect.x + updateRect.width ) { updateRect.width = horz - updateRect.x; } if( vert < updateRect.y ) { updateRect.height += updateRect.y - vert ; updateRect.y = vert ; } else if( vert > updateRect.y + updateRect.height ) { updateRect.height = vert - updateRect.y; } } } /** * Redraw all invalid squares.<br> * If no squares have been marked as in need of redrawing, no redrawing will occur. */ private void redraw() { Graphics page ; if( !updated ) { updated = true ; page = getGraphics(); if( page == null ) return ; page.setClip( brdInsets.left + updateRect.x * sqrSize.width, brdInsets.top + updateRect.y * sqrSize.height, (updateRect.width + 1) * sqrSize.width, (updateRect.height + 1) * sqrSize.height ); paint( page ); } } /** Redraw the whole component */ private void redrawAll() { updated = true ; Graphics page = getGraphics(); if( page == null ) return ; page.setClip( brdInsets.left, brdInsets.top, width * sqrSize.width, height * sqrSize.height ); paint( page ); } /** * Returns a lighter version of the specified color.<br> * The lighter color will looked up in a hashtable, making this method fast. * If the color is not found, the lighter color will be calculated and added to the lookup table for later reference. * * @param clr - the base color * * @return the lighter version of the color */ private Color getLighterColor( Color clr ) { Color $lighter ; $lighter = lighterColors.get( clr ); if( $lighter == null ) { $lighter = clr.brighter().brighter(); lighterColors.put( clr, $lighter ); } return $lighter ; } /** * Returns a darker version of the specified color.<br> * The darker color will looked up in a hashtable, making this method fast. * If the color is not found, the darker color will be calculated and added to the lookup table for later reference. * * @param clr - the base color * * @return the darker version of the color */ private Color getDarkerColor( Color clr ) { Color $darker ; $darker = darkerColors.get( clr ); if( $darker == null ) { $darker = clr.darker().darker(); darkerColors.put( clr, $darker ); } return $darker ; } /** * Paints this component indirectly.<br> * The painting is first done to a buffer image, that is then painted directly to the specified graphics context. * * @param page - the graphics context to use */ public synchronized void paint( Graphics page ) { Graphics $bufferPage ; Rectangle $rect ; // handle component size change if( brdSize == null || !brdSize.equals( getSize() ) ) { brdSize = getSize(); sqrSize.width = brdSize.width / width ; sqrSize.height = brdSize.height / height ; if( sqrSize.width <= sqrSize.height ) { sqrSize.height = sqrSize.width ; } else { sqrSize.width = sqrSize.height ; } brdInsets.left = ( brdSize.width - width * sqrSize.width ) / 2 ; brdInsets.right = brdInsets.left; brdInsets.top = 0 ; brdInsets.bottom = brdSize.height - height * sqrSize.height ; bufferImage = createImage( width * sqrSize.width, height * sqrSize.height ); } // paint component in buffer image $rect = page.getClipBounds(); $bufferPage = bufferImage.getGraphics(); $bufferPage.setClip( $rect.x - brdInsets.left, $rect.y - brdInsets.top, $rect.width, $rect.height ); paintComponent( $bufferPage ); // paint image buffer page.drawImage( bufferImage, brdInsets.left, brdInsets.top, getBackground(), null ); }// paint() /** * Paints this component directly.<br> * All the squares on the board will be painted directly to the specified graphics context. * * @param page - the graphics context to use */ protected void paintComponent( Graphics page ) { // paint background page.setColor( getBackground() ); page.fillRect( 0, 0, width * sqrSize.width, height * sqrSize.height ); // paint squares for( int y=0; y < height ; y++ ) { for( int x=0; x < width ; x++ ) { if( matrix[y][x] != null ) { paintSquare( page, x, y ); } } } // paint message if( message != null ) { paintMessage( page, message ); } }// paintComponent() /** * Paints a single board square. The specified position must contain a color object. * * @param page - the graphics context to use * @param horz - the horizontal position (0 <= x < width) * @param vert - the vertical position (0 <= y < height) */ private void paintSquare( Graphics page, int horz, int vert ) { Color $color = matrix[vert][horz]; int $xMin = horz * sqrSize.width ; int $yMin = vert * sqrSize.height ; int $xMax = $xMin + sqrSize.width - 1 ; int $yMax = $yMin + sqrSize.height - 1 ; int i ; // skip drawing if not visible bufferRect.x = $xMin ; bufferRect.y = $yMin ; bufferRect.width = sqrSize.width ; bufferRect.height = sqrSize.height ; if( !bufferRect.intersects(page.getClipBounds()) ) { return; } // fill with base color page.setColor( $color ); page.fillRect( $xMin, $yMin, sqrSize.width, sqrSize.height ); // draw brighter lines page.setColor( getLighterColor( $color ) ); for( i=0 ; i < sqrSize.width/10 ; i++ ) { page.drawLine( $xMin + i, $yMin + i, $xMax - i, $yMin + i ); page.drawLine( $xMin + i, $yMin + i, $xMin + i, $yMax - i ); } // draw darker lines page.setColor( getDarkerColor( $color ) ); for( i=0 ; i < sqrSize.width/10 ; i++ ) { page.drawLine( $xMax - i, $yMin + i, $xMax - i, $yMax - i ); page.drawLine( $xMin + i, $yMax - i, $xMax - i, $yMax - i ); } }// paintSquare() /** * Paints a board message. The message will be drawn at the center of the component. * * @param page - the graphics context to use * @param msg - the string message */ private void paintMessage( Graphics page, String msg ) { int $fontWidth ; int $offset ; int x, y ; // find string font width page.setFont( new Font("SansSerif", Font.BOLD, sqrSize.width + 4) ); $fontWidth = page.getFontMetrics().stringWidth( msg ); // find centered position x = ( width * sqrSize.width - $fontWidth ) / 2 ; y = height * sqrSize.height / 2 ; // draw black outline for the message $offset = sqrSize.width / 10 ; page.setColor( Color.black ); page.drawString( msg, x - $offset, y - $offset ); page.drawString( msg, x - $offset, y ); page.drawString( msg, x - $offset, y + $offset ); page.drawString( msg, x , y - $offset ); page.drawString( msg, x , y + $offset ); page.drawString( msg, x + $offset, y - $offset ); page.drawString( msg, x + $offset, y ); page.drawString( msg, x + $offset, y + $offset ); // display the message page.setColor( messageColor ); page.drawString( msg, x, y ); }// paintMessage() /* * F I E L D S * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /** default side length */ static final int SQUARE_SIDE_LENGTH_PX = 30 ; /** Enable or disable debug actions. */ boolean debugMode ; /** The board width (in squares) */ int width = 0 ; /** The board height (in squares) */ int height = 0 ; /** * The board color matrix. This matrix (or grid) contains a color entry for each square * in the board. The matrix is indexed by the vertical, and then the horizontal coordinate. */ private Color[][] matrix ; /** * An optional board message.<br> * The board message can be set at any time, printing it on top of the board. */ private String message ; /** * The number of lines removed.<br> * This counter is increased each time a line is removed from the board. */ private int removedLines = 0 ; /** * The component size. If the component has been resized, that will be detected when the * paint method executes. If this value is set to null, the component dimensions are unknown. */ private Dimension brdSize ; /** * The component's {@link java.awt.Insets}. * The Insets values are used to create a border around the board to compensate for a skewed aspect ratio. * If the component has been resized, the Insets values will be recalculated when the paint method executes. */ private Insets brdInsets ; /** * The square size in pixels. This value is updated when the component's size is * changed, i.e. when the {@link #brdSize} variable is modified. */ private Dimension sqrSize ; /** * An image used for double buffering. The board is first painted onto this image, and * that image is then painted onto the real surface in order to avoid making the drawing * process visible to the user. This image is recreated each time the component size changes. */ private Image bufferImage ; /** * A clip boundary buffer rectangle. This rectangle is used when calculating the clip * boundaries, in order to avoid allocating a new clip rectangle for each board square. */ private Rectangle bufferRect ; /** The board message color */ private Color messageColor ; /** * A lookup table containing lighter versions of the colors.<br> * This table is used to avoid calculating the lighter versions of the colors for each and every square drawn. */ private Hashtable<Color,Color> lighterColors ; /** * A lookup table containing darker versions of the colors.<br> * This table is used to avoid calculating the darker versions of the colors for each and every square drawn. */ private Hashtable<Color,Color> darkerColors ; /** A flag set when the component has been updated */ private boolean updated = true ; /** * A bounding box of the squares to update. The coordinates used in the rectangle refers to the square matrix. */ private Rectangle updateRect ; /** generated */ static final long serialVersionUID = 145079248878994429L ; }// class Board
7040721b6985625ace7fa69f516c79f29e85bde1
024a60c0ff7c9e67320fbd9c9452ee507f61f0fd
/Built Project/jp1705project/src/j2se/MS1.java
3150bedfcad9b9e1404627316cdb0a7de8c6ab2b
[]
no_license
TrongHue/JP_TrongHue
ee888b585fcab2ebf4d9cbbdefe815592698cb2c
2c5ec5a8aae845220651a6f7ede4a809ecf0339c
refs/heads/master
2020-03-15T12:36:58.658176
2018-05-04T14:11:35
2018-05-04T14:11:35
132,148,084
0
0
null
null
null
null
UTF-8
Java
false
false
136
java
package j2se; public interface MS1 extends EXE { public int getDetail(Person p); public int getDetailOfList(Person similar); }
3e8c40f440970d3227af19c54f5558318d27f91d
87b6db7f30ac15fd3cdcfb75df12d8885c3c36c0
/dic/src/com/kmboot/ws/Definition.java
22db59cfe229bb4d9bc8aa7c1dfd1aa5b7b9ff88
[]
no_license
meadlai/english-tool
0b73df6ee9c64a8f7cdaa883ab6aa1e50c9ca93b
339867d1c823da001832862d7ad3ef0a9aee1c42
refs/heads/master
2023-02-24T05:06:20.458638
2023-02-14T01:59:46
2023-02-14T01:59:46
165,672,766
0
0
null
2021-06-15T15:59:51
2019-01-14T14:10:21
Java
UTF-8
Java
false
false
2,904
java
package com.kmboot.ws; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for Definition complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="Definition"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="Word" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="Dictionary" type="{http://services.aonaware.com/webservices/}Dictionary" minOccurs="0"/> * &lt;element name="WordDefinition" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Definition", propOrder = { "word", "dictionary", "wordDefinition" }) public class Definition { @XmlElement(name = "Word") protected String word; @XmlElement(name = "Dictionary") protected Dictionary dictionary; @XmlElement(name = "WordDefinition") protected String wordDefinition; /** * Gets the value of the word property. * * @return * possible object is * {@link String } * */ public String getWord() { return word; } /** * Sets the value of the word property. * * @param value * allowed object is * {@link String } * */ public void setWord(String value) { this.word = value; } /** * Gets the value of the dictionary property. * * @return * possible object is * {@link Dictionary } * */ public Dictionary getDictionary() { return dictionary; } /** * Sets the value of the dictionary property. * * @param value * allowed object is * {@link Dictionary } * */ public void setDictionary(Dictionary value) { this.dictionary = value; } /** * Gets the value of the wordDefinition property. * * @return * possible object is * {@link String } * */ public String getWordDefinition() { return wordDefinition; } /** * Sets the value of the wordDefinition property. * * @param value * allowed object is * {@link String } * */ public void setWordDefinition(String value) { this.wordDefinition = value; } }
fc16ed4b3fcf0a4702844d4e5b5dd07d9283cf94
0ba34c4a77b8994cffd3436240cd9a52751bf157
/image/image-processing/src/main/java/org/openimaj/image/processing/resize/filters/BlackmanFilter.java
b059b9405a5821ba797e27fa2dcc0395a82665cd
[ "BSD-3-Clause" ]
permissive
openimaj/openimaj
6df226a8a14d9a59aa5c9d2738c04fd1cdb379d8
545969f7a99c13bb5bd02c0a30f55013e4abca72
refs/heads/master
2023-08-01T20:38:57.916507
2022-02-09T09:57:12
2022-02-09T09:57:12
31,323,673
350
149
NOASSERTION
2023-06-14T22:29:01
2015-02-25T16:37:24
Java
UTF-8
Java
false
false
2,656
java
/** * Copyright (c) 2011, The University of Southampton and the individual contributors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * * Neither the name of the University of Southampton nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.openimaj.image.processing.resize.filters; import org.openimaj.citation.annotation.Reference; import org.openimaj.citation.annotation.ReferenceType; import org.openimaj.image.processing.resize.ResizeFilterFunction; /** * Blackman window function interpolation filter for the resample function * * @author Jonathon Hare ([email protected]) * */ @Reference( author = { "R. B. Blackman", "J. W. Tukey" }, title = "Particular Pairs of Windows", type = ReferenceType.Inbook, year = "1959", booktitle = " In The Measurement of Power Spectra, From the Point of View of Communications Engineering", publisher = "Dover", pages = { "98", "99" }) public class BlackmanFilter implements ResizeFilterFunction { private static double blackman(final double t) { return 0.42 + 0.50 * Math.cos(Math.PI * t) + 0.08 * Math.cos(2.0 * Math.PI * t); } @Override public final double filter(final double t) { return blackman(t); } @Override public final double getSupport() { return 1.0; } }
951787721b32b55722eec06fddcf253e651c2fbf
3a2ca5dc19ee37d5286db0040a67468d9a27fbbc
/app/src/main/java/com/example/jetpackmasterclass/views/DogClickListener.java
d4ddd1db58648a887cb45543c058139a9f240784
[]
no_license
stYassine/Android-JetPack-Architecture
237167e09d0aa1a270ef0e57306bcfad6c57cb25
95705e6c4be482ee482c130d21fab270edf965fe
refs/heads/main
2023-03-13T22:37:45.696463
2021-03-08T19:29:30
2021-03-08T19:29:30
345,769,826
0
0
null
null
null
null
UTF-8
Java
false
false
153
java
package com.example.jetpackmasterclass.views; import android.view.View; public interface DogClickListener { public void onDogClicked(View view); }
bceb28cdcde4cc32592f88d3d959d6522d6fe650
c41fa007d669e4a081a04b197e507d2a46f20e14
/app/src/main/java/com/example/wallet10/Transaction.java
db816ddb41be98aae531e9bffcdd48febf481577
[]
no_license
hassan74-98/Java-E-Wallet-
9d251202dd73862c6482b3efff8e7a732529d84f
e895a27e08291e724d87b772eb0faa4417ab90ac
refs/heads/main
2023-02-12T21:41:31.387700
2021-01-23T00:59:09
2021-01-23T00:59:09
330,791,881
0
0
null
null
null
null
UTF-8
Java
false
false
14,612
java
package com.example.wallet10; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Typeface; import android.os.Build; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; 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.zxing.integration.android.IntentIntegrator; import com.google.zxing.integration.android.IntentResult; import org.json.JSONException; import org.json.JSONObject; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; public class Transaction extends AppCompatActivity implements View.OnClickListener { private ListView listView; private IntentIntegrator qrScan; private Button PAY,RECEIVE,TRANSACTION; final Context context = this; private TextView balance; private String ownPhone, transactionAmount; // initiate firebase // User -> phone number private FirebaseAuth firebaseAuth; DatabaseReference mRootRef = FirebaseDatabase.getInstance().getReference(); DatabaseReference mUser = mRootRef.child("User"); DatabaseReference mPhoneNo = mUser.child("Phone Number"); private static final String TAG = "track Phone"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_transaction); //initiate the firebase firebaseAuth = FirebaseAuth.getInstance(); //check if user sign out if(firebaseAuth.getCurrentUser() == null){ finish(); startActivity(new Intent(this, SignIn.class)); } // get the phone of current user FirebaseUser user = firebaseAuth.getCurrentUser(); String email = user.getEmail(); String [] parts = email.split("@"); ownPhone = parts[0]; /*mPhoneNo.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if(!(dataSnapshot.hasChild(ownPhone))){ firebaseAuth.signOut(); finish(); startActivity(new Intent(getApplicationContext(), LogInAndReg.class)); } } @Override public void onCancelled(DatabaseError databaseError) { } });*/ // get the database reference of current user DatabaseReference mCurrentUser = mPhoneNo.child(ownPhone); DatabaseReference mFirstName = mCurrentUser.child("firstName"); DatabaseReference mBalance = mCurrentUser.child("balanceAmount"); balance = (TextView)findViewById(R.id.balance); /* font */ TextView balanceText = (TextView)findViewById(R.id.balance); final TextView tranUserNameText = (TextView)findViewById(R.id.tranUserName); /* listeners */ RECEIVE = (Button) findViewById(R.id.receive); RECEIVE.setOnClickListener(this); PAY = (Button) findViewById(R.id.pay); PAY.setOnClickListener(this); TRANSACTION = (Button) findViewById(R.id.transaction); TRANSACTION.setOnClickListener(this); Button signOutButton = (Button) findViewById(R.id.signOutButton); signOutButton.setOnClickListener(this); qrScan = new IntentIntegrator(this); //retrieve the Name of User from database in realtime mFirstName.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { String tvfirstName = dataSnapshot.getValue(String.class); Log.i(TAG,tvfirstName); tranUserNameText.setText(tvfirstName); } @Override public void onCancelled(DatabaseError databaseError) { //Toast.makeText(Transaction.this, "Cannot find your name",Toast.LENGTH_SHORT).show(); } }); //retrieve the balance from database in realtime mBalance.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { String tvBalance = dataSnapshot.getValue(String.class); int oldBalance = Integer.parseInt(tvBalance); int inte = oldBalance/100; int deci = oldBalance%100; if(deci < 10){ String newBalance = inte + "." + "0" + deci; balance.setText(newBalance); } else{ String newBalance = inte + "." + deci; balance.setText(newBalance); } } @Override public void onCancelled(DatabaseError databaseError) { //Toast.makeText(Transaction.this, "Cannot find your balance",Toast.LENGTH_SHORT).show(); } }); } @Override public void onBackPressed() { // do not allow android backward button } @Override public void onClick(View view) { if(view.getId() == R.id.signOutButton) { firebaseAuth.signOut(); //sign out finish(); Intent goBackLogIn = new Intent(this, LoginAndReg.class); startActivity(goBackLogIn); } if(view.getId() == R.id.receive){ Toast.makeText(Transaction.this,"aiiie", Toast.LENGTH_SHORT).show(); Intent goToPayReceive = new Intent(view.getContext(), payAndReceive.class); startActivity(goToPayReceive); } if(view.getId() == R.id.pay){ Toast.makeText(Transaction.this,"scan", Toast.LENGTH_SHORT).show(); qrScan.initiateScan(); } if(view.getId() == R.id.transaction){ Toast.makeText(Transaction.this,"transactions", Toast.LENGTH_SHORT).show(); Intent i = new Intent(Transaction.this,CheckTransactions.class); startActivity(i); } } //Getting the scan results @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); if (result != null) { //if qrcode has nothing in it if (result.getContents() == null) { Toast.makeText(this, "Transaction Incomplete", Toast.LENGTH_LONG).show(); } else { //if qr contains data try { //converting the data to json JSONObject obj = new JSONObject(result.getContents()); } catch (JSONException e) { e.printStackTrace(); //if control comes here //that means the encoded format not matches //in this case you can display whatever data is available on the qrcode //to a toast //Toast.makeText(this, result.getContents(), Toast.LENGTH_LONG).show(); String[] separatedMessage = result.getContents().split(" "); final String senderPhone = separatedMessage[0]; final String tranAmount = separatedMessage[1]; transactionAmount = tranAmount; //Log.i("The sender is", senderPhone); //Log.i("The amount is", tranAmount); if(tranAmount.contains(".")){ String[] separatedAmount = tranAmount.split("\\."); String inte = separatedAmount[0]; String deci = separatedAmount[1]; //Log.i("The amount is", inte); //Log.i("The amount is", deci); int integ = Integer.parseInt(inte); int decimal = Integer.parseInt(deci); if(deci.length() == 1){decimal = decimal * 10;} int total = integ*100 + decimal; Log.i("The amount is", total+""); transactBalance(ownPhone, senderPhone, total); } else{ int total = Integer.parseInt(tranAmount) * 100; transactBalance(ownPhone, senderPhone, total); } } } } else { super.onActivityResult(requestCode, resultCode, data); } } /** * Transfer Amount fromPhone -> toPhone * @param phoneToPay * @param phoneToReceive * @param Amount */ public void transactBalance(String phoneToPay, String phoneToReceive, final int Amount){ //get the database ref from fromPhone DatabaseReference mFromUser = mPhoneNo.child(phoneToPay); final DatabaseReference mFromBalance = mFromUser.child("balanceAmount"); //get the database ref from toPhone DatabaseReference mToUser = mPhoneNo.child(phoneToReceive); final DatabaseReference mToBalance = mToUser.child("balanceAmount"); final String sender = phoneToPay; final String receiver = phoneToReceive; mFromBalance.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { //retrieve the balance for fromPhone from database int fromBalance = Integer.parseInt(dataSnapshot.getValue(String.class)); if(sender.equals(receiver)){Toast.makeText(Transaction.this, "llayhdik aaa smitk",Toast.LENGTH_SHORT).show(); return;} if(fromBalance >= Amount) { // if enough money, deduct the value fromBalance = fromBalance - Amount; }else{ Toast.makeText(Transaction.this, "Not enough money",Toast.LENGTH_SHORT).show(); return; } final int fromBalanceCopy = fromBalance; //retrieve the balance for toPhone from database mToBalance.addListenerForSingleValueEvent(new ValueEventListener() { @RequiresApi(api = Build.VERSION_CODES.O) @Override public void onDataChange(DataSnapshot dataSnapshot) { int toBalance = Integer.parseInt(dataSnapshot.getValue(String.class)); toBalance = toBalance + Amount; //add value mFromBalance.setValue(fromBalanceCopy+""); //update the balance for both account to database mToBalance.setValue(toBalance + ""); //inform user transaction has been done AlertDialog.Builder resultBuilder = new AlertDialog.Builder(context); resultBuilder .setNeutralButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }) .setCancelable(true) .setTitle("Transaction Complete") .setMessage("You paid " + transactionAmount + " dirham(s)"); AlertDialog resultDialog = resultBuilder.create(); resultDialog.show(); //add the transaction to sender receiver and the firebase DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"); LocalDateTime now = LocalDateTime.now(); String date = dtf.format(now); String TransactionId = sender+receiver+transactionAmount+date; TransactionToFirebase PayT = new TransactionToFirebase(receiver,"- "+transactionAmount+" dh",date,0); TransactionToFirebase ReceiverT = new TransactionToFirebase(sender,"+ "+transactionAmount+" dh",date); TransactionToFirebase T = new TransactionToFirebase(sender,receiver,transactionAmount+" dh",date); try { mPhoneNo.child(sender).child("mes Transactions").child(hash(TransactionId)).setValue(PayT); mPhoneNo.child(receiver).child("mes Transactions").child(hash(TransactionId)).setValue(ReceiverT); mUser.child("les Transactions").child(hash(TransactionId)).setValue(T); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } } @Override public void onCancelled(DatabaseError databaseError) { } }); } @Override public void onCancelled(DatabaseError databaseError) { } }); } @RequiresApi(api = Build.VERSION_CODES.KITKAT) public String hash(String txt) throws NoSuchAlgorithmException { MessageDigest md = MessageDigest.getInstance("SHA-256"); byte[] hashInBytes = md.digest(txt.getBytes(StandardCharsets.UTF_8)); // bytes to hex StringBuilder sb = new StringBuilder(); for (byte b : hashInBytes) { sb.append(String.format("%02x", b)); } return sb.toString(); } }
1e3fb25b626a025c390e3e64d96744d215b61cb5
bdc078b4f9894ee26724511dbeda64c70715cba7
/com.ecomarce/src/main/java/com/ecomarceproject/com/ecomarce/listeners/Listener.java
2980e02846c01e02e4e2373d7ede7c24cb92821c
[]
no_license
akash-mule/slenium-project
1521676784dfb04256f339af1a0b08d8b99c5278
2c072d7b9e51457ea68a1cd68f56d01f19dea116
refs/heads/master
2020-04-18T11:05:30.142474
2019-01-25T10:07:40
2019-01-25T10:07:40
167,488,300
0
0
null
null
null
null
UTF-8
Java
false
false
2,214
java
package com.ecomarceproject.com.ecomarce.listeners; import java.io.File; import java.text.SimpleDateFormat; import java.util.Calendar; import org.apache.commons.io.FileUtils; import org.bouncycastle.util.Strings; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.testng.ITestContext; import org.testng.ITestListener; import org.testng.ITestResult; import org.testng.Reporter; import com.ecomarceproject.com.ecomarce.basepage.Basepagejava; import com.gargoylesoftware.htmlunit.javascript.host.html.Image; import freemarker.template.utility.DateUtil.CalendarFieldsToDateConverter; public class Listener extends Basepagejava implements ITestListener { public void onFinish(ITestContext arg0) { // TODO Auto-generated method stub } public void onStart(ITestContext arg0) { // TODO Auto-generated method stub } public void onTestFailedButWithinSuccessPercentage(ITestResult arg0) { // TODO Auto-generated method stub } public void onTestFailure(ITestResult arg0) { // TODO Auto-generated method stub } public void onTestSkipped(ITestResult arg0) { Reporter.log("Test is skipped:"+arg0.getMethod().getMethodName()); } public void onTestStart(ITestResult arg0) { Reporter.log("Test start Runing:"+arg0.getMethod().getMethodName()); } public void onTestSuccess(ITestResult arg0) { Reporter.log("Test is success"+arg0.getMethod().getMethodName()); Calendar cal=Calendar.getInstance(); SimpleDateFormat simpledate=new SimpleDateFormat("dd_MM_hh_mm_ss"); String methodname = arg0.getName(); if(arg0.isSuccess()){ File sourcepath=((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); String reportdirectory = (new File (System.getProperty("user.dir")).getAbsolutePath()+ "/src/main/java/com/ecomarce"); File targetpath = new File((String)reportdirectory+"/failedScreens/"+methodname+"" +simpledate.format(cal.getTime())+".png"); try { FileUtils.copyFile(sourcepath, targetpath); } catch (Exception e) { } Reporter.log("<a href='"+targetpath.getAbsolutePath()+"'>"+"<img src='" +targetpath.getAbsolutePath()+"'height='100'/></a>"); } } }
ae7b6ca8187b7afbd69eaf7acf9e6d4252446743
e5e656979dc089abf7856aedd60863a53b9726c0
/app/src/main/java/com/example/yiliaoyinian/ui/fragments1/fuwu/UnFinshFragment.java
fad573101954346df29409bc5cbf9bee031fb95a
[]
no_license
yoyo89757001/yinianhushizhongduan
885d173f957e83276a022723aa84556e7a90f9df
b8fed379393f99bcb5b43c1df7906bfa89a802e6
refs/heads/master
2023-01-24T14:52:29.517533
2020-11-28T09:09:06
2020-11-28T09:09:06
316,694,765
0
1
null
null
null
null
UTF-8
Java
false
false
10,032
java
package com.example.yiliaoyinian.ui.fragments1.fuwu; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.listener.OnItemClickListener; import com.example.yiliaoyinian.Beans.UnFinshBean; import com.example.yiliaoyinian.MyApplication; import com.example.yiliaoyinian.R; import com.example.yiliaoyinian.adapter.UnFinshAdapter; import com.example.yiliaoyinian.utils.AppManager; import com.example.yiliaoyinian.utils.Consts; import com.example.yiliaoyinian.utils.DialogManager; import com.example.yiliaoyinian.utils.GsonUtil; import com.example.yiliaoyinian.utils.ToastUtils; import com.google.gson.Gson; import com.google.gson.JsonObject; import com.qmuiteam.qmui.widget.dialog.QMUITipDialog; import com.scwang.smart.refresh.layout.SmartRefreshLayout; import com.scwang.smart.refresh.layout.api.RefreshLayout; import com.scwang.smart.refresh.layout.listener.OnRefreshListener; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.util.ArrayList; import java.util.List; import okhttp3.Call; import okhttp3.Callback; import okhttp3.Request; import okhttp3.Response; import okhttp3.ResponseBody; /** * A simple {@link Fragment} subclass. */ public class UnFinshFragment extends Fragment { private RecyclerView recyclerView; private UnFinshAdapter adapter; private List<UnFinshBean.ResultBean> taskBeanList=new ArrayList<>(); private SmartRefreshLayout refreshLayout; public UnFinshFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view=inflater.inflate(R.layout.fuwu_fragment_task, container, false); refreshLayout=view.findViewById(R.id.refreshLayout); EventBus.getDefault().register(this); recyclerView=view.findViewById(R.id.recyclerview); adapter=new UnFinshAdapter(R.layout.unfinsh_fragment1,taskBeanList); // 获取模块 // adapter.getLoadMoreModule(); adapter.getLoadMoreModule().setAutoLoadMore(false);//第一次不调用加载更多方法 adapter.getLoadMoreModule().setEnableLoadMoreIfNotFullPage(false);//加载完成不满一屏自动加载 LinearLayoutManager manager=new LinearLayoutManager(getActivity(),LinearLayoutManager.VERTICAL,false); recyclerView.setLayoutManager(manager); recyclerView.setAdapter(adapter); View view1= LayoutInflater.from(getActivity()).inflate(R.layout.anull_data,null); adapter.setEmptyView(view1); refreshLayout.setOnRefreshListener(new OnRefreshListener() { @Override public void onRefresh(@NotNull RefreshLayout refreshlayout) { link_getPendService(); } }); // 设置加载更多监听事件 // adapter.getLoadMoreModule().setOnLoadMoreListener(new OnLoadMoreListener() { // @Override // public void onLoadMore() { // //加载更多 // Log.d("Fragment1_1", "加载更多un"); // // 当前这次数据加载完毕,调用此方法 // // mAdapter.getLoadMoreModule().loadMoreComplete(); // // 当前这次数据加载错误,调用此方法 // // mAdapter.getLoadMoreModule().loadMoreFail(); // } // }); adapter.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) { Log.d("Fragment1_1", "position:" + position); Intent intent=new Intent(getActivity(),TaskInfoActivity.class); intent.putExtra("id",taskBeanList.get(position).getServiceId()); intent.putExtra("type",1);//未完成 intent.putExtra("title",taskBeanList.get(position).getItemName()); intent.putExtra("lasttime",taskBeanList.get(position).getLastTime()); intent.putExtra("name",taskBeanList.get(position).getPatientName()); startActivity(intent); } }); link_getPendService(); return view; } @Subscribe(threadMode = ThreadMode.MAIN) public void wxMSG(String msgWarp){ if (msgWarp.equals("UnFinshFragment")){ link_getPendService(); } } private Call call; private void link_getPendService() { Request.Builder requestBuilder = new Request.Builder() .header("token", MyApplication.myApplication.getToken()) .get() .url(Consts.URL+"/api/nurseService/getPendService"); // step 3:创建 Call 对象 call = MyApplication.okHttpClient.newCall(requestBuilder.build()); //step 4: 开始异步请求 call.enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { Log.d("AllConnects", "请求失败" + e.getMessage()+call.request().url()); if (getActivity()!=null){ ToastUtils.setMessage("网络请求失败",recyclerView); getActivity().runOnUiThread(new Runnable() { @Override public void run() { refreshLayout.finishRefresh(); } }); } } @Override public void onResponse(Call call, Response response) throws IOException { Log.d("AllConnects", "请求成功" + call.request().toString()); //获得返回体 try { ResponseBody body = response.body(); String ss = body.string().trim(); Log.d("LoginActivity", "未处理服务:"+ss); JsonObject jsonObject = GsonUtil.parse(ss).getAsJsonObject(); Gson gson = new Gson(); UnFinshBean logingBe = gson.fromJson(jsonObject, UnFinshBean.class); if (logingBe.isSuccess()){ if (logingBe.getCode()==1 && logingBe.getResult()!=null){ if (getActivity()!=null){ getActivity().runOnUiThread(new Runnable() { @Override public void run() { try { taskBeanList.clear(); taskBeanList.addAll(logingBe.getResult()); adapter.notifyDataSetChanged(); // adapter.getLoadMoreModule().loadMoreComplete(); //adapter.getLoadMoreModule().loadMoreEnd(true); }catch (Exception e){ e.printStackTrace(); } } }); } }else { if (getActivity()!=null) ToastUtils.setMessage(jsonObject.get("errorMsg").getAsString(),recyclerView); } }else { if (logingBe.getCode()==102){ Log.d("UnFinshFragment", "进来"); //token过期 DialogManager.getAppManager().showToken(); }else { if (getActivity()!=null) ToastUtils.setMessage(jsonObject.get("errorMsg").getAsString(),recyclerView); } } } catch (Exception e) { Log.d("AllConnects", e.getMessage() + "异常"); AppManager.getAppManager().currentActivity().runOnUiThread(new Runnable() { @Override public void run() { QMUITipDialog qmuiTipDialog2 = new QMUITipDialog.Builder(AppManager.getAppManager().currentActivity()) .setIconType(QMUITipDialog.Builder.ICON_TYPE_NOTHING) .setTipWord("后台数据异常") .create(); qmuiTipDialog2.show(); recyclerView.postDelayed(new Runnable() { @Override public void run() { qmuiTipDialog2.dismiss(); } }, 2500); } }); }finally { if (getActivity()!=null){ getActivity().runOnUiThread(new Runnable() { @Override public void run() { refreshLayout.finishRefresh(); } }); } } } }); } @Override public void onDestroyView() { EventBus.getDefault().unregister(this); super.onDestroyView(); } }
fbfee6acdb6e8ccbe4aebde7e76ca09f2c230bdb
010e52b2b6827d0a1e5ff8772d0f583a04be29c7
/src/main/java/cl/clillo/ilumination/model/Show.java
a898f3f2cf52aadcddc82fcb5c7f6105cee35d27
[]
no_license
clillo/iluminacion-server
764808b1e3722855e164e395f5b345190bfb9d59
737c68ab04abc54ba40d3533edc61f4b520a477d
refs/heads/master
2023-08-08T17:09:22.620498
2023-06-13T18:03:01
2023-06-13T18:03:01
328,425,439
0
0
null
null
null
null
UTF-8
Java
false
false
1,541
java
package cl.clillo.ilumination.model; import cl.clillo.ilumination.config.scenes.Scene; import cl.clillo.ilumination.executor.StepExecutor; import cl.clillo.ilumination.executor.TipoGatillador; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.util.List; import java.util.Objects; @Data @Builder @NoArgsConstructor @AllArgsConstructor public class Show { private static final long NEXT_EXECUTION_DEFAULT = 3000; private int id; private String name; @JsonIgnore private long nextExecutionTime; @JsonIgnore private boolean executing; @JsonIgnore private StepExecutor stepExecutor; @JsonIgnore private TipoGatillador tipoGatillador; @JsonIgnore private int pasoActual; @JsonIgnore private List<Step> stepList; private List<Scene> scenesLists; private boolean firstTimeExecution; public Step nextStep(){ pasoActual++; if (pasoActual >= stepList.size()) pasoActual = 0; final Step step = stepList.get(pasoActual); if (step.isNextExecution()) { nextExecutionTime = System.currentTimeMillis() + step.getNextExecutionTime(); }else { nextExecutionTime = System.currentTimeMillis() + NEXT_EXECUTION_DEFAULT; } return step; } public void setNextExec(){ nextExecutionTime = System.currentTimeMillis() + NEXT_EXECUTION_DEFAULT; } }
5450f68ae485d7b7af984de40bacb7df3a079163
cee1c64929a8a594d2599377b4645dbee3e7cad8
/src/sort/IndexHeap.java
4cd432e23ccf9fa4207505032fc83121f6bf23a7
[]
no_license
hecomlilong/Algorithms
9003de3b7c0ba8b4831e2781c2bcd75131aed8dc
deba38247e67342c2772c5126bdd94895841af1f
refs/heads/master
2020-04-16T14:17:42.200379
2017-05-28T23:39:31
2017-05-28T23:39:31
83,437,864
0
0
null
null
null
null
UTF-8
Java
false
false
102
java
package sort; /** * Created by bruce on 2017/5/24. */ public class IndexHeap extends SortBase { }
efca21308646f1cf434f9595fdc1d8e5c2cc7551
50713d4200d941397af66cf32182852a9608df5a
/app/src/androidTest/java/com/upday/shutterdemo/pickyup/MenuItemOpensEmailIntentTest.java
e21d0bd88ee027513c75a642820e1614678513e2
[ "MIT" ]
permissive
nuhkoca/pickyup-assessment
bc2a1e0b87605089c753e9ce042aa43cc39b69ef
6a13f91c94c8e68a62d4b2f7d726e4fc8ba3371e
refs/heads/master
2022-07-08T14:03:18.533980
2018-09-19T11:39:57
2018-09-19T11:39:57
139,788,156
0
1
null
2022-06-26T10:13:29
2018-07-05T03:02:50
Java
UTF-8
Java
false
false
2,946
java
package com.upday.shutterdemo.pickyup; import android.content.Context; import android.content.Intent; import android.support.test.espresso.UiController; import android.support.test.espresso.ViewAction; import android.support.test.espresso.intent.rule.IntentsTestRule; import android.support.test.runner.AndroidJUnit4; import android.view.View; import com.upday.shutterdemo.pickyup.ui.MainActivity; import org.hamcrest.Matcher; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import static android.support.test.InstrumentationRegistry.getInstrumentation; import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu; import static android.support.test.espresso.action.ViewActions.click; import static android.support.test.espresso.action.ViewActions.swipeLeft; import static android.support.test.espresso.intent.Intents.intending; import static android.support.test.espresso.intent.matcher.IntentMatchers.hasAction; import static android.support.test.espresso.intent.matcher.IntentMatchers.hasData; import static android.support.test.espresso.matcher.ViewMatchers.isRoot; import static android.support.test.espresso.matcher.ViewMatchers.withId; import static android.support.test.espresso.matcher.ViewMatchers.withText; import static org.hamcrest.core.AllOf.allOf; @RunWith(AndroidJUnit4.class) public class MenuItemOpensEmailIntentTest { @Rule public IntentsTestRule<MainActivity> intentsTestRule = new IntentsTestRule<>(MainActivity.class); private Context context = getInstrumentation().getTargetContext(); @SuppressWarnings({"unchecked", "ResultOfMethodCallIgnored"}) @Test public void menuItem_OpensAnActivity() { onView(withId(R.id.vpImages)).perform(swipeLeft()); onView(isRoot()).perform(waitFor(1500)); openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext()); onView(withText(R.string.report_title)).perform(click()); intending(chooser(allOf(hasAction(Intent.ACTION_SENDTO), hasData(context.getString(R.string.mail_address))))); } // Check chooser public Matcher<Intent> chooser(Matcher<Intent> matcher) { return allOf(hasAction(Intent.ACTION_CHOOSER), hasData(context.getString(R.string.mail_address)), matcher); } // Wait for the swipe public static ViewAction waitFor(final long millis) { return new ViewAction() { @Override public Matcher<View> getConstraints() { return isRoot(); } @Override public String getDescription() { return "Wait for " + millis + " milliseconds."; } @Override public void perform(UiController uiController, final View view) { uiController.loopMainThreadForAtLeast(millis); } }; } }
17f4e9cbab8bd453195d113b0b410201e24d76c0
ddb4544a85f791d6f7fa59332136efb62d6c65e8
/CS 329E Mobile Computing/APP PROJECT (catcells)/a7/edu/tommytyngutexas/catcells/QuitDialogFragment.java
e20f7fa798c4c3074328a33171c16dfd5fd4136c
[]
no_license
TommyTyng/CS_CLASSES
e8fb16894fb8993f56f153faef40b02b5ff43d1c
0090a852c9c6737df0446ba41fe3e71f6e5fb3df
refs/heads/master
2020-03-28T02:28:45.538257
2018-09-11T06:25:37
2018-09-11T06:25:37
147,573,007
0
0
null
null
null
null
UTF-8
Java
false
false
1,153
java
package edu.tommytyngutexas.catcells; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.content.DialogInterface; import android.os.Bundle; public class QuitDialogFragment extends DialogFragment { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the Builder class for convenient dialog construction AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.quit_question) .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { getActivity().finish(); dismiss(); } }) .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dismiss(); } }); // Create the AlertDialog object and return it return builder.create(); } }
13d416ad54c5743957112a62b1edda96f871c2f0
f2d2f8ceded9051c61bbdb9dcb89292a6d90530b
/kwok-app/src/main/com/kwoksys/action/admin/attribute/CustomAttributeEdit2Action.java
08e879eef5b57ad34d552a5912cb41db21503c5a
[]
no_license
roliannetropia/kwok
7becc6ee54f33fc84bf68a57d8ce340cf1809a66
8074b853b1b4c8d74dee71771b24fb56d5abbbb1
refs/heads/master
2016-09-06T15:36:58.750644
2015-03-15T23:51:28
2015-03-15T23:51:28
30,286,995
0
0
null
null
null
null
UTF-8
Java
false
false
2,614
java
/* * ==================================================================== * Copyright 2005-2011 Wai-Lun Kwok * * http://www.kwoksys.com/LICENSE * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ==================================================================== */ package com.kwoksys.action.admin.attribute; import com.kwoksys.biz.ServiceProvider; import com.kwoksys.biz.admin.AdminService; import com.kwoksys.biz.admin.dto.Attribute; import com.kwoksys.biz.system.core.AppPaths; import com.kwoksys.framework.http.RequestContext; import com.kwoksys.framework.struts2.Action2; import org.apache.struts.action.ActionMessages; /** * Action class for editing custom attribute. */ public class CustomAttributeEdit2Action extends Action2 { public String execute() throws Exception { CustomAttributeForm actionForm = saveActionForm(new CustomAttributeForm()); AdminService adminService = ServiceProvider.getAdminService(requestContext); // Make sure the object exists Attribute attr = adminService.getCustomAttribute(actionForm.getAttrId()); attr.setName(actionForm.getAttrName()); attr.setDescription(actionForm.getDescription()); attr.setType(actionForm.getAttrType()); attr.setAttributeOption(actionForm.getAttrOption()); attr.setConvertUrl(actionForm.getAttrConvertUrl()); attr.setUrl(actionForm.getAttrUrl()); attr.setAttributeGroupId(actionForm.getAttrGroupId()); attr.setInputMask(actionForm.getInputMask()); attr.setAttrFieldIds(actionForm.getSystemFieldIds()); attr.setTypeCurrencySymbol(actionForm.getCurrencySymbol()); ActionMessages errors = adminService.updateAttribute(attr); if (!errors.isEmpty()) { saveActionErrors(errors); return redirect(AppPaths.ADMIN_CUSTOM_ATTR_EDIT + "?objectTypeId=" + attr.getObjectTypeId() + "&attrId=" + attr.getId() + "&" + RequestContext.URL_PARAM_ERROR_TRUE); } else { return redirect(AppPaths.ADMIN_CUSTOM_ATTR_DETAIL + "?attrId=" + attr.getId()); } } }
69a52cd306853eb86816f7c4d7b3f4d7fb7f9444
b3ada262b16c73a5a66b4833f904d6681bdb1bf4
/core/src/main/java/com/flipkart/gjex/core/config/BaseConfigurationFactory.java
d79f3db2ceec7be1f15370e0641a4172e8804cee
[]
no_license
monishgandhi/grpc-jexpress
5e5e482f5fcf16e79ce8854a8c269c53174f9895
db41bf6ea58e237eaaae258e472917ff86a9544d
refs/heads/master
2020-05-16T02:34:38.159771
2019-03-20T09:51:42
2019-03-20T09:51:42
182,634,565
0
0
null
2020-01-07T12:55:19
2019-04-22T06:19:02
Java
UTF-8
Java
false
false
6,824
java
/* * Copyright (c) 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 com.flipkart.gjex.core.config; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.exc.InvalidFormatException; import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException; import com.fasterxml.jackson.databind.node.TreeTraversingParser; import com.flipkart.gjex.core.GJEXConfiguration; import javafx.util.Pair; import javax.validation.ConstraintViolation; import javax.validation.Validator; import java.io.IOException; import java.io.InputStream; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import static java.util.Objects.requireNonNull; /** * A generic factory class for loading configuration files, binding them to configuration objects, and * validating their constraints. * * @param <T> the type of the configuration object to produce * @param <U> Given configuration as a simple plain map */ public abstract class BaseConfigurationFactory<T extends GJEXConfiguration, U extends Map> implements ConfigurationFactory<T, U> { protected final Class<T> klass; protected final ObjectMapper objectMapper; private final Validator validator; protected final String formatName; private final JsonFactory parserFactory; /** * Creates a new configuration factory for the given class. * @param parserFactory the factory that creates the parser used * @param formatName the name of the format parsed by this factory (used in exceptions) * @param klass the configuration class * @param validator the validator to use */ public BaseConfigurationFactory(JsonFactory parserFactory, String formatName, Class<T> klass, Validator validator, ObjectMapper objectMapper) { this.klass = klass; this.formatName = formatName; this.objectMapper = objectMapper; this.parserFactory = parserFactory; this.validator = validator; } @Override public Pair<T, U> build(ConfigurationSourceProvider provider, String path) throws IOException, ConfigurationException { try (InputStream input = provider.open(requireNonNull(path))) { final JsonNode node = objectMapper.readTree(createParser(input)); if (node == null) { throw ConfigurationParsingException .builder("GJEXConfiguration at " + path + " must not be empty") .build(path); } return build(node, path); } catch (JsonParseException e) { throw ConfigurationParsingException .builder("Malformed " + formatName) .setCause(e) .setLocation(e.getLocation()) .setDetail(e.getMessage()) .build(path); } } protected JsonParser createParser(InputStream input) throws IOException { return parserFactory.createParser(input); } @Override public Pair<T, U> build() throws IOException, ConfigurationException { try { final JsonNode node = objectMapper.valueToTree(klass.newInstance()); return build(node, "Default configuration"); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | SecurityException e) { throw new IllegalArgumentException("Unable create an instance " + "of the configuration class: '" + klass.getCanonicalName() + "'", e); } } protected Pair<T, U> build(JsonNode node, String path) throws IOException, ConfigurationException { try { final T config = objectMapper.readValue(new TreeTraversingParser(node), klass); final U configMap = objectMapper.readValue(objectMapper.writeValueAsString(node), new TypeReference<U>() {}); validate(path, config); return new Pair<>(config, configMap); } catch (UnrecognizedPropertyException e) { final List<String> properties = e.getKnownPropertyIds().stream() .map(Object::toString) .collect(Collectors.toList()); throw ConfigurationParsingException.builder("Unrecognized field") .setFieldPath(e.getPath()) .setLocation(e.getLocation()) .addSuggestions(properties) .setSuggestionBase(e.getPropertyName()) .setCause(e) .build(path); } catch (InvalidFormatException e) { final String sourceType = e.getValue().getClass().getSimpleName(); final String targetType = e.getTargetType().getSimpleName(); throw ConfigurationParsingException.builder("Incorrect type of value") .setDetail("is of type: " + sourceType + ", expected: " + targetType) .setLocation(e.getLocation()) .setFieldPath(e.getPath()) .setCause(e) .build(path); } catch (JsonMappingException e) { throw ConfigurationParsingException.builder("Failed to parse configuration") .setDetail(e.getMessage()) .setFieldPath(e.getPath()) .setLocation(e.getLocation()) .setCause(e) .build(path); } } private void validate(String path, T config) throws ConfigurationValidationException { if (validator != null) { final Set<ConstraintViolation<T>> violations = validator.validate(config); if (!violations.isEmpty()) { throw new ConfigurationValidationException(path, violations); } } } }
d09e9d108bbfcde6db51108a8cc078c8909f23aa
139eba811e076293653d0ca70ac71860c3f2ed22
/src/java/acetyl/AceSocket.java
5a258b6040d0d9ff47ed5392d8e1e3062e7fcae0
[]
no_license
dasmoth/acetyl
9bf34631876966d79023e648365219a31a2791a7
ec01a65ad9ec5fc81726f21d92c9393f3d3e7aff
refs/heads/master
2016-09-05T21:18:05.027960
2015-08-06T15:26:44
2015-08-06T15:26:44
23,148,380
0
2
null
null
null
null
UTF-8
Java
false
false
6,654
java
/* * BioJava development code * * This code may be freely distributed and modified under the * terms of the GNU Lesser General Public Licence. This should * be distributed with the code. If you do not have a copy, * see: * * http://www.gnu.org/copyleft/lesser.html * * Copyright for this code is held jointly by the individual * authors. These should be listed in @author doc comments. * * For more information on the BioJava project and its aims, * or to join the biojava-l mailing list, visit the home page * at: * * http://www.biojava.org/ * */ package acetyl; import java.util.*; import java.io.*; import java.net.*; import java.security.*; /** * Low level interface to the ACeDB sockets server. * * @author Thomas Down */ public class AceSocket { private final static int OK_MAGIC = 0x12345678; private final static String MSGREQ = "ACESERV_MSGREQ"; private final static String MSGDATA = "ACESERV_MSGDATA"; private final static String MSGOK = "ACESERV_MSGOK"; private final static String MSGENCORE = "ACESERV_MSGENCORE"; private final static String MSGFAIL = "ACESERV_MSGFAIL"; private final static String MSGKILL = "ACESERV_MSGKILL"; private Socket sock; private DataInputStream dis; private DataOutputStream dos; private boolean pendingConfig = true; private int serverVersion = 0; private int clientId = 0; boolean encore = false; private int maxBytes = 0; private boolean defunct = false; int transactionCount = 0; public AceSocket(String host, int port) throws Exception { this(host, port, "anonymous", "guest"); } public AceSocket(String host, int port, String user, String passwd) throws Exception { try { sock = new Socket(host, port); dis = new DataInputStream(sock.getInputStream()); dos = new DataOutputStream(sock.getOutputStream()); String pad = transact("bonjour"); String userPasswd = md5Sum(user, passwd); String token = md5Sum(userPasswd, pad); String repl = transact(user + " " + token); if (!repl.startsWith("et bonjour a vous")) throw new Exception("Couldn't connect ("+repl+")"); } catch (IOException ex) { throw new Exception(ex); } } public String transact(String s) throws Exception { ++transactionCount; try { if (dis.available() != 0) { handleUnsolicited(); } writeMessage(MSGREQ, s); String reply = readMessage(); return reply; } catch (IOException ex) { throw new Exception(ex); } } public InputStream transactToStream(String s) throws Exception { ++transactionCount; if (dis.available() != 0) { handleUnsolicited(); } writeMessage(MSGREQ, s); return new AceInputStream(this); } private void handleUnsolicited() throws Exception { defunct = true; throw new Exception("Unsolicited data from server!"); } private void writeMessage(String type, String s) throws IOException { dos.writeInt(OK_MAGIC); dos.writeInt(s.length() + 1); dos.writeInt(serverVersion); // ???Server version??? dos.writeInt(clientId); // clientId dos.writeInt(maxBytes); // maxBytes dos.writeBytes(type); byte[] padding = new byte[30 - type.length()]; dos.write(padding, 0, padding.length); dos.writeBytes(s); dos.write(0); dos.flush(); } private String readMessage() throws IOException { StringBuilder sb = new StringBuilder(); while (readMessagePart(sb)) { writeEncore(); } return sb.toString(); } void writeEncore() throws IOException { if (!encore) throw new IllegalStateException(); writeMessage(MSGENCORE, "encore"); } private boolean readMessagePart(StringBuilder sb) throws IOException { sb.append(new String(read())); return this.encore; } byte[] read() throws IOException { int magic = dis.readInt(); int length = dis.readInt(); int rServerVersion = dis.readInt(); int rClientId = dis.readInt(); int rMaxBytes = dis.readInt(); byte[] typeb = new byte[30]; dis.readFully(typeb); String type = new String(typeb); if (pendingConfig) { serverVersion = rServerVersion; clientId = rClientId; maxBytes = rMaxBytes; pendingConfig = false; } byte[] message = new byte[length-1]; dis.readFully(message); dis.skipBytes(1); this.encore = type.startsWith(MSGENCORE); return message; } public void dispose() throws Exception { try { defunct = true; sock.close(); } catch (IOException ex) { throw new Exception(ex); } } private static String md5Sum(String a, String b) { try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(a.getBytes()); byte[] digest = md.digest(b.getBytes()); StringBuffer sb = new StringBuffer(); for (int i = 0; i < digest.length; ++i) { int bt = digest[i]; sb.append(hexChar((bt >>> 4) & 0xf)); sb.append(hexChar(bt & 0xf)); } return sb.toString(); } catch (NoSuchAlgorithmException ex) { throw new Error("BioJava access to ACeDB sockets require the MD5 hash algorithm. Consult your Java Vendor."); } } private static char hexChar(int i) { if (i <= 9) return (char) ('0' + i); else return (char) ('a' + i-10); } public boolean isDefunct() { return defunct; } } class AceInputStream extends InputStream { private AceSocket socket; private int validity; private byte[] buffer; private int offset; AceInputStream(AceSocket s) throws IOException { this.socket = s; this.validity = this.socket.transactionCount; next(); } private void validate() throws IOException { if (this.validity != this.socket.transactionCount) throw new IOException("Tried to read from AceInputStream after a new transaction has been performed"); } private boolean next() throws IOException { if (buffer == null || socket.encore) { if (socket.encore) socket.writeEncore(); buffer = socket.read(); offset = 0; return true; } else { return false; } } public int read() throws IOException { validate(); if (offset >= buffer.length) if (!next()) return -1; return buffer[offset++]; } public int read(byte[] b) throws IOException { return read(b, 0, b.length); } public int read(byte[] b, int off, int len) throws IOException { validate(); if (offset >= buffer.length) if (!next()) return -1; int r = Math.min(len, buffer.length-offset); System.arraycopy(buffer, offset, b, off, r); offset += r; return r; } }
ac046d0039f492ea0c32f663893258de2a02b561
fe49198469b938a320692bd4be82134541e5e8eb
/scenarios/web/large/gradle/ClassLib109/src/main/java/ClassLib109/Class039.java
e9c3eddfa45efc186ae2306b0e0bcf4ebcfc56f9
[]
no_license
mikeharder/dotnet-cli-perf
6207594ded2d860fe699fd7ef2ca2ae2ac822d55
2c0468cb4de9a5124ef958b315eade7e8d533410
refs/heads/master
2022-12-10T17:35:02.223404
2018-09-18T01:00:26
2018-09-18T01:00:26
105,824,840
2
6
null
2022-12-07T19:28:44
2017-10-04T22:21:19
C#
UTF-8
Java
false
false
122
java
package ClassLib109; public class Class039 { public static String property() { return "ClassLib109"; } }
b40eeb3e3b9cda44a2a6b03982e1f6365443e01a
77a91d1901f9e4f013cca4ec3dd81e8a229cc833
/src/com/kt/glos/adapter/CustomViewAdapter.java
6d72432d615d924a7f852764f93d2a446fdbaf53
[]
no_license
SoongChoi/try_git
fb249c0a6cfeb45559f5c2ed4d610f1790f2582d
3c3b3458e81a09802d0090aefa1c792d6d95585d
refs/heads/master
2020-06-04T05:27:02.481462
2013-05-15T11:48:35
2013-05-15T11:48:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
575
java
package com.kt.glos.adapter; import java.util.ArrayList; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; public class CustomViewAdapter extends ArrayAdapter<InterAdapterGetview> { public CustomViewAdapter(Context context, int textViewResourceId, ArrayList<InterAdapterGetview> items) { super(context, textViewResourceId, items); } @Override public View getView(int position, View convertView, ViewGroup parent) { return this.getItem(position).getMyView(position,convertView); } }
6b83c404f441ee8c46efd0878d8ed42e5ffd2c30
5614686c0d19ea121c48b4caa42768d48a6ca542
/smithy-syntax/src/test/java/software/amazon/smithy/syntax/TokenTreeNodeTest.java
9002125dbdaf2e17a4e590d965847ed08c4a5e52
[ "Apache-2.0" ]
permissive
srchase/smithy
09d99ad4a764d84f61b1f78dec8c5285927e3ebd
9ec4f9dbe0667df179a5224cd76da4926a49332a
refs/heads/main
2023-08-20T09:08:01.503988
2023-08-15T08:05:39
2023-08-15T20:06:46
240,372,678
1
0
Apache-2.0
2022-12-06T19:04:29
2020-02-13T21:57:33
Java
UTF-8
Java
false
false
1,906
java
package software.amazon.smithy.syntax; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; import java.util.stream.Collectors; import org.junit.jupiter.api.Test; import software.amazon.smithy.model.loader.IdlTokenizer; public class TokenTreeNodeTest { @Test public void hasChildren() { TokenTree tree = TokenTree.of(TreeType.BR); TokenTree a = TokenTree.of(TreeType.WS); TokenTree b = TokenTree.of(TreeType.TOKEN); tree.appendChild(a); tree.appendChild(b); assertThat(tree.getChildren(), contains(a, b)); tree.removeChild(a); assertThat(tree.getChildren(), contains(b)); } @Test public void hasTokens() { IdlTokenizer tokenizer = IdlTokenizer.create("foo"); CapturedToken capture = CapturedToken.from(tokenizer); TokenTree tree = TokenTree.of(capture); assertThat(tree.tokens().collect(Collectors.toList()), contains(capture)); assertThat(tree.getStartPosition(), equalTo(0)); assertThat(tree.getStartLine(), equalTo(1)); assertThat(tree.getStartColumn(), equalTo(1)); assertThat(tree.getEndColumn(), equalTo(4)); // the column is exclusive (it goes to 3, but 4 is the _next_ col) assertThat(tree.getEndLine(), equalTo(1)); } @Test public void equalsAndHashCodeWork() { IdlTokenizer tokenizer = IdlTokenizer.create("foo"); CapturedToken capture = CapturedToken.from(tokenizer); TokenTree tree = TokenTree.of(capture); assertThat(tree, equalTo(tree)); assertThat(tree, not(equalTo("hi"))); assertThat(tree, not(equalTo(TokenTree.fromError("Foo")))); assertThat(tree.hashCode(), is(not(0))); } }
bb832cb7f9e43cf48a8f2c94870fd8e9d8e705cb
fc81e5921902a7e82e8cb313c61d6e9294d5b176
/app-hsqldb/src/main/java/org/example/hellodb/hsqldb/HelloHsqldb.java
9b55c7a06c755a81d73f1dca0b8c843b6393ee4d
[ "Apache-2.0" ]
permissive
beryx-gist/badass-jlink-example-hello-db-multi-project
ece79a0cfcd9c518938a180a4a94a03e15f3e12a
b8123a9da105b28ab4f66483ee01c35f1c0aca94
refs/heads/main
2023-04-14T00:29:34.950060
2021-04-11T22:39:14
2021-04-11T22:39:14
356,994,600
0
0
null
null
null
null
UTF-8
Java
false
false
281
java
package org.example.hellodb.hsqldb; import org.example.hellodb.main.HelloDB; public class HelloHsqldb { public static void main(String[] args) { HelloDB.main(new String[] { "--url=jdbc:hsqldb:mem:test", "--user=SA" }); } }
2a94916b34b3dfcfb63f358c46f35e30062bdbcb
f06760d27534a4cca6094a5ce8146ddadcaec002
/Adv_Day1/src/Assignment7/ArchitecturalNeutralityofJVM.java
911fc25d4518689bd0acb8515b16073ac001dee7
[]
no_license
rahilhasnani95/AdvancedJava
da06d0e89cc889450af69a96b2e7ef7031851d90
5efb20ae60bcaf722282ec4ee037535daed42002
refs/heads/master
2020-06-03T19:08:30.681450
2019-06-25T17:35:11
2019-06-25T17:35:11
191,696,233
0
0
null
null
null
null
UTF-8
Java
false
false
298
java
package Assignment7; public class ArchitecturalNeutralityofJVM { /* * Answer 1: compliler converts .java file to .class files * * Answer 2: .class files are independent * * ANswer 3: JDK is used to deploy WellsBank software. Software is platform * Dependent */ }
e9cde3f6d8a829d1c8e45efc65a95e6629398824
48e835e6f176a8ac9ae3ca718e8922891f1e5a18
/benchmark/training/org/apache/camel/processor/async/AsyncEndpointFailOverLoadBalanceMixed2Test.java
1f07047fea071b427860f400ba8d9fd28727826e
[]
no_license
STAMP-project/dspot-experiments
f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5
121487e65cdce6988081b67f21bbc6731354a47f
refs/heads/master
2023-02-07T14:40:12.919811
2019-11-06T07:17:09
2019-11-06T07:17:09
75,710,758
14
19
null
2023-01-26T23:57:41
2016-12-06T08:27:42
null
UTF-8
Java
false
false
1,872
java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.camel.processor.async; import org.apache.camel.ContextTestSupport; import org.junit.Assert; import org.junit.Test; public class AsyncEndpointFailOverLoadBalanceMixed2Test extends ContextTestSupport { private static String beforeThreadName; private static String afterThreadName; @Test public void testAsyncEndpoint() throws Exception { getMockEndpoint("mock:before").expectedBodiesReceived("Hello Camel"); getMockEndpoint("mock:fail").expectedBodiesReceived("Hello Camel"); getMockEndpoint("mock:after").expectedBodiesReceived("Bye World"); getMockEndpoint("mock:result").expectedBodiesReceived("Bye World"); String reply = template.requestBody("direct:start", "Hello Camel", String.class); Assert.assertEquals("Bye World", reply); assertMockEndpointsSatisfied(); Assert.assertFalse("Should use different threads", AsyncEndpointFailOverLoadBalanceMixed2Test.beforeThreadName.equalsIgnoreCase(AsyncEndpointFailOverLoadBalanceMixed2Test.afterThreadName)); } }
682bc2ec27ac01e51819fef8fed0d78608278cfd
fdbee101c045bb2aceb13f95497e3fd66bb7d583
/src/main/java/sorting/BubbleSorting.java
03579634d70658641ac83b47deeb7d9d023b430e
[]
no_license
azlupinski/algorytmyIProgramowanie
9f9b3d2df799a30c48a446566669cbf1cd004dea
7722fd2827a0da98b4a06a17fde1a33b0402b9b7
refs/heads/master
2020-04-01T04:17:48.149093
2018-10-28T13:54:55
2018-10-28T13:54:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
706
java
package sorting; public class BubbleSorting { public static void main(String[] args) { int tab[] = {4, 3, 2, 1, 5}; sortTable(tab); } private static void sortTable(int[] table) { int lenght = table.length; int temp; while (lenght > 0) { for (int i = 1; i < lenght; i++) { if (table[i] < table[i - 1]) { temp = table[i]; table[i] = table[i - 1]; table[i - 1] = temp; } } for (int obj : table) { System.out.print(obj); } System.out.println(); lenght--; } } }
332bf0f65814f35e1f18fc7e27c4786d457d7508
64577b35e99d520b84a54d40802ed0a035980ebd
/app/src/main/java/com/ecommerce/android/myownecommerceapp/adapter/CategoryAdapter.java
724760a78ebfed96c1b2698c9720358bf0be16ed
[]
no_license
Yuvraj162002/MyOwnEcommerceApp
016712ee0fa2ec0dc60d3650c76fc8e9162cb7b5
5e7835efa6e5782078bcad2db3fa934a65a99c34
refs/heads/master
2023-09-05T13:13:49.575891
2021-11-20T09:33:16
2021-11-20T09:33:16
430,053,610
0
0
null
null
null
null
UTF-8
Java
false
false
2,382
java
package com.ecommerce.android.myownecommerceapp.adapter; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import com.ecommerce.android.myownecommerceapp.Model.CategoryModel; import com.ecommerce.android.myownecommerceapp.R; import com.ecommerce.android.myownecommerceapp.activities.CategoryView; import com.ecommerce.android.myownecommerceapp.activities.ViewAllActivity; import java.util.List; public class CategoryAdapter extends RecyclerView.Adapter<CategoryAdapter.ViewHolder> { List<CategoryModel> categoryModelList; Context context; public CategoryAdapter(List<CategoryModel> categoryModelList, Context context) { this.categoryModelList = categoryModelList; this.context = context; } @NonNull @Override public CategoryAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.category,parent,false)); } @Override public void onBindViewHolder(@NonNull CategoryAdapter.ViewHolder holder, int position) { Glide.with(context).load(categoryModelList.get(position).getImg_url()).into(holder.imageView); holder.name.setText(categoryModelList.get(position).getTitle()); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent( context , CategoryView.class ); intent.putExtra("type",categoryModelList.get(holder.getAdapterPosition()).getType()); context.startActivity(intent); } }); } @Override public int getItemCount() { return categoryModelList.size(); } public class ViewHolder extends RecyclerView.ViewHolder { ImageView imageView; TextView name; public ViewHolder(@NonNull View itemView) { super(itemView); imageView = itemView.findViewById(R.id.IV_category); name = itemView.findViewById(R.id.TV_category); } } }
45705664f3b8e983fe7979078c4c6b30ab2d03b4
a78e72ef17b1b33b0efd5e9ab0e9245a851a1446
/src/main/java/com/wangtao/security/SysRole.java
e1bdc7004b45409366aa4dafcfecb6af7229c7ac
[]
no_license
velkoz1108/SpringBootTest
3f2845704bc6c1c5b61f7f725d407dca2983e17d
08f1d43d047f65d58ce93ab95019f53e04592a7e
refs/heads/master
2021-09-20T13:56:22.631035
2018-08-10T08:24:46
2018-08-10T08:24:46
115,410,247
0
0
null
null
null
null
UTF-8
Java
false
false
708
java
package com.wangtao.security; import com.alibaba.fastjson.JSON; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import java.io.Serializable; /** * Created by want on 2018-1-14. */ @Entity public class SysRole implements Serializable { @Id @GeneratedValue private Long id; private String name; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { return JSON.toJSONString(this); } }
ca4682ed4db52db9500c96e3716ebdfac30894af
fbf18fd77cebcc84e3dc77127ec89223f021c6a4
/src/main/java/com/chinadci/SpringBootQuickstartHelloworldApplication.java
fdef60f85766900342ddac9b7d17d397f83305e9
[]
no_license
GISerYuan/spring-boot-quickstart-helloworld
a91bd64efccc36bb4d311ef352f28f75f3ceaa5f
6ea42681dd75a06a6aada1ad077bee6039ee41a4
refs/heads/master
2020-08-01T10:56:22.251352
2019-09-26T01:43:43
2019-09-26T01:43:43
210,975,524
0
0
null
null
null
null
UTF-8
Java
false
false
353
java
package com.chinadci; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class SpringBootQuickstartHelloworldApplication { public static void main(String[] args) { SpringApplication.run(SpringBootQuickstartHelloworldApplication.class, args); } }
c2cbfe16b5623b14dcb3ca2fce9a75d3cc9a642c
28f92f2e7d7512186ce6b4b687d6445ad4b08a15
/src/com/zhf/service/UserServiceDemo1.java
2e384c2bd098f611a8d66d8b83d62fb96613e9d9
[ "Apache-2.0" ]
permissive
ZengHongfu/cloud_note
0ea76b52444880dba9c7f9b108c3dddbf3839187
25dc7aee9ad8ffb5a03096a8318c521354fb13c4
refs/heads/master
2021-01-20T14:16:45.036912
2017-05-08T04:08:04
2017-05-08T04:08:04
90,584,088
0
0
null
null
null
null
UTF-8
Java
false
false
2,007
java
package com.zhf.service; import java.security.NoSuchAlgorithmException; import javax.annotation.Resource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.zhf.dao.UserDao; import com.zhf.entity.Result; import com.zhf.entity.User; import com.zhf.util.NoteUtil; @Service public class UserServiceDemo1 implements UserService{ @Resource UserDao userDao; public Result checkLogin(String username, String pwd) throws Exception { Result result=new Result(); String md5_pwd=NoteUtil.md5(pwd); User user=userDao.findUserByName(username); if(user==null){ result.setStatus(1); result.setMsg("用户名不存在"); }else if(!user.getCn_user_password().equals(md5_pwd)){ result.setStatus(2); result.setMsg("密码错误"); }else{ result.setStatus(0); result.setMsg("登录成功"); result.setData(user.getCn_user_id()); } return result; } @Transactional() public Result saveUser(String username, String pwd, String nickname) throws Exception { Result result=new Result(); //检测用户名是否被占用 User tempuser=userDao.findUserByName(username); if(tempuser!=null){ result.setStatus(1); result.setMsg("用户名已被占用!"); return result; } //注册 User user=new User(); user.setCn_user_id(NoteUtil.createId()); user.setCn_user_name(username); String md5_pwd=NoteUtil.md5(pwd); user.setCn_user_password(md5_pwd); user.setCn_user_desc(nickname); userDao.saveUser(user); result.setStatus(0); result.setMsg("注册成功"); return result; } // public static void main(String[] args){ // User user=new User(); // user.setCn_user_id("1111"); // user.setCn_user_name("2222"); // user.setCn_user_password("33333333"); // user.setCn_user_token("444"); // user.setCn_user_desc("555"); // UserDao userDao=NoteUtil.getUserDao(); // userDao.saveUser(user); // } }
c59763a79cadfab9895ccd3bdcab54810e9923fb
9e3fa39fb7598e4f6f3250f9aea4e89fbc39261b
/src/com/chocolate/chocolateQuest/magic/ElementDamageSourceDark.java
0322b72a3bc17067de7787c31c2aec2ed6b6bacd
[]
no_license
TheExceptionist/chocolateQuest
e4253e7f50aa57713b251b9534d5e494c08f77f3
f337ddfb4d83c68ad67b6a35fba12f9e3fb1b4f7
refs/heads/master
2021-05-07T00:14:19.808122
2017-11-09T08:49:14
2017-11-09T08:49:14
110,089,977
0
0
null
2017-11-09T08:48:31
2017-11-09T08:48:31
null
UTF-8
Java
false
false
1,677
java
/* 1: */ package com.chocolate.chocolateQuest.magic; /* 2: */ /* 3: */ import net.minecraft.entity.Entity; /* 4: */ import net.minecraft.entity.EntityLivingBase; /* 5: */ import net.minecraft.potion.Potion; /* 6: */ import net.minecraft.potion.PotionEffect; /* 7: */ import net.minecraft.util.DamageSource; /* 8: */ /* 9: */ public class ElementDamageSourceDark /* 10: */ extends ElementDamageSource /* 11: */ { /* 12: */ public float onHitEntity(Entity source, Entity entityHit, float damage) /* 13: */ { /* 14:13 */ int fireDamage = (int)(damage / 4.0F); /* 15:14 */ if (fireDamage >= 1) /* 16: */ { /* 17:15 */ damage -= fireDamage; /* 18:16 */ ((EntityLivingBase)entityHit).addPotionEffect(new PotionEffect(Potion.wither.id, fireDamage * 60, 0)); /* 19: */ } /* 20:18 */ return damage; /* 21: */ } /* 22: */ /* 23: */ public DamageSource getIndirectDamage(Entity projectile, Entity shooter, String name) /* 24: */ { /* 25:23 */ return super.getIndirectDamage(projectile, shooter, name).setMagicDamage(); /* 26: */ } /* 27: */ /* 28: */ public DamageSource getDamageSource(Entity shooter, String name) /* 29: */ { /* 30:27 */ return super.getDamageSource(shooter, name).setMagicDamage(); /* 31: */ } /* 32: */ /* 33: */ public DamageSource getDamageSource(String name) /* 34: */ { /* 35:31 */ return super.getDamageSource(name).setMagicDamage(); /* 36: */ } /* 37: */ } /* Location: P:\robf.jar * Qualified Name: com.chocolate.chocolateQuest.magic.ElementDamageSourceDark * JD-Core Version: 0.7.1 */
bb792b49c0c322bccfd7f6d92442f69766f5aec7
70c8742e62936c4d7f731ee91fa440f475caa130
/app/src/main/java/it/flube/driver/deviceLayer/cloudServices/cloudImageStorage/uploadManagement/uploadTasks/RemoveImageUploadTask.java
64c505699f0c1358d81dbc69f01c800143c49215
[]
no_license
scrappyatx/flubeitDriver
20e9c375470e591c69edb868898dbcc9d54ed23b
0edbff05b524044e02516ae4e0c85a5757490328
refs/heads/master
2021-01-21T08:33:22.237589
2019-02-17T23:18:40
2019-02-17T23:18:40
91,628,715
0
0
null
null
null
null
UTF-8
Java
false
false
4,299
java
/* * Copyright (c) 2019. scrapdoodle, LLC. All Rights Reserved */ package it.flube.driver.deviceLayer.cloudServices.cloudImageStorage.uploadManagement.uploadTasks; import android.support.annotation.NonNull; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.database.DatabaseReference; import java.util.HashMap; import it.flube.driver.deviceLayer.cloudServices.cloudImageStorage.fileInfoNode.SetNodeFileInfo; import timber.log.Timber; import static it.flube.driver.deviceLayer.cloudServices.cloudImageStorage.CloudImageStorageConstants.RTD_CANCELED_NODE; import static it.flube.driver.deviceLayer.cloudServices.cloudImageStorage.CloudImageStorageConstants.RTD_FAILED_NODE; import static it.flube.driver.deviceLayer.cloudServices.cloudImageStorage.CloudImageStorageConstants.RTD_FINISHED_NODE; import static it.flube.driver.deviceLayer.cloudServices.cloudImageStorage.CloudImageStorageConstants.RTD_IN_PROGRESS_NODE; import static it.flube.driver.deviceLayer.cloudServices.cloudImageStorage.CloudImageStorageConstants.RTD_NOT_STARTED_NODE; import static it.flube.driver.deviceLayer.cloudServices.cloudImageStorage.CloudImageStorageConstants.RTD_PAUSED_NODE; import static it.flube.driver.deviceLayer.cloudServices.cloudImageStorage.CloudImageStorageConstants.RTD_PERMANENTLY_FAILED_NODE; import static it.flube.driver.deviceLayer.cloudServices.cloudImageStorage.CloudImageStorageConstants.RTD_SUCCESS_NODE; /** * Created on 1/24/2019 * Project : Driver */ public class RemoveImageUploadTask implements SetNodeFileInfo.Response, OnCompleteListener<Void> { private static final String TAG = "RemoveImageUploadTask"; private Response response; private DatabaseReference uploadTaskNodeRef; private String ownerGuid; public RemoveImageUploadTask(){ Timber.tag(TAG).d("created..."); } public void removeUploadTask(DatabaseReference uploadTaskNodeRef, String ownerGuid, Response response) { Timber.tag(TAG).d("removeUploadTask..."); this.response = response; this.uploadTaskNodeRef = uploadTaskNodeRef; this.ownerGuid = ownerGuid; Timber.tag(TAG).d(" uploadTaskNodeRef -> " + uploadTaskNodeRef.toString()); Timber.tag(TAG).d(" ownerGuid -> " + ownerGuid); this.response = response; //setup updates on children nodes HashMap<String, Object> childUpdates = new HashMap<String, Object>(); childUpdates.put(String.format(RTD_NOT_STARTED_NODE, ownerGuid), null); // notStarted childUpdates.put(String.format(RTD_IN_PROGRESS_NODE, ownerGuid), null); // inProgress childUpdates.put(String.format(RTD_PAUSED_NODE, ownerGuid), null); // paused childUpdates.put(String.format(RTD_FAILED_NODE, ownerGuid), null); // failed childUpdates.put(String.format(RTD_CANCELED_NODE, ownerGuid), null); // canceled childUpdates.put(String.format(RTD_SUCCESS_NODE, ownerGuid), null); // success childUpdates.put(String.format(RTD_PERMANENTLY_FAILED_NODE, ownerGuid), null); // failedPermanently childUpdates.put(String.format(RTD_FINISHED_NODE, ownerGuid), null); // finished //update children uploadTaskNodeRef.updateChildren(childUpdates).addOnCompleteListener(this); } public void onComplete(@NonNull Task<Void> task) { Timber.tag(TAG).d(" onComplete..."); if (task.isSuccessful()) { Timber.tag(TAG).d(" ...SUCCESS"); } else { Timber.tag(TAG).w(" ...FAILURE"); try { throw task.getException(); } catch (Exception e) { Timber.tag(TAG).e(e); } } Timber.tag(TAG).d("COMPLETE"); //remove node file info new SetNodeFileInfo().removeNodeRequest(uploadTaskNodeRef, ownerGuid, this); } public void setNodeFileInfoComplete(){ Timber.tag(TAG).d("setNodeFileInfoComplete"); response.removeImageUploadTaskComplete(); } public interface Response { void removeImageUploadTaskComplete(); } }
660d0d5abd9c2cbce3c604a09af16de89ecf717f
bdc7fc54f7e5839574ab9f2947d6c2aa5e7df400
/app/src/main/java/com/example/android/bakingapp/detail/DetailActivityViewModel.java
0c9c44fde86c3ca7e7c180edf0dbba10ba0fba9f
[]
no_license
NamerAlnamer/BakingApp
c86eada705c4f0b0d2f49e0f54d5811fd93af606
46d311ab9d034792f7840a62d61e4472152c65eb
refs/heads/master
2020-06-30T13:16:11.841523
2019-08-06T11:19:40
2019-08-06T11:19:40
200,836,920
0
0
null
null
null
null
UTF-8
Java
false
false
2,117
java
package com.example.android.bakingapp.detail; import android.app.Application; import androidx.annotation.NonNull; import androidx.lifecycle.AndroidViewModel; import com.example.android.bakingapp.data.model.RecipeModel; public class DetailActivityViewModel extends AndroidViewModel { private RecipeModel recipeModel; private int stepPosition; private int windowIndex = 0; private long playBackPosition = 0; private boolean playWhenReady = true; private int mStepPositionPrevious = -1; private boolean isLandscape = false; public DetailActivityViewModel(@NonNull Application application) { super(application); } public void init() { windowIndex = 0; playBackPosition = 0; playWhenReady = false; mStepPositionPrevious = -1; } public boolean isLandscape() { return isLandscape; } public void setLandscape(boolean landscape) { isLandscape = landscape; } public int getWindowIndex() { return windowIndex; } public void setWindowIndex(int windowIndex) { this.windowIndex = windowIndex; } public long getPlayBackPosition() { return playBackPosition; } public void setPlayBackPosition(long playBackPosition) { this.playBackPosition = playBackPosition; } public boolean isPlayWhenReady() { return playWhenReady; } public void setPlayWhenReady(boolean playWhenReady) { this.playWhenReady = playWhenReady; } public int getmStepPositionPrevious() { return mStepPositionPrevious; } public void setmStepPositionPrevious(int mStepPositionPrevious) { this.mStepPositionPrevious = mStepPositionPrevious; } public RecipeModel getRecipeModel() { return recipeModel; } public void setRecipeModel(RecipeModel recipeModel) { this.recipeModel = recipeModel; } public int getStepPosition() { return stepPosition; } public void setStepPosition(int stepPosition) { this.stepPosition = stepPosition; } }
64f0c88788798e56884a70962d30607302b5c23a
d1a6d1e511df6db8d8dd0912526e3875c7e1797d
/genny_JavaWithLambdas/applicationModule/src/main/java/applicationModulepackageJava4/Foo475.java
1d766bc2cc813f66bfcd2ed89ad10303534e745d
[]
no_license
NikitaKozlov/generated-project-for-desugaring
0bc1443ab3ddc84cd289331c726761585766aea7
81506b3711004185070ca4bb9a93482b70011d36
refs/heads/master
2020-03-20T00:35:06.996525
2018-06-12T09:30:37
2018-06-12T09:30:37
137,049,317
0
0
null
null
null
null
UTF-8
Java
false
false
575
java
package applicationModulepackageJava4; public class Foo475 { public void foo0() { final Runnable anything0 = () -> System.out.println("anything"); new applicationModulepackageJava4.Foo474().foo9(); } public void foo1() { foo0(); } public void foo2() { foo1(); } public void foo3() { foo2(); } public void foo4() { foo3(); } public void foo5() { foo4(); } public void foo6() { foo5(); } public void foo7() { foo6(); } public void foo8() { foo7(); } public void foo9() { foo8(); } }
c1ab42fd0223c0006aa51d794a6c56e55b9e1c5c
98d9e5fb6f7992bbeaf663dfe28729a22a9c9837
/CICLO_II/Retos/Reto 1/Soluciones/Reto 1.1.java
b28d8bcdd035b307799901ce5d10aef0d0446c00
[]
no_license
MISIONTIC-UN-2022/CICLO_II
b913f922ad7ae333c67cc04bd813b70e4657c760
40b2c1d4fa9efd97600874d4182a352f3b43d992
refs/heads/master
2023-07-20T10:46:54.484178
2021-08-25T23:34:45
2021-08-25T23:34:45
399,983,308
1
2
null
null
null
null
UTF-8
Java
false
false
4,268
java
import java.util.Scanner; // ¿Cuál es el porcentaje de aprobación para todos los exámenes presentados por el grupo? // ¿Cuántos examenes tienen una calificación Excelente? // ¿Cuál es la materia con el mejor desempeño promedio para todo el grupo? // ¿Cuál es el estudiante con el mejor desempeño para la materia historia? public class Reto1 { static double[][] gradingScale0 = { {0,1}, {1,2.5}, {2.5,3,5}, {3.5,4.5}, {4.5,5} }; static double[][] gradingScale1 = { {0,3}, {3,6}, {6,8}, {8,9}, {9,10} }; static double[][] gradingScale2 = { {0,30}, {30,60}, {60,80}, {80,90}, {90,100} }; static String[] subjects = {"historia", "literatura", "biologia"}; static double[][] gradingScale = gradingScale0; static String[] students = { "armando", "nicolas", "daniel", "maria", "marcela", "alexandra"}; static String[] genders = {"m", "f"}; public static void main(String[] args) throws Exception { double[][] data = readData(); print(getApprovalPercentaje(data)); print(getExamsExcellent(data)); print(subjects[getBetterPerformingSubjectGroup(data)]); print(students[getStudentBestGradeBySubject(data)[0] -1]); } public static void print(Object a){ if(a instanceof Double){ System.out.printf("%.2f\n",a); }else{ System.out.println(a); } } public static double[][] readData(){ Scanner scanLine = new Scanner(System.in); int n = scanLine.nextInt(); scanLine.nextLine(); double[][] data = new double[n][4]; String[] lines = new String[n]; for(int i = 0; i < n; i++){ lines[i] = scanLine.nextLine(); } for(int i = 0; i < lines.length; i++){ String[] line = lines[i].split(" "); for(int j = 0; j < line.length; j++) data[i][j] = Double.parseDouble(line[j]); } scanLine.close(); return data; } // '¿Cuál es el desempeño promedio de todo el grupo?' public static double getAverageAllGrades(double[][] data){ double sum = 0; for(int i = 0; i < data.length; i++){ sum += data[i][3]; } return (sum / data.length); } public static boolean isAprobbed(double grade){ return gradingScale[2][0] < grade; } public static double getApprovalPercentaje(double[][] data){ int count = 0; for(int i = 0; i < data.length; i++){ if(gradingScale[2][0] < data[i][3]){ count++; } } return (double)(count) / data.length; } public static int getExamsExcellent(double[][] data){ int count = 0; for(int i = 0; i < data.length; i++){ if(gradingScale[4][0] < data[i][3] && gradingScale[4][1] >= data[i][3]) count++; } return count; } public static int getBetterPerformingSubjectGroup(double[][] data){ double[] subjectsSum = {0,0,0}; int[] subjectsCount = {0,0,0}; for(int j = 0; j < data.length; j++){ subjectsSum[(int) (data[j][2]- 1)] = subjectsSum[(int) (data[j][2]- 1)] + data[j][3]; subjectsCount[(int) (data[j][2]- 1)] = subjectsCount[(int) (data[j][2]- 1)] + 1; } double auxMax = 0; int auxIndex = -1; for(int i = 0; i < subjectsSum.length; i++){ if(subjectsCount[i] != 0 && auxMax < subjectsSum[i]/subjectsCount[i]){ auxMax = subjectsSum[i]/subjectsCount[i]; auxIndex = i; } } return auxIndex; } public static int[] getStudentBestGradeBySubject(double[][] data){ double[] subjectsMax = {0,0,0}; int[] subjectsStudentIndex = {0,0,0}; for(int i = 0; i < data.length; i++){ if(subjectsMax[(int)(data[i][2] -1 ) ] < data[i][3]){ subjectsMax[(int)(data[i][2] -1 ) ] = data[i][3]; subjectsStudentIndex[(int)(data[i][2] -1 )] = (int)data[i][0]; } } return subjectsStudentIndex; } }