blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
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
listlengths
1
1
author_id
stringlengths
0
313
2448053c01396b086ad18d139737bd92cebff082
ad504db69e860ae4870f35ec01b89ab18ddc2d62
/resource/TestGameDemoResourceJavaLibraryM/src/main/java/org/allbinary/game/testgamedemo/input/TestGameDemoGameInputMappingFactory.java
c1df224c596f422d399c73df4d4033bd684ce1cf
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
AllBinary/AllBinary-Platform-Game
c9c4aad89be5e7418b73a0178a09c5f46c6087b5
5a309c328b65167f93657acbee70c58120a3f48b
refs/heads/master
2023-06-12T20:13:53.236214
2023-06-12T07:29:03
2023-06-12T07:29:03
20,319,549
1
0
null
null
null
null
UTF-8
Java
false
false
3,279
java
/* * AllBinary Open License Version 1 * Copyright (c) 2011 AllBinary * * By agreeing to this license you and any business entity you represent are * legally bound to the AllBinary Open License Version 1 legal agreement. * * You may obtain the AllBinary Open License Version 1 legal agreement from * AllBinary or the root directory of AllBinary's AllBinary Platform repository. * * Created By: Travis Berthelot * */ package org.allbinary.game.testgamedemo.input; import org.allbinary.game.input.GameKeyFactory; import org.allbinary.game.input.mapping.GameInputMapping; public class TestGameDemoGameInputMappingFactory { private static final TestGameDemoGameInputMappingFactory SINGLETON = new TestGameDemoGameInputMappingFactory(); public static TestGameDemoGameInputMappingFactory getInstance() { return SINGLETON; } private GameInputMapping[] gameInputMappingArray = new GameInputMapping[7]; public TestGameDemoGameInputMappingFactory() { final GameKeyFactory gameKeyFactory = GameKeyFactory.getInstance(); //Enter, 1, or Y", gameInputMappingArray[0] = new GameInputMapping("Fire", gameKeyFactory.KEY_NUM1); //Forward= Up, 2, or U gameInputMappingArray[1] = new GameInputMapping("Up", gameKeyFactory.UP); //Turn= Left, 4, or H gameInputMappingArray[2] = new GameInputMapping("Left", gameKeyFactory.LEFT); //Turn= Right, 6, or K gameInputMappingArray[3] = new GameInputMapping("Right", gameKeyFactory.RIGHT); //Reverse= Down, 8, or M gameInputMappingArray[4] = new GameInputMapping("Down", gameKeyFactory.DOWN); //Test game gameInputMappingArray[5] = new GameInputMapping("Zoom Out", gameKeyFactory.KEY_NUM3); gameInputMappingArray[6] = new GameInputMapping("Zoom In", gameKeyFactory.KEY_NUM0); /* //Forward= Up, 2, or U gameInputMappingArray[1] = new GameInputMapping("Forward", gameKeyFactory.UP); //Turn= Left, 4, or H gameInputMappingArray[2] = new GameInputMapping("Left Turn", gameKeyFactory.LEFT); //Turn= Right, 6, or K gameInputMappingArray[3] = new GameInputMapping("Right Turn", gameKeyFactory.RIGHT); //Reverse= Down, 8, or M gameInputMappingArray[4] = new GameInputMapping("Reverse", gameKeyFactory.DOWN); //Shield= 3, *, Space gameInputMappingArray[5] = new GameInputMapping("Shield", gameKeyFactory.KEY_NUM3); //Special 1= 0 or Insert gameInputMappingArray[6] = new GameInputMapping("Special 1", gameKeyFactory.KEY_NUM0); //Special 2= # or Delete gameInputMappingArray[7] = new GameInputMapping("Special 2", gameKeyFactory.KEY_POUND); gameInputMappingArray[8] = new GameInputMapping("All Stop", gameKeyFactory.KEY_NUM5); //Strafe Left= 7 gameInputMappingArray[9] = new GameInputMapping("Strafe Left", gameKeyFactory.KEY_NUM7); //Strafe Right= 9 gameInputMappingArray[10] = new GameInputMapping("Strafe Right", gameKeyFactory.KEY_NUM9); */ } public GameInputMapping[] get() { return this.gameInputMappingArray; } }
[ "travisberthelot@hotmail.com" ]
travisberthelot@hotmail.com
2fa3f650e3d6468e02cc601f6d7d9a8af26eb4b8
874f32275b67694837087f607ea3c38f47c84e5a
/Pecunia Bank MMP/src/com/capgemini/user/Account.java
59fdf864f52c9232a752558a6c71a39d1287ac7c
[]
no_license
Pavankalyan438/Testing
2fb81edf23d991a2c91a85848e11b0922d65771b
2163261841a83482ca32a46f0ae7883c13f4e02b
refs/heads/master
2021-04-08T07:31:37.259533
2020-03-23T09:26:54
2020-03-23T09:26:54
248,753,633
0
0
null
null
null
null
UTF-8
Java
false
false
279
java
package com.capgemini.user; public class Account { private String AccountNO; public String getAccountNO() { return AccountNO; } public void setAccountNO(String accountNO) { AccountNO = accountNO; } public Account(String accountNO) { super(); AccountNO = accountNO; } }
[ "pavankalyannaini438@gmail.com" ]
pavankalyannaini438@gmail.com
5f56b400b5bf0a6617b16438351a0ff2a4247d8b
0b4c5e1e4683ebd3851c875d8f3f98f0e60ff2c4
/src/main/java/fr/communication/domain/User.java
7e9af4e4199306744923ddd973a2a8b33e453fa8
[]
no_license
mohanajjar/communication
143695b06a0fe9cdc67e78023892d138f23549c7
659338732e1dc7236a9623db8caca5e4cb19efbd
refs/heads/master
2020-03-11T11:28:19.374713
2018-04-18T13:06:03
2018-04-18T13:06:03
129,970,467
0
0
null
null
null
null
UTF-8
Java
false
false
719
java
package fr.communication.domain; import lombok.Data; import javax.persistence.*; import java.io.Serializable; import java.util.ArrayList; import java.util.List; @Entity @Table(name = "user") @Data public class User implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "user_id", unique = true, nullable = false) private Long id; private String firstName; private String lastName; private String mailAdress; private String media; private String phoneNumber; private String passWord; @OneToMany(mappedBy = "user") public List<Role> roles = new ArrayList<>(); }
[ "m-najar@artefrance.fr" ]
m-najar@artefrance.fr
5c6cbcf926706bafb06f3babf3a506af8e32bab6
894097e20f940a551751340374c7fbc0b721c00b
/Lesson 21/SaveAnArrayOfObjectsToFile/src/com/company/Expense.java
bfc21f6e948943de5fce0993f9068d7ca1982ed3
[]
no_license
judaco/Java-Course
a15bdd9624de900e882735782eae1386bc13717e
bff237bea1e67a6d13c3e3e743101a1694a5a239
refs/heads/master
2020-04-12T06:25:40.626117
2017-04-22T19:31:45
2017-04-22T19:31:45
64,483,572
1
0
null
null
null
null
UTF-8
Java
false
false
1,779
java
package com.company; import java.nio.ByteBuffer; /** * Created by Juda on 21/03/2017. */ class Expense { private String name; private double price; private String description; public Expense(String name, double price, String description) { this.name = name; this.price = price; this.description = description; } public Expense (byte [] bytes){ name = new String(bytes, 1, bytes[0]); description = new String(bytes, 1 + bytes[0], bytes [1 + bytes[0]]); price = ByteBuffer.wrap(bytes).getDouble(1 + bytes[0] + 1 + bytes[1 + bytes[0]]); } public String getName() { return name; } public void setName(String name) { this.name = name; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public byte [] getBytes() { byte [] nameBytes = name.getBytes(); byte [] descriptionBytes = description.getBytes(); byte [] result = new byte[1 + nameBytes.length + descriptionBytes.length +8]; result [0] = (byte)nameBytes.length; for (int i = 0; i < nameBytes.length; i++) { result [1 + i] = nameBytes[i]; } result [1 + nameBytes.length] = (byte)descriptionBytes.length; for (int i = 0; i < descriptionBytes.length; i++) { result [i + nameBytes.length + 1 + i] = descriptionBytes[i]; } ByteBuffer.wrap(result).putDouble(1 + nameBytes.length + 1 + descriptionBytes.length, price); return result; } }
[ "judacossa@gmail.com" ]
judacossa@gmail.com
735f5d25b5a3c1ab86e1ce21e6d51dedfcbb4132
86ac90816a7bc993d01fcd063ad279db31978270
/src/main/java/SafeDelete.java
23f5cc4565e2f48d639045e3c520639cee089640
[]
no_license
Swyrough/Munchin
3ced2fac99ee26f8daa8eef78b08126137c1b7f0
4b4933551360081da7db0ed77e82213b2b77c8c7
refs/heads/master
2021-01-21T00:25:03.061723
2015-02-04T20:55:06
2015-02-04T20:55:06
30,130,082
0
0
null
null
null
null
UTF-8
Java
false
false
1,122
java
import com.google.appengine.api.datastore.*; /* Safely deletes an Entity from datastore and all its dependencies. Sends a follow up text to all associated users */ public class SafeDelete { private QueryManager queryManager = new QueryManager(); private static DatastoreService dataStore= DatastoreServiceFactory.getDatastoreService(); public boolean deleteTrip(){ return true; } /* Deletes an order from the datastore and sends a confirmation to the trip owner */ public boolean deleteOrder(Key key){ // Must be the key of an order try { Entity order= dataStore.get(key); dataStore.get(order.getParent()).getProperty("user"); return true; }catch (Exception e){ return false; } } public boolean deleteOrder(Entity order){ return true; } /* Safe deletes a given profile, then deletes all the trips and orders associated with this particular user. Finally it deletes the orders associated with its trip. */ public boolean deleteProfile(){ return true; } }
[ "jhwang261@gmail.com" ]
jhwang261@gmail.com
7f0db82f59f77bed24b284e9f64f275511bd52fd
5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1
/Code Snippet Repository/Spring/Spring3470.java
7d732df62a588a1e7eef07c9746d0dec001da588
[]
no_license
saber13812002/DeepCRM
3336a244d4852a364800af3181e03e868cf6f9f5
be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9
refs/heads/master
2023-03-16T00:08:06.473699
2018-04-18T05:29:50
2018-04-18T05:29:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
567
java
@Test public void testLoadingMultipleConfigFilesWithRelativeClass() { GenericGroovyApplicationContext ctx = new GenericGroovyApplicationContext(); ctx.load(GroovyApplicationContextTests.class, "applicationContext2.groovy", "applicationContext.groovy"); ctx.refresh(); Object framework = ctx.getBean("framework"); assertNotNull("could not find framework bean", framework); assertEquals("Grails", framework); Object company = ctx.getBean("company"); assertNotNull("could not find company bean", company); assertEquals("SpringSource", company); }
[ "Qing.Mi@my.cityu.edu.hk" ]
Qing.Mi@my.cityu.edu.hk
253866bb9ac6202f23be94494129d5cdc6581021
94f3467d233d1c2802f24f79b6ea20c383c99b24
/src/flyerGame/ui/CreditsGui.java
b7377a57e887923beec0a2d762900caf366ffd9e
[]
no_license
5731112821-AL/ProgMethProject
d12586a6ee256a99c5146c399ba46e0d64fa1afa
8cc3d5b3f5ebf36a79f8b0d5fd8d6e4584e31529
refs/heads/master
2021-01-13T00:38:26.062675
2015-12-15T22:30:00
2015-12-15T22:30:00
46,356,747
0
1
null
2015-12-10T15:37:51
2015-11-17T15:39:04
Java
UTF-8
Java
false
false
1,882
java
package flyerGame.ui; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import engine.render.InfiniteTile; import engine.ui.Button; import engine.ui.VisibleObject; import flyerGame.engineExtension.MovingBackground; import flyerGame.engineExtension.Resources; import flyerGame.engineExtension.SystemLogic; import flyerGame.engineExtension.SystemLogic.Action; /** * Gui Class of the Credits GUI Page * @author L2k-nForce */ public class CreditsGui extends Gui{ private Button backButton; private VisibleObject background; private MovingBackground script; public CreditsGui(SystemLogic systemLogic) { int offset = Resources.globalOffset; backButton = new Button(Resources.CreditsGUI.back, 280+offset, 920, new MouseListener() { @Override public void mouseReleased(MouseEvent e) { backButton.setClicked(false); systemLogic.action(Action.back); } @Override public void mousePressed(MouseEvent e) { backButton.setClicked(true);} @Override public void mouseClicked(MouseEvent e) {} @Override public void mouseEntered(MouseEvent e) { backButton.setHover(true);} @Override public void mouseExited(MouseEvent e) { backButton.setHover(false);} }); buttons.add(backButton); background = new VisibleObject(Resources.CreditsGUI.background, offset, 0, 0, 0); renderablesToAdd.add(background); script = new MovingBackground(new InfiniteTile(Resources.CreditsGUI.script), 0, 0.02f, -offset, 0); renderablesToAdd.add(script); systemLogic.addObjectNextTick(script); postConstrutorConfig(); } @Override public void setEnable(boolean set) { super.setEnable(set); if(set){ script.setY(0); } } @Override public void updateRenderableStates() { int offset = Resources.globalOffset; background.setScreenX(offset); script.setX(-offset); backButton.setScreenX(280+offset); } }
[ "bobby_nh@hotmail.com" ]
bobby_nh@hotmail.com
4116122b67831a18cac1f19588405ed2da389a10
5ceefa58a8acdf21278f9e5849d2ff901d86b01d
/Spring_AOP/src/beans/client/MethodInterceptorClient.java
810a3cef1f963e726b56fd5365a63230cb15a4ff
[]
no_license
Satish522/Spring
f85253a68190530b0b5a17c75235c9dd24093f86
ec44eceee894fbbdf399856833155d73ceacaa33
refs/heads/master
2021-04-27T13:49:54.791087
2018-04-04T16:44:59
2018-04-04T16:44:59
122,446,192
0
0
null
null
null
null
UTF-8
Java
false
false
485
java
package beans.client; import org.springframework.aop.framework.ProxyFactory; import beans.aop.programatic.AroundAspect; import beans.service.Math; public class MethodInterceptorClient { public static void main(String[] args) { // TODO Auto-generated method stub Math math=new Math(); ProxyFactory pf=new ProxyFactory(); pf.addAdvice(new AroundAspect()); pf.setTarget(math); Math m=(Math)pf.getProxy(); System.out.println(m.multiply(3, 4)); } }
[ "sasubudh@SASUBUDH-87D80.partnet.cisco.com" ]
sasubudh@SASUBUDH-87D80.partnet.cisco.com
881e06ca6b2b4faaafd577981e0d90764199afd3
b27f53005a6230fbd975677f20da43f5a3c4393c
/part04-Part04_17.Items/src/main/java/Items.java
07aebad4bc383505378448697d8e46830c41a134
[]
no_license
pbfryman/java-MOOC-I
97b6f4fb315b21fe7a8f184cd7a0e734bdc63d77
5743c1c28db06e26bf40b9429e0c7e7f2c97dd42
refs/heads/main
2023-01-30T17:22:14.441041
2020-12-07T18:16:54
2020-12-07T18:16:54
319,404,058
0
0
null
null
null
null
UTF-8
Java
false
false
644
java
import java.util.ArrayList; import java.util.Scanner; public class Items { public static void main(String[] args) { // implement here your program that uses the class Item ArrayList<Item> items = new ArrayList<>(); Scanner scanner = new Scanner(System.in); while (true) { System.out.print("Name: "); String name = scanner.nextLine(); if (name.isEmpty()) { break; } items.add(new Item(name)); } for (Item item : items) { System.out.println(item); } } }
[ "pfryman@student.wgu.edu" ]
pfryman@student.wgu.edu
bb8decc5f0cb45f13c264bb699072fa7bd4f4e17
257dd1efc08773f3a9ab4062426b0ec41afe1407
/Mackenzie_LP1/src/semana5/labInterseccao.java
55ba92b79d39e12597895a87d430ac8aefa20e8b
[]
no_license
lucastedeschi/Mackenzie-LP1
37e07af4aa4d1bd5f1f85cf940a10c34003be4a1
4815bf3cd569babdd0b508261ff7cdcc723eb6b6
refs/heads/master
2016-09-05T11:53:53.143821
2015-05-15T13:33:26
2015-05-15T13:33:26
32,524,339
1
0
null
null
null
null
UTF-8
Java
false
false
709
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 semana5; import java.awt.Rectangle; /** * * @author Lucas Tedeschi */ public class labInterseccao { public static Rectangle interseccao(Rectangle s, Rectangle t){ Rectangle box = s.intersection(t); return box; } public static void main(String args[]){ Rectangle box1 = new Rectangle(1,1,2,3); Rectangle box2 = new Rectangle(2,2,2,3); Rectangle res = interseccao(box1,box2); System.out.println("Retângulo resultante da interseccção: " + res); } }
[ "Lucas Tedeschi@LucasTedeschi" ]
Lucas Tedeschi@LucasTedeschi
8dfc887b15df25c18bd0bf06f02c17dc95310abe
a5a7e06fe569be4ecc3f6eee2704f6f6f4d8a3eb
/plugin/src/main/java/com/craftmend/openaudiomc/generic/commands/middleware/CleanStateCheckMiddleware.java
ecfe91653e2be0b9aa8336dd006b55b4e90c045f
[]
permissive
ApocalypsjeNL/OpenAudioMc
48ae4f148033ba2cc6d6a9ca5d318d871b06eb1a
3dd1f48c11995897a67f03c8e6a0261d503e79c4
refs/heads/master
2021-07-17T05:55:50.470889
2021-01-25T12:41:15
2021-01-25T12:41:15
115,910,912
0
0
Apache-2.0
2021-01-25T12:41:16
2018-01-01T09:46:13
Java
UTF-8
Java
false
false
1,074
java
package com.craftmend.openaudiomc.generic.commands.middleware; import com.craftmend.openaudiomc.OpenAudioMc; import com.craftmend.openaudiomc.generic.commands.interfaces.CommandMiddleware; import com.craftmend.openaudiomc.generic.commands.interfaces.GenericExecutor; import com.craftmend.openaudiomc.generic.commands.interfaces.SubCommand; public class CleanStateCheckMiddleware implements CommandMiddleware { @Override public boolean continueCommand(GenericExecutor genericExecutor, SubCommand subCommand) { if (!OpenAudioMc.getInstance().isCleanStartup()) { genericExecutor.sendMessage(OpenAudioMc.getInstance().getCommandModule().getCommandPrefix() + "It looks like that OpenAudioMc didn't start up smoothly due to a plugin/server reload. To prevent further damage, the plugin has now disabled itself. Please restart your server to re-activate the plugin. If this message keeps popping up (even after a clean restart), please contact the developer in the Discord server."); return false; } return true; } }
[ "noreply@github.com" ]
ApocalypsjeNL.noreply@github.com
1b0049ac9585b37121d1bc723e4e05846b5db545
e51c210ccf72a8ac1414791d8af552662c3fb034
/passerelle-core/com.isencia.passerelle.process.service.impl/src/main/java/com/isencia/passerelle/process/service/impl/FlowHandleImpl.java
2f896193e8cb3231b42db0cb5a93cf98d1c09cf5
[]
no_license
eclipselabs/passerelle
0187efa4fba411265ab58d60b5d83e74af09b203
e327dea8f4188e4bfe5ef4a76dd2476ad6f5664d
refs/heads/master
2021-01-18T09:26:07.614275
2017-06-28T10:05:12
2017-06-28T10:05:12
36,805,342
5
3
null
2015-08-04T18:43:19
2015-06-03T13:27:15
Java
UTF-8
Java
false
false
1,557
java
package com.isencia.passerelle.process.service.impl; import java.net.URI; import com.isencia.passerelle.actor.FlowUtils; import com.isencia.passerelle.model.Flow; import com.isencia.passerelle.runtime.FlowHandle; import com.isencia.passerelle.runtime.repository.VersionSpecification; public class FlowHandleImpl implements FlowHandle { private static final long serialVersionUID = 1L; private URI resourceLocator; private String code; private VersionSpecification version; private String rawFlowDefinition; private transient Flow flow; public FlowHandleImpl() { } public FlowHandleImpl(Flow flow) { code = flow.getName(); if (code.contains(FlowUtils.FLOW_SEPARATOR)) { code = code.split(FlowUtils.FLOW_SEPARATOR)[0]; } this.flow = flow; } @Override public String getCode() { return code; } @Override public Flow getFlow() { return flow; } @Override public String getRawFlowDefinition() { return rawFlowDefinition; } @Override public URI getResourceLocation() { return resourceLocator; } @Override public VersionSpecification getVersion() { return version; } public void setCode(String code) { this.code = code; } public void setFlow(Flow flow) { this.flow = flow; } public void setRawFlowDefinition(String rawFlowDefinition) { this.rawFlowDefinition = rawFlowDefinition; } public void setResourceLocator(URI resourceLocator) { this.resourceLocator = resourceLocator; } public void setVersion(VersionSpecification version) { this.version = version; } }
[ "erwindl0@gmail.com" ]
erwindl0@gmail.com
86848eb89f000041de1483c40df5f2b71b4bfebe
647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4
/com.tencent.mm/classes.jar/com/tencent/mm/boot/svg/code/drawable/fav_addtab_normal.java
5fa570e8473572feee7d8ce7f9f02fcaca27ac3a
[]
no_license
tsuzcx/qq_apk
0d5e792c3c7351ab781957bac465c55c505caf61
afe46ef5640d0ba6850cdefd3c11badbd725a3f6
refs/heads/main
2022-07-02T10:32:11.651957
2022-02-01T12:41:38
2022-02-01T12:41:38
453,860,108
36
9
null
2022-01-31T09:46:26
2022-01-31T02:43:22
Java
UTF-8
Java
false
false
4,240
java
package com.tencent.mm.boot.svg.code.drawable; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Paint.Cap; import android.graphics.Paint.Join; import android.graphics.Paint.Style; import android.graphics.Path; import android.os.Looper; import com.tencent.mm.svg.WeChatSVGRenderC2Java; import com.tencent.mm.svg.c; public class fav_addtab_normal extends c { private final int height = 24; private final int width = 24; public int doCommand(int paramInt, Object... paramVarArgs) { switch (paramInt) { } for (;;) { return 0; return 24; return 24; Canvas localCanvas = (Canvas)paramVarArgs[0]; paramVarArgs = (Looper)paramVarArgs[1]; Object localObject1 = c.instanceMatrix(paramVarArgs); Object localObject2 = c.instanceMatrixArray(paramVarArgs); Paint localPaint1 = c.instancePaint(paramVarArgs); localPaint1.setFlags(385); localPaint1.setStyle(Paint.Style.FILL); Paint localPaint2 = c.instancePaint(paramVarArgs); localPaint2.setFlags(385); localPaint2.setStyle(Paint.Style.STROKE); localPaint1.setColor(-16777216); localPaint2.setStrokeWidth(1.0F); localPaint2.setStrokeCap(Paint.Cap.BUTT); localPaint2.setStrokeJoin(Paint.Join.MITER); localPaint2.setStrokeMiter(4.0F); localPaint2.setPathEffect(null); c.instancePaint(localPaint2, paramVarArgs).setStrokeWidth(1.0F); localCanvas.save(); localPaint1 = c.instancePaint(localPaint1, paramVarArgs); localPaint1.setColor(-436207616); localObject2 = c.setMatrixFloatArray((float[])localObject2, 1.0F, 0.0F, 2.0F, 0.0F, 1.0F, 3.0F, 0.0F, 0.0F, 1.0F); ((Matrix)localObject1).reset(); ((Matrix)localObject1).setValues((float[])localObject2); localCanvas.concat((Matrix)localObject1); localCanvas.save(); localObject1 = c.instancePaint(localPaint1, paramVarArgs); localObject2 = c.instancePath(paramVarArgs); ((Path)localObject2).moveTo(1.207107F, 11.207107F); ((Path)localObject2).cubicTo(0.816583F, 10.816583F, 0.816583F, 10.183417F, 1.207107F, 9.792893F); ((Path)localObject2).lineTo(10.707107F, 0.2928932F); ((Path)localObject2).cubicTo(10.894643F, 0.1053568F, 11.148997F, 1.073389E-014F, 11.414213F, 1.021405E-014F); ((Path)localObject2).lineTo(18.0F, 0.0F); ((Path)localObject2).cubicTo(18.552284F, -1.014531E-016F, 19.0F, 0.4477153F, 19.0F, 1.0F); ((Path)localObject2).lineTo(19.0F, 7.585786F); ((Path)localObject2).cubicTo(19.0F, 7.851003F, 18.894644F, 8.105357F, 18.707108F, 8.292893F); ((Path)localObject2).lineTo(9.207107F, 17.792892F); ((Path)localObject2).cubicTo(8.816583F, 18.183418F, 8.183417F, 18.183418F, 7.792893F, 17.792892F); ((Path)localObject2).lineTo(1.207107F, 11.207107F); ((Path)localObject2).close(); ((Path)localObject2).moveTo(17.799999F, 7.502944F); ((Path)localObject2).lineTo(17.799999F, 1.2F); ((Path)localObject2).lineTo(11.497056F, 1.2F); ((Path)localObject2).lineTo(2.197056F, 10.5F); ((Path)localObject2).lineTo(8.5F, 16.802944F); ((Path)localObject2).lineTo(17.799999F, 7.502944F); ((Path)localObject2).close(); ((Path)localObject2).moveTo(14.0F, 6.5F); ((Path)localObject2).cubicTo(13.171573F, 6.5F, 12.5F, 5.828427F, 12.5F, 5.0F); ((Path)localObject2).cubicTo(12.5F, 4.171573F, 13.171573F, 3.5F, 14.0F, 3.5F); ((Path)localObject2).cubicTo(14.828427F, 3.5F, 15.5F, 4.171573F, 15.5F, 5.0F); ((Path)localObject2).cubicTo(15.5F, 5.828427F, 14.828427F, 6.5F, 14.0F, 6.5F); ((Path)localObject2).close(); WeChatSVGRenderC2Java.setFillType((Path)localObject2, 2); localCanvas.drawPath((Path)localObject2, (Paint)localObject1); localCanvas.restore(); localCanvas.restore(); c.done(paramVarArgs); } } } /* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes12.jar * Qualified Name: com.tencent.mm.boot.svg.code.drawable.fav_addtab_normal * JD-Core Version: 0.7.0.1 */
[ "98632993+tsuzcx@users.noreply.github.com" ]
98632993+tsuzcx@users.noreply.github.com
76821b93382e8e9688a45ce94d1a71cd1acd1f2b
6b266d89694d9dd94395c469992459a94a7a999b
/app/src/main/java/com/example/rs2/MainActivity.java
f17f9b75e6798ee13fba82c02c4650ba0395b27b
[]
no_license
Kodi392/The-Ration-App
c69270b171b5d029859f6d2091e6b187c23bd1f4
69979676c0a308bb7c0eb7f9be403b8a4ad5e111
refs/heads/master
2023-05-25T13:29:05.482048
2021-05-30T06:15:55
2021-05-30T06:15:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,067
java
package com.example.rs2; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class MainActivity extends AppCompatActivity { Button signup,login; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); signup=(Button)findViewById(R.id.signuphome); login=(Button)findViewById(R.id.loginhome); signup.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(MainActivity.this,signup2.class)); finish(); } }); login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(MainActivity.this, com.example.rs2.login.class)); finish(); } }); } }
[ "dinuss2k@gmail.com" ]
dinuss2k@gmail.com
a004b6b0b5430fa6466f065336c911388475d1e4
f23f6870ac6c87c2fc2f1a439508adf1baaaf2f9
/Guava/src/test/java/com/jachs/guava/io/FilesTest.java
ae98cfcb3ef6e0d78603ea4f13279ae4da8d60b5
[]
no_license
ZhanChaoHan/Google
8d32cd1b32ef0877b0c67ca090fc2e0f2ce56695
a9d839beb0badd49f8628dc9cacb25cc04a37c13
refs/heads/main
2023-08-31T08:52:42.137428
2021-11-01T08:55:40
2021-11-01T08:55:40
401,264,432
0
0
null
null
null
null
UTF-8
Java
false
false
2,328
java
package com.jachs.guava.io; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.nio.MappedByteBuffer; import java.nio.charset.Charset; import org.junit.Test; import com.google.common.io.ByteSink; import com.google.common.io.ByteSource; import com.google.common.io.CharSink; import com.google.common.io.CharSource; import com.google.common.io.FileWriteMode; import com.google.common.io.Files; /*** * * @author zhanchaohan * */ public class FilesTest { /*** * 复制文件 * * @throws FileNotFoundException * @throws IOException */ @Test public void copyTest() throws FileNotFoundException, IOException { Files.copy(new File("e:\\aaa.txt"), new FileOutputStream("f:\\c.txt")); Files.copy(new File("e:\\aaa.txt"), new File("f:\\cc.txt")); } /*** * 文本后追加内容 * * @throws IOException */ @Test public void testAppend() throws IOException { Files.append("追加内容", new File("f:\\cc.txt"), Charset.defaultCharset()); } /*** * 可以同时获取is和os, 需要手动关闭流 */ @Test public void testByteSink() { ByteSink bs = Files.asByteSink(new File("f:\\cc.txt"), FileWriteMode.APPEND); } @Test public void testByteSource() { ByteSource bs=Files.asByteSource(new File("f:\\cc.txt")); } //------------------------------ @Test public void testCharSink() { CharSink cs=Files.asCharSink(null, null, null); } @Test public void testCharSource() { CharSource cs=Files.asCharSource(new File(""), Charset.defaultCharset()); } //---------------------------------- @Test public void testcreateParentDirs() throws IOException { //创建父级文件夹如果不存在 Files.createParentDirs(new File("f:\\aaa\\aa\\a")); } @Test public void testFileExtension() { //取后缀 String nc=Files.getFileExtension("jchu.ewq.dqfw.v.txt"); System.out.println(nc); } @Test public void testNameWithoutExtension() { //取名称 String nc=Files.getNameWithoutExtension("jchu.ewq.dqfw.v.txt"); System.out.println(nc); } @Test public void testMap() throws IOException { MappedByteBuffer mbb=Files.map(new File("")); } @Test public void testMove() throws IOException { //移动文件 Files.move(new File("f:\\a.txt"), new File("e:\\bc.txt")); } }
[ "799516423@qq.com" ]
799516423@qq.com
fc4c7ac9bc2974101df7b2890f38fcd1aa6f6577
3c36704817f868c462aead3078613a3003ead17b
/src/introsde/rest/client/ClientMain.java
ab3c078f26cf675ab9dc91cab71d6333992dc11d
[]
no_license
Recognizen/introsde-2016-assignment-2
0ced62b92831c7ab211e907dfb49a5bb83a3c8e9
772f1cccfde325a71b01bd35a7deba36b78ba9de
refs/heads/master
2020-07-02T22:23:11.767160
2016-11-22T20:36:41
2016-11-22T20:36:41
74,275,367
0
0
null
null
null
null
UTF-8
Java
false
false
34,729
java
package introsde.rest.client; import java.io.IOException; import java.io.PrintWriter; import java.io.StringReader; import java.io.StringWriter; import java.util.ArrayList; import java.util.List; import javax.ws.rs.core.Response; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.OutputKeys; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import javax.xml.xpath.XPathExpressionException; import com.jayway.jsonpath.JsonPath; import org.json.JSONArray; import org.json.JSONObject; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; public class ClientMain { private PrintWriter writerXML; private PrintWriter writerJSON; private XPathQueries queryXML; private ClientRequests client; private int first_person_id; private int last_person_id; public ClientMain(){ client = new ClientRequests(); // Print URL System.out.println("URL of the server: " + ClientRequests.getBaseURI()); try { //----------------------- Task 2 --------------------------- this.xmlRun(); this.jsonRun(); } catch (XPathExpressionException | IOException | ParserConfigurationException | SAXException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void main(String[] args) throws JsonParseException, JsonMappingException, IOException { new ClientMain(); } public void xmlRun() throws JsonParseException, JsonMappingException, IOException, XPathExpressionException, ParserConfigurationException, SAXException{ final String format = "xml"; //utility class, provides xPath queries queryXML = new XPathQueries(); writerXML = new PrintWriter("client-server-xml.log", "UTF-8"); //-------------------- Task 1 --------------------- writerXML.write("URL of the server: " + ClientRequests.getBaseURI()); //-------------------- Task 3.1 -------------------- System.out.println("\nXML:-------------------- Task 3.1 --------------------\n"); writerXML.write("\n-------------------- Task 3.1 --------------------\n"); String request = "#1 GET /person Accept: APPLICATION/XML Content-Type: APPLICATION/XML"; Response response = client.doGET("person", format); String body = response.readEntity(String.class); //Get first and last ids from XPath nodes NodeList peopleIDs = queryXML.getPersonIDs(body); first_person_id = Integer.parseInt(peopleIDs.item(0).getTextContent()); last_person_id = Integer.parseInt(peopleIDs.item(peopleIDs.getLength() - 1).getTextContent()); String reqResult = ((peopleIDs.getLength() < 3) ? "ERROR" : "OK"); System.out.println(printResult(request, response.getStatus(), reqResult, body, format)); writerXML.write(printResult(request, response.getStatus(), reqResult, body, format)); // -------------------- Task 3.2 -------------------- System.out.println("\nXML:-------------------- Task 3.2 --------------------\n"); writerXML.write("\n-------------------- Task 3.2 --------------------\n"); request = "#2 GET /person/" + first_person_id + " Accept: APPLICATION/XML Content-Type: APPLICATION/XML"; response = client.doGET("person/" + first_person_id, format); body = response.readEntity(String.class); reqResult = ((response.getStatus() == 200 || (response.getStatus() == 201) ? "OK" : "ERROR")); System.out.println(printResult(request, response.getStatus(), reqResult, body, format)); writerXML.write(printResult(request, response.getStatus(), reqResult, body, format)); // -------------------- Task 3.3 -------------------- System.out.println("\nXML:-------------------- Task 3.3 --------------------\n"); writerXML.write("\n-------------------- Task 3.3 --------------------\n"); //Reprinting previous GET, no need to redo it System.out.println(printResult(request, response.getStatus(), reqResult, body, format)); writerXML.write(printResult(request, response.getStatus(), reqResult, body, format)); //Save the first name of the person returned by 3.2 String oldFirstName = queryXML.getNodeResult("person/firstname", body).getTextContent(); request = "#3 PUT /person/" + first_person_id + " Accept: APPLICATION/XML Content-Type: APPLICATION/XML"; // BODY of the PUT request String requestBody = "<person>" + "<firstname>a" + oldFirstName + "a</firstname>" + "<healthProfile></healthProfile>" + "</person>"; //PUT request to update the person with first_person_id's firstname response = client.doPUT("person/" + first_person_id, requestBody, format); //REDO GET to see if updated Response responseGET = client.doGET("person/" + first_person_id, format); String getBody = responseGET.readEntity(String.class); //Save the first name of the updated person String newFirstName = queryXML.getNodeResult("person/firstname", getBody).getTextContent(); //if PUT request was successful and the name is actually changed then OK reqResult = ((response.getStatus() == 201 && !oldFirstName.equals(newFirstName) ? "OK" : "ERROR")); //Printing body empty because PUT response does not return a body System.out.println(printResult(request, response.getStatus(), reqResult, "", format)); writerXML.write(printResult(request, response.getStatus(), reqResult, "", format)); //reset the GET request header request = "#2 GET /person/" + first_person_id + " Accept: APPLICATION/JSON Content-Type: APPLICATION/JSON"; //Printing the second GET System.out.println(printResult(request, responseGET.getStatus(), "OK", getBody, format)); writerXML.write(printResult(request, responseGET.getStatus(), "OK", getBody, format)); // -------------------- Task 3.4 -------------------- System.out.println("\nXML:-------------------- Task 3.4 --------------------\n"); writerXML.write("\n-------------------- Task 3.4 --------------------\n"); request = "#4 POST /person Accept: APPLICATION/XML Content-Type: APPLICATION/XML"; requestBody = "<person>" + "<firstname>New</firstname>" + "<lastname>Person</lastname>" + "<birthdate>1978-09-01T23:00:00+01:00</birthdate>" + "<email>new.person@gmail.com</email>" + "<username>new.person</username>" + "<healthProfile>" + "<measure>" + "<value>72.3</value>" + "<measureDefinition>" + "<type>weight</type>" + "</measureDefinition>" + "</measure>" + "<measure>" + "<value>1.86</value>" + "<measureDefinition>" + "<type>height</type>" + "</measureDefinition>" + "</measure>" + "</healthProfile>" + "</person>"; //Send POST request with above body response = client.doPOST("person", requestBody, format); body = response.readEntity(String.class); int resultPost = response.getStatus(); //Store the idPerson of the generated person String newIdPerson = queryXML.getNodeResult("person/idPerson", body).getTextContent(); reqResult = ((resultPost == 200 || resultPost == 201 || resultPost == 202) && !newIdPerson.isEmpty() ? "OK" : "ERROR"); System.out.println(printResult(request, resultPost, reqResult, body, format)); writerXML.write(printResult(request, resultPost, reqResult, body, format)); // -------------------- Task 3.5 -------------------- System.out.println("\nXML:-------------------- Task 3.5 --------------------\n"); writerXML.write("\n-------------------- Task 3.5 --------------------\n"); request = "#5 DELETE /person/" + newIdPerson + " Accept: APPLICATION/XML Content-Type: APPLICATION/XML"; response = client.doDELETE("person/"+ newIdPerson, format); String request2 = "#2 GET /person/" + newIdPerson + " Accept: APPLICATION/XML Content-Type: APPLICATION/XML"; Response response2 = client.doGET("person/"+ newIdPerson, format); reqResult = (response.getStatus() == 204 && response2.getStatus() == 404 ? "OK" : "ERROR"); System.out.println(printResult(request, response.getStatus(), reqResult, "", format)); writerXML.write(printResult(request, response.getStatus(), reqResult, "", format)); System.out.println(printResult(request2, response2.getStatus(), reqResult, "", format)); writerXML.write(printResult(request2, response2.getStatus(), reqResult, "", format)); // -------------------- Task 3.6 -------------------- System.out.println("\nXML:-------------------- Task 3.6 --------------------\n"); writerXML.write("\n-------------------- Task 3.6 --------------------\n"); request = "#9 GET /measureTypes Accept: APPLICATION/XML Content-Type: APPLICATION/XML"; response = client.doGET("measureTypes", format); body = response.readEntity(String.class); //Retrieve all measureType elements from the response body NodeList types = queryXML.getNodeListResult("measureTypes/measureType", body); List<String> measure_types = new ArrayList<>(); //save them in a list for (int i = 0; i < types.getLength(); i++) { measure_types.add(types.item(i).getTextContent()); } reqResult = ((measure_types.size() < 3) ? "ERROR" : "OK"); System.out.println(printResult(request, response.getStatus(), reqResult, body, format)); writerXML.write(printResult(request, response.getStatus(), reqResult, body, format)); // -------------------- Task 3.7 -------------------- System.out.println("\nXML:-------------------- Task 3.7 --------------------\n"); writerXML.write("\n-------------------- Task 3.7 --------------------\n"); //to be used in Task 3.8 int measurePersonId = 0; String measure_id =""; String measure_type =""; //keep track of number measures found int measureCount = 0; //Structure used to Nest the two id loops List<Integer> ids = new ArrayList<>(); ids.add(first_person_id); ids.add(last_person_id); //Iterate over people and measuretypes in search for at least one measure for(Integer i : ids){ for (String measureType : measure_types) { //do the get requests response = client.doGET("person/"+ i.intValue() + "/"+ measureType, format); body = response.readEntity(String.class); if (response.getStatus() == 200) { NodeList nodes = queryXML.getNodeListResult("healthMeasureHistories/measure/mid" , body); //This will ensure that we keep at least one measure for Task 3.8 if (nodes.getLength() > 0) { measurePersonId = i.intValue(); measure_id = nodes.item(0).getTextContent(); measure_type = measureType; measureCount+=nodes.getLength(); } } } } //if at least one measure was found among the two people then OK if (measureCount == 0) { reqResult = "ERROR"; request = "#6 GET /person/{id}/{measureType} Accept: APPLICATION/XML Content-Type: APPLICATION/XML"; System.out.println(printResult(request, 204 , reqResult, "", format)); writerXML.write(printResult(request, 204 , reqResult, "", format)); } else { reqResult = "OK"; //REDO the GET requests in order to log them for(Integer i : ids){ for (String measureType : measure_types) { request = "#6 GET /person/"+ i.intValue() +"/" + measureType +" Accept: APPLICATION/XML Content-Type: APPLICATION/XML"; response = client.doGET("person/"+ i.intValue() + "/"+ measureType, format); body = response.readEntity(String.class); //if something was found then print the body as well, otherwise content not found if (response.getStatus() == 200) { System.out.println(printResult(request, response.getStatus(), reqResult, body, format)); writerXML.write(printResult(request, response.getStatus(), reqResult, body, format)); } else { System.out.println(printResult(request, 204 , reqResult, "", format)); writerXML.write(printResult(request, 204 , reqResult, "", format)); } } } } //System.out.println("Found measures: "+measureCount); // -------------------- Task 3.8 -------------------- System.out.println("\nXML:-------------------- Task 3.8 --------------------\n"); writerXML.write("\n-------------------- Task 3.8 --------------------\n"); request = "#7 GET /person/" + measurePersonId + "/" + measure_type + "/" + measure_id + " Accept: APPLICATION/XML Content-Type: APPLICATION/XML"; response = client.doGET("person/" + measurePersonId + "/" + measure_type + "/" + measure_id , format); body = response.readEntity(String.class); reqResult = (response.getStatus() == 200 ? "OK" : "ERROR"); System.out.println(printResult(request, response.getStatus(), reqResult, body, format)); writerXML.write(printResult(request, response.getStatus(), reqResult, body, format)); // -------------------- Task 3.9 -------------------- System.out.println("\nXML:-------------------- Task 3.9 --------------------\n"); writerXML.write("\n-------------------- Task 3.9 --------------------\n"); request = "#6 GET /person/" + measurePersonId + "/" + measure_type + " Accept: APPLICATION/XML Content-Type: APPLICATION/XML"; //GET all measures having type response = client.doGET("person/"+ measurePersonId + "/"+ measure_type, format); body = response.readEntity(String.class); //store how many measures there were measureCount = 0; if (response.getStatus() == 200) { NodeList nodes = queryXML.getNodeListResult("healthMeasureHistories/measure/mid" , body); measureCount = nodes.getLength(); String requestPost = "#8 POST /person/" + measurePersonId + "/" + measure_type + " Accept: APPLICATION/XML Content-Type: APPLICATION/XML"; requestBody = "<measure>" + "<value>102</value>" + "<created>2011-12-09</created>" + "</measure>"; //POST request adding a measure Response responsePost = client.doPOST("person/" + measurePersonId + "/" + measure_type, requestBody, format); String postBody = responsePost.readEntity(String.class); //Redo the GET responseGET = client.doGET("person/"+ measurePersonId + "/"+ measure_type, format); getBody = responseGET.readEntity(String.class); //Find new number of measures NodeList nodes2 = queryXML.getNodeListResult("healthMeasureHistories/measure/mid", getBody); int newMeasureCount = nodes2.getLength(); //System.out.println(measureCount +" <? " + newMeasureCount); reqResult = (measureCount+1 == newMeasureCount ? "OK" : "ERROR"); System.out.println(printResult(request, response.getStatus(), "OK", body, format)); writerXML.write(printResult(request, response.getStatus(), "OK", body, format)); System.out.println(printResult(requestPost, responsePost.getStatus(), reqResult, postBody, format)); writerXML.write(printResult(requestPost, responsePost.getStatus(), reqResult, postBody, format)); System.out.println(printResult(request, responseGET.getStatus(), "OK", getBody, format)); writerXML.write(printResult(request, responseGET.getStatus(), "OK", getBody, format)); // -------------------- Task 3.10 -------------------- System.out.println("\nXML:-------------------- Task 3.10 --------------------\n"); writerXML.write("\n-------------------- Task 3.10 --------------------\n"); //Using a R#6 to retrieve the measure with specific mid = measure_id String requestGET = "#6 GET /person/" + measurePersonId + "/" + measure_type+ "/" + measure_id + " Accept: APPLICATION/XML Content-Type: APPLICATION/XML"; responseGET = client.doGET("person/" + measurePersonId + "/" + measure_type + "/" + measure_id, format); body = responseGET.readEntity(String.class); String oldValue = queryXML.getNodeResult("measure/value",body).getTextContent(); request = "#10 PUT /person/" + measurePersonId + "/" + measure_type + "/" + measure_id + " Accept: APPLICATION/XML Content-Type: APPLICATION/XML"; requestBody = "<measure>" + "<value>"+(oldValue+1)+"</value>" + "<created>2011-12-09</created>" + "</measure>"; response = client.doPUT("person/" + measurePersonId + "/" + measure_type + "/" + measure_id, requestBody, format); int statusPUT = response.getStatus(); //REDO the GET responseGET = client.doGET("person/" + measurePersonId + "/" + measure_type + "/" + measure_id, format); getBody = responseGET.readEntity(String.class); String newValue = queryXML.getNodeResult("measure/value",getBody).getTextContent(); reqResult = (!oldValue.equals(newValue) && statusPUT == 201 ? "OK" : "ERROR"); //responseGET and body belong to the first GET request System.out.println(printResult(requestGET, responseGET.getStatus(), "OK", body, format)); writerXML.write(printResult(requestGET, responseGET.getStatus(), "OK", body, format)); System.out.println(printResult(request, statusPUT, reqResult, "", format)); writerXML.write(printResult(request, statusPUT, reqResult, "", format)); //responseGET and getBody belong to the second GET request System.out.println(printResult(requestGET, responseGET.getStatus(), "OK", getBody, format)); writerXML.write(printResult(requestGET, responseGET.getStatus(), "OK", getBody, format)); // -------------------- Task 3.11 & 3.12 -------------------- // Not implemented } writerXML.close(); } public void jsonRun() throws JsonParseException, JsonMappingException, IOException{ final String format = "json"; writerJSON = new PrintWriter("client-server-json.log", "UTF-8"); // -----------------------Task1--------------------------------- writerJSON.write("URL of the server: " + ClientRequests.getBaseURI()); //-------------------- Task 3.1 -------------------- System.out.println("\nJSON:-------------------- Task 3.1 --------------------\n"); writerJSON.write("\n-------------------- Task 3.1 --------------------\n"); String request = "#1 GET /person Accept: APPLICATION/JSON Content-Type: APPLICATION/JSON"; Response response = client.doGET("person", format); String body = response.readEntity(String.class); //Get first and last ids from JSON body first_person_id = JsonPath.read(body, "$.[0].idPerson"); last_person_id = JsonPath.read(body, "$.[(@.length-1)].idPerson"); JSONArray people = new JSONArray(body); String reqResult = ((people.length() < 3) ? "ERROR" : "OK"); System.out.println(printResult(request, response.getStatus(), reqResult, body, format)); writerJSON.write(printResult(request, response.getStatus(), reqResult, body, format)); // -------------------- Task 3.2 -------------------- System.out.println("\nJSON:-------------------- Task 3.2 --------------------\n"); writerJSON.write("\n-------------------- Task 3.2 --------------------\n"); request = "#2 GET /person/" + first_person_id + " Accept: APPLICATION/JSON Content-Type: APPLICATION/JSON"; response = client.doGET("person/" + first_person_id, format); body = response.readEntity(String.class); reqResult = ((response.getStatus() == 200 || (response.getStatus() == 201) ? "OK" : "ERROR")); System.out.println(printResult(request, response.getStatus(), reqResult, body, format)); writerJSON.write(printResult(request, response.getStatus(), reqResult, body, format)); // -------------------- Task 3.3 -------------------- System.out.println("\nJSON:-------------------- Task 3.3 --------------------\n"); writerJSON.write("\n-------------------- Task 3.3 --------------------\n"); //Reprinting previous GET, no need to redo it System.out.println(printResult(request, response.getStatus(), reqResult, body, format)); writerJSON.write(printResult(request, response.getStatus(), reqResult, body, format)); //Save the firstname of the person returned by 3.2 String oldFirstName = JsonPath.read(body, "$.firstname"); request = "#3 PUT /person/" + first_person_id + " Accept: APPLICATION/JSON Content-Type: APPLICATION/JSON"; // BODY of the PUT request String requestBody ="{" + "\"firstname\" : \"a"+ oldFirstName +"a\"," + "\"measure\": []" +"}"; //PUT request to update the person with first_person_id's firstname response = client.doPUT("person/" + first_person_id, requestBody, format); //REDO GET to see if updated Response responseGET = client.doGET("person/" + first_person_id, format); body = responseGET.readEntity(String.class); //Save the first name of the updated person String newFirstName = JsonPath.read(body, "$.firstname"); //if PUT request was successful and the name is actually changed then OK reqResult = ((response.getStatus() == 201 && !oldFirstName.equals(newFirstName) ? "OK" : "ERROR")); //Printing body empty because PUT response does not return a body System.out.println(printResult(request, response.getStatus(), reqResult, "",format)); writerJSON.write(printResult(request, response.getStatus(), reqResult, "",format)); //reset the GET request header request = "#2 GET /person/" + first_person_id + " Accept: APPLICATION/JSON Content-Type: APPLICATION/JSON"; //Printing the second GET System.out.println(printResult(request, responseGET.getStatus(), "OK", body,format)); writerJSON.write(printResult(request, responseGET.getStatus(), "OK", body,format)); // -------------------- Task 3.4 -------------------- System.out.println("\nJSON:-------------------- Task 3.4 --------------------\n"); writerJSON.write("\n-------------------- Task 3.4 --------------------\n"); request = "#4 POST /person Accept: APPLICATION/JSON Content-Type: APPLICATION/JSON"; requestBody ="{" + "\"firstname\" : \"New\"," + "\"lastname\" : \"Person\"," + "\"birthdate\" : \"1978-09-01\"," + "\"email\" : \"new.person@gmail.com\"," + "\"measure\": [" + "{" + "\"value\" : \"72.3\"," + "\"measureDefinition\" : {" + "\"type\": \"weight\"" +"}" + "}," + "{" + "\"value\" : \"1.86\"," + "\"measureDefinition\" : {" + "\"type\": \"height\"" +"}" + "}" + "]}"; //Send POST request with above body response = client.doPOST("person", requestBody, format); body = response.readEntity(String.class); int resultPost = response.getStatus(); //Store the idPerson of the generated person String newIdPerson = JsonPath.read(body, "$.idPerson").toString(); System.out.println(newIdPerson); reqResult = ((resultPost == 200 || resultPost == 201 || resultPost == 202) && !newIdPerson.isEmpty() ? "OK" : "ERROR"); System.out.println(printResult(request, resultPost, reqResult, body, format)); writerJSON.write(printResult(request, resultPost, reqResult, body, format)); // -------------------- Task 3.5 -------------------- System.out.println("\nJSON:-------------------- Task 3.5 --------------------\n"); writerJSON.write("\n-------------------- Task 3.5 --------------------\n"); request = "#5 DELETE /person/" + newIdPerson + " Accept: APPLICATION/JSON Content-Type: APPLICATION/JSON"; response = client.doDELETE("person/"+ newIdPerson, format); String request2 = "#2 GET /person/" + newIdPerson + " Accept: APPLICATION/JSON Content-Type: APPLICATION/JSON"; Response response2 = client.doGET("person/"+ newIdPerson, format); reqResult = (response.getStatus() == 204 && response2.getStatus() == 404 ? "OK" : "ERROR"); System.out.println(printResult(request, response.getStatus(), reqResult, "", format)); writerJSON.write(printResult(request, response.getStatus(), reqResult, "", format)); System.out.println(printResult(request2, response2.getStatus(), reqResult, "", format)); writerJSON.write(printResult(request2, response2.getStatus(), reqResult, "", format)); // -------------------- Task 3.6 -------------------- System.out.println("\nJSON:-------------------- Task 3.6 --------------------\n"); writerJSON.write("\n-------------------- Task 3.6 --------------------\n"); request = "#9 GET /measureTypes Accept: APPLICATION/JSON Content-Type: APPLICATION/JSON"; response = client.doGET("measureTypes", format); body = response.readEntity(String.class); //Retrieve all measureType elements from the response body JSONArray types = new JSONObject(body).getJSONArray("measureType"); List<String> measure_types = new ArrayList<>(); for(int i =0; i< types.length();i++){ measure_types.add(types.getString(i)); } reqResult = ((measure_types.size() < 3) ? "ERROR" : "OK"); System.out.println(printResult(request, response.getStatus(), reqResult, body, format)); writerJSON.write(printResult(request, response.getStatus(), reqResult, body, format)); // -------------------- Task 3.7 -------------------- System.out.println("\nJSON:-------------------- Task 3.7 --------------------\n"); writerJSON.write("\n-------------------- Task 3.7 --------------------\n"); //to be used in Task 3.8 int measurePersonId = 0; String measure_id =""; String measure_type =""; //keep track of number measures found int measureCount = 0; //Structure used to Nest the two id loops List<Integer> ids = new ArrayList<>(); ids.add(first_person_id); ids.add(last_person_id); //Iterate over people and measuretypes in search for at least one measure for(Integer i : ids){ for (String measureType : measure_types) { //do the get requests response = client.doGET("person/"+ i.intValue() + "/"+ measureType, format); body = response.readEntity(String.class); if (response.getStatus() == 200) { JSONArray measures = new JSONArray(body); //This will ensure that we keep at least one measure for Task 3.8 if(measures.length()>0){ measurePersonId = i.intValue(); measure_id = ((JSONObject)measures.get(0)).getInt("mid")+""; measure_type = measureType; measureCount += measures.length(); // System.out.println(i.toString() +" : "+ measure_id + " " + measure_type +" "+measureCount); } } } } //if at least one measure was found among the two people then OK if (measureCount == 0) { reqResult = "ERROR"; request = "#6 GET /person/{id}/{measureType} Accept: APPLICATION/JSON Content-Type: APPLICATION/JSON"; System.out.println(printResult(request, 204 , reqResult, "", format)); writerJSON.write(printResult(request, 204 , reqResult, "", format)); } else { reqResult = "OK"; //REDO the GET requests in order to log them for(Integer i : ids){ for (String measureType : measure_types) { request = "#6 GET /person/"+ i.intValue() +"/" + measureType +" Accept: APPLICATION/JSON Content-Type: APPLICATION/JSON"; response = client.doGET("person/"+ i.intValue() + "/"+ measureType, format); body = response.readEntity(String.class); //if something was found then print the body as well, otherwise content not found if (response.getStatus() == 200) { System.out.println(printResult(request, response.getStatus(), reqResult, body, format)); writerJSON.write(printResult(request, response.getStatus(), reqResult, body, format)); } else { System.out.println(printResult(request, 204 , reqResult, "", format)); writerJSON.write(printResult(request, 204 , reqResult, "", format)); } } } } // -------------------- Task 3.8 -------------------- System.out.println("\nJSON:-------------------- Task 3.8 --------------------\n"); writerJSON.write("\n-------------------- Task 3.8 --------------------\n"); request = "#7 GET /person/" + measurePersonId + "/" + measure_type + "/" + measure_id + " Accept: APPLICATION/JSON Content-Type: APPLICATION/JSON"; response = client.doGET("person/" + measurePersonId + "/" + measure_type + "/" + measure_id , format); body = response.readEntity(String.class); reqResult = (response.getStatus() == 200 ? "OK" : "ERROR"); System.out.println(printResult(request, response.getStatus(), reqResult, body, format)); writerJSON.write(printResult(request, response.getStatus(), reqResult, body, format)); // -------------------- Task 3.9 -------------------- System.out.println("\nJSON:-------------------- Task 3.9 --------------------\n"); writerJSON.write("\n-------------------- Task 3.9 --------------------\n"); request = "#6 GET /person/" + measurePersonId + "/" + measure_type + " Accept: APPLICATION/JSON Content-Type: APPLICATION/JSON"; //GET all measures having type response = client.doGET("person/"+ measurePersonId + "/"+ measure_type, format); body = response.readEntity(String.class); //store how many measures there were measureCount = 0; if (response.getStatus() == 200) { JSONArray measuresBefore = new JSONArray(body); measureCount = measuresBefore.length(); String requestPost = "#8 POST /person/" + measurePersonId + "/" + measure_type + " Accept: APPLICATION/JSON Content-Type: APPLICATION/JSON"; requestBody = "{ \"value\":\"102\"," + "\"created\":\"1950-10-10\"}"; //POST request adding a measure Response responsePost = client.doPOST("person/" + measurePersonId + "/" + measure_type, requestBody, format); String postBody = responsePost.readEntity(String.class); //Redo the GET responseGET = client.doGET("person/"+ measurePersonId + "/"+ measure_type, format); String getBody = responseGET.readEntity(String.class); //Find new number of measures JSONArray measuresAfter = new JSONArray(getBody); int newMeasureCount = measuresAfter.length(); //System.out.println(measureCount +" <? " + newMeasureCount); reqResult = (measureCount+1 == newMeasureCount ? "OK" : "ERROR"); System.out.println(printResult(request, response.getStatus(), "OK", body, format)); writerJSON.write(printResult(request, response.getStatus(), "OK", body, format)); System.out.println(printResult(requestPost, responsePost.getStatus(), reqResult, postBody, format)); writerJSON.write(printResult(requestPost, responsePost.getStatus(), reqResult, postBody, format)); System.out.println(printResult(request, responseGET.getStatus(), "OK", getBody, format)); writerJSON.write(printResult(request, responseGET.getStatus(), "OK", getBody, format)); // -------------------- Task 3.10 -------------------- System.out.println("\nJSON:-------------------- Task 3.10 --------------------\n"); writerJSON.write("\n-------------------- Task 3.10 --------------------\n"); //Using a R#6 to retrieve the measure with specific mid = measure_id String requestGET = "#6 GET /person/" + measurePersonId + "/" + measure_type + "/" + measure_id + " Accept: APPLICATION/JSON Content-Type: APPLICATION/JSON"; responseGET = client.doGET("person/" + measurePersonId + "/" + measure_type + "/" + measure_id, format); body = responseGET.readEntity(String.class); String oldValue = JsonPath.read(body, "$.value"); request = "#10 PUT /person/" + measurePersonId + "/" + measure_type + "/" + measure_id + " Accept: APPLICATION/JSON Content-Type: APPLICATION/JSON"; requestBody = "{"+ "\"value\": \""+(oldValue+1)+"\"," +"\"created\": \"2011-12-08\"" + "}"; response = client.doPUT("person/" + measurePersonId + "/" + measure_type + "/" + measure_id, requestBody, format); int statusPUT = response.getStatus(); responseGET = client.doGET("person/" + measurePersonId + "/" + measure_type + "/" + measure_id, format); getBody = responseGET.readEntity(String.class); String newValue = JsonPath.read(getBody, "$.value"); reqResult = (!oldValue.equals(newValue) && statusPUT == 201 ? "OK" : "ERROR"); //responseGET and body belong to the first GET request System.out.println(printResult(requestGET, responseGET.getStatus(), "OK", body, format)); writerJSON.write(printResult(requestGET, responseGET.getStatus(), "OK", body, format)); System.out.println(printResult(request, statusPUT, reqResult, "", format)); writerJSON.write(printResult(request, statusPUT, reqResult, "", format)); //responseGET and getBody belong to the second GET request System.out.println(printResult(requestGET, responseGET.getStatus(), "OK", getBody, format)); writerJSON.write(printResult(requestGET, responseGET.getStatus(), "OK", getBody, format)); // -------------------- Task 3.11 & 3.12 -------------------- // Not implemented } writerJSON.close(); } public String printResult(String request, int status, String result, String body, String format) throws JsonParseException, JsonMappingException, IOException { String craftedResult = "\nRequest: " + request + "\n" + "=>Result: " + result + "\n" + "=>HTTP Status: " + status + "\n" ; craftedResult += (format.equals("xml")) ? prettyXML(body) : prettyJSON(body); return craftedResult; } public static String prettyJSON(String input) throws JsonParseException, JsonMappingException, IOException { if(input != null && !input.isEmpty()){ ObjectMapper mapper = new ObjectMapper(); mapper.enable(SerializationFeature.INDENT_OUTPUT); Object json = mapper.readValue(input, Object.class); String indented = mapper.writerWithDefaultPrettyPrinter() .writeValueAsString(json); return indented; } return " "; } public static String prettyXML(String input) { int indent = 2; try { if(input != null && !input.isEmpty()){ Source xmlInput = new StreamSource(new StringReader(input)); StringWriter stringWriter = new StringWriter(); StreamResult xmlOutput = new StreamResult(stringWriter); TransformerFactory transformerFactory = TransformerFactory.newInstance(); transformerFactory.setAttribute("indent-number", indent); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.transform(xmlInput, xmlOutput); return xmlOutput.getWriter().toString(); } return " "; } catch (Exception e) { throw new RuntimeException(e); // simple exception handling, please review it } } }
[ "bogdanliviu_a@yahoo.com" ]
bogdanliviu_a@yahoo.com
0e13facd9eb72c6f199aea17db72db1d21c7b9a9
fec32819a8ffb22c2b8a4479490ba54904e71d26
/basicJava/src/main/java/com/sirish/utils/DatePredictor.java
399339d3749ee3e0e3f7ad7484b90672508622cb
[]
no_license
sirish936/sirish_work
d63c63a0012abacdb4307b9da299571ca240d19d
30f2c26691d6ea8724a46d9bdd2684b5c7f748b3
refs/heads/master
2022-06-18T12:19:43.674602
2020-02-18T07:18:40
2020-02-18T07:18:40
38,474,341
0
0
null
2022-05-20T20:52:42
2015-07-03T05:43:24
Java
UTF-8
Java
false
false
5,262
java
package com.sirish.utils; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class DatePredictor { static final Logger log = LoggerFactory.getLogger(DatePredictor.class); public PredictDates predictYear(final PredictDates predictDates) { PredictDates predictedDates = null; final PredictYearFor predictYearFor = getYearPredictor(predictDates); switch (predictYearFor) { case STATEMENT_DATE: predictedDates = predictStmtDateFromDueDates(predictDates); break; case DUE_DATE: predictedDates = predictDueDateFromStmtDates(predictDates); break; case STATEMENT_DATE_AND_DUE_DATE: predictedDates = predictStmtDateAndDueDate(predictDates); break; case NULLITY: log.error("Prediction is very difficult, {} ", predictDates); break; default: log.error("Prediction is very difficult, stmtDate: {} dueDate: {} ", predictDates.getStmtDate(), predictDates.getStmtDate()); break; } return predictedDates; } protected PredictDates predictStmtDateAndDueDate(final PredictDates predictDates) { log.info("Predicting year in stmt Date {} and Due date {}", predictDates.getStmtDate(), predictDates.getDueDate()); return null; } protected PredictDates predictDueDateFromStmtDates(final PredictDates predictDates) { log.info("Predicting year in Due date {}", predictDates.getDueDate()); return null; } protected PredictDates predictStmtDateFromDueDates(final PredictDates predictDates) { log.info("Predicting year in stmt Date {} ", predictDates.getStmtDate()); return null; } protected PredictYearFor getYearPredictor(final PredictDates predictDates) { final boolean isCorrectStatementDate, isCorrectDueDate; PredictYearFor predictYearFor = null; if (predictDates == null || predictDates.getStmtDate() == null || predictDates.getDueDate() == null) { log.warn("Null Refrence found it not possible to predict"); predictYearFor = PredictYearFor.NULLITY; } isCorrectStatementDate = getFormattedDate(predictDates.getStmtDate()) == null ? false : true; isCorrectDueDate = getFormattedDate(predictDates.getDueDate()) == null ? false : true; if (!isCorrectStatementDate && !isCorrectDueDate) { log.info("Missing year in StmtDate {} and Due date {} ", predictDates.getStmtDate(), predictDates.getDueDate()); predictYearFor = PredictYearFor.STATEMENT_DATE_AND_DUE_DATE; } else if (!isCorrectStatementDate) { log.info("Missing year in Statement date {}", predictDates.getStmtDate()); predictYearFor = PredictYearFor.STATEMENT_DATE; } else if (!isCorrectDueDate) { log.info("Missing year in Due date {}", predictDates.getDueDate()); predictYearFor = PredictYearFor.DUE_DATE; } return predictYearFor; } public static Date getFormattedDate(String date) { DateFormat format = null; if (date != null && !date.isEmpty()) { date = date.trim(); if (date.matches("((\\d){1,2}\\-){1,2}(\\d){4}")) { format = DateFormat.MM_DD_YYYY_WITH_HYPHEN; } else if (date.matches("((\\d){1,2}\\-){1,2}(\\d){2}")) { format = DateFormat.MM_DD_YY_WITH_HYPHEN; } else if (date.matches("((\\d){1,2}\\/){1,2}(\\d){2}")) { format = DateFormat.MM_DD_WITH_HYHEN; } else if (date.matches("((\\d){1,2}\\/){1,2}(\\d){4}")) { format = DateFormat.MM_DD_YYYY_WITH_SLASH; } else if (date.matches("((\\d){4}\\-(\\d){1,2}\\-(\\d){1,2})")) { format = DateFormat.YYYY_MM_DD_WITH_SLASH; } else if (date.matches("((\\w){3,9}\\s+(\\d){1,2}\\,\\s+(\\d){4})")) { format = DateFormat.MMM_DD_YYYY_WITH_SPACE; } else if (date.matches("((\\w){3,9}\\s+(\\d){1,2}\\,(\\d){4})")) { format = DateFormat.MMM_DD_YYYY_WITHOUT_SPACE; } else if (date.matches("((\\d){1,2}\\s+(\\w){3,9}\\,\\s+(\\d){4})")) { format = DateFormat.DD_MMM_YYYY_WITH_SPACE; } else if (date.matches("((\\d){1,2}\\s+(\\w){3,9}\\,(\\d){4})")) { format = DateFormat.DD_MMM_YYYY_WITHOUT_SPACE; } } if (format == null) { log.error("DateFormat not supported for the date {} ", date); return null; } final String month = date.toLowerCase(); if (month.contains("sept") && !month.contains("september")) { log.error("Scraped date value before formatting: {}", date); date = date.replaceAll("t", ""); log.error("Scraped date value after formatting: {}", date); } final Date formattedDate = getFormattedDate(format, date); return formattedDate; } public static Date getFormattedDate(final DateFormat format, final String date) { Date formattedDate = null; if (date != null && date.isEmpty() == false) { try { formattedDate = new SimpleDateFormat(format.toString()).parse(date); } catch (final ParseException e) { log.error("Error", e); } } return formattedDate; } } enum PredictYearFor { STATEMENT_DATE, DUE_DATE, STATEMENT_DATE_AND_DUE_DATE, NULLITY; } class PredictDates { private String dueDate; private String stmtDate; public String getDueDate() { return dueDate; } public void setDueDate(final String dueDate) { this.dueDate = dueDate; } public String getStmtDate() { return stmtDate; } public void setStmtDate(final String stmtDate) { this.stmtDate = stmtDate; } }
[ "sirish@lenovo.com" ]
sirish@lenovo.com
66df365a9b2ce87dcd1cb8cc383e1e887d6a53b6
9ef133c5712d76c16d0db17082fd7996617cc69c
/Ch13(재네릭)/src/exam01/PersonEx.java
ad4cec278a1b9e3ee3f65c074c66a66cf8385fb6
[]
no_license
youngseonL/2020_JAVA
63e15c16a05a1f6c04a9b43c53cafee5a017a8f1
103f33c9604a93ef7a07319cd37e70a4e9801be0
refs/heads/main
2023-04-02T22:47:16.088497
2021-04-08T11:59:29
2021-04-08T11:59:29
null
0
0
null
null
null
null
UHC
Java
false
false
690
java
package exam01; class Person{ private Object obj; // Object : 모든 클래스 public Object getObj() { return obj; } public void setObj(Object obj) { this.obj = obj; } } public class PersonEx { // 비제네릭 코드 public static void main(String[] args) { Person person = new Person(); //Up캐스팅 : String type => Object type person.setObj("홍길동"); // Down캐스팅 : Object type => String type String str = (String)person.getObj(); System.out.println(str); Person person1 = new Person(); //Boxing person1.setObj(new Integer(100)); int num = (Integer)person1.getObj(); System.out.println(num); } }
[ "68880233+parkincastle@users.noreply.github.com" ]
68880233+parkincastle@users.noreply.github.com
6a50786394aa080ebbea0d9f6b38bd23a5fff1b0
e6e0fda2a0665a29cab154c5d41d7abd3377110d
/core/src/kirill/ag/controller/WorldController.java
3d3f0d9e52544e2dd3f94ab36240b6e714ddf353
[]
no_license
iGroza/lesson_0001
3c75d27dc880dcb5d74654deca9765627711ec9e
0d13a7fe1dc604a599c5de2d97ab863beb203f2c
refs/heads/master
2019-05-18T07:55:27.340735
2017-02-28T10:45:49
2017-02-28T10:45:49
83,398,349
0
0
null
null
null
null
UTF-8
Java
false
false
1,763
java
package kirill.ag.controller; import java.util.HashMap; import java.util.Map; import kirill.ag.model.Player; /** * Created by Feor on 27.02.2017. */ public class WorldController { enum Keys{ LEFT,RIGHT,UP,DOWN } public Player player; static Map<Keys,Boolean> keys= new HashMap<Keys, Boolean>(); static { keys.put(Keys.DOWN ,false); keys.put(Keys.RIGHT ,false); keys.put(Keys.UP ,false); keys.put(Keys.DOWN ,false); } public WorldController(Player player) { this.player = player; } public void leftPressed(){ keys.put(Keys.LEFT ,true); } public void rightPressed(){ keys.put(Keys.RIGHT ,true); } public void upPressed(){ keys.put(Keys.UP ,true); } public void downPressed(){ keys.put(Keys.DOWN ,true); } public void leftReleased(){ keys.put(Keys.LEFT ,false); } public void rightReleased(){ keys.put(Keys.RIGHT ,false); } public void upReleased(){ keys.put(Keys.UP ,false); } public void downReleased(){ keys.put(Keys.DOWN ,false); } public void resetWay(){ downReleased(); rightReleased(); upReleased(); downReleased(); } public void update(float delta){ processInput(); player.update(delta); } private void processInput() { if(keys.get(Keys.LEFT )) player.getVelocity().x = -Player.SPEED; if(keys.get(Keys.RIGHT )) player.getVelocity().x = Player.SPEED; if(keys.get(Keys.UP )) player.getVelocity().y = Player.SPEED; if(keys.get(Keys.DOWN )) player.getVelocity().y = -Player.SPEED; } }
[ "xneonxneon@mail.ru" ]
xneonxneon@mail.ru
4262569ac4ac7f6f7387d0361e57a54e3535b2c1
b804507f9f8698a0bf06b22095da7cbd2b709aa9
/concurrency/tasksCooperation/NotifyVsNotifyAll.java
6f8acef407df92106a0bb584ff23f1167e644e00
[]
no_license
TwentySevenC/ThinkingInJava
8483a67de701452cccfc8f1904c4b3ef5a2e918d
015bcbda65982981d84b0b64190837126353ce90
refs/heads/master
2021-01-10T15:21:08.317295
2016-11-17T08:14:05
2016-11-17T08:14:05
45,603,075
1
0
null
null
null
null
UTF-8
Java
false
false
1,880
java
package concurrency.tasksCooperation; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; //: concurrency/NotifyVsNotifyAll.java class Blocker{ public synchronized void waitingCall(){ try{ while(!Thread.interrupted()){ wait(); System.out.print(Thread.currentThread() + " "); } }catch(InterruptedException e){ System.out.println("Exiting via InterruptedException" + Thread.currentThread()); } } public synchronized void prod(){ notify(); } public synchronized void prodAll(){ notifyAll(); } } class Task implements Runnable{ static Blocker bloocker = new Blocker(); @Override public void run() { bloocker.waitingCall(); } } class Task2 implements Runnable { static Blocker blocker = new Blocker(); @Override public void run() { blocker.waitingCall(); } } public class NotifyVsNotifyAll { public static void main(String[] args) throws InterruptedException { ExecutorService exe = Executors.newCachedThreadPool(); for(int i = 0; i < 5; i++){ exe.execute(new Task()); } exe.execute(new Task2()); Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { boolean prod = true; @Override public void run() { if(prod){ System.out.println("\n notify "); Task.bloocker.prod(); prod = false; }else{ System.out.println("\n notify all "); Task.bloocker.prodAll(); prod = true; } } }, 400, 400); TimeUnit.SECONDS.sleep(3); System.out.println("\n Timer Cancel.."); timer.cancel(); TimeUnit.MILLISECONDS.sleep(400); System.out.println("Task2 notify all."); Task2.blocker.prodAll(); TimeUnit.MILLISECONDS.sleep(400); System.out.println("\n Ending all tasks."); exe.shutdownNow(); } }
[ "xiaojianbox@163.com" ]
xiaojianbox@163.com
7a9bccd4496bf5475b35e62b8dda209f3a4ef3e9
61dee1acc77d1315a40870b483f004c417f455c1
/bookstore/src/cn/dave/bookstore/user/service/UserException.java
1b5ce637a4a66d1c588c539c5bb18f53e7d0d35d
[]
no_license
dave0824/JavaWeb
9c21ea419a476e859a129f50bb4aae5e178fef9b
ec9abde58045aa9e30ce64f28a8bfc331518b950
refs/heads/master
2020-07-13T22:33:04.843963
2019-08-29T13:30:20
2019-08-29T13:30:20
205,169,543
1
0
null
null
null
null
UTF-8
Java
false
false
445
java
package cn.dave.bookstore.user.service; public class UserException extends Exception { public UserException() { super(); } public UserException(String arg0, Throwable arg1, boolean arg2, boolean arg3) { super(arg0, arg1, arg2, arg3); } public UserException(String arg0, Throwable arg1) { super(arg0, arg1); } public UserException(String arg0) { super(arg0); } public UserException(Throwable arg0) { super(arg0); } }
[ "51199302+dave0824@users.noreply.github.com" ]
51199302+dave0824@users.noreply.github.com
6af71db0fb5aaa49f016e93a29df668ae0136d58
d0208b384a5d5e75e29393e261b8fef31a17a062
/src/org/usfirst/frc/team3946/robot/commands/AutonomousLeft.java
673c699bf5f9524c36c9d3bf06dcf007aee30d56
[]
no_license
brandojomo/RecycleRush
5e85920d8b73c09102a340d13ae429c792f9a435
2b6712fba062cd1f3f9df132d1376e9709110968
refs/heads/master
2021-01-21T18:15:42.334974
2015-12-08T00:56:07
2015-12-08T00:56:07
47,585,235
0
0
null
2015-12-07T23:14:46
2015-12-07T23:14:45
Java
UTF-8
Java
false
false
529
java
package org.usfirst.frc.team3946.robot.commands; import edu.wpi.first.wpilibj.command.CommandGroup; /** * */ public class AutonomousLeft extends CommandGroup { public AutonomousLeft() { // Pick up tote and drive to safe zone. addParallel(new AutonomousDrive(1.0, 0.5)); addSequential (new TimedLift(0.4)); addSequential(new AutonomousDrive(3.0, 0.5)); // Drop tote then back up slightly. addParallel(new TimedLift(-0.4)); addSequential(new AutonomousDrive(0.5, -0.6)); } }
[ "tclark79301@gmail.com" ]
tclark79301@gmail.com
42db98d9209606fd62a2c28b4c2c88892b042b86
c53feaa93bf0b1c31cd05c178d70c4fdb2f7cc2e
/src/design_pattern/observer_pattern/ObserverPatternTest.java
2c808f9a3b84153b0e1f3d0bf7a000a396b788ab
[]
no_license
lzhangwei/design-parttern
b01b76aaaec9725b8767e92dcb788365a8bc1474
85b05cf101e1869974473ebd0cb7a6662ec67725
refs/heads/master
2021-01-10T07:42:55.568260
2015-11-12T16:33:51
2015-11-12T16:33:51
46,065,879
0
0
null
null
null
null
UTF-8
Java
false
false
439
java
package design_pattern.observer_pattern; public class ObserverPatternTest { public static void main(String args[]) { Subject subject = new Subject(); new BinaryObserver(subject); new HexaObserver(subject); new OctalObserver(subject); System.out.println("十进制: 10"); subject.setState(10); System.out.println("......\n十进制: 15"); subject.setState(15); } }
[ "lzhangwei@outlook.com" ]
lzhangwei@outlook.com
d983b391c0dc6b816019cd50b1d5dbddadc8632f
b87ebd35a156e1392023629a6e8ec298b98aa726
/src/main/java/au/net/electronichealth/ns/cda/_2_0/ActClassDocumentSection.java
ed475f58292ad37f148a0e45066aa0148a7e26f2
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "BSD-2-Clause" ]
permissive
AuDigitalHealth/cda-schema-java
8112f4f9c5b372e184c96ddabb9e83a35713e0ae
cec3eb9bd9fbf8c759fa9c8b38ac5a1ed9e15d3b
refs/heads/master
2023-02-24T19:31:16.548025
2021-02-08T04:32:39
2021-02-08T04:32:39
335,827,871
0
1
null
null
null
null
UTF-8
Java
false
false
1,110
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2021.02.03 at 09:15:32 AM AEST // package au.net.electronichealth.ns.cda._2_0; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for ActClassDocumentSection. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="ActClassDocumentSection"> * &lt;restriction base="{urn:hl7-org:v3}cs"> * &lt;enumeration value="DOCSECT"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "ActClassDocumentSection") @XmlEnum public enum ActClassDocumentSection { DOCSECT; public String value() { return name(); } public static ActClassDocumentSection fromValue(String v) { return valueOf(v); } }
[ "peter.ball@digitalhealth.gov.au" ]
peter.ball@digitalhealth.gov.au
85d2680939ba05cd3cf88dfdd95076872fcdaa0f
507ef28e2efbe7b07f842485eea1619202baffb6
/WAA Lab5/src/managedbeans/calcManagedBean.java
6865e9fdf17947f870f2977557ba46519c379073
[]
no_license
rameshstha/WAA
7ce7c33fff75c48f8813224eb83d39c0fd916e37
eb3fc693ee0a527c03da60f7a8cfeb669c055c80
refs/heads/master
2022-12-25T07:37:05.829383
2017-01-08T01:10:44
2017-01-08T01:10:44
72,386,957
0
0
null
2022-12-16T07:12:37
2016-10-31T01:23:29
JavaScript
UTF-8
Java
false
false
1,068
java
/** * */ package managedbeans; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; /** * @author Ramesh Shrestha * */ @ManagedBean @RequestScoped public class calcManagedBean { private int firstNumber; private int secondNumber; private String result; public calcManagedBean() {} public int getFirstNumber() { return firstNumber; } public void setFirstNumber(int firstNumber) { this.firstNumber = firstNumber; } public int getSecondNumber() { return secondNumber; } public void setSecondNumber(int secondNumber) { this.secondNumber = secondNumber; } public String getResult() { return result; } public String add(){ result=Integer.toString(firstNumber+secondNumber); return ""; } public String subtract(){ result=Integer.toString(firstNumber-secondNumber); return ""; } public String multiply(){ result=Integer.toString(firstNumber*secondNumber); return ""; } public String divide(){ result=secondNumber == 0 ? "n/a" : Double.toString(firstNumber/secondNumber); return ""; } }
[ "ramesh.shresthag@gmail.com" ]
ramesh.shresthag@gmail.com
ec44b570a5ee60a66c3f9a46e6cd2d2f3f8cb965
190a11a77c2fee854ebd8a31544a7a84afdb19e5
/src/com/weibo/sdk/android/model/Trends.java
f4ee06070cab00c06fbb50ae04f3153ce9163412
[ "Apache-2.0" ]
permissive
alexcaisenchuan/FunWeibo
3447368a2a796fc82e6df48d77f4852fe37e2226
d3f06cb7a7ea164d9b2ca302d1fd00dac0c9df3d
refs/heads/master
2020-12-24T14:44:47.540250
2014-02-17T14:41:20
2014-02-17T14:41:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,519
java
/* Copyright (c) 2007-2009, Yusuke Yamamoto All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Yusuke Yamamoto nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY Yusuke Yamamoto ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Yusuke Yamamoto BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.weibo.sdk.android.model; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.Collections; import java.util.Arrays; import com.weibo.sdk.android.http.Response; import com.weibo.sdk.android.org.json.JSONArray; import com.weibo.sdk.android.org.json.JSONException; import com.weibo.sdk.android.org.json.JSONObject; /** * A data class representing Treands. * * @author Yusuke Yamamoto - yusuke at mac.com * @since Weibo4J 1.2.1 */ public class Trends extends WeiboResponse implements Comparable<Trends> { private Date asOf; private Date trendAt; private Trend[] trends; private static final long serialVersionUID = -7151479143843312309L; public int compareTo(Trends that) { return this.trendAt.compareTo(that.trendAt); } /*package*/ Trends(Response res, Date asOf, Date trendAt, Trend[] trends) throws WeiboException { super(res); this.asOf = asOf; this.trendAt = trendAt; this.trends = trends; } /*package*/ static List<Trends> constructTrendsList(Response res) throws WeiboException { JSONObject json = res.asJSONObject(); List<Trends> trends; try { Date asOf = parseDate(json.getString("as_of")); JSONObject trendsJson = json.getJSONObject("trends"); trends = new ArrayList<Trends>(trendsJson.length()); Iterator ite = trendsJson.keys(); while (ite.hasNext()) { String key = (String) ite.next(); JSONArray array = trendsJson.getJSONArray(key); Trend[] trendsArray = jsonArrayToTrendArray(array); if (key.length() == 19) { // current trends trends.add(new Trends(res, asOf, parseDate(key , "yyyy-MM-dd HH:mm:ss"), trendsArray)); } else if (key.length() == 16) { // daily trends trends.add(new Trends(res, asOf, parseDate(key , "yyyy-MM-dd HH:mm"), trendsArray)); } else if (key.length() == 10) { // weekly trends trends.add(new Trends(res, asOf, parseDate(key , "yyyy-MM-dd"), trendsArray)); } } Collections.sort(trends); return trends; } catch (JSONException jsone) { throw new WeiboException(jsone.getMessage() + ":" + res.asString(), jsone); } } /*package*/ static Trends constructTrends(Response res) throws WeiboException { JSONObject json = res.asJSONObject(); try { Date asOf = parseDate(json.getString("as_of")); JSONArray array = json.getJSONArray("trends"); Trend[] trendsArray = jsonArrayToTrendArray(array); return new Trends(res, asOf, asOf, trendsArray); } catch (JSONException jsone) { throw new WeiboException(jsone.getMessage() + ":" + res.asString(), jsone); } } private static Date parseDate(String asOfStr) throws WeiboException { Date parsed; if (asOfStr.length() == 10) { parsed = new Date(Long.parseLong(asOfStr) * 1000); } else { parsed = WeiboResponse.parseDate(asOfStr, "EEE, d MMM yyyy HH:mm:ss z"); } return parsed; } private static Trend[] jsonArrayToTrendArray(JSONArray array) throws JSONException { Trend[] trends = new Trend[array.length()]; for (int i = 0; i < array.length(); i++) { JSONObject trend = array.getJSONObject(i); trends[i] = new Trend(trend); } return trends; } public Trend[] getTrends() { return this.trends; } public Date getAsOf() { return asOf; } public Date getTrendAt() { return trendAt; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Trends)) return false; Trends trends1 = (Trends) o; if (asOf != null ? !asOf.equals(trends1.asOf) : trends1.asOf != null) return false; if (trendAt != null ? !trendAt.equals(trends1.trendAt) : trends1.trendAt != null) return false; if (!Arrays.equals(trends, trends1.trends)) return false; return true; } @Override public int hashCode() { int result = asOf != null ? asOf.hashCode() : 0; result = 31 * result + (trendAt != null ? trendAt.hashCode() : 0); result = 31 * result + (trends != null ? Arrays.hashCode(trends) : 0); return result; } @Override public String toString() { return "Trends{" + "asOf=" + asOf + ", trendAt=" + trendAt + ", trends=" + (trends == null ? null : Arrays.asList(trends)) + '}'; } }
[ "caisenchuan@163.com" ]
caisenchuan@163.com
551ddfe23adfe4fdb35539442b1e9b4834c18da2
a636fb3fd165f2e30ed01c09bfc802aef28e85ed
/src/Sample/SampleClass.java
800a1b60df97cd9db5cc9babc8a6c2f25de7a5b1
[]
no_license
Wilq33/Day
a5a448f35dbb5aed309125a3cd02e03840947c93
147917b650a11b947d313b29bd258645b4cc3786
refs/heads/master
2020-09-03T01:05:54.033388
2019-11-18T19:10:32
2019-11-18T19:10:32
219,347,115
0
0
null
null
null
null
UTF-8
Java
false
false
287
java
package Sample; import Rough.TestA; public class SampleClass extends TestA{ public static void main(String[] args) { SampleClass obj = new SampleClass(); System.out.println(obj.publicVariable); System.out.println(obj.protectedVariable); } }
[ "34482885+Wilq33@users.noreply.github.com" ]
34482885+Wilq33@users.noreply.github.com
e6e2537d05b811584362882427dad7594bc809fb
0dede05a653cb5de0329f7e2455ae02e2941a14a
/src/bean/request/SO_Req_GenOTPSaleOrderBean.java
08f6e947a56de218362cd43968cceef133c6fd24
[]
no_license
itnopadol/NPDriveThruWs
27da1f00b6ea64195c9e492a860c8451bb264bb1
1e9ecae7b5120284758ddbb67f1352cea2410298
refs/heads/master
2021-01-20T05:37:21.121355
2017-12-15T07:46:35
2017-12-15T07:46:35
101,458,790
0
1
null
null
null
null
TIS-620
Java
false
false
3,607
java
package bean.request; import java.util.List; public class SO_Req_GenOTPSaleOrderBean { private String access_token; private String doc_no; private int bill_type; private int tax_type; private int delivery_type; private String receiver_name; private String pickup_datetime; List<SO_Req_ListOwnerPhoneBean> owner_phone;//เบอร์โทร คนรับของ List<SO_Req_ListOwnerPhoneBean> receiver_phone;//เบอร์โทร คนรับของ //private String otp_password; private String plate_number; private String car_brand; List<SO_Req_ListItemToQueueBean> item; public SO_Req_GenOTPSaleOrderBean() { super(); // TODO Auto-generated constructor stub } public SO_Req_GenOTPSaleOrderBean(String access_token, String doc_no, int bill_type, int tax_type, int delivery_type, String receiver_name, String pickup_datetime, List<SO_Req_ListOwnerPhoneBean> owner_phone, List<SO_Req_ListOwnerPhoneBean> receiver_phone, String plate_number, String car_brand, List<SO_Req_ListItemToQueueBean> item) { super(); this.access_token = access_token; this.doc_no = doc_no; this.bill_type = bill_type; this.tax_type = tax_type; this.delivery_type = delivery_type; this.receiver_name = receiver_name; this.pickup_datetime = pickup_datetime; this.owner_phone = owner_phone; this.receiver_phone = receiver_phone; //this.otp_password = otp_password; this.plate_number = plate_number; this.car_brand = car_brand; this.item = item; } public String getAccess_token() { return access_token; } public void setAccess_token(String access_token) { this.access_token = access_token; } public String getDoc_no() { return doc_no; } public void setDoc_no(String doc_no) { this.doc_no = doc_no; } public int getBill_type() { return bill_type; } public void setBill_type(int bill_type) { this.bill_type = bill_type; } public int getTax_type() { return tax_type; } public void setTax_type(int tax_type) { this.tax_type = tax_type; } public int getDelivery_type() { return delivery_type; } public void setDelivery_type(int delivery_type) { this.delivery_type = delivery_type; } public String getReceiver_name() { return receiver_name; } public void setReceiver_name(String receiver_name) { this.receiver_name = receiver_name; } public String getPickup_datetime() { return pickup_datetime; } public void setPickup_datetime(String pickup_datetime) { this.pickup_datetime = pickup_datetime; } public List<SO_Req_ListOwnerPhoneBean> getOwner_phone() { return owner_phone; } public void setOwner_phone(List<SO_Req_ListOwnerPhoneBean> owner_phone) { this.owner_phone = owner_phone; } public List<SO_Req_ListOwnerPhoneBean> getReceiver_phone() { return receiver_phone; } public void setReceiver_phone(List<SO_Req_ListOwnerPhoneBean> receiver_phone) { this.receiver_phone = receiver_phone; } // public String getOtp_password() { // return otp_password; // } // // // public void setOtp_password(String otp_password) { // this.otp_password = otp_password; // } public String getPlate_number() { return plate_number; } public void setPlate_number(String plate_number) { this.plate_number = plate_number; } public String getCar_brand() { return car_brand; } public void setCar_brand(String car_brand) { this.car_brand = car_brand; } public List<SO_Req_ListItemToQueueBean> getItem() { return item; } public void setItem(List<SO_Req_ListItemToQueueBean> item) { this.item = item; } }
[ "somrod@nopadol.com" ]
somrod@nopadol.com
6b012fb0eaa060ec36c26204e28626c54d098e19
02ecfb34f1067b45377e6c7e9c9bd34ef2578726
/newsday011/src/main/java/com/zhuoxin/adapter/ChannelUserAdapter.java
aee1506badf783a40576e50535ddaf0934211ebc
[]
no_license
zhaolongchao/AndroidStudioWorkspace
24e61dcfb429e7a0d6075ffe07a7aec9e7ca2087
1ead5f8e29cec4c5d1e5b66ede14c46dd86b8607
refs/heads/master
2020-12-24T13:21:32.583149
2016-12-15T03:27:53
2016-12-15T03:27:53
76,517,731
1
0
null
null
null
null
UTF-8
Java
false
false
2,106
java
package com.zhuoxin.adapter; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.zhuoxin.baseAdapter.BaseAdapter1; import com.zhuoxin.entity.ChannelItem; import com.zhuoxin.newsday01.R; import java.util.List; /** * Created by l on 2016/11/17. */ public class ChannelUserAdapter extends BaseAdapter1<ChannelItem> { //点击的位置 private int position=-1; //最后一个元素是否可见 private boolean isVisibile=true; public ChannelUserAdapter(List<ChannelItem> baseData, Context context) { super(baseData, context); } @Override public View getView(int i, View view, ViewGroup viewGroup) { view=inflater.inflate(R.layout.inflate_news_channel_item,null); TextView tv= (TextView) view.findViewById(R.id.tv_channel_item); //设置频道名字 tv.setText(getItem(i).getChannelName()); if(i==0 || i==1){ tv.setEnabled(false); } //设置选中的tv内容不可见 if(i==position){ tv.setText(""); //设置控件背景效果 tv.setSelected(true); tv.setEnabled(false); position=-1; } //设置新追加的元素不可见 if(!isVisibile && i==baseData.size()-1){ tv.setText(""); tv.setSelected(true); tv.setEnabled(false); } return view; } //保存当前点击的位置 public void saveClickPosition(int i) { position=i; //重新适配 notifyDataSetChanged(); } //设置最后一个元素内容不可见 public void setTextVisibile1(boolean b) { isVisibile=b; //重新适配 notifyDataSetChanged(); } //封装交换item的位置 public void exchange(int startPosition,int dropPosition){ ChannelItem channelItem=baseData.get(startPosition); baseData.remove(startPosition); baseData.add(dropPosition,channelItem); notifyDataSetChanged(); } }
[ "285652988@qq.com" ]
285652988@qq.com
f35c943ade0a27e105750f419084feda0c4549a2
b187d3dae47ee41a46f135b5737e5b2ed020579c
/Android/DesafioAndroidNovo/app/src/main/java/com/example/desafioandroidnovo/activity/SplashActivity.java
721a265b817c6d7e2180412227d629579c848ccc
[]
no_license
Andrearibas/DHMobileAndroid03
d52675845a2b69257c552d0bcd0177b8d815187b
a0638237640faf5153faeb367b2191aafceffd69
refs/heads/master
2020-07-04T08:49:18.548095
2019-11-18T23:58:57
2019-11-18T23:58:57
202,228,204
0
0
null
null
null
null
UTF-8
Java
false
false
865
java
package com.example.desafioandroidnovo.activity; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import com.example.desafioandroidnovo.R; import com.example.desafioandroidnovo.activity.LoginActivity; import java.util.Timer; import java.util.TimerTask; public class SplashActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); new Timer().schedule(new TimerTask(){ @Override public void run() { irParaTelaLoginActivity(); } }, 2000); } private void irParaTelaLoginActivity () { Intent intent = new Intent(this, LoginActivity.class); startActivity(intent); } }
[ "Andrearibas" ]
Andrearibas
d0d6416b64da1c3f4dbc67f702aa15c1991d6ca8
e66dfd2f3250e0e271dcdac4883227873e914429
/zml-web/src/main/java/com/zml/commodity/service/CfCommodityServiceI.java
593281420ea6d7603e108f748542d935dae5d833
[]
no_license
tianshency/zhuminle
d13b45a8a528f0da2142aab0fd999775fe476e0c
c864d0ab074dadf447504f54a82b2fc5b149b97e
refs/heads/master
2020-03-18T00:54:16.153820
2018-05-20T05:20:08
2018-05-20T05:20:08
134,118,245
0
1
null
null
null
null
UTF-8
Java
false
false
1,125
java
package com.zml.commodity.service; import com.zml.commodity.entity.CfCommodityEntity; import com.zml.commodity.entity.CfCommodityImgEntity; import java.util.List; import org.jeecgframework.core.common.service.CommonService; import java.io.Serializable; public interface CfCommodityServiceI extends CommonService{ public <T> void delete(T entity); /** * 添加一对多 * */ public void addMain(CfCommodityEntity cfCommodity, List<CfCommodityImgEntity> cfCommodityImgList) ; /** * 修改一对多 * */ public void updateMain(CfCommodityEntity cfCommodity, List<CfCommodityImgEntity> cfCommodityImgList); public void delMain (CfCommodityEntity cfCommodity); /** * 默认按钮-sql增强-新增操作 * @param id * @return */ public boolean doAddSql(CfCommodityEntity t); /** * 默认按钮-sql增强-更新操作 * @param id * @return */ public boolean doUpdateSql(CfCommodityEntity t); /** * 默认按钮-sql增强-删除操作 * @param id * @return */ public boolean doDelSql(CfCommodityEntity t); }
[ "tianshencaoyin@163.com" ]
tianshencaoyin@163.com
4a65d5140b0fb15b33b367455e5d7a469d7cbb05
92e7a62c54bcf24de97b5d4c1bb15b99f775bed2
/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/action/NouveauExerciceAction.java
1e52a4ac082acc80af399ef1dcb17a48e5378b8d
[]
no_license
trespe/openconcerto
4a9c294006187987f64dbf936f167d666e6c5d52
6ccd5a7b56cd75350877842998c94434083fb62f
refs/heads/master
2021-01-13T02:06:29.609413
2015-04-10T08:35:31
2015-04-10T08:35:31
33,717,537
3
0
null
null
null
null
UTF-8
Java
false
false
1,253
java
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. * * The contents of this file are subject to the terms of the GNU General Public License Version 3 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific * language governing permissions and limitations under the License. * * When distributing the software, include this License Header Notice in each file. */ package org.openconcerto.erp.core.finance.accounting.action; import org.openconcerto.erp.action.CreateFrameAbstractAction; import org.openconcerto.sql.Configuration; import org.openconcerto.sql.view.EditFrame; import javax.swing.Action; import javax.swing.JFrame; public class NouveauExerciceAction extends CreateFrameAbstractAction { public NouveauExerciceAction() { super(); this.putValue(Action.NAME, "Test Exercice"); } @Override public JFrame createFrame() { return new EditFrame(Configuration.getInstance().getDirectory().getElement("EXERCICE_COMMON")); } }
[ "guillaume.maillard@gmail.com@658cf4a1-8b1b-4573-6053-fb3ec553790b" ]
guillaume.maillard@gmail.com@658cf4a1-8b1b-4573-6053-fb3ec553790b
56f38f02190fe53d79942400c9d10dfeec6d8d93
95f7ba7516bed9a6a787a40400c4a4a3fe95ff64
/app/src/main/java/com/example/sfarmani/ucsctutor/TutorSignUp.java
3ca6e6c338034c17a76c9bda7b99b8ad81e1e327
[]
no_license
sfarmani/ucsctutorapp
7936f55d03b467a860d13875a7cb80a028c8ee3a
af4caf9ac515bb4f1470e2ab5a13e9361eced079
refs/heads/master
2021-01-10T04:17:25.254911
2015-12-04T05:03:10
2015-12-04T05:03:10
44,211,587
0
1
null
2015-10-16T17:40:14
2015-10-13T23:31:09
Java
UTF-8
Java
false
false
7,693
java
package com.example.sfarmani.ucsctutor; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.graphics.Rect; import android.os.Bundle; import android.os.Handler; import android.view.MotionEvent; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.Toast; import com.dd.processbutton.iml.ActionProcessButton; import com.example.sfarmani.ucsctutor.utils.ProgressGenerator; /** * Created by Shayan Farmani on 10/15/2015. */ public class TutorSignUp extends Activity implements ProgressGenerator.OnCompleteListener{ public static final String EXTRAS_ENDLESS_MODE = "EXTRAS_ENDLESS_MODE"; public static Activity tutorSignUp; String passwordtxt; String passwordtxtconfirm; String fNameTxt; String lNameTxt; String emailTxt; String usernametxt; EditText username; EditText password; EditText passwordconfirm; EditText email; EditText fName; EditText lName; @Override public void onComplete() { } @Override public boolean dispatchTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { View v = getCurrentFocus(); if (v instanceof EditText) { Rect outRect = new Rect(); v.getGlobalVisibleRect(outRect); if (!outRect.contains((int) event.getRawX(), (int) event.getRawY())) { v.clearFocus(); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(v.getWindowToken(), 0); } } } return super.dispatchTouchEvent(event); } // maniupulate how the data is sent into parse for tutor. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tutorsignup); // get the edit text fields for each requirement password = (EditText) findViewById(R.id.passwordtextfield); passwordconfirm = (EditText) findViewById(R.id.passwordconfirmfield); username = (EditText) findViewById(R.id.usernamefield); email = (EditText) findViewById(R.id.emailfield); fName = (EditText) findViewById(R.id.fnamefield); lName = (EditText) findViewById(R.id.lnamefield); // make a progress generator for the animation of the submit button. final ActionProcessButton next = (ActionProcessButton) findViewById(R.id.nexttutor); // not sure what this is for, but its here and it apprently does something. Bundle extras = getIntent().getExtras(); if (extras != null && extras.getBoolean(EXTRAS_ENDLESS_MODE)) { next.setMode(ActionProcessButton.Mode.ENDLESS); } else { next.setMode(ActionProcessButton.Mode.PROGRESS); } // when the submit button is pressed do the following... next.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // get the string that was inputted by the user passwordtxt = password.getText().toString(); passwordtxtconfirm = passwordconfirm.getText().toString(); usernametxt = username.getText().toString(); emailTxt = email.getText().toString(); fNameTxt = fName.getText().toString(); lNameTxt = lName.getText().toString(); // if any of the fields are left empty then show them a Toast saying they need to finish if (usernametxt.equals("") || passwordtxt.equals("") || passwordtxtconfirm.equals("") || emailTxt.equals("") || fNameTxt.equals("") || lNameTxt.equals("")) { next.setProgress(-1); Toast.makeText(getApplicationContext(), "Please complete the sign up form", Toast.LENGTH_LONG).show(); Handler errorhandler = new Handler(); errorhandler.postDelayed(new Runnable() { @Override public void run() { next.setProgress(0); } }, 3000); } else if (!usernametxt.matches("[a-zA-Z]+")) { next.setProgress(-1); username.setText(""); Toast.makeText(getApplicationContext(), "Username cannot include any non-word character\n(letter, number, underscore)", Toast.LENGTH_LONG).show(); Handler errorhandler = new Handler(); errorhandler.postDelayed(new Runnable() { @Override public void run() { next.setProgress(0); } }, 3000); } else if (!emailTxt.matches("[a-zA-Z]+@ucsc.edu")) { next.setProgress(-1); email.setText(""); Toast.makeText(getApplicationContext(), "Please sign up with your UCSC email", Toast.LENGTH_LONG).show(); Handler errorhandler = new Handler(); errorhandler.postDelayed(new Runnable() { @Override public void run() { next.setProgress(0); } }, 3000); } else if(!passwordtxtconfirm.equals(passwordtxt)){ next.setProgress(-1); password.setText(""); passwordconfirm.setText(""); Toast.makeText(getApplicationContext(), "Passwords do not match", Toast.LENGTH_LONG).show(); Handler errorhandler = new Handler(); errorhandler.postDelayed(new Runnable() { @Override public void run() { next.setProgress(0); } }, 3000); } else if (passwordtxt.length() < 4) { next.setProgress(-1); password.setText(""); passwordconfirm.setText(""); Toast.makeText(getApplicationContext(), "Password has to be 4 or more characters.", Toast.LENGTH_LONG).show(); Handler errorhandler = new Handler(); errorhandler.postDelayed(new Runnable() { @Override public void run() { next.setProgress(0); } }, 3000); } else{ next.setEnabled(false); password.setEnabled(false); passwordconfirm.setEnabled(false); email.setEnabled(false); fName.setEnabled(false); lName.setEnabled(false); Intent intent = new Intent(TutorSignUp.this, TutorSignUpCont.class); intent.putExtra("fNameTxt", fNameTxt); intent.putExtra("lNameTxt", lNameTxt); intent.putExtra("usernametxt", usernametxt); intent.putExtra("passwordtxt", passwordtxt); intent.putExtra("emailTxt", emailTxt); startActivity(intent); finish(); } } }); } }
[ "sfarmani@ucsc.edu" ]
sfarmani@ucsc.edu
d27f2c0d7405f04890bad8e4dc49f5a59df2002a
3279cf76f1cfdace10813d4382950fedbab7606d
/src/qapps/gdrive/gui/Test.java
1d6b70a88479ff1a4b662471cc63911f143997ab
[]
no_license
jakubdykowski/gdrive
6f73553a9e68c0e343559a89740666c3156f6088
1829df675abe22b1b702ec4e3b05e0438674740d
refs/heads/master
2021-01-12T21:54:04.523063
2017-02-12T19:58:24
2017-02-12T19:58:24
81,751,155
0
0
null
null
null
null
UTF-8
Java
false
false
329
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package qapps.gdrive.gui; import java.io.File; /** * * @author root */ public class Test { public static void main(String[] args) { // System.out.println(Test.class.getResource("p.properties").getFile()); } }
[ "jakub.dykowski@gmail.com" ]
jakub.dykowski@gmail.com
e692edacb434cd5c4e3f505595a158561a52bb77
1affc03e0e8e060fa67ec1a9c04c3829660bce76
/app/src/main/java/com/hbbsolution/mproduction/data/response/BaseObjectResponse.java
d81a4b41ba6600b25e36986c46b58917ec810c97
[]
no_license
thanhduy26091995/RxJavaRetrofit
a26934351583f38913146ce52edfae50cadc3528
37b64b04429180863a23f8bb74e73f2def7dec25
refs/heads/master
2021-09-17T07:47:56.133133
2018-06-29T07:35:31
2018-06-29T07:35:31
111,080,849
0
0
null
null
null
null
UTF-8
Java
false
false
787
java
package com.hbbsolution.mproduction.data.response; import com.google.gson.annotations.SerializedName; /** * Created by buivu on 17/11/2017. */ public class BaseObjectResponse<T> { @SerializedName("success") private boolean success; @SerializedName("data") private T data; @SerializedName("errorCode") private String errorCode; public boolean isSuccess() { return success; } public void setSuccess(boolean success) { this.success = success; } public T getData() { return data; } public void setData(T data) { this.data = data; } public String getErrorCode() { return errorCode; } public void setErrorCode(String errorCode) { this.errorCode = errorCode; } }
[ "buivuthanhduy@gmail.com" ]
buivuthanhduy@gmail.com
b700b819366392fd7f8d5326cc4ee84917e15335
e1e89c8c5574deead87b02c938e48b6b565c81a4
/src/QuanLiBatDongSan/ModuleChucNang/GiaoDichDanhSach.java
3891ee5a8e3a5d8efed8720c5a3da064fbd874b0
[]
no_license
trongthanht3/QuanLiBatDongSan
6707d5e52b15a01a4d4d4edb1418807065845eb4
4977280372ec1d9e559f1448e057a682037d129a
refs/heads/master
2020-08-03T22:45:52.819227
2019-10-06T22:59:51
2019-10-06T22:59:51
211,908,864
0
0
null
null
null
null
UTF-8
Java
false
false
152
java
package QuanLiBatDongSan.ModuleChucNang; public class GiaoDichDanhSach { public void CallDanhSach() { System.out.print("Danh sach con cac"); } }
[ "trongthanht3@gmail.com" ]
trongthanht3@gmail.com
7b39c8345506c8ad193cbb6297eeaa6cd085911b
d469d57785a297b1023052e020d5d14aeeffa680
/Vjezba 6/MqttSubscriber/src/main/java/com/example/MqttSubscriber/AppConfig.java
2793caee16f5806a14e2c028c4cf5e0e4b2b908b
[]
no_license
LukaRogulj/java_vjezbe
c57fa0200e64d8939aaf6eb08d263f056871ccb4
c7208e988beae2e5735b9b3dc97398d37f0549b5
refs/heads/main
2023-04-09T07:00:20.478191
2021-04-14T19:30:03
2021-04-14T19:30:03
358,018,960
0
0
null
null
null
null
UTF-8
Java
false
false
1,102
java
package com.example.MqttSubscriber; import com.example.MqttSubscriber.user.web.MQTTHandler; import com.example.MqttSubscriber.user.service.MQTTSubscriber; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.socket.WebSocketHandler; import org.springframework.web.socket.config.annotation.EnableWebSocket; import org.springframework.web.socket.config.annotation.WebSocketConfigurer; import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; @Configuration @EnableWebSocket @EnableAutoConfiguration public class AppConfig implements WebSocketConfigurer { @Bean public MQTTSubscriber subscriber() { return new MQTTSubscriber(); } @Override public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { registry.addHandler(handler(), "/accelerometer").withSockJS(); } @Bean public WebSocketHandler handler() { return new MQTTHandler(); } }
[ "luka.rogulj92@gmail.com" ]
luka.rogulj92@gmail.com
3200e07d4aa09075b5f6111410af8100890905b5
33e32a2816f869f099b81adc1e9a6ddb804a6249
/privilegeservice/src/main/java/cn/edu/xmu/privilege/controller/AdminUserController.java
8d42c71350a03e626c10aeabe3fdaa554bb59335
[]
no_license
FeiyanLiu/Privilege
ec7590256690a2bc64a8e8a2828baa039db8ecad
827a1a02c23c3f1486aa862130a1c25872225fab
refs/heads/master
2023-01-05T07:32:52.922578
2020-11-04T16:08:03
2020-11-04T16:08:03
310,303,054
0
0
null
null
null
null
UTF-8
Java
false
false
5,308
java
package cn.edu.xmu.privilege.controller; import cn.edu.xmu.ooad.util.ResponseCode; import cn.edu.xmu.ooad.util.ResponseUtil; import cn.edu.xmu.ooad.util.ReturnObject; import cn.edu.xmu.privilege.model.vo.UserEditVo; import cn.edu.xmu.privilege.service.UserService; import io.swagger.annotations.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; /** * AdminUser 控制器 * @author Han Li **/ @Api(value = "权限服务", tags = "privilege") @RestController /*Restful的Controller对象*/ @RequestMapping(value = "/", produces = "application/json;charset=UTF-8") public class AdminUserController { private static final Logger logger = LoggerFactory.getLogger(PrivilegeController.class); @Autowired private UserService userService; /** * auth009: 修改任意用户信息 * @param id: 用户 id * @return Object */ @ApiOperation(value = "修改任意用户信息") @ApiImplicitParams({ @ApiImplicitParam(name="authorization", value="Token", required = true, dataType="String", paramType="header"), @ApiImplicitParam(name="id", required = true, dataType="Integer", paramType="path") }) @ApiResponses({ @ApiResponse(code = 732, message = "邮箱已被注册"), @ApiResponse(code = 733, message = "电话已被注册"), @ApiResponse(code = 0, message = "成功"), }) @PutMapping("adminusers/{id}") public Object modifyUserInfo(@PathVariable Long id, @RequestBody UserEditVo vo) { logger.debug("modifyUserInfo: id = "+ id +" vo" + vo); ReturnObject returnObject = userService.modifyUserInfo(id, vo); if (returnObject.getCode() == ResponseCode.RESOURCE_ID_NOTEXIST) { return new ResponseEntity( ResponseUtil.fail(returnObject.getCode(), returnObject.getErrmsg()), HttpStatus.NOT_FOUND); } return ResponseUtil.fail(returnObject.getCode(), returnObject.getErrmsg()); } /** * auth009: 删除任意用户 * @param id: 用户 id * @return Object */ @ApiOperation(value = "删除任意用户") @ApiImplicitParams({ @ApiImplicitParam(name="authorization", value="Token", required = true, dataType="String", paramType="header"), @ApiImplicitParam(name="id", required = true, dataType="Integer", paramType="path") }) @ApiResponses({ @ApiResponse(code = 0, message = "成功"), }) @DeleteMapping("adminusers/{id}") public Object deleteUser(@PathVariable Long id) { logger.debug("deleteUser: id = "+ id); ReturnObject returnObject = userService.deleteUser(id); if (returnObject.getCode() == ResponseCode.RESOURCE_ID_NOTEXIST) { return new ResponseEntity( ResponseUtil.fail(returnObject.getCode(), returnObject.getErrmsg()), HttpStatus.NOT_FOUND); } return ResponseUtil.fail(returnObject.getCode(), returnObject.getErrmsg()); } /** * auth009: 禁止用户登录 * @param id: 用户 id * @return Object */ @ApiOperation(value = "禁止用户登录") @ApiImplicitParams({ @ApiImplicitParam(name="authorization", value="Token", required = true, dataType="String", paramType="header"), @ApiImplicitParam(name="id", required = true, dataType="Integer", paramType="path") }) @ApiResponses({ @ApiResponse(code = 0, message = "成功"), }) @PutMapping("adminusers/{id}/forbid") public Object forbidUser(@PathVariable Long id) { logger.debug("forbidUser: id = "+ id); ReturnObject returnObject = userService.forbidUser(id); if (returnObject.getCode() == ResponseCode.RESOURCE_ID_NOTEXIST) { return new ResponseEntity( ResponseUtil.fail(returnObject.getCode(), returnObject.getErrmsg()), HttpStatus.NOT_FOUND); } return ResponseUtil.fail(returnObject.getCode(), returnObject.getErrmsg()); } /** * auth009: 恢复用户 * @param id: 用户 id * @return Object */ @ApiOperation(value = "恢复用户") @ApiImplicitParams({ @ApiImplicitParam(name="authorization", value="Token", required = true, dataType="String", paramType="header"), @ApiImplicitParam(name="id", required = true, dataType="Integer", paramType="path") }) @ApiResponses({ @ApiResponse(code = 0, message = "成功"), }) @PutMapping("adminusers/{id}/release") public Object releaseUser(@PathVariable Long id) { logger.debug("releaseUser: id = "+ id); ReturnObject returnObject = userService.releaseUser(id); if (returnObject.getCode() == ResponseCode.RESOURCE_ID_NOTEXIST) { return new ResponseEntity( ResponseUtil.fail(returnObject.getCode(), returnObject.getErrmsg()), HttpStatus.NOT_FOUND); } return ResponseUtil.fail(returnObject.getCode(), returnObject.getErrmsg()); } }
[ "han@han-li.cn" ]
han@han-li.cn
59e29787e7aa55c7c27ab3cc598535e6c34e32b6
5170a6803ac9740bec3cd7c7bfaa23b9f7f975b2
/app.webview/src/main/java/com/hl/appwebview/base/BaseFragment.java
25ad0b651f95acb71d7289d56af2a47443daeb15
[ "Apache-2.0" ]
permissive
miguoer/ApplicationCollention
85f8e60e3567152d9a0133a3a39c81eb67e7a817
882a5cf77f038036085fdde80c82196b86ce47d7
refs/heads/master
2021-01-22T09:17:18.527110
2017-05-09T15:06:35
2017-05-09T15:06:35
81,948,818
3
0
null
null
null
null
UTF-8
Java
false
false
2,298
java
package com.hl.appwebview.base; import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.squareup.leakcanary.RefWatcher; import butterknife.ButterKnife; /** * Created by huanglin on 2017/2/19. * 邮箱:1871767675@qq.com */ public abstract class BaseFragment<P extends BasePresenterImpl> extends Fragment implements IBaseView{ protected View rootView; protected BaseActivity activity; protected P presenter; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (bindLayout() != 0) { rootView = inflater.inflate(bindLayout(),container, false); return rootView; }else { return super.onCreateView(inflater, container, savedInstanceState); } } @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ButterKnife.bind(this, view); initView(view); } @Override public void onAttach(Context context) { super.onAttach(context); if (context instanceof BaseActivity) { BaseActivity activity = (BaseActivity) context; this.activity = activity; } } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public void onDetach() { activity = null; super.onDetach(); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); presenter = bindPresenter(); initData(); } @Override public void onDestroy() { super.onDestroy(); } protected abstract void initView(View view); protected abstract void initData(); protected abstract int bindLayout(); protected abstract P bindPresenter(); @Override public void showToast() { } @Override public void showWaitingDialog() { } @Override public void hideWaitingDialog() { } }
[ "18123600915@163.com" ]
18123600915@163.com
22728eec46eda4251f17fa1bdbadb8236241b761
123f28050b5a8089dbc3a4ba220bb4e47c1c066d
/sql/hazdb/common/src/main/java/com/hazelcast/samples/sql/hazdb/CdcPipeline.java
735b68f216eef08f3a5d0e99102ba6541d0f6f7b
[]
no_license
hazelcast/hazelcast-code-samples
bd9f006e6d7a93ae216099d1e6f8f367b36a4c36
e764287590f46f666836b0be1e115d9c17caf000
refs/heads/master
2023-08-31T21:55:30.338482
2023-08-14T05:55:38
2023-08-14T05:55:38
11,708,465
565
695
null
2023-08-14T05:55:40
2013-07-27T17:31:05
Java
UTF-8
Java
false
false
2,877
java
/* * Copyright (c) 2008-2022, Hazelcast, Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.hazelcast.samples.sql.hazdb; import java.util.Objects; import com.hazelcast.function.PredicateEx; import com.hazelcast.jet.Observable; import com.hazelcast.jet.datamodel.Tuple3; import com.hazelcast.jet.pipeline.JournalInitialPosition; import com.hazelcast.jet.pipeline.Pipeline; import com.hazelcast.jet.pipeline.Sinks; import com.hazelcast.jet.pipeline.Sources; import com.hazelcast.jet.pipeline.StreamStage; import com.hazelcast.map.EventJournalMapEvent; /** * <p> * Apply a projection/selection to the journal of events on the selected map. * Projection reformats. Selection is a no-op. * </p> */ public class CdcPipeline { /** * <p> * Process changes to the nominated map. New value may be null if delete. Old * value (not used) may be null if create. Both present for create. * </p> * * @param mapName * @param observable Null allowed, if no clientside logging needed * @return */ @SuppressWarnings("rawtypes") public static Pipeline build(String mapName, Observable<Tuple3<String, String, String>> observable) { Pipeline pipeline = Pipeline.create(); StreamStage<Tuple3<String, String, String>> events = pipeline.readFrom(Sources.mapJournal(mapName, JournalInitialPosition.START_FROM_CURRENT, (EventJournalMapEvent eventJournalMapEvent) -> { // Filter out no-ops String before = Objects.toString(eventJournalMapEvent.getOldValue()); String after = Objects.toString(eventJournalMapEvent.getNewValue()); if (before.equals(after)) { return null; } return Tuple3.tuple3(mapName, eventJournalMapEvent.getType().toString(), Utils.makeText(eventJournalMapEvent.getKey()) + "," + Utils.makeText(eventJournalMapEvent.getNewValue())); }, PredicateEx.alwaysTrue())).withoutTimestamps(); // Log serverside events.writeTo(Sinks.logger()); // Log clientside if (observable != null) { events.writeTo(Sinks.observable(observable)); } return pipeline; } }
[ "noreply@github.com" ]
hazelcast.noreply@github.com
c1ddeba435379ba0b34a7c09596c70244e99402a
57c5d7b75aa2e1ef77aa061921a33aaae4d524d0
/src/com/izmyr/test/Test.java
f71ef6bc215251598e985d01f8fc08a812258663
[]
no_license
sourcewarehouse/tureng
e325d1c1f17ebf2e4e7c17b4864f8db97531dfeb
41caa268365d89ad7ad469f81479b020520d88ae
refs/heads/master
2021-01-24T22:02:41.790004
2015-09-06T20:17:03
2015-09-06T20:17:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
320
java
package com.izmyr.test; import com.izmyr.tureng.Results; import com.izmyr.tureng.Tureng; public class Test { public static void main(String[] args) { Tureng tureng = new Tureng(); Results results = tureng.translate("pay"); // input can be in Turkish or English results.print(); } }
[ "ugurcany@outlook.com" ]
ugurcany@outlook.com
b281f1035ed8c64807cd9d1ca6f51e4ae3234d03
96ddcbfcebe7fb88bb7964beae9d364086fe05f6
/src/com/lanqiao/videoVIP/mapper/YhbProvider.java
a16ae8230eeb7731721f57cd58d699eb71031976
[]
no_license
0Zsad/videoVIP
7309bef891a2b69f08d8fb59995fbf74fa2c801e
4817839a46efd974d853bcc4a4799b1df56a0667
refs/heads/master
2023-07-14T14:06:12.100105
2021-08-22T16:15:11
2021-08-22T16:15:11
398,765,442
0
0
null
null
null
null
UTF-8
Java
false
false
2,152
java
package com.lanqiao.videoVIP.mapper; import com.lanqiao.videoVIP.entity.Yhb; import com.lanqiao.videoVIP.util.StrUtil; public class YhbProvider { /** 动态查询 得空需要修改 */ public String getListSql(Yhb user) { StringBuffer sql = new StringBuffer("select yhzh,pwd,yhnc,yhtx,yhzt from yhb where 1=1 "); /*if(null != user) { if(StrUtil.isNotEmpty(user.getYhzh())) { sql.append(" and yhm like concat('%',#{yhm},'%') "); } if(user.getYhsf() != null) { sql.append(" and yhsf = #{yhsf} "); } if(StrUtil.isNotEmpty(user.getZcsj())) { sql.append(" and zcsj like concat('%',#{zcsj},'%') "); } if(StrUtil.isNotEmpty(user.getSjh())) { sql.append(" and sjh like concat('%',#{sjh},'%') "); } if(StrUtil.isNotEmpty(user.getSex())) { sql.append(" and sex = #{sex} "); } if(StrUtil.isNotEmpty(user.getEmail())) { sql.append(" and email like concat('%',#{email},'%') "); } }*/ return sql.toString(); } /** 动态更改 */ public String getUpdateSql(Yhb user){ StringBuffer sql = new StringBuffer("update yhb set where yhzh = #{yhzh}"); if(null != user) { //密码为空时 if(StrUtil.isNotEmpty(user.getYhnc()) && StrUtil.isNotEmpty(user.getYhzt())) { sql.insert(15, "yhnc = #{yhnc},yhzt = #{yhzt}"); } //修改用户信息 if(StrUtil.isNotEmpty(user.getYhnc()) && StrUtil.isNotEmpty(user.getPwd())) { sql.insert(15, "pwd = #{pwd},yhnc = #{yhnc}"); } } return sql.toString(); } /** 模糊查询 */ public String mhselectSql(Yhb yhb) { StringBuffer sql = new StringBuffer("select yhzh,yhzt,yhnc from yhb where 1=1 "); if(null != yhb) { if(StrUtil.isNotEmpty(yhb.getYhzh())) { sql.append(" and yhzh like concat('%',#{yhzh},'%') "); } if(StrUtil.isNotEmpty(yhb.getYhzt())) { sql.append(" and yhzt like #{yhzt} "); } if(StrUtil.isNotEmpty(yhb.getYhnc())) { sql.append(" and yhnc like concat('%',#{yhnc},'%') "); } } return sql.toString(); } }
[ "linghuanjie138@163.com" ]
linghuanjie138@163.com
d38ff8c1b42b5b16f273ce2bc03654d7fe54256c
868400cf813b38c15553814fc53fcaf77102df0b
/HomeDepot/src/test/java/automationFramework/HomeService.java
79937f486e0e413bbb80e2354acc5df4e0b7fc04
[]
no_license
qateksolutions/charlotte
15a34205a457315b9b9903cf43d3999e8b4dea34
78340e31468c9f5f7edd9f8b11ef29743f110de0
refs/heads/master
2021-12-26T10:07:42.333012
2021-12-22T12:59:42
2021-12-22T12:59:42
90,475,377
0
0
null
2018-09-10T01:34:21
2017-05-06T16:15:57
HTML
UTF-8
Java
false
false
299
java
package automationFramework; import org.testng.annotations.Test; import org.testng.annotations.BeforeTest; import org.testng.annotations.AfterTest; public class HomeService { @BeforeTest public void beforeTest() { } @Test public void f() { } @AfterTest public void afterTest() { } }
[ "alam08215@hotmail.com" ]
alam08215@hotmail.com
48c3795ff89e59764c196bc3cd50495697927b18
65c45c7b303d0159d3838717075bdc1be729868a
/parkinglotproject/src/testing/CarDetails.java
2f8d97f6189e9fc3d17346a1834add1b71783284
[]
no_license
punyaharitha/ParkingLotProject
69c6fed59061350830caa902c56b3e5f02b1e22c
07679bf81761e70a282fa20e1381829f2e14c484
refs/heads/master
2020-06-21T02:20:50.706395
2019-07-22T06:41:11
2019-07-22T06:41:11
197,321,774
0
0
null
null
null
null
UTF-8
Java
false
false
1,096
java
package testing; public class CarDetails { String regNo; Colour colour; String slotNo; public enum Colour{ BLUE,BLACK,RED,WHITE,GREEN } public CarDetails() { super(); } public CarDetails(String regNo,String colour,String slotNo){ setColour(colour); setRegNo(regNo); setSlotNo(slotNo); } public void setRegNo(String regNo) { this.regNo = regNo; } public String getRegNo() { return regNo; } public void setColour(String colour) { try{ this.colour = Colour.valueOf(colour.toUpperCase()); }catch (IllegalArgumentException ex){ System.out.println("Please enter valid Colour"); for(Colour c:Colour.values() ){ System.out.println(c); } } } public Colour getColour() { return colour; } public void setSlotNo(String slotNo) { this.slotNo = slotNo; } public String getSlotNo() { return slotNo; } }
[ "Punya Haritha@LAPTOP-Q7M8UTUR" ]
Punya Haritha@LAPTOP-Q7M8UTUR
98c3b39f4a790eec11891aa39de19c57064a7faf
af9eb566fa45387f1959985131487effa56b5326
/Tri 2/COMP 103/Assignment 3/Emergency room/src/EmergencyRoom.java
cc4e69152b468371f8907bed021b6f951a3405ba
[]
no_license
Niels-Clayton/Uni-Notes-First-Year
b54032220ca3663218f07365b2bd6e478e5dc1fe
9e839fc6ca8c420cea04d21223f7f80a68d604dd
refs/heads/master
2023-03-16T17:41:56.525342
2019-07-27T04:47:10
2019-07-27T04:47:10
199,116,166
0
0
null
null
null
null
UTF-8
Java
false
false
9,353
java
// This program is copyright VUW. // You are granted permission to use it to construct your answer to a COMP103 assignment. // You may not distribute it in any other way without permission. /* Code for COMP103 - 2018T2, Assignment 3 * Name: * Username: * ID: */ import ecs100.*; import java.util.*; import java.io.*; /** * Simulation of an EmergencyRoom, * The Emergency room has a collection of departments for treating patients (ER beds, X-ray, * Operating Theatre, MRI, Ultrasound, etc). * * When patients arrive at the emergency room, they are immediately assessed by the * triage team who determine the priority of the patient and a sequence of treatments * that the patient will need. * * Each department has * - a Set of patients that they are currently treating, * (There is a maximum size of this set for each department) * - a Queue for the patients waiting for that department. * * The departments should be in a Map, with the department name (= treatment type) as the key. * * When a patient has finished a treatment, they should be moved to the * department for the next treatment they require. * * When a patient has finished all their treatments, they should be discharged: * - a record of their total time, treatment time, and wait time should be printed, * - the details should be added to the statistics. * * * The main simulation should consist of * a setting up phase which initialises all the queues, * a loop that steps through time: * - advances the time by one "tick" * - Processes one time tick for each patient currently in each department * (either making them wait if they are on the queue, or * advancing their treatment if they are being treated) * - Checks for any patients who have completed their current treatment, * and remove from the department * - Move all Patients that completed a treatment to their next department (or discharge them) * - Checks each department, and moves patients from the front of the * waiting queues into the Sets of patients being treated, if there is room * - Gets any new patient that has arrived (depends on arrivalInterval) and * puts them on the appropriate queue * - Redraws all the departments - showing the patients being treated, and * the patients waiting in the queues * - Pauses briefly * * The simple simulation just has one department - ER beds that can treat 5 people at once. * Patients arrive and need treatment for random times. */ public class EmergencyRoom{ private Map<String, Department> departments = new HashMap<String, Department>(); private boolean running = false; // fields controlling the probabilities. private int arrivalInterval = 5; // new patient every 5 ticks, on average private double probPri1 = 0.1; // 10% priority 1 patients private double probPri2 = 0.2; // 20% priority 2 patients private Random random = new Random(); // The random number generator. private int time = 0; // The simulated time /** * Construct a new EmergencyRoom object, setting up the GUI */ public EmergencyRoom(){ setupGUI(); reset(); } public void setupGUI(){ UI.addButton("Reset", this::reset); UI.addButton("Start", this::run); UI.addButton("Stop", ()->{running=false;}); UI.addSlider("Av arrival interval", 1, 50, arrivalInterval, (double val)-> {arrivalInterval = (int)val;}); UI.addSlider("Prob of Priority 1", 1, 100, probPri1*100, (double val)-> {probPri1 = val/100;}); UI.addSlider("Prob of Priority 2", 1, 100, probPri2*100, (double val)-> {probPri2 = Math.min(val/100,1-probPri1);}); UI.addButton("Quit", UI::quit); UI.setWindowSize(1000,600); UI.setDivider(0.5); } /** * Define the departments available and put them in the map of departments. * Each department needs to have a name and a maximum number of patients that * it can be treating at the same time. * Simple version: just a collection of 5 ER beds. */ public void reset(){ UI.clearGraphics(); UI.clearText(); running=false; time = 0; departments.put("ER beds", new Department("ER beds", 8)); departments.put("Operating Theatre", new Department("Operating Theatre", 2)); departments.put("X-ray", new Department("X-ray", 2)); departments.put("MRI", new Department("MRI", 1)); departments.put("Ultrasound", new Department("Ultrasound", 3)); departments.put("Toilet", new Department("Toilet", 12)); departments.put("Crematory", new Department("Crematory", 3)); } /** * Main loop of the simulation */ public void run(){ running = true; while (running){ // Hint: if you are stepping through a set, you can't remove // items from the set inside the loop! // If you need to remove items, you can add the items to a // temporary list, and after the loop is done, remove all // the items on the temporary list from the set. /*# YOUR CODE HERE */ if(random.nextDouble() < 1/(double)arrivalInterval){ Patient newPatient = new Patient(time, randomPriority()); departments.get(newPatient.getNextTreatment()).addPatient(newPatient); newPatient.incrementTreatmentNumber(); } for(String department : departments.keySet()){ // Step through each department Department currentDep = departments.get(department); Collection<Patient> currentPatients = currentDep.getCurrentPatients(); //retrieve Collections of waiting and current patients Collection<Patient> waitingPatient = currentDep.getWaitingPatients(); List<Patient> removed = new ArrayList<>(); for(Patient curPatient : currentPatients){ //for each current patient, advance their treatment time curPatient.advanceTreatmentByTick(); if(curPatient.completedCurrentTreatment()){ // If the current treatment has been completed if(curPatient.completedAllTreatments()){ // If all treatments have not been completed removed.add(curPatient); // Remove the patient from the department they just completed treatment in discharge(curPatient); } else{ // If all treatment has been completed, remove them without adding them elsewhere departments.get(curPatient.getNextTreatment()).addPatient(curPatient); // Add the patient to the waiting list of the next department curPatient.incrementTreatmentNumber(); removed.add(curPatient); } } } for(Patient toRemove : removed){ currentDep.removePatient(toRemove); } for(Patient waitPatient : waitingPatient){ waitPatient.waitForATick(); //for each patient in the waiting list, wait for a tick } for(int i = 0; i < currentDep.depMax(); i++){ currentDep.moveFromWaiting(); } } time++; redraw(); UI.sleep(300); } // Stopped reportStatistics(); } /** * Report that a patient has been discharged, along with any * useful statistics about the patient */ public void discharge(Patient p){ UI.println("Discharge: " + p); } /** * Report summary statistics about the simulation */ public void reportStatistics(){ } /** * Redraws all the departments */ public void redraw(){ UI.clearGraphics(); UI.setFontSize(14); UI.drawString("Treating Patients", 5, 15); UI.drawString("Waiting Queues", 200, 15); UI.drawLine(0,32,400, 32); double y = 80; for (String dept : new String[]{"ER beds","Operating Theatre", "X-ray", "Ultrasound", "MRI", "Toilet", "Crematory"}){ departments.get(dept).redraw(y); UI.drawLine(0,y+2,400, y+2); y += 50; } } /** (COMPLETION) * Returns a random priority 1 - 3 * Probability of a priority 1 patient should be probPri1 * Probability of a priority 2 patient should be probPri2 * Probability of a priority 3 patient should be (1-probPri1-probPri2) */ public int randomPriority(){ double rand = random.nextDouble(); if(rand < probPri1) return 1; else if(rand < (probPri1 + probPri2)) return 2; else return 3; } public static void main(String[] arguments){ new EmergencyRoom(); } }
[ "nielsdanielclayton@gmail.com" ]
nielsdanielclayton@gmail.com
bc7c11127fc5f730bdb97314813a992fdd0a8009
dc9c7f90d19e664f9970f4623578570203f98399
/src/bai12_java_collection_framework/bai_tap_them/Main2.java
3084805a4a8a2b36bc6da626f81d07741f4f53d6
[]
no_license
hauhp94/C0321G1_HuynhPhuocHau_Module2
427a6413316efc37306fb3f2d5e28bf6b14317ba
633dcb2a377a181cc76c906247c3a771ede04383
refs/heads/main
2023-06-01T01:06:47.598267
2021-06-07T03:21:13
2021-06-07T03:21:13
362,328,451
0
0
null
null
null
null
UTF-8
Java
false
false
1,077
java
package bai12_java_collection_framework.bai_tap_them; import java.util.*; public class Main2 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Nhập vào chuỗi: "); String string = scanner.nextLine(); Map<Character, Integer> map = new LinkedHashMap<>(); for(Character charOfString: string.toCharArray()){ if(!map.containsKey(charOfString)){ map.put(charOfString,1); }else { map.put(charOfString,map.get(charOfString)+1); } } // for (int i = 0; i < string.length(); i++) { // if (!map.containsKey(string.charAt(i))) { // map.put(string.charAt(i), 1); // } else { // map.put(string.charAt(i), map.get(string.charAt(i)) + 1); // } // } Set<Character> key = map.keySet(); for (Character k : key) { System.out.println("chữ: " + k + " xuất hiện " + map.get(k) + " lần"); } } }
[ "hauhpdn2015@gmail.com" ]
hauhpdn2015@gmail.com
dd4b17f56734cc4bee8966aa46b8dc6f24835419
ee4e12c3ec0893221494d3912a584a8eed297430
/zhttp/src/main/java/com/zpj/http/utils/DataUtil.java
00ec62f7f0640d263cf569b76058fba98f28f519
[]
no_license
lzjian119/ZDownloader
eed7cbc67f954f6abd4f96006e7eda8bf66cecd7
aecc19f62c2f26a599a9dbcf53cfe63edfa52633
refs/heads/master
2021-01-26T03:08:58.738720
2020-02-09T15:08:05
2020-02-09T15:08:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,308
java
package com.zpj.http.utils; import android.util.Log; import com.zpj.http.core.IHttp; import com.zpj.http.exception.UncheckedIOException; import com.zpj.http.io.ConstrainableInputStream; import com.zpj.http.parser.html.nodes.Comment; import com.zpj.http.parser.html.nodes.Document; import com.zpj.http.parser.html.nodes.Element; import com.zpj.http.parser.html.nodes.Node; import com.zpj.http.parser.html.nodes.XmlDeclaration; import com.zpj.http.parser.html.Parser; import com.zpj.http.parser.html.select.Elements; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.charset.IllegalCharsetNameException; import java.util.Locale; import java.util.Random; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Internal static utilities for handling data. * */ public final class DataUtil { private static final Pattern charsetPattern = Pattern.compile("(?i)\\bcharset=\\s*(?:[\"'])?([^\\s,;\"']*)"); public static final String defaultCharset = "UTF-8"; // used if not found in header or meta charset private static final int firstReadBufferSize = 1024 * 5; public static final int bufferSize = 1024 * 512; // 1024 * 32 private static final char[] mimeBoundaryChars = "-_1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray(); static final int boundaryLength = 32; private DataUtil() {} /** * Loads a file to a Document. * @param in file to load * @param charsetName character set of input * @param baseUri base URI of document, to resolve relative links against * @return Document * @throws IOException on IO error */ public static Document load(File in, String charsetName, String baseUri) throws IOException { return parseInputStream(new FileInputStream(in), charsetName, baseUri, Parser.htmlParser()); } /** * Parses a Document from an input steam. * @param in input stream to parse. You will need to close it. * @param charsetName character set of input * @param baseUri base URI of document, to resolve relative links against * @return Document * @throws IOException on IO error */ public static Document load(InputStream in, String charsetName, String baseUri) throws IOException { return parseInputStream(in, charsetName, baseUri, Parser.htmlParser()); } /** * Parses a Document from an input steam, using the provided Parser. * @param in input stream to parse. You will need to close it. * @param charsetName character set of input * @param baseUri base URI of document, to resolve relative links against * @param parser alternate {@link Parser#xmlParser() parser} to use. * @return Document * @throws IOException on IO error */ public static Document load(InputStream in, String charsetName, String baseUri, Parser parser) throws IOException { return parseInputStream(in, charsetName, baseUri, parser); } // /** // * Writes the input stream to the output stream. Doesn't close them. // * @param in input stream to read from // * @param out output stream to write to // * @throws IOException on IO error // */ // public static void crossStreams(final InputStream in, final OutputStream out) throws IOException { // crossStreams(in, out, null); // } /** * Writes the input stream to the output stream. Doesn't close them. * @param in input stream to read from * @param out output stream to write to * @throws IOException on IO error */ public static void crossStreams(final InputStream in, final OutputStream out, IHttp.OnStreamWriteListener listener) throws IOException { final byte[] buffer = new byte[bufferSize]; int len; while ((len = in.read(buffer, 0, buffer.length)) != -1) { if (listener.shouldContinue()) { Log.d("crossStreams", "len=" + len); out.write(buffer, 0, len); Log.d("crossStreams", "write"); out.flush(); Log.d("crossStreams", "flush"); Log.d("crossStreams", "onBytesWritten"); listener.onBytesWritten(len); Log.d("crossStreams", "----------------------------------------------"); } else { Log.d("crossStreams", "stop"); throw new IOException("Stop Post by User!"); } } } public static Document parseInputStream(InputStream input, String charsetName, String baseUri, Parser parser) throws IOException { if (input == null) // empty body return new Document(baseUri); input = ConstrainableInputStream.wrap(input, bufferSize, 0); Document doc = null; // read the start of the stream and look for a BOM or meta charset input.mark(bufferSize); ByteBuffer firstBytes = readToByteBuffer(input, firstReadBufferSize - 1); // -1 because we read one more to see if completed. First read is < buffer size, so can't be invalid. boolean fullyRead = (input.read() == -1); input.reset(); // look for BOM - overrides any other header or input BomCharset bomCharset = detectCharsetFromBom(firstBytes); if (bomCharset != null) charsetName = bomCharset.charset; if (charsetName == null) { // determine from meta. safe first parse as UTF-8 String docData = Charset.forName(defaultCharset).decode(firstBytes).toString(); try { doc = parser.parseInput(docData, baseUri); } catch (UncheckedIOException e) { throw e.ioException(); } // look for <meta http-equiv="Content-Type" content="text/html;charset=gb2312"> or HTML5 <meta charset="gb2312"> Elements metaElements = doc.select("meta[http-equiv=content-type], meta[charset]"); String foundCharset = null; // if not found, will keep utf-8 as best attempt for (Element meta : metaElements) { if (meta.hasAttr("http-equiv")) foundCharset = getCharsetFromContentType(meta.attr("content")); if (foundCharset == null && meta.hasAttr("charset")) foundCharset = meta.attr("charset"); if (foundCharset != null) break; } // look for <?xml encoding='ISO-8859-1'?> if (foundCharset == null && doc.childNodeSize() > 0) { Node first = doc.childNode(0); XmlDeclaration decl = null; if (first instanceof XmlDeclaration) decl = (XmlDeclaration) first; else if (first instanceof Comment) { Comment comment = (Comment) first; if (comment.isXmlDeclaration()) decl = comment.asXmlDeclaration(); } if (decl != null) { if (decl.name().equalsIgnoreCase("xml")) foundCharset = decl.attr("encoding"); } } foundCharset = validateCharset(foundCharset); if (foundCharset != null && !foundCharset.equalsIgnoreCase(defaultCharset)) { // need to re-decode. (case insensitive check here to match how validate works) foundCharset = foundCharset.trim().replaceAll("[\"']", ""); charsetName = foundCharset; doc = null; } else if (!fullyRead) { doc = null; } } else { // specified by content type header (or by user on file load) Validate.notEmpty(charsetName, "Must set charset arg to character set of file to parse. Set to null to attempt to detect from HTML"); } if (doc == null) { if (charsetName == null) charsetName = defaultCharset; BufferedReader reader = new BufferedReader(new InputStreamReader(input, charsetName), bufferSize); if (bomCharset != null && bomCharset.offset) { // creating the buffered reader ignores the input pos, so must skip here long skipped = reader.skip(1); Validate.isTrue(skipped == 1); // WTF if this fails. } try { doc = parser.parseInput(reader, baseUri); } catch (UncheckedIOException e) { // io exception when parsing (not seen before because reading the stream as we go) throw e.ioException(); } Charset charset = Charset.forName(charsetName); doc.outputSettings().charset(charset); if (!charset.canEncode()) { // some charsets can read but not encode; switch to an encodable charset and update the meta el doc.charset(Charset.forName(defaultCharset)); } } input.close(); return doc; } /** * Read the input stream into a byte buffer. To deal with slow input streams, you may interrupt the thread this * method is executing on. The data read until being interrupted will be available. * @param inStream the input stream to read from * @param maxSize the maximum size in bytes to read from the stream. Set to 0 to be unlimited. * @return the filled byte buffer * @throws IOException if an exception occurs whilst reading from the input stream. */ public static ByteBuffer readToByteBuffer(InputStream inStream, int maxSize) throws IOException { Validate.isTrue(maxSize >= 0, "maxSize must be 0 (unlimited) or larger"); final ConstrainableInputStream input = ConstrainableInputStream.wrap(inStream, bufferSize, maxSize); return input.readToByteBuffer(maxSize); } public static ByteBuffer emptyByteBuffer() { return ByteBuffer.allocate(0); } /** * Parse out a charset from a content type header. If the charset is not supported, returns null (so the default * will kick in.) * @param contentType e.g. "text/html; charset=EUC-JP" * @return "EUC-JP", or null if not found. Charset is trimmed and uppercased. */ public static String getCharsetFromContentType(String contentType) { if (contentType == null) return null; Matcher m = charsetPattern.matcher(contentType); if (m.find()) { String charset = m.group(1).trim(); charset = charset.replace("charset=", ""); return validateCharset(charset); } return null; } private static String validateCharset(String cs) { if (cs == null || cs.length() == 0) return null; cs = cs.trim().replaceAll("[\"']", ""); try { if (Charset.isSupported(cs)) return cs; cs = cs.toUpperCase(Locale.ENGLISH); if (Charset.isSupported(cs)) return cs; } catch (IllegalCharsetNameException e) { // if our this charset matching fails.... we just take the default } return null; } /** * Creates a random string, suitable for use as a mime boundary */ public static String mimeBoundary() { final StringBuilder mime = StringUtil.borrowBuilder(); final Random rand = new Random(); for (int i = 0; i < boundaryLength; i++) { mime.append(mimeBoundaryChars[rand.nextInt(mimeBoundaryChars.length)]); } return StringUtil.releaseBuilder(mime); } private static BomCharset detectCharsetFromBom(final ByteBuffer byteData) { final Buffer buffer = byteData; // .mark and rewind used to return Buffer, now ByteBuffer, so cast for backward compat buffer.mark(); byte[] bom = new byte[4]; if (byteData.remaining() >= bom.length) { byteData.get(bom); buffer.rewind(); } if (bom[0] == 0x00 && bom[1] == 0x00 && bom[2] == (byte) 0xFE && bom[3] == (byte) 0xFF || // BE bom[0] == (byte) 0xFF && bom[1] == (byte) 0xFE && bom[2] == 0x00 && bom[3] == 0x00) { // LE return new BomCharset("UTF-32", false); // and I hope it's on your system } else if (bom[0] == (byte) 0xFE && bom[1] == (byte) 0xFF || // BE bom[0] == (byte) 0xFF && bom[1] == (byte) 0xFE) { return new BomCharset("UTF-16", false); // in all Javas } else if (bom[0] == (byte) 0xEF && bom[1] == (byte) 0xBB && bom[2] == (byte) 0xBF) { return new BomCharset("UTF-8", true); // in all Javas // 16 and 32 decoders consume the BOM to determine be/le; utf-8 should be consumed here } return null; } private static class BomCharset { private final String charset; private final boolean offset; public BomCharset(String charset, boolean offset) { this.charset = charset; this.offset = offset; } } }
[ "37832345+Z-P-J@users.noreply.github.com" ]
37832345+Z-P-J@users.noreply.github.com
58b8bf0fb33934feaf776a3c28fffe6ea885ccaa
b99684d48895dc6558fb339e759fb6645095021b
/backend/src/main/java/com/cloudbilling/backend/service/UserSecurityService.java
c24213efb6edc85519b24ccd9722d27eab963a89
[]
no_license
OshritShoua/CloudBilling
57b94fcb6a7eb9a63713d01cfdcf838ae255fbc0
e8c800f43558144e218db1d41736b713044b6768
refs/heads/master
2020-03-12T16:03:40.972874
2018-04-23T14:31:25
2018-04-23T14:31:25
130,416,019
0
0
null
null
null
null
UTF-8
Java
false
false
1,105
java
package com.cloudbilling.backend.service; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; import com.cloudbilling.backend.entity.User; import com.cloudbilling.backend.repository.UserRepository; @Service public class UserSecurityService implements UserDetailsService{ private static final Logger LOG = LoggerFactory.getLogger(UserSecurityService.class); @Autowired private UserRepository userRepository; @Override public UserDetails loadUserByUsername (String username) throws UsernameNotFoundException { User user = userRepository.findByUsername(username); if(user == null) { LOG.warn("Username not found"); throw new UsernameNotFoundException ("Username " + username + "not found"); } return user; } }
[ "oshritshoua@gmail.com" ]
oshritshoua@gmail.com
4bbde4442b819180b0628a22e55ab752ede9c181
ca1ccc7a8fa210ac367b3616097740cfb55d08c4
/app/src/androidTest/java/in/arjsna/passcodeviewsample/ApplicationTest.java
e361f009b6967e68c8504f70a15d7ac00f27acf6
[ "Apache-2.0" ]
permissive
radiumapp/android-passcodeview
e12d75fa5ce6fb901821f42b3342a3f457908ae8
c7798903b4856557e21ea7196178adfcdad4ac97
refs/heads/master
2020-05-01T14:45:50.238863
2019-04-26T08:32:03
2019-04-26T08:32:03
177,528,895
0
1
Apache-2.0
2019-04-26T08:32:04
2019-03-25T06:38:47
Java
UTF-8
Java
false
false
351
java
package in.arjsna.passcodeviewsample; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "arjun@codebrahma.com" ]
arjun@codebrahma.com
23c120f6ce69fca6d46f77a158e8bd9a7f3926bb
5b93b09dd5dc4777cbbeff8b377085112585e04e
/leo-grab-engine/src/main/java/com/hongru/parse/HTMLDateParse.java
8325dd4a648ecd9bb23e017fc66df29e94fe48b2
[]
no_license
chenhy8208/leoSearcher
f5c4abb462f0ab698ea2dccb6fc8feb4110e07ac
06dd85826669a3fc5b22b81ce93014cf86fa5467
refs/heads/master
2020-05-25T15:41:22.928050
2017-03-05T14:59:28
2017-03-05T14:59:28
69,433,815
0
1
null
null
null
null
UTF-8
Java
false
false
4,982
java
package com.hongru.parse; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Created by chenhongyu on 2016/10/14. */ public class HTMLDateParse { /** * 从网页中解析出当前网页可能的发布时间 * @param htmlText * @return */ public static Date parseHTMLPublishDate(String htmlText) { Date defaultDate = new Date(0); if (regExDates == null) init(); if (regExDates != null) { for (RegExDate regExDate:regExDates) { Date regDate = regDate(regExDate, htmlText); if (regDate != null) return regDate; } } return defaultDate; } //匹配时间 private static Date regDate(RegExDate regExDate, String htmlText) { if (StringUtils.isBlank(regExDate.getDatePrefix())) return emptyPrefixRegDate(regExDate, htmlText); else return NotEmptyPrefixRegDate(regExDate, htmlText); } private static Date emptyPrefixRegDate(RegExDate regExDate, String htmlText) { List<Date> dates = new ArrayList<>(); for (String reg: regExDate.getRegEx()) { Pattern pattern = Pattern.compile(reg); Matcher matcher = pattern.matcher(htmlText); while (matcher.find()){ try { Date date = getDateFromMatcher(matcher); dates.add(date); } catch (ParseException e) { e.printStackTrace(); logger.warn("Find Date fault,err = " + e.getMessage()); } } } if (dates!=null) { //TODO 如果有很多日期,而且没有关键词,那么就返回第一个匹配 return dates.get(0); } return null; } private static Date NotEmptyPrefixRegDate(RegExDate regExDate, String htmlText) { for (String reg: regExDate.getRegEx()) { String regStr = regExDate.getDatePrefix()+"\\s*[::\\s]\\s*"+reg; Pattern pattern = Pattern.compile(regStr); Matcher matcher = pattern.matcher(htmlText); if (matcher.find()){ try { Date date = getDateFromMatcher(matcher); return date; } catch (ParseException e) { e.printStackTrace(); logger.warn("Find Date fault,err = " + e.getMessage()); return null; } } } return null; } //解析日期 private static Date getDateFromMatcher(Matcher matcher) throws ParseException { String year = matcher.group(1); String month = matcher.group(2); String day = matcher.group(3); Date date = sdf.parse(year+"-"+month+"-"+day); return date; } private static void init() { if (regExDates == null) { synchronized (HTMLDateParse.class) { List<String> regs = allPureDateRegEx(); if (regExDates == null) { loadRegExDate(regs); } } } } /** * 正则规则设置 * @param regs */ private static void loadRegExDate(List<String> regs ) { regExDates = new ArrayList<>(); String[] datePrefixs = new String[]{ "发布日期", "发布时间", "更新日期", "更新时间", "招标日期", "招标时间", "最后更新时间", "" }; for (String pre : datePrefixs) { RegExDate regExDate = new RegExDate(); regExDate.setDatePrefix(pre); regExDate.setRegEx(regs); regExDates.add(regExDate); } } /** * 列举所有可能得日期格式组合 * @return */ private static List<String> allPureDateRegEx() { List<String> regs = new ArrayList<>(); regs.add("("+regYear+")\\s*-\\s*("+regOther+")\\s*-\\s*(" + regOther + ")"); regs.add("("+regYear+")\\s*年\\s*("+regOther+")\\s*月\\s*(" + regOther + ")"); regs.add("("+regYear+")\\s*/\\s*("+regOther+")\\s*/\\s*(" + regOther + ")"); return regs; } private static List<RegExDate> regExDates; private static String regYear = "\\d{4}"; private static String regOther = "\\d{2}"; private static String prefixSpace = "\\s*[::\\s]\\s*"; private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); private static final Logger logger = LogManager.getLogger(HTMLDateParse.class); }
[ "37799400@qq.com" ]
37799400@qq.com
6a29e5752f701b966078ae785164eff10f44b516
88c4189861ac4491c84a1551f2921f1d6f4533cd
/storm-parser/src/main/java/ninja/eivind/stormparser/models/Player.java
192b8892bae102ba0f45acd8961c67aea9f07b1b
[]
no_license
zhedar/HotSReplayParser
0d371df28b6e40b52bd20d03299fe30b1d749cf2
3eefc6430c9de5023915726715a2217c1cc6bbdf
refs/heads/master
2020-12-25T22:29:04.361873
2015-11-07T23:35:05
2015-11-07T23:38:49
45,755,096
0
0
null
2015-11-07T21:20:26
2015-11-07T21:20:26
null
UTF-8
Java
false
false
432
java
package ninja.eivind.stormparser.models; /** * @author Eivind Vegsundvåg */ public class Player { private String bNetId; public Player(TrackerEventStructure item) { this.bNetId = String.valueOf(item.getDictionary().get(1L).getDictionary().get(4L).getVarInt()); } public void setBNetId(String bNetId) { this.bNetId = bNetId; } public String getBNetId() { return bNetId; } }
[ "eivindveg@hotmail.com" ]
eivindveg@hotmail.com
ea22bad9bbc2efdb8106cd4ed679e48c74b85802
48e835e6f176a8ac9ae3ca718e8922891f1e5a18
/benchmark/test/org/keycloak/saml/processing/core/saml/v2/util/AssertionUtilTest.java
69beef81619c825d78ab999155552ef195c91e08
[]
no_license
STAMP-project/dspot-experiments
f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5
121487e65cdce6988081b67f21bbc6731354a47f
refs/heads/master
2023-02-07T14:40:12.919811
2019-11-06T07:17:09
2019-11-06T07:17:09
75,710,758
14
19
null
2023-01-26T23:57:41
2016-12-06T08:27:42
null
UTF-8
Java
false
false
4,278
java
package org.keycloak.saml.processing.core.saml.v2.util; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.security.cert.X509Certificate; import org.bouncycastle.util.Arrays; import org.junit.Assert; import org.junit.Test; import org.keycloak.common.util.Base64; import org.keycloak.common.util.DerUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; public class AssertionUtilTest { private static final String PRIVATE_KEY = "MIICWwIBAAKBgQDVG8a7xGN6ZIkDbeecySygcDfsypjUMNPE4QJjis8B316CvsZQ0hcTTLUyiRpHlHZys2k3xEhHBHymFC1AONcvzZzpb40tAhLHO1qtAnut00khjAdjR3muLVdGkM/zMC7G5s9iIwBVhwOQhy+VsGnCH91EzkjZ4SVEr55KJoyQJQIDAQABAoGADaTtoG/+foOZUiLjRWKL/OmyavK9vjgyFtThNkZY4qHOh0h3og0RdSbgIxAsIpEa1FUwU2W5yvI6mNeJ3ibFgCgcxqPk6GkAC7DWfQfdQ8cS+dCuaFTs8ObIQEvU50YzeNPiiFxRA+MnauCUXaKm/PnDfjd4tPgru7XZvlGh0wECQQDsBbN2cKkBKpr/b5oJiBcBaSZtWiMNuYBDn9x8uORj+Gy/49BUIMHF2EWyxOWz6ocP5YiynNRkPe21Zus7PEr1AkEA5yWQOkxUTIg43s4pxNSeHtL+Ebqcg54lY2xOQK0yufxUVZI8ODctAKmVBMiCKpU3mZQquOaQicuGtocpgxlScQI/YM31zZ5nsxLGf/5GL6KhzPJT0IYn2nk7IoFu7bjn9BjwgcPurpLA52TNMYWQsTqAKwT6DEhG1NaRqNWNpb4VAkBehObAYBwMm5udyHIeEc+CzUalm0iLLa0eRdiN7AUVNpCJ2V2Uo0NcxPux1AgeP5xXydXafDXYkwhINWcNO9qRAkEA58ckAC5loUGwU5dLaugsGH/a2Q8Ac8bmPglwfCstYDpl8Gp/eimb1eKyvDEELOhyImAv4/uZV9wN85V0xZXWsw=="; /** * The public certificate that corresponds to {@link #PRIVATE_KEY}. */ private static final String PUBLIC_CERT = "MIIDdzCCAl+gAwIBAgIEbySuqTANBgkqhkiG9w0BAQsFADBsMRAwDgYDVQQGEwdVbmtub3duMRAwDgYDVQQIEwdVbmtub3duMRAwDgYDVQQHEwdVbmtub3duMRAwDgYDVQQKEwdVbmtub3duMRAwDgYDVQQLEwdVbmtub3duMRAwDgYDVQQDEwdVbmtub3duMB4XDTE1MDEyODIyMTYyMFoXDTE3MTAyNDIyMTYyMFowbDEQMA4GA1UEBhMHVW5rbm93bjEQMA4GA1UECBMHVW5rbm93bjEQMA4GA1UEBxMHVW5rbm93bjEQMA4GA1UEChMHVW5rbm93bjEQMA4GA1UECxMHVW5rbm93bjEQMA4GA1UEAxMHVW5rbm93bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAII/K9NNvXi9IySl7+l2zY/kKrGTtuR4WdCI0xLW/Jn4dLY7v1/HOnV4CC4ecFOzhdNFPtJkmEhP/q62CpmOYOKApXk3tfmm2rwEz9bWprVxgFGKnbrWlz61Z/cjLAlhD3IUj2ZRBquYgSXQPsYfXo1JmSWF5pZ9uh1FVqu9f4wvRqY20ZhUN+39F+1iaBsoqsrbXypCn1HgZkW1/9D9GZug1c3vB4wg1TwZZWRNGtxwoEhdK6dPrNcZ+6PdanVilWrbQFbBjY4wz8/7IMBzssoQ7Usmo8F1Piv0FGfaVeJqBrcAvbiBMpk8pT+27u6p8VyIX6LhGvnxIwM07NByeSUCAwEAAaMhMB8wHQYDVR0OBBYEFFlcNuTYwI9W0tQ224K1gFJlMam0MA0GCSqGSIb3DQEBCwUAA4IBAQB5snl1KWOJALtAjLqD0mLPg1iElmZP82Lq1htLBt3XagwzU9CaeVeCQ7lTp+DXWzPa9nCLhsC3QyrV3/+oqNli8C6NpeqI8FqN2yQW/QMWN1m5jWDbmrWwtQzRUn/rh5KEb5m3zPB+tOC6e/2bV3QeQebxeW7lVMD0tSCviUg1MQf1l2gzuXQo60411YwqrXwk6GMkDOhFDQKDlMchO3oRbQkGbcP8UeiKAXjMeHfzbiBr+cWz8NYZEtxUEDYDjTpKrYCSMJBXpmgVJCZ00BswbksxJwaGqGMPpUKmCV671pf3m8nq3xyiHMDGuGwtbU+GE8kVx85menmp8+964nin"; @Test public void testSaml20Signed() throws Exception { X509Certificate decodeCertificate = DerUtils.decodeCertificate(new ByteArrayInputStream(Base64.decode(AssertionUtilTest.PUBLIC_CERT))); try (InputStream st = AssertionUtilTest.class.getResourceAsStream("saml20-signed-response.xml")) { Document document = DocumentUtil.getDocument(st); Element assertion = DocumentUtil.getDirectChildElement(document.getDocumentElement(), "urn:oasis:names:tc:SAML:2.0:assertion", "Assertion"); Assert.assertTrue(AssertionUtil.isSignatureValid(assertion, decodeCertificate.getPublicKey())); // test manipulation of signature Element signatureElement = AssertionUtil.getSignature(assertion); byte[] validSignature = Base64.decode(signatureElement.getTextContent()); // change the signature value slightly byte[] invalidSignature = Arrays.clone(validSignature); invalidSignature[0] ^= invalidSignature[0]; signatureElement.setTextContent(Base64.encodeBytes(invalidSignature)); // check that signature now is invalid Assert.assertFalse(AssertionUtil.isSignatureValid(document.getDocumentElement(), decodeCertificate.getPublicKey())); // restore valid signature, but remove Signature element, check that still invalid signatureElement.setTextContent(Base64.encodeBytes(validSignature)); assertion.removeChild(signatureElement); Assert.assertFalse(AssertionUtil.isSignatureValid(document.getDocumentElement(), decodeCertificate.getPublicKey())); } } }
[ "benjamin.danglot@inria.fr" ]
benjamin.danglot@inria.fr
e56648023216802221a743267bb6591e21ea8daf
05a14c594fcb01931310ed1792be4a9e8701f994
/src/com/mycompany/a3/Decelerate.java
65444facf5a6e6c7815a50562db9637fe2f139f5
[]
no_license
kaurlakhveer5/CSC133
6b176dfbd448b7296449b130e8e80d194a677d91
a994ddce89c10515aa9296613a1722d14ed2e654
refs/heads/master
2020-04-14T07:02:07.241722
2018-12-31T23:10:25
2018-12-31T23:10:25
163,701,969
0
0
null
null
null
null
UTF-8
Java
false
false
361
java
package com.mycompany.a3; import com.codename1.ui.Command; import com.codename1.ui.events.ActionEvent; public class Decelerate extends Command{ private GameWorld gw; public Decelerate(GameWorld gw) { super("Decelerate"); this.gw = gw; } public void actionPerformed(ActionEvent e) { if (e.getKeyEvent() != -1) gw.decSpeed(); } }
[ "noreply@github.com" ]
kaurlakhveer5.noreply@github.com
8df590a6d57c43c7643e3c8268a918f21ef48b7f
a524cec8f2658fdfbf2bd2901740941ef353ac8c
/leekwars-utils/src/main/java/com/leekwars/utils/tools/InstallCert.java
d71655722e51884c8a1bcbe96633e52a2a668da8
[]
no_license
LeBezout/LEEK-WARS
b9de8ee33a0cd1d67ad2fb581f1a1b1b1af29610
ed75967f77f5aea084748dca377e472a3a70defb
refs/heads/master
2022-09-08T15:40:59.170094
2022-08-09T20:52:38
2022-08-09T20:52:38
49,378,145
7
1
null
2022-05-21T08:01:41
2016-01-10T17:50:53
Java
UTF-8
Java
false
false
7,884
java
package com.leekwars.utils.tools; /* * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * - Neither the name of Sun Microsystems nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import javax.net.ssl.*; import java.io.*; import java.security.KeyStore; import java.security.MessageDigest; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; /** * Class used to add the server's certificate to the KeyStore with your trusted certificates. * Originally from: * http://blogs.sun.com/andreas/resource/InstallCert.java * Use: * java InstallCert passphrase */ public class InstallCert { public static void main(String[] args) throws Exception { final int port = 443; final String host = "leekwars.com"; final char[] passphrase = ((args.length == 1) ? args[0] : "changeit").toCharArray(); // String host; // int port; // char[] passphrase; // if ((args.length == 1) || (args.length == 2)) { // String[] c = args[0].split(":"); // host = c[0]; // port = (c.length == 1) ? 443 : Integer.parseInt(c[1]); // String p = (args.length == 1) ? "changeit" : args[1]; // passphrase = p.toCharArray(); // } else { // System.out.println("Usage: java InstallCert [:port] [passphrase]"); // return; // } File file = new File("jssecacerts"); if (file.isFile() == false) { char SEP = File.separatorChar; File dir = new File(System.getProperty("java.home") + SEP + "lib" + SEP + "security"); file = new File(dir, "jssecacerts"); if (file.isFile() == false) { file = new File(dir, "cacerts"); } } System.out.println("Loading KeyStore " + file + "..."); InputStream in = new FileInputStream(file); KeyStore ks; try { ks = KeyStore.getInstance(KeyStore.getDefaultType()); ks.load(in, passphrase); } finally { in.close(); } SSLContext context = SSLContext.getInstance("TLS"); TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmf.init(ks); X509TrustManager defaultTrustManager = (X509TrustManager) tmf.getTrustManagers()[0]; SavingTrustManager tm = new SavingTrustManager(defaultTrustManager); context.init(null, new TrustManager[]{tm}, null); SSLSocketFactory factory = context.getSocketFactory(); System.out.println("Opening connection to " + host + ":" + port + "..."); SSLSocket socket = (SSLSocket) factory.createSocket(host, port); socket.setSoTimeout(10000); try { System.out.println("Starting SSL handshake..."); socket.startHandshake(); socket.close(); System.out.println(); System.out.println("No errors, certificate is already trusted"); } catch (SSLException e) { System.out.println(); e.printStackTrace(System.out); } X509Certificate[] chain = tm.chain; if (chain == null) { System.out.println("Could not obtain server certificate chain"); return; } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.println(); System.out.println("Server sent " + chain.length + " certificate(s):"); System.out.println(); MessageDigest sha1 = MessageDigest.getInstance("SHA1"); MessageDigest md5 = MessageDigest.getInstance("MD5"); for (int i = 0; i < chain.length; i++) { X509Certificate cert = chain[i]; System.out.println(" " + (i + 1) + " Subject " + cert.getSubjectDN()); System.out.println(" Issuer " + cert.getIssuerDN()); sha1.update(cert.getEncoded()); System.out.println(" sha1 " + toHexString(sha1.digest())); md5.update(cert.getEncoded()); System.out.println(" md5 " + toHexString(md5.digest())); System.out.println(); } System.out.println("Enter certificate to add to trusted keystore or 'q' to quit: [1]"); String line = reader.readLine().trim(); int k; try { k = (line.length() == 0) ? 0 : Integer.parseInt(line) - 1; } catch (NumberFormatException e) { System.out.println("KeyStore not changed"); return; } X509Certificate cert = chain[k]; String alias = host + "-" + (k + 1); ks.setCertificateEntry(alias, cert); OutputStream out = new FileOutputStream("jssecacerts"); ks.store(out, passphrase); out.close(); System.out.println(); System.out.println(cert); System.out.println(); System.out.println("Added certificate to keystore 'jssecacerts' using alias '" + alias + "'"); } private static final char[] HEXDIGITS = "0123456789abcdef".toCharArray(); private static String toHexString(byte[] bytes) { StringBuilder sb = new StringBuilder(bytes.length * 3); for (int b : bytes) { b &= 0xff; sb.append(HEXDIGITS[b >> 4]); sb.append(HEXDIGITS[b & 15]); sb.append(' '); } return sb.toString(); } private static class SavingTrustManager implements X509TrustManager { private final X509TrustManager tm; private X509Certificate[] chain; SavingTrustManager(X509TrustManager tm) { this.tm = tm; } public X509Certificate[] getAcceptedIssuers() { /* * This change has been done due to the following resolution advised for Java 1.7+ http://infposs.blogspot.kr/2013/06/installcert-and-java-7.html **/ return new X509Certificate[0]; //throw new UnsupportedOperationException(); } public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { throw new UnsupportedOperationException(); } public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { this.chain = chain; tm.checkServerTrusted(chain, authType); } } }
[ "lebezout@gmail.com" ]
lebezout@gmail.com
cde866ed7724df4e5b239de2fd4195e304f65148
6dbc4fc08a4494e3f559887fd6d3607e1ba6b265
/src/main/java/com/dds/model/indicador/IndicadorCompuesto.java
f226b5e8ee8e545308fcdbc757048851c5eab22b
[]
no_license
feded94/dds2017Grupo9
40a3b32a797e1a567d0c62e79d4458f420b2c0b9
e1256a8543af6cef15ed6c0b6f4a3883878f058f
refs/heads/master
2021-01-19T16:45:38.394237
2017-11-29T03:01:21
2017-11-29T03:01:21
88,283,744
0
1
null
null
null
null
UTF-8
Java
false
false
916
java
package com.dds.model.indicador; public class IndicadorCompuesto extends Indicador { private Indicador izq; private Operador op; private Indicador der; protected IndicadorCompuesto(Indicador izq, Operador op, Indicador der) { this.izq = izq; this.op = op; this.der = der; } @Override public double getResultado(String nombreEmpresa, Integer periodo) throws IndicadorException { op.setEmpresa(nombreEmpresa); op.setPeriodo(periodo); return op.operar(izq, der); } @Override public String toString() { return new StringBuilder().append("(") .append(izq.toString()) .append(op.getSimbolo()) .append(der.toString()) .append(")") .toString(); } }
[ "wzfernandochen@gmail.com" ]
wzfernandochen@gmail.com
6d288083cf40114eb1b982a5b827c9e157234ec0
38772e3d16c3c2a15c379969d9a607916a65e7ba
/core/src/com/emistoolbox/common/results/ResultUtil.java
6a4032d42394fcd397438c1241d0ba733e2ac06b
[ "Apache-2.0" ]
permissive
emistoolbox/emistoolbox
2d57aa6189c99f2cbd4f53429c184a4096b3a3ca
c973fc5ebe2607402a0c48b8c548dfe3188b27b9
refs/heads/master
2021-01-19T01:42:40.658255
2019-04-27T19:58:36
2019-04-27T19:58:36
32,792,202
1
0
Apache-2.0
2018-11-26T10:43:07
2015-03-24T10:39:36
Java
UTF-8
Java
false
false
1,517
java
package com.emistoolbox.common.results; import com.emistoolbox.common.results.impl.ResultImpl; public class ResultUtil { public static int[] getIndexes(String[][] headers, String[] indexes) { int[] result = new int[indexes.length]; for (int i = 0; i < indexes.length; i++) { result[i] = getIndex(headers[i], indexes[i]); if (result[i] == -1) { throw new IllegalArgumentException("Failed to find index for '" + indexes[i] + "' in dimension " + i); } } return result; } public static int getIndex(String[] headers, String index) { for (int i = 0; i < headers.length; i++) { if (headers[i].equals(index)) return i; } return -1; } public static Result mergeResults(Result[] results) { int[] dims = new int[results[0].getDimensions() + 1]; for (int i = 0; i < results[0].getDimensions(); i++) dims[i] = results[0].getDimensionSize(i); dims[(dims.length - 1)] = results.length; ResultImpl mergeResult = new ResultImpl(dims); mergeResult.merge(results); return mergeResult; } public static double add(double value1, double value2) { if (Double.isNaN(value1)) return value2; if (Double.isNaN(value2)) return value1; return value1 + value2; } }
[ "murkhog@googlemail.com" ]
murkhog@googlemail.com
338e2c1b279c08c5f40a50ac12c3261ddbaa2e6e
c0a790ad93e9eea328448179fb3e4d70c33a8812
/src/main/java/cn/niter/forum/mapper/NewsMapper.java
9a10790f99224e767871a62199fefa744d782786
[]
permissive
linyu902/NiterForum
282a4032b547ac975d7954e25b50f45ac5a09c3d
402041ac2f7115014ad0604c5a8d3461b6fdde3e
refs/heads/master
2022-08-16T07:32:25.969290
2022-07-27T08:15:07
2022-07-27T08:15:07
242,678,178
0
0
MIT
2022-07-27T19:05:40
2020-02-24T07:59:50
Java
UTF-8
Java
false
false
3,175
java
package cn.niter.forum.mapper; import cn.niter.forum.model.News; import cn.niter.forum.model.NewsExample; import java.util.List; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.session.RowBounds; public interface NewsMapper { /** * This method was generated by MyBatis Generator. * This method corresponds to the database table news * * @mbg.generated Wed Sep 23 18:14:48 CST 2020 */ long countByExample(NewsExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table news * * @mbg.generated Wed Sep 23 18:14:48 CST 2020 */ int deleteByExample(NewsExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table news * * @mbg.generated Wed Sep 23 18:14:48 CST 2020 */ int deleteByPrimaryKey(Long newsId); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table news * * @mbg.generated Wed Sep 23 18:14:48 CST 2020 */ int insert(News record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table news * * @mbg.generated Wed Sep 23 18:14:48 CST 2020 */ int insertSelective(News record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table news * * @mbg.generated Wed Sep 23 18:14:48 CST 2020 */ List<News> selectByExampleWithRowbounds(NewsExample example, RowBounds rowBounds); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table news * * @mbg.generated Wed Sep 23 18:14:48 CST 2020 */ List<News> selectByExample(NewsExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table news * * @mbg.generated Wed Sep 23 18:14:48 CST 2020 */ News selectByPrimaryKey(Long newsId); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table news * * @mbg.generated Wed Sep 23 18:14:48 CST 2020 */ int updateByExampleSelective(@Param("record") News record, @Param("example") NewsExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table news * * @mbg.generated Wed Sep 23 18:14:48 CST 2020 */ int updateByExample(@Param("record") News record, @Param("example") NewsExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table news * * @mbg.generated Wed Sep 23 18:14:48 CST 2020 */ int updateByPrimaryKeySelective(News record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table news * * @mbg.generated Wed Sep 23 18:14:48 CST 2020 */ int updateByPrimaryKey(News record); }
[ "kuang099@qq.com" ]
kuang099@qq.com
f80b4db6ef7d340ae383c7265f84e9babfd62f16
77388d833b05cb106160c7bb7f639b97f604ad79
/Movie_Demo/src/movie_demo/Studio.java
785caba5ae384a772f01dda63248270aecf06367
[]
no_license
teamphoenixCS157B/hibernateProject
a7cb1f08ecae53519bbb4c6250f4e0c9ba017e1b
716383ddf56a63c39f38b66c8a579dd1417a1730
refs/heads/master
2020-06-08T23:37:51.433141
2013-02-11T00:43:29
2013-02-11T00:43:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,385
java
package movie_demo; import java.util.ArrayList; import java.util.List; import javax.persistence.*; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.Query; @Entity public class Studio { private int Studioid; private String name; private String website; private double income; private int year; private List<Movie> Movies; public Studio () {} public Studio(String name, String website, double income, int year) { this.name = name; this.website = website; this.income = income; this.year = year; } @Id @GeneratedValue @Column(name="StudioID") public int getId() { return Studioid; } public void setId(int id) { this.Studioid = id; } @Column(name="StudioName") public String getStudioName() { return name; } public void setStudioName(String name) { this.name = name; } @Column(name="Website") public String getWebsite() { return website; } public void setWebsite(String website) { this.website = website; } @Column(name="Income") public double getIncome() { return income; } public void setIncome(double income) { this.income = income; } @Column(name="Year") public int getyear() { return year; } public void setyear(int year) { this.year = year; } /** * @return the Movies */ @OneToMany(mappedBy="Studio", targetEntity=Movie.class, cascade=CascadeType.ALL, fetch=FetchType.EAGER) public List<Movie> getMovies() { return Movies; } /** * @param Movies the Movies to set */ public void setMovies(List<Movie> Movies) { this.Movies = Movies; } public void printInSession() { Session session = HibernateContext.getSession(); session.update(this); print(); session.close(); } void print() { } public static void load() { Session session = HibernateContext.getSession(); // Load the Student table in a transaction. Transaction tx = session.beginTransaction(); { session.save(new Studio("20th Centrury Fox", "www.foxmovies.com" , 100000 , 1935)); session.save(new Studio("CBS Films", "www.CBSFilms.com" , 2000000 , 2007)); session.save(new Studio("Columbia Pictures", "www.Sonypictures.com" , 50000000 , 1918)); session.save(new Studio("Lionsgate", "www.lionsgate.com" , 63000000 , 1997)); session.save(new Studio("Paramount Pictures", "www.paramount.com" , 300000000 , 1912)); session.save(new Studio("Universal Pictures", "www.universalstudios.com" , 27000000 , 1912)); session.save(new Studio("Warner Bros. Pictures", "www.warnerbros.com" , 1200000000 , 1918)); } tx.commit(); session.close(); System.out.println("Actor table loaded."); } public static Studio getStudio(String StudioName){ Session session = HibernateContext.getSession(); Query query = session.createQuery("from Studio where StudioName = :name"); query.setString("name", StudioName); Studio stud = (Studio) query.uniqueResult(); session.close(); return stud; } }
[ "chars.long@gmail.com" ]
chars.long@gmail.com
4fece559d0bd46de4f55ff31efa8f6e579cb4974
1543384e6b9b714a0fee2cb7d6392ebb39c1c73b
/unit4/src/com/comlumbus/unit4/Unit4Main.java
b33eafa36145cd55db303ffce29b39ba781b671b
[]
no_license
matthewdickens23123/ubit4
163c7d1fff1093e457ef0af63083b4f8a992d4aa
b5dd82d3c293665cd4887c114432dea49d5454b9
refs/heads/master
2023-08-21T08:40:19.365213
2021-10-20T11:55:51
2021-10-20T11:55:51
419,352,033
0
0
null
null
null
null
UTF-8
Java
false
false
532
java
package com.comlumbus.unit4; public class Unit4Main { public static void main(String[] args) { // TODO Auto-generated method stub Unit4_1WhileLoop whileTesting = new Unit4_1WhileLoop(); //whileTesting.whileTest(); //whileTesting.whileTest2(); Unit4_2ForLoop forTesting = new Unit4_2ForLoop(); //forTesting.forLoopTesting(); Unit4_3StringLoops stringLoops = new Unit4_3StringLoops(); stringLoops.stringLoop1(); //stringLoops.vowelCount(); //stringLoops.reverseString(); } }
[ "isoto@columbushs.com" ]
isoto@columbushs.com
e56ada7c1254eb20ddabe0f098de17c95b99cad8
51c5e47f257abe72bc25781008b8c7606314b78a
/Chapter 9 - System Design and Scalability/Problem 2/SocialNetwork.java
cdfb30e828e12c88a61ad1c4dbe4ccd0d527670e
[]
no_license
jeffersonly/CrackingTheCodingInterview-JavaQuestionsTemplate
b3bc2373b443a38c0eb5f73e09bd8c40e2c83c97
6bee3aa8f20a1c4b632c9f554e86953082f2b5b5
refs/heads/master
2023-02-10T01:48:24.553751
2020-08-22T22:34:19
2020-08-22T22:34:19
289,576,921
0
0
null
null
null
null
UTF-8
Java
false
false
295
java
// CTCI Page 145 // How would you design the data structures for a very large social network like // Facebook or Linkedln? Describe how you would design an algorithm to show // the shortest path between two people (e.g., Me -> Bob -> Susan -> Jason -> // You). // Hints: #270, #285, #304, #327
[ "xjlsays@gmail.com" ]
xjlsays@gmail.com
9f23fbb6640186435862b01393be9a143f3e1795
e6c6dbda11899b9d53992786f2ccae11465048c5
/sc/src/main/java/cn/augusto/ch1/di/DiConfig.java
236b1222501d736726e4473444e2af2f8c48e955
[]
no_license
staugust/learnsb
7d57b89b91bfd69e1915f1168249ca4b2e705fe6
32d928c45fd38ad91e01bf8a94d40f7e5b04413a
refs/heads/master
2020-03-20T17:50:24.735420
2018-12-24T07:34:54
2018-12-24T07:34:54
137,566,939
0
0
null
null
null
null
UTF-8
Java
false
false
228
java
package cn.augusto.ch1.di; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration @ComponentScan("cn.augusto.ch1.di") public class DiConfig { }
[ "jinghua.yao@sky-data.cn" ]
jinghua.yao@sky-data.cn
01b8c68ea12582e00710c8fa14b55df5cf5ebf0b
606fe12ddea335ec44cb8faf802ef6ab18ac504a
/Leetcode_reverseKGroup/package-info.java
400527e96d6a02321c487eab41f439fa4bf27fbe
[]
no_license
fdeng001/Interview
85dc2f44cbc6103ce9dede020ec998a7a9750384
642ff7423186b9f6d6dc3772b55fb7fe9d160582
refs/heads/master
2021-01-01T10:14:01.639665
2014-09-24T02:54:02
2014-09-24T02:54:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
69
java
/** * */ /** * @author Fei * */ package Leetcode_reverseKGroup;
[ "c2c3u2@u.northwestern.edu" ]
c2c3u2@u.northwestern.edu
77d8608498019a073fafb85f44d1b0bfdf863f9f
e8d5976996b6441bbf5aebdd4b50e9d4f51ede99
/src/Models/Odd.java
4fc8da0b81d9c081fdb5c5a836a435cdda27f231
[]
no_license
pcardosolei/AS-refactor
924b4c4bab65d2c30d46b3f63167fa7390660d7a
a1e341f8ee7358896765bb355bc28efa483b8b7b
refs/heads/master
2021-01-18T05:05:58.546489
2016-01-07T10:08:41
2016-01-07T10:08:41
48,257,963
0
0
null
null
null
null
UTF-8
Java
false
false
509
java
package Models; public class Odd { private float odd1; private float oddx; private float odd2; public Odd(float odd1, float oddx, float odd2) { this.odd1 = odd1; this.oddx = oddx; this.odd2 = odd2; } public float getOdd1() {return this.odd1;} public void setOdd1(float odd1) {this.odd1 = odd1;} public float getOddx() {return this.oddx;} public void setOddx(float oddx) {this.oddx = oddx;} public float getOdd2() {return this.odd2;} public void setOdd2(float odd2) {this.odd2 = odd2;} }
[ "pcardoso.lei@gmail.com" ]
pcardoso.lei@gmail.com
e2a2d887a63ae65874b7b16df0efec795237be5d
5215259d27c90e363b9db3f626dd9869d5f55c76
/src/day10_swichKey/C1_TernaryTekrar.java
ef20b12c6667228e44337ba406c24faac6a50c70
[]
no_license
testgbt/winter2021turkhish
187dd93ed1cd8c9905870500d6656ef55aebc5aa
f413ec59adbbb36d03e2daf762047f7ed55b2395
refs/heads/master
2023-05-12T13:49:23.598859
2021-05-04T10:36:53
2021-05-04T10:36:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
741
java
package day10_swichKey; import java.util.Scanner; public class C1_TernaryTekrar { public static void main(String[] args) { // Kullanicidan bir sayi alin ve // sayi 3 basamakli pozitif sayi ise “uc basamakli sayi”, yoksa // “Uc basamakli degil” yazdirin Scanner scan = new Scanner(System.in); System.out.println("Lutfen bir tam sayi giriniz"); int sayi = scan.nextInt(); String sonuc = sayi >= 100 ? (sayi < 1000 ? "uc basamakli" : "uc basamakli degil") : "uc basamakli degil"; System.out.println(sonuc); // nested ternary olmasin String sonuc2 = sayi >= 100 && sayi < 1000 || sayi <= -100 && sayi > -1000 ? "uc basamakli" : "uc basamakli degil"; System.out.println(sonuc2); scan.close(); } }
[ "nazlizehradaglar@gmail.com" ]
nazlizehradaglar@gmail.com
5257811cd3154dd7ac2bfa7924f4ba6780bcc56a
445c3cf84dd4bbcbbccf787b2d3c9eb8ed805602
/aliyun-java-sdk-live/src/main/java/com/aliyuncs/live/model/v20161101/SetBoardCallbackRequest.java
abe8ab425ceb59d225911a7a5ed1c1b0bb7fa2fb
[ "Apache-2.0" ]
permissive
caojiele/aliyun-openapi-java-sdk
b6367cc95469ac32249c3d9c119474bf76fe6db2
ecc1c949681276b3eed2500ec230637b039771b8
refs/heads/master
2023-06-02T02:30:02.232397
2021-06-18T04:08:36
2021-06-18T04:08:36
172,076,930
0
0
NOASSERTION
2019-02-22T14:08:29
2019-02-22T14:08:29
null
UTF-8
Java
false
false
3,210
java
/* * 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.aliyuncs.live.model.v20161101; import com.aliyuncs.RpcAcsRequest; import com.aliyuncs.http.MethodType; import com.aliyuncs.live.Endpoint; /** * @author auto create * @version */ public class SetBoardCallbackRequest extends RpcAcsRequest<SetBoardCallbackResponse> { private String authKey; private Integer callbackEnable; private String callbackEvents; private Long ownerId; private String callbackUri; private String appId; private String authSwitch; public SetBoardCallbackRequest() { super("live", "2016-11-01", "SetBoardCallback", "live"); setMethod(MethodType.POST); try { com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointMap").set(this, Endpoint.endpointMap); com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointRegional").set(this, Endpoint.endpointRegionalType); } catch (Exception e) {} } public String getAuthKey() { return this.authKey; } public void setAuthKey(String authKey) { this.authKey = authKey; if(authKey != null){ putQueryParameter("AuthKey", authKey); } } public Integer getCallbackEnable() { return this.callbackEnable; } public void setCallbackEnable(Integer callbackEnable) { this.callbackEnable = callbackEnable; if(callbackEnable != null){ putQueryParameter("CallbackEnable", callbackEnable.toString()); } } public String getCallbackEvents() { return this.callbackEvents; } public void setCallbackEvents(String callbackEvents) { this.callbackEvents = callbackEvents; if(callbackEvents != null){ putQueryParameter("CallbackEvents", callbackEvents); } } public Long getOwnerId() { return this.ownerId; } public void setOwnerId(Long ownerId) { this.ownerId = ownerId; if(ownerId != null){ putQueryParameter("OwnerId", ownerId.toString()); } } public String getCallbackUri() { return this.callbackUri; } public void setCallbackUri(String callbackUri) { this.callbackUri = callbackUri; if(callbackUri != null){ putQueryParameter("CallbackUri", callbackUri); } } public String getAppId() { return this.appId; } public void setAppId(String appId) { this.appId = appId; if(appId != null){ putQueryParameter("AppId", appId); } } public String getAuthSwitch() { return this.authSwitch; } public void setAuthSwitch(String authSwitch) { this.authSwitch = authSwitch; if(authSwitch != null){ putQueryParameter("AuthSwitch", authSwitch); } } @Override public Class<SetBoardCallbackResponse> getResponseClass() { return SetBoardCallbackResponse.class; } }
[ "sdk-team@alibabacloud.com" ]
sdk-team@alibabacloud.com
8b9a06bf1f7091715dde08f7ec0edd7449974967
75768e62b82f366525f309483e156b78ca777150
/Inheritance/src/com/sanjay/Main.java
03b16e8ced24640f7547a8fe5a1aa44175cdf9d9
[]
no_license
sanjay0813/practice
b1af7ab889aa9df4414d3bd9cd18390adf334902
72f0d3b1a70f1f02fc75e97428c4f15d3407ec61
refs/heads/master
2021-01-16T19:11:04.438883
2017-11-11T17:20:45
2017-11-11T17:20:45
100,150,085
0
0
null
null
null
null
UTF-8
Java
false
false
258
java
package com.sanjay; public class Main { public static void main(String[] args) { Animal animal = new Animal("Animal",1,1,5,5); Dog dog = new Dog("Donald", 8,20,2,4,1,20,"long silky"); dog.eat(); dog.walk(); dog.run(); } }
[ "kaflesanajy@hotmail.com" ]
kaflesanajy@hotmail.com
f20590181c646a7d60f09fc18abf16b82cbae1ba
86dced93ffae5598c5a56473a5aaa310db60114b
/app/src/main/java/com/uppergain/mark4/framework/io/XMLdataIO.java
92f6e2d6fc7ac72210b52b36850af4c5661c8606
[]
no_license
ntakimoto/ForexGoMark4
51aba60c4d788d90e0d9c471c7cfc1eef5ceb250
b94d94dc6d1dda6b31e844de5c13f33d95563857
refs/heads/master
2021-05-19T18:29:30.773977
2020-04-16T15:32:58
2020-04-16T15:32:58
252,064,585
0
0
null
null
null
null
UTF-8
Java
false
false
195
java
package com.uppergain.mark4.framework.io; /** * 共通機能<br> * 基底GoF:Strategyパターン * * @author ntakimoto * @version 0.0.1 * @since 2020-02-22 */ public class XMLdataIO { }
[ "n.takimoto.dev@gmail.com" ]
n.takimoto.dev@gmail.com
f8ba7abae5cf7416c95aa292ad6bb4a51830ff50
5d00995d9dcfbe818473743ba6212d0a73dac722
/Practicas/EnvioArchivos/MultifilesTCP/src/Terminal.java
d8b99f11099d43a7e9863083912398ab7fdd38de
[]
no_license
AaronGG11/Aplicaciones-para-comunicaciones-de-red
ad8a6e9ae0a6d43e1534b4897bd133e9df34ec89
b269a60f3cad55187d5293077bab31372a8d612c
refs/heads/master
2023-02-26T11:34:38.989626
2021-02-02T14:49:21
2021-02-02T14:49:21
294,489,174
1
0
null
null
null
null
UTF-8
Java
false
false
2,090
java
import java.io.*; import java.net.Socket; /** * @author Aaron Garcia */ public class Terminal { public static void main(String[] args) { // Configuration values Integer longitud_buffer; Integer numero_archivos; Boolean algoritmo_nigle; // This is just a client StringBuilder LOCAL_PATH = new StringBuilder(); LOCAL_PATH.append("."); LOCAL_PATH.append(File.separator); LOCAL_PATH.append("terminal_files"); LOCAL_PATH.append(File.separator); String nombre = new String(); // Server's credentials to connect String HOST = "localhost"; Integer PORT = 7001; try { Socket cliente = new Socket(HOST, PORT); System.out.println("Cliente: " + cliente.getLocalSocketAddress() + " conectado"); DataInputStream dis = new DataInputStream(cliente.getInputStream()); longitud_buffer = dis.readInt(); numero_archivos = dis.readInt(); algoritmo_nigle = dis.readBoolean(); System.out.println(longitud_buffer); System.out.println(numero_archivos); System.out.println(algoritmo_nigle); byte[] b = new byte[1024]; nombre = dis.readUTF(); System.out.println("Recibimos el archivo:"+nombre); long tam = dis.readLong(); DataOutputStream dos = new DataOutputStream(new FileOutputStream(LOCAL_PATH + nombre)); long recibidos=0; int n, porcentaje; while(recibidos < tam){ n = dis.read(b); dos.write(b,0,n); dos.flush(); recibidos = recibidos + n; porcentaje = (int)(recibidos*100/tam); System.out.print("Recibido: "+porcentaje+"%\r"); }//While System.out.print("\n\nArchivo recibido.\n"); dos.close(); dis.close(); cliente.close(); } catch (IOException e) { e.printStackTrace(); } } }
[ "aarongarcia.ipn.escom@gmail.com" ]
aarongarcia.ipn.escom@gmail.com
8175d4da694173159dcbaedd279eb9b01626f0a6
53e2241c86345742415ed525d00e0c51887095fa
/src/main/java/br/com/zup/ecommerce/autenticacao/LoginForm.java
4f006ea3d72bf14d02e72a46ae257af0e6c44c96
[ "Apache-2.0" ]
permissive
didamendes/orange-talents-04-template-ecommerce
7b100833be4ac717baabf38c9f570925160ab3ab
29dcdaaf142a848018a04561a587d2ddb864e499
refs/heads/main
2023-04-20T23:14:22.316593
2021-05-08T18:59:10
2021-05-08T18:59:10
362,802,866
0
0
Apache-2.0
2021-04-29T12:03:48
2021-04-29T12:03:48
null
UTF-8
Java
false
false
558
java
package br.com.zup.ecommerce.autenticacao; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; public class LoginForm { private String login; private String senha; public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } public String getSenha() { return senha; } public void setSenha(String senha) { this.senha = senha; } public UsernamePasswordAuthenticationToken converter() { return new UsernamePasswordAuthenticationToken(login, senha); } }
[ "didamendes@hotmail.com" ]
didamendes@hotmail.com
fb01b5a2947c18e9386a3413151ad8932f87e83e
8a1ee1eeb1965640180c97363832e55ae2af1cf9
/src/main/java/pageObjects/CustomerRegMsgPage.java
24068f47ef3b27fe6289f301e1c363889b3b6e19
[]
no_license
wangyeee/DataDrivenTesting
f02eb90e6eb39a2d64a0a29e274a2cc5ce2fe3f3
6f7e0ce3bdd94de5f882530b09e55b76d818b90d
refs/heads/master
2020-07-02T08:31:19.765150
2019-08-10T03:56:12
2019-08-10T03:56:12
201,473,391
0
0
null
2019-08-09T13:32:27
2019-08-09T13:32:26
null
UTF-8
Java
false
false
2,585
java
package pageObjects; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.How; public class CustomerRegMsgPage { @FindBy(how = How.XPATH, using = "//*[@id=\"customer\"]/tbody/tr[1]/td/p") WebElement msg; @FindBy(how = How.XPATH, using = "//*[@id=\"customer\"]/tbody/tr[4]/td[2]") WebElement id; @FindBy(how = How.XPATH, using = "//*[@id=\"customer\"]/tbody/tr[5]/td[2]") WebElement name; @FindBy(how = How.XPATH, using = "//*[@id=\"customer\"]/tbody/tr[6]/td[2]") WebElement gender; @FindBy(how = How.XPATH, using = "//*[@id=\"customer\"]/tbody/tr[7]/td[2]") WebElement birth; @FindBy(how = How.XPATH, using = "//*[@id=\"customer\"]/tbody/tr[8]/td[2]") WebElement addr; @FindBy(how = How.XPATH, using = "//*[@id=\"customer\"]/tbody/tr[9]/td[2]") WebElement city; @FindBy(how = How.XPATH, using = "//*[@id=\"customer\"]/tbody/tr[10]/td[2]") WebElement state; @FindBy(how = How.XPATH, using = "//*[@id=\"customer\"]/tbody/tr[11]/td[2]") WebElement pin; @FindBy(how = How.XPATH, using = "//*[@id=\"customer\"]/tbody/tr[12]/td[2]") WebElement mobile; @FindBy(how = How.XPATH, using = "//*[@id=\"customer\"]/tbody/tr[13]/td[2]") WebElement email; @FindBy(how = How.XPATH, using = "//*[@id=\"customer\"]/tbody/tr[14]/td/a") WebElement continueLink; @FindBy(how = How.XPATH, using = "/html/body/p/a") WebElement homeLink; public String getMsg() { return msg.getText(); } public String getId() { System.out.println(id.getText()); return id.getText(); } public String getName() { return name.getText(); } public String getGender() { return gender.getText(); } public String getBirth() { return birth.getText(); } public String getAddress() { return addr.getText(); } public String getCity() { return city.getText(); } public String getState() { return state.getText(); } public String getPin() { return pin.getText(); } public String getMobile() { return mobile.getText(); } public String getEmail() { System.out.println(email.getText()); return email.getText(); } public void clickContinueLink() { continueLink.click(); } public void clickHomeLink() { homeLink.click(); } }
[ "meichen.chow@gmail.com" ]
meichen.chow@gmail.com
96f3053e0c2a1b61d4392006ef1a1ea67d17dd53
c161280b82bd642d0833b1972aa821ec390c749e
/src/main/java/io/rancher/type/NetworkPolicyRuleBetween.java
7948edb7d7bf15c5fcebd4165929a0ece87cde39
[ "Apache-2.0" ]
permissive
bluepeople1/rancher-java-sdk
fcd818a8d1cdb4497c01e0d76e740d94a7338868
2ca01d03786ab3bf4059ef9ca9708a8458fd5843
refs/heads/master
2020-05-03T21:42:39.503310
2017-07-12T19:38:05
2017-07-12T19:38:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
515
java
package io.rancher.type; import io.rancher.base.AbstractType; public class NetworkPolicyRuleBetween extends AbstractType { private String groupBy; private String selector; public String getGroupBy() { return this.groupBy; } public void setGroupBy(String groupBy) { this.groupBy = groupBy; } public String getSelector() { return this.selector; } public void setSelector(String selector) { this.selector = selector; } }
[ "cedric.lamalle@basis.com.br" ]
cedric.lamalle@basis.com.br
269d98ccd21583cfc66ee01f800385c1c2041704
257f6e8b266cfc3bbefec5833209f658413ad446
/Compile.java
af222fa5ec819d786309b3ac83657efd4ecc3a89
[]
no_license
lukeclement/MetaStuff
de5f897b63b3bff66f5ef78eb09fd06904028d5b
1e21f3d220c1f80404c197507111df57ba1026a1
refs/heads/master
2021-01-12T02:47:17.328656
2017-01-05T10:20:02
2017-01-05T10:20:02
78,102,901
0
0
null
null
null
null
UTF-8
Java
false
false
114
java
import java.util.*; import java.io.*; public class Compile{ public static void main(String[] args){ } }
[ "lclement.57468@farnborough.ac.uk" ]
lclement.57468@farnborough.ac.uk
8a5cbc2cb87eeeb12f68dde9b84b1145281f1a1f
50995a7374d257b85a7273679b2c0efe099d202a
/23-1-2020Junit/Springweapp/src/test/java/com/practice/mockito/MathApplication.java
433a19668aff45d4deb432a9cbbe43b23a38dfbd
[]
no_license
GowsalyaSG/Spring-AU-2020
367cd5c9d3448b89c35e0235d3517c96851e0239
5217d7c8ae09d8f73521335340d679dc027733d2
refs/heads/master
2020-12-07T14:19:25.866847
2020-02-03T11:37:16
2020-02-03T11:37:16
232,736,682
0
1
null
2020-01-09T06:17:08
2020-01-09T06:17:07
null
UTF-8
Java
false
false
896
java
package com.practice.mockito; import com.practice.mockito.CalculatorService; public class MathApplication { private CalculatorService calcService; public void setCalculatorService(CalculatorService calcService){ this.calcService = calcService; } public double add(double input1, double input2){ return calcService.add(input1, input2); //return input1 + input2; } public double subtract(double input1, double input2){ return calcService.subtract(input1, input2); //return input1 - input2; } public double multiply(double input1, double input2){ return calcService.multiply(input1, input2); //return input1 * input2; } public double divide(double input1, double input2){ return calcService.divide(input1, input2); //return input1 / input2; } }
[ "noreply@github.com" ]
GowsalyaSG.noreply@github.com
cf74a94e90cdfb087fc040c39274121e0143d472
f2f3caee76e2b5cbd16526a31273abf5909ac055
/src/Stack/Easy/ValidParentheses.java
a65a29361099c31aafea34d20499f852ec354d1f
[]
no_license
JaspreetChhabra/Data-Structure-and-Algorithms-in-Java
3ce2fef71ecc5222caa3bb1f88deec3f1911dd4b
e529c25abc5d629e7278c052b19c2b3ee605d8f9
refs/heads/main
2023-08-06T05:19:34.860745
2021-09-28T19:28:01
2021-09-28T19:28:01
362,185,493
1
0
null
null
null
null
UTF-8
Java
false
false
1,361
java
package Stack.Easy; import java.util.HashMap; import java.util.Stack; // LeetCode 20. Valid Parentheses https://leetcode.com/problems/valid-parentheses/ // // Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. // // An input string is valid if: // // Open brackets must be closed by the same type of brackets. // Open brackets must be closed in the correct order. // // Example 1: // // Input: s = "()" // Output: true public class ValidParentheses { public static boolean isValid(String s) { Stack<Character> bracketsStack = new Stack<>(); HashMap<Character, Character> charHashMap = new HashMap<>(); charHashMap.put(')', '('); charHashMap.put('}', '{'); charHashMap.put(']', '['); for (int i=0; i< s.length(); i++){ char c = s.charAt(i); if(charHashMap.containsKey(c)){ char topElement = bracketsStack.isEmpty() ? '$' : bracketsStack.pop(); if(topElement != charHashMap.get(c)) return false; } else bracketsStack.push(c); } return bracketsStack.isEmpty(); } public static void main(String[] args){ System.out.println(isValid("()[]{}")); System.out.println(isValid("()[]{")); } }
[ "jaspreetchhabra94@gmail.com" ]
jaspreetchhabra94@gmail.com
0e36bbe2b5f7657855708fc2233ddeb82de558a8
5d0302eaa53b9e5443106b4e4b1917fc51d6ab52
/forge-1.6.4-9.11.1.965-src/forge/mcp/src/minecraft/atlantismod/common/WorldProviderAtlantis.java
b6f893d1d2c081c4421cd2117496ab7bb959829e
[]
no_license
jak6jak/atlantis-mod
a064ce43315278ce9ce60d40411a86fc1151f707
0e3aed5e5850d29d2798c92acd4db80c1f220fd6
refs/heads/master
2021-01-15T13:28:33.823951
2014-03-05T00:17:20
2014-03-05T00:17:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
659
java
package atlantismod.common; import net.minecraft.world.WorldProvider; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.WorldChunkManagerHell; import net.minecraft.world.chunk.IChunkProvider; public class WorldProviderAtlantis extends WorldProvider { @Override public String getDimensionName() { return "Atlantis"; } public void registerWorldChunkManager() { this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.ocean, 0.4F, 0.6F); this.dimensionId = AtlantisMod.dimensionID; } public IChunkProvider createChunkGenerator() { return new ChunkProviderAtlantis(worldObj, worldObj.getSeed(), true); } }
[ "gholliday2@hotmail.com" ]
gholliday2@hotmail.com
1e425b9c00f9b82c72be94c9463888a1567e4707
139b22918284b087d946464e98c82f6a732b6fd2
/src/main/java/demo.java
3b64369ea3eebf2b1d19a24ceebba0685208614e
[]
no_license
yufuxin123456/jiangkang_parent
05b07a7c6e943c272e9083467ed8af49902ca1e4
ddb999aadb3a94da10b6dd6e0e5348facd3fb867
refs/heads/master
2022-12-08T10:53:21.411072
2020-08-16T05:31:35
2020-08-16T05:31:35
286,942,396
0
0
null
null
null
null
UTF-8
Java
false
false
376
java
import java.util.HashMap; public class demo { public static void main(String[] args) { String x =""; if (x!=null && "".equals(x)){ System.out.println("全"); }else { System.out.println("不"); } int[] arr = new int[]{1,1,2,3,4,5,6,2,5,1}; HashMap<String, String> map = new HashMap<>(); } }
[ "yufuxin19990101@163.com" ]
yufuxin19990101@163.com
0f570c21740115752080014d7e33f80a01492790
670a444604d8723620682a122dd07c10db3ba3b8
/date-me-api/src/main/java/com/date/me/api/service/impl/Service.java
06ea4f6fcc5f7cda0dea394688bb458c4aa935bd
[]
no_license
distributeShjTest/date-me-server
67c705b5398f4cf190dafcaddeaf199dbdc83ed0
d92c3dcafec8291596262d6cc02f6cabb608633a
refs/heads/master
2020-05-23T03:11:22.419189
2017-03-12T17:38:09
2017-03-12T17:38:09
84,743,926
0
0
null
null
null
null
UTF-8
Java
false
false
2,070
java
package com.date.me.api.service.impl; import com.date.me.api.net.UserMsgSent; import com.date.me.api.protocol.impl.ProtocolAnalyze; import com.date.me.api.protocol.impl.ProtocolPackageImpl; import com.date.me.api.service.Handler; import com.date.me.api.service.MsgRecieveFromNet; import com.date.me.api.service.ProtocolSent; import com.date.me.model.dto.JSONAnalyze; import java.util.List; /** * Created by shj on 17-3-10. */ public class Service implements ProtocolSent,MsgRecieveFromNet{ private ProtocolAnalyze protocolAnalyze; private List<Handler> handlers; private UserMsgSent userMsgSent; private ProtocolPackageImpl protocolPackage; public Service() { } public void sent(JSONAnalyze jsonAnalyze) { } public void recieve(String str, int id,boolean isNullId) throws Exception{ JSONAnalyze jsonAnalyze = null; try { jsonAnalyze =this.protocolAnalyze.analyzePro(str,id); }catch (Exception e){ this.userMsgSent.sentBack(id,this.protocolPackage.protocalError(),isNullId); return; } for(Handler h:handlers){ if(h.getObjectType().equals(jsonAnalyze.getObjectType())){ h.handle(jsonAnalyze,isNullId); } } } public ProtocolAnalyze getProtocolAnalyze() { return protocolAnalyze; } public void setProtocolAnalyze(ProtocolAnalyze protocolAnalyze) { this.protocolAnalyze = protocolAnalyze; } public List<Handler> getHandlers() { return handlers; } public void setHandlers(List<Handler> handlers) { this.handlers = handlers; } public UserMsgSent getUserMsgSent() { return userMsgSent; } public void setUserMsgSent(UserMsgSent userMsgSent) { this.userMsgSent = userMsgSent; } public ProtocolPackageImpl getProtocolPackage() { return protocolPackage; } public void setProtocolPackage(ProtocolPackageImpl protocolPackage) { this.protocolPackage = protocolPackage; } }
[ "hjsong1993@163.com" ]
hjsong1993@163.com
73ddceb4cb05177c9c44ce23265758ab068c1b77
3b6f52e7d6bd560bab49b3272781356648fdf8a4
/src/main/java/tema2/instance0f/Persona.java
38ede2f2b9650b2a908a5b8049560fbfaf297f4c
[]
no_license
Charlinio/JAVA-7
aa1a673dd3a5df319ca979a8040a1c7542a10d69
ede5d80ec5e169b8858806a58ef25574960ca381
refs/heads/master
2020-04-03T05:20:50.802863
2018-10-28T19:46:00
2018-10-28T19:46:00
155,042,618
0
0
null
null
null
null
UTF-8
Java
false
false
52
java
package tema2.instance0f; public class Persona { }
[ "charlytorresg@gmail.com" ]
charlytorresg@gmail.com
fbcd2c77147505b7a507bff49b26475783a71b10
b244c9cafb95205dff582f191c946d0b2cb98c0b
/src/com/massivecraft/massivecore/mson/Mson.java
8c0dbf74fa8be09e4c801fabe33079904df07320
[]
no_license
IMADICK666/MassiveCore
195fb42799dc892c6b4469598cf8b9d974658926
ff8a68b82eb8544039959543af1d7738d6919a0e
refs/heads/master
2020-12-25T23:27:27.985080
2015-06-25T14:11:55
2015-06-27T10:02:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
29,041
java
package com.massivecraft.massivecore.mson; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.ListIterator; import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.inventory.ItemStack; import com.massivecraft.massivecore.Predictate; import com.massivecraft.massivecore.adapter.LowercaseEnumAdapter; import com.massivecraft.massivecore.collections.MassiveList; import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.xlib.gson.Gson; import com.massivecraft.massivecore.xlib.gson.GsonBuilder; import com.massivecraft.massivecore.xlib.gson.JsonElement; public class Mson implements Serializable { // -------------------------------------------- // // CONSTANTS // -------------------------------------------- // private static final long serialVersionUID = 1L; public static final Pattern PARSE_PREFIX = Pattern.compile("\u00A7"); public static final LowercaseEnumAdapter<ChatColor> ADAPTER_LOWERCASE_CHAT_COLOR = LowercaseEnumAdapter.get(ChatColor.class); public static final LowercaseEnumAdapter<MsonEventAction> ADAPTER_LOWERCASE_MSON_EVENT_ACTION = LowercaseEnumAdapter.get(MsonEventAction.class); // -------------------------------------------- // // GSON // -------------------------------------------- // public static final Gson GSON = new GsonBuilder() .disableHtmlEscaping() .registerTypeAdapter(ChatColor.class, ADAPTER_LOWERCASE_CHAT_COLOR) .registerTypeAdapter(MsonEventAction.class, ADAPTER_LOWERCASE_MSON_EVENT_ACTION) .create(); // -------------------------------------------- // // FIELDS // -------------------------------------------- // // FIELD: The Msons text // A parents text can't be null, then Mojang throws an exception. // It does not make sense for something which doesn't have extras // to not have text, because then it doesn't show up at all. protected String text = ""; public String text() { return this.text; } public Mson text(String text) { this.text = Objects.requireNonNull(text); return this; } public boolean textHas() { return ! this.text().isEmpty(); } // FIELD: Color of the mson protected ChatColor color = null; public ChatColor color() { return this.color; } public ChatColor colorEffective() { return color() != null ? color() : colorInherited(); } public ChatColor colorInherited() { return parentHas() ? parent().colorEffective() : null; } public Mson color(ChatColor color) { if (color != null && ! color.isColor()) throw new IllegalArgumentException("Color must be a color."); this.color = color; return this; } // FIELD: bold protected Boolean bold = null; public Boolean bold() { return bold; } public Mson bold(Boolean bold) { this.bold = bold; return this; } public boolean boldEffective() { return bold() != null ? bold() : boldInherited(); } public boolean boldInherited() { return parentHas() && parent().boldEffective(); } // FIELD: italic protected Boolean italic = null; public Boolean italic() { return this.italic; } public Mson italic(Boolean italic) { this.italic = italic; return this; } public boolean italicEffective() { return italic() != null ? italic() : italicInherited(); } protected boolean italicInherited() { return parentHas() && parent().italicEffective(); } // FIELD: underlined protected Boolean underlined = null; public Boolean underlined() { return this.underlined; } public Mson underlined(Boolean underlined) { this.underlined = underlined; return this; } public boolean underlinedEffective() { return italic() != null ? italic() : italicInherited(); } protected boolean underlinedInherited() { return parentHas() && parent().underlinedEffective(); } // FIELD: strikethrough protected Boolean strikethrough = null; public Boolean strikethrough() { return this.strikethrough; } public Mson strikethrough(Boolean strikethrough) { this.strikethrough = strikethrough; return this; } public boolean strikethroughEffective() { return strikethrough() != null ? strikethrough() : strikethroughInherited(); } protected boolean strikethroughInherited() { return parentHas() && parent().strikethroughEffective(); } // FIELD: obfuscated protected Boolean obfuscated = null; public Boolean obfuscated() { return this.obfuscated; } public Mson obfuscated(Boolean obfuscated) { this.obfuscated = obfuscated; return this; } public boolean obfuscatedEffective() { return obfuscated() != null ? obfuscated() : obfuscatedInherited(); } protected boolean obfuscatedInherited() { return parentHas() && parent().obfuscatedEffective(); } // FIELD: The Events which happen when you click, hover over or shift-click the message protected MsonEvent clickEvent = null; public MsonEvent clickEvent() { return this.clickEvent; } public MsonEvent clickEventEffective() { return clickEvent() != null ? clickEvent() : clickEventInherited(); } protected MsonEvent clickEventInherited() { return this.parentHas() ? this.parent().clickEventEffective() : null; } public Mson clickEvent(MsonEvent clickEvent) { if (clickEvent != null && ! clickEvent.isClickEvent()) throw new IllegalArgumentException("ClickEvent may not be a HoverEvent."); this.clickEvent = clickEvent; return this; } protected MsonEvent hoverEvent = null; public MsonEvent hoverEvent() { return this.hoverEvent; } public MsonEvent hoverEventEffective() { return hoverEvent() != null ? hoverEvent() : hoverEventInherited(); } protected MsonEvent hoverEventInherited() { return this.parentHas() ? this.parent().hoverEventEffective() : null; } public Mson hoverEvent(MsonEvent hoverEvent) { if (hoverEvent != null && ! hoverEvent.isHoverEvent()) throw new IllegalArgumentException("HoverEvent may not be a ClickEvent."); this.hoverEvent = hoverEvent; return this; } protected String insertionString = null; public String insertionString() { return this.insertionString; } public String insertionStringEffective() { return insertionString() != null ? insertionString() : insertionStringInherited(); } public Mson insertionString(String insertionString) { this.insertionString = insertionString; return this; } protected String insertionStringInherited() { return this.parentHas() ? this.parent().insertionStringEffective() : null; } // The other parts of the message protected List<Mson> extra = null; public List<Mson> extra() { return this.extra; } public Mson extra(List<Mson> extra) { this.extra = extra; return this; } public boolean extraHas() { return this.extra() != null; } public List<Mson> extraCreative() { if ( ! this.extraHas()) this.extra(new MassiveList<Mson>()); return this.extra(); } // Parent & Root protected transient Mson parent = null; public Mson parent() { return this.parent; } public Mson parent(Mson parent) { this.parent = parent; return this; } public boolean parentHas() { return this.parent() != null; } public Mson parentCreative() { if ( ! this.parentHas()) this.parent(new Mson()); return this.parent(); } public boolean isRoot() { return this.parent() == null; } public Mson root() { Mson root = this; while (true) { Mson parent = root.parent(); if (parent == null) break; root = parent; } return root; } // -------------------------------------------- // // CONVENIENCE MSON EVENT // -------------------------------------------- // public Mson link(String link) { this.clickEvent(MsonEvent.openUrl(link)); return this; } public Mson suggest(String replace) { this.clickEvent(MsonEvent.replace(replace)); return this; } public Mson command(String command) { this.clickEvent(MsonEvent.performCmd(command)); return this; } public Mson tooltip(String tooltip) { this.hoverEvent(MsonEvent.hoverText(text)); return this; } public Mson tooltip(String... tooltip) { this.hoverEvent(MsonEvent.hoverText(text)); return this; } public Mson tooltip(Collection<String> tooltip) { this.hoverEvent(MsonEvent.hoverText(text)); return this; } public Mson tooltipParse(String tooltip) { this.hoverEvent(MsonEvent.hoverTextParse(text)); return this; } public Mson tooltipParse(String... tooltip) { this.hoverEvent(MsonEvent.hoverTextParse(text)); return this; } public Mson tooltipParse(Collection<String> tooltip) { this.hoverEvent(MsonEvent.hoverTextParse(text)); return this; } public Mson tooltip(ItemStack item) { this.hoverEvent(MsonEvent.item(item)); return this; } // -------------------------------------------- // // CONVENIENCE STYLE // -------------------------------------------- // public Mson style(ChatColor... styles) { for (ChatColor style : styles) { this.style(style); } return this; } public Mson style(ChatColor style) { if (style == ChatColor.RESET) return this.removeStyles(); if (style == ChatColor.BOLD) return this.bold(true); if (style == ChatColor.ITALIC) return this.italic(true); if (style == ChatColor.UNDERLINE) return this.underlined(true); if (style == ChatColor.STRIKETHROUGH) return this.strikethrough(true); if (style == ChatColor.MAGIC) return this.obfuscated(true); if (style.isColor()) return this.color(style); throw new UnsupportedOperationException(style.name()); } public Mson removeStyles() { // NOTE: We can't use null. // Since we want to override color and format in parents. this.color = ChatColor.WHITE; this.bold = false; this.italic = false; this.underlined = false; this.strikethrough = false; this.obfuscated = false; return this; } // -------------------------------------------- // // BUILD TREE // -------------------------------------------- // // Child, called on parent or root public Mson addChild(Object child) { if (child == null) throw new NullPointerException("child"); Mson mson = Mson.mson(child); List<Mson> extra = this.extraCreative(); mson.parent(this); extra.add(mson); return mson; // Return child } public Mson addChildren(Object... children) { if (children == null) throw new NullPointerException("children"); for (Object part : children) { this.addChild(part); } return this; // Return this } // Sibling, normally called on child public Mson addSibling(Object sibling) { if (sibling == null) throw new NullPointerException("sibling"); Mson parent = this.parentCreative(); return parent.addChild(sibling); // Return sibling } public Mson addSiblings(Object... siblings) { if (siblings == null) throw new NullPointerException("siblings"); Mson parent = this.parentCreative(); if ( ! parent.equals(this.parent())) this.parent(parent); parent.addChildren(siblings); return this; // Return this } // -------------------------------------------- // // SIMPLE CLEAN // -------------------------------------------- // // These methods, exist to clean up after mistakes. // So they are very forgiving. public boolean isEmpty() { // It has text, not empty. if (this.textHas()) return false; if (this.extraHas()) { for (Mson extra : this.extra()) { // It is null. So kinda empty. if (extra == null) continue; // It is empty if (extra.isEmpty()) continue; // It was not empty. return false; } } // We are empty. return true; } // Detaches uneccessary extras. public Mson simpleClean() { if ( ! this.extraHas()) return this; if (this.extra().isEmpty()) { this.extra(null); return this; } for (ListIterator<Mson> it = this.extra().listIterator(); it.hasNext();) { Mson extra = it.next(); if (extra == null) { it.remove(); continue; } if (extra.isEmpty()) { extra.parent(null); it.remove(); continue; } extra.simpleClean(); } return this; } // -------------------------------------------- // // CONSTRUCT // -------------------------------------------- // public Mson() { } public static Mson mson() { return new Mson(); } public static Mson mson(Object part) { return Mson.getMson(part); } public static Mson mson(Object... parts) { return Mson.getMson(parts); } private static Mson getMson(Object part) { if (part == null) throw new NullPointerException("part"); if (part instanceof Mson) { return (Mson) part; } else if (part instanceof String) { String text = (String) part; return mson().text(text); } else if (part instanceof Collection<?>) { Collection<?> parts = (Collection<?>) part; List<Mson> msons = Mson.msons(parts); if (msons.isEmpty()) return mson(); if (msons.size() == 1) return msons.get(0); return mson().extra(msons); } else if (part instanceof Object[]) { Object[] parts = (Object[]) part; return getMson(Arrays.asList(parts)); } else { throw new IllegalArgumentException("We only accept Strings, Msons, Collections and Arrays."); } } public static List<Mson> msons(Object... parts) { return msons(Arrays.asList(parts)); } public static List<Mson> msons(Iterable<?> parts) { if (parts == null) throw new NullPointerException("parts"); List<Mson> msons = new MassiveList<Mson>(); for (Object part : parts) { msons.add(getMson(part)); } return msons; } public static Mson fromParsedMessage(String message) { if (message == null) throw new NullPointerException("message"); // Everything must have a color. // Because when we split, we assume that each part starts with a color code. // Here we assure it starts with one. message = ensureStartsWithColorCode(message); // We split at color/format change. String[] parts = PARSE_PREFIX.split(message); // Since we start with a color, the first element will be empty. // We don't want that empty element. parts = Arrays.copyOfRange(parts, 1, parts.length); List<Mson> msons = new ArrayList<Mson>(); ChatColor latestColor = null; Boolean bold = null; Boolean italic = null; Boolean underlined = null; Boolean strikethrough = null; Boolean obfuscated = null; for (String part : parts) { ChatColor color = ChatColor.getByChar(part.charAt(0)); String text = part.substring(1); if ((color != null && color.isColor()) || color == ChatColor.RESET) { latestColor = color; bold = null; italic = null; underlined = null; strikethrough = null; obfuscated = null; } if (color == ChatColor.RESET) latestColor = null; else if (color == ChatColor.BOLD) bold = true; else if (color == ChatColor.ITALIC) italic = true; else if (color == ChatColor.UNDERLINE) underlined = true; else if (color == ChatColor.STRIKETHROUGH) strikethrough = true; else if (color == ChatColor.MAGIC) obfuscated = true; // Don't add empty msons. if (text.isEmpty()) continue; Mson mson = new Mson() .text(text) .color(latestColor) .bold(bold) .italic(italic) .underlined(underlined) .strikethrough(strikethrough) .obfuscated(obfuscated); msons.add(mson); } return Mson.mson(msons); } private static String ensureStartsWithColorCode(String message) { if ( ! message.startsWith("\u00A7")) { message = ChatColor.RESET + message; } return message; } // Parse redirects, convert to Mson directly public static Mson parse(String string) { return Mson.fromParsedMessage(Txt.parse(string)); } public static Mson parse(String format, Object... args) { return Mson.fromParsedMessage(Txt.parse(format, args)); } public static Mson format(String format, Object... args) { return Mson.mson().text(String.format(format, args)); } public Mson copy() { Mson copy = new Mson() .text(this.text) .color(this.color) .bold(this.bold) .italic(this.italic) .underlined(this.underlined) .strikethrough(this.strikethrough) .obfuscated(this.obfuscated) .insertionString(this.insertionString) .clickEvent(this.clickEvent) .hoverEvent(this.hoverEvent); if (this.extraHas()) { List<Mson> extras = new MassiveList<Mson>(this.extra.size()); for (Mson extra : this.extra) { Mson extraCopy = extra.copy(); extraCopy.parent(copy); extras.add(extraCopy); } copy.extra(extras); } return copy; } private Mson copyFormatAndBehaviour(Mson ancestor) { if (ancestor == null) throw new NullPointerException("ancestor"); this.color(ancestor.color()); this.bold(ancestor.bold()); this.italic(ancestor.italic()); this.underlined(ancestor.underlined()); this.strikethrough(ancestor.strikethrough()); this.obfuscated(ancestor.obfuscated()); this.hoverEvent(ancestor.hoverEvent()); this.clickEvent(ancestor.clickEvent()); this.insertionString(ancestor.insertionString()); return this; } // -------------------------------------------- // // STRING LIKE METHODS // -------------------------------------------- // // Split public List<Mson> split(String regex) { return this.split(regex, 0); } public List<Mson> split(String regex, int limit) { return split(Pattern.compile(regex), limit); } public List<Mson> split(Pattern pattern) { return this.split(pattern, 0); } public List<Mson> split(Pattern pattern, int limit) { if (pattern == null) throw new NullPointerException("pattern"); boolean limited = (limit == 0 ? false : true); List<Mson> msons = new MassiveList<Mson>(); String[] splited = pattern.split(this.text(), limit); if (splited.length == 1) return new MassiveList<Mson>(this); for (String string : splited) { if (string.isEmpty()) continue; Mson part = new Mson().text(string); part.copyFormatAndBehaviour(this); msons.add(part); } int size = msons.size(); for (Mson part : this.extraCreative()) { if (limited) { limit -= size; if (limit <= 0) break; } List<Mson> innerMsons = part.split(pattern, limit); msons.addAll(innerMsons); size = innerMsons.size(); } return msons; } // Replace public Mson replace(char oldChar, char newChar) { this.text(this.text().replace(oldChar, newChar)); if (this.extraHas()) { for (Mson part : this.extra()) { part.replace(oldChar, newChar); } } return this; } public Mson replace(CharSequence replace, CharSequence replacement) { if (replace == null) throw new NullPointerException("replace"); if (replacement == null) throw new NullPointerException("replacement"); this.text(this.text().replace(replace, replacement)); if (this.extraHas()) { for (Mson part : this.extra()) { part.replace(replace, replacement); } } return this; } public Mson replaceAll(String regex, String replacement) { if (regex == null) throw new NullPointerException("regex"); if (replacement == null) throw new NullPointerException("replacement"); this.text(this.text().replaceAll(regex, replacement)); if (this.extraHas()) { for (Mson part : this.extra()) { part.replaceAll(regex, replacement); } } return this; } // Special replace all // This is old and not the best solution. // Awaiting further decision. /* public Mson replaceAll(String regex, Mson replacement) { if (regex == null) throw new NullPointerException("regex"); if (replacement == null) throw new NullPointerException("replacement"); return this.replaceAllOld(Pattern.compile(regex), replacement); } public Mson replaceAll(Pattern pattern, Mson replacement) { if (pattern == null) throw new NullPointerException("pattern"); if (replacement == null) throw new NullPointerException("replacement"); // We don't want the same object to eventually be part of itself Mson repCopy = replacement.copy(); String text = (this.text() + " "); // Prepare text // Split the string of this msons text and create an iterator // and create the list of mson with the replacements in between ... List<Mson> msons = new MassiveList<Mson>(); for (ListIterator<String> it = Arrays.asList(pattern.split(text)).listIterator(); it.hasNext();) { String string = it.next(); // string might be empty, we don't want these empty msons if ( ! string.isEmpty()) { Mson part = Mson.mson(string); msons.add(part); // Delete security spacing at the last string if ( ! it.hasNext()) part.text(string.substring(0, string.length() - 1)); } // In between every part, add in replacement if (it.hasNext()) msons.add(repCopy); } // ... and forge back together, unless the whole text is "replaced", then set it to be the replacement itself. Mson mson; if ( ! msons.isEmpty()) { mson = msons.get(0).copy(); msons.remove(0); mson.copyFormatAndBehaviour(this); if ( ! msons.isEmpty()) mson.extra(msons); } else { mson = repCopy; } mson.parent(this.parent()); // If there is no extra, return here... List<Mson> extra = this.extra(); if (extra == null) return mson; // ... otherwise iterate over the extra and modify it. for (ListIterator<Mson> it = extra.listIterator(); it.hasNext();) { Mson part = it.next(); int index = extra.indexOf(part); part = part.replaceAll(pattern, replacement); part.parent(mson); extra.set(index, part); } // If the current mson has any extra ... List<Mson> extras = mson.extra(); if( extras != null) { // ... apply tree structure again ... extras.get(extras.size() - 1).extra(extra); } else { // ... set the extra directly ... mson.extra(extra); } mson.simpleClean(); // ... and return recreated mson return mson; }*/ public Mson replaceAll(String regex, Mson replacement) { if (regex == null) throw new NullPointerException("regex"); if (replacement == null) throw new NullPointerException("replacement"); return this.replaceAll(Pattern.compile(regex), replacement); } public Mson replaceAll(Pattern pattern, final Mson replacement) { if (pattern == null) throw new NullPointerException("pattern"); if (replacement == null) throw new NullPointerException("replacement"); MsonReplacement replacer = new MsonReplacement() { @Override public Object getReplacement(String match) { return replacement; } }; return this.replaceAll(pattern, replacer); } public Mson replaceAll(String regex, MsonReplacement replacer) { if (regex == null) throw new NullPointerException("regex"); if (replacer == null) throw new NullPointerException("replacer"); return this.replaceAll(Pattern.compile(regex), replacer); } public Mson replaceAll(Pattern pattern, MsonReplacement replacer) { if (pattern == null) throw new NullPointerException("pattern"); if (replacer == null) throw new NullPointerException("replacer"); Mson ret = mson().copyFormatAndBehaviour(this); List<Mson> msons = new ArrayList<Mson>(); StringBuffer currentString = new StringBuffer(); Matcher matcher = pattern.matcher(text()); while (matcher.find()) { String match = matcher.group(0); Object replacement = replacer.getReplacement(match); // Add the match if (replacement == null) matcher.appendReplacement(currentString, match); // Add the string else if (replacement instanceof String) matcher.appendReplacement(currentString, replacement.toString()); // Add the mson else if (replacement instanceof Mson) { // Fixup current string matcher.appendReplacement(currentString, ""); if (addStringBuffer(msons, currentString)) currentString = new StringBuffer(); // Add this replacement msons.add((Mson) replacement); } // Not allowed else throw new IllegalArgumentException("We only support null, String and Mson."); } // Add the remaining string pieces matcher.appendTail(currentString); addStringBuffer(msons, currentString); // Recurse on extras. if (this.extraHas()) { for (Mson extra : this.extra()) { msons.add(extra.replaceAll(pattern, replacer)); } } // Set extras for (Mson mson : msons) { mson.parent(ret); } ret.extra(msons); return ret; } private static boolean addStringBuffer(List<Mson> msons, StringBuffer buffer) { if (buffer.length() == 0) return false; Mson mson = mson().text(buffer.toString()); msons.add(mson); return true; } public Mson replaceAll(Mson replace, Mson replacement) { if (replace == null) throw new NullPointerException("replace"); if (replacement == null) throw new NullPointerException("replacement"); // We don't want the same object to eventually be part of itself Mson repCopy = replacement.copy(); Mson mson = this; List<Mson> extra = this.extra(); if (mson.equals(replace)) { mson = repCopy; mson.parent(this.parent()); if (extra != null) mson.extraCreative().addAll(extra); } if (extra == null) return mson; for (ListIterator<Mson> it = extra.listIterator(); it.hasNext();) { int index = it.nextIndex(); Mson part = it.next(); part = part.replaceAll(replace, replacement); part.parent(mson); extra.set(index, part); } mson.extra(extra); return mson; } // -------------------------------------------- // // SEND // -------------------------------------------- // // All public boolean sendAll() { return Mixin.messageRawAll(this); } // Predictate public boolean sendPredictate(Predictate<CommandSender> predictate) { return Mixin.messageRawPredictate(predictate, this); } // One public boolean sendOne(Object senderObject) { return Mixin.messageRawOne(senderObject, this); } // -------------------------------------------- // // TO JSON, RAW, PLAIN & STRING // -------------------------------------------- // public JsonElement rootToJson() { return this.root().toJson(); } public JsonElement toJson() { return GSON.toJsonTree(this); } public String rootToRaw() { return this.root().toRaw(); } public String toRaw() { return this.toJson().toString(); } public String toPlain() { StringBuilder ret = new StringBuilder(); ret.append(toPlainSimple(this)); if (this.extraHas()) { for (Mson part : this.extra()) { ret.append(ChatColor.RESET); ret.append(part.toPlain()); } } return ret.toString(); } // Turns a single mson (without it's children) into plain text. protected static String toPlainSimple(Mson mson) { if (mson.textHas()) { // Color must be put in BEFORE formatting. // http://minecraft.gamepedia.com/Formatting_codes#Formatting_codes StringBuilder ret = new StringBuilder(mson.text().length()); if (mson.colorEffective() != null) ret.append(mson.colorEffective()); if (mson.boldEffective()) ret.append(ChatColor.BOLD); if (mson.italicEffective()) ret.append(ChatColor.ITALIC); if (mson.underlinedEffective()) ret.append(ChatColor.UNDERLINE); if (mson.strikethroughEffective()) ret.append(ChatColor.STRIKETHROUGH); if (mson.obfuscatedEffective()) ret.append(ChatColor.MAGIC); ret.append(mson.text()); return ret.toString(); } return ""; } @Override public String toString() { return this.toRaw(); } // -------------------------------------------- // // EQUALS AND HASHCODE // -------------------------------------------- // @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Objects.hashCode(this.text); result = prime * result + Objects.hashCode(this.color); result = prime * result + Objects.hashCode(this.bold); result = prime * result + Objects.hashCode(this.italic); result = prime * result + Objects.hashCode(this.obfuscated); result = prime * result + Objects.hashCode(this.strikethrough); result = prime * result + Objects.hashCode(this.underlined); result = prime * result + Objects.hashCode(this.clickEvent); result = prime * result + Objects.hashCode(this.hoverEvent); result = prime * result + Objects.hashCode(this.insertionString); result = prime * result + Objects.hashCode(this.extra); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if ( ! (obj instanceof Mson)) return false; Mson that = (Mson) obj; if ( ! MUtil.equals(this.text, that.text)) return false; if ( ! MUtil.equals(this.color, that.color)) return false; if ( ! MUtil.equals(this.bold, that.bold)) return false; if ( ! MUtil.equals(this.italic, that.italic)) return false; if ( ! MUtil.equals(this.obfuscated, that.obfuscated)) return false; if ( ! MUtil.equals(this.strikethrough, that.strikethrough)) return false; if ( ! MUtil.equals(this.underlined, that.underlined)) return false; if ( ! MUtil.equals(this.clickEvent, that.clickEvent)) return false; if ( ! MUtil.equals(this.hoverEvent, that.hoverEvent)) return false; if ( ! MUtil.equals(this.insertionString, that.insertionString)) return false; if ( ! MUtil.equals(this.extra, that.extra)) return false; return true; } }
[ "olof@sylt.nu" ]
olof@sylt.nu
ae60053aae1cb62c0381281b380ac677977ab563
86e830d1286878d0ecf1cc8999fa6686b25aea27
/kodilla-exception/src/main/java/com/kodilla/exception/io/FileReaderWithoutHandling.java
451caf798bd8d8a3ee4078deebfe6d2d8e3cec86
[]
no_license
annafiega/Anna-Fiega-kodilla-java
8e9a0bde1c1fc8ff413e551c7fda2f189dbdd44c
b1283b2b59e2a5277f3c47f64a6191e60d385b01
refs/heads/master
2021-10-10T13:48:44.390742
2019-01-11T12:03:48
2019-01-11T12:03:48
115,808,688
1
0
null
2019-01-11T12:03:49
2017-12-30T16:25:23
Java
UTF-8
Java
false
false
535
java
package com.kodilla.exception.io; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.stream.Stream; public class FileReaderWithoutHandling { public void readFile() throws IOException{ ClassLoader classLoader = getClass().getClassLoader(); File file = new File(classLoader.getResource("names.txt").getFile()); Stream<String> fileLines= Files.lines( Paths.get(file.getPath())); fileLines.forEach(System.out::println); } }
[ "annafiega@gmail.com" ]
annafiega@gmail.com
72b37c3dee9b5a532d3fe62ae904c5e0ba9b047d
1f94cf2c467dc08dcc9e3dd52d7eb946879a802c
/Assignment 4 Iterator v2/src/Waitress.java
c6f275f1a0ea49ef0225d3713033a4028cfbf8f6
[]
no_license
FIIRETURRET/OODesign-Assignment4--Iterator
86399944d39329cbf23640a3a4275bcba8cd2fdb
fc1d0a099846303384d9b0d4c2fbef0e4247e962
refs/heads/master
2020-03-29T07:53:53.511975
2018-09-25T19:44:21
2018-09-25T19:44:21
149,684,453
0
0
null
null
null
null
UTF-8
Java
false
false
825
java
public class Waitress { Menu kaibaCardsMenu; Menu yugiCardsMenu; public Waitress(Menu yugiCardsMenu, Menu kaibaCardsMenu) { this.kaibaCardsMenu = kaibaCardsMenu; this.yugiCardsMenu = yugiCardsMenu; } public void printMenu() { Iterator yugiCardsIterator = yugiCardsMenu.createIterator(); Iterator kaibaCardsIterator = kaibaCardsMenu.createIterator(); System.out.println("Yugimoto cards\n"); printMenu(yugiCardsIterator); System.out.println("\nKaiba cards\n"); printMenu(kaibaCardsIterator); } private void printMenu(Iterator iterator) { while (iterator.hasNext()) { MenuItem menuItem = iterator.next(); System.out.print(menuItem.getName() + ", "); System.out.print(menuItem.getType() + " -- "); System.out.println(menuItem.getCardText()); } } }
[ "brandonjoutras@gmail.com" ]
brandonjoutras@gmail.com
c57bfbea6e91db28e7bfffddf50f3a6866991eba
4050d3dab98d6279a5e04f9dc812d2340e0a9c3a
/src/main/java/com/panda/diary/service/UserService.java
3276a88e4d1d0546509e86ca897e57a3fa006d26
[]
no_license
metingun/diary
f8c41a852afcd412eed69752c78e1df332a3ffd3
a37d2d9a0902d437f4124e0f7914f4d49b15b367
refs/heads/master
2022-04-09T16:01:59.916228
2020-03-04T12:42:25
2020-03-04T12:42:25
244,896,726
0
0
null
null
null
null
UTF-8
Java
false
false
2,040
java
package com.panda.diary.service; import com.panda.diary.model.ChangePasswordModel; import com.panda.diary.model.UserInfoModel; import com.panda.diary.repository.UserInfoRepo; import java.util.List; import org.springframework.stereotype.Service; @Service public class UserService { final UserInfoRepo userInfoRepo; private final ReadPropertyService readPropertyService; public UserService(UserInfoRepo userInfoRepo, ReadPropertyService readPropertyService) { this.userInfoRepo = userInfoRepo; this.readPropertyService = readPropertyService; } public String createUser(UserInfoModel userInfoModel, List<UserInfoModel> usersList) { if (usersList != null && usersList.size() != 0) { for (UserInfoModel userInfo : usersList) { if (userInfoModel.getUsername().equals(userInfo.getUsername())) { return readPropertyService.getPropertyValue("1004"); } } } userInfoRepo.save(userInfoModel); return readPropertyService.getPropertyValue("1003"); } public List<UserInfoModel> getUsers() { return userInfoRepo.findAll(); } public String changePassword(ChangePasswordModel changePassword, List<UserInfoModel> usersList) { for (UserInfoModel userInfoModel : usersList) { if (changePassword.getUsername().equals(userInfoModel.getUsername()) && changePassword.getOldPassword().equals(userInfoModel.getPassword())) { userInfoModel.setPassword(changePassword.getNewPassword()); updateDatabaseRow(userInfoModel); return readPropertyService.getPropertyValue("1001"); } } return readPropertyService.getPropertyValue("1002"); } public void updateDatabaseRow(UserInfoModel userInfoModel){ UserInfoModel userInfo = userInfoRepo.getOne(userInfoModel.getId()); userInfo.setPassword(userInfo.getPassword()); userInfoRepo.save(userInfo); } }
[ "metin.gun@metric.net" ]
metin.gun@metric.net
a7cf7614a45de3f2e80c2a7f4fc3b810a38d586a
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/TaskStatisticsForAuditCheck.java
9077beebd4a1b43b8d599a228055d8f8e1b47f2b
[ "Apache-2.0" ]
permissive
aws/aws-sdk-java
2c6199b12b47345b5d3c50e425dabba56e279190
bab987ab604575f41a76864f755f49386e3264b4
refs/heads/master
2023-08-29T10:49:07.379135
2023-08-28T21:05:55
2023-08-28T21:05:55
574,877
3,695
3,092
Apache-2.0
2023-09-13T23:35:28
2010-03-22T23:34:58
null
UTF-8
Java
false
false
12,635
java
/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.iot.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** * <p> * Provides summary counts of how many tasks for findings are in a particular state. This information is included in the * response from DescribeAuditMitigationActionsTask. * </p> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class TaskStatisticsForAuditCheck implements Serializable, Cloneable, StructuredPojo { /** * <p> * The total number of findings to which a task is being applied. * </p> */ private Long totalFindingsCount; /** * <p> * The number of findings for which at least one of the actions failed when applied. * </p> */ private Long failedFindingsCount; /** * <p> * The number of findings for which all mitigation actions succeeded when applied. * </p> */ private Long succeededFindingsCount; /** * <p> * The number of findings skipped because of filter conditions provided in the parameters to the command. * </p> */ private Long skippedFindingsCount; /** * <p> * The number of findings to which the mitigation action task was canceled when applied. * </p> */ private Long canceledFindingsCount; /** * <p> * The total number of findings to which a task is being applied. * </p> * * @param totalFindingsCount * The total number of findings to which a task is being applied. */ public void setTotalFindingsCount(Long totalFindingsCount) { this.totalFindingsCount = totalFindingsCount; } /** * <p> * The total number of findings to which a task is being applied. * </p> * * @return The total number of findings to which a task is being applied. */ public Long getTotalFindingsCount() { return this.totalFindingsCount; } /** * <p> * The total number of findings to which a task is being applied. * </p> * * @param totalFindingsCount * The total number of findings to which a task is being applied. * @return Returns a reference to this object so that method calls can be chained together. */ public TaskStatisticsForAuditCheck withTotalFindingsCount(Long totalFindingsCount) { setTotalFindingsCount(totalFindingsCount); return this; } /** * <p> * The number of findings for which at least one of the actions failed when applied. * </p> * * @param failedFindingsCount * The number of findings for which at least one of the actions failed when applied. */ public void setFailedFindingsCount(Long failedFindingsCount) { this.failedFindingsCount = failedFindingsCount; } /** * <p> * The number of findings for which at least one of the actions failed when applied. * </p> * * @return The number of findings for which at least one of the actions failed when applied. */ public Long getFailedFindingsCount() { return this.failedFindingsCount; } /** * <p> * The number of findings for which at least one of the actions failed when applied. * </p> * * @param failedFindingsCount * The number of findings for which at least one of the actions failed when applied. * @return Returns a reference to this object so that method calls can be chained together. */ public TaskStatisticsForAuditCheck withFailedFindingsCount(Long failedFindingsCount) { setFailedFindingsCount(failedFindingsCount); return this; } /** * <p> * The number of findings for which all mitigation actions succeeded when applied. * </p> * * @param succeededFindingsCount * The number of findings for which all mitigation actions succeeded when applied. */ public void setSucceededFindingsCount(Long succeededFindingsCount) { this.succeededFindingsCount = succeededFindingsCount; } /** * <p> * The number of findings for which all mitigation actions succeeded when applied. * </p> * * @return The number of findings for which all mitigation actions succeeded when applied. */ public Long getSucceededFindingsCount() { return this.succeededFindingsCount; } /** * <p> * The number of findings for which all mitigation actions succeeded when applied. * </p> * * @param succeededFindingsCount * The number of findings for which all mitigation actions succeeded when applied. * @return Returns a reference to this object so that method calls can be chained together. */ public TaskStatisticsForAuditCheck withSucceededFindingsCount(Long succeededFindingsCount) { setSucceededFindingsCount(succeededFindingsCount); return this; } /** * <p> * The number of findings skipped because of filter conditions provided in the parameters to the command. * </p> * * @param skippedFindingsCount * The number of findings skipped because of filter conditions provided in the parameters to the command. */ public void setSkippedFindingsCount(Long skippedFindingsCount) { this.skippedFindingsCount = skippedFindingsCount; } /** * <p> * The number of findings skipped because of filter conditions provided in the parameters to the command. * </p> * * @return The number of findings skipped because of filter conditions provided in the parameters to the command. */ public Long getSkippedFindingsCount() { return this.skippedFindingsCount; } /** * <p> * The number of findings skipped because of filter conditions provided in the parameters to the command. * </p> * * @param skippedFindingsCount * The number of findings skipped because of filter conditions provided in the parameters to the command. * @return Returns a reference to this object so that method calls can be chained together. */ public TaskStatisticsForAuditCheck withSkippedFindingsCount(Long skippedFindingsCount) { setSkippedFindingsCount(skippedFindingsCount); return this; } /** * <p> * The number of findings to which the mitigation action task was canceled when applied. * </p> * * @param canceledFindingsCount * The number of findings to which the mitigation action task was canceled when applied. */ public void setCanceledFindingsCount(Long canceledFindingsCount) { this.canceledFindingsCount = canceledFindingsCount; } /** * <p> * The number of findings to which the mitigation action task was canceled when applied. * </p> * * @return The number of findings to which the mitigation action task was canceled when applied. */ public Long getCanceledFindingsCount() { return this.canceledFindingsCount; } /** * <p> * The number of findings to which the mitigation action task was canceled when applied. * </p> * * @param canceledFindingsCount * The number of findings to which the mitigation action task was canceled when applied. * @return Returns a reference to this object so that method calls can be chained together. */ public TaskStatisticsForAuditCheck withCanceledFindingsCount(Long canceledFindingsCount) { setCanceledFindingsCount(canceledFindingsCount); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getTotalFindingsCount() != null) sb.append("TotalFindingsCount: ").append(getTotalFindingsCount()).append(","); if (getFailedFindingsCount() != null) sb.append("FailedFindingsCount: ").append(getFailedFindingsCount()).append(","); if (getSucceededFindingsCount() != null) sb.append("SucceededFindingsCount: ").append(getSucceededFindingsCount()).append(","); if (getSkippedFindingsCount() != null) sb.append("SkippedFindingsCount: ").append(getSkippedFindingsCount()).append(","); if (getCanceledFindingsCount() != null) sb.append("CanceledFindingsCount: ").append(getCanceledFindingsCount()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof TaskStatisticsForAuditCheck == false) return false; TaskStatisticsForAuditCheck other = (TaskStatisticsForAuditCheck) obj; if (other.getTotalFindingsCount() == null ^ this.getTotalFindingsCount() == null) return false; if (other.getTotalFindingsCount() != null && other.getTotalFindingsCount().equals(this.getTotalFindingsCount()) == false) return false; if (other.getFailedFindingsCount() == null ^ this.getFailedFindingsCount() == null) return false; if (other.getFailedFindingsCount() != null && other.getFailedFindingsCount().equals(this.getFailedFindingsCount()) == false) return false; if (other.getSucceededFindingsCount() == null ^ this.getSucceededFindingsCount() == null) return false; if (other.getSucceededFindingsCount() != null && other.getSucceededFindingsCount().equals(this.getSucceededFindingsCount()) == false) return false; if (other.getSkippedFindingsCount() == null ^ this.getSkippedFindingsCount() == null) return false; if (other.getSkippedFindingsCount() != null && other.getSkippedFindingsCount().equals(this.getSkippedFindingsCount()) == false) return false; if (other.getCanceledFindingsCount() == null ^ this.getCanceledFindingsCount() == null) return false; if (other.getCanceledFindingsCount() != null && other.getCanceledFindingsCount().equals(this.getCanceledFindingsCount()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getTotalFindingsCount() == null) ? 0 : getTotalFindingsCount().hashCode()); hashCode = prime * hashCode + ((getFailedFindingsCount() == null) ? 0 : getFailedFindingsCount().hashCode()); hashCode = prime * hashCode + ((getSucceededFindingsCount() == null) ? 0 : getSucceededFindingsCount().hashCode()); hashCode = prime * hashCode + ((getSkippedFindingsCount() == null) ? 0 : getSkippedFindingsCount().hashCode()); hashCode = prime * hashCode + ((getCanceledFindingsCount() == null) ? 0 : getCanceledFindingsCount().hashCode()); return hashCode; } @Override public TaskStatisticsForAuditCheck clone() { try { return (TaskStatisticsForAuditCheck) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.iot.model.transform.TaskStatisticsForAuditCheckMarshaller.getInstance().marshall(this, protocolMarshaller); } }
[ "" ]
07fac744c14def7619218850d20be2504ae0b797
cb68a35c5d70c7528f6ca32e63654de4b602a421
/src/biochemie/pcr/io/USCDParser.java
249e28e85117383c974c3a6ecd0ab363b08f37a7
[]
no_license
smee/assaydesign
58edc96ea7f60b858fa037c885ff1fab34cb499d
5f3071866f3733834aa22f84a9031100788ec1ae
refs/heads/master
2016-08-03T13:59:45.119696
2006-04-13T11:17:06
2006-04-13T11:17:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,256
java
/* * Created on 25.10.2003 * */ package biochemie.pcr.io; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; /** * * @author Steffen * */ public class USCDParser { String sequence; public USCDParser(String filename) throws IOException { BufferedReader br= new BufferedReader(new FileReader(filename)); String temp; StringBuffer sb=new StringBuffer(); while(null != (temp = br.readLine())) { if('>' != temp.charAt(0)) sb.append(temp); } sequence=sb.toString(); } public String getRepetetiveSeqsAsString() { StringBuffer sb=new StringBuffer(); int start=0; int end=0; int index=-1; while(index++!=sequence.length()-1) { if(Character.isLowerCase(sequence.charAt(index))) { start=index; while(index++!=sequence.length()-1) { if(Character.isUpperCase(sequence.charAt(index))) { end=index; sb.append(""+start+','+(end-start)+' '); break; } } } } return sb.toString(); } }
[ "dienst" ]
dienst
b57b46b773dee1932ea446f16f367543ee7e0ec2
9af3a18d922ecd3558ada49d670718d1c9d509f3
/src/main/java/com/bolsadeideas/springboot/datajpa/app/springbootdatajpa/models/entity/Role.java
ea9006da4f6101eb8b8034b62212d22ff578b81e
[]
no_license
davis2isra/springboot-security-cl
c6dae64034c3d027196143fd9d247aae7dafba6f
ced442b1d24fa396fde11c29fec3cf0422799ff8
refs/heads/main
2023-03-30T02:17:25.931255
2021-04-07T02:49:32
2021-04-07T02:49:32
355,391,690
0
0
null
null
null
null
UTF-8
Java
false
false
697
java
package com.bolsadeideas.springboot.datajpa.app.springbootdatajpa.models.entity; import javax.persistence.*; @Entity @Table(name = "authorities", uniqueConstraints = {@UniqueConstraint(columnNames = {"user_id", "authority"})}) public class Role { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String authority; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getAuthority() { return authority; } public void setAuthority(String authority) { this.authority = authority; } public static final long serialVersionUID = 1L; }
[ "israelvencesmondragon@gmail.com" ]
israelvencesmondragon@gmail.com
9815ba108ae148efe2777bd9a6c4cfa0127fac67
af0cc1710019ce2db2560bfbe2c4b73af4f865bc
/learnBroadcast/app/src/test/java/com/example/liuyi/learnbroadcast/ExampleUnitTest.java
d723922637341bd2209c20344d541667869e2202
[]
no_license
jiyeershi/AndroidProject
5c4ec443daf9f996f9a5d4f591588bce578272c2
0f623f084e9542108540182a0dd55537a195d8f6
refs/heads/master
2021-08-23T10:17:32.374500
2017-11-12T06:11:07
2017-11-12T06:11:07
110,404,600
0
0
null
null
null
null
UTF-8
Java
false
false
325
java
package com.example.liuyi.learnbroadcast; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "liuyi-124772115@163.com" ]
liuyi-124772115@163.com
b2e652d7352a9b79ab3fb73475b70202faf55832
610482bd0ab4dfc6e3d9726e9776e067a59dc8aa
/SpringDataJpa2/src/main/java/xyz/durianyang/dao/LinkManDao.java
61079ecd73b2e5c55ae5605b945b9fafb877e142
[]
no_license
Durianyang/springdata
f812e95ae459afb58cb1091c92891990dd38a7ca
2a69f94513b80410251f3b7c5a989aa938d0001e
refs/heads/master
2022-12-21T14:12:30.477596
2019-09-24T16:01:43
2019-09-24T16:01:43
210,313,328
0
0
null
2022-12-16T04:25:28
2019-09-23T09:17:41
Java
UTF-8
Java
false
false
422
java
package xyz.durianyang.dao; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.stereotype.Repository; import xyz.durianyang.entity.LinkMan; /** * @author Durian * @date 2019-09-24 18:24 */ @Repository public interface LinkManDao extends JpaRepository<LinkMan, Long>, JpaSpecificationExecutor<LinkMan> { }
[ "49614355+Durianyang@users.noreply.github.com" ]
49614355+Durianyang@users.noreply.github.com
4d69fe085d10468eff05cc6d63a36783e2e63682
bfcbffb51173300863ac20b526cbee3f3fe3dd4d
/HomeWork/Spring_homework_06_Spring_JDBC/src/main/java/com/it_uatech/shell/BookShell.java
d08e0f3b66070d8dd4b7c51ec984570a48b54724
[]
no_license
ituatech/SpringMainCourse
cf190b12a48ffa2d155287ae61293c8daa734f03
3d2f7d47f98bd894ca067dc4a87f6965894c491d
refs/heads/master
2022-12-30T04:19:19.283164
2020-07-28T07:37:06
2020-07-28T07:37:06
265,321,441
0
0
null
2020-10-13T22:48:44
2020-05-19T17:52:30
Java
UTF-8
Java
false
false
1,378
java
package com.it_uatech.shell; import com.it_uatech.services.BookService; import org.springframework.shell.standard.ShellComponent; import org.springframework.shell.standard.ShellMethod; import org.springframework.shell.standard.ShellOption; @ShellComponent public class BookShell { private final BookService bookService; public BookShell(BookService bookService) { this.bookService = bookService; } @ShellMethod("Book count") public int bookCount(){ return bookService.count(); } @ShellMethod("Book get by id") public String bookGetById(@ShellOption int id){ return bookService.getById(id).toString(); } @ShellMethod("Book delete by id") public void bookDeleteById(@ShellOption int id){ bookService.deleteById(id); } @ShellMethod("Book insert") public void bookInsert(@ShellOption int id, @ShellOption String name, @ShellOption String description, @ShellOption int authorId, @ShellOption String firstName, @ShellOption String secondName, @ShellOption int genreId, @ShellOption String genreName){ bookService.insert(id, name, description, authorId, firstName, secondName, genreId, genreName); } @ShellMethod("Book list") public String bookList(){ return bookService.getAllBook().toString(); } }
[ "53702365+ituatech@users.noreply.github.com" ]
53702365+ituatech@users.noreply.github.com
5fae85711054227105fb7624997ae0fa07561411
e570c9e935103cfca3448a0bf497a62f8dd1a365
/Java/1002.查找常用字符.java
6b9b09923d66cae83c95a581f07cd4a2be5cc35f
[]
no_license
Whalone/JavaBook
3c49a41e0647b074bed06b09e8fd6e52cf070d06
fe4a909f7468bee7cd758a83293c2402897ebedb
refs/heads/main
2023-01-13T02:07:37.413870
2020-11-09T01:44:55
2020-11-09T01:44:55
302,554,867
0
0
null
null
null
null
UTF-8
Java
false
false
375
java
/* * @lc app=leetcode.cn id=1002 lang=java * * [1002] 查找常用字符 */ // @lc code=start class Solution { public List<String> commonChars(String[] A) { int[][] charsNum = new int[A.length][A.length]; for(int i = 0;i<A.length;i++){ for(char cha : A[i].toCharArray()){ } } } } // @lc code=end
[ "469716638@qq.com" ]
469716638@qq.com
e84a3a2b9ec6fbefa6d458c467bcfe91b1f4203d
03f6dbc0ca24a26b8bb16f53991b5f5d7685f3a2
/src/test/java/com/example/demo/controller/HelloControllerTest.java
d38df17e0db145d296c0e9fa4eda57653b174ba5
[]
no_license
fzu-hhj/demo
2cee9a5fa7d2697888f9f181ccca4bcbfbec26c1
d86a8646bd69c871bb4d5a18027cfd49e6d9f0e4
refs/heads/master
2023-02-03T07:42:13.086517
2020-12-21T15:51:33
2020-12-21T15:51:33
323,369,384
0
0
null
null
null
null
UTF-8
Java
false
false
693
java
package com.example.demo.controller; import com.example.demo.bean.Person; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import static org.junit.Assert.*; @RunWith(SpringRunner.class) @SpringBootTest public class HelloControllerTest { @Autowired private Person person; @Before public void setUp() throws Exception { } @After public void tearDown() throws Exception { } @Test public void hello() { } }
[ "2571402106@qq.com" ]
2571402106@qq.com
ff0507bc1eb4ebd776c24a1fbd636c1a89bf9f36
038ee6b20cae51169a2ed4ed64a7b8e99b5cbaad
/schemaOrgDoma/src/org/kyojo/schemaorg/m3n4/auto/impl/ROOF_LOAD.java
d09280199f1387af11778efe79fea607ff2e8031
[ "Apache-2.0" ]
permissive
nagaikenshin/schemaOrg
3dec1626781913930da5585884e3484e0b525aea
4c9d6d098a2741c2dc2a814f1c708ee55c36e9a8
refs/heads/master
2021-06-25T04:52:49.995840
2019-05-12T06:22:37
2019-05-12T06:22:37
134,319,974
1
0
null
null
null
null
UTF-8
Java
false
false
6,769
java
package org.kyojo.schemaorg.m3n4.auto.impl; import java.util.ArrayList; import java.util.List; import org.kyojo.schemaorg.SimpleJsonBuilder; import org.kyojo.schemaorg.m3n4.auto.Container; import org.kyojo.schemaorg.m3n4.core.Clazz.QuantitativeValue; import org.kyojo.schemaorg.m3n4.core.Container.Name; import org.kyojo.schemaorg.m3n4.core.impl.QUANTITATIVE_VALUE; import org.kyojo.schemaorg.m3n4.pending.Clazz.MonetaryAmountDistribution; import org.kyojo.schemaorg.m3n4.pending.Clazz.QuantitativeValueDistribution; import org.seasar.doma.Transient; public class ROOF_LOAD implements Container.RoofLoad { private static final long serialVersionUID = 1L; @Transient public List<MonetaryAmountDistribution> monetaryAmountDistributionList; @Transient public List<QuantitativeValue> quantitativeValueList; @Transient public List<QuantitativeValueDistribution> quantitativeValueDistributionList; public ROOF_LOAD() { } public ROOF_LOAD(String string) { this(new QUANTITATIVE_VALUE(string)); } public String getString() { if(quantitativeValueList == null || quantitativeValueList.size() == 0 || quantitativeValueList.get(0) == null) { return null; } else { Name name = quantitativeValueList.get(0).getName(); if(name == null || name.getTextList() == null || name.getTextList().size() == 0 || name.getTextList().get(0) == null) { return null; } else { return name.getTextList().get(0).getString(); } } } public void setString(String string) { if(quantitativeValueList == null) { quantitativeValueList = new ArrayList<QuantitativeValue>(); } if(quantitativeValueList.size() == 0) { quantitativeValueList.add(new QUANTITATIVE_VALUE(string)); } else { quantitativeValueList.set(0, new QUANTITATIVE_VALUE(string)); } } public ROOF_LOAD(MonetaryAmountDistribution monetaryAmountDistribution) { monetaryAmountDistributionList = new ArrayList<MonetaryAmountDistribution>(); monetaryAmountDistributionList.add(monetaryAmountDistribution); } @Override public MonetaryAmountDistribution getMonetaryAmountDistribution() { if(monetaryAmountDistributionList != null && monetaryAmountDistributionList.size() > 0) { return monetaryAmountDistributionList.get(0); } else { return null; } } @Override public void setMonetaryAmountDistribution(MonetaryAmountDistribution monetaryAmountDistribution) { if(monetaryAmountDistributionList == null) { monetaryAmountDistributionList = new ArrayList<>(); } if(monetaryAmountDistributionList.size() == 0) { monetaryAmountDistributionList.add(monetaryAmountDistribution); } else { monetaryAmountDistributionList.set(0, monetaryAmountDistribution); } } @Override public List<MonetaryAmountDistribution> getMonetaryAmountDistributionList() { return monetaryAmountDistributionList; } @Override public void setMonetaryAmountDistributionList(List<MonetaryAmountDistribution> monetaryAmountDistributionList) { this.monetaryAmountDistributionList = monetaryAmountDistributionList; } @Override public boolean hasMonetaryAmountDistribution() { return monetaryAmountDistributionList != null && monetaryAmountDistributionList.size() > 0 && monetaryAmountDistributionList.get(0) != null; } public ROOF_LOAD(QuantitativeValue quantitativeValue) { quantitativeValueList = new ArrayList<QuantitativeValue>(); quantitativeValueList.add(quantitativeValue); } @Override public QuantitativeValue getQuantitativeValue() { if(quantitativeValueList != null && quantitativeValueList.size() > 0) { return quantitativeValueList.get(0); } else { return null; } } @Override public void setQuantitativeValue(QuantitativeValue quantitativeValue) { if(quantitativeValueList == null) { quantitativeValueList = new ArrayList<>(); } if(quantitativeValueList.size() == 0) { quantitativeValueList.add(quantitativeValue); } else { quantitativeValueList.set(0, quantitativeValue); } } @Override public List<QuantitativeValue> getQuantitativeValueList() { return quantitativeValueList; } @Override public void setQuantitativeValueList(List<QuantitativeValue> quantitativeValueList) { this.quantitativeValueList = quantitativeValueList; } @Override public boolean hasQuantitativeValue() { return quantitativeValueList != null && quantitativeValueList.size() > 0 && quantitativeValueList.get(0) != null; } public ROOF_LOAD(QuantitativeValueDistribution quantitativeValueDistribution) { quantitativeValueDistributionList = new ArrayList<QuantitativeValueDistribution>(); quantitativeValueDistributionList.add(quantitativeValueDistribution); } @Override public QuantitativeValueDistribution getQuantitativeValueDistribution() { if(quantitativeValueDistributionList != null && quantitativeValueDistributionList.size() > 0) { return quantitativeValueDistributionList.get(0); } else { return null; } } @Override public void setQuantitativeValueDistribution(QuantitativeValueDistribution quantitativeValueDistribution) { if(quantitativeValueDistributionList == null) { quantitativeValueDistributionList = new ArrayList<>(); } if(quantitativeValueDistributionList.size() == 0) { quantitativeValueDistributionList.add(quantitativeValueDistribution); } else { quantitativeValueDistributionList.set(0, quantitativeValueDistribution); } } @Override public List<QuantitativeValueDistribution> getQuantitativeValueDistributionList() { return quantitativeValueDistributionList; } @Override public void setQuantitativeValueDistributionList(List<QuantitativeValueDistribution> quantitativeValueDistributionList) { this.quantitativeValueDistributionList = quantitativeValueDistributionList; } @Override public boolean hasQuantitativeValueDistribution() { return quantitativeValueDistributionList != null && quantitativeValueDistributionList.size() > 0 && quantitativeValueDistributionList.get(0) != null; } public ROOF_LOAD(List<MonetaryAmountDistribution> monetaryAmountDistributionList, List<QuantitativeValue> quantitativeValueList, List<QuantitativeValueDistribution> quantitativeValueDistributionList) { setMonetaryAmountDistributionList(monetaryAmountDistributionList); setQuantitativeValueList(quantitativeValueList); setQuantitativeValueDistributionList(quantitativeValueDistributionList); } public void copy(Container.RoofLoad org) { setMonetaryAmountDistributionList(org.getMonetaryAmountDistributionList()); setQuantitativeValueList(org.getQuantitativeValueList()); setQuantitativeValueDistributionList(org.getQuantitativeValueDistributionList()); } @Override public String getNativeValue() { return getString(); } @Override public String toString() { return SimpleJsonBuilder.toJson(this); } }
[ "nagai@nagaikenshin.com" ]
nagai@nagaikenshin.com
fc3d5f60a6d430cf51937103c56b04709c981b45
52304dc90d359c150919252aec9fc4f553a605b2
/inheritance/Mahasiswa.java
58f07532f2ea5d02eeb40dcc2afc5479b03d9087
[]
no_license
harkespan/pbo
f4eabd7a8fa7ae6e8cbb87a87d18e65d3417d140
1438867a467846e27d92cab21cf4c83971d0cc1d
refs/heads/master
2023-06-26T02:48:12.345308
2023-06-23T05:46:02
2023-06-23T05:46:02
364,138,763
6
13
null
2022-04-05T14:02:57
2021-05-04T04:27:35
Java
UTF-8
Java
false
false
606
java
package inheritance; public class Mahasiswa{ String nim; String nama; int usia; public Mahasiswa(String nim, String nama, int usia){ this.nim = nim; this.nama = nama; this.usia = usia; } public void mengumpulkanTugas() { System.out.println(nama+" mengumpulkan tugas"); } public void mengikutiKuliah() { System.out.println(nama+" sedang mengikuti kuliah"); } public void cetak(){ System.out.println("NIM: "+nim); System.out.println("Nama: "+nama); System.out.println("Usia: "+usia); } }
[ "octone.harry@gmail.com" ]
octone.harry@gmail.com
0b1f9ee49f9addd8a9cfc303ef3459d160093a79
025190a5a5b06c820a67dffb8e6a58c16a0130b4
/java/src/main/java/org/examples/algorithms/dp/StockMaximize.java
bb5e0fc810ddde417f5bccc4a391ccb02c44097e
[]
no_license
stormy-ua/algorithms
c6064bf59893cc4c0a5a8dd7c4bd472819b643c9
bb1cfa72536ca7ebfc201795febd9b2bb8b62510
refs/heads/master
2023-03-22T02:07:51.537571
2021-03-21T14:12:59
2021-03-21T14:12:59
111,160,153
0
0
null
null
null
null
UTF-8
Java
false
false
2,531
java
package org.examples.algorithms.dp; import java.io.FileInputStream; import java.util.Arrays; import java.util.Scanner; public class StockMaximize { public static final int MIN_PRICE = 1; public static final int MAX_PRICE = 100000; private static int[] buildMaxPriceLookup(int[] prices) { int N = prices.length; int[] lookup = new int[N]; lookup[N - 1] = MIN_PRICE - 1; for (int t = N - 1; t >= 1; --t) { lookup[t - 1] = Math.max(prices[t], lookup[t]); } return lookup; } public static long optimize(int[] prices) { int N = prices.length; int[] maxPriceLookup = buildMaxPriceLookup(prices); long shares = 0; long profit = 0; for(int t = 0; t < N; ++t) { if(prices[t] < maxPriceLookup[t]) { // BUY shares++; profit -= prices[t]; System.out.println(String.format("time=%d: buying @ %d, profit = %d", t, prices[t], profit)); } else if(prices[t] > maxPriceLookup[t] && shares > 0) { System.out.println(String.format("time=%d: selling %d shares @ %d, profit = %d ", t, shares, prices[t], profit)); // SELL profit += Math.multiplyExact(shares, prices[t]); shares = 0; } else { System.out.println(String.format("time=%d: holding ", t)); } } return profit; } public static void main(String[] args) { int[] prices = { 1, 3, 1, 2 }; //int[] prices = { 1, 2, 100 }; //int[] prices = { 5, 3, 2 }; int N = prices.length; int[] maxPriceLookup = buildMaxPriceLookup(prices); System.out.println(Arrays.toString(maxPriceLookup)); long maxProfit = optimize(prices); System.out.println(String.format("max profit = %d", maxProfit)); } /*public static void main(String[] args) throws Exception { Scanner in = new Scanner(new FileInputStream("/Users/panarky/Projects/tmp/stockMaximize.input.txt")); int t = in.nextInt(); for(int a0 = 0; a0 < t; a0++){ int n = in.nextInt(); int[] arr = new int[n]; for(int arr_i = 0; arr_i < n; arr_i++){ arr[arr_i] = in.nextInt(); } if (a0 == 3) { long maxProfit = optimize(arr); System.out.println(maxProfit); } } in.close(); }*/ }
[ "kirill.panarin@gmail.com" ]
kirill.panarin@gmail.com
40dec3f25cb1bec0ee96d2c09829baf068bf5865
90372da1b8cf6c00fc5deeb464af3c2a809122b0
/src/main/java/com/famousbeejay/spring/versioning/VersioningPersonController.java
4f6817644379c89cc01e9c580b8330ae7fd21550
[]
no_license
omabolaji/spring-boot-project
4a4d420dd937247e2318ffaf43fa7fa4fd13a345
a10703737a054b999088d3ed9fe57561482ca27f
refs/heads/master
2021-01-08T00:36:31.968523
2020-02-20T11:13:24
2020-02-20T11:13:24
241,863,125
0
0
null
null
null
null
UTF-8
Java
false
false
1,714
java
package com.famousbeejay.spring.versioning; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class VersioningPersonController { @GetMapping("/v1/person") public PersonV1 personv1() { return new PersonV1("Folake kemi"); } @GetMapping("/v2/person") public PersonV2 personv2() { return new PersonV2(new Name("Bolaji", "Folami")); } //using params to pass the version @GetMapping(value="/person/params", params="version=1" ) public PersonV1 paramv1() { return new PersonV1("Folake kemi"); } //using params to pass the version @GetMapping(value="/person/params", params="version=2") public PersonV2 paramv2() { return new PersonV2(new Name("Bolaji", "Folami")); } //using headers to pass the version @GetMapping(value="/person/headers", headers="X-API-VERSION=1" ) public PersonV1 headerV1() { return new PersonV1("Folake kemi"); } //using headers to pass the version @GetMapping(value="/person/headers", headers="X-API-VERSION=2") public PersonV2 headerV2() { return new PersonV2(new Name("Bolaji", "Folami")); } //using produces to pass the version //you can use xml or json @GetMapping(value="/person/produces", produces ="application/vnd.company.app-v1+xml" ) public PersonV1 producesV1() { return new PersonV1("Folake kemi"); } //using produces to pass the version //you can use xml or json @GetMapping(value="/person/produces", produces ="application/vnd.company.app-v2+xml" ) public PersonV2 producesV2() { return new PersonV2(new Name("Bolaji", "Folami")); } }
[ "oyewumibolajimuftau@gmail.com" ]
oyewumibolajimuftau@gmail.com
d426edd2c597af8fb05ab8dc44c977440e37a738
0b82dcd8f075e0053aaf6b29372bb16c4d653b3c
/src/com/esprit/PI_Sprint3_Mobile/GUI/responsableCategorie/ResponsableCategorieShowForm.java
ad0412e499b06c3dc4fdf6168974e5b6718c45cd
[]
no_license
bassem97/3A23_PI_Sprint3_Mobile
03783becdf5d492ab93fd1c69ac4a8d4f51fe1e6
708764265bcbde346ff245350b3466cde93ae474
refs/heads/master
2023-04-11T19:17:49.011718
2021-05-21T14:25:15
2021-05-21T14:25:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,761
java
package com.esprit.PI_Sprint3_Mobile.GUI.responsableCategorie; import com.codename1.charts.util.ColorUtil; import com.codename1.ui.*; import com.codename1.ui.layouts.BoxLayout; import com.codename1.ui.util.Resources; import com.esprit.PI_Sprint3_Mobile.Template.LoginForm; import com.esprit.PI_Sprint3_Mobile.entities.Categorie; import com.esprit.PI_Sprint3_Mobile.entities.ResponsableCategorie; import com.esprit.PI_Sprint3_Mobile.services.CategorieService; import com.esprit.PI_Sprint3_Mobile.services.ResponsableCategorieService; import com.esprit.PI_Sprint3_Mobile.services.ThemeService; import java.io.IOException; public class ResponsableCategorieShowForm extends Form { private Resources res; private ResponsableCategorie responsableCategorie; private TextField lbNom, lbPrenom, lbEmail; private ComboBox<Categorie> lbCategorie; Button btnUpdate; public ResponsableCategorieShowForm(ResponsableCategorie responsableCategorie) { super(responsableCategorie.getNom(), BoxLayout.yCenter()); try { res = Resources.openLayered("/theme"); } catch (IOException e) { e.printStackTrace(); } this.responsableCategorie = responsableCategorie; addGUIs(); addActions(); } private void addGUIs() { FontImage icon = FontImage.createMaterial(FontImage.MATERIAL_LOGOUT, "", 5); // this.getToolbar().addCommandToOverflowMenu("Home", null, evt1 -> new ProfileForm(res).show()); this.getToolbar().addCommandToOverflowMenu(null, icon, evt1 -> new LoginForm(res, null, null).show()); this.getToolbar().addCommandToRightBar(null, FontImage.createMaterial(FontImage.MATERIAL_DELETE, "", 5), actionEvent -> { if(Dialog.show("Confirmation", "Supprimer " + responsableCategorie.getNom() + " ?", "Oui", "Non" )) { ThemeService.getInstance().delete(responsableCategorie.getId()); new ResponsableCategorieListForm().show(); } }); this.getToolbar().addCommandToLeftBar(null, FontImage.createMaterial(FontImage.MATERIAL_ARROW_BACK, "TitleCommand", 5), evt1 -> new ResponsableCategorieListForm().show()); lbNom = new TextField(responsableCategorie.getNom(), "Nom"); lbNom.getAllStyles().setFgColor(ColorUtil.BLACK); lbPrenom = new TextField(responsableCategorie.getPrenom(), "Prenom"); lbPrenom.getAllStyles().setFgColor(ColorUtil.BLACK); lbEmail = new TextField(responsableCategorie.getEmail(), "Email"); lbEmail.getAllStyles().setFgColor(ColorUtil.BLACK); lbCategorie = new ComboBox<>(); CategorieService.getInstance().findAll().forEach(ct -> lbCategorie.addItem(ct)); lbCategorie.setSelectedItem(responsableCategorie.getCategorie()); lbCategorie.getAllStyles().setFgColor(ColorUtil.BLACK); btnUpdate = new Button("Modifier"); this.addAll(new Container(BoxLayout.yCenter()).addAll(lbNom,lbPrenom,lbEmail,lbCategorie), btnUpdate); } private void addActions() { btnUpdate.addActionListener(actionEvent -> { responsableCategorie.setNom(lbNom.getText()); responsableCategorie.setPrenom(lbPrenom.getText()); responsableCategorie.setEmail(lbEmail.getText()); responsableCategorie.setCategorie(lbCategorie.getSelectedItem()); if (ResponsableCategorieService.getInstance().update(responsableCategorie)) { Dialog.show("Information", responsableCategorie.getNom() + " Modifié", "OK",null); new ResponsableCategorieListForm().show(); } else { Dialog.show("Erreur", "Erreur De Modification", "OK",null); } }); } }
[ "karim.mannai7@gmail.com" ]
karim.mannai7@gmail.com
03394be129497fdd1dcdae4fae8041faf1f77458
eb6165ca44ec541b1f6b31b3c51e4a843beb11db
/src/main/java/edu/csupomona/nlp/opinsum/repository/SentimentCountRepositoryImpl.java
4ebbdc257ff18abb03295e7d90e2397a45c1d097
[]
no_license
AnakinFoxe/OpinSum
286e909bec3d3957ef7f1bfb68bec9f2b7a28df9
753821fbd9be9601b255548d3669795d16c8a136
refs/heads/master
2020-04-06T04:38:57.791672
2015-03-01T20:07:15
2015-03-01T20:07:15
22,036,847
0
1
null
null
null
null
UTF-8
Java
false
false
1,028
java
package edu.csupomona.nlp.opinsum.repository; import edu.csupomona.nlp.opinsum.model.SentimentCount; import org.springframework.stereotype.Repository; import javax.persistence.EntityManager; import javax.persistence.NoResultException; import javax.persistence.PersistenceContext; import javax.persistence.Query; import java.util.List; /** * Created by Xing HU on 11/30/14. */ @Repository public class SentimentCountRepositoryImpl implements SentimentCountRepository { @PersistenceContext private EntityManager em; @Override public SentimentCount saveOrUpdate(SentimentCount count) { em.persist(count); em.flush(); return count; } @Override public List<SentimentCount> loadAll() { try { String qString = "select g from SentimentCount g"; Query query = em.createQuery(qString); List counts = query.getResultList(); return counts; } catch (NoResultException e) { return null; } } }
[ "xing.y.hu@gmail.com" ]
xing.y.hu@gmail.com
a6fe909ba20f96955f99bf850affff71a868887b
de97b35c01fcb5329ac8023861fb7e6d3fdf5234
/app/src/main/java/com/example/owner/pushup/MainActivity.java
6309b2ec5c954e0dfb2b37bd585a4d5239704a5a
[]
no_license
winchoi4/pushup
2d966c701d29dec90e7265874ced17d301a496ba
2d960b2d88a44a0e1c11a63dccbe376b25f66560
refs/heads/master
2021-01-09T05:34:54.275588
2017-02-03T03:36:36
2017-02-03T03:36:36
80,794,103
0
0
null
null
null
null
UTF-8
Java
false
false
1,846
java
package com.example.owner.pushup; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } private void TestUpload() { int i = 1+1; } }
[ "KinKinBBG" ]
KinKinBBG
9218956c31389b93a3f325261c1b56b7d65c5379
6016ff65babed9108d9aebcebf6fb4017a9959d0
/geopaparazzilibrary/src/main/java/eu/geopaparazzi/library/core/activities/DirectoryBrowserActivity.java
b0e7eec2e1b4893a686a04b31d202b199b68adb3
[]
no_license
hnyzwtf/geopaparazzi
30a3817e56aafa97e07e3d3a8b8088f001e17a5f
c5b5fe8c3dc56cf6e012c8a33f541620891ed699
refs/heads/master
2020-12-26T02:50:59.107916
2016-04-15T11:55:14
2016-04-15T11:55:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,321
java
/* * Geopaparazzi - Digital field mapping on Android based devices * Copyright (C) 2016 HydroloGIS (www.hydrologis.com) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package eu.geopaparazzi.library.core.activities; import java.io.File; import java.io.FileFilter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import android.app.Activity; import android.app.ListActivity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.design.widget.FloatingActionButton; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import eu.geopaparazzi.library.R; import eu.geopaparazzi.library.util.LibraryConstants; /** * Folder browser activity. * <p/> * <p>Example usage:</p> * File sdcardDir = ResourcesManager.getInstance(getContext()).getSdcardDir(); * Intent browseIntent = new Intent(getContext(), DirectoryBrowserActivity.class); * browseIntent.putExtra(DirectoryBrowserActivity.PUT_PATH_PREFERENCE, PREFS_KEY_CUSTOM_EXTERNALSTORAGE); * browseIntent.putExtra(DirectoryBrowserActivity.EXTENTIONS, new String[]{ DirectoryBrowserActivity.FOLDER}); * browseIntent.putExtra(DirectoryBrowserActivity.STARTFOLDERPATH, sdcardDir.getAbsolutePath()); * startActivityForResult(browseIntent, RETURNCODE_BROWSE); * <p/> * <p>And in onResult</p> * case (RETURNCODE_BROWSE): { * if (resultCode == Activity.RESULT_OK) { * String path = data.getStringExtra(LibraryConstants.PREFS_KEY_PATH); * if (path != null && new File(path).exists()) { * ... * } * } * } * * @author Andrea Antonello (www.hydrologis.com) */ public class DirectoryBrowserActivity extends ListActivity { /** */ public static final String STARTFOLDERPATH = "STARTFOLDERPATH"; //$NON-NLS-1$ /** * Key that brings the preference key in which to place the selected path. */ public static final String PUT_PATH_PREFERENCE = "PUT_PATH_PREFERENCE"; //$NON-NLS-1$ /** * Key for a new intent to launch on the resulting path. */ public static final String INTENT_ID = "INTENT_ID"; //$NON-NLS-1$ /** * Key to pass extensions to visualize. */ public static final String EXTENSIONS = "EXTENSIONS"; //$NON-NLS-1$ /** * */ public static final String SHOWHIDDEN = "SHOWHIDDEN"; //$NON-NLS-1$ /** * */ public static final String FOLDER = "folder"; //$NON-NLS-1$ private List<File> filesList = new ArrayList<File>(); private File startFolderFile; private String intentId; private String[] extentions; private FileFilter fileFilter; private File currentDir; private boolean doFolder; private boolean doHidden; private String startFolder; private FileArrayAdapter fileListAdapter; private String preferencesKey; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.browse); Bundle extras = getIntent().getExtras(); if (extras != null) { intentId = extras.getString(INTENT_ID); extentions = extras.getStringArray(EXTENSIONS); startFolder = extras.getString(STARTFOLDERPATH); doHidden = extras.getBoolean(SHOWHIDDEN, false); preferencesKey = extras.getString(PUT_PATH_PREFERENCE); if (extentions != null && extentions.length > 0) { if (extentions[0].equals(FOLDER)) doFolder = true; } fileFilter = new FileFilter() { public boolean accept(File file) { if (file.isDirectory()) { return true; } if (!doFolder) { String name = file.getName(); return endsWith(name, extentions); } return false; } }; } FloatingActionButton okButton = (FloatingActionButton) findViewById(R.id.okbutton); if (doFolder) { okButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { String absolutePath = currentDir.getAbsolutePath(); if (preferencesKey != null) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(v.getContext()); SharedPreferences.Editor editor = preferences.edit(); editor.putString(preferencesKey, absolutePath); editor.apply(); } handleIntent(absolutePath); finish(); } }); } else { okButton.hide(); } FloatingActionButton upButton = (FloatingActionButton) findViewById(R.id.upbutton); upButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { goUp(); } }); startFolderFile = new File(startFolder); getFiles(startFolderFile, startFolderFile.listFiles(fileFilter)); } private void handleIntent(String absolutePath) { if (intentId != null) { Intent intent = new Intent(intentId); intent.putExtra(LibraryConstants.PREFS_KEY_PATH, absolutePath); startActivity(intent); } else { Intent intent = new Intent((String) null); intent.putExtra(LibraryConstants.PREFS_KEY_PATH, absolutePath); setResult(Activity.RESULT_OK, intent); } } @Override protected void onListItemClick(ListView l, View v, int position, long id) { int selectedRow = (int) id; File file = filesList.get(selectedRow); if (file.isDirectory()) { File[] filesArray = file.listFiles(fileFilter); if (filesArray != null) { currentDir = file; getFiles(currentDir, filesArray); } else { filesArray = currentDir.listFiles(fileFilter); getFiles(currentDir, filesArray); } } else { String absolutePath = file.getAbsolutePath(); handleIntent(absolutePath); finish(); } } private void goUp() { File tmpDir = currentDir.getParentFile(); if (tmpDir != null && tmpDir.exists()) { if (tmpDir.canRead()) { currentDir = tmpDir; } } getFiles(currentDir, currentDir.listFiles(fileFilter)); } private void getFiles(File parent, File[] files) { Arrays.sort(files); currentDir = parent; filesList.clear(); for (File file : files) { if (!doHidden && file.getName().startsWith(".")) { //$NON-NLS-1$ continue; } filesList.add(file); } if (fileListAdapter == null) { fileListAdapter = new FileArrayAdapter(this, filesList); setListAdapter(fileListAdapter); } else { fileListAdapter.notifyDataSetChanged(); } } private class FileArrayAdapter extends ArrayAdapter<File> { private final Activity context; private final List<File> files; public FileArrayAdapter(Activity context, List<File> files) { super(context, R.id.browselist_text, files); this.context = context; this.files = files; } class ViewHolder { public TextView textView; public ImageView imageView; } @Override public int getCount() { return files.size(); } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; // Recycle existing view if passed as parameter View rowView = convertView; if (rowView == null) { LayoutInflater inflater = context.getLayoutInflater(); rowView = inflater.inflate(R.layout.browse_file_row, null, true); holder = new ViewHolder(); holder.textView = (TextView) rowView.findViewById(R.id.browselist_text); holder.imageView = (ImageView) rowView.findViewById(R.id.fileIconView); rowView.setTag(holder); } else { holder = (ViewHolder) rowView.getTag(); } File file = files.get(position); String fileName = file.getName(); holder.textView.setText(fileName); if (file.isDirectory()) { holder.imageView.setImageResource(R.drawable.ic_folder_primary_24dp); } else { if (!doFolder && endsWith(fileName, extentions)) { holder.imageView.setImageResource(R.drawable.ic_star_accent_24dp); } else { holder.imageView.setImageResource(R.drawable.ic_file_primary_24dp); } } return rowView; } } private boolean endsWith(String name, String[] extentions) { name = name.toLowerCase(); for (String ext : extentions) { if (name.endsWith(ext.toLowerCase())) { return true; } } return false; } }
[ "andrea.antonello@gmail.com" ]
andrea.antonello@gmail.com
0ddc0ec28e27ea7c5020c74bab493f615839d17a
f82430d19def6bb0b01ed5e7f63dd1979a2c51f1
/Main.java
1011a58e5f581d49dfd0fda05b983a6fc37716a5
[]
no_license
ugurcansandik/ogrenciListesi
6e18be3bd678c2360201ad0906a74a143de5a1b2
8fbf74a52df6218616b1904497414cf381a91862
refs/heads/main
2023-05-01T10:50:03.972177
2021-05-06T00:54:42
2021-05-06T00:54:42
364,744,872
0
0
null
null
null
null
UTF-8
Java
false
false
2,268
java
import java.util.Scanner; import java.io.File; import java.io.PrintWriter; import java.io.FileWriter; import java.io.BufferedWriter; import java.util.ArrayList; public class Main { public static void main(String[] args) throws Exception { read(); } public static void read() throws Exception { char cinsiyet; String ad, soyad, durum; ArrayList <Kisi> kisiler = new ArrayList<Kisi> (); Scanner input = new Scanner(new File("ogrenciListesi.txt")); while(input.hasNext()) { cinsiyet = input.next().charAt(0); ad = input.next().trim(); soyad = input.next().trim(); durum = input.next().trim(); Kisi kisi = new Kisi(cinsiyet, ad, soyad, durum); kisiler.add(kisi); } write(kisiler); } public static void write(ArrayList <Kisi> kisiler) throws Exception { int kalem = 0; int bisiklet = 0; int tabletBilgisayar = 0; FileWriter fw = new FileWriter("OgrenciHediyeler.txt", true); BufferedWriter bw = new BufferedWriter(fw); for (int i = 0 ; i < kisiler.size() ; i++) { if (kisiler.get(i).getDurum().equals("Kötü")) { bw.write(kisiler.get(i).getSoyad() + ", " + kisiler.get(i).getAd() + " kalem"); kalem++; }else if(kisiler.get(i).getCinsiyet() == 'F' && kisiler.get(i).getDurum().equals("İyi")) { bw.write(kisiler.get(i).getSoyad() + ", " + kisiler.get(i).getAd() + " bisiklet"); bisiklet++; }else if(kisiler.get(i).getCinsiyet() == 'M' && kisiler.get(i).getDurum().equals("İyi")) { bw.write(kisiler.get(i).getSoyad() + ", " + kisiler.get(i).getAd() + " tablet bilgisayar"); tabletBilgisayar++; } bw.newLine(); } bw.newLine(); bw.write("Kalem: " + kalem); System.out.println("Kalem: " + kalem); bw.newLine(); bw.write("Bisiklet: " + bisiklet); System.out.println("Bisiklet: " + bisiklet); bw.newLine(); bw.write("Tablet Bilgisayar: " + tabletBilgisayar); System.out.println("Tablet Bilgisayar: " + tabletBilgisayar); bw.newLine(); bw.close(); } }
[ "noreply@github.com" ]
ugurcansandik.noreply@github.com
a4b5a874c79552665a07770f49e3244a031ceab3
27367d4b14cf6338183cc3369f3b612f682ef2e0
/pyg_pojo/src/main/java/com/itheima/pyg/pojo/user/UserQuery.java
0b78159aaad4f25fd798b69ca46ce1f20fba5b14
[]
no_license
bingfengtianyi/pyg_parent
830f59e7024e901c7b90db551ecf137d88d207a2
36cbbcb7f7e8b198b011912611b93aa04bb6972a
refs/heads/master
2020-04-08T14:14:00.529429
2018-12-01T03:09:58
2018-12-01T03:09:58
159,427,865
0
0
null
null
null
null
UTF-8
Java
false
false
54,662
java
package com.itheima.pyg.pojo.user; import java.util.ArrayList; import java.util.Date; import java.util.List; public class UserQuery { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; protected String fields; public UserQuery() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } public void setFields(String fields) { this.fields=fields; } public String getFields() { return fields; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(Long value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(Long value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(Long value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Long value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(Long value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Long value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<Long> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Long> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Long value1, Long value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Long value1, Long value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andUsernameIsNull() { addCriterion("username is null"); return (Criteria) this; } public Criteria andUsernameIsNotNull() { addCriterion("username is not null"); return (Criteria) this; } public Criteria andUsernameEqualTo(String value) { addCriterion("username =", value, "username"); return (Criteria) this; } public Criteria andUsernameNotEqualTo(String value) { addCriterion("username <>", value, "username"); return (Criteria) this; } public Criteria andUsernameGreaterThan(String value) { addCriterion("username >", value, "username"); return (Criteria) this; } public Criteria andUsernameGreaterThanOrEqualTo(String value) { addCriterion("username >=", value, "username"); return (Criteria) this; } public Criteria andUsernameLessThan(String value) { addCriterion("username <", value, "username"); return (Criteria) this; } public Criteria andUsernameLessThanOrEqualTo(String value) { addCriterion("username <=", value, "username"); return (Criteria) this; } public Criteria andUsernameLike(String value) { addCriterion("username like", value, "username"); return (Criteria) this; } public Criteria andUsernameNotLike(String value) { addCriterion("username not like", value, "username"); return (Criteria) this; } public Criteria andUsernameIn(List<String> values) { addCriterion("username in", values, "username"); return (Criteria) this; } public Criteria andUsernameNotIn(List<String> values) { addCriterion("username not in", values, "username"); return (Criteria) this; } public Criteria andUsernameBetween(String value1, String value2) { addCriterion("username between", value1, value2, "username"); return (Criteria) this; } public Criteria andUsernameNotBetween(String value1, String value2) { addCriterion("username not between", value1, value2, "username"); return (Criteria) this; } public Criteria andPasswordIsNull() { addCriterion("password is null"); return (Criteria) this; } public Criteria andPasswordIsNotNull() { addCriterion("password is not null"); return (Criteria) this; } public Criteria andPasswordEqualTo(String value) { addCriterion("password =", value, "password"); return (Criteria) this; } public Criteria andPasswordNotEqualTo(String value) { addCriterion("password <>", value, "password"); return (Criteria) this; } public Criteria andPasswordGreaterThan(String value) { addCriterion("password >", value, "password"); return (Criteria) this; } public Criteria andPasswordGreaterThanOrEqualTo(String value) { addCriterion("password >=", value, "password"); return (Criteria) this; } public Criteria andPasswordLessThan(String value) { addCriterion("password <", value, "password"); return (Criteria) this; } public Criteria andPasswordLessThanOrEqualTo(String value) { addCriterion("password <=", value, "password"); return (Criteria) this; } public Criteria andPasswordLike(String value) { addCriterion("password like", value, "password"); return (Criteria) this; } public Criteria andPasswordNotLike(String value) { addCriterion("password not like", value, "password"); return (Criteria) this; } public Criteria andPasswordIn(List<String> values) { addCriterion("password in", values, "password"); return (Criteria) this; } public Criteria andPasswordNotIn(List<String> values) { addCriterion("password not in", values, "password"); return (Criteria) this; } public Criteria andPasswordBetween(String value1, String value2) { addCriterion("password between", value1, value2, "password"); return (Criteria) this; } public Criteria andPasswordNotBetween(String value1, String value2) { addCriterion("password not between", value1, value2, "password"); return (Criteria) this; } public Criteria andPhoneIsNull() { addCriterion("phone is null"); return (Criteria) this; } public Criteria andPhoneIsNotNull() { addCriterion("phone is not null"); return (Criteria) this; } public Criteria andPhoneEqualTo(String value) { addCriterion("phone =", value, "phone"); return (Criteria) this; } public Criteria andPhoneNotEqualTo(String value) { addCriterion("phone <>", value, "phone"); return (Criteria) this; } public Criteria andPhoneGreaterThan(String value) { addCriterion("phone >", value, "phone"); return (Criteria) this; } public Criteria andPhoneGreaterThanOrEqualTo(String value) { addCriterion("phone >=", value, "phone"); return (Criteria) this; } public Criteria andPhoneLessThan(String value) { addCriterion("phone <", value, "phone"); return (Criteria) this; } public Criteria andPhoneLessThanOrEqualTo(String value) { addCriterion("phone <=", value, "phone"); return (Criteria) this; } public Criteria andPhoneLike(String value) { addCriterion("phone like", value, "phone"); return (Criteria) this; } public Criteria andPhoneNotLike(String value) { addCriterion("phone not like", value, "phone"); return (Criteria) this; } public Criteria andPhoneIn(List<String> values) { addCriterion("phone in", values, "phone"); return (Criteria) this; } public Criteria andPhoneNotIn(List<String> values) { addCriterion("phone not in", values, "phone"); return (Criteria) this; } public Criteria andPhoneBetween(String value1, String value2) { addCriterion("phone between", value1, value2, "phone"); return (Criteria) this; } public Criteria andPhoneNotBetween(String value1, String value2) { addCriterion("phone not between", value1, value2, "phone"); return (Criteria) this; } public Criteria andEmailIsNull() { addCriterion("email is null"); return (Criteria) this; } public Criteria andEmailIsNotNull() { addCriterion("email is not null"); return (Criteria) this; } public Criteria andEmailEqualTo(String value) { addCriterion("email =", value, "email"); return (Criteria) this; } public Criteria andEmailNotEqualTo(String value) { addCriterion("email <>", value, "email"); return (Criteria) this; } public Criteria andEmailGreaterThan(String value) { addCriterion("email >", value, "email"); return (Criteria) this; } public Criteria andEmailGreaterThanOrEqualTo(String value) { addCriterion("email >=", value, "email"); return (Criteria) this; } public Criteria andEmailLessThan(String value) { addCriterion("email <", value, "email"); return (Criteria) this; } public Criteria andEmailLessThanOrEqualTo(String value) { addCriterion("email <=", value, "email"); return (Criteria) this; } public Criteria andEmailLike(String value) { addCriterion("email like", value, "email"); return (Criteria) this; } public Criteria andEmailNotLike(String value) { addCriterion("email not like", value, "email"); return (Criteria) this; } public Criteria andEmailIn(List<String> values) { addCriterion("email in", values, "email"); return (Criteria) this; } public Criteria andEmailNotIn(List<String> values) { addCriterion("email not in", values, "email"); return (Criteria) this; } public Criteria andEmailBetween(String value1, String value2) { addCriterion("email between", value1, value2, "email"); return (Criteria) this; } public Criteria andEmailNotBetween(String value1, String value2) { addCriterion("email not between", value1, value2, "email"); return (Criteria) this; } public Criteria andCreatedIsNull() { addCriterion("created is null"); return (Criteria) this; } public Criteria andCreatedIsNotNull() { addCriterion("created is not null"); return (Criteria) this; } public Criteria andCreatedEqualTo(Date value) { addCriterion("created =", value, "created"); return (Criteria) this; } public Criteria andCreatedNotEqualTo(Date value) { addCriterion("created <>", value, "created"); return (Criteria) this; } public Criteria andCreatedGreaterThan(Date value) { addCriterion("created >", value, "created"); return (Criteria) this; } public Criteria andCreatedGreaterThanOrEqualTo(Date value) { addCriterion("created >=", value, "created"); return (Criteria) this; } public Criteria andCreatedLessThan(Date value) { addCriterion("created <", value, "created"); return (Criteria) this; } public Criteria andCreatedLessThanOrEqualTo(Date value) { addCriterion("created <=", value, "created"); return (Criteria) this; } public Criteria andCreatedIn(List<Date> values) { addCriterion("created in", values, "created"); return (Criteria) this; } public Criteria andCreatedNotIn(List<Date> values) { addCriterion("created not in", values, "created"); return (Criteria) this; } public Criteria andCreatedBetween(Date value1, Date value2) { addCriterion("created between", value1, value2, "created"); return (Criteria) this; } public Criteria andCreatedNotBetween(Date value1, Date value2) { addCriterion("created not between", value1, value2, "created"); return (Criteria) this; } public Criteria andUpdatedIsNull() { addCriterion("updated is null"); return (Criteria) this; } public Criteria andUpdatedIsNotNull() { addCriterion("updated is not null"); return (Criteria) this; } public Criteria andUpdatedEqualTo(Date value) { addCriterion("updated =", value, "updated"); return (Criteria) this; } public Criteria andUpdatedNotEqualTo(Date value) { addCriterion("updated <>", value, "updated"); return (Criteria) this; } public Criteria andUpdatedGreaterThan(Date value) { addCriterion("updated >", value, "updated"); return (Criteria) this; } public Criteria andUpdatedGreaterThanOrEqualTo(Date value) { addCriterion("updated >=", value, "updated"); return (Criteria) this; } public Criteria andUpdatedLessThan(Date value) { addCriterion("updated <", value, "updated"); return (Criteria) this; } public Criteria andUpdatedLessThanOrEqualTo(Date value) { addCriterion("updated <=", value, "updated"); return (Criteria) this; } public Criteria andUpdatedIn(List<Date> values) { addCriterion("updated in", values, "updated"); return (Criteria) this; } public Criteria andUpdatedNotIn(List<Date> values) { addCriterion("updated not in", values, "updated"); return (Criteria) this; } public Criteria andUpdatedBetween(Date value1, Date value2) { addCriterion("updated between", value1, value2, "updated"); return (Criteria) this; } public Criteria andUpdatedNotBetween(Date value1, Date value2) { addCriterion("updated not between", value1, value2, "updated"); return (Criteria) this; } public Criteria andSourceTypeIsNull() { addCriterion("source_type is null"); return (Criteria) this; } public Criteria andSourceTypeIsNotNull() { addCriterion("source_type is not null"); return (Criteria) this; } public Criteria andSourceTypeEqualTo(String value) { addCriterion("source_type =", value, "sourceType"); return (Criteria) this; } public Criteria andSourceTypeNotEqualTo(String value) { addCriterion("source_type <>", value, "sourceType"); return (Criteria) this; } public Criteria andSourceTypeGreaterThan(String value) { addCriterion("source_type >", value, "sourceType"); return (Criteria) this; } public Criteria andSourceTypeGreaterThanOrEqualTo(String value) { addCriterion("source_type >=", value, "sourceType"); return (Criteria) this; } public Criteria andSourceTypeLessThan(String value) { addCriterion("source_type <", value, "sourceType"); return (Criteria) this; } public Criteria andSourceTypeLessThanOrEqualTo(String value) { addCriterion("source_type <=", value, "sourceType"); return (Criteria) this; } public Criteria andSourceTypeLike(String value) { addCriterion("source_type like", value, "sourceType"); return (Criteria) this; } public Criteria andSourceTypeNotLike(String value) { addCriterion("source_type not like", value, "sourceType"); return (Criteria) this; } public Criteria andSourceTypeIn(List<String> values) { addCriterion("source_type in", values, "sourceType"); return (Criteria) this; } public Criteria andSourceTypeNotIn(List<String> values) { addCriterion("source_type not in", values, "sourceType"); return (Criteria) this; } public Criteria andSourceTypeBetween(String value1, String value2) { addCriterion("source_type between", value1, value2, "sourceType"); return (Criteria) this; } public Criteria andSourceTypeNotBetween(String value1, String value2) { addCriterion("source_type not between", value1, value2, "sourceType"); return (Criteria) this; } public Criteria andNickNameIsNull() { addCriterion("nick_name is null"); return (Criteria) this; } public Criteria andNickNameIsNotNull() { addCriterion("nick_name is not null"); return (Criteria) this; } public Criteria andNickNameEqualTo(String value) { addCriterion("nick_name =", value, "nickName"); return (Criteria) this; } public Criteria andNickNameNotEqualTo(String value) { addCriterion("nick_name <>", value, "nickName"); return (Criteria) this; } public Criteria andNickNameGreaterThan(String value) { addCriterion("nick_name >", value, "nickName"); return (Criteria) this; } public Criteria andNickNameGreaterThanOrEqualTo(String value) { addCriterion("nick_name >=", value, "nickName"); return (Criteria) this; } public Criteria andNickNameLessThan(String value) { addCriterion("nick_name <", value, "nickName"); return (Criteria) this; } public Criteria andNickNameLessThanOrEqualTo(String value) { addCriterion("nick_name <=", value, "nickName"); return (Criteria) this; } public Criteria andNickNameLike(String value) { addCriterion("nick_name like", value, "nickName"); return (Criteria) this; } public Criteria andNickNameNotLike(String value) { addCriterion("nick_name not like", value, "nickName"); return (Criteria) this; } public Criteria andNickNameIn(List<String> values) { addCriterion("nick_name in", values, "nickName"); return (Criteria) this; } public Criteria andNickNameNotIn(List<String> values) { addCriterion("nick_name not in", values, "nickName"); return (Criteria) this; } public Criteria andNickNameBetween(String value1, String value2) { addCriterion("nick_name between", value1, value2, "nickName"); return (Criteria) this; } public Criteria andNickNameNotBetween(String value1, String value2) { addCriterion("nick_name not between", value1, value2, "nickName"); return (Criteria) this; } public Criteria andNameIsNull() { addCriterion("name is null"); return (Criteria) this; } public Criteria andNameIsNotNull() { addCriterion("name is not null"); return (Criteria) this; } public Criteria andNameEqualTo(String value) { addCriterion("name =", value, "name"); return (Criteria) this; } public Criteria andNameNotEqualTo(String value) { addCriterion("name <>", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThan(String value) { addCriterion("name >", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThanOrEqualTo(String value) { addCriterion("name >=", value, "name"); return (Criteria) this; } public Criteria andNameLessThan(String value) { addCriterion("name <", value, "name"); return (Criteria) this; } public Criteria andNameLessThanOrEqualTo(String value) { addCriterion("name <=", value, "name"); return (Criteria) this; } public Criteria andNameLike(String value) { addCriterion("name like", value, "name"); return (Criteria) this; } public Criteria andNameNotLike(String value) { addCriterion("name not like", value, "name"); return (Criteria) this; } public Criteria andNameIn(List<String> values) { addCriterion("name in", values, "name"); return (Criteria) this; } public Criteria andNameNotIn(List<String> values) { addCriterion("name not in", values, "name"); return (Criteria) this; } public Criteria andNameBetween(String value1, String value2) { addCriterion("name between", value1, value2, "name"); return (Criteria) this; } public Criteria andNameNotBetween(String value1, String value2) { addCriterion("name not between", value1, value2, "name"); return (Criteria) this; } public Criteria andStatusIsNull() { addCriterion("status is null"); return (Criteria) this; } public Criteria andStatusIsNotNull() { addCriterion("status is not null"); return (Criteria) this; } public Criteria andStatusEqualTo(String value) { addCriterion("status =", value, "status"); return (Criteria) this; } public Criteria andStatusNotEqualTo(String value) { addCriterion("status <>", value, "status"); return (Criteria) this; } public Criteria andStatusGreaterThan(String value) { addCriterion("status >", value, "status"); return (Criteria) this; } public Criteria andStatusGreaterThanOrEqualTo(String value) { addCriterion("status >=", value, "status"); return (Criteria) this; } public Criteria andStatusLessThan(String value) { addCriterion("status <", value, "status"); return (Criteria) this; } public Criteria andStatusLessThanOrEqualTo(String value) { addCriterion("status <=", value, "status"); return (Criteria) this; } public Criteria andStatusLike(String value) { addCriterion("status like", value, "status"); return (Criteria) this; } public Criteria andStatusNotLike(String value) { addCriterion("status not like", value, "status"); return (Criteria) this; } public Criteria andStatusIn(List<String> values) { addCriterion("status in", values, "status"); return (Criteria) this; } public Criteria andStatusNotIn(List<String> values) { addCriterion("status not in", values, "status"); return (Criteria) this; } public Criteria andStatusBetween(String value1, String value2) { addCriterion("status between", value1, value2, "status"); return (Criteria) this; } public Criteria andStatusNotBetween(String value1, String value2) { addCriterion("status not between", value1, value2, "status"); return (Criteria) this; } public Criteria andHeadPicIsNull() { addCriterion("head_pic is null"); return (Criteria) this; } public Criteria andHeadPicIsNotNull() { addCriterion("head_pic is not null"); return (Criteria) this; } public Criteria andHeadPicEqualTo(String value) { addCriterion("head_pic =", value, "headPic"); return (Criteria) this; } public Criteria andHeadPicNotEqualTo(String value) { addCriterion("head_pic <>", value, "headPic"); return (Criteria) this; } public Criteria andHeadPicGreaterThan(String value) { addCriterion("head_pic >", value, "headPic"); return (Criteria) this; } public Criteria andHeadPicGreaterThanOrEqualTo(String value) { addCriterion("head_pic >=", value, "headPic"); return (Criteria) this; } public Criteria andHeadPicLessThan(String value) { addCriterion("head_pic <", value, "headPic"); return (Criteria) this; } public Criteria andHeadPicLessThanOrEqualTo(String value) { addCriterion("head_pic <=", value, "headPic"); return (Criteria) this; } public Criteria andHeadPicLike(String value) { addCriterion("head_pic like", value, "headPic"); return (Criteria) this; } public Criteria andHeadPicNotLike(String value) { addCriterion("head_pic not like", value, "headPic"); return (Criteria) this; } public Criteria andHeadPicIn(List<String> values) { addCriterion("head_pic in", values, "headPic"); return (Criteria) this; } public Criteria andHeadPicNotIn(List<String> values) { addCriterion("head_pic not in", values, "headPic"); return (Criteria) this; } public Criteria andHeadPicBetween(String value1, String value2) { addCriterion("head_pic between", value1, value2, "headPic"); return (Criteria) this; } public Criteria andHeadPicNotBetween(String value1, String value2) { addCriterion("head_pic not between", value1, value2, "headPic"); return (Criteria) this; } public Criteria andQqIsNull() { addCriterion("qq is null"); return (Criteria) this; } public Criteria andQqIsNotNull() { addCriterion("qq is not null"); return (Criteria) this; } public Criteria andQqEqualTo(String value) { addCriterion("qq =", value, "qq"); return (Criteria) this; } public Criteria andQqNotEqualTo(String value) { addCriterion("qq <>", value, "qq"); return (Criteria) this; } public Criteria andQqGreaterThan(String value) { addCriterion("qq >", value, "qq"); return (Criteria) this; } public Criteria andQqGreaterThanOrEqualTo(String value) { addCriterion("qq >=", value, "qq"); return (Criteria) this; } public Criteria andQqLessThan(String value) { addCriterion("qq <", value, "qq"); return (Criteria) this; } public Criteria andQqLessThanOrEqualTo(String value) { addCriterion("qq <=", value, "qq"); return (Criteria) this; } public Criteria andQqLike(String value) { addCriterion("qq like", value, "qq"); return (Criteria) this; } public Criteria andQqNotLike(String value) { addCriterion("qq not like", value, "qq"); return (Criteria) this; } public Criteria andQqIn(List<String> values) { addCriterion("qq in", values, "qq"); return (Criteria) this; } public Criteria andQqNotIn(List<String> values) { addCriterion("qq not in", values, "qq"); return (Criteria) this; } public Criteria andQqBetween(String value1, String value2) { addCriterion("qq between", value1, value2, "qq"); return (Criteria) this; } public Criteria andQqNotBetween(String value1, String value2) { addCriterion("qq not between", value1, value2, "qq"); return (Criteria) this; } public Criteria andAccountBalanceIsNull() { addCriterion("account_balance is null"); return (Criteria) this; } public Criteria andAccountBalanceIsNotNull() { addCriterion("account_balance is not null"); return (Criteria) this; } public Criteria andAccountBalanceEqualTo(Long value) { addCriterion("account_balance =", value, "accountBalance"); return (Criteria) this; } public Criteria andAccountBalanceNotEqualTo(Long value) { addCriterion("account_balance <>", value, "accountBalance"); return (Criteria) this; } public Criteria andAccountBalanceGreaterThan(Long value) { addCriterion("account_balance >", value, "accountBalance"); return (Criteria) this; } public Criteria andAccountBalanceGreaterThanOrEqualTo(Long value) { addCriterion("account_balance >=", value, "accountBalance"); return (Criteria) this; } public Criteria andAccountBalanceLessThan(Long value) { addCriterion("account_balance <", value, "accountBalance"); return (Criteria) this; } public Criteria andAccountBalanceLessThanOrEqualTo(Long value) { addCriterion("account_balance <=", value, "accountBalance"); return (Criteria) this; } public Criteria andAccountBalanceIn(List<Long> values) { addCriterion("account_balance in", values, "accountBalance"); return (Criteria) this; } public Criteria andAccountBalanceNotIn(List<Long> values) { addCriterion("account_balance not in", values, "accountBalance"); return (Criteria) this; } public Criteria andAccountBalanceBetween(Long value1, Long value2) { addCriterion("account_balance between", value1, value2, "accountBalance"); return (Criteria) this; } public Criteria andAccountBalanceNotBetween(Long value1, Long value2) { addCriterion("account_balance not between", value1, value2, "accountBalance"); return (Criteria) this; } public Criteria andIsMobileCheckIsNull() { addCriterion("is_mobile_check is null"); return (Criteria) this; } public Criteria andIsMobileCheckIsNotNull() { addCriterion("is_mobile_check is not null"); return (Criteria) this; } public Criteria andIsMobileCheckEqualTo(String value) { addCriterion("is_mobile_check =", value, "isMobileCheck"); return (Criteria) this; } public Criteria andIsMobileCheckNotEqualTo(String value) { addCriterion("is_mobile_check <>", value, "isMobileCheck"); return (Criteria) this; } public Criteria andIsMobileCheckGreaterThan(String value) { addCriterion("is_mobile_check >", value, "isMobileCheck"); return (Criteria) this; } public Criteria andIsMobileCheckGreaterThanOrEqualTo(String value) { addCriterion("is_mobile_check >=", value, "isMobileCheck"); return (Criteria) this; } public Criteria andIsMobileCheckLessThan(String value) { addCriterion("is_mobile_check <", value, "isMobileCheck"); return (Criteria) this; } public Criteria andIsMobileCheckLessThanOrEqualTo(String value) { addCriterion("is_mobile_check <=", value, "isMobileCheck"); return (Criteria) this; } public Criteria andIsMobileCheckLike(String value) { addCriterion("is_mobile_check like", value, "isMobileCheck"); return (Criteria) this; } public Criteria andIsMobileCheckNotLike(String value) { addCriterion("is_mobile_check not like", value, "isMobileCheck"); return (Criteria) this; } public Criteria andIsMobileCheckIn(List<String> values) { addCriterion("is_mobile_check in", values, "isMobileCheck"); return (Criteria) this; } public Criteria andIsMobileCheckNotIn(List<String> values) { addCriterion("is_mobile_check not in", values, "isMobileCheck"); return (Criteria) this; } public Criteria andIsMobileCheckBetween(String value1, String value2) { addCriterion("is_mobile_check between", value1, value2, "isMobileCheck"); return (Criteria) this; } public Criteria andIsMobileCheckNotBetween(String value1, String value2) { addCriterion("is_mobile_check not between", value1, value2, "isMobileCheck"); return (Criteria) this; } public Criteria andIsEmailCheckIsNull() { addCriterion("is_email_check is null"); return (Criteria) this; } public Criteria andIsEmailCheckIsNotNull() { addCriterion("is_email_check is not null"); return (Criteria) this; } public Criteria andIsEmailCheckEqualTo(String value) { addCriterion("is_email_check =", value, "isEmailCheck"); return (Criteria) this; } public Criteria andIsEmailCheckNotEqualTo(String value) { addCriterion("is_email_check <>", value, "isEmailCheck"); return (Criteria) this; } public Criteria andIsEmailCheckGreaterThan(String value) { addCriterion("is_email_check >", value, "isEmailCheck"); return (Criteria) this; } public Criteria andIsEmailCheckGreaterThanOrEqualTo(String value) { addCriterion("is_email_check >=", value, "isEmailCheck"); return (Criteria) this; } public Criteria andIsEmailCheckLessThan(String value) { addCriterion("is_email_check <", value, "isEmailCheck"); return (Criteria) this; } public Criteria andIsEmailCheckLessThanOrEqualTo(String value) { addCriterion("is_email_check <=", value, "isEmailCheck"); return (Criteria) this; } public Criteria andIsEmailCheckLike(String value) { addCriterion("is_email_check like", value, "isEmailCheck"); return (Criteria) this; } public Criteria andIsEmailCheckNotLike(String value) { addCriterion("is_email_check not like", value, "isEmailCheck"); return (Criteria) this; } public Criteria andIsEmailCheckIn(List<String> values) { addCriterion("is_email_check in", values, "isEmailCheck"); return (Criteria) this; } public Criteria andIsEmailCheckNotIn(List<String> values) { addCriterion("is_email_check not in", values, "isEmailCheck"); return (Criteria) this; } public Criteria andIsEmailCheckBetween(String value1, String value2) { addCriterion("is_email_check between", value1, value2, "isEmailCheck"); return (Criteria) this; } public Criteria andIsEmailCheckNotBetween(String value1, String value2) { addCriterion("is_email_check not between", value1, value2, "isEmailCheck"); return (Criteria) this; } public Criteria andSexIsNull() { addCriterion("sex is null"); return (Criteria) this; } public Criteria andSexIsNotNull() { addCriterion("sex is not null"); return (Criteria) this; } public Criteria andSexEqualTo(String value) { addCriterion("sex =", value, "sex"); return (Criteria) this; } public Criteria andSexNotEqualTo(String value) { addCriterion("sex <>", value, "sex"); return (Criteria) this; } public Criteria andSexGreaterThan(String value) { addCriterion("sex >", value, "sex"); return (Criteria) this; } public Criteria andSexGreaterThanOrEqualTo(String value) { addCriterion("sex >=", value, "sex"); return (Criteria) this; } public Criteria andSexLessThan(String value) { addCriterion("sex <", value, "sex"); return (Criteria) this; } public Criteria andSexLessThanOrEqualTo(String value) { addCriterion("sex <=", value, "sex"); return (Criteria) this; } public Criteria andSexLike(String value) { addCriterion("sex like", value, "sex"); return (Criteria) this; } public Criteria andSexNotLike(String value) { addCriterion("sex not like", value, "sex"); return (Criteria) this; } public Criteria andSexIn(List<String> values) { addCriterion("sex in", values, "sex"); return (Criteria) this; } public Criteria andSexNotIn(List<String> values) { addCriterion("sex not in", values, "sex"); return (Criteria) this; } public Criteria andSexBetween(String value1, String value2) { addCriterion("sex between", value1, value2, "sex"); return (Criteria) this; } public Criteria andSexNotBetween(String value1, String value2) { addCriterion("sex not between", value1, value2, "sex"); return (Criteria) this; } public Criteria andUserLevelIsNull() { addCriterion("user_level is null"); return (Criteria) this; } public Criteria andUserLevelIsNotNull() { addCriterion("user_level is not null"); return (Criteria) this; } public Criteria andUserLevelEqualTo(Integer value) { addCriterion("user_level =", value, "userLevel"); return (Criteria) this; } public Criteria andUserLevelNotEqualTo(Integer value) { addCriterion("user_level <>", value, "userLevel"); return (Criteria) this; } public Criteria andUserLevelGreaterThan(Integer value) { addCriterion("user_level >", value, "userLevel"); return (Criteria) this; } public Criteria andUserLevelGreaterThanOrEqualTo(Integer value) { addCriterion("user_level >=", value, "userLevel"); return (Criteria) this; } public Criteria andUserLevelLessThan(Integer value) { addCriterion("user_level <", value, "userLevel"); return (Criteria) this; } public Criteria andUserLevelLessThanOrEqualTo(Integer value) { addCriterion("user_level <=", value, "userLevel"); return (Criteria) this; } public Criteria andUserLevelIn(List<Integer> values) { addCriterion("user_level in", values, "userLevel"); return (Criteria) this; } public Criteria andUserLevelNotIn(List<Integer> values) { addCriterion("user_level not in", values, "userLevel"); return (Criteria) this; } public Criteria andUserLevelBetween(Integer value1, Integer value2) { addCriterion("user_level between", value1, value2, "userLevel"); return (Criteria) this; } public Criteria andUserLevelNotBetween(Integer value1, Integer value2) { addCriterion("user_level not between", value1, value2, "userLevel"); return (Criteria) this; } public Criteria andPointsIsNull() { addCriterion("points is null"); return (Criteria) this; } public Criteria andPointsIsNotNull() { addCriterion("points is not null"); return (Criteria) this; } public Criteria andPointsEqualTo(Integer value) { addCriterion("points =", value, "points"); return (Criteria) this; } public Criteria andPointsNotEqualTo(Integer value) { addCriterion("points <>", value, "points"); return (Criteria) this; } public Criteria andPointsGreaterThan(Integer value) { addCriterion("points >", value, "points"); return (Criteria) this; } public Criteria andPointsGreaterThanOrEqualTo(Integer value) { addCriterion("points >=", value, "points"); return (Criteria) this; } public Criteria andPointsLessThan(Integer value) { addCriterion("points <", value, "points"); return (Criteria) this; } public Criteria andPointsLessThanOrEqualTo(Integer value) { addCriterion("points <=", value, "points"); return (Criteria) this; } public Criteria andPointsIn(List<Integer> values) { addCriterion("points in", values, "points"); return (Criteria) this; } public Criteria andPointsNotIn(List<Integer> values) { addCriterion("points not in", values, "points"); return (Criteria) this; } public Criteria andPointsBetween(Integer value1, Integer value2) { addCriterion("points between", value1, value2, "points"); return (Criteria) this; } public Criteria andPointsNotBetween(Integer value1, Integer value2) { addCriterion("points not between", value1, value2, "points"); return (Criteria) this; } public Criteria andExperienceValueIsNull() { addCriterion("experience_value is null"); return (Criteria) this; } public Criteria andExperienceValueIsNotNull() { addCriterion("experience_value is not null"); return (Criteria) this; } public Criteria andExperienceValueEqualTo(Integer value) { addCriterion("experience_value =", value, "experienceValue"); return (Criteria) this; } public Criteria andExperienceValueNotEqualTo(Integer value) { addCriterion("experience_value <>", value, "experienceValue"); return (Criteria) this; } public Criteria andExperienceValueGreaterThan(Integer value) { addCriterion("experience_value >", value, "experienceValue"); return (Criteria) this; } public Criteria andExperienceValueGreaterThanOrEqualTo(Integer value) { addCriterion("experience_value >=", value, "experienceValue"); return (Criteria) this; } public Criteria andExperienceValueLessThan(Integer value) { addCriterion("experience_value <", value, "experienceValue"); return (Criteria) this; } public Criteria andExperienceValueLessThanOrEqualTo(Integer value) { addCriterion("experience_value <=", value, "experienceValue"); return (Criteria) this; } public Criteria andExperienceValueIn(List<Integer> values) { addCriterion("experience_value in", values, "experienceValue"); return (Criteria) this; } public Criteria andExperienceValueNotIn(List<Integer> values) { addCriterion("experience_value not in", values, "experienceValue"); return (Criteria) this; } public Criteria andExperienceValueBetween(Integer value1, Integer value2) { addCriterion("experience_value between", value1, value2, "experienceValue"); return (Criteria) this; } public Criteria andExperienceValueNotBetween(Integer value1, Integer value2) { addCriterion("experience_value not between", value1, value2, "experienceValue"); return (Criteria) this; } public Criteria andBirthdayIsNull() { addCriterion("birthday is null"); return (Criteria) this; } public Criteria andBirthdayIsNotNull() { addCriterion("birthday is not null"); return (Criteria) this; } public Criteria andBirthdayEqualTo(Date value) { addCriterion("birthday =", value, "birthday"); return (Criteria) this; } public Criteria andBirthdayNotEqualTo(Date value) { addCriterion("birthday <>", value, "birthday"); return (Criteria) this; } public Criteria andBirthdayGreaterThan(Date value) { addCriterion("birthday >", value, "birthday"); return (Criteria) this; } public Criteria andBirthdayGreaterThanOrEqualTo(Date value) { addCriterion("birthday >=", value, "birthday"); return (Criteria) this; } public Criteria andBirthdayLessThan(Date value) { addCriterion("birthday <", value, "birthday"); return (Criteria) this; } public Criteria andBirthdayLessThanOrEqualTo(Date value) { addCriterion("birthday <=", value, "birthday"); return (Criteria) this; } public Criteria andBirthdayIn(List<Date> values) { addCriterion("birthday in", values, "birthday"); return (Criteria) this; } public Criteria andBirthdayNotIn(List<Date> values) { addCriterion("birthday not in", values, "birthday"); return (Criteria) this; } public Criteria andBirthdayBetween(Date value1, Date value2) { addCriterion("birthday between", value1, value2, "birthday"); return (Criteria) this; } public Criteria andBirthdayNotBetween(Date value1, Date value2) { addCriterion("birthday not between", value1, value2, "birthday"); return (Criteria) this; } public Criteria andLastLoginTimeIsNull() { addCriterion("last_login_time is null"); return (Criteria) this; } public Criteria andLastLoginTimeIsNotNull() { addCriterion("last_login_time is not null"); return (Criteria) this; } public Criteria andLastLoginTimeEqualTo(Date value) { addCriterion("last_login_time =", value, "lastLoginTime"); return (Criteria) this; } public Criteria andLastLoginTimeNotEqualTo(Date value) { addCriterion("last_login_time <>", value, "lastLoginTime"); return (Criteria) this; } public Criteria andLastLoginTimeGreaterThan(Date value) { addCriterion("last_login_time >", value, "lastLoginTime"); return (Criteria) this; } public Criteria andLastLoginTimeGreaterThanOrEqualTo(Date value) { addCriterion("last_login_time >=", value, "lastLoginTime"); return (Criteria) this; } public Criteria andLastLoginTimeLessThan(Date value) { addCriterion("last_login_time <", value, "lastLoginTime"); return (Criteria) this; } public Criteria andLastLoginTimeLessThanOrEqualTo(Date value) { addCriterion("last_login_time <=", value, "lastLoginTime"); return (Criteria) this; } public Criteria andLastLoginTimeIn(List<Date> values) { addCriterion("last_login_time in", values, "lastLoginTime"); return (Criteria) this; } public Criteria andLastLoginTimeNotIn(List<Date> values) { addCriterion("last_login_time not in", values, "lastLoginTime"); return (Criteria) this; } public Criteria andLastLoginTimeBetween(Date value1, Date value2) { addCriterion("last_login_time between", value1, value2, "lastLoginTime"); return (Criteria) this; } public Criteria andLastLoginTimeNotBetween(Date value1, Date value2) { addCriterion("last_login_time not between", value1, value2, "lastLoginTime"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
[ "jb112224@sina.com" ]
jb112224@sina.com