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
b05509fc52fe937973f9279bf82a9007e9372266
475a41231c1853cdd7210f5884dd03517cbbf6c6
/Singleton-Pattern/src/main/java/doubleCheck/Sington.java
b50c1af816061302cd0a3cf6875f78439a1cbcb8
[]
no_license
ColdPepsi/Leetcode
dd349c1ddf3187ecbc32c0ddee9fff59e405ed89
1adac49f864bf57b0db41dbd6616d3b4cc5ebf19
refs/heads/master
2021-02-24T22:29:58.713247
2020-12-16T08:44:12
2020-12-16T08:44:12
245,442,512
9
6
null
null
null
null
UTF-8
Java
false
false
500
java
package doubleCheck; /** * @author WuBiao * @date 2020/5/12 10:03 */ public class Sington { private volatile static Sington sington = null;//注意volatile关键字 private Sington() { }//私有化构造器 public static Sington getInstance() { if (sington == null) { synchronized (Sington.class) { if (sington == null) { sington = new Sington(); } } } return sington; } }
833d14a038ef286942d401c4779c7c3dd95d1956
7b8f32cb896682e53bd8030a1705da42ef5d05c6
/src/main/java/cobaia/mvc/controllers/RegistroController.java
459c297845471dcbaea693842dadc98b180cc5d9
[ "MIT" ]
permissive
RobinsonLuiz/CursosWebApp-Cobaia-APS
78e544c8ade4d7f8fffb2ae0bf5e2a02fac52a52
cdb75d78b3983b1b519dd477517a615bb6fd21b6
refs/heads/master
2021-04-15T05:53:36.053180
2018-05-19T03:46:29
2018-05-19T03:46:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,186
java
package cobaia.mvc.controllers; import java.util.UUID; import org.apache.commons.mail.DefaultAuthenticator; import org.apache.commons.mail.EmailException; import org.apache.commons.mail.HtmlEmail; import cobaia.Modelo.Usuario; public class RegistroController extends AbstractController { String SALT = "cobaiaforever"; @Override protected String controller() { int c = this.getClass().getSimpleName().toLowerCase().indexOf("controller"); return this.getClass().getSimpleName().toLowerCase().substring(0,c); } public String index() { Session(); return view(); } public String finalizar() { Session(); Usuario u = new Usuario(); String uid = UUID.randomUUID().toString().split("-")[0]; u.setNome(getRequest().queryParams("nome")); u.setEmail(getRequest().queryParams("email")); u.setSenha(getRequest().queryParams("senha") + SALT); u.setVerificaSenha(getRequest().queryParams("senha2") + SALT); u.setToken(uid); u.setSaldo((double) 0); try { u.validar(); if (!u.isValido()) { viewBag.put("erro", u.getErros()); return view("registro/index.pebble"); } sendEmail(uid,u); viewBag.put("registrar", u); dao.abreConexao(); String sql = "SELECT status FROM usuarios WHERE email = ?"; dao.comando(sql); dao.comandoinuse().setString(1, u.getEmail()); dao.result(); if (dao.resultados().next()) { viewBag.put("erro", "Este e-mail já está cadastrado."); return view("registro/index.pebble"); } u.save(); } catch (Exception e) { return "VSF"; } getResponse().redirect("/mvc/ativar"); return "OK"; } public String sendEmail(String uid,Usuario u) { try { HtmlEmail mailer = new HtmlEmail(); mailer.setHostName("smtp.googlemail.com"); mailer.setSmtpPort(465); mailer.setAuthenticator(new DefaultAuthenticator("[email protected]", System.getenv("COBAIA_MAIL_PASSWORD"))); mailer.setSSLOnConnect(true); mailer.setFrom("[email protected]"); mailer.setSubject("[Cobaia] Confirmar seu registro"); mailer.setHtmlMsg("Olá " + u.getNome() + "<br><br>Confirme sua conta com esse código: " + u.getToken() + " ou, se preferir, clique nesse link: <a href=\"http://localhost:4567/mvc/ativar/" + u.getToken() + "\">http://localhost:4567/mvc/ativar/" + u.getToken() + "</a> para direcioná-lo diretamente"); mailer.addTo(u.getEmail()); mailer.send(); } catch (EmailException e) { return "não foi possivel enviar o email"; } return "OK"; } public String reenviar() { Session(); return view(); } public String confirmaReenvio() throws Exception { Session(); String email = getRequest().queryParams("email"); viewBag.put("email", email); if (!email.matches("[\\w._]+@\\w+(\\.\\w+)+")) { viewBag.put("erro", "E-mail inválido, ele deve ter o formato de usuario@provedor"); return view("registro/reenviar.pebble"); } Usuario u = null; dao.abreConexao(); String sql = "SELECT id, status, nome FROM usuarios WHERE email = ?"; dao.comando(sql); dao.comandoinuse().setString(1, email); dao.result(); if (dao.resultados().next()) { if (dao.resultados().getInt("status") > 0) { viewBag.put("info", "Esta conta já está ativada, você pode fazer o login."); return view("login/index.pebble"); } else { u = new Usuario().load(dao.resultados().getInt("id")); } } else { viewBag.put("erro", "Este e-mail não existe no nosso sistema, você pode fazer o cadastro."); return view("registro/index.pebble"); } String uid = UUID.randomUUID().toString().split("-")[0]; sendEmail(uid,u); viewBag.put("info", "O código de ativação foi enviado com sucesso, verifique seu email"); return view("ativar/index.pebble"); } }
78ac213c1c166be9dacb861e72a0dad3ec96762e
672cdad563502cae9297c13bb8a9e96b3f6cfc85
/webplat/src/main/java/com/tjs/admin/system/model/DicType.java
4ce7379e8bcae21d4aa3df5992946df9efb5d6ea
[]
no_license
duanyujun/webplat
dc9d57a69c15d03d222d77761a79d014fa9027f8
9a7186f523ec2f637ab3cd039ea9a0d6289b48de
refs/heads/master
2021-01-22T09:09:23.903123
2015-09-30T04:13:06
2015-09-30T04:13:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
866
java
package com.tjs.admin.system.model; public class DicType { /**dicId*/ private String id; /**dic父ID*/ private String pId; /**dic对应Key*/ private String dicKey; /**dic对应值*/ private String dicValue; /**dic类别 对应DicTypeEnum*/ private String dicClass; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getpId() { return pId; } public void setpId(String pId) { this.pId = pId; } public String getDicKey() { return dicKey; } public void setDicKey(String dicKey) { this.dicKey = dicKey; } public String getDicValue() { return dicValue; } public void setDicValue(String dicValue) { this.dicValue = dicValue; } public String getDicClass() { return dicClass; } public void setDicClass(String dicClass) { this.dicClass = dicClass; } }
2b4f360e8fcd2a1a64c57815024a8a3ad23aef5e
9f7b068015915ea9b424b6d2f0e0a07f963ad57f
/urls/src/test/java/com/hub4vision/urls/BStackTakeScreenshot.java
65b9eb1f554f17e84d998c2a818cc8969f8c59ee
[]
no_license
hub4vision/url
99b500818fee162674a4e8f630716088152d098f
03af2d5cfdec8809c84854cc11094d8306d81c22
refs/heads/master
2021-01-09T10:32:11.612086
2020-07-03T18:21:57
2020-07-03T18:21:57
242,267,231
0
0
null
null
null
null
UTF-8
Java
false
false
1,398
java
package com.hub4vision.urls; import java.io.File; import org.apache.commons.io.FileUtils; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.annotations.Test; public class BStackTakeScreenshot { @Test public void testBStackTakeScreenShot() throws Exception{ WebDriver driver ; System.setProperty("webdriver.gecko.driver","F:/IDE3/workspace/url/urls/Drivers/geckodriver/geckodriver.exe"); //webdriver.gecko.driver driver = new FirefoxDriver(); //goto url driver.get("https://www.browserstack.com"); //Call take screenshot function BStackTakeScreenshot.takeSnapShot(driver, "F:/IDE3/workspace/url/urls/screenshots/test.png") ; } /** * This function will take screenshot * @param webdriver * @param fileWithPath * @throws Exception */ public static void takeSnapShot(WebDriver webdriver,String fileWithPath) throws Exception{ //Convert web driver object to TakeScreenshot TakesScreenshot scrShot =((TakesScreenshot)webdriver); //Call getScreenshotAs method to create image file File SrcFile=scrShot.getScreenshotAs(OutputType.FILE); //Move image file to new destination File DestFile=new File(fileWithPath); //Copy file at destination FileUtils.copyFile(SrcFile, DestFile); } }
[ "uks@umesh" ]
uks@umesh
527d57b696041c5b3ad3fb3dd8332075e9f56462
793d2acf246860f753924f50f5e441cdeca434f4
/20200227_javaEx/src/Stu01.java
07ad50e2b32f9a19e500010653e4be530eb3c259
[]
no_license
ljw0730/koitt_java
ba3a2036513a8a93e227f7dca7d21de53f313adc
1f47cef26bcbb45a361eacb2f06eed93f7f3c0ff
refs/heads/master
2021-03-01T19:31:54.771453
2020-03-28T07:48:17
2020-03-28T07:48:17
245,809,761
0
0
null
null
null
null
UHC
Java
false
false
392
java
class Stu01 extends Object { // private static Stu01 s = new Stu01(); static int count = 0; int hak_num; String name; { // 인스턴스 초기화 블럭 count++; hak_num = count; } Stu01() { this("홍길동"); } Stu01(String name) { super(); this.name = name; } public String toString() { return "학번 : " + this.hak_num + " / 이름 : " + this.name; } }
7386a8c2356bffa88792e537c43f0fc026aa243a
4080f5a31c14c46ced4cfa02af5228664adf140d
/src/com/wen/TenthFifty/HammingDistance.java
bb090391af586580829f15d78003ac091f377400
[]
no_license
Jeff-Playground/LeetCode
43aa5e760f694650048a9c1feb2a3cf8f444e6e9
2e2e3987ccc605835cf04c2db1330dfb339f34aa
refs/heads/master
2023-08-25T08:41:07.304552
2023-08-03T20:21:41
2023-08-03T20:21:41
166,677,973
3
0
null
null
null
null
UTF-8
Java
false
false
425
java
package com.wen.TenthFifty; public class HammingDistance { public int hammingDistance(int x, int y) { if((x^y)==0){ return 0; } return (x^y)%2+hammingDistance(x>>1, y>>1); } // public int hammingDistance(int x, int y) { // int result=0, xor=x^y; // while(xor>0){ // result+=xor&1; // xor>>=1; // } // return result; // } }
1be65afda2b81bb4d2f7508cf44962699bdf2743
a1fcee07dd6a3e4765b36eccbc36e2c5605de4ac
/src/android/geosvr/dtn/servlib/nodeinfo/HistoryTravelData.java
75c3f26da273677732eecc84103ba3a07301783b
[]
no_license
wujingbang/vanetDtn-andriod
05f36927c677b0695655e5b42549cd993cb3bb44
d52ca5f04c69976665058ce1c4063761ddd13daf
refs/heads/NewConv_layer
2021-01-19T21:48:22.648697
2014-09-13T07:50:17
2014-09-13T07:50:17
14,515,407
2
1
null
2014-07-10T09:19:05
2013-11-19T05:40:10
Java
UTF-8
Java
false
false
345
java
/* * 历史行驶信息:车辆行驶特点是,要么停在目的地,要么是在路上。 * 选出 * 每小时一个时间段,每一次运行(一个地点到另一个地点)处在哪个时间段! * -把地图分块,编号。 */ package android.geosvr.dtn.servlib.nodeinfo; public class HistoryTravelData { }
56e40dee58f1c73b7b05a33a1387e11c013f81ec
726d8518a8c7a38b0db6ba9d4326cec172a6dde6
/1032. Stream of Characters/Solution.java
a03213313ea54e6b055638384916fc427f2e5d7a
[]
no_license
faterazer/LeetCode
ed01ef62edbcfba60f5e88aad401bd00a48b4489
d7ba416d22becfa8f2a2ae4eee04c86617cd9332
refs/heads/master
2023-08-25T19:14:03.494255
2023-08-25T03:34:44
2023-08-25T03:34:44
128,856,315
4
0
null
null
null
null
UTF-8
Java
false
false
1,315
java
import java.util.HashMap; import java.util.Map; class StreamChecker { class Trie { public Map<Character, Trie> children = new HashMap<>(); public boolean isEnd = false; } private Trie root = new Trie(); private StringBuilder charStream = new StringBuilder(); private void update(String word) { Trie p = root; for (int i = word.length() - 1; i >= 0; i--) { if (!p.children.containsKey(word.charAt(i))) { p.children.put(word.charAt(i), new Trie()); } p = p.children.get(word.charAt(i)); } p.isEnd = true; } public StreamChecker(String[] words) { for (String word : words) { update(word); } } public boolean query(char letter) { charStream.append(letter); Trie p = root; for (int i = charStream.length() - 1; i >= 0 && p != null; i--) { char ch = charStream.charAt(i); p = p.children.getOrDefault(ch, null); if (p != null && p.isEnd) { return true; } } return false; } } /** * Your StreamChecker object will be instantiated and called as such: * StreamChecker obj = new StreamChecker(words); * boolean param_1 = obj.query(letter); */
618e60fcd54ff8a1d4bb503cfb5e73892444b57a
f19c9c99c0c02ce0200f470a51f99585d514e586
/app/src/main/java/net/furkankaplan/namaz724/gps/model/DefaultLocation.java
0726039e79b235071de31758aa28dc24f3fcdfbf
[]
no_license
furkankaplan/Namaz724
898f210ea271dcbbb71e9758834653255cbeac18
5a1840896b507c256331f1d1b56647b4b137d57b
refs/heads/master
2020-04-03T19:11:42.985781
2019-05-01T14:30:13
2019-05-01T14:30:13
155,513,914
0
0
null
null
null
null
UTF-8
Java
false
false
735
java
package net.furkankaplan.namaz724.gps.model; import android.location.Location; public class DefaultLocation { private String country; private String city; private String subAdminArea; private Location location; public DefaultLocation(String country, String city, String subAdminArea, Location location) { this.country = country; this.city = city; this.subAdminArea = subAdminArea; this.location = location; } public String getCountry() { return country; } public String getCity() { return city; } public String getSubAdminArea() { return subAdminArea; } public Location getLocation() { return location; } }
82c08b43e86e0fbc2c606a7b13959505ddb76cbb
6f44b90bc56e934051274c47ec8576fab5a9c9ea
/src/main/java/org/freda/cooper4/framework/core/sequence/generator/impl/DefaultModel.java
61f166b887d7679a6e437ca02a788e0f7337d58a
[]
no_license
FredaTeam/cooper4-framework-core
2f883cb3c1180b91bf240fd6893c08027ec4ca5c
2479d6f090f8100534048fb0ba8af28394ec55c2
refs/heads/master
2021-09-06T15:55:01.959378
2018-02-08T08:16:49
2018-02-08T08:16:49
119,620,587
0
0
null
null
null
null
UTF-8
Java
false
false
302
java
package org.freda.cooper4.framework.core.sequence.generator.impl; import org.freda.cooper4.framework.core.sequence.generator.Model; /** * Created by rally on 2017/4/12. */ public class DefaultModel extends Model { public DefaultModel(String sequenceId) { super(sequenceId); } }
b2cfc3d5efa65efe54e60befcca756ca19c141f1
5392fda009cad63be12344ede33f514f9d93d558
/leetcode/src/com/lc/thread/TestCallable.java
5f919d31526960182e519fb227dc70813b0a0ea3
[]
no_license
LCcanwin/lc
4991864e368de090a32e98fc3b34587939da0664
3cac451cfa9b088df862560b6ec5fa30c8f62dd4
refs/heads/main
2023-02-04T03:34:04.973693
2020-12-15T03:10:48
2020-12-15T03:10:48
308,640,193
0
0
null
null
null
null
UTF-8
Java
false
false
945
java
package com.lc.thread; import java.util.concurrent.*; /** * @Auther: luochao * @Date: 2020/12/5 * @Description: */ public class TestCallable implements Callable<Integer> { @Override public Integer call() throws Exception { int sum = 0; for (int i = 0; i < 100; i++) { sum+=i; } return sum; } public static void main(String[] args) throws Exception { TestCallable callable = new TestCallable(); ExecutorService executor = Executors.newFixedThreadPool(1); Future<Integer> future1 = executor.submit(callable); System.out.println(future1.get()); FutureTask<Integer> futureTask = new FutureTask<>(callable); new Thread(futureTask).start(); try { System.out.println(futureTask.get()); executor.shutdown(); } catch (InterruptedException e) { throw new Exception(e); } } }
4c0faae8bd98595ad6d785cb5b77af253956ce70
42acefcf9b1da79eab6e24950b5c8245ebeb3236
/marketingMap/src/main/java/com/example/stringbootbo/service/Impl/UserServiceImpl.java
ace74bacc357b78ea224ae3546bbb48615490ce0
[]
no_license
guoxiaodong5160/MarketingMap
415571ef2e2a3f332d92bc0e4d804d87db53be42
d07be00d243ec338164a224960eb1a47ca9dc786
refs/heads/master
2020-03-28T07:44:01.803603
2018-09-08T10:15:18
2018-09-08T10:15:18
147,920,743
0
0
null
null
null
null
UTF-8
Java
false
false
566
java
package com.example.stringbootbo.service.Impl; import com.example.stringbootbo.bean.User; import com.example.stringbootbo.mapper.UserMapper; import com.example.stringbootbo.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class UserServiceImpl implements UserService { @Autowired UserMapper userMapper; @Override public User selectById(Integer id) { User user = userMapper.selectById(id); return user; } }
f573c490638d1aa4a2648a7e52f6dcc83411fca2
236f1d2f615289b432ba8baca26a3190427e37e2
/src/main/java/com/incentro/ws/models/bd/BerichtAntwoord.java
1dc4980972a22ef29dc4bb7e58a7142f5eba9fb6
[]
no_license
arnestaphorsius/city-alerts
1832432106ab82a7c0d09feb31fe007be78a772a
3f84bfb9f5f4fac717650f223607dc13ae798120
refs/heads/master
2020-04-17T02:25:17.419430
2017-03-31T13:56:01
2017-03-31T13:56:01
50,920,952
0
0
null
null
null
null
UTF-8
Java
false
false
655
java
package main.java.com.incentro.ws.models.bd; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * @author Arne Staphorsius. * @since 29-3-2016. */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "BerichtAntwoord", propOrder = { "antwoord" }) public class BerichtAntwoord { @XmlElement(name = "Antwoord", required = true) protected ResultDoc antwoord; public ResultDoc getAntwoord() { return antwoord; } public void setAntwoord(ResultDoc antwoord) { this.antwoord = antwoord; } }
9024d584bc24215f8ed89add9614caaf2ff1c9a5
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/11/11_93b759f263d0bf06573e3c7e1f8ec811d3201881/ItemMeltedMetal/11_93b759f263d0bf06573e3c7e1f8ec811d3201881_ItemMeltedMetal_t.java
8050cd98387bda118aadffdbd9504698b2c8d070
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
3,676
java
package TFC.Items; import java.util.List; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import TFC.Reference; import TFC.TerraFirmaCraft; import TFC.API.TFCTabs; import TFC.API.Enums.EnumSize; import TFC.API.Enums.EnumWeight; import TFC.API.Util.StringUtil; import TFC.Core.TFC_Core; import TFC.Core.TFC_ItemHeat; import TFC.Core.Player.PlayerInfo; import TFC.Core.Player.PlayerManagerTFC; public class ItemMeltedMetal extends ItemTerra { public ItemMeltedMetal(int i) { super(i); setMaxDamage(101); setCreativeTab(TFCTabs.TFCMaterials); this.setFolder("ingots/"); } @Override public void registerIcons(IconRegister registerer) { this.itemIcon = registerer.registerIcon(Reference.ModID + ":" + textureFolder+this.getUnlocalizedName().replace("item.", "").replace("Weak ", "").replace("HC ", "")); } @Override public EnumWeight getWeight() { return EnumWeight.HEAVY; } @Override public EnumSize getSize() { return EnumSize.SMALL; } @Override public boolean canStack() { return false; } @Override public void addInformation(ItemStack is, EntityPlayer player, List arraylist, boolean flag) { super.addInformation(is, player, arraylist, flag); } @Override public void addItemInformation(ItemStack is, EntityPlayer player, List arraylist) { if(is.getItemDamage() > 1) { arraylist.add(StringUtil.localize("gui.MeltedMetal.NotFull")); } } @Override public void onUpdate(ItemStack is, World world, Entity entity, int i, boolean isSelected) { super.onUpdate(is,world,entity,i,isSelected); if (is.hasTagCompound()) { NBTTagCompound stackTagCompound = is.getTagCompound(); //System.out.println(stackTagCompound.getFloat("temperature")); if(stackTagCompound.hasKey("temperature") && stackTagCompound.getFloat("temperature") >= TFC_ItemHeat.getMeltingPoint(is)) { if(is.getItemDamage()==0){ is.setItemDamage(1); //System.out.println(is.getItemDamage()); } } else if(is.getItemDamage()==1){ is.setItemDamage(0); //System.out.println(is.getItemDamage()); } } } @Override public boolean isDamaged(ItemStack stack) { return stack.getItemDamage() > 1; } @Override public void addExtraInformation(ItemStack is, EntityPlayer player, List arraylist) { if(TFC_ItemHeat.getIsLiquid(is)) { if (TFC_Core.showExtraInformation()) { arraylist.add(StringUtil.localize("gui.Help")); arraylist.add(StringUtil.localize("gui.MeltedMetal.Inst0")); } else { arraylist.add(StringUtil.localize("gui.ShowHelp")); } } } @Override public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) { if(itemstack.stackSize <= 0) { itemstack.stackSize = 1; } if(TFC_ItemHeat.getIsLiquid(itemstack)) { PlayerInfo pi = PlayerManagerTFC.getInstance().getPlayerInfoFromPlayer(entityplayer); pi.specialCraftingType = itemstack.copy(); entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, null); entityplayer.openGui(TerraFirmaCraft.instance, 38, world, (int)entityplayer.posX, (int)entityplayer.posY, (int)entityplayer.posZ); } return itemstack; } }
d7118cdf19a758899bbc87381287d34a00ea9c51
f84f151b3bf5c647a66887a44c4f474861608990
/AtiwWatch - core/networking/networking/GameClientListener.java
257321b2cc6b7b720cf682a0ee2a481e4c0b01ee
[ "Apache-2.0" ]
permissive
jonashammerschmidt/AtiwWatch
deaeeccd1d87b7619a31b2ba417cd069fbba914e
310663ceafcc393f3b7dd21f2e646fd65e91e2d1
refs/heads/master
2021-06-20T20:02:12.399551
2017-07-14T19:10:49
2017-07-14T19:10:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,215
java
package networking; import com.esotericsoftware.kryonet.Connection; import com.esotericsoftware.kryonet.Listener; import com.socketserver.hebe.AtiwWatch; import helper.FPSCounter; import protocol.SpecialAttack; import protocol.events.KillBullet; import protocol.events.NewBullet; import protocol.events.PlayerKilledBy; import protocol.events.Respawn; import protocol.events.SetPlayerToPos; import protocol.events.StunData; import protocol.info.TeamInformation; import protocol.message.Message; import protocol.worlddata.TerrainData; import protocol.worlddata.WorldData; public class GameClientListener extends Listener { private GameClient client; private FPSCounter ms; private long send, recieve; public GameClientListener(GameClient client) { this.client = client; this.ms = new FPSCounter(1); } @Override public void received(Connection con, Object object) { if (object instanceof WorldData) { this.recieve = System.currentTimeMillis(); this.ms.add((this.recieve - this.send) / 1000f); ((WorldData) object).ms = this.ms.getFPS(); this.client.setWorldData((WorldData) object); this.client.sendPlayerData(); this.send = System.currentTimeMillis(); } else if (object instanceof TerrainData) { this.client.setWorldTerrain((TerrainData) object); } else if (object instanceof SetPlayerToPos) { this.client.setPlayerToPos((SetPlayerToPos) object); } else if (object instanceof TeamInformation) { AtiwWatch.team = ((TeamInformation) object).team; } else if (object instanceof NewBullet) { this.client.setNewBullet((NewBullet) object); } else if (object instanceof KillBullet) { this.client.killBullet(((KillBullet) object).id); } else if (object instanceof SpecialAttack) { this.client.newSpecialAttack((SpecialAttack) object); } else if (object instanceof StunData) { this.client.stun(((StunData) object).stunned); } else if (object instanceof Respawn) { this.client.respawn(); } else if (object instanceof PlayerKilledBy) { PlayerKilledBy by = (PlayerKilledBy) object; this.client.playerGotKilled(by.killer + " killed by " + by.killed); }else if(object instanceof Message){ client.recieveMessage((Message)object); } } }
5edee2addfc5c5d15585f2a7b8761596201a33bb
feab6e6404f2999a6a961783b682e01f6d4c9cf6
/src/main/java/com/system/Service/Impl/CollegeServiceImpl.java
02fb61a16e4152ae488bb6f215c882f5681a500c
[]
no_license
lifeformg/edu_system
e011afc47dac054f40d9b89a0862b8c026dd7b8c
341830fc673df3b68c1965c015c6b7e8903d643b
refs/heads/master
2023-06-02T19:40:32.004209
2021-06-27T13:34:14
2021-06-27T13:34:14
380,748,431
0
0
null
null
null
null
UTF-8
Java
false
false
529
java
package com.system.service.impl; import com.system.entity.College; import com.system.mapper.CollegeMapper; import com.system.service.CollegeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class CollegeServiceImpl implements CollegeService { @Autowired private CollegeMapper collegeMapper; @Override public List<College> selectAllCollege() { return collegeMapper.selectAllCollege(); } }
58c91385ba974bc0e9c062e673be0ee4661a3e70
949cebaad48792637fceeace15137b00355f10a9
/trainee/Impl.java
ccbef9a9ab5ba6f9194a3903f33ad0aad4ea86cf
[]
no_license
jainis2894/nishant_niitcoding
c3e0b6246a876a17ecc70b14cd385ecd7c77510c
a7c116dc0a6faf882d29734dafc721d346d8b5a2
refs/heads/master
2021-01-01T04:33:16.686681
2017-07-14T10:56:09
2017-07-14T10:56:09
97,197,549
0
0
null
null
null
null
UTF-8
Java
false
false
174
java
class Impl implements Ainterface,Binterface { public void fn2() { System.out.println("impl class"); } public static void main(String args[]) { Impl i=new Impl(); i.fn(); } }
fc4e54341ccd1fd5d3b50149a03e3c9b4b60fcda
32ebc67435bc5f858a32702f91d1e832ec3bf7bb
/Airline Reservation System/src/com/lti/repository/AirportRepositoryImpl.java
4ecf33d292d7d740fd5047217166a5b8d056dffb
[]
no_license
janakdave555/airlineproject
eb3d35fd67a3cfcbe186a14875f785ac773c1cc7
0f1e96e3e2d9d37b7202b7e4992044c02addcd76
refs/heads/master
2022-12-23T00:16:51.240855
2019-11-26T16:40:44
2019-11-26T16:40:44
222,858,664
0
0
null
2022-12-15T23:39:04
2019-11-20T05:33:03
Java
UTF-8
Java
false
false
1,611
java
package com.lti.repository; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; import javax.transaction.Transactional; import org.springframework.stereotype.Repository; import com.lti.model.AircraftType; import com.lti.model.Airports; @Repository("airportRepository") public class AirportRepositoryImpl implements AirportRepository { @PersistenceContext EntityManager em; @Override @Transactional public Airports addAirport(Airports a) { em.persist(a); System.out.println("Airports Added"); return a; } @Override public Airports findAirport(String airport_id) { Airports a= em.find(Airports.class, airport_id); return a; } @Transactional @Override public Airports updateAirport(Airports atype) { em.persist(atype); return atype; } @Transactional @Override public void deleteAirport(Airports atype) { atype=em.merge(atype); em.remove(atype); } public Airports findAirportBySource(String city_name) { String q="select a from Airports a where a.city_name=?1"; TypedQuery<Airports> query=em.createQuery(q,Airports.class); query.setParameter(1,city_name); Airports a=query.getSingleResult(); return a; } public Airports findAirportByDestination(String city_name) { String q="select a from Airports a where a.city_name=?1"; TypedQuery<Airports> query=em.createQuery(q,Airports.class); query.setParameter(1,city_name); Airports a=query.getSingleResult(); return a; } }
30af4f18b622290bd3f7de973811bac40ebe8a9a
95e8098444048cf841ad3b1aea19f14bd61e65a9
/java/datapack/Allotmentqueue.java
b084ce1f5250ce14845611772365fef8340eb678
[]
no_license
KunalMoharkar/webapp
bb1f921a6224535a96900fefb9815c732f350989
3faf4237b8989ab1a27912f80bec27daedf2d3df
refs/heads/master
2022-04-25T04:49:40.877566
2020-04-21T16:36:03
2020-04-21T16:36:03
257,648,926
0
0
null
null
null
null
UTF-8
Java
false
false
721
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 datapack; /** * * @author kumar */ public class Allotmentqueue { private int professional_id; private int service_id; public int getProfessional_id() { return professional_id; } public void setProfessional_id(int professional_id) { this.professional_id = professional_id; } public int getService_id() { return service_id; } public void setService_id(int service_id) { this.service_id = service_id; } }
5da37458976c9bf1f0af7074c88317b78dfa3eab
1cb1fe8c5398399d3027a49dcc7d7cf495974bde
/src/main/java/com/gxhh/mysql/bank/service/ClientService.java
de59822a66a0b9e36c63322edb83ec190c609817
[]
no_license
guxinghuahuo/BankTransferSystem
2f54d7f2df78354d54f2917692de0f189164bc09
86fb3dfb3938b75fd772504e4657a62b7e46aab0
refs/heads/master
2022-06-02T05:59:30.005789
2019-12-24T12:53:21
2019-12-24T12:53:21
229,940,148
1
1
null
null
null
null
UTF-8
Java
false
false
344
java
package com.gxhh.mysql.bank.service; import com.gxhh.mysql.bank.model.Client; import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; @Service public interface ClientService { List<Client> getClientList(); Client getClientByPhone(String phone); void insertClient(Map<String, Object> map); }
c6a5123fc863e979b76c4bc579c878ee3c7e6361
95edd8e0f02ee458ddcc6c53525080312629ec10
/src/dgrp/warewolf/WareWolfHandler.java
f2ac96b78faf358df2cc6bfa9b093a754cbfbcf4
[]
no_license
butsuryo/dgrp_gm_tool
532ee25336a342033523ecb0fcefd36aa4164f79
3b723785076142b3a16690bba2377a1f354dad92
refs/heads/master
2021-01-10T12:57:59.123514
2015-11-17T09:36:36
2015-11-17T09:36:36
46,331,943
0
0
null
null
null
null
UTF-8
Java
false
false
654
java
package dgrp.warewolf; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.jface.wizard.IWizard; import org.eclipse.jface.wizard.WizardDialog; import dgrp.warewolf.wizard.WareWolfWizard; public class WareWolfHandler extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { IWizard wizard = new WareWolfWizard(); WizardDialog dialog = new WizardDialog(null, wizard); dialog.setTitle("bbbbb"); dialog.open(); return null; } }
9101882cdea894fcea4a7d3fad48770158d0c7d7
0708e30a9f951f28be3790a9e41ae20560887136
/src/main/java/com/itheima/crud_solr.java
03d62cd8a87c3563ff8c63c2f32c96c80b1aaaf4
[]
no_license
ityusijun/git2_test
8557ff31a565bbf2e9f10a0728db1868c7f14d61
c75dd6b147d05a1559543020cbdf7beee4ee37b3
refs/heads/master
2022-07-19T19:07:04.385990
2018-08-04T00:47:46
2018-08-04T00:47:46
143,486,555
0
0
null
2022-06-21T00:40:33
2018-08-04T01:00:38
Java
UTF-8
Java
false
false
929
java
package com.itheima; import org.apache.solr.client.solrj.impl.HttpSolrServer; import org.apache.solr.common.SolrInputDocument; import org.junit.Test; public class crud_solr { @Test public void testCreateIndexBySolr() throws Exception{ String baseURl="http://localhost:8080/solr/article"; HttpSolrServer solrServer = new HttpSolrServer(baseURl); SolrInputDocument document = new SolrInputDocument(); document.addField("id","1"); document.addField("title","华为手机"); document.addField("description","国产的骄傲。太牛了哈哈哈"); solrServer.add(document); solrServer.commit(); } @Test public void deleteIndexBySolr()throws Exception { String baseURl="http://localhost:8080/solr"; HttpSolrServer solrServer = new HttpSolrServer(baseURl); solrServer.deleteById("1"); solrServer.commit(); } }
50a726d61d65286edf0a67693f516372d6103fe8
231f47fabcae99711139b4f7207d65b377ed9b28
/src/Arrays/Other/MaxProduct.java
a46b1dbcc6187a663aa97ce94ee13cfa9c6777d0
[]
no_license
qingqingshu123/LeetCode
d15721c90de85956dd42f5eb61869659d384505b
1f07ba9d16b28a0a0be74b643ab266bcaaf49338
refs/heads/master
2021-01-25T08:02:33.774864
2017-06-22T06:53:48
2017-06-22T06:53:48
93,710,216
0
0
null
null
null
null
UTF-8
Java
false
false
1,750
java
package Arrays.Other; /** * Created by jixiaoqiang on 2017/6/11. */ public class MaxProduct { public static void main(String[] args) { } //主要找到负数的个数 遇到0 重新开始 不能解决 public int maxProduct(int[] nums) { if(nums == null || nums.length < 1) return 0; //从当前i开始 后面的0之前的负数的个数 int[] help = new int[nums.length]; int count = 0; for (int i = nums.length -1; i >= 0; i--) { if(nums[i] > 0) help[i] = count; else if(nums[i] < 0) help[i] = ++count; else { count=0; help[i] = 0; } } int max = Integer.MIN_VALUE; int tmp = 1; for (int i = 0; i < nums.length; i++){ if(nums[i] > 0) tmp*= nums[i]; else if(nums[i] < 0){ if(help[i] > 1) tmp*=nums[i]; else tmp = 1; }else{ tmp = 1; } max = Math.max(max, Math.abs(tmp)); } return max; } public int maxProduct1(int[] nums) { if(nums == null || nums.length < 1) return 0; int res = nums[0]; int max = nums[0]; int min = nums[0]; int maxEnd = 0; int minEnd = 0; for (int i = 0; i < nums.length; i++) { maxEnd = max * nums[i]; minEnd = min * nums[i]; max = Math.max(nums[i], Math.max(maxEnd, minEnd)); min = Math.min(nums[i], Math.min(maxEnd, minEnd)); res = Math.max(max, res); } return res; } }
032ef28411db2a2d7287da76515c97f3f87f175a
a9a903ea4ea7acba97b811285c5cc10fdc3f6193
/plugins/elasticsearch/src/test/java/com/dremio/plugins/elastic/ITTestDateTypesJavaTimeDateTime.java
f0bcbc34e1c207a87053aec878358f1007136e99
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
satanson/dremio-oss
5647409448032d6d50aa7645b00bce9623957f6b
5d615463e5d468c589c0b91bd20cbf70db3bc581
refs/heads/master
2023-07-20T20:35:12.282424
2021-07-06T16:57:27
2021-07-06T16:57:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,299
java
/* * Copyright (C) 2017-2019 Dremio Corporation * * 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.dremio.plugins.elastic; import static com.dremio.plugins.elastic.ElasticsearchType.DATE; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.concurrent.TimeUnit; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestRule; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import com.dremio.common.util.TestTools; import com.google.common.collect.ImmutableMap; @RunWith(Parameterized.class) public class ITTestDateTypesJavaTimeDateTime extends ElasticBaseTestQuery { private final String format; private final DateFormats.FormatterAndTypeJavaTime formatter; private final DateTimeFormatter dateTimeFormatter; @Rule public final TestRule TIMEOUT = TestTools.getTimeoutRule(300, TimeUnit.SECONDS); public ITTestDateTypesJavaTimeDateTime(String format) { this.format = format; this.formatter = DateFormats.FormatterAndTypeJavaTime.getFormatterAndType(format); this.dateTimeFormatter = DateTimeFormatter.ofPattern(format); } @Parameterized.Parameters public static Collection<Object[]> data() { List<Object[]> data = new ArrayList(); data.add(new Object[]{"yyyyMMdd'T'HHmmss"}); data.add(new Object[]{"yyyy-MM-dd'T'HH:mm:ss"}); data.add(new Object[]{"yyyy/MM/dd'T'HH:mm:ss"}); return data; } @Test public void runTestZonedDateTime() throws Exception { final LocalDateTime dt1 = LocalDateTime.of(LocalDate.now(), LocalTime.now(ZoneOffset.UTC)); final LocalDateTime dt2 = dt1.plusYears(1); final String value1 = dt2.atZone(ZoneOffset.UTC).format(dateTimeFormatter); final String value2 = dt2.atZone(ZoneOffset.UTC).format(dateTimeFormatter); final ElasticsearchCluster.ColumnData[] dataZonedDateTime = new ElasticsearchCluster.ColumnData[]{ new ElasticsearchCluster.ColumnData("field", DATE, ImmutableMap.of("format", format), new Object[][]{ {value1}, {value2} }) }; elastic.load(schema, table, dataZonedDateTime); final String sql = "select CAST(field AS VARCHAR) as field from elasticsearch." + schema + "." + table; testBuilder() .sqlQuery(sql) .ordered() .baselineColumns("field") .baselineValues(formatter.parse(value1, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")).toString().replace("T", " ") + ".000") .baselineValues(formatter.parse(value2, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")).toString().replace("T", " ") + ".000") .go(); } }
b7f73cbe932b2712c511cc2595d802d9bd9ab59a
5bb4a4b0364ec05ffb422d8b2e76374e81c8c979
/sdk/mediaservices/mgmt-v2019_05_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2019_05_01_preview/implementation/ListStreamingLocatorsResponseInner.java
f474946319c7b7ac2ddfe8af8da0a0d795b7f067
[ "MIT", "LicenseRef-scancode-generic-cla", "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-or-later", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
FabianMeiswinkel/azure-sdk-for-java
bd14579af2f7bc63e5c27c319e2653db990056f1
41d99a9945a527b6d3cc7e1366e1d9696941dbe3
refs/heads/main
2023-08-04T20:38:27.012783
2020-07-15T21:56:57
2020-07-15T21:56:57
251,590,939
3
1
MIT
2023-09-02T00:50:23
2020-03-31T12:05:12
Java
UTF-8
Java
false
false
1,028
java
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. */ package com.microsoft.azure.management.mediaservices.v2019_05_01_preview.implementation; import java.util.List; import com.microsoft.azure.management.mediaservices.v2019_05_01_preview.AssetStreamingLocator; import com.fasterxml.jackson.annotation.JsonProperty; /** * The Streaming Locators associated with this Asset. */ public class ListStreamingLocatorsResponseInner { /** * The list of Streaming Locators. */ @JsonProperty(value = "streamingLocators", access = JsonProperty.Access.WRITE_ONLY) private List<AssetStreamingLocator> streamingLocators; /** * Get the list of Streaming Locators. * * @return the streamingLocators value */ public List<AssetStreamingLocator> streamingLocators() { return this.streamingLocators; } }
0ec4832e6e4c364c05498f59807df2f8edce9856
4b8a176ec6140f10157e48d1631df4005c5bec24
/src/test/java/nl/han/oose/dynamicroombackend/util/AuthenticationHelperTest.java
99e15c44fd9bdedd4fe947b72a955837fa70860f
[]
no_license
Lunium/OOSE-Project-RESTService
48350b485d0294b053a49a9647249f6935b199b6
fb179436972c05febee0ec1162cc104d325dfe0d
refs/heads/master
2020-04-06T17:52:21.993946
2018-11-15T08:47:11
2018-11-15T08:47:11
157,676,320
0
0
null
null
null
null
UTF-8
Java
false
false
455
java
package nl.han.oose.dynamicroombackend.util; import org.junit.Test; import static org.junit.Assert.assertTrue; public class AuthenticationHelperTest { @Test public void RandomPinGenerator() { AuthenticationHelper helper = new AuthenticationHelper(); int g = helper.generatePinForReservation(); assertTrue("Error, value is too small", g > 99999); assertTrue("Error, value is too large", g <= 1000000); } }
efff7b35faf56ea0f6415cb676dca343274154b3
ae9e074b6289c7908f4cda836cd2ed3e520e94ea
/labs/8/Triangle.java
e670aaea4c883e541b0d588fbfe801b76405a46b
[]
no_license
dmopsick/cmpt220Mopsick
cdda26c6ae715d2f0cd28312dbeee33ad209d0a2
2d86904783d5b434836e29a8d7836c855d736b1d
refs/heads/master
2021-05-01T20:26:34.044407
2017-04-19T21:00:46
2017-04-19T21:00:46
79,248,477
0
0
null
null
null
null
UTF-8
Java
false
false
996
java
public class Triangle extends GeometricObject{ private double side1; private double side2; private double side3; public Triangle(String color, boolean filled){ side1 = 1.0; side2 = 1.0; side3 = 1.0; this.setColor(color); this.setFilled(filled); } public Triangle(double side1, double side2, double side3, String color, boolean filled){ this.side1 = side1; this.side2 = side2; this.side3 = side3; this.setColor(color); this.setFilled(filled); } /** Uses Heron's Formula to calculate Triangle area based on the * three side lengths */ public double getArea(){ double s = (side1 + side2 + side3) / 2; return Math.sqrt(s * (s - side1) * (s - side2) * (s - side3)); } /** Returns the perimeter of the triangle */ public double getPerimeter(){ return side1 + side2 + side3; } /** Prints out a string description of the triangle */ public String toString(){ return "Triangle: side1 = " + side1 + " side2 = " + side2 + " side2 = " + side3; } }
d71f9a109ec2821cd2da18cd37cc52e9f94e27ce
91affeea7bffaab3d6a2d636900b4abfaef4b776
/src/main/java/net/codestory/jajascript/jettyserver/ServerBootstrap.java
7145526f0b03a1726e8692346fe22c996ffc9e9d
[]
no_license
jmoutsinga/code-story-2013
d55a74b0f9e2f29b25d5f885ea28a19d8a79f3a6
bc7f8385becbf50bdb0b01d88a8e406c14c26973
refs/heads/master
2016-08-08T02:32:34.942438
2013-09-29T20:54:04
2013-09-29T20:54:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
211
java
package net.codestory.jajascript.jettyserver; public class ServerBootstrap { /** * @param args */ public static void main(String[] args) { new JettyServerWrapper().start(); } }
22fe22e04878c254ade0048dec19a361ee691cb6
f1794ebcfd95f50b419a1cdf8a194c0e1edbcc9d
/src/main/java/com/spring/usingconstructordepinj/SpellChecker.java
eb43d7b7c87da5b94d71e9db409e4f8a7a9c6792
[]
no_license
Madhukar-22/JavaPoc
e0267bd75b5f873682fa7b18d18e5f0a22ad210a
2ec615770ff59e9ec31c73131a0e484cd13afa37
refs/heads/master
2020-03-27T19:26:49.094526
2018-09-01T10:34:08
2018-09-01T10:34:08
146,989,481
0
0
null
null
null
null
UTF-8
Java
false
false
267
java
package com.spring.usingconstructordepinj; public class SpellChecker { public SpellChecker(){ System.out.println("Inside SpellChecker constructor." ); } public void checkSpelling() { System.out.println("Inside checkSpelling." ); } }
6b61c12127e7c10ede2b27a63d99ca5f9fbfacf4
e401d4c1b709b148d446767059581bed3c885232
/src/main/java/leecode热门100题/_19删除链表的倒数第N个结点.java
4170c696af97baa19a444a0af2761ae7caa79cb2
[]
no_license
zzsanshi/Code
cdc86beeef4715d8069ef3cdf1835556a83b617b
1b97eb8fcf67a816750914f1060b48aa12101784
refs/heads/master
2023-07-24T18:10:39.485898
2021-09-03T13:56:15
2021-09-03T13:56:15
364,813,536
0
0
null
null
null
null
UTF-8
Java
false
false
550
java
package leecode热门100题; public class _19删除链表的倒数第N个结点 { public ListNode removeNthFromEnd(ListNode head, int n) { ListNode dummy = new ListNode(0, head); ListNode first = head; ListNode second = dummy; while(n > 0) { first= first.next; n--; } while (first != null) { first = first.next; second = second.next; } second.next = second.next.next; ListNode ans = dummy.next; return ans; } }
97766bf3ec5ef8a20227a1ed39ab01dcf8c34708
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/7/7_3230a0644cc2eb4f3443367acdba0853202e8ae1/AnnotationIssueProcessor/7_3230a0644cc2eb4f3443367acdba0853202e8ae1_AnnotationIssueProcessor_s.java
43524dd489368d25dc8369629f367ca54fffb0be
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
6,913
java
/******************************************************************************* * Copyright (c) 2009 Michael Clay and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * *******************************************************************************/ package org.eclipse.xtext.ui.core.editor.validation; import java.util.Iterator; import java.util.List; import java.util.Map; import org.eclipse.core.resources.IMarker; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.emf.ecore.EValidator; import org.eclipse.jface.text.Position; import org.eclipse.jface.text.source.Annotation; import org.eclipse.jface.text.source.IAnnotationModel; import org.eclipse.jface.text.source.IAnnotationModelExtension; import org.eclipse.jface.text.source.IAnnotationModelListener; import org.eclipse.ui.texteditor.AnnotationTypeLookup; import org.eclipse.ui.texteditor.MarkerAnnotation; import org.eclipse.xtext.ui.core.MarkerTypes; import org.eclipse.xtext.ui.core.editor.XtextEditor; import org.eclipse.xtext.ui.core.editor.model.IXtextDocument; import org.eclipse.xtext.validation.Issue; import org.eclipse.xtext.validation.Issue.Severity; import com.google.common.collect.Iterators; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; /** * @author Sven Efftinge - Initial contribution and API * @author Michael Clay * @author Heiko Behrens */ public class AnnotationIssueProcessor implements IValidationIssueProcessor, IAnnotationModelListener { private final IAnnotationModel annotationModel; private AnnotationTypeLookup lookup = new AnnotationTypeLookup(); private final IXtextDocument xtextDocument; private boolean updateMarkersOnModelChange; public AnnotationIssueProcessor(IXtextDocument xtextDocument, IAnnotationModel annotationModel) { super(); this.annotationModel = annotationModel; if (annotationModel != null) annotationModel.addAnnotationModelListener(this); this.xtextDocument = xtextDocument; } public void processIssues(List<Issue> issues, IProgressMonitor monitor) { updateMarkersOnModelChange = false; List<Annotation> toBeRemoved = getAnnotationsToRemove(monitor); Multimap<Position, Annotation> positionToAnnotations = Multimaps.newArrayListMultimap(); Map<Annotation, Position> annotationToPosition = getAnnotationsToAdd(positionToAnnotations, issues, monitor); updateMarkerAnnotations(monitor); updateAnnotations(monitor, toBeRemoved, annotationToPosition); updateMarkersOnModelChange = true; } private void updateAnnotations(IProgressMonitor monitor, List<Annotation> toBeRemoved, Map<Annotation, Position> annotationToPosition) { if (monitor.isCanceled()) { return; } if (annotationModel instanceof IAnnotationModelExtension) { Annotation[] removedAnnotations = toBeRemoved.toArray(new Annotation[toBeRemoved.size()]); ((IAnnotationModelExtension) annotationModel).replaceAnnotations(removedAnnotations, annotationToPosition); } else { for (Annotation annotation : toBeRemoved) { if (monitor.isCanceled()) { return; } annotationModel.removeAnnotation(annotation); } for (Map.Entry<Annotation, Position> entry : annotationToPosition.entrySet()) { if (monitor.isCanceled()) { return; } annotationModel.addAnnotation(entry.getKey(), entry.getValue()); } } } private List<Annotation> getAnnotationsToRemove(IProgressMonitor monitor) { if (monitor.isCanceled()) { return Lists.newArrayList(); } @SuppressWarnings("unchecked") Iterator<Annotation> annotationIterator = annotationModel.getAnnotationIterator(); List<Annotation> toBeRemoved = Lists.newArrayList(); while (annotationIterator.hasNext()) { if (monitor.isCanceled()) { return toBeRemoved; } Annotation annotation = annotationIterator.next(); String type = annotation.getType(); if (isRelevantAnnotationType(type)) { if (!(annotation instanceof MarkerAnnotation)) { toBeRemoved.add(annotation); } } } return toBeRemoved; } private Map<Annotation, Position> getAnnotationsToAdd(Multimap<Position, Annotation> positionToAnnotations, List<Issue> issues, IProgressMonitor monitor) { if (monitor.isCanceled()) { return Maps.newHashBiMap(); } Map<Annotation, Position> annotationToPosition = Maps.newHashMapWithExpectedSize(issues.size()); for (Issue issue : issues) { if (monitor.isCanceled()) { return annotationToPosition; } if (issue.getOffset() != -1 && issue.getLength() != -1 && issue.getMessage() != null) { String type = lookup.getAnnotationType(EValidator.MARKER, getMarkerSeverity(issue.getSeverity())); Annotation annotation = new XtextAnnotation(type, false, xtextDocument, issue); Position position = new Position(issue.getOffset(), issue.getLength()); annotationToPosition.put(annotation, position); positionToAnnotations.put(position, annotation); } } return annotationToPosition; } private int getMarkerSeverity(Severity severity) { switch (severity) { case ERROR: return IMarker.SEVERITY_ERROR; case WARNING: return IMarker.SEVERITY_WARNING; case INFO: return IMarker.SEVERITY_INFO; } throw new IllegalArgumentException(); } private void updateMarkerAnnotations(IProgressMonitor monitor) { if (monitor.isCanceled()) { return; } Iterator<MarkerAnnotation> annotationIterator = Iterators.filter(annotationModel.getAnnotationIterator(), MarkerAnnotation.class); // every markerAnnotation produced by fast validation can be marked as deleted. // If its predicate still holds, the validation annotation will covered anyway. while (annotationIterator.hasNext() && !monitor.isCanceled()) { final MarkerAnnotation annotation = annotationIterator.next(); try { if (isRelevantAnnotationType(annotation.getType())) annotation.markDeleted(annotation.getMarker().isSubtypeOf(MarkerTypes.FAST_VALIDATION)); } catch (CoreException e) { // marker type cannot be resolved - keep state of annotation } } } private boolean isRelevantAnnotationType(String type) { return type.equals(XtextEditor.ERROR_ANNOTATION_TYPE) || type.equals(XtextEditor.WARNING_ANNOTATION_TYPE); } public void modelChanged(IAnnotationModel model) { if (updateMarkersOnModelChange) { updateMarkerAnnotations(new NullProgressMonitor()); } } }
e33e7a7151eae7e38aa55e50ca9d9a0a072370d0
5c820b57c066ed81b184439633990b7b96b10489
/src/main/java/qian/ling/yi/work/FileUtil.java
24b81bb3be5233b6261f84c85f8be02c031856e1
[]
no_license
liudebin/TestAll
4cf658335564e90011066be716c354575dcad274
ed35e2ad893581ecaffe056780adfbb655d70fef
refs/heads/master
2022-12-09T13:36:29.794418
2021-01-28T10:14:05
2021-01-28T10:14:05
73,248,143
0
2
null
2022-12-06T00:39:45
2016-11-09T03:04:07
Java
UTF-8
Java
false
false
9,675
java
package qian.ling.yi.work; import java.io.*; import java.util.*; import java.util.function.Function; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; /** * TODO * * @date: 2018/12/20. * @author: [email protected] */ public class FileUtil { public static void main(String args[]) throws Exception { // String path = "D:/ideaProjects/ces"; // String path = "D:/ideaProjects/com"; // String path = "D:/ideaProjects/rds"; String path = "D:/ideaProjects/mes"; // setFeignClient("com-app", "com"); // getFileByType(path, "Facade.java") // .forEach(file -> readLine(file, DubboToFeignUtil::refactorFacadeLine) // .ifPresent(s -> writeLine(s, file))); // // getFileByType(path, "FacadeImpl.java") // .forEach(file -> readLine(file, DubboToFeignUtil::refactorFacadeImplLine) // .ifPresent(s -> writeLine(s, file))); getFileByType(path, "Facade.java") .forEach(file -> refactorLine(file, FileUtil::response) .ifPresent(n->n.stream().filter(Objects::nonNull).forEach(System.out::println))); } public static Optional<List<String>> refactorLine(File file, Function<String, String> function) { try (FileReader fileReader = new FileReader(file); BufferedReader bufferedReader = new BufferedReader(fileReader)) { return Optional.of(bufferedReader.lines().map(function).collect(Collectors.toList())); } catch (IOException e) { e.printStackTrace(); } return Optional.empty(); } public static void writeLine(List<String> lines, File file) { File fOut = new File(file.getAbsolutePath() + ".tmp"); try (FileWriter fileWriter = new FileWriter(fOut); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter)) { lines.forEach( str -> Optional.ofNullable(str) .ifPresent(s -> bufferWriteLine(bufferedWriter, str)) ); } catch (IOException e) { e.printStackTrace(); } file.delete(); fOut.renameTo(file); } public static void write(String content, File fOut) { try (FileWriter fileWriter = new FileWriter(fOut); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter)) { bufferWriteLine(bufferedWriter, content); } catch (IOException e) { e.printStackTrace(); } } public static void appendLine(List<String> lines, File file) { // File fOut = new File(file.getAbsolutePath() + ".tmp"); try (FileWriter fileWriter = new FileWriter(file,true); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter)) { lines.forEach( str -> Optional.ofNullable(str) .ifPresent(s -> bufferWriteLine(bufferedWriter, str)) ); } catch (IOException e) { e.printStackTrace(); } // file.delete(); // fOut.renameTo(file); } private static void bufferWriteLine(BufferedWriter bufferedWriter, String str) { try { bufferedWriter.write(str + "\n"); } catch (IOException e) { e.printStackTrace(); } } private static String refactorFacadeImplLine(String line) { return Optional.of(line) .filter(l -> !l.contains("@Service")) .map(l -> facadeImplAddRestAnnotation(l) .orElseGet(() -> implAddPostMapping(line) .orElseGet(() -> getImplImport(line))) ).orElse(null); } private static String response(String line) { return Optional.of(line) .filter(l -> l.contains("Response") &&!l.contains("Response<") &&!l.contains("import")) .orElse(null); } public static String getImport(String line) { return Optional.of(line) .filter(l -> l.contains("package")) .map(l -> l.concat("\n import org.springframework.web.bind.annotation.PostMapping;") .concat("\n") .concat("import org.springframework.cloud.openfeign.FeignClient;") .concat("\n") .concat("import org.springframework.web.bind.annotation.RequestMapping;") .concat("\n") .concat("import org.springframework.web.bind.annotation.RequestParam;") .concat("\n") .concat("import org.springframework.web.bind.annotation.RequestBody;") .concat("\n")) .orElse(line); } public static String getImplImport(String line) { return Optional.of(line) .filter(l -> l.contains("package")) .map(l -> l.concat("\n import org.springframework.web.bind.annotation.RestController;") .concat("\n") .concat("import org.springframework.web.bind.annotation.RequestParam;") .concat("\n") .concat("import org.springframework.web.bind.annotation.RequestBody;") .concat("\n")) .orElse(line); } public static List<File> getFacadeOrImplList(String path, String keyWord) { List<File> facadeOrImpl = new ArrayList<>(); Arrays.stream(Objects.requireNonNull(new File(path).listFiles())) .filter(File::isDirectory) .forEach(file2 -> { collectFacadeOrImplFromDir(file2, keyWord).ifPresent(facadeOrImpl::addAll); facadeOrImpl.addAll(getFacadeOrImplList(file2.getAbsolutePath(), keyWord)); } ); return facadeOrImpl; } public static List<File> getDir(String path) { return Arrays.stream(Objects.requireNonNull(new File(path).listFiles())) .filter(f -> f.isDirectory() && !f.getName().contains(".")) .map(f -> { List<File> list = getDir(f.getAbsolutePath()); list.add(f); return list; } ).reduce((n, n1) -> { n.addAll(n1); return n; }).orElse(new ArrayList<>()); } public static List<File> getFile(File dir, String keyWord) { return Optional.of(dir) .map(File::listFiles) .map(Arrays::stream) .map(stream -> stream .filter(f -> f.getName().endsWith(keyWord) && !f.getName().contains("Ext") ) .collect(Collectors.toList()) ) .orElse(Collections.emptyList()); } public static List<File> getFileNew(File dir, Predicate<File> predicate) { return Optional.of(dir) .map(File::listFiles) .map(Arrays::stream) .map(stream -> stream .filter(predicate) .collect(Collectors.toList()) ) .orElse(Collections.emptyList()); } public static List<File> getFileByType(String path, String keyWord) { return Stream.of(getDir(path), Collections.singletonList(new File(path))) .flatMap(Collection::stream) .flatMap(n -> getFile(n, keyWord).stream()) .collect(Collectors.toList()); } public static List<File> getFileByTypeNew(String path, Predicate<File> predicate) { return Stream.of(getDir(path), Collections.singletonList(new File(path))) .flatMap(Collection::stream) .flatMap(n -> getFileNew(n, predicate).stream()) .collect(Collectors.toList()); } private static Optional<List<File>> collectFacadeOrImplFromDir(File file, String key) { return Optional.of(file).filter(n -> n.exists() && n.isDirectory()) .map(n -> Arrays.asList(Objects.requireNonNull(n.listFiles(f -> f.getName().endsWith(key + ".java") && !f.getName().contains("Ext"))))); } static Optional<String> addRequestAnnotation(String str) { return Optional.of(str.substring(0, str.indexOf("(")) .trim() .split(" ")) .filter(n -> n.length > 1).flatMap(n -> Arrays.stream(n).skip(n.length - 1) .map(m -> "\t@PostMapping(\"/" + m + "\")").findFirst()); } static Optional<String> implAddPostMapping(String line) { return Optional.of(line) .filter(l -> l.contains("(") && l.contains("public")) .map(DubboToFeignUtil::addImplRequestType); } static Optional<String> facadeInterfaceAddFeignOption(String line) { return Optional.of(line).filter(l -> l.contains("public interface")) .map(DubboToFeignUtil::facadeInterfaceAddFeign); } private static Optional<String> facadeImplAddRestAnnotation(String line) { return Optional.of(line) .filter(l -> l.contains("public class")) .map(l -> "@RestController".concat("\n ").concat(l)); } }
5aeb561e4cc2b25c8d3a0736f464f6f3f51dcce6
17fdff72b0cbd7695900b1e359b9bdc4bb1d5971
/src/interfazBuzon/PanelEvent.java
a252405c31f4e74d6be1df7b89915131b2c2b283
[]
no_license
DiegoAmezquita/ProgramaSAI
5483f6ef5fcb3e96820272d571889c71c2119341
c8e30062480dca132c25ce42163903f933bec906
refs/heads/master
2021-01-10T20:38:18.691504
2013-03-15T03:51:34
2013-03-15T03:51:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,539
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package interfazBuzon; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import Interfaz.FrameMain; /** * * @author Diego */ public class PanelEvent extends JPanel { private JLabel labelUsers; private JComboBox comboUsers; private JTextArea areaDescriptionNewEven; private JScrollPane scrollPaneDescripcionNewEven; private JLabel labelDescriptionNewEven; private JButton buttonCancelar; private JButton buttonGuardar; private JLabel labelNextEvent; private JComboBox comboNextEvent; public PanelEvent(FrameMain frameMain) { setLayout(null); labelUsers = new JLabel("Usuarios"); labelUsers.setBounds(20, 20, 100, 30); add(labelUsers); comboUsers = new JComboBox(); comboUsers.setBounds(140, 20, 200, 30); add(comboUsers); labelNextEvent = new JLabel("Siguiente Evento"); labelNextEvent.setBounds(20, 55, 100, 30); add(labelNextEvent); comboNextEvent = new JComboBox(); comboNextEvent.setBounds(140, 55, 200, 30); add(comboNextEvent); labelDescriptionNewEven = new JLabel("Motivo Asignacion:"); labelDescriptionNewEven.setBounds(20, 90, 150, 30); add(labelDescriptionNewEven); areaDescriptionNewEven = new JTextArea(); scrollPaneDescripcionNewEven = new JScrollPane(areaDescriptionNewEven); scrollPaneDescripcionNewEven.setBounds(140, 90, 200, 50); add(scrollPaneDescripcionNewEven); buttonGuardar = new JButton("GUARDAR"); buttonGuardar.setBounds(20, 200, 100, 30); buttonGuardar.addActionListener(frameMain); buttonGuardar.setActionCommand("GUARDAREVENTOBUZON"); add(buttonGuardar); buttonCancelar = new JButton("CANCELAR"); buttonCancelar.setBounds(150, 200, 100, 30); buttonCancelar.addActionListener(frameMain); buttonCancelar.setActionCommand("CANCELAREVENTO"); add(buttonCancelar); bloquearBotones(); } public void limpiarCampos() { comboNextEvent.setSelectedIndex(0); comboUsers.setSelectedIndex(0); areaDescriptionNewEven.setText(""); } public void bloquearBotones(){ buttonCancelar.setEnabled(false); buttonGuardar.setEnabled(false); } public void desbloquearBotones(){ buttonCancelar.setEnabled(true); buttonGuardar.setEnabled(true); } public JTextArea getAreaDescriptionNewEven() { return areaDescriptionNewEven; } public void setAreaDescriptionNewEven(JTextArea areaDescriptionNewEven) { this.areaDescriptionNewEven = areaDescriptionNewEven; } public JButton getButtonCancelar() { return buttonCancelar; } public void setButtonCancelar(JButton buttonCancelar) { this.buttonCancelar = buttonCancelar; } public JButton getButtonGuardar() { return buttonGuardar; } public void setButtonGuardar(JButton buttonGuardar) { this.buttonGuardar = buttonGuardar; } public JComboBox getComboNextEvent() { return comboNextEvent; } public void setComboNextEvent(JComboBox comboNextEvent) { this.comboNextEvent = comboNextEvent; } public JComboBox getComboUsers() { return comboUsers; } public void setComboUsers(JComboBox comboUsers) { this.comboUsers = comboUsers; } public JLabel getLabelDescriptionNewEven() { return labelDescriptionNewEven; } public void setLabelDescriptionNewEven(JLabel labelDescriptionNewEven) { this.labelDescriptionNewEven = labelDescriptionNewEven; } public JLabel getLabelNextEvent() { return labelNextEvent; } public void setLabelNextEvent(JLabel labelNextEvent) { this.labelNextEvent = labelNextEvent; } public JLabel getLabelUsers() { return labelUsers; } public void setLabelUsers(JLabel labelUsers) { this.labelUsers = labelUsers; } public JScrollPane getScrollPaneDescripcionNewEven() { return scrollPaneDescripcionNewEven; } public void setScrollPaneDescripcionNewEven(JScrollPane scrollPaneDescripcionNewEven) { this.scrollPaneDescripcionNewEven = scrollPaneDescripcionNewEven; } }
[ "German@German-PC" ]
German@German-PC
aab07b62fd6be2e1ff3ff24cf1e90fff6901d5d4
7fcb1efdb5678c16eaedcf380ba28579e2d90c23
/src/com/radaee/reader/ReaderController.java
99808c75bc06694bffaa7d4b4f273d3b36670ed3
[]
no_license
jeffwdg/ProX_v2
bc11fc5c18eb7463f437133c4191803c7fa18695
bca5ae0a37d6f5d40aed14a4122bd255d69031bc
refs/heads/master
2016-09-06T05:04:59.900165
2014-03-08T15:49:16
2014-03-08T15:49:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,467
java
package com.radaee.reader; import android.content.Context; import android.graphics.Canvas; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import com.radaee.pdf.Document; import com.radaee.view.*; import com.radaee.view.PDFView.PDFPos; /** * Created with IntelliJ IDEA. * User: Erick * Date: 1/21/13 * Time: 11:12 PM * To change this template use File | Settings | File Templates. */ public class ReaderController extends View implements PDFView.PDFViewListener { PDFView m_pdv; public boolean m_lock_resize = false; private int m_save_w = 0; private int m_save_h = 0; private int m_cur_page = 0; public ReaderController(Context context) { super(context); } public ReaderController(Context context, AttributeSet attrs) { super(context, attrs); } protected void onDraw(Canvas canvas) { m_pdv.vDraw(canvas); // Paint paint = new Paint(); // paint.setARGB(255, 255, 0, 0); // canvas.drawText("myText", 20, 20, paint); } public void open(Document doc) { m_pdv = new PDFViewDual(getContext()); m_pdv.vOpen(doc, 4, 0xFFCCCCCC, this); invalidate(); } @Override public boolean onTouchEvent(MotionEvent event) { if( m_pdv != null ) return m_pdv.vTouchEvent(event); else return true; } protected void onSizeChanged (int w, int h, int oldw, int oldh) { m_save_w = w; m_save_h = h; if( m_pdv != null && !m_lock_resize ) m_pdv.vResize(w, h); } public void close() { if (m_pdv != null) { m_pdv.vClose(); } m_pdv = null; } public void OnPDFPosChanged(PDFPos pos) { if( pos != null ) m_cur_page = pos.pageno; } public boolean OnPDFDoubleTapped(float x, float y) { return false; } public boolean OnPDFSingleTapped(float x, float y) { return false; } public void OnPDFLongPressed(float x, float y) { } public void OnPDFShowPressed(float x, float y) { } public void OnPDFSelectEnd() { } public void OnPDFFound(boolean found) { } public void OnPDFInvalidate(boolean post) { if( post ) postInvalidate(); else invalidate(); } public void OnPDFPageDisplayed(Canvas canvas, PDFVPage vpage) { } @Override public void computeScroll() { if( m_pdv == null ) return; m_pdv.vComputeScroll(); } }
294b68621fe1bfd1d373c7516722b48dd95336fa
5e7498043736edfa19955e3ccd511e939523d700
/src/main/java/com/sher/mycrawler/repository/UserRepository.java
67fbf18da8c041108e99a5f2a020dbb1d25b46f1
[]
no_license
cloudSher/crawler
2e8502b58943cd30c9b1dfd6bbf92f5fce03333a
389c8c565376878852da6471160dce7bfb01966d
refs/heads/master
2020-05-21T08:40:30.461720
2016-08-24T09:24:39
2016-08-24T09:24:39
62,553,233
0
0
null
null
null
null
UTF-8
Java
false
false
751
java
package com.sher.mycrawler.repository; import com.sher.mycrawler.domain.User; import java.time.ZonedDateTime; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; import java.util.Optional; /** * Spring Data JPA repository for the User entity. */ public interface UserRepository extends JpaRepository<User, Long> { Optional<User> findOneByActivationKey(String activationKey); List<User> findAllByActivatedIsFalseAndCreatedDateBefore(ZonedDateTime dateTime); Optional<User> findOneByResetKey(String resetKey); Optional<User> findOneByEmail(String email); Optional<User> findOneByLogin(String login); Optional<User> findOneById(Long userId); @Override void delete(User t); }
be7a4a94d772ba91801e35664e0748d3f9c0be83
6dd1247159a1ef29e94d4627fd340310afd77a24
/Java/URI_BEECROWD/DATA_STRUCTURES_AND_LIBRARIES/P1260_Hardwood_Species.java
ee3709d9c09acccd2f3b167a6a82495775fad621
[]
no_license
Boombarm/onlinejudge
3c34c202d863cf707fb1f88ff4e9b767277d3acb
763fa2e77c92467441753c0d0e60c1b8b1114c03
refs/heads/master
2023-09-01T22:44:37.154364
2023-08-24T13:21:14
2023-08-24T13:21:14
122,501,259
1
0
null
null
null
null
UTF-8
Java
false
false
1,956
java
/** * @author Teerapat Phokhonwong * @Onlinejudge: URI Online Judge * @Problem: 1260 Hardwood Species * @Link: https://www.urionlinejudge.com.br/judge/en/problems/view/1260 * @Status: Accepted 22/10/2015 - 19:52:19 Runtime:0.724s * @Solution: Counting and Calculate Average */ package URI.Accepted.DATA_STRUCTURES_AND_LIBRARIES.sourcecode; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.Map; import java.util.TreeMap; public class P1260_Hardwood_Species { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); DecimalFormat df = new DecimalFormat("0.0000"); df.setRoundingMode(RoundingMode.HALF_EVEN); int n = Integer.parseInt(br.readLine()); br.readLine(); for (int i = 0; i < n; i++) { String specie = ""; int countSpecie = 0; Map<String, Integer> species = new TreeMap(); while ((specie = br.readLine()) != null) { if (specie.isEmpty()) { break; } species.put(specie, species.get(specie) == null ? 1 : species.get(specie) + 1); countSpecie++; } for (Map.Entry<String, Integer> now : species.entrySet()) { String key = now.getKey(); Integer value = now.getValue(); bw.append(key + " " + df.format((double) (value * 100.0 / countSpecie))); bw.newLine(); bw.flush(); } if (i < n - 1) { bw.newLine(); bw.flush(); } } } }
7842fb03a7715754c7523b365cba9fac3b8903eb
76d08120a4642a5641207f95ec312c390f8c8563
/offer/src/main/java/offer/T21.java
e4c4bb9b5f503b2db65e4a5cec71907466d30523
[]
no_license
Lydiawin/OfferExercise
d366f3b4b9cd6357dab93e6c86dc89ce0c0a4f88
d6e9abb113419608951598c91bd0f07527a863da
refs/heads/master
2020-04-24T18:02:24.307915
2019-03-28T08:26:41
2019-03-28T08:26:41
172,167,456
2
0
null
2019-03-28T08:26:45
2019-02-23T03:39:25
Java
UTF-8
Java
false
false
1,352
java
package offer; /* * 定义栈的数据结构,在该类型中实现一个能够得到的最小的元素的min函数 * 在该栈中,调用pop、push、以及min的时间复杂度都是O(1) * */ import java.util.Stack; /* * 使用辅助栈,存的是每次压栈的最小元素 * 辅助栈的栈顶存的始终是最小的元素值 * */ public class T21 { public class Solution { Stack<Integer> stack = new Stack(); Stack<Integer> minStack = new Stack(); public void push(int node) { stack.push(node); if (minStack.isEmpty() || node < minStack.peek()) { minStack.push(node); } else { minStack.push(minStack.peek()); } } public void pop() { if (!stack.isEmpty() && !minStack.isEmpty()){ stack.pop(); minStack.pop(); } } public int top() { if (stack.isEmpty()){ throw new RuntimeException("No element in stack."); } return stack.peek(); } public int min() { if (minStack.isEmpty()){ throw new RuntimeException("No element in stack."); } return minStack.peek(); } } }
d77345299c8ea49d9274c97ca79c480c873553b0
42ffeda5c5713497f1eeff75e95ebef7ed15cc3b
/src/test/java/com/redis/test/PubSubTest.java
73c6d2d164182ec389c5213a5c9375e4413138d0
[]
no_license
helloworldtang/redis-web
f63135e2b0978ef546cd9fa60245832bb3a3ad99
664bee991837ffcf96601e04ce08c612c9ad1452
refs/heads/master
2020-04-02T05:45:11.468332
2016-06-25T15:24:49
2016-06-25T15:24:49
61,949,114
2
0
null
null
null
null
UTF-8
Java
false
false
766
java
/** * 2014-7-2 * PubSybTest.java * author:Edwin Chen */ package com.redis.test; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.redis.service.impl.PubServiceImpl; /** * @author new * */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:WEB-INF/config/spring-context.xml", "classpath:WEB-INF/config/redis-context.xml"}) public class PubSubTest { @Autowired private PubServiceImpl pubservice ; @Test public void PubTest() { String message = "chenhaoran2"; pubservice.Publisher(message); } }
59a88cdad170f79654c30353bd499b6732e44bca
13e2b78f03c00926c4ea247ccfc1df421159ec3c
/src/test/java/com/github/mmolimar/kafka/connect/fs/task/TaskFsTestConfig.java
1efe3b4b5e8f559ee2135152406142d3f335c750
[ "Apache-2.0" ]
permissive
mmolimar/kafka-connect-fs
80c1000dd0a9861b35ab08b12dea882db53e21d9
7adc7574d04cd2ed20b70f4f1582669477b93f76
refs/heads/master
2022-11-15T01:07:49.567199
2021-12-19T22:30:45
2021-12-19T22:30:45
84,784,018
118
85
Apache-2.0
2022-11-07T07:27:02
2017-03-13T04:27:04
Java
UTF-8
Java
false
false
2,794
java
package com.github.mmolimar.kafka.connect.fs.task; import com.github.mmolimar.kafka.connect.fs.AbstractHdfsFsConfig; import com.github.mmolimar.kafka.connect.fs.AbstractLocalFsConfig; import com.github.mmolimar.kafka.connect.fs.FsSourceTask; import com.github.mmolimar.kafka.connect.fs.FsTestConfig; import org.apache.hadoop.fs.Path; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.UUID; interface TaskFsTestConfig extends FsTestConfig { FsSourceTask getTask(); void setTask(FsSourceTask task); Map<String, String> getTaskConfig(); void setTaskConfig(Map<String, String> taskConfig); List<Path> getDirectories(); } class LocalFsConfig extends AbstractLocalFsConfig implements TaskFsTestConfig { private FsSourceTask task; private Map<String, String> taskConfig; private List<Path> directories; @Override public void init() throws IOException { directories = new ArrayList<Path>() {{ add(new Path(getFsUri().toString(), UUID.randomUUID().toString())); add(new Path(getFsUri().toString(), UUID.randomUUID().toString())); }}; for (Path dir : directories) { getFs().mkdirs(dir); } } @Override public FsSourceTask getTask() { return task; } @Override public void setTask(FsSourceTask task) { this.task = task; } @Override public Map<String, String> getTaskConfig() { return taskConfig; } @Override public void setTaskConfig(Map<String, String> taskConfig) { this.taskConfig = taskConfig; } @Override public List<Path> getDirectories() { return directories; } } class HdfsFsConfig extends AbstractHdfsFsConfig implements TaskFsTestConfig { private FsSourceTask task; private Map<String, String> taskConfig; private List<Path> directories; @Override public void init() throws IOException { directories = new ArrayList<Path>() {{ add(new Path(getFsUri().toString(), UUID.randomUUID().toString())); add(new Path(getFsUri().toString(), UUID.randomUUID().toString())); }}; for (Path dir : directories) { getFs().mkdirs(dir); } } @Override public FsSourceTask getTask() { return task; } @Override public void setTask(FsSourceTask task) { this.task = task; } @Override public Map<String, String> getTaskConfig() { return taskConfig; } @Override public void setTaskConfig(Map<String, String> taskConfig) { this.taskConfig = taskConfig; } @Override public List<Path> getDirectories() { return directories; } }
6c887c2239bdb5ecf32a72c44f7029b72a202795
04e3733d86dcdeec8f0f8f6f858389901a1a2ce9
/src/main/java/br/com/pirigotes/quiz/service/AnswerService.java
a31fd7a22560d5c603fd1f0925291921cd1b6d56
[]
no_license
TenorioStephano/quiz
610d9184a6e93e5d2b98ad41b99246a86ea1728c
0ecd60db7f965af5aa3d180ec864e90df7eab316
refs/heads/master
2021-08-23T03:47:56.504387
2017-12-03T02:04:40
2017-12-03T02:04:40
112,892,364
0
0
null
null
null
null
UTF-8
Java
false
false
529
java
package br.com.pirigotes.quiz.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import br.com.pirigotes.quiz.model.Answer; import br.com.pirigotes.quiz.repository.AnswerRepository; @Service public class AnswerService { @Autowired private AnswerRepository answerRepository; public boolean isCorrectAnswer(Long id) { Answer answer = answerRepository.findOne(id); if(answer != null) { return answer.isCorrect(); }else { return false; } } }
3d3cd0dff55f2eae30dd617bf280526c29f07228
83e4b87392c8370711ead95b26fcb3722f5e1f4c
/src/main/java/com/supermarket/service/support/GoodsService.java
8ec672bc94d0b997b455acb528effd9afcac8bb6
[ "MIT" ]
permissive
c3b2a7/sms
191c60b50458aaed8dc0c06efb231fe880fcbc8c
c00f886d30ce67d7b1221258b1a0cb9c7a25024d
refs/heads/master
2023-07-17T05:51:18.638727
2020-11-29T12:21:54
2020-11-29T12:21:54
198,813,804
0
0
null
null
null
null
UTF-8
Java
false
false
1,319
java
package com.supermarket.service.support; import com.supermarket.entity.Goods; import com.supermarket.mapper.GoodsMapper; import com.supermarket.service.AbstractService; import org.apache.ibatis.session.SqlSession; import java.sql.SQLException; import java.util.List; /** * @ClassName GoodsService * @Description < * @Author Liar * @Date 2019/8/27 18:38 */ public class GoodsService extends AbstractService implements GoodsMapper { private GoodsMapper mapper; public GoodsService() { mapper = getMapper(GoodsMapper.class); } public GoodsService(SqlSession session) { super(session); mapper = session.getMapper(GoodsMapper.class); } @Override public Goods getGoodsById(int id) throws SQLException { return mapper.getGoodsById(id); } @Override public List<Goods> getAllGoods() throws SQLException { return mapper.getAllGoods(); } @Override public void insertGoods(Goods goods) throws SQLException { mapper.insertGoods(goods); } @Override public void deleteGoodsById(int id) throws SQLException { mapper.deleteGoodsById(id); } @Override public void updateGoods(Goods goods) throws SQLException { mapper.updateGoods(goods); } }
2da2eb37d4925190801f2893a87cbf17a803c884
70c8125675124287dcf376789a51416a7e24acee
/rest1/src/main/java/rest/AnimalsDemo.java
ce0d47f8ee55f194e90b0c070b6005c268f0273f
[]
no_license
MarcusJyl/Week1
52cc856ceb025aad70a930a9a96542e68e577c1a
b2b8b293235017cd4ed617776dec2d9f19bab6c5
refs/heads/master
2022-12-09T20:39:20.854005
2020-08-30T17:02:28
2020-08-30T17:02:28
291,257,087
0
0
null
null
null
null
UTF-8
Java
false
false
1,684
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 rest; import com.google.gson.Gson; import javax.ws.rs.core.Context; import javax.ws.rs.core.UriInfo; import javax.ws.rs.Produces; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PUT; import javax.ws.rs.core.MediaType; import model.AnimalNoDB; /** * REST Web Service * * @author Marcus */ @Path("dyr") public class AnimalsDemo { @Context private UriInfo context; private AnimalNoDB animal = new AnimalNoDB("duck","quack"); /** * Creates a new instance of AnimalsDemo */ public AnimalsDemo() { } /** * Retrieves representation of an instance of rest.AnimalsDemo * @return an instance of java.lang.String */ @GET @Produces(MediaType.TEXT_PLAIN) public String getJson() { return "vuf (message from a dog)"; } @GET @Path("animals_list") @Produces(MediaType.APPLICATION_JSON) public String getJson2 () { return "\"[\\\"Dog\\\", \\\"Cat\\\", \\\"Mouse\\\", \\\"Bird\\\"]\""; } @GET @Path("/animal") @Produces(MediaType.APPLICATION_JSON) public String getJson3(){ return new Gson().toJson(animal); } /** * PUT method for updating or creating an instance of AnimalsDemo * @param content representation for the resource */ @PUT @Consumes(MediaType.APPLICATION_JSON) public void putJson(String content) { } }
[ "marcusravn1996'gmail.com" ]
marcusravn1996'gmail.com
d5eab9aebdf4e272b24df149e6c770a424cc1924
4a7cb14aa934df8f362cf96770e3e724657938d8
/MFES/ATS/Project/structuring/projectsPOO_1920/23/ProjetoPOO/exTransportadoraDoesNotExist.java
399fa91c5f11875b8a0e7098ab12f558a7ff86f7
[]
no_license
pCosta99/Masters
7091a5186f581a7d73fd91a3eb31880fa82bff19
f835220de45a3330ac7a8b627e5e4bf0d01d9f1f
refs/heads/master
2023-08-11T01:01:53.554782
2021-09-22T07:51:51
2021-09-22T07:51:51
334,012,667
1
1
null
null
null
null
UTF-8
Java
false
false
241
java
// Exceção para impedir a realização de uma entrega com uma transportadora inexistente public class exTransportadoraDoesNotExist extends Exception { public exTransportadoraDoesNotExist(String message) { super(message); } }
12416df69633d624d71344454f7870acd19503fb
85a37bd26a020a7943d503cbc9bf6c92c39cfc6a
/TestWebService/src/test/java/sxs/xas/bqq/hqz/yjgc/myw/TestWebServiceApplicationTests.java
88b3609130dec91f8b3ac9146b4f2677f46b1304
[]
no_license
endloops/spring-cloud
aa285d40d7ee546222a7dd5d497b3853545f7f4b
e1bd08286ad242cd958ec467dd68c480ed998fdd
refs/heads/master
2022-07-18T15:28:39.402353
2019-06-11T02:09:27
2019-06-11T02:09:27
120,439,454
3
1
null
2022-06-30T20:09:37
2018-02-06T10:35:17
JavaScript
UTF-8
Java
false
false
349
java
package sxs.xas.bqq.hqz.yjgc.myw; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class TestWebServiceApplicationTests { @Test public void contextLoads() { } }
185e1659de478b27fdc80ccc310aaeb59c54b06e
e4539e39ec786694fe6522e68283c24446490bf0
/eureak/src/main/java/pro/yhl/eureak/EureakApplication.java
9c20a084851e41b97d6f7d0b8e6a6b83164cbcba
[]
no_license
hailiangyuan/SpringCloudDemo
7c25e59918fc8bdda55f237f9698176644280b45
e26bb7baf9270bb943ae5ab0568e092df12aee59
refs/heads/master
2020-04-15T14:46:10.387743
2019-01-07T15:50:12
2019-01-07T15:50:12
164,766,938
0
0
null
null
null
null
UTF-8
Java
false
false
413
java
package pro.yhl.eureak; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @EnableEurekaServer @SpringBootApplication public class EureakApplication { public static void main(String[] args) { SpringApplication.run(EureakApplication.class, args); } }
3cc7e9ad1a9f33cf38d487e9e9c1978e71048c46
7871109084b62e2f4c2e403c7d9ecb29f97755ec
/demo/src/main/java/com/yanzhenjie/definebehavior/adapter/ListRecyclerAdapter.java
eadac6161189e9a90a54901f1f84d682b43202d7
[]
no_license
shaycormac/DayDayUp
c5b84de19184cff1f2ac74acec520671841feaa5
3f9a658b9be0b0d6c6965d8133ad1b181a42a568
refs/heads/master
2021-08-19T19:45:00.622892
2017-11-27T08:35:40
2017-11-27T08:35:40
112,169,968
0
0
null
null
null
null
UTF-8
Java
false
false
2,105
java
/* * Copyright 2016 Yan Zhenjie * * 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.yanzhenjie.definebehavior.adapter; import android.support.v7.widget.RecyclerView.Adapter; import android.support.v7.widget.RecyclerView.ViewHolder; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.yanzhenjie.definebehavior.R; import java.util.List; /** * Created on 2016/7/14. * * @author Yan Zhenjie. */ public class ListRecyclerAdapter extends Adapter<ListRecyclerAdapter.DefineViewHolder> { private List<String> list; public ListRecyclerAdapter(List<String> list) { this.list = list; } @Override public int getItemCount() { return list == null ? 0 : list.size(); } @Override public void onBindViewHolder(DefineViewHolder viewHolder, int position) { viewHolder.setData(list.get(position)); } @Override public DefineViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); View view = layoutInflater.inflate(R.layout.item, parent, false); return new DefineViewHolder(view); } static class DefineViewHolder extends ViewHolder { TextView tvTitle; public DefineViewHolder(View itemView) { super(itemView); tvTitle = (TextView) itemView.findViewById(R.id.tv_title); } public void setData(String data) { tvTitle.setText(data); } } }
4b4e811e983e2e0e5b8631a463db4b379ef3a49e
2fcf546d3cebe08e37ffebae48185a1057829bcf
/src/test/java/com/bridgeLabz/carInvoiceGenerator/InvoiceServiceTest.java
8af7638c2c22b0693732ad045485033d68a330c9
[]
no_license
Ajaybarath/CarInvoiceGenerator
cedd833bf6886e7141709204cdaf96659d1d8686
c2a14ab1a73d6765c5b4e18b9c2c1b9b847492ce
refs/heads/master
2023-08-15T01:13:49.484340
2021-09-22T12:07:01
2021-09-22T12:07:01
409,165,246
0
0
null
null
null
null
UTF-8
Java
false
false
2,329
java
package com.bridgeLabz.carInvoiceGenerator; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; public class InvoiceServiceTest { @Test public void calculateFareAndCompare() { InvoiceGenerator invoiceGenerator = new InvoiceGenerator(); double distance = 2.0; int time = 5; double fare = invoiceGenerator.calculateFare(distance, time, Ride.RideType.NORMAL); Assertions.assertEquals(25, fare); } @Test public void calculateFareForMinimumDistanceAndTime() { InvoiceGenerator invoiceGenerator = new InvoiceGenerator(); double distance = 0.1; int time = 1; double fare = invoiceGenerator.calculateFare(distance, time, Ride.RideType.NORMAL); Assertions.assertEquals(5, fare); } @Test public void givenMultipleRidesReturnInvoiceSummary() { Ride[] rides = { new Ride(2.0, 5), new Ride(0.1, 1) }; InvoiceSummary invoiceSummary = new InvoiceGenerator().calculateFare(rides); InvoiceSummary expectedInvoiceSummary = new InvoiceSummary(2, 30); Assertions.assertEquals(expectedInvoiceSummary, invoiceSummary); } @Test public void givenUserIdGetInvoiceSummaryForAllRides() { int userId = 123; RideRepository rideRepository = new RideRepository(userId); rideRepository.addRide(new Ride(2.0, 5)); rideRepository.addRide(new Ride(0.1, 1)); InvoiceSummary invoiceSummary = new InvoiceGenerator().calculateFare(rideRepository); InvoiceSummary expectedInvoiceSummary = new InvoiceSummary(2, 30); Assertions.assertEquals(expectedInvoiceSummary, invoiceSummary); } @Test public void givenUserIdGetInvoiceSummaryForAllRidesOfPremiumAndNormalCategory() { int userId = 123; RideRepository rideRepository = new RideRepository(userId); rideRepository.addRide(new Ride(2.0, 5, Ride.RideType.NORMAL)); rideRepository.addRide(new Ride(0.1, 1, Ride.RideType.PREMIUM)); InvoiceSummary invoiceSummary = new InvoiceGenerator().calculateFare(rideRepository); InvoiceSummary expectedInvoiceSummary = new InvoiceSummary(2, 45); Assertions.assertEquals(expectedInvoiceSummary, invoiceSummary); } }
b83c1173ee50b5e431540dd6d4797635d8853fb5
debead707679ff027658863b73224e8a921cfd49
/src/java_chap18/Q0603_03.java
b3598f851a56721d248a37ce840ca2ab2eec2200
[]
no_license
sde3300/java_chap18
5850cad83f0b0b0de5ab9d24a09c876d485da645
73dd5904d124464eab6e1c39ea0f891997d10a1d
refs/heads/master
2023-05-17T03:06:25.104668
2021-06-03T07:03:17
2021-06-03T07:03:17
372,419,873
0
0
null
null
null
null
UTF-8
Java
false
false
3,576
java
package java_chap18; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Scanner; //문제 3) employees 테이블의 정보를 조회하는 프로그램을 작성하세요 //* 콘솔에서 사용자 정보를 입력하여 데이터를 조회 //* 연속으로 계속 조회할 수 있어야하며, 'exit'이라는 명령어 입력 시 프로그램 종료 //* 입력 정보 : 사원번호 //* 출력 정보 : 사원번호, 이름, 성씨, 성별, 입사일 public class Q0603_03 { final static String JDBC_DRIVER = "com.mysql.cj.jdbc.Driver"; final static String DB_URL = "jdbc:mysql://localhost:3306/testdb1?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC"; public static void main(String[] args) { String userId = "tester1"; String userPw = "asdf1234"; // 사용자가 입력을 받기 위한 Scanner 클래스 타입의 객체 생성 Scanner sc = new Scanner(System.in); Connection conn = null; Statement stmt = null; // SELCET 명령어 사용 시 결과값을 받아오는 데이터 타입 ResultSet rs = null; try { Class.forName(JDBC_DRIVER); conn = DriverManager.getConnection(DB_URL, userId, userPw); if (conn.isClosed()) { System.out.println("데이터 베이스에 연결되지 않았습니다."); System.exit(0); } System.out.println("데이터 베이스에 연결되었습니다.\n"); // 사원 번호 입력 부분을 무한 반복함 while (true) { System.out.println("조회할 사원의 사원번호를 입력하세요 : "); // 사용자에게 사원번호를 입력받음 // exit 문자열을 입력 받을 경우를 생각하여 nextInt()가 아닌 nextLine()을 사용 String strNumber = sc.nextLine(); if (strNumber.equals("exit")) { System.out.println("프로그램을 종료합니다."); } else { // Integer 클래스는 기본 데이터 타입인 int의 랩핑 클래스임 // parseInt() : 매개변수로 입력받은 숫자인 문자열을 정수로 변환 int empNumber = Integer.parseInt(strNumber); String query = "SELECT emp_no, fisrt_name, last_name, gender, hire_date, FROM employees "; // Statement를 사용 시 쿼리문에 변수를 직접 입력해야 함 query += "WHERE emp_no = " + empNumber + " "; stmt = conn.createStatement(); rs = stmt.executeQuery(query); while (rs.next()) { String empNo = rs.getString("emp_no"); String birthDate = rs.getString("birth_date"); String firstName = rs.getString("first_name"); String lastName = rs.getString("last_name"); String gender = rs.getString("gender"); String hireDate = rs.getString("hire_date"); System.out.println("사원 번호 : " + empNo + "\n사원 생일 : " + birthDate + "\n사원 이름 : " + firstName + "\n사원 성씨: " + lastName+ "\n사원 성별: " + gender + "\n사원 입사일 : " + hireDate + "\n\n-------------\n"); } } } } catch (SQLException e) { System.out.println("데이터 베이스 사용 시 오류가 발생했습니다."); } catch (Exception e) { System.out.println("데이터 베이스 연결시 오류가 발생했습니다."); } finally { try { if (rs != null) { rs.close(); } if (stmt != null) { stmt.close(); } if (conn != null) { conn.close(); } System.out.println("데이터 베이스 연결이 종료되었습니다."); } catch (Exception e) { } } } }
e64da25739411bd443358b4d7c129291e52a56eb
fbbe760bb7d4e2296fbcedb8acd5566c28b3528d
/shop/src/cn/it/shop/service/RoleService.java
c2ef3f62f714479a80907a7fd4e71a5fd2816d67
[]
no_license
LeiDingDing/WebRepository
4c650b3d1b1265fe888a640874615060aa0935e8
e53f708ea38c8005b972c093a4e3f823e5ea45c9
refs/heads/master
2020-12-02T19:20:23.560762
2017-07-05T14:21:24
2017-07-05T14:21:24
96,326,501
0
0
null
null
null
null
UTF-8
Java
false
false
630
java
package cn.it.shop.service; import java.util.List; import java.util.Set; import cn.it.shop.model.Role; /** * * @Title: CategoryService.java * @Package cn.it.shop.service * @Description: TODO(角色的业务逻辑) * @author http://www.itcast.cn/ 传智播客 * @date 2014-7-7 下午2:32:40 * @version V1.0 */ public interface RoleService extends BaseService<Role> { public List<Role> query(String name, int page, int rows); public Long count(String name); public void deleteByIds(String ids); public Role getJoinPrvilege(int id); public int[] getRoleId(Set<Role> roleSet); }
87e58e7dc7a558486d6282da213312218ce45d77
376ec1f7589736e7be964691cf2599453564c2ff
/Backend_version_2/shopping/src/main/java/com/shopping/controller/CartController.java
d1f7a8a9349cd453921a3e4db1a0cff59cb04930
[]
no_license
NguyenVanTien99/Tshop
c9c8ac59a1391d2ad250b7ec99592fd500f1ce9b
18b6052cc1734874264a6240860d0ed40a6207a2
refs/heads/main
2023-08-22T16:41:29.801005
2021-10-06T04:30:57
2021-10-06T04:30:57
414,055,033
0
0
null
null
null
null
UTF-8
Java
false
false
789
java
package com.shopping.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.shopping.dto.CartDTO; import com.shopping.services.CartService; @CrossOrigin(origins = "*") @RestController @RequestMapping("/api/cart") public class CartController { @Autowired CartService cartService; @GetMapping("user/{id}") public List<CartDTO> getById(@PathVariable(value = "id") long id) { return cartService.findByUserId(id); } }
92800e0ce56e9ee04b330ed8bd67fab49e4a8a85
734ea2be6110348614430ce492c359411c8d6911
/src/common/NetTCPReader.java
e8bc9b46e8feb7f3a355883e42d86330fdda865c
[]
no_license
billyS/PongGame
f568e27b0ceb0481689d63e1c86c8efb42de5e63
49bb92662bbeb31e5e721d3aaf1045f513c47091
refs/heads/master
2020-05-20T12:39:55.910255
2015-02-26T18:35:48
2015-02-26T18:35:48
31,377,676
0
0
null
null
null
null
UTF-8
Java
false
false
1,166
java
package common; import java.io.*; import java.net.Socket; /** * Wrapper to allow reading of Strings from a socket */ public class NetTCPReader extends ObjectInputStream implements NetStringReader { /** * @param s Socket to read from * @throws IOException when can not create the connection */ public NetTCPReader( Socket s ) throws IOException { super( s.getInputStream() ); DEBUG.traceA( "new NetTCPStringReader()" ); } // Get object return null on 'error' public synchronized String get() // Get object from stream { try // { String s = (String) readObject(); // Return read object DEBUG.trace("NetTCPReader.got [%s]", s); return s; } catch ( Exception e ) // Reading error { e.printStackTrace(); DEBUG.error("NetTCPReader.get %s", e.getMessage() ); return null; // On error return null } } public void close() { try { super.close(); } catch ( Exception e ) { DEBUG.error("NetTCPReader.close %s", e.getMessage() ); } } }
cf6c0cef53034487c7ab5cbd62ff9c7d5da824c2
b17d9e917e95fd1f79d9c6ed55e72ff1088c58a5
/src/main/java/org/bharath/unico/gcdassignment/util/DatabaseUtil.java
1691d880f420148c958bec6cec9bf10361c898ae
[]
no_license
Bharath-Manjegowda/Unico-GCD-Assignment
44e96f7143439ad2aaee636746b1179c87daa1e9
7f7a60f82ceb6b26387301ab783fa601c7d78954
refs/heads/master
2020-12-31T07:41:37.094224
2017-03-29T06:39:49
2017-03-29T06:39:49
86,541,885
0
0
null
null
null
null
UTF-8
Java
false
false
738
java
package org.bharath.unico.gcdassignment.util; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import org.bharath.unico.gcdassignment.model.InputNumbers; /** * Created by Bharath on 29-03-2017. */ public class DatabaseUtil { public static Connection getConnection() throws Exception{ try { String connectionURL = "jdbc:oracle:thin:@localhost:1521:xe"; Connection connection = null; Class.forName("oracle.jdbc.driver.OracleDriver"); connection = DriverManager.getConnection(connectionURL, "bharath", "bharath"); return connection; } catch (Exception e){ throw e; } } }
a090f18b145615ad99dad2c86a5c0bd70cd9bdac
26ad2541958ca82c63325fdc9cd6e5e205af9e96
/src/br/com/exemplo/jdbc/UsuarioDAO.java
63932a5950f9c79c712af0222dc0d0fb0c47e835
[]
no_license
FernandoDantas/Crud-Jsp-e-Mysql
55793f71b26ad38a6dadafed70caf20d9ce1c3ed
7fe7a01df21969f9b23b494f4b53fe35337e3120
refs/heads/master
2021-01-23T16:35:23.583066
2015-08-06T14:40:04
2015-08-06T14:40:04
40,309,698
0
0
null
null
null
null
ISO-8859-2
Java
false
false
5,024
java
package br.com.exemplo.jdbc; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import br.com.exemplo.beans.Usuario; public class UsuarioDAO { private Connection con = Conexao.getConnection(); //Metodo que insere dados no BD public void cadastro(Usuario usuario){ String sql = "INSERT INTO USUARIO(nome,email,senha,datainscricao)values(?,?,?,?)"; try { PreparedStatement preparador = con.prepareStatement(sql); preparador.setString(1, usuario.getNome()); preparador.setString(2, usuario.getEmail()); preparador.setString(3, usuario.getSenha()); preparador.setDate(4, usuario.getDatainscricao()); preparador.execute(); preparador.close(); System.out.println("Cadastrado com sucesso!!"); } catch (SQLException e) { System.out.println("Erro -"+e.getMessage()); } } //Meotodo que altera dados na tabela do BD public void Alterar(Usuario usuario){ String sql = "UPDATE USUARIO SET NOME = ?, EMAIL = ?, SENHA = ?, DATAINSCRICAO = ? WHERE id = ?"; try { PreparedStatement preparador = con.prepareStatement(sql); preparador.setString(1, usuario.getNome()); preparador.setString(2, usuario.getEmail()); preparador.setString(3, usuario.getSenha()); preparador.setDate(4, usuario.getDatainscricao()); preparador.setInt(5, usuario.getId()); preparador.execute(); preparador.close(); System.out.println("Alterado com sucesso!!"); } catch (SQLException e) { System.out.println("Erro -"+e.getMessage()); } } //Meotodo que excluir dados na tabela do BD public void Deletar(Usuario usuario){ String sql = "DELETE FROM USUARIO WHERE id = ?"; try { PreparedStatement preparador = con.prepareStatement(sql); preparador.setInt(1, usuario.getId()); preparador.execute(); preparador.close(); System.out.println("Deletado com sucesso!!"); } catch (SQLException e) { System.out.println("Erro -"+e.getMessage()); } } //Metodo que faz o select no BD public List<Usuario> buscarTodos(Usuario usuario){ String sql = "SELECT * FROM USUARIO"; List<Usuario> lista = new ArrayList<Usuario>(); try { PreparedStatement preparador = con.prepareStatement(sql); ResultSet resultados = preparador.executeQuery(); while(resultados.next()){ Usuario usu = new Usuario(); usu.setId(resultados.getInt("id")); usu.setNome(resultados.getString("nome")); usu.setEmail(resultados.getString("email")); usu.setSenha(resultados.getString("senha")); usu.setDatainscricao(resultados.getDate("datainscricao")); lista.add(usu); } } catch (SQLException e) { System.out.println("Erro - "+e.getMessage()); }return lista; } //Metodo que faz o select no BD por id public Usuario buscarporID(Integer id){//objeto de retorno do método Usuario usuRetorno= null; String sql = "SELECT * FROM USUARIO WHERE id=?"; try { PreparedStatement preparador = con.prepareStatement(sql); preparador.setInt(1, id); //Retorna a consulta em resultset ResultSet resultado = preparador.executeQuery(); //Se tem registro if(resultado.next()){ //instancia o objeto usuario usuRetorno = new Usuario(); usuRetorno.setId(resultado.getInt("id")); usuRetorno.setNome(resultado.getString("nome")); usuRetorno.setEmail(resultado.getString("email")); usuRetorno.setSenha(resultado.getString("senha")); usuRetorno.setDatainscricao(resultado.getDate("datainscricao")); } System.out.println("Encontrado com Sucesso!"); } catch (SQLException e) { System.out.println("Erro de SQL:" +e.getMessage()); }return usuRetorno; } //Metodo que faz o select no BD por id public Usuario autenticacao(Usuario usuario){//objeto de retorno do método Usuario usuRetorno= null; String sql = "SELECT * FROM USUARIO WHERE email = ? and senha = ?"; try { PreparedStatement preparador = con.prepareStatement(sql); preparador.setString(1, usuario.getEmail()); preparador.setString(2, usuario.getSenha()); //Retorna a consulta em resultset ResultSet resultado = preparador.executeQuery(); //Se tem registro if(resultado.next()){ //instancia o objeto usuario usuRetorno = new Usuario(); usuRetorno.setId(resultado.getInt("id")); usuRetorno.setNome(resultado.getString("nome")); usuRetorno.setEmail(resultado.getString("email")); usuRetorno.setSenha(resultado.getString("senha")); usuRetorno.setDatainscricao(resultado.getDate("datainscricao")); } System.out.println("Encontrado com Sucesso!"); } catch (SQLException e) { System.out.println("Erro de SQL:" +e.getMessage()); }return usuRetorno; } }
5d13ea83bbb22867e42ab5041201cee2c38e1f34
7314d6d2ea1c94b64e63a1d9053cecb38d8a86a4
/src/LinkedListCycle.java
08f68a9528c55a0d03360bc08fd98a5b1036d2ce
[]
no_license
Seventeen1Gx/LeetCodeAlgorithm
730acd721d220812b5c2e792af1ea449869ea4af
92db1400dcfe95bf0bd87fe36712adcb6457cc9a
refs/heads/master
2021-07-05T19:09:07.352598
2020-11-12T07:43:22
2020-11-12T07:43:22
203,897,333
0
0
null
null
null
null
UTF-8
Java
false
false
1,331
java
package src; import src.util.ListNode; import java.util.HashSet; import java.util.Set; /** * 141. 环形链表 * * 给定一个链表,判断链表中是否有环。 * * @author Seventeen1Gx * @version 1.0 */ public class LinkedListCycle { /** * 双指针法,一个指针每次移动两步,一个指针每次移动一步,从而在含有环的链表中,这两个指针总能相遇 */ public boolean solution1(ListNode head) { if (head == null || head.next == null) { return false; } ListNode p = head, q = head.next; while (p != null && q != null) { if (p == q) { return true; } p = p.next; q = q.next; if (q != null) { q = q.next; } } return false; } /** * 还可以用哈希表记录被访问结点,当遍历到已被访问过的结点,说明链表中存在环 */ public boolean solution2(ListNode head) { Set<ListNode> hashSet = new HashSet<>(); while (head != null) { if (hashSet.contains(head)) { return true; } else { hashSet.add(head); head = head.next; } } return false; } }
2ddf9dbf919c6308a3a6a7145240b2b118663264
353bc9732f3fd0c706d1873ac0854a7501164241
/src/main/java/com/deep/api/request/NoticePlanModel.java
fcf3943f43f501d96da4a5340c379d4f355575bc
[ "Apache-2.0" ]
permissive
mrHuangWenHai/deep
36156e093c6f7695423d6a867c2b93e8ac058cfd
a37a78ab79a88529cf831a17ae94f9c41c2cd485
refs/heads/master
2021-05-09T01:11:28.026278
2018-08-15T05:53:51
2018-08-15T05:53:51
119,779,509
3
3
null
null
null
null
UTF-8
Java
false
false
7,209
java
package com.deep.api.request; import java.io.Serializable; import java.util.Date; /** * author: Created By Caojiawei * date: 2018/4/12 21:20 */ public class NoticePlanModel implements Serializable { private Integer id; private Date gmtCreate; private Date gmtModified; private String professor; private Byte type; private String title; private String filepath; private String suffixname; private String content; private String search_string; private String s_breedingT; private String s_gestationT; private String s_prenatalIT; private String s_cubT; private String s_diagnosisT; private String s_nutritionT; private String s_gmtCreate1; private String s_gmtCreate2; private String s_gmtModified1; private String s_gmtModified2; private String s_breedingT1; private String s_breedingT2; private String s_gestationT1; private String s_gestationT2; private String s_prenatalIT1; private String s_prenatalIT2; private String s_cubT1; private String s_cubT2; private String s_diagnosisT1; private String s_diagnosisT2; private String s_nutritionT1; private String s_nutritionT2; private String downloadPath; private int size; private int page; private static final long serialVersionUID = 1L; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Date getGmtCreate() { return gmtCreate; } public void setGmtCreate(Date gmtCreate) { this.gmtCreate = gmtCreate; } public Date getGmtModified() { return gmtModified; } public void setGmtModified(Date gmtModified) { this.gmtModified = gmtModified; } public String getProfessor() { return professor; } public void setProfessor(String professor) { this.professor = professor; } public Byte getType() { return type; } public void setType(Byte type) { this.type = type; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getFilepath() { return filepath; } public void setFilepath(String filepath) { this.filepath = filepath; } public String getSuffixname() { return suffixname; } public void setSuffixname(String suffixname) { this.suffixname = suffixname; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getSearch_string() { return search_string; } public void setSearch_string(String search_string) { this.search_string = search_string; } public String getS_breedingT() { return s_breedingT; } public void setS_breedingT(String s_breedingT) { this.s_breedingT = s_breedingT; } public String getS_gestationT() { return s_gestationT; } public void setS_gestationT(String s_gestationT) { this.s_gestationT = s_gestationT; } public String getS_prenatalIT() { return s_prenatalIT; } public void setS_prenatalIT(String s_prenatalIT) { this.s_prenatalIT = s_prenatalIT; } public String getS_cubT() { return s_cubT; } public void setS_cubT(String s_cubT) { this.s_cubT = s_cubT; } public String getS_diagnosisT() { return s_diagnosisT; } public void setS_diagnosisT(String s_diagnosisT) { this.s_diagnosisT = s_diagnosisT; } public String getS_nutritionT() { return s_nutritionT; } public void setS_nutritionT(String s_nutritionT) { this.s_nutritionT = s_nutritionT; } public String getS_gmtCreate1() { return s_gmtCreate1; } public void setS_gmtCreate1(String s_gmtCreate1) { this.s_gmtCreate1 = s_gmtCreate1; } public String getS_gmtCreate2() { return s_gmtCreate2; } public void setS_gmtCreate2(String s_gmtCreate2) { this.s_gmtCreate2 = s_gmtCreate2; } public String getS_gmtModified1() { return s_gmtModified1; } public void setS_gmtModified1(String s_gmtModified1) { this.s_gmtModified1 = s_gmtModified1; } public String getS_gmtModified2() { return s_gmtModified2; } public void setS_gmtModified2(String s_gmtModified2) { this.s_gmtModified2 = s_gmtModified2; } public String getS_breedingT1() { return s_breedingT1; } public void setS_breedingT1(String s_breedingT1) { this.s_breedingT1 = s_breedingT1; } public String getS_breedingT2() { return s_breedingT2; } public void setS_breedingT2(String s_breedingT2) { this.s_breedingT2 = s_breedingT2; } public String getS_gestationT1() { return s_gestationT1; } public void setS_gestationT1(String s_gestationT1) { this.s_gestationT1 = s_gestationT1; } public String getS_gestationT2() { return s_gestationT2; } public void setS_gestationT2(String s_gestationT2) { this.s_gestationT2 = s_gestationT2; } public String getS_prenatalIT1() { return s_prenatalIT1; } public void setS_prenatalIT1(String s_prenatalIT1) { this.s_prenatalIT1 = s_prenatalIT1; } public String getS_prenatalIT2() { return s_prenatalIT2; } public void setS_prenatalIT2(String s_prenatalIT2) { this.s_prenatalIT2 = s_prenatalIT2; } public String getS_cubT1() { return s_cubT1; } public void setS_cubT1(String s_cubT1) { this.s_cubT1 = s_cubT1; } public String getS_cubT2() { return s_cubT2; } public void setS_cubT2(String s_cubT2) { this.s_cubT2 = s_cubT2; } public String getS_diagnosisT1() { return s_diagnosisT1; } public void setS_diagnosisT1(String s_diagnosisT1) { this.s_diagnosisT1 = s_diagnosisT1; } public String getS_diagnosisT2() { return s_diagnosisT2; } public void setS_diagnosisT2(String s_diagnosisT2) { this.s_diagnosisT2 = s_diagnosisT2; } public String getS_nutritionT1() { return s_nutritionT1; } public void setS_nutritionT1(String s_nutritionT1) { this.s_nutritionT1 = s_nutritionT1; } public String getS_nutritionT2() { return s_nutritionT2; } public void setS_nutritionT2(String s_nutritionT2) { this.s_nutritionT2 = s_nutritionT2; } public String getDownloadPath() { return downloadPath; } public void setDownloadPath(String downloadPath) { this.downloadPath = downloadPath; } public int getSize() { return size; } public void setSize(int size) { this.size = size; } public int getPage() { return page; } public void setPage(int page) { this.page = page; } }
c73d2112bab82099d79cfbe90bcb625cfab488be
17b7aa2570db8257ad9f460344521c6117039095
/core/src/com/symbolplay/tria/game/enemies/collisions/RectangleEnemyCollision.java
e2f7f785dfb52397dfe63162d943d85c84e1e9d6
[ "MIT" ]
permissive
mrzli-other/tria
88ab669bbb3d330dc439676cf88a07e456e0aea8
058ede29ea11ad73e84773b21189435a2928c27c
refs/heads/master
2022-02-11T12:28:26.917543
2015-04-20T20:28:18
2015-04-20T20:28:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,144
java
package com.symbolplay.tria.game.enemies.collisions; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.math.Intersector; import com.badlogic.gdx.math.Rectangle; final class RectangleEnemyCollision extends EnemyCollisionBase { private final Rectangle collisionRect; private final float collisionPadding; public RectangleEnemyCollision(Sprite sprite, float collisionPadding) { this.collisionPadding = collisionPadding; float x = sprite.getX() + this.collisionPadding; float y = sprite.getY() + this.collisionPadding; float width = sprite.getWidth() - 2.0f * this.collisionPadding; float height = sprite.getHeight() - 2.0f * this.collisionPadding; collisionRect = new Rectangle(x, y, width, height); } @Override public void update(Sprite sprite) { collisionRect.setX(sprite.getX() + collisionPadding); collisionRect.setY(sprite.getY() + collisionPadding); } @Override public boolean isCollision(Rectangle characterRect) { return Intersector.overlaps(collisionRect, characterRect); } }
92f794a985faf539117f85ddb1718bc00472a6ca
b0876822b161b0db1fa890636a04da105e6f7cf3
/app/src/test/java/ru/knaus_g/sherlok/ExampleUnitTest.java
d48b6a186041b0c3d5ae8e0b09442f0054925c08
[]
no_license
KnausGeorgy/Sherlok
4c1543390def05940418059e94e180d855846a92
ef006a92143c0bbd803d2f9392925d6203970f64
refs/heads/master
2020-09-25T17:06:40.949676
2019-12-05T13:09:04
2019-12-05T13:09:04
226,050,399
0
0
null
null
null
null
UTF-8
Java
false
false
379
java
package ru.knaus_g.sherlok; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
bef72399895e89fa9e7e491e74852a7e58e1fa5f
2d626c194fcb44ff426ae2ffbb1aebd14a7581fc
/src/main/java/br/com/unitri/v2/v2ppi/service/implement/ScoreServiceImpl.java
886f3804078a6ff954b1e2f4b1e434911089674e
[]
no_license
irleylopes/v2-ppi
0930f8489efba376247711427db98d6adbfab4b6
c72465157e6d05683c7c5e6088c9f98b15245db3
refs/heads/master
2020-04-09T21:21:04.270264
2018-12-07T03:52:47
2018-12-07T03:52:47
160,599,430
0
0
null
2018-12-07T03:52:48
2018-12-06T01:11:32
Java
UTF-8
Java
false
false
1,485
java
package br.com.unitri.v2.v2ppi.service.implement; import br.com.unitri.v2.v2ppi.domain.Score; import br.com.unitri.v2.v2ppi.domain.Student; import br.com.unitri.v2.v2ppi.repository.ScoreRepository; import br.com.unitri.v2.v2ppi.repository.StudentRepository; import br.com.unitri.v2.v2ppi.service.interfaceServ.ScoreService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; import java.util.Optional; @Service public class ScoreServiceImpl implements ScoreService { @Autowired private ScoreRepository scoreRepository; @Autowired private StudentRepository studentRepository; @Override public List<Score> findAll(Long studentId) { List<Score> scores = scoreRepository.findByStudentId(studentId); return scores; } @Override public Score create(Score score, Long studentId) { Optional<Student> student = studentRepository.findById(studentId); score.setStudent(student.get()); score = scoreRepository.save(score); return score; } @Override public Score findById(Long id) { Optional<Score> score = scoreRepository.findById(id); return score.get(); } @Override public Score update(Score score, Long id) { score = scoreRepository.save(score); return score; } @Override public void delete(Long id) { scoreRepository.deleteById(id); } }
1ea74bacf0a9fb585a5bce5fc9d7359368b19c2d
4c57ea2e8b9ca3796b5d0db3f9c8cfd3a1c45653
/ccl-java_encryption/src/main/java/com/ccl/RSA/EncrypRSA.java
3f6b5697e40cb6089525a6b67373d0940e824ec4
[]
no_license
freedom541/cclTest
ca212803140229a9c7841fa8c8a31663f5a2bd7b
ac4110cc256856ad11098dd7943a4017138dffca
refs/heads/master
2020-07-01T03:46:07.291382
2017-08-16T05:44:04
2017-08-16T05:44:04
74,097,590
3
0
null
null
null
null
UTF-8
Java
false
false
3,096
java
package com.ccl.RSA; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import java.security.InvalidKeyException; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.NoSuchAlgorithmException; import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPublicKey; /** * Created by ccl on 16/11/18. */ public class EncrypRSA { /** * 加密 */ protected byte[] encrypt(RSAPublicKey publicKey, byte[] srcBytes) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException { if (publicKey != null) { // Cipher负责完成加密或解密工作,基于RSA Cipher cipher = Cipher.getInstance("RSA"); // 根据公钥,对Cipher对象进行初始化 cipher.init(Cipher.ENCRYPT_MODE, publicKey); byte[] resultBytes = cipher.doFinal(srcBytes); return resultBytes; } return null; } /** * 解密 */ protected byte[] decrypt(RSAPrivateKey privateKey, byte[] srcBytes) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException { if (privateKey != null) { // Cipher负责完成加密或解密工作,基于RSA Cipher cipher = Cipher.getInstance("RSA"); // 根据公钥,对Cipher对象进行初始化 cipher.init(Cipher.DECRYPT_MODE, privateKey); byte[] resultBytes = cipher.doFinal(srcBytes); return resultBytes; } return null; } /** * @param args */ public static void main(String[] args) throws NoSuchAlgorithmException, InvalidKeyException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException { EncrypRSA rsa = new EncrypRSA(); String msg = "XX-"; // KeyPairGenerator类用于生成公钥和私钥对,基于RSA算法生成对象 KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("RSA"); // 初始化密钥对生成器,密钥大小为1024位 keyPairGen.initialize(1024); // 生成一个密钥对,保存在keyPair中 KeyPair keyPair = keyPairGen.generateKeyPair(); // 得到私钥 RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate(); // 得到公钥 RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); // 用公钥加密 byte[] srcBytes = msg.getBytes(); byte[] resultBytes = rsa.encrypt(publicKey, srcBytes); // 用私钥解密 byte[] decBytes = rsa.decrypt(privateKey, resultBytes); System.out.println("明文是:" + msg); System.out.println("加密后是:" + new String(resultBytes)); System.out.println("解密后是:" + new String(decBytes)); } }
3d07eb8f12e286c5c609f60af7a130f0dacb3e0e
e7fce86e589fd136af24e2bbdc84bc40f165d7b4
/src/entities/BackgroundFactory.java
76ef877029500d5b9f37e557bae364348f5cb945
[]
no_license
MichaelCCrow/stickman
63be32a0f83db06b1a752df73d89bd2d6fc3ae5b
ef881d247054fa748df2a07b634d0f1c94d17606
refs/heads/master
2020-04-16T09:09:42.615800
2016-09-16T17:49:00
2016-09-16T17:49:00
68,254,383
0
0
null
null
null
null
UTF-8
Java
false
false
309
java
//package entities; // //public class BackgroundFactory { // // public Background makeBackground(String backgroundType) { // // Background newBackground = null; // // if (backgroundType.equalsIgnoreCase("stoneFloor")) { // // return new GroundFloor(); // } // // else return null; // } // //}
71b4241c830d66cd260135f84ec4e7cfaa34164e
b136e9097cdabf86f9e6919e9566082d7684cb3d
/changgou3_parent1/changgou3_pojo/src/main/java/com/czxy/changgou3/vo/NewsVo.java
a50cdd870fcfc9147a2232a4308169a262d2cf93
[]
no_license
githubitzdh/changgou
e56e6bd44f8060548b2feb4d3092d1c4a7c74e7d
363db8c68c5d8f4cd3fa55e6106aeef91403072c
refs/heads/master
2022-12-04T11:26:33.490216
2020-08-14T06:56:22
2020-08-14T06:56:22
287,447,794
0
0
null
null
null
null
UTF-8
Java
false
false
149
java
package com.czxy.changgou3.vo; /** 快报所有的查询条件封装对象(含分页) **/ public class NewsVo extends PageRequest { //特有 }
[ "‘[email protected]’" ]
8cedd543748cf1dffef74f3d6da85fcf0954a9e2
50051e0a86e3ae4278a7c68ece663927f84665bd
/src/org/usfirst/frc/team6894/robot/commands/IntakeUpCommand.java
9c28312c45d6a11cbcf526d8dc447e48a1db5cc3
[]
no_license
icedjava/IcedJava2018-PowerUp
934bea63c144f5df0568de464d7468e9bea1d644
429ae1ac62698fae73b2f57bab4582d6f438fba7
refs/heads/master
2021-04-15T15:08:37.652039
2018-03-27T21:47:57
2018-03-28T13:33:56
126,638,170
1
1
null
null
null
null
UTF-8
Java
false
false
1,013
java
package org.usfirst.frc.team6894.robot.commands; import org.usfirst.frc.team6894.robot.Robot; import edu.wpi.first.wpilibj.command.Command; /** * */ public class IntakeUpCommand extends Command { public IntakeUpCommand() { requires(Robot.intakePistonSubsystem); // Use requires() here to declare subsystem dependencies // eg. requires(chassis); } // Called just before this Command runs the first time protected void initialize() { } // Called repeatedly when this Command is scheduled to run protected void execute() { Robot.intakePistonSubsystem.IntakeUp(); } // Make this return true when this Command no longer needs to run execute() protected boolean isFinished() { return false; } // Called once after isFinished returns true protected void end() { } // Called when another command which requires one or more of the same // subsystems is scheduled to run protected void interrupted() { } }
f3625c46054775ad7b8f5300c3642b530e81bad3
8f0e3f102718d2b92af30a1814b15d5333a37d53
/src/main/java/com/portalVesti/repo/VestRepository.java
ae721c637a4a53489c98356399305340519a7fff
[]
no_license
katolina/portal
5be9353f5aa8a53f61225f784f9f700a646a520f
e8451efba1b8c4a3ced8f648fb92deb961de5bc5
refs/heads/master
2023-01-01T17:21:18.917967
2020-10-19T10:37:44
2020-10-19T10:37:44
301,100,931
0
0
null
null
null
null
UTF-8
Java
false
false
697
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 com.portalVesti.repo; import com.portalVesti.model.KategorijaEntity; import com.portalVesti.model.VestEntity; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; /** * * @author Katica */ //@Repository public interface VestRepository extends JpaRepository<VestEntity, Integer>{ VestEntity save(VestEntity vest); VestEntity findByKategorija(KategorijaEntity kategorija); }
[ "Kata@DESKTOP-JDQLT0F" ]
Kata@DESKTOP-JDQLT0F
cb48fdc2ead864b07c6ad847b0bbd35c8c6e1a3f
4500de405a0b801a48e6dcdd1a9b40ebd560ed5e
/api/src/main/java/com/cyrillic/farm/controller/BaseController.java
c4e27f7bbec1e63264e06fe5a5f170c356119b36
[]
no_license
nemtish/spring-vue-rest
9a10b17ef3fab8211ffc96bd353c48212289e6b2
b6e25e21918f8233b5523d9754fa3ce5e3489d98
refs/heads/main
2023-03-25T14:51:49.428460
2021-03-23T08:59:13
2021-03-23T08:59:13
350,158,352
0
0
null
2021-03-22T10:32:20
2021-03-22T00:36:06
Java
UTF-8
Java
false
false
575
java
package com.cyrillic.farm.controller; import com.cyrillic.farm.entity.User; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.bind.annotation.RequestMapping; @RequestMapping(path = "api/v1") public abstract class BaseController { protected User getAuthenticatedUser() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); User user = (User) authentication.getPrincipal(); return user; } }
13102ba3c8f687aacfea160294eb92ba4e3db369
7f2f1e2d699c7795ba835358485dc6832c7c1b48
/src/main/java/org/dispatcher/beans/passenger/PassengerRegisterRequest.java
0cd016f3138bea7f68ffbf1f4649f10ba5bea56c
[]
no_license
krishnateja262/BusApp
6d9e79bad9e9f6b1682b4955b7ad99bf1c7f72ce
ba4f70a099162ead52bbcf32a488302676b82ddb
refs/heads/master
2021-01-20T15:37:08.248775
2014-08-30T15:01:10
2014-08-30T15:01:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,376
java
package org.dispatcher.beans.passenger; public class PassengerRegisterRequest { String routeNumber; String gcmId; String lat; String lon; int oldTimeInterval; int newTimeInterval; String newStartingPoint; String oldStartingPoint; public String getRouteNumber() { return routeNumber; } public void setRouteNumber(String routeNumber) { this.routeNumber = routeNumber; } public String getGcmId() { return gcmId; } public void setGcmId(String gcmId) { this.gcmId = gcmId; } public String getLat() { return lat; } public void setLat(String lat) { this.lat = lat; } public String getLon() { return lon; } public void setLon(String lon) { this.lon = lon; } public int getOldTimeInterval() { return oldTimeInterval; } public void setOldTimeInterval(int oldTimeInterval) { this.oldTimeInterval = oldTimeInterval; } public int getNewTimeInterval() { return newTimeInterval; } public void setNewTimeInterval(int newTimeInterval) { this.newTimeInterval = newTimeInterval; } public String getNewStartingPoint() { return newStartingPoint; } public void setNewStartingPoint(String newStartingPoint) { this.newStartingPoint = newStartingPoint; } public String getOldStartingPoint() { return oldStartingPoint; } public void setOldStartingPoint(String oldStartingPoint) { this.oldStartingPoint = oldStartingPoint; } }
a3043516cdf60fadd15ace60f3250c859ff838d0
9f4bde26ab50e56c91c78d406d37660f5c3af038
/mybatis3-learn/src/main/java/org/apache/ibatis/transaction/managed/ManagedTransaction.java
dd6bd4df22f39679e3264b25429731763f4ad1b8
[]
no_license
MaricoL/mybatis3
b817692fee4810ef94b623ac4c86932491a2e429
904ebc9d84c3991c1822b025363786ac288c4ca3
refs/heads/master
2022-10-04T21:48:03.702124
2019-10-08T09:02:07
2019-10-08T09:02:07
204,367,354
0
0
null
null
null
null
UTF-8
Java
false
false
2,629
java
/** * Copyright 2009-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.ibatis.transaction.managed; import org.apache.ibatis.logging.Log; import org.apache.ibatis.logging.LogFactory; import org.apache.ibatis.session.TransactionIsolationLevel; import org.apache.ibatis.transaction.Transaction; import javax.sql.DataSource; import java.sql.Connection; import java.sql.SQLException; public class ManagedTransaction implements Transaction { private static final Log log = LogFactory.getLog(ManagedTransaction.class); private DataSource dataSource; private TransactionIsolationLevel level; private Connection connection; private final boolean closeConnection; public ManagedTransaction(Connection connection, boolean closeConnection) { this.connection = connection; this.closeConnection = closeConnection; } public ManagedTransaction(DataSource ds, TransactionIsolationLevel level, boolean closeConnection) { this.dataSource = ds; this.level = level; this.closeConnection = closeConnection; } @Override public Connection getConnection() throws SQLException { if (this.connection == null) { openConnection(); } return this.connection; } @Override public void commit() throws SQLException { // Does nothing } @Override public void rollback() throws SQLException { // Does nothing } @Override public void close() throws SQLException { if (this.closeConnection && this.connection != null) { if (log.isDebugEnabled()) { log.debug("Closing JDBC Connection [" + this.connection + "]"); } this.connection.close(); } } protected void openConnection() throws SQLException { if (log.isDebugEnabled()) { log.debug("Opening JDBC Connection"); } this.connection = this.dataSource.getConnection(); if (this.level != null) { this.connection.setTransactionIsolation(this.level.getLevel()); } } @Override public Integer getTimeout() throws SQLException { return null; } }
a640b79886359a996b5e537264c7b7fb797ae5f6
331418dd6c3414ef7d6f4f01d8e9952b851f7d33
/src/caixa/Produto.java
b181533fe0b5bbd344b3df8e8774609bcbc2ddd0
[]
no_license
schloegl10/ZG2
b81ad51fc1662f352080d7c90852094e4f9dd969
9e5ebebe180760f70c435eb5dd4d9295d742c824
refs/heads/master
2020-03-29T07:04:25.194625
2018-09-22T03:18:24
2018-09-22T03:18:24
149,651,999
0
0
null
null
null
null
UTF-8
Java
false
false
921
java
package caixa; import java.math.BigDecimal; public class Produto { private int id; private BigDecimal preco; private String descricao; Promocao promocao = null; public Produto(BigDecimal preco, String descricao) { this.preco=preco; this.descricao=descricao; } public void setPreco(BigDecimal preco) { this.preco = preco; } public void setDescricao(String descricao) { this.descricao = descricao; } public void setPromocao(Promocao promocao) { this.promocao = promocao; } public int getID() { return id; } public void setID(int id) { this.id = id; } public BigDecimal getPreco() { return preco; } public String getDescricao() { return descricao; } public void criaPromocaoValorAbsoluto(int leve, BigDecimal valor) { promocao = new PromocaoValorAbsoluto(leve,valor); } public void criaPromocaoPagueLeve(int leve, int pague) { promocao = new PromocaoPagueLeve(leve,pague); } }
9950b76ebbfa26431f047b821725c9729a10c618
a1e6c1432a2209ae0b26951755adcaa7363b4dc8
/Cpp/NewCwk2/src/Movie.java
8129c71d015e9e4f7a9b28a90802f3b9a329663c
[]
no_license
p-burgess/TCP-and-parallel
bc703eb582607b873c321c8588760865cd8ea610
a278d8c92ef68b1d5c8d53f3dd770669a185a1da
refs/heads/master
2020-04-28T17:33:09.070894
2019-03-16T15:10:27
2019-03-16T15:10:27
175,451,149
1
0
null
null
null
null
UTF-8
Java
false
false
873
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author p0073862 */ public class Movie { private String name; private Actor[] actors = new Actor[10]; private int nbrActors = 0; public Movie(String name) { this.name = name; } public String getName() { return name; } public void addActor(Actor actor) { actors[nbrActors] = actor; nbrActors++; } public int getNbrActors() { return nbrActors; } public Actor getActor(int i) { return actors[i]; } boolean containsActor(Actor actor) { for (int i=0; i<nbrActors;i++) { if (actors[i].equals(actor)) { return true; } } return false; } }
0cb4b936a93e4c1804d496590ea19f439be23ba4
9388abd21c69dd5fe914a7ff586fd427bd55d2df
/Server/src/test/java/com/kittyapp/KittyApplicationTests.java
81bfee3f60327e57238a7c65ab2b2002eff45a50
[]
no_license
MikeShiner/KittyApp
214867ad9913bcb138472deb2dbdc3869cb9205e
2efc62f61958b3e9cdd5ca05fb5444838a4fdd8a
refs/heads/master
2021-08-28T06:45:52.517516
2017-12-11T13:10:15
2017-12-11T13:10:15
109,976,001
0
0
null
null
null
null
UTF-8
Java
false
false
328
java
package com.kittyapp; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class KittyApplicationTests { @Test public void contextLoads() { } }
6d018065c9e7d4bafc809465e637a98c80e77e14
5fabf091faf9371d2c73bfe47d71e346b5dab2fd
/src/main/java/cn/ghang/store/service/CartServiceImpl.java
1afe9e86954a163875c37567548449af22639d10
[]
no_license
gaohanghang/CollegeStore
ce1c48257c0b3393a8653b62e3c76bae1c164bb9
59a5e08e3ab23c40c4bd567c5f87a48bab60c619
refs/heads/master
2021-01-25T14:09:36.951214
2018-06-29T11:13:43
2018-06-29T11:13:43
123,654,597
0
0
null
null
null
null
UTF-8
Java
false
false
570
java
package cn.ghang.store.service; import java.util.List; import javax.annotation.Resource; import cn.ghang.store.bean.Cart; import cn.ghang.store.mapper.CartMapper; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service("cartService") public class CartServiceImpl implements CartService{ @Resource private CartMapper cartMapper; public void add(Cart cart) { cartMapper.add(cart); } @Transactional public List<Cart> getCartList(Integer uid) { return cartMapper.getCartList(uid); } }
79a8e015bd436bdc557fb0ddb230b545be8c19f3
86a4f4a2dc3f38c0b3188d994950f4c79f036484
/src/com/fasterxml/jackson/databind/ser/std/StdJdkSerializers$AtomicBooleanSerializer.java
fef38bd008864d0d63061f6f97dc1db01fd4bb2b
[]
no_license
reverseengineeringer/com.cbs.app
8f6f3532f119898bfcb6d7ddfeb465eae44d5cd4
7e588f7156f36177b0ff8f7dc13151c451a65051
refs/heads/master
2021-01-10T05:08:31.000287
2016-03-19T20:39:17
2016-03-19T20:39:17
54,283,808
0
0
null
null
null
null
UTF-8
Java
false
false
1,357
java
package com.fasterxml.jackson.databind.ser.std; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import java.lang.reflect.Type; import java.util.concurrent.atomic.AtomicBoolean; public class StdJdkSerializers$AtomicBooleanSerializer extends StdScalarSerializer<AtomicBoolean> { public StdJdkSerializers$AtomicBooleanSerializer() { super(AtomicBoolean.class, false); } public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper paramJsonFormatVisitorWrapper, JavaType paramJavaType) { paramJsonFormatVisitorWrapper.expectBooleanFormat(paramJavaType); } public JsonNode getSchema(SerializerProvider paramSerializerProvider, Type paramType) { return createSchemaNode("boolean", true); } public void serialize(AtomicBoolean paramAtomicBoolean, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider) { paramJsonGenerator.writeBoolean(paramAtomicBoolean.get()); } } /* Location: * Qualified Name: com.fasterxml.jackson.databind.ser.std.StdJdkSerializers.AtomicBooleanSerializer * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
5854fc9e23790eedf5df0c77b96549b3639b0587
dab677ec007fd3553376610609e999b220ea26c1
/lesson_1/src/obstacles/Wall.java
57a847db592324c1ae1ffde76eb44aa2d96fd76b
[]
no_license
lddconf/jlevel2
aeae20fdc2f4f69202cb3b84a4b4ba081b02293a
f7ec72cd5be299c90121ce2927333d164ede8e27
refs/heads/master
2022-10-12T23:23:04.763746
2020-06-10T19:42:36
2020-06-10T19:42:36
264,928,774
0
0
null
2020-06-10T23:07:49
2020-05-18T12:12:21
Java
UTF-8
Java
false
false
534
java
package obstacles; import competitors.Competitor; public class Wall implements Obstacle { int height; public Wall(int height) { this.height = height; } @Override public boolean doIt(Competitor competitor) { boolean result = competitor.jump(height); if ( result ) { System.out.println("The " + competitor.getName() + " jump succeed!"); } else { System.out.println("The " + competitor.getName() + " jump failed!"); } return result; } }
30a85942ad035f3c87121083e547bcbf890f3bc5
1f4a8544fdf226f9c6f637c10b2283986748914c
/mapps-filter/src/main/java/com/mapps/filter/impl/exceptions/InvalidCoordinatesException.java
f2b5a345108f506efd23786ad5c120226c073b10
[]
no_license
martinbomio/mapps
127da20dc34fdd8d245d38745e50e39029be4c85
f7ae81c5d60a713dfbed464b60c4d0ef00ab3f55
refs/heads/master
2021-01-19T03:24:16.715043
2015-11-16T04:23:48
2015-11-16T04:25:47
14,993,427
0
0
null
null
null
null
UTF-8
Java
false
false
120
java
package com.mapps.filter.impl.exceptions; /** * * */ public class InvalidCoordinatesException extends Exception { }
4f77e46509f76786af185a4777886ec4a7e0e7b7
80303c1e6972ebce94793d863dd97594c61cb622
/dawnlightning/dawnlightning/src/com/zhy/Activity/BrowseImageViewActivity.java
108c29d987ed09ea28d9d9a48a961fc1b7634c41
[]
no_license
konglinghai123/dawnlightning
a3679f2da54dbdabd024b0bee12e216a4021b4ca
dc63c968293aa5b28937c83c5ff37774ab58a00f
refs/heads/master
2021-01-10T08:27:44.168750
2015-11-16T11:56:15
2015-11-16T11:56:15
46,354,384
2
1
null
null
null
null
UTF-8
Java
false
false
2,912
java
package com.zhy.Activity; import java.util.ArrayList; import java.util.List; import com.zhy.Adapter.BrowseImageAdapter; import com.dawnlightning.ucqa.R; import android.content.Intent; import android.os.Bundle; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; /** * 浏览图片 * @author Administrator * */ public class BrowseImageViewActivity extends BaseActivity implements OnClickListener,OnPageChangeListener { private ViewPager myViewPager; private List<View> allViewPagerView=new ArrayList<View>(); private LayoutInflater inflater; private List<String> allImageUrl; private Button btnDelete; BrowseImageAdapter adapter; private int currentPosition; @Override protected void onCreate(Bundle arg0) { // TODO Auto-generated method stub super.onCreate(arg0); setContentView(R.layout.browse_image); initData(); initViews(); } @Override public void initViews() { // TODO Auto-generated method stub super.initViews(); btnDelete=(Button)findViewById(R.id.photo_bt_del); btnDelete.setOnClickListener(this); } @Override public void initData() { // TODO Auto-generated method stub super.initData(); myViewPager=(ViewPager)findViewById(R.id.viewPager); inflater=LayoutInflater.from(BrowseImageViewActivity.this); List<String> allImageUrl=getIntent().getStringArrayListExtra("imageUrl"); int psit=getIntent().getExtras().getInt("position"); currentPosition=psit; this.allImageUrl=allImageUrl; for(int i=0;i<allImageUrl.size();i++){ View v=inflater.inflate(R.layout.browse_image_item, null); allViewPagerView.add(v); } } @Override protected void onStart() { // TODO Auto-generated method stub super.onStart(); adapter=new BrowseImageAdapter(BrowseImageViewActivity.this, allViewPagerView,allImageUrl); myViewPager.setAdapter(adapter); myViewPager.setOnPageChangeListener(this); myViewPager.setCurrentItem(currentPosition); } @Override public void onClick(View arg0) { // TODO Auto-generated method stub if(arg0==btnDelete){ if(allImageUrl.size()>0){ Intent intent=new Intent(); intent.setAction("delImage"); intent.putExtra("position", currentPosition); sendBroadcast(intent); allImageUrl.remove(currentPosition); allViewPagerView.remove(currentPosition); adapter.notifyDataSetChanged(); }else{ finish(); } } } @Override public void onPageScrollStateChanged(int arg0) { // TODO Auto-generated method stub } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { // TODO Auto-generated method stub } @Override public void onPageSelected(int arg0) { // TODO Auto-generated method stub currentPosition=arg0; } }
2fdbaa19d934917fbbf62e42b9cea09dbc7ba252
35e6719397615bf18d7c2ed468c1eec9ce7e3824
/src/main/java/com/controleestoque/dto/MarcaDTO.java
2cfc47cdc850ce45924f2450c2c4d3b72f1307f3
[]
no_license
FabioTV/controle-estoque
7087481e37b9f8925e93c2cd0727ebad95b9919c
60c22d62855363f9724cf6e426ad60120934f357
refs/heads/main
2023-06-14T08:01:21.237259
2021-06-23T14:21:24
2021-06-23T14:21:24
371,550,909
0
0
null
null
null
null
UTF-8
Java
false
false
855
java
package com.controleestoque.dto; import java.util.List; import javax.validation.constraints.NotEmpty; import com.controleestoque.model.Produto; import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Builder; @Builder @JsonInclude(JsonInclude.Include.NON_EMPTY) public class MarcaDTO { private Long id; @NotEmpty private String nome; private List<Produto> produtos; //Getters and Setters public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } public String getNome() { return this.nome; } public void setNome(String nome) { this.nome = nome; } public List<Produto> getProdutos() { return this.produtos; } public void setProdutos(List<Produto> produtos) { this.produtos = produtos; } }
095d204496e1b09094417f410a727e2d9fa8a1ff
b6acb787a644ab293e5a4c7a711ac7cdfca5d0df
/pgkernelgateway/src/main/java/com/electron/mfs/pg/gateway/repository/FeatureRepository.java
b790b430a3a1c08e3bf08878cca3f496a6b00a74
[]
no_license
fsfish/electron-backend
3440089550a5222cfa5fa4855302a2404fa34577
dff5634d0f8e75c090eca3c66aad3c76883b1edd
refs/heads/master
2021-05-22T00:27:37.984536
2020-03-30T18:16:03
2020-03-30T18:16:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
378
java
package com.electron.mfs.pg.gateway.repository; import com.electron.mfs.pg.gateway.domain.Feature; import org.springframework.data.jpa.repository.*; import org.springframework.stereotype.Repository; /** * Spring Data repository for the Feature entity. */ @SuppressWarnings("unused") @Repository public interface FeatureRepository extends JpaRepository<Feature, Long> { }
bafeff97b9cddae7fb7234bb153fe1469d63ed0a
62ac4ed20bb77468784c321acbe7ad6badbe84c3
/src/main/java/com/atmecs/employeedatabase/entity/EmployeeDetails.java
cdb77c1e936aabcebb4edf7bb78e93dc70c301bd
[]
no_license
anshika529/EmployeeDatabaseManagement
810e52d3e165eb921cb1ae3ec34c5ec0382b4486
f8d31a67a6fc6171d8329f2700f2583bc252c912
refs/heads/master
2023-01-07T10:18:51.585332
2020-11-05T14:19:30
2020-11-05T14:19:30
309,698,117
0
0
null
null
null
null
UTF-8
Java
false
false
1,168
java
package com.atmecs.employeedatabase.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity public class EmployeeDetails { @Id @Column(name="emp_detail_id") private int emp_detail_id; private String salary; private String experience; private String hobby; public EmployeeDetails() { super(); } public EmployeeDetails(int emp_detail_id, String salary, String experience, String hobby) { super(); this.emp_detail_id = emp_detail_id; this.salary = salary; this.experience = experience; this.hobby = hobby; } public int getEmp_detail_id() { return emp_detail_id; } public void setEmp_detail_id(int emp_detail_id) { this.emp_detail_id = emp_detail_id; } public String getSalary() { return salary; } public void setSalary(String salary) { this.salary = salary; } public String getExperience() { return experience; } public void setExperience(String experience) { this.experience = experience; } public String getHobby() { return hobby; } public void setHobby(String hobby) { this.hobby = hobby; } }
14d5590620b9e8b645c5c1d45246f6ffd3073fb3
2485387bc5e4ce8a51fbe6cb0b6d5ac93e0b321b
/app/src/main/java/com/example/roubaisha/counter/duaen/ListItemActivity38.java
6d933840a3a47697eb31a18793fe9b70e9c00fee
[]
no_license
sobiamughal/Islamic-App
27be20e893cde7fd95d80800c505ed6d00bc4bd3
ba66d47de00e0f96392576ebb4003e958b3664ef
refs/heads/master
2020-06-18T07:08:41.723713
2019-10-29T05:10:32
2019-10-29T05:10:32
196,206,171
0
0
null
2019-10-29T05:10:33
2019-07-10T13:00:54
Java
UTF-8
Java
false
false
1,566
java
package com.example.roubaisha.counter.duaen; import android.media.MediaPlayer; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import com.example.roubaisha.counter.R; public class ListItemActivity38 extends AppCompatActivity { Button play; MediaPlayer mP; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list_item_activity_38); getSupportActionBar().setTitle("Dua for iftar"); getSupportActionBar().setDisplayHomeAsUpEnabled(true); play = (Button)findViewById(R.id.button_play); mP = MediaPlayer.create(ListItemActivity38.this, R.raw.msmm); play.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mP.isPlaying()){ mP.pause(); play.setBackgroundResource(R.drawable.play); }else { mP.start(); play.setBackgroundResource(R.drawable.pause); } } }); } public void onBackPressed(){ super.onBackPressed(); //stopAndPlay(); mP.stop(); finish(); } @Override protected void onPause() { super.onPause(); if (mP != null){ mP.stop(); if (isFinishing()){ mP.stop(); mP.release(); } } } }
c3df82ea4a5849fef40a95a7ea0a1cc2f416742c
13ec8d109b2018584fa484f72b8d7664cc2c1bd0
/common/src/main/java/com/mtl/common/tool/config/JacksonConfiguration.java
f45a223dbac65eeae095bb363bb21a3aa178a3a5
[]
no_license
xiaozhi1218/springboot-xn
0050e8733a9e5d993b6fa96aa33642801105ef07
52277cb5c87947f2a79f49a94dd9658bc91c2e8b
refs/heads/master
2022-06-29T18:08:51.502220
2019-07-31T09:31:57
2019-07-31T09:31:57
199,824,643
0
0
null
2021-04-26T19:22:40
2019-07-31T09:31:39
Java
UTF-8
Java
false
false
2,598
java
package com.mtl.common.tool.config; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.mtl.common.tool.jackson.MtlJavaTimeModule; import com.mtl.common.tool.utils.DateUtil; import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import java.text.SimpleDateFormat; import java.time.ZoneId; import java.util.Locale; import java.util.TimeZone; /** * Jackson配置类 * * @author Chill */ @Configuration @ConditionalOnClass(ObjectMapper.class) @AutoConfigureBefore(JacksonAutoConfiguration.class) public class JacksonConfiguration { @Primary @Bean public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) { builder.simpleDateFormat(DateUtil.PATTERN_DATETIME); //创建ObjectMapper ObjectMapper objectMapper = builder.createXmlMapper(false).build(); //设置地点为中国 objectMapper.setLocale(Locale.CHINA); //去掉默认的时间戳格式 objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); //设置为中国上海时区 objectMapper.setTimeZone(TimeZone.getTimeZone(ZoneId.systemDefault())); //序列化时,日期的统一格式 objectMapper.setDateFormat(new SimpleDateFormat(DateUtil.PATTERN_DATETIME, Locale.CHINA)); //序列化处理 objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true); objectMapper.configure(JsonParser.Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER, true); objectMapper.findAndRegisterModules(); //失败处理 objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); //单引号处理 objectMapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); //反序列化时,属性不存在的兼容处理 objectMapper.getDeserializationConfig().withoutFeatures(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); //日期格式化 objectMapper.registerModule(new MtlJavaTimeModule()); objectMapper.findAndRegisterModules(); return objectMapper; } }
33ac02fc9e1d41ecc02a1898f74c1ee0c7da9e28
b12672d7f4c378a08ed3fbdc1a4545c5807003ff
/src/main/java/fr/customentity/thesynctowers/injection/PluginModule.java
726022dea007f05dfd813bef4558a42ece0cce64
[]
no_license
CustomEntity/TheSyncTowers
54fd26de58d8971c3c0a8b5c2d8427ddeddef0f8
e7de647d3d7d8973b727a1fd3bd2b33540b3133b
refs/heads/master
2023-03-14T05:51:37.539315
2021-03-06T09:35:28
2021-03-06T09:35:28
336,515,966
0
1
null
null
null
null
UTF-8
Java
false
false
2,000
java
package fr.customentity.thesynctowers.injection; import com.google.inject.AbstractModule; import com.google.inject.assistedinject.FactoryModuleBuilder; import fr.customentity.thesynctowers.TheSyncTowers; import fr.customentity.thesynctowers.commands.SubCommandExecutor; import fr.customentity.thesynctowers.data.RunningTowerSync; import fr.customentity.thesynctowers.data.tower.Tower; import fr.customentity.thesynctowers.data.TowerSync; import fr.customentity.thesynctowers.tasks.RunningTowerSyncTask; /** * Copyright (c) 2021. By CustomEntity * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * @Author: CustomEntity * @Date: 18/02/2021 * */ public class PluginModule extends AbstractModule { private TheSyncTowers plugin; public PluginModule(TheSyncTowers plugin) { this.plugin = plugin; } @Override protected void configure() { this.bind(TheSyncTowers.class).toInstance(this.plugin); this.install(new FactoryModuleBuilder() .build(Tower.Factory.class)); this.install(new FactoryModuleBuilder() .build(RunningTowerSync.Factory.class)); this.install(new FactoryModuleBuilder() .build(TowerSync.Factory.class)); this.install(new FactoryModuleBuilder() .build(SubCommandExecutor.Factory.class)); this.install(new FactoryModuleBuilder() .build(RunningTowerSyncTask.Factory.class)); } }
7e42e8a21bc13f3b5f3540270a13de38afbc4160
19802a91324bce8f8d080438114d83d0e30e9d2e
/src/main/java/apz/btk/entity/Libro.java
5ddf7c58ee51d49f16af7f2bca2119f0ba7a97a9
[]
no_license
arturisimo/bibliotk
a42760fa5f50608a2ada1ae81a4279fc360080ff
df7fc5d2d12baa82e31af4873901c4ac2cc0e52d
refs/heads/master
2020-12-24T06:10:20.552948
2020-01-23T20:50:04
2020-01-23T20:50:04
73,174,801
0
1
null
2020-07-01T18:39:34
2016-11-08T10:24:14
Java
UTF-8
Java
false
false
1,144
java
package apz.btk.entity; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public class Libro { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; private String titulo; private String isbn; @Column(columnDefinition = "boolean default false") private boolean alta; @Column(columnDefinition="TIMESTAMP DEFAULT CURRENT_TIMESTAMP") private Date fechaAlta ; public Date getFechaAlta() { return fechaAlta; } public void setFechaAlta(Date fechaAlta) { this.fechaAlta = fechaAlta; } public long getId() { return id; } public void setId(long id) { this.id = id; } public boolean isAlta() { return alta; } public void setAlta(boolean alta) { this.alta = alta; } public String getTitulo() { return titulo; } public void setTitulo(String titulo) { this.titulo = titulo; } public String getIsbn() { return isbn; } public void setIsbn(String isbn) { this.isbn = isbn; } }
e3b879616063f7a80f6b0d789618bfc7dcdb99ff
807c4fdd66ef9debd93b45a58871ed5848f5353a
/JUnit_Testing_Misc_Projects/Project 3/src/project3/DemoBigO.java
540f0fbe74d626367cc63facb1c8c4f01af33986
[]
no_license
AllynVo/Simple-Java-Projects
38a10dd6a67f50dfa20ec0efb0bc03e13871a6db
c3330bfb1570b37b73c6212a335a84052beddbb4
refs/heads/master
2020-05-18T04:29:17.660960
2019-04-30T04:42:52
2019-04-30T04:42:52
184,174,589
0
0
null
null
null
null
UTF-8
Java
false
false
3,313
java
//Allyn Vo //April 12, 2017 //CS 301 package project3; import java.util.Map; import java.util.Random; import java.util.TreeMap; /** * * @author Allyn Vo */ public class DemoBigO { /** * * @author Allyn Vo */ public TreeMap<Integer, Integer> tree = new TreeMap(); public boolean throwDivideException() throws ArithmeticException { int one = 1, two = 2, zero = 0; int result = one / two; /************************************************************ Write the single line of code that will cause a Divide by Zero Exception to be thrown ************************************************************/ return true; } public void throwAnException() { /************************************************************ Write the single line of code that will throw an ArithmeticException and produce the given test output ************************************************************/ throw new ArithmeticException(); } /* * An obvious O(1) * */ public void demoBigO1(long n) { /************************************************************ Write the code for a O(1) method ************************************************************/ if(n>0){ System.out.print("1"); } } /* * A O( Log(n) ) method studied in class **** GIVEN */ public void demoBigOLogN(long n) { int nInt = (int) n; //int[] dummy= new int[nInt]; for (int i = 0; i < n; i++) { while (n > 1) { n = n / 2; } } return; } /* * An obvious O(n) * */ public void demoBigOn(long n) { /************************************************************ Write the code for a O(n) method ************************************************************/ int count = 0; for(int i=0; i<n; i++){ count++; } System.out.println(count); } /* * Fill a tree of size n with random integers **** GIVEN */ public void demoBigONLogNInit(long n) { int randomInt; long i = 0; //System.out.println("n = "+n ); Random r = new Random(); while (i < n) { randomInt = (int) r.nextInt((int) ((long) 2 * n)); //System.out.println("i= "+i+" randomInt = "+randomInt ); tree.put(randomInt, randomInt); i++; } } /* * A traversal of a tree of size n that we will learn about in 302 **** GIVEN */ public void demoBigONLogN(long n) { int i; for (Map.Entry<Integer, Integer> entry : tree.entrySet()) { Integer key = entry.getKey(); Integer value = entry.getValue(); }; } /* * An obvious O(n*n) * */ public void demoBigOnn(long n) { /************************************************************ Write the code for a O(n*n) method ************************************************************/ for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ System.out.println(i * j); } } } }
9ecfb9ad60cb53e5385aab5b626d7bfaf23e27f1
9c4e76ccbca165ac79d41929aefd62947ea24def
/src/main/ij/gui/Arrow.java
6b7e4d215009364d173d8681cce263134c85cf5f
[]
no_license
sina-masoud-ansari/ImageJ
a5e5ba94b901b5c2d94525566c47917ff5f2329b
253c1dd6b5595cdf30607c7886b21f4632e6f8ce
refs/heads/master
2021-01-20T12:03:43.850458
2012-06-04T15:45:55
2012-06-04T15:45:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,888
java
package ij.gui; import ij.*; import ij.parallel.process.*; import ij.process.ImageProcessor; import java.awt.*; import java.awt.geom.*; /** This is an Roi subclass for creating and displaying arrows. */ public class Arrow extends Line { public static final String STYLE_KEY = "arrow.style"; public static final String WIDTH_KEY = "arrow.width"; public static final String SIZE_KEY = "arrow.size"; public static final String DOUBLE_HEADED_KEY = "arrow.double"; public static final String OUTLINE_KEY = "arrow.outline"; public static final int FILLED=0, NOTCHED=1, OPEN=2, HEADLESS=3; public static final String[] styles = {"Filled", "Notched", "Open", "Headless"}; private static int defaultStyle = (int)Prefs.get(STYLE_KEY, FILLED); private static float defaultWidth = (float)Prefs.get(WIDTH_KEY, 2); private static double defaultHeadSize = (int)Prefs.get(SIZE_KEY, 10); // 0-30; private static boolean defaultDoubleHeaded = Prefs.get(DOUBLE_HEADED_KEY, false); private static boolean defaultOutline = Prefs.get(OUTLINE_KEY, false); private int style; private double headSize = 10; // 0-30 private boolean doubleHeaded; private boolean outline; private float[] points = new float[2*5]; private GeneralPath path = new GeneralPath(); private static Stroke defaultStroke = new BasicStroke(); static { if (defaultStyle<FILLED || defaultStyle>HEADLESS) defaultStyle = FILLED; } public Arrow(double ox1, double oy1, double ox2, double oy2) { super(ox1, oy1, ox2, oy2); setStrokeWidth(2); } public Arrow(int sx, int sy, ImagePlus imp) { super(sx, sy, imp); setStrokeWidth(defaultWidth); style = defaultStyle; headSize = defaultHeadSize; doubleHeaded = defaultDoubleHeaded; outline = defaultOutline; setStrokeColor(Toolbar.getForegroundColor()); } /** Draws this arrow on the image. */ public void draw(Graphics g) { Shape shape2 = null; if (doubleHeaded) { flipEnds(); shape2 = getShape(); flipEnds(); } Shape shape = getShape(); Color color = strokeColor!=null? strokeColor:ROIColor; if (fillColor!=null) color = fillColor; g.setColor(color); Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); AffineTransform at = g2.getDeviceConfiguration().getDefaultTransform(); double mag = getMagnification(); int xbase=0, ybase=0; if (ic!=null) { Rectangle r = ic.getSrcRect(); xbase = r.x; ybase = r.y; } at.setTransform(mag, 0.0, 0.0, mag, -xbase*mag, -ybase*mag); if (outline) { float lineWidth = (float)(getOutlineWidth()*mag); g2.setStroke(new BasicStroke(lineWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)); g2.draw(at.createTransformedShape(shape)); if (doubleHeaded) g2.draw(at.createTransformedShape(shape2)); g2.setStroke(defaultStroke); } else { g2.fill(at.createTransformedShape(shape)); if (doubleHeaded) g2.fill(at.createTransformedShape(shape2)); } if (state!=CONSTRUCTING && !overlay) { int size2 = HANDLE_SIZE/2; handleColor=Color.white; drawHandle(g, screenXD(x1d)-size2, screenYD(y1d)-size2); drawHandle(g, screenXD(x2d)-size2, screenYD(y2d)-size2); drawHandle(g, screenXD(x1d+(x2d-x1d)/2.0)-size2, screenYD(y1d+(y2d-y1d)/2.0)-size2); } if (state!=NORMAL && imp!=null && imp.getRoi()!=null) showStatus(); if (updateFullWindow) {updateFullWindow = false; imp.draw();} } private void flipEnds() { double tmp = x1R; x1R=x2R; x2R=tmp; tmp=y1R; y1R=y2R; y2R=tmp; } private Shape getPath() { path.reset(); path = new GeneralPath(); calculatePoints(); path.moveTo(points[0], points[1]); // tail path.lineTo(points[2 * 1], points[2 * 1 + 1]); // head back path.moveTo(points[2 * 1], points[2 * 1 + 1]); // head back if (style==OPEN) path.moveTo(points[2 * 2], points[2 * 2 + 1]); else path.lineTo(points[2 * 2], points[2 * 2 + 1]); // left point path.lineTo(points[2 * 3], points[2 * 3 + 1]); // head tip path.lineTo(points[2 * 4], points[2 * 4 + 1]); // right point path.lineTo(points[2 * 1], points[2 * 1 + 1]); // back to the head back return path; } /** Based on the method with the same name in Fiji's Arrow plugin, written by Jean-Yves Tinevez and Johannes Schindelin. */ private void calculatePoints() { double tip = 0.0; double base; double shaftWidth = getStrokeWidth(); double length = 8+10*shaftWidth*0.5; length = length*(headSize/10.0); length -= shaftWidth*1.42; if (style==NOTCHED) length*=0.74; if (style==OPEN) length*=1.32; if (length<0.0 || style==HEADLESS) length=0.0; x1d=x+x1R; y1d=y+y1R; x2d=x+x2R; y2d=y+y2R; x1=(int)x1d; y1=(int)y1d; x2=(int)x2d; y2=(int)y2d; double dx=x2d-x1d, dy=y2d-y1d; double arrowLength = Math.sqrt(dx*dx+dy*dy); dx=dx/arrowLength; dy=dy/arrowLength; if (doubleHeaded && style!=HEADLESS) { points[0] = (float)(x1d+dx*shaftWidth*2.0); points[1] = (float)(y1d+dy*shaftWidth*2.0); } else { points[0] = (float)x1d; points[1] = (float)y1d; } if (length>0) { double factor = style==OPEN?1.3:1.42; points[2*3] = (float)(x2d-dx*shaftWidth*factor); points[2*3+1] = (float)(y2d-dy*shaftWidth*factor); } else { points[2*3] = (float)x2d; points[2*3+1] = (float)y2d; } final double alpha = Math.atan2(points[2*3+1]-points[1], points[2*3]-points[0]); double SL = 0.0; switch (style) { case FILLED: case HEADLESS: tip = Math.toRadians(20.0); base = Math.toRadians(90.0); points[1*2] = (float) (points[2*3] - length*Math.cos(alpha)); points[1*2+1] = (float) (points[2*3+1] - length*Math.sin(alpha)); SL = length*Math.sin(base)/Math.sin(base+tip);; break; case NOTCHED: tip = Math.toRadians(20); base = Math.toRadians(120); points[1*2] = (float) (points[2*3] - length*Math.cos(alpha)); points[1*2+1] = (float) (points[2*3+1] - length*Math.sin(alpha)); SL = length*Math.sin(base)/Math.sin(base+tip);; break; case OPEN: tip = Math.toRadians(25); //30 points[1*2] = points[2*3]; points[1*2+1] = points[2*3+1]; SL = length; break; } // P2 = P3 - SL*alpha+tip points[2*2] = (float) (points[2*3] - SL*Math.cos(alpha+tip)); points[2*2+1] = (float) (points[2*3+1] - SL*Math.sin(alpha+tip)); // P4 = P3 - SL*alpha-tip points[2*4] = (float) (points[2*3] - SL*Math.cos(alpha-tip)); points[2*4+1] = (float) (points[2*3+1] - SL*Math.sin(alpha-tip)); } private Shape getShape() { Shape arrow = getPath(); BasicStroke stroke = new BasicStroke((float)getStrokeWidth(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); Shape outlineShape = stroke.createStrokedShape(arrow); Area a1 = new Area(arrow); Area a2 = new Area(outlineShape); try {a1.add(a2);} catch(Exception e) {}; return a1; } private ShapeRoi getShapeRoi() { Shape arrow = getPath(); BasicStroke stroke = new BasicStroke(getStrokeWidth(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); ShapeRoi sroi = new ShapeRoi(arrow); Shape outlineShape = stroke.createStrokedShape(arrow); sroi.or(new ShapeRoi(outlineShape)); return sroi; } public ImageProcessor getMask() { if (width==0 && height==0) return null; else return getShapeRoi().getMask(); } private double getOutlineWidth() { double width = getStrokeWidth()/8.0; if (width<1.0) width = 1.0; double head = headSize/8.0; if (head<1.0) head = 1.0; double lineWidth = width*head; if (lineWidth<1.0) lineWidth = 1.0; return lineWidth; } public void drawPixels(ImageProcessor ip) { ShapeRoi shapeRoi = getShapeRoi(); ShapeRoi shapeRoi2 = null; if (doubleHeaded) { flipEnds(); shapeRoi2 = getShapeRoi(); flipEnds(); } if (outline) { int lineWidth = ip.getLineWidth(); ip.setLineWidth((int)Math.round(getOutlineWidth())); shapeRoi.drawPixels(ip); if (doubleHeaded) shapeRoi2.drawPixels(ip); ip.setLineWidth(lineWidth); } else { ip.fill(shapeRoi); if (doubleHeaded) ip.fill(shapeRoi2); } } public boolean contains(int x, int y) { return getShapeRoi().contains(x, y); } /** Return the bounding rectangle of this arrow. */ public Rectangle getBounds() { return getShapeRoi().getBounds(); } protected void handleMouseDown(int sx, int sy) { super.handleMouseDown(sx, sy); startxd = ic!=null?ic.offScreenXD(sx):sx; startyd = ic!=null?ic.offScreenYD(sy):sy; } protected int clipRectMargin() { double mag = getMagnification(); double arrowWidth = getStrokeWidth(); double size = 8+10*arrowWidth*mag*0.5; return (int)Math.max(size*2.0, headSize); } public boolean isDrawingTool() { return true; } public static void setDefaultWidth(double width) { defaultWidth = (float)width; } public static double getDefaultWidth() { return defaultWidth; } public void setStyle(int style) { this.style = style; } public int getStyle() { return style; } public static void setDefaultStyle(int style) { defaultStyle = style; } public static int getDefaultStyle() { return defaultStyle; } public void setHeadSize(double headSize) { this.headSize = headSize; } public double getHeadSize() { return headSize; } public static void setDefaultHeadSize(double size) { defaultHeadSize = size; } public static double getDefaultHeadSize() { return defaultHeadSize; } public void setDoubleHeaded(boolean b) { doubleHeaded = b; } public boolean getDoubleHeaded() { return doubleHeaded; } public static void setDefaultDoubleHeaded(boolean b) { defaultDoubleHeaded = b; } public static boolean getDefaultDoubleHeaded() { return defaultDoubleHeaded; } public void setOutline(boolean b) { outline = b; } public boolean getOutline() { return outline; } public static void setDefaultOutline(boolean b) { defaultOutline = b; } public static boolean getDefaultOutline() { return defaultOutline; } }
96f8ea2d0189be06a8d26c6b68811976dc2db97f
9a66438560d4dbace9c0efa9b3c9ef70dbff6af4
/app/src/main/java/github/grace5921/TwrpBuilder/Fragment/BackupFragment.java
19231b7aa240e0f345e5d02175edce423a22bb41
[]
no_license
Waintlever1/TwrpBuilder
d84bb2a1b168abeb82067f6dc9ccd85fad77b963
62f063df154e130f91627992fbee69005c83c295
refs/heads/master
2020-06-23T07:44:56.491713
2016-11-24T07:18:03
2016-11-24T07:18:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
18,370
java
package github.grace5921.TwrpBuilder.Fragment; import android.app.NotificationManager; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v4.app.NotificationCompat; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.storage.FileDownloadTask; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.OnProgressListener; import com.google.firebase.storage.StorageMetadata; import com.google.firebase.storage.StorageReference; import com.google.firebase.storage.UploadTask; import java.io.File; import java.util.List; import eu.chainfire.libsuperuser.Shell; import github.grace5921.TwrpBuilder.R; import github.grace5921.TwrpBuilder.ads.AdsActivity; import github.grace5921.TwrpBuilder.util.Config; import github.grace5921.TwrpBuilder.util.User; import static github.grace5921.TwrpBuilder.firebase.FirebaseInstanceIDService.refreshedToken; import static github.grace5921.TwrpBuilder.util.Config.CheckDownloadedTwrp; /** * Created by Sumit on 19.10.2016. */ public class BackupFragment extends Fragment { /*Buttons*/ public static Button mUploadBackup; public static Button mDownloadRecovery; private Button mBackupButton; private Button mCancel; /*TextView*/ private TextView ShowOutput; private TextView mBuildDescription; private TextView mBuildApproved; /*Uri*/ private Uri file; private UploadTask uploadTask; /*FireBase*/ public static FirebaseStorage storage = FirebaseStorage.getInstance(); public static StorageReference storageRef = storage.getReferenceFromUrl("gs://twrpbuilder.appspot.com/"); public static StorageReference riversRef; public static StorageReference getRecoveryStatus; private FirebaseDatabase mFirebaseInstance; private FirebaseAuth mFirebaseAuth; private DatabaseReference mUploader; private DatabaseReference mDownloader; /*Strings*/ private String store_RecoveryPartitonPath_output; private String[] parts; private String[] recovery_output_last_value; private String recovery_output_path; private List<String> RecoveryPartitonPath; private String userId; private String Email; private String Uid; /*Progress Bar*/ private ProgressDialog mProgressDialog; private ProgressBar mProgressBar; /*Notification*/ private NotificationManager mNotifyManager; private NotificationCompat.Builder mBuilder; /**/ private ImageView mRequestApprovedImage; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_backup, container, false); /*Buttons*/ mBackupButton = (Button) view.findViewById(R.id.BackupRecovery); mUploadBackup = (Button) view.findViewById(R.id.UploadBackup); mDownloadRecovery = (Button) view.findViewById(R.id.get_recovery); mCancel=(Button)view.findViewById(R.id.cancel_upload); /*TextView*/ ShowOutput = (TextView) view.findViewById(R.id.show_output); mBuildDescription=(TextView)view.findViewById(R.id.build_description); mBuildApproved=(TextView)view.findViewById(R.id.build_approved); /*Notification*/ mNotifyManager = (NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE); /*Progress Bar*/ mProgressBar=(ProgressBar)view.findViewById(R.id.progress_bar); /*ImageView*/ mRequestApprovedImage=(ImageView)view.findViewById(R.id.twrp_request_approved); /*Define Methods*/ mFirebaseInstance = FirebaseDatabase.getInstance(); mUploader = mFirebaseInstance.getReference("Uploader"); mDownloader=mFirebaseInstance.getReference("Downloader"); mFirebaseAuth=FirebaseAuth.getInstance(); Email=mFirebaseAuth.getCurrentUser().getEmail(); Uid=mFirebaseAuth.getCurrentUser().getUid(); file = Uri.fromFile(new File("/sdcard/TwrpBuilder/TwrpBuilderRecoveryBackup.tar")); riversRef = storageRef.child("queue/" + Build.BRAND + "/" + Build.BOARD + "/" + Build.MODEL + "/" + file.getLastPathSegment()); getRecoveryStatus = storageRef.child("output/" + Build.BRAND + "/" + Build.BOARD + "/" + Build.MODEL + "/" + "Twrp.img"); if(CheckDownloadedTwrp()) {mDownloadRecovery.setEnabled(false); mBuildDescription.setVisibility(View.GONE);}else{mDownloadRecovery.setEnabled(true); mBuildDescription.setVisibility(View.GONE);} /*Buttons Visibility */ if (Config.checkBackup()) { riversRef.getMetadata().addOnSuccessListener(new OnSuccessListener<StorageMetadata>() { @Override public void onSuccess(StorageMetadata storageMetadata) { mUploadBackup.setVisibility(View.GONE); mBuildDescription.setVisibility(View.VISIBLE); ShowOutput.setVisibility(View.GONE); try { Intent intent = new Intent(getActivity(), AdsActivity.class); startActivity(intent); }catch (Exception exception) { Toast.makeText(getContext(), R.string.failed_to_load_ads, Toast.LENGTH_LONG).show(); } if(mDownloadRecovery.getVisibility()==View.VISIBLE) {mBuildDescription.setVisibility(View.GONE);}else{mBuildDescription.setText(R.string.build_description_text);} } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception exception) { mUploadBackup.setVisibility(View.VISIBLE); } }); } getRecoveryStatus.getMetadata().addOnSuccessListener(new OnSuccessListener<StorageMetadata>() { @Override public void onSuccess(StorageMetadata storageMetadata) { mBuildApproved.setVisibility(View.VISIBLE); mBuildDescription.setVisibility(View.GONE); mBuildApproved.setText(R.string.request_approved); mDownloadRecovery.setVisibility(View.VISIBLE); mRequestApprovedImage.setVisibility(View.VISIBLE); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception exception) { // Uh-oh, an error occurred! } }); /*Find Recovery (Works if device supports /dev/block/platfrom/---/by-name) else gives Exception*/ try { RecoveryPartitonPath = Shell.SU.run("ls -la `find /dev/block/platform/ -type d -name \"by-name\"` | grep RECOVERY"); store_RecoveryPartitonPath_output = String.valueOf(RecoveryPartitonPath); parts = store_RecoveryPartitonPath_output.split("\\s+"); recovery_output_last_value = parts[7].split("\\]"); recovery_output_path = recovery_output_last_value[0]; ShowOutput.setVisibility(View.VISIBLE); } catch (Exception e) { RecoveryPartitonPath = Shell.SU.run("ls -la `find /dev/block/platform/ -type d -name \"by-name\"` | grep recovery"); store_RecoveryPartitonPath_output = String.valueOf(RecoveryPartitonPath); parts = store_RecoveryPartitonPath_output.split("\\s+"); ShowOutput.setVisibility(View.VISIBLE); try { recovery_output_last_value = parts[7].split("\\]"); recovery_output_path = recovery_output_last_value[0]; } catch (Exception ExceptionE) { Toast.makeText(getContext(), R.string.device_not_supported, Toast.LENGTH_LONG).show(); } } /*Check For Backup */ if (Config.checkBackup()) { ShowOutput.setText(getString(R.string.recovery_mount_point) + recovery_output_path); } else { if(mDownloadRecovery.getVisibility()==View.VISIBLE) { mBackupButton.setVisibility(View.GONE); }else { mBackupButton.setVisibility(View.VISIBLE); ShowOutput.setText(R.string.warning_about_recovery_backup);} } /*On Click Listeners */ mDownloadRecovery.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { DownloadStream(); } } ); mBackupButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { mBackupButton.setVisibility(View.GONE); Shell.SU.run("mkdir -p /sdcard/TwrpBuilder ; dd if=" + recovery_output_path + " of=/sdcard/TwrpBuilder/Recovery.img ; ls -la `find /dev/block/platform/ -type d -name \"by-name\"` > /sdcard/TwrpBuilder/mounts ; getprop ro.build.fingerprint > /sdcard/TwrpBuilder/fingerprint ; tar -c /sdcard/TwrpBuilder/Recovery.img /sdcard/TwrpBuilder/fingerprint /sdcard/TwrpBuilder/mounts > /sdcard/TwrpBuilder/TwrpBuilderRecoveryBackup.tar "); ShowOutput.setText("Backed up recovery " + recovery_output_path); Snackbar.make(view, R.string.made_recovery_backup, Snackbar.LENGTH_LONG) .setAction("Action", null).show(); mUploadBackup.setVisibility(View.VISIBLE); } } ); mUploadBackup.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Snackbar.make(view, R.string.Uploading_please_wait, Snackbar.LENGTH_INDEFINITE) .setAction("Action", null).show(); //creating a new user uploadStream(); } } ); return view; } @Override public void onResume() { super.onResume(); } private void uploadStream() { riversRef = storageRef.child("queue/" + Build.BRAND + "/" + Build.BOARD + "/" + Build.MODEL + "/" + file.getLastPathSegment()); uploadTask = riversRef.putFile(file); mUploadBackup.setEnabled(false); /*showHorizontalProgressDialog("Uploading", "Please wait...");*/ uploadTask.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { /* hideProgressDialog();*/ Log.d("Status", "uploadStream : " + taskSnapshot.getTotalByteCount()); mUploadBackup.setVisibility(View.GONE); Snackbar.make(getView(), getString(R.string.upload_finished), Snackbar.LENGTH_LONG) .setAction("Action", null).show(); ShowOutput.setText(R.string.build_description_text); mBuilder.setContentText(getString(R.string.upload_finished)); mBuilder.setOngoing(false); mNotifyManager.notify(1, mBuilder.build()); mProgressBar.setVisibility(View.GONE); Intent intent = new Intent(getActivity(), AdsActivity.class); startActivity(intent); mCancel.setVisibility(View.GONE); userId = mUploader.push().getKey(); User user = new User(Build.BRAND, Build.BOARD,Build.MODEL,Email,Uid,refreshedToken); mUploader.child(userId).setValue(user); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { mUploadBackup.setVisibility(View.VISIBLE); Snackbar.make(getView(), R.string.failed_to_upload, Snackbar.LENGTH_SHORT) .setAction("Action", null).show(); mProgressBar.setVisibility(View.GONE); mUploadBackup.setEnabled(true); mCancel.setVisibility(View.GONE); mBuilder.setContentText(getString(R.string.failed_to_upload)); mBuilder.setOngoing(false); mNotifyManager.notify(1, mBuilder.build()); ShowOutput.setText(R.string.failed_to_upload); /*hideProgressDialog();*/ } }).addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() { @Override public void onProgress(UploadTask.TaskSnapshot taskSnapshot) { final double progress = (100 * taskSnapshot.getBytesTransferred()) / taskSnapshot.getTotalByteCount(); Log.d("uploadDataInMemory progress : ", String.valueOf(progress)); ShowOutput.setVisibility(View.VISIBLE); ShowOutput.setText(String.valueOf(progress + "%")); mBuilder = new NotificationCompat.Builder(getContext()) .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle(getString(R.string.uploading)) .setAutoCancel(false) .setOngoing(true) .setContentText(getString(R.string.uploaded) + progress+("%") + "/100%"+")"); mNotifyManager.notify(1, mBuilder.build()); mProgressBar.setVisibility(View.VISIBLE); /*updateProgress((int) progress);*/ /*To cancel upload*/ mCancel.setVisibility(View.VISIBLE); mCancel.setText("Cancel Upload"); mCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { uploadTask.cancel(); mCancel.setVisibility(View.GONE); Snackbar.make(getView(), R.string.upload_cancelled, Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); } }); } private void DownloadStream() { File localFile = new File(Environment.getExternalStorageDirectory(), "TwrpBuilder/Twrp.img"); /* showHorizontalProgressDialog("Downloading", "Please wait...");*/ mDownloadRecovery.setEnabled(false); getRecoveryStatus.getFile(localFile).addOnSuccessListener(new OnSuccessListener<FileDownloadTask.TaskSnapshot>() { @Override public void onSuccess(FileDownloadTask.TaskSnapshot taskSnapshot) { /* hideProgressDialog();*/ Snackbar.make(getView(), R.string.twrp_downloaded, Snackbar.LENGTH_LONG).setAction("Action", null).show(); mBuilder.setContentText(getString(R.string.download_complete)); mBuilder.setOngoing(false); mNotifyManager.notify(1, mBuilder.build()); mProgressBar.setVisibility(View.GONE); mBuildDescription.setVisibility(View.GONE); Intent intent = new Intent(getActivity(), AdsActivity.class); startActivity(intent); mCancel.setVisibility(View.GONE); userId = mDownloader.push().getKey(); User user = new User(Build.BRAND, Build.BOARD,Build.MODEL,Email,Uid,refreshedToken); mDownloader.child(userId).setValue(user); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception exception) { /* hideProgressDialog();*/ Snackbar.make(getView(), R.string.failed_to_download, Snackbar.LENGTH_LONG).setAction("Action", null).show(); mProgressBar.setVisibility(View.GONE); mDownloadRecovery.setEnabled(true); mBuildDescription.setVisibility(View.GONE); } }).addOnProgressListener(new OnProgressListener<FileDownloadTask.TaskSnapshot>() { @Override public void onProgress(FileDownloadTask.TaskSnapshot taskSnapshot) { double progress = (100 * taskSnapshot.getBytesTransferred()) / taskSnapshot.getTotalByteCount(); Log.d("Download in progress : ", String.valueOf(progress)); ShowOutput.setVisibility(View.VISIBLE); ShowOutput.setText(String.valueOf(progress + "%")); mBuilder = new NotificationCompat.Builder(getContext()) .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle(getString(R.string.downloading)) .setAutoCancel(false) .setOngoing(true) .setContentText(getString(R.string.downloaded) + progress+"%" + "/100%"+")"); mNotifyManager.notify(1, mBuilder.build()); mProgressBar.setVisibility(View.VISIBLE); mBuildDescription.setVisibility(View.GONE); /* updateProgress((int) progress);*/ } }); } }
c262c6f036b7484a667bde86070247cf8b40e113
9bc4f6d01f492607589d0407bb6e4698b6d0f0b7
/Corba/CalculadoraApp/CalculadoraOperations.java
3e25a3c63e7257ba8e94dbf1c0f6617d86db43a8
[]
no_license
gonLuna/SistemasDistribuidos
56a1575f4718a3bb244eb60d6633a93d4a8b3553
ccc3bc1f70fdd6f7307b158b77f0c29e797482d1
refs/heads/master
2021-01-10T10:53:38.846673
2015-11-06T01:23:52
2015-11-06T01:23:52
44,398,611
0
0
null
null
null
null
UTF-8
Java
false
false
427
java
package CalculadoraApp; /** * CalculadoraApp/CalculadoraOperations.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from Calculadora.idl * jueves 5 de noviembre de 2015 20H05' COT */ public interface CalculadoraOperations { double add (double x, double y); double substract (double x, double y); double multiply (double x, double y); void shutdown (); } // interface CalculadoraOperations
af664b11a886b275762134bc80bc55a37bc96501
d0d748713d3ba3d3b27c3d2d0c1c1c07ca180eb8
/IT/Student Presentations/2018-19/Rocio Paloma Romero/Exposicion Inglés/Snake-Lluvia/core/src/com/pddm/game/GameScreen.java
2620d0a6915fb3b2a160560c6720bdb99e6222ba
[]
no_license
MahrozJawad/2-DAM
b08d9baf987cff4c1a3f567144d7af786ee3cdcd
9bf039771f782d6055e39d4b25ff5a8e1b112f23
refs/heads/master
2022-04-01T17:13:49.820532
2020-02-11T13:15:09
2020-02-11T13:15:09
218,342,769
0
0
null
null
null
null
UTF-8
Java
false
false
16,893
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 com.pddm.game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; import com.badlogic.gdx.ScreenAdapter; import com.badlogic.gdx.graphics.Camera; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.PerspectiveCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.GlyphLayout; import com.badlogic.gdx.graphics.g2d.ParticleEffect; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.viewport.FitViewport; import com.badlogic.gdx.utils.viewport.Viewport; import java.util.Set; /** * * @author alumno */ public class GameScreen extends ScreenAdapter { private static final float WORLD_WIDTH = 640; private static final float WORLD_HEIGHT = 480; private ParticleEffect particle= new ParticleEffect(); private enum STATE { PLAYING, GAME_OVER, Pause } private STATE state = STATE.PLAYING; private SpriteBatch batch; private SpriteBatch batchScore; private Texture snakeHead; private Texture apple; private Texture snakeBody; private Texture fondo1; private Texture fondo2; private Array<BodyPart> bodyParts = new Array<BodyPart>(); private int snakeXBeforeUpdate = 0, snakeYBeforeUpdate = 0; private boolean appleAvailable = false; private int appleX, appleY; private static final float MOVE_TIME = 0.25F; private float timer = MOVE_TIME; private static final int SNAKE_MOVEMENT = 32; private int snakeX = 0, snakeY = 0; private static final int RIGHT = 0; private static final int LEFT = 1; private static final int UP = 2; private static final int DOWN = 3; private int snakeDirection = RIGHT; private ShapeRenderer shapeRenderer; private static final int GRID_CELL = 32; boolean directionSet = false; private BitmapFont bitmapFont; private GlyphLayout layout = new GlyphLayout(); private static final String GAME_OVER_TEXT = "Game Over...Tap space to restart"; private int score = 0; private static final int POINTS_PER_APPLE = 20; private Viewport viewport; private Camera camera; private PerspectiveCamera camaraPerspectiveCamera; private OrthographicCamera camaraOrthographicCamera; private Texture fondoactual; private Array<Texture> fondos = new Array<Texture>(); private void moveSnake() { snakeXBeforeUpdate = snakeX; snakeYBeforeUpdate = snakeY; switch (snakeDirection) { case RIGHT: { snakeX += SNAKE_MOVEMENT; return; } case LEFT: { snakeX -= SNAKE_MOVEMENT; return; } case UP: { snakeY += SNAKE_MOVEMENT; return; } case DOWN: { snakeY -= SNAKE_MOVEMENT; return; } } } private void updateBodyPartsPosition() { if (bodyParts.size > 0) { BodyPart bodyPart = bodyParts.removeIndex(0); bodyPart.updateBodyPosition(snakeXBeforeUpdate, snakeYBeforeUpdate); bodyParts.add(bodyPart); } } @Override public void show() { final float FOVY_DEGREES = 60; camaraPerspectiveCamera = new PerspectiveCamera(FOVY_DEGREES, 640, 480); camaraPerspectiveCamera.position.set(640 / 2, 480 / 2 * -1.75f, 480); camaraPerspectiveCamera.near = 1f; // Near Clipping plane or VP. camaraPerspectiveCamera.far = WORLD_WIDTH * 2f; // Far Clipping plane. camaraPerspectiveCamera.lookAt(WORLD_WIDTH / 2, WORLD_HEIGHT / 2, 0); camaraOrthographicCamera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());; camera = camaraOrthographicCamera; camera.position.set(WORLD_WIDTH / 2, WORLD_HEIGHT / 2, 0); ((OrthographicCamera) camera).zoom = 1; viewport = new FitViewport(WORLD_WIDTH, WORLD_HEIGHT, camera); ((OrthographicCamera) camera).zoom = 1; bitmapFont = new BitmapFont(); shapeRenderer = new ShapeRenderer(); batch = new SpriteBatch(); batchScore = new SpriteBatch(); snakeHead = new Texture(Gdx.files.internal("snakehead.png")); apple = new Texture(Gdx.files.internal("apple.png")); snakeBody = new Texture(Gdx.files.internal("snakebody.png")); fondo1 = new Texture(Gdx.files.internal("bg2.png")); fondo2 = new Texture(Gdx.files.internal("bg3.png")); fondoactual = fondo1; particle.load(Gdx.files.internal("rain.p"),Gdx.files.internal("")); particle.getEmitters().first().setPosition(0,Gdx.graphics.getHeight()); particle.start(); } @Override public void render(float delta) { switch (state) { case PLAYING: queryInput(); Pausar(); updateSnake(delta); updateLluvia(delta); checkAppleCollision(); checkAndPlaceApple(); /* batch2.begin(); effect.draw(batch2,delta); batch2.end();*/ break; case GAME_OVER: checkForRestart(); break; case Pause: Pausar(); break; } clearScreen(fondoactual); // drawGrid(); draw(); drawParticle(); } private void drawParticle() { batch.begin(); particle.draw(batch); batch.end(); } private void updateLluvia(float delta) { particle.update(delta); } private void updateSnake(float delta) { if (state != STATE.Pause) { timer -= delta; if (timer <= 0) { timer = MOVE_TIME; moveSnake(); checkForOutOfBounds(); updateBodyPartsPosition(); checkSnakeBodyCollision(); directionSet = false; if (camera.getClass() == OrthographicCamera.class) { moidificaCamara(); } viewport.getCamera().update(); } } } private void moidificaCamara() { Float minCameraX = ((OrthographicCamera) camera).zoom * (camera.viewportWidth / 2); Float maxCameraX = WORLD_WIDTH - minCameraX; Float minCameraY = ((OrthographicCamera) camera).zoom * (camera.viewportHeight / 2); Float maxCameraY = WORLD_HEIGHT - minCameraY; Float posCameraX = (snakeX > minCameraX ? snakeX : minCameraX); posCameraX = (posCameraX < maxCameraX ? posCameraX : maxCameraX); Float posCameraY = (snakeY > minCameraY ? snakeY : minCameraY); posCameraY = (posCameraY < maxCameraY ? posCameraY : maxCameraY); /*if (((OrthographicCamera) viewport.getCamera()).zoom < 0.60) { viewport.getCamera().position.set(posCameraX, posCameraY, 0); camaraOrthographicCamera = (OrthographicCamera) camera; } else { viewport.getCamera().position.set(maxCameraX, maxCameraY, 0); camaraOrthographicCamera = (OrthographicCamera) camera; }*/ camera.position.set(posCameraX,posCameraY,0); } private void clearScreen(Texture fondo) { Gdx.gl.glClearColor(Color.BLACK.r, Color.BLACK.g, Color.BLACK.b, Color.BLACK.a); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); batch.draw(fondo, 0, 0, WORLD_WIDTH, WORLD_HEIGHT); batch.end(); } private void draw() { batch.setProjectionMatrix(camera.projection); batch.setTransformMatrix(camera.view); batch.begin(); particle.draw(batch); batch.draw(snakeHead, snakeX, snakeY); for (BodyPart bodyPart : bodyParts) { bodyPart.draw(batch); } if (appleAvailable) { batch.draw(apple, appleX, appleY); } if (state == STATE.GAME_OVER) { layout.setText(bitmapFont, GAME_OVER_TEXT); bitmapFont.draw(batch, GAME_OVER_TEXT, (viewport.getWorldWidth() - layout.width) / 2, (viewport.getWorldHeight() - layout.height) / 2); } if (state == STATE.Pause) { layout.setText(bitmapFont, GAME_OVER_TEXT); bitmapFont.draw(batch, "Pausa", (viewport.getWorldWidth() - layout.width) / 2, (viewport.getWorldHeight() - layout.height) / 2); } batch.end(); batchScore.begin(); drawSore(); batchScore.end(); } private void checkForOutOfBounds() { if (snakeX >= viewport.getWorldWidth()) { snakeX = 0; } if (snakeX < 0) { snakeX = (int) viewport.getWorldWidth() - SNAKE_MOVEMENT; } if (snakeY >= (int) viewport.getWorldHeight()) { snakeY = 0; } if (snakeY < 0) { snakeY = (int) viewport.getWorldHeight() - SNAKE_MOVEMENT; } } private void queryInput() { boolean lPressed = Gdx.input.isKeyPressed(Input.Keys.LEFT); boolean rPressed = Gdx.input.isKeyPressed(Input.Keys.RIGHT); boolean uPressed = Gdx.input.isKeyPressed(Input.Keys.UP); boolean dPressed = Gdx.input.isKeyPressed(Input.Keys.DOWN); boolean fPressed = Gdx.input.isKeyJustPressed(Input.Keys.F); boolean oPressed = Gdx.input.isKeyJustPressed(Input.Keys.O); boolean shiftoPressed = Gdx.input.isKeyPressed(Input.Keys.SHIFT_LEFT) && Gdx.input.isKeyPressed(Input.Keys.O); boolean pPressed = Gdx.input.isKeyJustPressed(Input.Keys.P); boolean shiftX = Gdx.input.isKeyPressed(Input.Keys.SHIFT_LEFT) && Gdx.input.isKeyPressed(Input.Keys.X); boolean shiftY = Gdx.input.isKeyPressed(Input.Keys.SHIFT_LEFT) && Gdx.input.isKeyPressed(Input.Keys.Y); boolean shiftZ = Gdx.input.isKeyPressed(Input.Keys.SHIFT_LEFT) && Gdx.input.isKeyPressed(Input.Keys.Z); if (lPressed) { updateDirection(LEFT); } if (rPressed) { updateDirection(RIGHT); } if (uPressed) { updateDirection(UP); } if (dPressed) { updateDirection(DOWN); } if (fPressed) { updatefondo(); } if (camera.getClass() == OrthographicCamera.class) { if (oPressed) { if (((OrthographicCamera) camera).zoom < 1) { ((OrthographicCamera) camera).zoom += 0.025; } } if (shiftoPressed) { if (((OrthographicCamera) camera).zoom > 0.60) { ((OrthographicCamera) camera).zoom -= 0.025; } } } if (pPressed) { if (camera.getClass() == OrthographicCamera.class) { camera = camaraPerspectiveCamera; } else { camera = camaraOrthographicCamera; } camera.update(); } if (camera.getClass() == PerspectiveCamera.class) { if (shiftX) { camera.translate(10, 0, 0); } if (shiftY) { camera.translate(0, 10, 0); } if (shiftZ) { camera.translate(0, 0, 10); } camera.lookAt(WORLD_WIDTH / 2, WORLD_HEIGHT / 2, 0); camera.update(); } } private void Pausar() { boolean espacio = Gdx.input.isKeyJustPressed(Input.Keys.SPACE); if (espacio) { if(state==STATE.PLAYING) { state = STATE.Pause; } else { state=STATE.PLAYING; } } } private void updatefondo() { if (fondoactual.equals(fondo1)) { fondoactual = fondo2; } else { fondoactual = fondo1; } } private void checkAndPlaceApple() { if (!appleAvailable) { do { appleX = (int) MathUtils.random(viewport.getWorldWidth() / SNAKE_MOVEMENT - 1) * SNAKE_MOVEMENT; appleY = (int) MathUtils.random(viewport.getWorldHeight() / SNAKE_MOVEMENT - 1) * SNAKE_MOVEMENT; appleAvailable = true; } while (appleX == snakeX && appleY == snakeY); } } private void checkAppleCollision() { if (appleAvailable && appleX == snakeX && appleY == snakeY) { appleAvailable = false; BodyPart bodyPart = new BodyPart(snakeBody); bodyPart.updateBodyPosition(snakeX, snakeY); bodyParts.insert(0, bodyPart); addScore(); } } private class BodyPart { private int x, y; private Texture texture; public BodyPart(Texture texture) { this.texture = texture; } public void updateBodyPosition(int x, int y) { this.x = x; this.y = y; } public void draw(Batch batch) { if (!(x == snakeX && y == snakeY)) { batch.draw(texture, x, y); } } } private void drawGrid() { shapeRenderer.setProjectionMatrix(camera.projection); shapeRenderer.setTransformMatrix(camera.view); shapeRenderer.begin(ShapeRenderer.ShapeType.Line); for (int x = 0; x < viewport.getWorldWidth(); x += GRID_CELL) { for (int y = 0; y < viewport.getWorldHeight(); y += GRID_CELL) { shapeRenderer.rect(x, y, GRID_CELL, GRID_CELL); } } shapeRenderer.end(); } @Override public void resize(int width, int height) { super.resize(width, height); viewport.update(width, height); } private void updateIfNotOppositeDirection(int newSnakeDirection, int oppositeDirection) { if (snakeDirection != oppositeDirection || bodyParts.size == 0) { snakeDirection = newSnakeDirection; } } private void updateDirection(int newSnakeDirection) { if (!directionSet && snakeDirection != newSnakeDirection) { directionSet = true; switch (newSnakeDirection) { case LEFT: { updateIfNotOppositeDirection(newSnakeDirection, RIGHT); } break; case RIGHT: { updateIfNotOppositeDirection(newSnakeDirection, LEFT); } break; case UP: { updateIfNotOppositeDirection(newSnakeDirection, DOWN); } break; case DOWN: { updateIfNotOppositeDirection(newSnakeDirection, UP); } break; } } } private void checkSnakeBodyCollision() { for (BodyPart bodyPart : bodyParts) { if (bodyPart.x == snakeX && bodyPart.y == snakeY) { state = STATE.GAME_OVER; } } } private void doRestart() { state = STATE.PLAYING; bodyParts.clear(); snakeDirection = RIGHT; directionSet = false; timer = MOVE_TIME; snakeX = 0; snakeY = 0; snakeXBeforeUpdate = 0; snakeYBeforeUpdate = 0; appleAvailable = false; score = 0; } private void checkForRestart() { if (Gdx.input.isKeyPressed(Input.Keys.SPACE)) { doRestart(); } } private void addScore() { score += POINTS_PER_APPLE; } private void drawSore() { if (state == STATE.PLAYING) { String scoreAsString = Integer.toString(score); GlyphLayout scoreBounds = new GlyphLayout(); scoreBounds.setText(bitmapFont, scoreAsString); //bitmapFont.draw(batchScore, scoreAsString, (viewport.getWorldWidth() - scoreBounds.width) , (4 * viewport.getWorldHeight() / 5) - scoreBounds.height / 2); bitmapFont.draw(batchScore, scoreAsString, (scoreBounds.width), 20); } } }
c530ce08c5d7024da26b10f61a6d06067004ad7a
1dbde128175ce49be2e70fdecc35fab02bfdfaa4
/fifthAssignmentJavaCamp/src/fifthAssignmentJavaCamp/business/concreates/VerificationManager.java
401133229e91273f59290daf172b914dc057a012
[]
no_license
vildntn/JavaCamp
aa12e7571202843a0e4fae129156442df738d45c
13745aedbb1034b25ae4527a53aa2c4ff6856c64
refs/heads/main
2023-05-11T15:16:48.914898
2021-05-26T13:51:30
2021-05-26T13:51:30
363,417,209
6
0
null
null
null
null
UTF-8
Java
false
false
664
java
package fifthAssignmentJavaCamp.business.concreates; import java.util.Scanner; import fifthAssignmentJavaCamp.business.abstracts.VerificationService; public class VerificationManager implements VerificationService { private final String code="something"; public String getCode() { return code; } @Override public void verificateByCode() { System.out.println("Verification Code: "+getCode()); Scanner input=new Scanner(System.in); System.out.print("Please enter the verification code: "); String event=input.nextLine(); if(!code.equals(event)) { System.out.println("You entered an invalid code!"); } } }
[ "Lenovo@DESKTOP-TCNT505" ]
Lenovo@DESKTOP-TCNT505
7af789c18909d280ab6bf1a65bfe1be4061efdcf
75cdc074413f60834e90d250d30970646d6bfaee
/app/src/main/java/com/kingscastle/nuzi/towerdefence/level/GidBackground.java
e6d83a34d8bd7dd440722da36cd5346c9bc392d9
[]
no_license
ChrisKay27/KingsCastleTowerDefence
d3f2c56131f13e15e9edb1a5620462f0078dd886
3a546518aef200d09ce371a2a61cd6ef53953d99
refs/heads/master
2021-01-22T04:57:06.722148
2015-08-25T04:49:50
2015-08-25T04:49:50
41,343,353
1
0
null
null
null
null
UTF-8
Java
false
false
11,144
java
package com.kingscastle.nuzi.towerdefence.level; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Paint.Align; import android.graphics.PorterDuff; import android.graphics.PorterDuffXfermode; import android.graphics.Rect; import com.kingscastle.nuzi.towerdefence.R; import com.kingscastle.nuzi.towerdefence.framework.Assets; import com.kingscastle.nuzi.towerdefence.framework.Graphics; import com.kingscastle.nuzi.towerdefence.framework.Image; import com.kingscastle.nuzi.towerdefence.framework.Rpg; import com.kingscastle.nuzi.towerdefence.gameUtils.vector; import java.util.ArrayList; public class GidBackground { private final int mapWidth , mapHeight , mapWidthInPx , mapHeightInPx , regTileWidth , regTileHeight; private final int screenWidth; private final int screenHeight; private final int screenWidthDiv2; private final int screenHeightDiv2; private int numHorzTiles; private int numVertTiles; private ArrayList<TileLayer> layers = new ArrayList<TileLayer>(); private GidTileHolder gidTileHolder = new GidTileHolder(); private Image backgroundImage = Assets.loadImage(R.drawable.large_grass_tile); public GidBackground( int screenWidth , int screenHeight , int mapWidth2 , int mapHeight2 , int regTileWidth2, int regTileHeight2 ) { this.screenWidth = screenWidth; this.screenHeight = screenHeight; this.screenWidthDiv2 = Rpg.getWidthDiv2(); this.screenHeightDiv2 = Rpg.getHeightDiv2(); this.mapWidth = mapWidth2; this.mapHeight = mapHeight2; this.regTileWidth = regTileWidth2 ; this.regTileHeight = regTileHeight2 ; this.mapWidthInPx = mapWidth * regTileWidth2; this.mapHeightInPx = mapHeight * regTileHeight2; loadBackgroundLayer( mapWidthInPx , mapHeightInPx ); } public void addTileset( TilesetParams readTileset ) { gidTileHolder.loadImageIntoGids(readTileset); } void addTileLayer(TileLayer layer) { // if( layer == null ) // return; // //System.out.println("Adding layer : " + layer ); layers.add( layer ); } private void loadBackgroundLayer( int mapWidthInPx , int mapHeightInPx ) { //Image backgroundImage = Assets.loadImage( R.drawable.large_grass_tile ); //gidTileHolder.addImageToGidImages( backgroundImage , backgroundImage.getWidth() , backgroundImage.getHeight() ); numHorzTiles = screenWidth / getRegTileWidth() + 1; numVertTiles = screenHeight / getRegTileHeight() + 1; TileLayer tl = getBackgroundLayer(backgroundImage, mapWidthInPx , mapHeightInPx , screenWidth , screenHeight ); addTileLayer( tl ); } private static TileLayer getBackgroundLayer(Image backgroundTile , int mapWidthInPx , int mapHeightInPx , int screenWidth, int screenHeight) { TileLayer tl = new TileLayer(); int horzTiles = mapWidthInPx / backgroundTile.getWidth(); int vertTiles = mapHeightInPx / backgroundTile.getHeight(); short[][] backgroundGids= new short[vertTiles][horzTiles]; fillWith ( backgroundGids , (short) 1 ); tl.setTileWidth( backgroundTile.getWidth() ); tl.setTileHeight( backgroundTile.getHeight() ); tl.setThisLayersNumHorzTiles( ( screenWidth / tl.getTileWidth() ) + 2 ); tl.setThisLayersNumVertTiles( ( screenHeight / tl.getTileHeight() ) + 2); tl.setGids(backgroundGids); return tl; } private static short[][] fillWith( short[][] array2D, short filler ) { int i = 0, j = 0; while ( j < array2D.length) { while ( i < array2D[j].length) { array2D[j][i] = filler ; i++; } i = 0; j++; } return array2D; } //private long lastmessage; private int xTemp , yTemp , xOffs , yOffs , xGid , yGid ; private Rect src = new Rect(), dst = new Rect(); public void drawBackground( Graphics g , vector centeredOn ) { xTemp = centeredOn.getIntX() - screenWidthDiv2; yTemp = centeredOn.getIntY() - screenHeightDiv2; int x = 0 ; int y = 0 ; // if ( GameTime.getTime() - lastmessage > 1000) // { // System.out.println("GidBackground.drawBackground() : centeredOn is " + centeredOn); // System.out.println(" Current xTemp value for drawing is : " + xTemp ); // System.out.println(" Current xTemp value for drawing is : " + yTemp ); // System.out.println(" There are " + layers.size() + " layers."); // } // short gid; for( TileLayer tl : layers) { xGid = xTemp / tl.getTileWidth(); yGid = yTemp / tl.getTileHeight(); xOffs = -xTemp % tl.getTileWidth(); yOffs = -yTemp % tl.getTileHeight(); for( int j = 0 ; j < tl.getThisLayersNumVertTiles() ; ++ j ) { for( int i = 0 ; i < tl.getThisLayersNumHorzTiles() ; ++ i ) { //gid = tl.getGidFor( xGid + i , yGid + j ); //if( gid != 0 ) //{ //g.drawImage( gidTileHolder.getImage( (short) 1 ), x + xOffs , y + yOffs , dstATopPaint ); // if( x+xOffs+backgroundImage.getWidth() > mapWidthInPx || y+yOffs+backgroundImage.getHeight() > mapHeightInPx ) { // // dst.set( x + xOffs,y + yOffs,x + xOffs + (mapWidthInPx-centeredOn.getIntX()) , y + yOffs + (mapHeightInPx-centeredOn.getIntY())); // g.drawImage(backgroundImage, src, dst , getPaint()); // }else g.drawImage(backgroundImage, x + xOffs , y + yOffs , getPaint() ); //} // if ( GameTime.getTime() - lastmessage > 1000) // { // System.out.println("GidBackground.drawBackground() : current tile gid for this layer is " + gid); // System.out.println(" Current x value for drawing is : " + x ); // } x += tl.getTileWidth(); } // if ( GameTime.getTime() - lastmessage > 1000) // { // lastmessage=GameTime.getTime(); // System.out.println(" Current y value for drawing is : " + y ); // // } x = 0; y += tl.getTileHeight(); } } //g.drawString( porterType , Rpg.getWidthDiv2() , Rpg.getHeightDiv2() , clearPaint ); } private final Paint dstATopPaint = new Paint();{ dstATopPaint.setXfermode( new PorterDuffXfermode(PorterDuff.Mode.DST_OVER ) ); } private final Paint clearPaint = new Paint(); private int currentPorterIndex; private String porterType; private long timeToSwitchPorterMode; private final ArrayList<PorterDuff.Mode> porterDuffModes = new ArrayList<PorterDuff.Mode>(); { //porterDuffModes.add( PorterDuff.Mode.DST ); porterDuffModes.add( PorterDuff.Mode.DST_OVER ); //porterDuffModes.add( PorterDuff.Mode.DST_ATOP ); //porterDuffModes.add( PorterDuff.Mode.DST_IN ); //porterDuffModes.add( PorterDuff.Mode.DST_OUT ); //porterDuffModes.add( PorterDuff.Mode.SRC ); //porterDuffModes.add( PorterDuff.Mode.SRC_ATOP ); //porterDuffModes.add( PorterDuff.Mode.SRC_IN ); //porterDuffModes.add( PorterDuff.Mode.SRC_OUT ); //porterDuffModes.add( PorterDuff.Mode.SRC_OVER ); //porterDuffModes.add( PorterDuff.Mode.ADD ); //porterDuffModes.add( PorterDuff.Mode.CLEAR ); //porterDuffModes.add( PorterDuff.Mode.DARKEN ); //porterDuffModes.add( PorterDuff.Mode.LIGHTEN ); //porterDuffModes.add( PorterDuff.Mode.MULTIPLY ); //porterDuffModes.add( PorterDuff.Mode.OVERLAY ); //porterDuffModes.add( PorterDuff.Mode.SCREEN ); //porterDuffModes.add( PorterDuff.Mode.XOR ); //clearPaint.setXfermode( new PorterDuffXfermode( PorterDuff.Mode.CLEAR )); //clearPaint.setTextSize( Rpg.getGame().getTextSize() * 2 ); clearPaint.setColor( Color.WHITE ); clearPaint.setTextAlign( Align.CENTER ); } private Paint getPaint() { // // if( timeToSwitchPorterMode < GameTime.getTime() ) // { // // dstATopPaint.setXfermode( new PorterDuffXfermode(porterDuffModes.get(currentPorterIndex) ) ); // // timeToSwitchPorterMode = GameTime.getTime() + 2000; // // porterType = porterDuffModes.get(currentPorterIndex).toString(); // // ++currentPorterIndex; // // if( currentPorterIndex >= porterDuffModes.size() ) // { // currentPorterIndex = 0; // } // } return dstATopPaint; } public void setBackgroundImage(Image backgroundImage) { this.backgroundImage = backgroundImage; } /** * @return the width */ public int getWidthInPx() { return mapWidthInPx; } /** * @return the width */ public int getWidth() { return mapWidth; } /** * @return the width */ public int getHeightInPx() { return mapHeightInPx; } /** * @return the height */ public int getHeight() { return mapHeight; } /** * @return the mapWidth */ public int getMapWidth() { return mapWidth; } /** * @return the mapHeight */ public int getMapHeight() { return mapHeight; } /** * @return the layers */ public ArrayList<TileLayer> getLayers() { return layers; } /** * @param layers the layers to set */ public void setLayers(ArrayList<TileLayer> layers) { this.layers = layers; } /** * @return the tileGidHolder */ public GidTileHolder getTileGidHolder() { return gidTileHolder; } /** * @param gidTileHolder the tileGidHolder to set */ public void setTileGidHolder(GidTileHolder gidTileHolder) { this.gidTileHolder = gidTileHolder; } /** * @return the screenWidth */ public int getScreenWidth() { return screenWidth; } /** * @return the screenHeight */ public int getScreenHeight() { return screenHeight; } /** * @return the screenWidthDiv2 */ public int getScreenWidthDiv2() { return screenWidthDiv2; } /** * @return the screenHeightDiv2 */ public int getScreenHeightDiv2() { return screenHeightDiv2; } /** * @return the numHorzTiles */ public int getNumHorzTiles() { return numHorzTiles; } /** * @param numHorzTiles the numHorzTiles to set */ public void setNumHorzTiles(int numHorzTiles) { this.numHorzTiles = numHorzTiles; } /** * @return the numVertTiles */ public int getNumVertTiles() { return numVertTiles; } /** * @param numVertTiles the numVertTiles to set */ public void setNumVertTiles(int numVertTiles) { this.numVertTiles = numVertTiles; } /** * @return the xTemp */ public int getxTemp() { return xTemp; } /** * @param xTemp the xTemp to set */ public void setxTemp(int xTemp) { this.xTemp = xTemp; } /** * @return the yTemp */ public int getyTemp() { return yTemp; } /** * @param yTemp the yTemp to set */ public void setyTemp(int yTemp) { this.yTemp = yTemp; } /** * @return the xOffs */ public int getxOffs() { return xOffs; } /** * @param xOffs the xOffs to set */ public void setxOffs(int xOffs) { this.xOffs = xOffs; } /** * @return the yOffs */ public int getyOffs() { return yOffs; } /** * @param yOffs the yOffs to set */ public void setyOffs(int yOffs) { this.yOffs = yOffs; } /** * @return the xGid */ public int getxGid() { return xGid; } /** * @param xGid the xGid to set */ public void setxGid(int xGid) { this.xGid = xGid; } /** * @return the yGid */ public int getyGid() { return yGid; } /** * @param yGid the yGid to set */ public void setyGid(int yGid) { this.yGid = yGid; } int getRegTileWidth() { return regTileWidth; } int getRegTileHeight() { return regTileHeight; } }
5e4e955730f851493d38b16aead5bbfd7d850bb8
8ae7a6373cccd94cc2d9efa47843f0577145c6c3
/notification-service/src/main/java/com/mrjeffapp/notification/model/Email.java
eb10f4f25284e15f7fe3c40a264cc9c10cc953ec
[]
no_license
siwar-benrejeb/mrjeffapp
286d88b39c9de75749773f9ccf4314ec71d1fddd
0bab0e3512eaee40c7793c58919eafdba0295dce
refs/heads/master
2021-08-20T06:53:08.961702
2017-11-28T12:32:00
2017-11-28T12:32:00
103,963,713
2
0
null
null
null
null
UTF-8
Java
false
false
2,449
java
package com.mrjeffapp.notification.model; public class Email { private String emailTypeCode; private String destination; private String subject; private String content; public Email(){ } public Email(String emailTypeCode, String destination, String subject, String content) { this.emailTypeCode = emailTypeCode; this.destination = destination; this.subject = subject; this.content = content; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Email email = (Email) o; if (emailTypeCode != null ? !emailTypeCode.equals(email.emailTypeCode) : email.emailTypeCode != null) return false; if (destination != null ? !destination.equals(email.destination) : email.destination != null) return false; if (subject != null ? !subject.equals(email.subject) : email.subject != null) return false; return content != null ? content.equals(email.content) : email.content == null; } @Override public int hashCode() { int result = emailTypeCode != null ? emailTypeCode.hashCode() : 0; result = 31 * result + (destination != null ? destination.hashCode() : 0); result = 31 * result + (subject != null ? subject.hashCode() : 0); result = 31 * result + (content != null ? content.hashCode() : 0); return result; } public String getEmailTypeCode() { return emailTypeCode; } public void setEmailTypeCode(String emailTypeCode) { this.emailTypeCode = emailTypeCode; } public void setDestination(String destination) { this.destination = destination; } public void setSubject(String subject) { this.subject = subject; } public void setContent(String content) { this.content = content; } public String getDestination() { return destination; } public String getSubject() { return subject; } public String getContent() { return content; } @Override public String toString() { return "Email{" + "emailTypeCode='" + emailTypeCode + '\'' + ", destination='" + destination + '\'' + ", subject='" + subject + '\'' + ", content='" + content + '\'' + '}'; } }
4e27e6336399a91e21593db007cfe5463053058d
e79ffa3f144c7ccfef4a7445ecd2a63ad9532d6f
/src/BirdShelterWithACrookedSecurityGuard.java
eb2e1f6d354dda7025713c361c3647c62ad22b18
[]
no_license
carlosmunozus03/codeup-java-exercises
b3348609a382aa9287520c2373da5c3412f22a93
a3c590d68eba661a6fa8b28b81cbd6e61f26b1e1
refs/heads/main
2023-06-24T13:25:59.818178
2021-07-26T20:55:15
2021-07-26T20:55:15
369,643,552
0
0
null
null
null
null
UTF-8
Java
false
false
444
java
public class BirdShelterWithACrookedSecurityGuard extends BirdShelter { // this will not work because the method in the superclass is final // public void securityProcedures(){ // camerasOn = false; // guardsAlert = false; // alarmsArmed = false; // } public void securityProcedures(String guardName, int duration){ camerasOn = false; guardsAlert = false; alarmsArmed = false; } }
ac48f9472fd75dfacebfac89a14a5705247c220a
896670c11c9c2d916e4d5182ae8745c7f56abf1c
/app/src/main/java/cxd/com/programlearning/widgets/banner/BaseAdapter.java
51ccccc1e9915ded2467cb42beedeb0a326c4ae4
[]
no_license
chenxiandiao/Widgets
677e1db9c48bb55d223b92f3516d67f16c3855c1
0e792947f5743cd30ec16e6875923bb236743ebc
refs/heads/master
2022-07-09T12:20:01.716905
2020-05-19T09:39:21
2020-05-19T09:39:21
265,206,654
0
0
null
null
null
null
UTF-8
Java
false
false
311
java
package cxd.com.programlearning.widgets.banner; import android.database.DataSetObservable; import android.view.View; /** * Created by geminiwen on 15/9/29. */ public abstract class BaseAdapter extends DataSetObservable { public abstract int getCount(); public abstract View getView(int position); }
[ "cooldiao316" ]
cooldiao316
0bb518397da5089996c99156851a2edce5e63e1f
3ebaee3a565d5e514e5d56b44ebcee249ec1c243
/assetBank 3.77 decomplied fixed/src/java/com/bright/assetbank/search/action/SaveSearchAction.java
dc93092c799d10cef43dad0eefd2a4a0802e51d1
[]
no_license
webchannel-dev/Java-Digital-Bank
89032eec70a1ef61eccbef6f775b683087bccd63
65d4de8f2c0ce48cb1d53130e295616772829679
refs/heads/master
2021-10-08T19:10:48.971587
2017-11-07T09:51:17
2017-11-07T09:51:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,523
java
/* */ package com.bright.assetbank.search.action; /* */ /* */ import com.bn2web.common.exception.Bn2Exception; /* */ import com.bright.assetbank.application.constant.AssetBankSettings; /* */ import com.bright.assetbank.application.util.ABImageMagick; /* */ import com.bright.assetbank.search.bean.BaseSearchQuery; /* */ import com.bright.assetbank.search.bean.SavedSearch; /* */ import com.bright.assetbank.search.bean.SearchBuilderQuery; /* */ import com.bright.assetbank.search.exception.MaxSearchesReachedException; /* */ import com.bright.assetbank.search.form.SavedSearchForm; /* */ import com.bright.assetbank.search.service.SavedSearchManager; /* */ import com.bright.assetbank.usage.bean.ColorSpace; /* */ import com.bright.assetbank.usage.service.UsageManager; /* */ import com.bright.assetbank.user.bean.ABUserProfile; /* */ import com.bright.framework.common.action.BTransactionAction; /* */ import com.bright.framework.database.bean.DBTransaction; /* */ import com.bright.framework.service.FileStoreManager; /* */ import com.bright.framework.simplelist.bean.ListItem; /* */ import com.bright.framework.simplelist.service.ListManager; /* */ import com.bright.framework.storage.constant.StoredFileType; /* */ import com.bright.framework.user.bean.User; /* */ import com.bright.framework.user.bean.UserProfile; /* */ import com.bright.framework.util.FileUtil; /* */ import com.bright.framework.util.StringUtil; /* */ import java.io.File; /* */ import java.io.IOException; /* */ import java.io.InputStream; /* */ import javax.servlet.http.HttpServletRequest; /* */ import javax.servlet.http.HttpServletResponse; /* */ import org.apache.commons.lang.StringUtils; /* */ import org.apache.commons.logging.Log; /* */ import org.apache.struts.action.ActionForm; /* */ import org.apache.struts.action.ActionForward; /* */ import org.apache.struts.action.ActionMapping; /* */ import org.apache.struts.upload.FormFile; /* */ /* */ public class SaveSearchAction extends BTransactionAction /* */ { /* 62 */ private SavedSearchManager m_savedSearchManager = null; /* 63 */ private ListManager m_listManager = null; /* 64 */ private FileStoreManager m_fileStoreManager = null; /* 65 */ protected UsageManager m_usageManager = null; /* */ /* */ public ActionForward execute(ActionMapping a_mapping, ActionForm a_form, HttpServletRequest a_request, HttpServletResponse a_response, DBTransaction a_transaction) /* */ throws Bn2Exception /* */ { /* 74 */ ActionForward afForward = null; /* 75 */ ABUserProfile userProfile = (ABUserProfile)UserProfile.getUserProfile(a_request.getSession()); /* */ /* 77 */ SavedSearchForm form = (SavedSearchForm)a_form; /* */ /* 79 */ if (!userProfile.getIsLoggedIn()) /* */ { /* 81 */ this.m_logger.debug("SaveSearchAction.execute() : A user must be logged in to save a search."); /* 82 */ return a_mapping.findForward("NoPermission"); /* */ } /* */ /* 85 */ if (StringUtils.isEmpty(form.getSavedSearch().getName())) /* */ { /* 87 */ form.addError(this.m_listManager.getListItem(a_transaction, "failedValidationNoName", userProfile.getCurrentLanguage()).getBody()); /* */ } /* */ /* 90 */ String sOldName = a_request.getParameter("oldName"); /* */ /* 92 */ form.getSavedSearch().setBuilderSearch(userProfile.getSearchCriteria() instanceof SearchBuilderQuery); /* */ /* 94 */ if (!StringUtil.stringIsPopulated(sOldName)) /* */ { /* 97 */ form.getSavedSearch().setCriteria((BaseSearchQuery)userProfile.getSearchCriteria()); /* */ } /* */ /* */ try /* */ { /* 103 */ if ((form.getRemoveImage()) || ((form.getImage() != null) && (form.getImage().getFileSize() > 0) && (StringUtil.stringIsPopulated(form.getSavedSearch().getImage())))) /* */ { /* 106 */ File fToDelete = new File(AssetBankSettings.getApplicationPath() + "/" + form.getSavedSearch().getImage()); /* 107 */ fToDelete.delete(); /* 108 */ FileUtil.logFileDeletion(fToDelete); /* 109 */ form.getSavedSearch().setImage(null); /* */ } /* */ /* 113 */ if ((form.getImage() != null) && (form.getImage().getFileSize() > 0)) /* */ { /* 116 */ InputStream ins = null; /* 117 */ String sImageUrl = null; /* 118 */ String sDestination = null; /* */ try /* */ { /* 122 */ ins = form.getImage().getInputStream(); /* 123 */ sImageUrl = this.m_fileStoreManager.addFile(ins, form.getImage().getFileName(), StoredFileType.PREVIEW_OR_THUMBNAIL); /* */ /* 127 */ sDestination = AssetBankSettings.getSavedSearchImagesDir() + "/" + FileUtil.getSafeFilename(new StringBuilder().append(form.getSavedSearch().getName()).append(userProfile.getUser().getId()).append(".").append("jpg").toString(), true); /* */ /* 132 */ String sRgbColorProfile = this.m_usageManager.getColorSpace(null, 1).getFileLocation(); /* 133 */ String sCmykColorProfile = this.m_usageManager.getColorSpace(null, 2).getFileLocation(); /* */ /* 135 */ ABImageMagick.convertToCategoryImage(this.m_fileStoreManager.getAbsolutePath(sImageUrl), AssetBankSettings.getApplicationPath() + "/" + sDestination, sRgbColorProfile, sCmykColorProfile); /* */ } /* */ catch (Exception bn2e) /* */ { /* 139 */ this.m_logger.error("SaveSearchAction.execute() : Exception whilst storing image for saved search", bn2e); /* 140 */ form.addError(this.m_listManager.getListItem(a_transaction, "imageFileError", userProfile.getCurrentLanguage()).getBody()); /* */ } /* */ finally /* */ { /* */ try /* */ { /* 146 */ ins.close(); /* */ } /* */ catch (IOException ioe) { /* */ } /* 150 */ if (sImageUrl != null) /* */ { /* 152 */ this.m_fileStoreManager.deleteFile(sImageUrl); /* */ } /* */ } /* 155 */ form.getSavedSearch().setImage(sDestination); /* */ } /* */ /* 158 */ if (form.getHasErrors()) /* */ { /* 160 */ return a_mapping.findForward("Failure"); /* */ } /* */ /* 164 */ this.m_savedSearchManager.saveSearch(a_transaction, form.getSavedSearch(), userProfile, sOldName, false); /* */ /* 166 */ if (form.isRecent()) /* */ { /* 168 */ afForward = a_mapping.findForward("SuccessRecent"); /* */ } /* */ else /* */ { /* 172 */ afForward = a_mapping.findForward("SuccessCurrent"); /* */ } /* */ } /* */ catch (MaxSearchesReachedException e) /* */ { /* 177 */ form.addError(this.m_listManager.getListItem(a_transaction, "maxSavedSearchesReached", userProfile.getCurrentLanguage()).getBody()); /* 178 */ return a_mapping.findForward("Failure"); /* */ } /* */ catch (IOException e) /* */ { /* 182 */ this.m_logger.error("SaveSearchAction.execute: IOError: " + e.getMessage()); /* 183 */ form.addError(this.m_listManager.getListItem(a_transaction, "failedValidationFile", userProfile.getCurrentLanguage()).getBody()); /* 184 */ return a_mapping.findForward("Failure"); /* */ } /* */ /* 187 */ return afForward; /* */ } /* */ /* */ public void setSavedSearchManager(SavedSearchManager savedSearchManager) /* */ { /* 192 */ this.m_savedSearchManager = savedSearchManager; /* */ } /* */ /* */ public void setListManager(ListManager listManager) /* */ { /* 197 */ this.m_listManager = listManager; /* */ } /* */ /* */ public void setFileStoreManager(FileStoreManager a_fileStoreManager) /* */ { /* 202 */ this.m_fileStoreManager = a_fileStoreManager; /* */ } /* */ /* */ public void setUsageManager(UsageManager a_sUsageManager) /* */ { /* 207 */ this.m_usageManager = a_sUsageManager; /* */ } /* */ } /* Location: C:\Users\mamatha\Desktop\com.zip * Qualified Name: com.bright.assetbank.search.action.SaveSearchAction * JD-Core Version: 0.6.0 */
572097611acbe3004b48504e6e10a68ad135582d
3ef6c568f38af1d79e359ef8ce4a3bcb1c1d0482
/app/src/main/java/com/example/flashcardapp/FlashcardDatabase.java
ae174dfe446a7e947effb7e4f58632ca8d12c3b2
[]
no_license
brentonjackson/Flashcard-Android-App
46e2876c2bd68b48536d11f3063aa79890840a31
8d57175ee0e2b7bad117c9cc92fd80ddf9dfdfa7
refs/heads/master
2022-04-23T19:52:59.511436
2020-04-03T07:20:58
2020-04-03T07:20:58
240,780,218
1
1
null
null
null
null
UTF-8
Java
false
false
1,072
java
package com.example.flashcardapp; import android.content.Context; import androidx.room.Room; import java.util.List; public class FlashcardDatabase { private final AppDatabase db; FlashcardDatabase(Context context) { db = Room.databaseBuilder(context.getApplicationContext(), AppDatabase.class, "flashcard-database") .allowMainThreadQueries() .fallbackToDestructiveMigration() .build(); } public List<Flashcard> getAllCards() { return db.flashcardDao().getAll(); } public void insertCard(Flashcard flashcard) { db.flashcardDao().insertAll(flashcard); } public void deleteCard(String flashcardQuestion) { List<Flashcard> allCards = db.flashcardDao().getAll(); for (Flashcard f : allCards) { if (f.getQuestion().equals(flashcardQuestion)) { db.flashcardDao().delete(f); } } } public void updateCard(Flashcard flashcard) { db.flashcardDao().update(flashcard); } }
110e5bad72c65e02e14715843c7e28bb2fbadf1b
59a78bb3ff66822d27269497c68dff04878cf81e
/mwunion-parent/mwunion-dao/src/main/java/com/sungan/ad/dao/AdHostAccountAdOrderSourcesDAO.java
1fcc26b1b0c9a11ab4410c8d500fb22dfe5e60e9
[]
no_license
zyfCode/mwunion
4cd8e2afed66c326bf00548a84a8d34d6fa95c8e
b15499dbd7d578d5f0982b6f311649b6308c48a0
refs/heads/master
2021-01-18T17:50:30.112839
2017-05-22T16:23:44
2017-05-22T16:23:46
86,818,093
0
0
null
null
null
null
UTF-8
Java
false
false
248
java
package com.sungan.ad.dao; import com.sungan.ad.common.dao.DAO; import com.sungan.ad.dao.model.AdHostAccountAdOrderSources; /** * 说明: */ public interface AdHostAccountAdOrderSourcesDAO extends DAO<AdHostAccountAdOrderSources> { }
4bd2f3b25f37c6f9230f03d99ea89c554c1eaf3d
60841b57711c5f723003cc8b22e1266cd5ac0992
/core/src/main/java/juzu/impl/plugin/controller/descriptor/ControllerDescriptorResolver.java
083aa2b51e19af49310d876f032921f266ecbd50
[]
no_license
tu-vu-duy/juzu
7313ba8d8a6ce4582fcf0fef980adcdbcbe12dd5
864b17f0a4527894b26a502bed4e21c7feb723ce
refs/heads/master
2020-05-19T03:55:04.055163
2012-08-20T07:12:45
2012-08-20T07:12:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,133
java
/* * Copyright (C) 2012 eXo Platform SAS. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package juzu.impl.plugin.controller.descriptor; import juzu.impl.plugin.controller.ControllerResolver; import juzu.request.Phase; import java.util.Collection; /** * Resolves controller method algorithm. * * @author <a href="mailto:[email protected]">Julien Viet</a> */ class ControllerDescriptorResolver extends ControllerResolver<MethodDescriptor> { /** . */ private final ControllersDescriptor desc; /** . */ private final MethodDescriptor[] methods; ControllerDescriptorResolver(ControllersDescriptor desc) throws NullPointerException { this.methods = desc.getMethods().toArray(new MethodDescriptor[desc.getMethods().size()]); this.desc = desc; } @Override public MethodDescriptor[] getMethods() { return methods; } @Override public String getId(MethodDescriptor method) { return method.getId(); } @Override public Phase getPhase(MethodDescriptor method) { return method.getPhase(); } @Override public String getName(MethodDescriptor method) { return method.getName(); } @Override public boolean isDefault(MethodDescriptor method) { return method.getType() == desc.getDefault(); } @Override public Collection<String> getParameterNames(MethodDescriptor method) { return method.getArgumentNames(); } }
0590318d50bfaae621fb3e15aa6771f19114e606
7fd4b7e7311a34c4e31bec92f516de03fd4260e8
/src/Java0521/Factoraial.java
4852f5de0ebab800911ad941fd7857678559189a
[]
no_license
yujesang124/Java
8a77091048c0ae096734e81270cca647b3abd264
279abfd073c47442f4438a9b912b489ff13c8ee3
refs/heads/master
2022-08-03T01:17:26.257892
2020-05-29T07:27:36
2020-05-29T07:27:36
263,823,120
0
0
null
null
null
null
UTF-8
Java
false
false
874
java
package Java0521; public class Factoraial { //메소드 // 1. int getFactorial (int num) // 매개변수로 전송된 숫자의 팩토리얼 값을 구해서 리턴하시오 // int num= 5인경우 5*4*3*2*1 // 2. int getPower(int num) // 매개변수로 전송된 값까지의 제곱의 합을 구해서 리턴 // int num = 3인 경우 1*1 + 2*2 + 3*3 int getFactorial(int num) { int fact =1; for(int i=num; i>0; i--) { fact = fact * i; System.out.println("fact : " + fact); System.out.println("i : " + i); System.out.println("num : " + num); } return fact; }; int getPower(int num) { int rsl = 0; for(int i=1; i<=num; i++) { rsl += i * i; System.out.println(" i : " + i); System.out.println("i*i : " + i*i); System.out.println("rsl : " + rsl); } return rsl; } }
[ "1@1-PC" ]
1@1-PC
12086c7e402714abc1258ab8f6479eb5f676e348
3d2a5abcb61ce2b85233b8e351eb4d08ef09ff04
/src/main/java/com/cv/sharding/DependencyBinder.java
b4fdd5049f5ff13e01421f989621e0253efc0e35
[]
no_license
serye/dbscaling
3f5e0f19bb3584d92536078249b46436b26ab5c6
212d0df0d4937e322cf2b95308eb219bd2aea2af
refs/heads/master
2020-06-04T18:59:00.372561
2015-01-10T19:13:27
2015-01-10T19:13:27
29,067,619
0
0
null
null
null
null
UTF-8
Java
false
false
294
java
package com.cv.sharding; import org.glassfish.hk2.utilities.binding.AbstractBinder; public class DependencyBinder extends AbstractBinder{ @Override protected void configure() { bind(LogRepository.class).to(LogDAO.class); bind(ShardSelectorImpl.class).to(ShardSelector.class); } }
26ae4c01ff1b53b29eb429b8f772564073d0c133
fac5b30b5a3ad6d4ac77a489eb657c1e5b5130cd
/app/src/main/java/com/example/guestaccount/scoutingapp2018/Autonomous.java
8643780163cfa0fb991a4b7f9fe07ba553d5d2b9
[]
no_license
SouthCoastCorsairs/2018ScoutingApp
22e5ae8c0b8031d00f4ddbafe31a2edd3551ba28
b831edb9bd248ad42fdd30ecd1fb6fca1db6756f
refs/heads/master
2021-05-10T22:45:45.906878
2019-01-12T16:26:22
2019-01-12T16:26:22
118,265,444
0
0
null
null
null
null
UTF-8
Java
false
false
5,747
java
package com.example.guestaccount.scoutingapp2018; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class Autonomous extends AppCompatActivity implements OnClickListener { Button scale_auto_up; Button scale_auto_down; Button switch_auto_up; Button switch_auto_down; Button deliver_auto_up; Button deliver_auto_down; TextView scale_auto_entry; TextView switch_auto_entry; TextView deliver_auto_entry; public static int scale_auto=0; public static int switch_auto=0; public static int deliver_auto=0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_autonomous); scale_auto_up = findViewById(R.id.scale_auto_up); scale_auto_down = findViewById(R.id.scale_auto_down); switch_auto_up = findViewById(R.id.switch_auto_up); switch_auto_down = findViewById(R.id.switch_auto_down); deliver_auto_up = findViewById(R.id.deliver_auto_up); deliver_auto_down = findViewById(R.id.deliver_auto_down); scale_auto_entry = findViewById(R.id.scale_auto_entry); switch_auto_entry = findViewById(R.id.switch_tele_entry); deliver_auto_entry = findViewById(R.id.deliver_auto_entry); scale_auto_up.setOnClickListener(this); scale_auto_down.setOnClickListener(this); switch_auto_up.setOnClickListener(this); switch_auto_down.setOnClickListener(this); deliver_auto_up.setOnClickListener(this); deliver_auto_down.setOnClickListener(this); scale_auto_entry.setText(String.valueOf(scale_auto)); switch_auto_entry.setText(String.valueOf(switch_auto)); deliver_auto_entry.setText(String.valueOf(deliver_auto)); /* Button scale_auto_up = (Button) findViewById(R.id.scale_auto_up); final TextView scale_auto_entry = (TextView) findViewById(R.id.scale_auto_entry); scale_auto_up.setOnClickListener(new Button.OnClickListener(){ int i = 0; public void onClick(View v){ i++; scale_auto_entry.setText(Integer.toString(i)); } } ); Button scale_auto_down = (Button) findViewById(R.id.scale_auto_down); scale_auto_down.setOnClickListener(new Button.OnClickListener(){ int i = 0; public void onClick(View v){ i--; if (i <0) {i = 0;} scale_auto_entry.setText(Integer.toString(i)); } } ); Button switch_auto_up = (Button) findViewById(R.id.switch_auto_up); final TextView switch_auto_entry = (TextView) findViewById(R.id.switch_auto_entry); switch_auto_up.setOnClickListener(new Button.OnClickListener(){ int i = 0; public void onClick(View v){ i++; switch_auto_entry.setText(Integer.toString(i)); } } ); final Button switch_auto_down = (Button) findViewById(R.id.switch_auto_down); switch_auto_down.setOnClickListener(new Button.OnClickListener(){ int i = 0; public void onClick(View v){ i--; if (i <0) {i = 0;} switch_auto_entry.setText(Integer.toString(i)); } } ); Button deliver_auto_up = (Button) findViewById(R.id.deliver_auto_up); final TextView deliver_auto_entry = (TextView) findViewById(R.id.deliver_auto_entry); deliver_auto_up.setOnClickListener(new Button.OnClickListener(){ int i = 0; public void onClick(View v){ i++; deliver_auto_entry.setText(Integer.toString(i)); } } ); Button deliver_auto_down = (Button) findViewById(R.id.deliver_auto_down); deliver_auto_down.setOnClickListener(new Button.OnClickListener(){ int i = 0; public void onClick(View v){ i--; if (i <0) {i = 0;} deliver_auto_entry.setText(Integer.toString(i)); } } ); */ } /*public void scale_auto(View v) { if(v==scale_auto_up){ i++; } else if(v==scale_auto_down){ i--; if (i<0){ i=0; } } }*/ public void Teleop (View view) { Intent tele = new Intent(this, Tele.class); startActivity(tele); } public void Notes (View view) { Intent notes = new Intent(this, Notes.class); startActivity(notes); } @Override public void onClick(View v) { if(v==scale_auto_up){ scale_auto++; } else if(v==scale_auto_down){ scale_auto--; if (scale_auto<0){ scale_auto=0; } } else if(v==switch_auto_up) { switch_auto++; } else if(v==switch_auto_down){ switch_auto--; if(switch_auto<0){ switch_auto=0; } } else if(v==deliver_auto_up){ deliver_auto++; } else if(v==deliver_auto_down){ deliver_auto--; if(deliver_auto<0){ deliver_auto=0; } } scale_auto_entry.setText(String.valueOf(scale_auto)); switch_auto_entry.setText(String.valueOf(switch_auto)); deliver_auto_entry.setText(String.valueOf(deliver_auto)); } }
5603c9aea783b3bd104fe7f193816e72f22eccc6
bbf526bca24e395fcc87ef627f6c196d30a1844f
/maximum-vacation-days/Solution.java
dc71ab17b7ce47a62086471c217dd1371f775f96
[]
no_license
charles-wangkai/leetcode
864e39505b230ec056e9b4fed3bb5bcb62c84f0f
778c16f6cbd69c0ef6ccab9780c102b40731aaf8
refs/heads/master
2023-08-31T14:44:52.850805
2023-08-31T03:04:02
2023-08-31T03:04:02
25,644,039
52
18
null
2021-06-05T00:02:50
2014-10-23T15:29:44
Java
UTF-8
Java
false
false
701
java
import java.util.Arrays; public class Solution { public int maxVacationDays(int[][] flights, int[][] days) { int N = flights.length; int K = days[0].length; int[] vacations = new int[N]; Arrays.fill(vacations, -1); vacations[0] = 0; for (int i = 0; i < K; i++) { int[] nextVacations = new int[N]; Arrays.fill(nextVacations, -1); for (int j = 0; j < N; j++) { if (vacations[j] < 0) { continue; } for (int k = 0; k < N; k++) { if (k == j || flights[j][k] == 1) { nextVacations[k] = Math.max(nextVacations[k], vacations[j] + days[k][i]); } } } vacations = nextVacations; } return Arrays.stream(vacations).max().getAsInt(); } }
5c5c6a53b2046623d069235b54ab60cb97b340e5
f08c8ca7c7e81b8fe11faede6b6d19cee6d3d24f
/src/main/java/com/xmart/reservationterrain/security/JwtAuthenticationEntryPoint.java
1e69f101f500f0f08ec0e66d2c17a3db840c48f1
[]
no_license
bsadiki/Football-field-booking-back-end
bc6f4fdaa884afa4cca1d22946dbee763dd3373c
6384f576bc2d5c14d7024e45e23f94cc493d7c28
refs/heads/master
2021-08-29T20:39:34.792392
2017-12-14T23:28:23
2017-12-14T23:28:23
114,306,021
1
0
null
null
null
null
UTF-8
Java
false
false
1,072
java
package com.xmart.reservationterrain.security; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.Serializable; @Component public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint, Serializable { private static final long serialVersionUID = -8970718410437077606L; @Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException { // This is invoked when user tries to access a secured REST resource without supplying any credentials // We should just send a 401 Unauthorized response because there is no 'login page' to redirect to response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized"); } }