blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
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
684M
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
132 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
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
9545c173a13e91cacadd0d509e99b493788b5b03
17e8438486cb3e3073966ca2c14956d3ba9209ea
/dso/tags/4.0.2/dso-common/src/test/java/com/tc/object/locks/LockIdSerializerTest.java
4008129dfe1df0bc4c7c975b36601bb44c67d992
[]
no_license
sirinath/Terracotta
fedfc2c4f0f06c990f94b8b6c3b9c93293334345
00a7662b9cf530dfdb43f2dd821fa559e998c892
refs/heads/master
2021-01-23T05:41:52.414211
2015-07-02T15:21:54
2015-07-02T15:21:54
38,613,711
1
0
null
null
null
null
UTF-8
Java
false
false
4,417
java
/* * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. */ package com.tc.object.locks; import com.tc.io.TCByteBufferInput; import com.tc.io.TCByteBufferInputStream; import com.tc.io.TCByteBufferOutput; import com.tc.io.TCByteBufferOutputStream; import com.tc.object.LiteralValues; import com.tc.object.ObjectID; import com.tc.object.bytecode.Manageable; import com.tc.object.bytecode.Manager; import com.tc.object.loaders.ClassProvider; import com.tc.util.Assert; import java.io.IOException; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import junit.framework.TestCase; public class LockIdSerializerTest extends TestCase { public void testDsoLockID() { DsoLockID lock = new DsoLockID(new ObjectID(42L)); Assert.assertEquals(lock, passThrough(lock)); } public void testVolatileLockID() { DsoVolatileLockID lock = new DsoVolatileLockID(new ObjectID(42L), "theMeaning"); Assert.assertEquals(lock, passThrough(lock)); } public void testStringLockID() { StringLockID lock = new StringLockID("FortyTwo"); Assert.assertEquals(lock, passThrough(lock)); } public void testLongLockID() { LongLockID lock = new LongLockID(42L); Assert.assertEquals(lock, passThrough(lock)); } public void testLiteralLockID() { literalLockTest(Integer.valueOf(42)); literalLockTest(Long.valueOf(42)); literalLockTest(Character.valueOf((char) 42)); literalLockTest(Float.valueOf(42f)); literalLockTest(Double.valueOf(42d)); literalLockTest(Byte.valueOf((byte) 42)); literalLockTest(Boolean.valueOf(true)); literalLockTest(Short.valueOf((short) 42)); literalLockTest(MyEnum.A); try { literalLockTest("bad string!"); throw new IllegalStateException(); } catch (AssertionError e) { // expected } try { literalLockTest(Object.class); throw new IllegalStateException(); } catch (AssertionError e) { // expected } try { literalLockTest(new ObjectID(42)); throw new IllegalStateException(); } catch (AssertionError e) { // expected } } public void literalLockTest(Object literal) { DsoLiteralLockID lock = new DsoLiteralLockID(manager, literal); Assert.assertEquals(lock, passThrough(lock)); } public void unclusteredLockTest(Object literal) { try { new DsoLiteralLockID(manager, literal); Assert.fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException e) { // expected } } private LockID passThrough(LockID in) { try { TCByteBufferOutput tcOut = new TCByteBufferOutputStream(); try { LockIDSerializer serializer = new LockIDSerializer(in); serializer.serializeTo(tcOut); } finally { tcOut.close(); } TCByteBufferInput tcIn = new TCByteBufferInputStream(tcOut.toArray()); try { LockIDSerializer serializer = new LockIDSerializer(); serializer.deserializeFrom(tcIn); return serializer.getLockID(); } finally { tcIn.close(); } } catch (IOException e) { throw new AssertionError(e); } } static enum MyEnum { A, B, C } static Manager manager = (Manager) Proxy.newProxyInstance(LockIDSerializer.class.getClassLoader(), new Class[] { Manager.class }, new DumbClassProvider()); static class DumbClassProvider implements ClassProvider, InvocationHandler { static ClassLoader CLASS_LOADER = LockIDSerializer.class.getClassLoader(); @Override public Class getClassFor(String className) { throw new AssertionError(); } /* * Copied from ManagerImpl */ public boolean isLiteralAutolock(final Object o) { if (o instanceof Manageable) { return false; } return (!(o instanceof Class)) && (!(o instanceof ObjectID)) && LiteralValues.isLiteralInstance(o); } @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("getClassProvider".equals(method.getName())) { return this; } else if ("isLiteralAutolock".equals(method.getName())) { return isLiteralAutolock(args[0]); } else { throw new AssertionError("Cannot handle " + method); } } } }
[ "cruise@7fc7bbf3-cf45-46d4-be06-341739edd864" ]
cruise@7fc7bbf3-cf45-46d4-be06-341739edd864
ce5d3fceb28239383db9edf2ebbf0013dac439a7
aa2bbb078328b3705bdd97825fd68aa221f19d1f
/src/main/java/com/zhiguogongfang/hrmapp/service/NoticeService.java
e1e2c6944072fe1c7ca8a91f9ba2e1f813d8fe5f
[]
no_license
wlzcool/hrmapp
8c83d68c38f6f006ea3fdc3614987dc0f8c409cb
05306489efbbeeddff984a6e91c2d6acd3b1e4e6
refs/heads/master
2020-04-13T00:46:50.424787
2018-12-23T01:37:29
2018-12-23T01:37:29
162,854,324
0
0
null
null
null
null
UTF-8
Java
false
false
380
java
package com.zhiguogongfang.hrmapp.service; import com.zhiguogongfang.hrmapp.domain.Dept; import com.zhiguogongfang.hrmapp.domain.Notice; import java.util.List; public interface NoticeService { List<Notice> findNotice(); void removeNoticeById(Integer id); Notice findNoticeById(Integer id); void addNotice(Notice notice); void modifyNotice(Notice notice); }
[ "wlzcool@foxmail.com" ]
wlzcool@foxmail.com
3ad2856b3d51a02cdf010188e3a1f00590efbc78
4ca2e1acb081aedfc290d4cd076c8401e6a58f2d
/RemoteControl/src/newRemoteControl/interfaces/iRemoteControl.java
165df205f144611e7c13a48756a17eb9eb93f082
[]
no_license
Dev01-5/Dev01-5
a8c8c92c19232be705a49a192aada92ec42f7523
1c24e5ab2304178fbc7e46459adf56f0f3f0916b
refs/heads/master
2021-01-10T19:11:50.554379
2013-11-06T16:28:52
2013-11-06T16:28:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
764
java
package newRemoteControl.interfaces; import java.awt.Color; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JTextArea; import newRemoteControl.View.FrameView.Position; import newRemoteControl.View.FrameView.Size; import newRemoteControl.View.FrameView; public interface iRemoteControl { void addButton(FrameView view, JButton button); void addTextArea(FrameView view, JTextArea field); void setWindowTitle(String value); void setWindowSize(Size value); void setWindowPosition(Position value); void setWindowBackground(Color color); void setRemoteWindow(); String getWindowTitle(); Size getWindowSize(); Position getWindowPosition(); JButton[] getButtons(); Color getWindowBackground(); JFrame getRemoteWindow(); }
[ "dennis.wielen@gmail.com" ]
dennis.wielen@gmail.com
0cf4c34f887062bb0716504ed6622d3c9685ad36
7fcaa33f88e83a7a065dd1bc0cf5525c84174dfe
/src/MetaInformation/AMCUser.java
a76ece020d1ac31c3bdbf9f52982a9170352cf3b
[]
no_license
mshayganfar/AffectiveMotivationalCollaborationFramework
9c48ad68d4f1bfc6b88aca76c2d431711ceb41d7
dbc950d3092f84c08f359b48d0fe84fa27772e69
refs/heads/master
2020-04-06T03:57:12.137822
2016-07-07T13:50:57
2016-07-07T13:50:57
56,329,997
0
0
null
2016-06-15T18:37:49
2016-04-15T15:22:35
Java
UTF-8
Java
false
false
696
java
package MetaInformation; import edu.wpi.disco.Actor; import edu.wpi.disco.Agenda; import edu.wpi.disco.Interaction; import edu.wpi.disco.User; import edu.wpi.disco.plugin.AuthorizedPlugin; public class AMCUser extends Actor{ private MentalProcesses mentalProcesses; public AMCUser(String name, Actor who) { super(name, new Agenda(who)); // super(name); } public void prepareUser(MentalProcesses mentalProcesses) { this.mentalProcesses = mentalProcesses; } @Override public void init () { new AuthorizedPlugin(agenda, 225); } @Override protected boolean synchronizedRespond(Interaction interaction, boolean ok, boolean guess) { throw new IllegalStateException(); } }
[ "mshayganfar@wpi.edu" ]
mshayganfar@wpi.edu
be07ff2c377799083eb71169ba5dd83ad810a592
5795f87fea8517bbd3d19bd9bbcb973414796bd1
/src/main/java/com/beamofsoul/bip/entity/query/QBaseAbstractRelationalEntity.java
5176b634367262d77816f2c3743fe58be43a372c
[ "Apache-2.0" ]
permissive
suhuo66/BusinessInfrastructurePlatformGroupVersion
dacdac12588a6bc88f1e791cc6ed55ea25177df7
46ea11f9f096fe583bab965a535effe7c75dab09
refs/heads/master
2020-03-18T11:13:33.668667
2018-05-24T03:51:12
2018-05-24T03:51:12
134,658,115
0
0
null
2018-05-24T03:49:23
2018-05-24T03:49:22
null
UTF-8
Java
false
false
1,494
java
package com.beamofsoul.bip.entity.query; import static com.querydsl.core.types.PathMetadataFactory.*; import com.querydsl.core.types.dsl.*; import com.querydsl.core.types.PathMetadata; import javax.annotation.Generated; import com.beamofsoul.bip.entity.BaseAbstractRelationalEntity; import com.querydsl.core.types.Path; /** * QBaseAbstractRelationalEntity is a Querydsl query type for BaseAbstractRelationalEntity */ @Generated("com.querydsl.codegen.SupertypeSerializer") public class QBaseAbstractRelationalEntity extends EntityPathBase<BaseAbstractRelationalEntity> { private static final long serialVersionUID = -1933339813L; public static final QBaseAbstractRelationalEntity baseAbstractRelationalEntity = new QBaseAbstractRelationalEntity("baseAbstractRelationalEntity"); public final QBaseAbstractEntity _super = new QBaseAbstractEntity(this); //inherited public final DateTimePath<java.util.Date> createDate = _super.createDate; //inherited public final DateTimePath<java.util.Date> modifyDate = _super.modifyDate; public QBaseAbstractRelationalEntity(String variable) { super(BaseAbstractRelationalEntity.class, forVariable(variable)); } public QBaseAbstractRelationalEntity(Path<? extends BaseAbstractRelationalEntity> path) { super(path.getType(), path.getMetadata()); } public QBaseAbstractRelationalEntity(PathMetadata metadata) { super(BaseAbstractRelationalEntity.class, metadata); } }
[ "beamofsoul@sina.com" ]
beamofsoul@sina.com
8f2ab2b44d69037046e07751fd5745dfadf74a30
300058aa133f9e9291311e8b27fd68f361ade818
/src/java/DrPlant/email/EmailService.java
cadef59ca61a6dd59f629a9fac636f8f9e3fec10
[]
no_license
eneko1225/drplantServer
883d527672cf01c5757eeb99f941cd1e543f6ec9
154cbb5e18f0f52c84adc75e42566fb7ff6f0b92
refs/heads/master
2023-02-28T05:05:35.236504
2021-01-29T07:28:53
2021-01-29T07:28:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,760
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 DrPlant.email; import DrPlant.encryption.PrivadaEmail; import java.util.Properties; import javax.mail.Authenticator; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Multipart; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; /** * Builds an Email Service capable of sending normal email to a given SMTP Host. * Currently <b>send()</b> can only works with text. */ public class EmailService { PrivadaEmail priv = new PrivadaEmail(); //private static final ResourceBundle EmailFile = ResourceBundle.getBundle("DrPlant.email.email"); // Server mail user & pass account private String user = priv.descifrarTexto("correo.txt"); private String pass = priv.descifrarTexto("contraseña.txt"); // DNS Host + SMTP Port private String smtp_host = "smtp.gmail.com"; private int smtp_port = 465; @SuppressWarnings("unused") public EmailService() { } /** * Sends the given <b>text</b> from the <b>sender</b> to the * <b>receiver</b>. In any case, both the <b>sender</b> and <b>receiver</b> * must exist and be valid mail addresses. The sender, mail's FROM part, is * taken from this.user by default<br/> * <br/> * * Note the <b>user</b> and <b>pass</b> for the authentication is provided * in the class constructor. Ideally, the <b>sender</b> and the <b>user</b> * coincide. * * @param receiver The mail's TO part * @param nuevaContraseña The new e-mail * @throws MessagingException Is something awry happens * */ public void sendMail(String receiver, String nuevaContraseña) throws MessagingException { //user= priv.cifrarTexto(new String(priv.fileReader("Z:\\2DAMi\\Reto2\\SERVIDOR\\drplantServer\\src\\java\\DrPlant\\encryption\\RSA_Private.key")), "serv1doR"); //System.out.println(priv.descifrarTexto("Z:\\2DAMi\\Reto2\\SERVIDOR\\drplantServer\\src\\java\\DrPlant\\email\\contraseña.txt")+priv.descifrarTexto("Z:\\2DAMi\\Reto2\\SERVIDOR\\drplantServer\\src\\java\\DrPlant\\email\\correo.txt")); // Mail properties Properties properties = new Properties(); properties.put("mail.smtp.auth", true); properties.put("mail.smtp.starttls.enable", "true"); properties.put("mail.smtp.host", smtp_host); properties.put("mail.smtp.port", smtp_port); properties.put("mail.smtp.ssl.enable", "true"); properties.put("mail.smtp.auth", "true"); properties.put("mail.smtp.ssl.trust", smtp_host); properties.put("mail.imap.partialfetch", false); // Authenticator knows how to obtain authentication for a network connection. Session session = Session.getInstance(properties, new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(user, pass); } }); // MIME message to be sent Message message = new MimeMessage(session); message.setFrom(new InternetAddress(user)); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(receiver)); // Ej: receptor@gmail.com message.setSubject("Cambio de contraseña"); // Asunto del mensaje // A mail can have several parts Multipart multipart = new MimeMultipart(); // A message part (the message, but can be also a File, etc...) MimeBodyPart mimeBodyPart = new MimeBodyPart(); mimeBodyPart.setContent("<!DOCTYPE html>\n" + "<html>\n" + " <head>\n" + " <title>TODO supply a title</title>\n" + " <meta charset=\"UTF-8\">\n" + " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n " + " <style type=\"text/css\">\n" + " #contenedor { \n" + " background-color: lightgray; \n" + " padding: 5% 5% 5% 5%;\n" + " text-align: center;\n" + " display: block;" + " }\n" + " body{\n" + " padding-left: 5%;\n" + " padding-right: 5%;\n" + " }\n" + " </style>" + " </head>\n" + " <body> \n" + " <div id=\"contenedor\">\n" + " <img alt=\"Logo Dr. Plant\" src=\"https://cdn.dribbble.com/users/2068059/screenshots/4216858/science_plant_logo.png?compress=1&resize=200x150\"/>\n" + " <h1>Dr. Plant S.L. le informa de que su nueva contraseña es: </h1>\n" + " <h2>" + nuevaContraseña + "</h2>\n" + " Gracias por confiar en nosotros :)\n" + " </div>\n" + " </body>\n" + "</html>\n" + "", "text/html"); multipart.addBodyPart(mimeBodyPart); // Adding up the parts to the MIME message message.setContent(multipart); // And here it goes... Transport.send(message); } }
[ "eneko@DESKTOP-3ULA5MQ" ]
eneko@DESKTOP-3ULA5MQ
cd7a79d0222202ed0ab66b5e5f6f631283cfb053
716c3956a1d959a7379f59e5df1e095c2bd8357e
/Projeto 03/Game.java
e94724109aef2ea058e07e666cd1ad859b35a881
[]
no_license
sydo26/POO-2020-2
fd8902a6965c63d51f9b214bf57df8841595eabb
987675343211af51e806c3c7fbd076e027e93638
refs/heads/main
2023-04-13T10:21:09.969607
2021-04-07T04:39:23
2021-04-07T04:39:23
315,615,929
1
0
null
null
null
null
UTF-8
Java
false
false
1,383
java
import java.awt.*; import listeners.GameListeners; import screens.game.GameScreen; public class Game implements GameListeners { private Player player; private GameScreen gameScreen; private int pointBooster = 1; public Game(String nickName) { this.player = new Player(nickName); Game game = this; EventQueue.invokeLater(new Runnable() { @Override public void run() { new GameScreen("GIVEME POINTS", game); } }); } @Override public String playerNickName() { return this.player.getNickname(); } @Override public void upBooster() { this.pointBooster *= 2; } @Override public int getBooster() { return this.pointBooster; } @Override public void addPoints(int value) { this.player.setPoints(this.player.getPoints() + value); } @Override public long getPoints() { return this.player.getPoints(); } @Override public void removePoints(int value) { this.player.setPoints(this.player.getPoints() - value); } protected void setGameScreen(GameScreen gameScreen) { this.gameScreen = gameScreen; } public Player getPlayer() { return this.player; } public GameScreen getGameScreen() { return this.gameScreen; } }
[ "sydoafk@gmail.com" ]
sydoafk@gmail.com
3254618edb24469a4a5c8109715987936257f840
b2d2250699b7dfd31c77e2d7cce83d936c7b146c
/Servlet_advanced/src/com/imooc/servlet/direct/CheckLoginServelt.java
a1ba770fe85dab0d79535a7b69f19b15bdb148aa
[]
no_license
taotao0501/JavaLearningFromScratch
4bcbaa07e6ed96ad37b35ab62c0271ba1728cab6
0a81fe6ec03387290dae31024a891a194cfb1df2
refs/heads/master
2023-03-26T01:43:51.113555
2021-03-04T14:06:50
2021-03-04T14:06:50
326,297,490
0
0
null
null
null
null
UTF-8
Java
false
false
895
java
package com.imooc.servlet.direct; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @WebServlet("/direct/check") public class CheckLoginServelt extends HttpServlet { public CheckLoginServelt(){ super(); } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { System.out.println("用户登陆成功!"); req.setAttribute("username","admin"); //实现了请求转发的功能 req.getRequestDispatcher("/direct/index").forward(req,resp); // 响应重定向 需要增加 contextPath //resp.sendRedirect("/Servlet_advanced_war_exploded/direct/index"); } }
[ "21707001sbt@zju.edu.cn" ]
21707001sbt@zju.edu.cn
0939fb56c941a516e4a8cdd12e50e257628936a9
c201fe2b82e7cb70a0d74dd215d973ae1a04f533
/src/main/java/it/fb5/imgshare/imgshare/repository/ImageRepository.java
03724c4959fdb70bd06befa5a226f32b03ddab74
[ "MIT" ]
permissive
mpotthoff/spring-boot-demo
0abbd52c2d949d96aae38911ae2d6181cb28a6df
edf86f8652ba850ad0062f92fab0f44e6d591b28
refs/heads/master
2021-01-04T00:59:52.101157
2020-02-13T17:07:36
2020-02-13T17:07:36
240,313,546
0
0
null
null
null
null
UTF-8
Java
false
false
288
java
package it.fb5.imgshare.imgshare.repository; import it.fb5.imgshare.imgshare.entity.Image; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository public interface ImageRepository extends CrudRepository<Image, Long> { }
[ "michael@potthoff.eu" ]
michael@potthoff.eu
91963afe348b83181f0f353201cf9694a8581bff
e6039fdb4c1e71726085c874781a243755f5b8f4
/22-Spring-Cloud-Eureka-Client/src/main/java/com/consulting/mgt/springboot/practica22/eurekaclient/helper/EurekaClientHelper.java
94e8f40a007611eabda52e69f32662b4e88ef6ed
[]
no_license
tlacuache987/microserviceMgtGrupo1
0037b9c8dbe5108de03df0fa04058e47861ea79c
a0c1495c73d59c349706995495cac4c3a81c8184
refs/heads/master
2020-05-29T13:00:59.091079
2019-07-31T23:26:43
2019-07-31T23:26:43
189,145,212
1
1
null
null
null
null
UTF-8
Java
false
false
798
java
package com.consulting.mgt.springboot.practica22.eurekaclient.helper; import java.net.URI; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.netflix.appinfo.InstanceInfo; import com.netflix.discovery.EurekaClient; import lombok.SneakyThrows; @Component public class EurekaClientHelper { // Inyecta EurekaClient eurekaClient; @Autowired private EurekaClient eurekaClient; @SneakyThrows public URI getServiceURI(String appName) { // Implementa return new URI(eurekaClient .getNextServerFromEureka(appName, false) .getHomePageUrl()); } public List<InstanceInfo> getInstances(String appName) { // Implementa return eurekaClient.getInstancesByVipAddress(appName, false); } }
[ "isc.ivgarcia@gmail.com" ]
isc.ivgarcia@gmail.com
b4302739c26924f1ccc5201b085f419d4da6b329
f095f42abf96a1f72a88bf0601d4ac50d6aadecd
/src/server-java/testapp-interactive/lib/nextapp/echo/testapp/interactive/testscreen/ColumnTest.java
9da0dec1543ba7cf474a1280a9ca448a9331b45c
[]
no_license
XSoftBG/echo3
c5b199dd3bb3ac510525d4ae4ce93fa320ed37b5
ec26549cd9fb3342545f0b8c98d40b92a16fbe64
refs/heads/master
2021-01-01T17:56:16.199487
2015-08-27T16:38:43
2015-08-27T16:38:43
3,494,130
0
0
null
null
null
null
UTF-8
Java
false
false
17,028
java
/* * This file is part of the Echo Web Application Framework (hereinafter "Echo"). * Copyright (C) 2002-2009 NextApp, Inc. * * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. */ package nextapp.echo.testapp.interactive.testscreen; import nextapp.echo.app.Border; import nextapp.echo.app.Button; import nextapp.echo.app.Color; import nextapp.echo.app.Column; import nextapp.echo.app.Component; import nextapp.echo.app.DecimalExtent; import nextapp.echo.app.Extent; import nextapp.echo.app.Insets; import nextapp.echo.app.Label; import nextapp.echo.app.SplitPane; import nextapp.echo.app.event.ActionEvent; import nextapp.echo.app.event.ActionListener; import nextapp.echo.app.layout.ColumnLayoutData; import nextapp.echo.app.layout.SplitPaneLayoutData; import nextapp.echo.testapp.interactive.ButtonColumn; import nextapp.echo.testapp.interactive.StyleUtil; import nextapp.echo.testapp.interactive.Styles; public class ColumnTest extends SplitPane { private static final SplitPaneLayoutData insetLayoutData; static { insetLayoutData = new SplitPaneLayoutData(); insetLayoutData.setInsets(new Insets(10)); } private int nextValue = 0; public ColumnTest() { super(); setStyleName("TestControls"); ButtonColumn controlsColumn = new ButtonColumn(); controlsColumn.setStyleName("TestControlsColumn"); add(controlsColumn); final Column testColumn = new Column(); testColumn.setBorder(new Border(new Extent(1), Color.BLUE, Border.STYLE_SOLID)); testColumn.setLayoutData(insetLayoutData); add(testColumn); controlsColumn.addButton("Add Item (at beginning)", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.add(new Label("Added item [" + nextValue++ + "]"), 0); } }); controlsColumn.addButton("Add Item (at index 1)", new ActionListener() { public void actionPerformed(ActionEvent e) { if (testColumn.getComponentCount() >= 1) { testColumn.add(new Label("Added item [" + nextValue++ + "]"), 1); } } }); controlsColumn.addButton("Add Item (at index 2)", new ActionListener() { public void actionPerformed(ActionEvent e) { if (testColumn.getComponentCount() >= 2) { testColumn.add(new Label("Added item [" + nextValue++ + "]"), 2); } } }); controlsColumn.addButton("Add Item (at end - 1)", new ActionListener() { public void actionPerformed(ActionEvent e) { if (testColumn.getComponentCount() >= 1) { testColumn.add(new Label("Added item [" + nextValue++ + "]"), testColumn.getComponentCount() - 1); } } }); controlsColumn.addButton("Add Item (at end)", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.add(new Label("Added item [" + nextValue++ + "]")); } }); controlsColumn.addButton("Add Two Items (at end)", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.add(new Label("Added item [" + nextValue++ + "]")); testColumn.add(new Label("Added item [" + nextValue++ + "]")); } }); controlsColumn.addButton("Add Item, Remove/Add Column Itself", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.add(new Label("Added item [" + nextValue++ + "]")); Component parent = testColumn.getParent(); parent.remove(testColumn); parent.add(testColumn); } }); controlsColumn.addButton("Remove Item 0", new ActionListener() { public void actionPerformed(ActionEvent e) { if (testColumn.getComponentCount() > 0) { testColumn.remove(0); } } }); controlsColumn.addButton("Remove Item 1", new ActionListener() { public void actionPerformed(ActionEvent e) { if (testColumn.getComponentCount() > 1) { testColumn.remove(1); } } }); controlsColumn.addButton("Remove Item 2", new ActionListener() { public void actionPerformed(ActionEvent e) { if (testColumn.getComponentCount() > 2) { testColumn.remove(2); } } }); controlsColumn.addButton("Remove Second-to-Last Item", new ActionListener() { public void actionPerformed(ActionEvent e) { if (testColumn.getComponentCount() >= 2) { testColumn.remove(testColumn.getComponentCount() - 2); } } }); controlsColumn.addButton("Remove Last Item", new ActionListener() { public void actionPerformed(ActionEvent e) { if (testColumn.getComponentCount() > 0) { testColumn.remove(testColumn.getComponentCount() - 1); } } }); controlsColumn.addButton("Rotate", new ActionListener() { public void actionPerformed(ActionEvent e) { if (testColumn.getComponentCount() == 0) { return; } Component component = testColumn.getComponent(testColumn.getComponentCount() - 1); testColumn.remove(component); testColumn.add(component, 0); } }); controlsColumn.addButton("Add-Remove Container (at end)", new ActionListener() { public void actionPerformed(ActionEvent e) { Column subColumn = new Column(); subColumn.add(new Label()); testColumn.add(subColumn); testColumn.remove(subColumn); } }); controlsColumn.addButton("Add-Remove Item (at end)", new ActionListener() { public void actionPerformed(ActionEvent e) { Label label = new Label("Never Added item [" + nextValue++ + "]"); testColumn.add(label); testColumn.remove(label); } }); controlsColumn.addButton("Add-Remove-Add Item (at end)", new ActionListener() { public void actionPerformed(ActionEvent e) { Label label = new Label("Added item [" + nextValue++ + "]"); testColumn.add(label); testColumn.remove(label); testColumn.add(label); } }); controlsColumn.addButton("Add Some Items, Remove Some Items", new ActionListener() { public void actionPerformed(ActionEvent e) { int count = 1 + ((int) (Math.random() * 10)); for (int i = 0; i < count; ++i) { int componentCount = testColumn.getComponentCount(); if (componentCount > 0 && ((int) (Math.random() * 2)) == 0) { // Perform remove. int position = (int) (Math.random() * componentCount); testColumn.remove(position); } else { // Perform add. int position = (int) (Math.random() * (componentCount + 1)); testColumn.add(new Label("Added item [" + nextValue++ + "]"), position); } } } }); controlsColumn.addButton("Randomly Remove and Re-insert Item", new ActionListener() { public void actionPerformed(ActionEvent e) { int itemCount = testColumn.getComponentCount(); if (itemCount == 0) { return; } Component item = testColumn.getComponent((int) (Math.random() * itemCount)); testColumn.remove(item); testColumn.add(item, (int) (Math.random() * (itemCount - 1))); } }); controlsColumn.addButton("Add Changing Button", new ActionListener() { public void actionPerformed(ActionEvent e) { final Button button = new Button(Integer.toString(nextValue++)); button.setStyleName("Default"); button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { try { int newValue = Integer.parseInt(button.getText()) + 1; button.setText(Integer.toString(newValue)); } catch (NumberFormatException ex) { button.setText("0"); } } }); testColumn.add(button); } }); controlsColumn.addButton("Set Foreground", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.setForeground(StyleUtil.randomColor()); } }); controlsColumn.addButton("Clear Foreground", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.setForeground(null); } }); controlsColumn.addButton("Set Background", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.setBackground(StyleUtil.randomColor()); } }); controlsColumn.addButton("Clear Background", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.setBackground(null); } }); controlsColumn.addButton("Set Border (All Attributes)", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.setBorder(StyleUtil.randomBorder()); } }); controlsColumn.addButton("Set Border Color", new ActionListener() { public void actionPerformed(ActionEvent e) { Border border = testColumn.getBorder(); if (border == null) { border = new Border(new Extent(1), Color.BLUE, Border.STYLE_SOLID); } testColumn.setBorder(new Border(border.getSize(), StyleUtil.randomColor(), border.getStyle())); } }); controlsColumn.addButton("Set Border Size", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.setBorder(StyleUtil.nextBorderSize(testColumn.getBorder())); } }); controlsColumn.addButton("Set Border Style", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.setBorder(StyleUtil.nextBorderStyle(testColumn.getBorder())); } }); controlsColumn.addButton("Remove Border", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.setBorder(null); } }); controlsColumn.addButton("Cell Spacing -> 0px", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.setCellSpacing(new Extent(0, Extent.PX)); } }); controlsColumn.addButton("Cell Spacing -> 2px", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.setCellSpacing(new Extent(2, Extent.PX)); } }); controlsColumn.addButton("Cell Spacing -> 20px", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.setCellSpacing(new Extent(20, Extent.PX)); } }); controlsColumn.addButton("Insets -> null", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.setInsets(null); } }); controlsColumn.addButton("Insets -> 0px", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.setInsets(new Insets(0)); } }); controlsColumn.addButton("Insets -> 5px", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.setInsets(new Insets(5)); } }); controlsColumn.addButton("Insets -> 0.5em", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.setInsets(new Insets(new DecimalExtent(0.5, Extent.EM))); } }); controlsColumn.addButton("Insets -> 10/20/30/40px", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.setInsets(new Insets(10, 20, 30, 40)); } }); controlsColumn.addButton("Insets -> 0.5em/1.5em", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.setInsets(new Insets(new DecimalExtent(0.5, Extent.EM), new DecimalExtent(1.5, Extent.EM))); } }); controlsColumn.addButton("Set Layout Data (of random item)", new ActionListener() { public void actionPerformed(ActionEvent e) { int componentCount = testColumn.getComponentCount(); if (componentCount == 0) { return; } Component component = testColumn.getComponent((int) (Math.random() * componentCount)); ColumnLayoutData columnLayoutData = new ColumnLayoutData(); columnLayoutData.setAlignment(StyleUtil.randomAlignmentHV()); columnLayoutData.setBackground(StyleUtil.randomBrightColor()); columnLayoutData.setInsets(new Insets((int) (Math.random() * 30))); switch((int) (Math.random() * 7)) { case 0: columnLayoutData.setBackgroundImage(Styles.BG_SHADOW_DARK_BLUE); break; case 1: columnLayoutData.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE); break; case 2: columnLayoutData.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE_5_PX_REPEAT); break; case 3: columnLayoutData.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE_1_PERCENT_REPEAT); break; default: columnLayoutData.setBackgroundImage(null); } component.setLayoutData(columnLayoutData); } }); controlsColumn.addButton("Add Item, Randomize Column Insets", new ActionListener() { public void actionPerformed(ActionEvent e) { testColumn.add(new Label("Added item [" + nextValue++ + "]")); testColumn.setInsets(new Insets((int) (Math.random() * 50))); } }); controlsColumn.addButton("Toggle Test Inset", new ActionListener() { public void actionPerformed(ActionEvent e) { if (testColumn.getLayoutData() == null) { testColumn.setLayoutData(insetLayoutData); } else { testColumn.setLayoutData(null); } } }); } }
[ "andrey@xsoftbg.com" ]
andrey@xsoftbg.com
5094d2f77e31e6497c33bc3fee0ff48bbfca4004
c677934faaf99328c41343d42f844d5cf2dd2c03
/PDFGenerator/src/main/java/com/competency/pdfgenerator/PDFCreator.java
c3d1d376853798363a1044acdb31955189fa2228
[]
no_license
satyammca/PDFGenerator
c9570daa326f1add2830f9370e3c2b6cf9fa5e25
65c1b798f4580e320690fe9f087c4b411f6cff4d
refs/heads/master
2021-01-10T04:05:21.038512
2015-06-04T15:59:27
2015-06-04T15:59:27
36,880,701
0
0
null
null
null
null
UTF-8
Java
false
false
3,694
java
package com.competency.pdfgenerator; import com.competency.pdfgenerator.iterator.BaseIterator; import com.competency.pdfgenerator.utilities.XMLUtil; import com.itextpdf.text.PageSize; import com.itextpdf.text.pdf.PdfWriter; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.util.List; import javax.el.ExpressionFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdom.Document; import org.jdom.Element; public class PDFCreator { private static Log _log = LogFactory.getLog(PDFCreator.class); private static ExpressionFactory factory = new de.odysseus.el.ExpressionFactoryImpl(); public InputStream generatePDF(Object theBean, String xmlFileName, String pdfPath, String locale) { _log.info("PDFCreator.generatePDF() START"); ByteArrayInputStream bais =null; try { de.odysseus.el.util.SimpleContext context = new de.odysseus.el.util.SimpleContext(); context.setVariable("foo", factory.createValueExpression(theBean, theBean.getClass())); // Document pdfStructureDom = // XMLUtil.getDomObj(PDFCreator.class.getResourceAsStream("/xml/PDFstructure.xml")); Document pdfStructureDom = XMLUtil.getDomObj(this.getClass().getClassLoader().getResource(xmlFileName).getPath()); com.itextpdf.text.Document pdfDocument = new com.itextpdf.text.Document( PageSize.A4); ByteArrayOutputStream baos = new ByteArrayOutputStream(); // PdfWriter writer = PdfWriter.getInstance(pdfDocument, // new FileOutputStream(pdfPath)); PdfWriter.getInstance(pdfDocument, baos); processPDF(pdfStructureDom, theBean, pdfDocument, locale); // inputStream = new FileInputStream(pdfPath); bais= new ByteArrayInputStream(baos.toByteArray()); //_log.info("Stream created"); _log.info("PDFCreator.generatePDF() END"); } catch (Exception ex) { _log.error(ex.getMessage()); } return bais; } public InputStream generatePDF(Object theBean, String xmlFileName, String locale) { _log.info("PDFCreator.generatePDF() START"); ByteArrayInputStream bais =null; try { de.odysseus.el.util.SimpleContext context = new de.odysseus.el.util.SimpleContext(); context.setVariable("foo",factory.createValueExpression(theBean, theBean.getClass())); // Document pdfStructureDom = // XMLUtil.getDomObj(PDFCreator.class.getResourceAsStream("/xml/PDFstructure.xml")); Document pdfStructureDom = XMLUtil.getDomObj(this.getClass().getClassLoader().getResource(xmlFileName).getPath()); com.itextpdf.text.Document pdfDocument = new com.itextpdf.text.Document( PageSize.A4); ByteArrayOutputStream baos = new ByteArrayOutputStream(); // PdfWriter writer = PdfWriter.getInstance(pdfDocument, // new FileOutputStream(pdfPath)); PdfWriter.getInstance(pdfDocument, baos); processPDF(pdfStructureDom, theBean, pdfDocument, locale); // inputStream = new FileInputStream(pdfPath); bais= new ByteArrayInputStream(baos.toByteArray()); // _log.info("Stream created"); _log.info("PDFCreator.generatePDF() END"); } catch (Exception ex) { _log.error(ex.getMessage()); } return bais; } public static void processPDF(Document pdfStructureDom, Object theBean, com.itextpdf.text.Document pdfDocument, String locale) throws Exception { _log.info("PDFCreator.processPDF() START"); List<Element> blockList = XMLUtil.getElementList("pdfcreator/block", pdfStructureDom); pdfDocument.open(); for (Element blockElt : blockList) { BaseIterator.processBlock(blockElt, theBean, pdfDocument, locale); } pdfDocument.close(); _log.info("PDFCreator.processPDF() END"); } }
[ "satya.kolliboina@gmail.com" ]
satya.kolliboina@gmail.com
b222eb99802d835ef17af26bba02e2f721d0cf0c
7e2896f96796fd0328f31964d7073a1d891d49e4
/other-project/geotools/src/main/java/com/moheqionglin/ShapeFile.java
3cc9bfbd325a8eed98ea78634e57a0fc66dbc90d
[]
no_license
moheqionglin/spring-demo
bfc48f24396d9f83714a179e951eab0562ff1621
e1a0cc05bc807b2ba92d28498a2f5231c652165c
refs/heads/master
2023-03-18T15:53:41.406310
2022-04-27T15:57:41
2022-04-27T15:57:41
138,487,811
6
1
null
2023-03-08T17:33:45
2018-06-24T14:17:22
Java
UTF-8
Java
false
false
6,560
java
package com.moheqionglin; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.Point; import org.geotools.data.DataUtilities; import org.geotools.data.DefaultTransaction; import org.geotools.data.Transaction; import org.geotools.data.shapefile.ShapefileDataStore; import org.geotools.data.shapefile.ShapefileDataStoreFactory; import org.geotools.data.simple.SimpleFeatureSource; import org.geotools.data.simple.SimpleFeatureStore; import org.geotools.feature.DefaultFeatureCollection; import org.geotools.feature.simple.SimpleFeatureBuilder; import org.geotools.feature.simple.SimpleFeatureTypeBuilder; import org.geotools.geometry.jts.JTSFactoryFinder; import org.geotools.referencing.crs.DefaultGeographicCRS; import org.geotools.swing.data.JFileDataStoreChooser; import org.opengis.feature.simple.SimpleFeature; import org.opengis.feature.simple.SimpleFeatureType; import java.io.File; import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.Function; public class ShapeFile { private static final String FILE_NAME = "shapefile.shp"; public static void main(String[] args) throws Exception { DefaultFeatureCollection collection = new DefaultFeatureCollection(); GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); SimpleFeatureType TYPE = DataUtilities.createType("Location", "location:Point:srid=4326," + "name:String"); SimpleFeatureType CITY = createFeatureType(); addLocations(CITY, collection); File shapeFile = getNewShapeFile(); ShapefileDataStoreFactory dataStoreFactory = new ShapefileDataStoreFactory(); Map<String, Serializable> params = new HashMap<String, Serializable>(); ShapefileDataStore dataStore = setDataStoreParams(dataStoreFactory, params, shapeFile, CITY); writeToFile(dataStore, collection); } static SimpleFeatureType createFeatureType() { SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.setName("Location"); builder.setCRS(DefaultGeographicCRS.WGS84); builder.add("Location", Point.class); builder.length(15) .add("Name", String.class); return builder.buildFeatureType(); } static void addLocations(SimpleFeatureType CITY, DefaultFeatureCollection collection) { Map<String, List<Double>> locations = new HashMap<>(); double lat = 13.752222; double lng = 100.493889; addToLocationMap("Bangkok", lat, lng, locations); lat = 53.083333; lng = -0.15; addToLocationMap("New York", lat, lng, locations); lat = -33.925278; lng = 18.423889; addToLocationMap("Cape Town", lat, lng, locations); lat = -33.859972; lng = 151.211111; addToLocationMap("Sydney", lat, lng, locations); lat = 45.420833; lng = -75.69; addToLocationMap("Ottawa", lat, lng, locations); lat = 30.07708; lng = 31.285909; addToLocationMap("Cairo", lat, lng, locations); GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); locations.entrySet().stream() .map(toFeature(CITY, geometryFactory)) .forEach(collection::add); } private static Function<Map.Entry<String, List<Double>>, SimpleFeature> toFeature(SimpleFeatureType CITY, GeometryFactory geometryFactory) { return location -> { Point point = geometryFactory.createPoint( new Coordinate(location.getValue() .get(0), location.getValue().get(1))); SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(CITY); featureBuilder.add(point); featureBuilder.add(location.getKey()); return featureBuilder.buildFeature(null); }; } private static void addToLocationMap(String name, double lat, double lng, Map<String, List<Double>> locations) { List<Double> coordinates = new ArrayList<>(); coordinates.add(lat); coordinates.add(lng); locations.put(name, coordinates); } private static File getNewShapeFile() { String filePath = new File(".").getAbsolutePath() + FILE_NAME; JFileDataStoreChooser chooser = new JFileDataStoreChooser("shp"); chooser.setDialogTitle("Save shapefile"); chooser.setSelectedFile(new File(filePath)); int returnVal = chooser.showSaveDialog(null); if (returnVal != JFileDataStoreChooser.APPROVE_OPTION) { System.exit(0); } return chooser.getSelectedFile(); } private static ShapefileDataStore setDataStoreParams(ShapefileDataStoreFactory dataStoreFactory, Map<String, Serializable> params, File shapeFile, SimpleFeatureType CITY) throws Exception { params.put("url", shapeFile.toURI() .toURL()); params.put("create spatial index", Boolean.TRUE); ShapefileDataStore dataStore = (ShapefileDataStore) dataStoreFactory.createNewDataStore(params); dataStore.createSchema(CITY); return dataStore; } private static void writeToFile(ShapefileDataStore dataStore, DefaultFeatureCollection collection) throws Exception { // If you decide to use the TYPE type and create a Data Store with it, // You will need to uncomment this line to set the Coordinate Reference System // newDataStore.forceSchemaCRS(DefaultGeographicCRS.WGS84); Transaction transaction = new DefaultTransaction("create"); String typeName = dataStore.getTypeNames()[0]; SimpleFeatureSource featureSource = dataStore.getFeatureSource(typeName); if (featureSource instanceof SimpleFeatureStore) { SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource; featureStore.setTransaction(transaction); try { featureStore.addFeatures(collection); transaction.commit(); } catch (Exception problem) { problem.printStackTrace(); transaction.rollback(); } finally { transaction.close(); } System.exit(0); // success! } else { System.out.println(typeName + " does not support read/write access"); System.exit(1); } } }
[ "" ]
0fe33a1ba2eb07a48005c436a68e1acaa6842a2a
c17969dfc42d8902d3f0995e79d304d0246890b0
/src/test/java/com/netflixApp/client/MovieFanArtTest2.java
e5ae353dace6fbb329eaae4a074eb3a043334647
[]
no_license
borjaneumann/Netflix-clone-Spring-Boot
ed7cc4cf3183d1daba040ad72f04743b0cde0f31
2526bb311ed1cfccd3261368efe9d02321d460ca
refs/heads/main
2023-03-22T18:07:38.383469
2021-03-10T14:28:00
2021-03-10T14:28:00
346,380,841
1
0
null
null
null
null
UTF-8
Java
false
false
1,911
java
package com.netflixApp.client; import com.netflixApp.controller.MovieController; import com.netflixApp.dto.fanArt.FanArtInfo; import com.netflixApp.dto.fanArt.Hdmovielogo; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Value; import java.util.ArrayList; import java.util.List; import static org.junit.jupiter.api.Assertions.*; @ExtendWith({MockitoExtension.class}) class MovieFanArtTest2 { @Mock private MovieFanArt movieFanArt; @InjectMocks private MovieController movieController; @Value("${fanArt.api_key}") private String fanArt_api_key; MovieFanArtTest2() { } @Test void getFanArtDetails() { FanArtInfo fanArtInfo = new FanArtInfo(); List<Hdmovielogo> hdMovieLogosList = new ArrayList<>(); Hdmovielogo hdmovielogoObj = new Hdmovielogo(); // fanArtInfo.setName("Ad Astra"); fanArtInfo.setTmdbId("550"); hdmovielogoObj.setUrl("https://assets.fanart.tv"); hdmovielogoObj.setId("1"); hdMovieLogosList.add(hdmovielogoObj); fanArtInfo.setHdmovielogo(hdMovieLogosList); Mockito.when(movieFanArt.getFanArtDetails(123, fanArt_api_key)).thenReturn(fanArtInfo); FanArtInfo result = movieController.getLogos(123); Assertions.assertEquals(fanArtInfo.getName(), result.getName()); Assertions.assertEquals(fanArtInfo.getTmdbId(), result.getTmdbId()); Assertions.assertEquals(fanArtInfo.getHdmovielogo().get(0).getUrl(), result.getHdmovielogo().get(0).getUrl()); Assertions.assertEquals(fanArtInfo.getHdmovielogo().get(0).getId(), result.getHdmovielogo().get(0).getId()); } }
[ "borjaneumann@hotmail.com" ]
borjaneumann@hotmail.com
7c5c424888c46872649f1a2f487eaf0eb3f6071a
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/9/9_9c863500a513629473c2223a84f25768f00043b0/CsvDatasourceServiceImpl/9_9c863500a513629473c2223a84f25768f00043b0_CsvDatasourceServiceImpl_t.java
d2512d1e897b0943d0c5509ad93b90b48ca252b2
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
10,222
java
/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * 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 Lesser General Public License for more details. * * Copyright 2009-2010 Pentaho Corporation. All rights reserved. * * Created Sep, 2010 * @author jdixon */ package org.pentaho.platform.dataaccess.datasource.wizard.service.impl; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.pentaho.agilebi.modeler.ModelerWorkspace; import org.pentaho.agilebi.modeler.gwt.GwtModelerWorkspaceHelper; import org.pentaho.metadata.model.Domain; import org.pentaho.metadata.model.LogicalModel; import org.pentaho.platform.api.engine.IPentahoObjectFactory; import org.pentaho.platform.api.engine.IPentahoSession; import org.pentaho.platform.api.engine.ObjectFactoryException; import org.pentaho.platform.dataaccess.datasource.beans.BogoPojo; import org.pentaho.platform.dataaccess.datasource.wizard.csv.CsvUtils; import org.pentaho.platform.dataaccess.datasource.wizard.csv.FileUtils; import org.pentaho.platform.dataaccess.datasource.wizard.models.CsvFileInfo; import org.pentaho.platform.dataaccess.datasource.wizard.models.CsvTransformGeneratorException; import org.pentaho.platform.dataaccess.datasource.wizard.models.DatasourceDTO; import org.pentaho.platform.dataaccess.datasource.wizard.models.FileInfo; import org.pentaho.platform.dataaccess.datasource.wizard.models.ModelInfo; import org.pentaho.platform.dataaccess.datasource.wizard.service.agile.AgileHelper; import org.pentaho.platform.dataaccess.datasource.wizard.service.agile.CsvTransformGenerator; import org.pentaho.platform.dataaccess.datasource.wizard.service.gwt.ICsvDatasourceService; import org.pentaho.platform.dataaccess.datasource.wizard.sources.csv.FileTransformStats; import org.pentaho.platform.engine.core.system.PentahoBase; import org.pentaho.platform.engine.core.system.PentahoSystem; import org.pentaho.platform.plugin.action.kettle.KettleSystemListener; import org.pentaho.reporting.libraries.base.util.StringUtils; import com.thoughtworks.xstream.XStream; @SuppressWarnings("unchecked") public class CsvDatasourceServiceImpl extends PentahoBase implements ICsvDatasourceService { private static final long serialVersionUID = 2498165533158485182L; private Log logger = LogFactory.getLog(CsvDatasourceServiceImpl.class); private ModelerService modelerService = new ModelerService(); private ModelerWorkspace modelerWorkspace; public CsvDatasourceServiceImpl(){ super(); modelerWorkspace = new ModelerWorkspace(new GwtModelerWorkspaceHelper()); modelerService = new ModelerService(); } public Log getLogger() { return logger; } public String getEncoding(String fileName) { String encoding = null; try { CsvUtils csvModelService = new CsvUtils(); encoding = csvModelService.getEncoding(fileName); } catch (Exception e) { logger.error(e); } return encoding; } public ModelInfo stageFile(String fileName, String delimiter, String enclosure, boolean isFirstRowHeader, String encoding) throws Exception { ModelInfo modelInfo; try { CsvUtils csvModelService = new CsvUtils(); int headerRows = isFirstRowHeader ? 1 : 0; modelInfo = csvModelService.generateFields("", fileName, AgileHelper.getCsvSampleRowSize(), delimiter, enclosure, headerRows, true, true, encoding); //$NON-NLS-1$ } catch (Exception e) { logger.error(e); throw e; } return modelInfo; } public FileInfo[] getStagedFiles() throws Exception { FileInfo[] files; try { FileUtils fileService = new FileUtils(); files = fileService.listFiles(); } catch (Exception e) { logger.error(e); throw e; } return files; } public FileTransformStats generateDomain(DatasourceDTO datasourceDto) throws Exception { ModelInfo modelInfo = datasourceDto.getCsvModelInfo(); IPentahoSession pentahoSession = null; try { pentahoSession = getSession(); KettleSystemListener.environmentInit(pentahoSession); String statsKey = FileTransformStats.class.getSimpleName() + "_" + modelInfo.getFileInfo().getTmpFilename(); //$NON-NLS-1$ FileTransformStats stats = new FileTransformStats(); pentahoSession.setAttribute(statsKey, stats); CsvTransformGenerator csvTransformGenerator = new CsvTransformGenerator(modelInfo, AgileHelper.getDatabaseMeta()); csvTransformGenerator.setTransformStats(stats); try { csvTransformGenerator.dropTable(modelInfo.getStageTableName()); } catch (CsvTransformGeneratorException e) { // this is ok, the table may not have existed. logger.info("Could not drop table before staging"); //$NON-NLS-1$ } csvTransformGenerator.createOrModifyTable(pentahoSession); // no longer need to truncate the table since we dropped it a few lines up, so just pass false csvTransformGenerator.loadTable(false, pentahoSession, true); ArrayList<String> combinedErrors = new ArrayList<String>(modelInfo.getCsvInputErrors()); combinedErrors.addAll(modelInfo.getTableOutputErrors()); stats.setErrors(combinedErrors); // wait until it it done while (!stats.isRowsFinished()) { Thread.sleep(200); } modelerWorkspace.setDomain(modelerService.generateCSVDomain(modelInfo.getStageTableName(), modelInfo.getDatasourceName())); modelerWorkspace.getWorkspaceHelper().autoModelFlat(modelerWorkspace); modelerWorkspace.getWorkspaceHelper().autoModelRelationalFlat(modelerWorkspace); modelerWorkspace.setModelName(modelInfo.getDatasourceName()); modelerWorkspace.getWorkspaceHelper().populateDomain(modelerWorkspace); Domain workspaceDomain = modelerWorkspace.getDomain(); XStream xstream = new XStream(); String serializedDto = xstream.toXML(datasourceDto); workspaceDomain.getLogicalModels().get(0).setProperty("datasourceModel", serializedDto); workspaceDomain.getLogicalModels().get(0).setProperty("DatasourceType", "CSV"); prepareForSerialization(workspaceDomain); modelerService.serializeModels(workspaceDomain, modelerWorkspace.getModelName()); stats.setDomain(modelerWorkspace.getDomain()); return stats; } catch (Exception e) { e.printStackTrace(); logger.error(e); throw e; } finally { if (pentahoSession != null) { pentahoSession.destroy(); } } } protected void prepareForSerialization(Domain domain) throws IOException { /* * This method is responsible for cleaning up legacy information when * changing datasource types and also manages CSV files for CSV based * datasources. */ String relativePath = PentahoSystem.getSystemSetting("file-upload-defaults/relative-path", String.valueOf(FileUtils.DEFAULT_RELATIVE_UPLOAD_FILE_PATH)); //$NON-NLS-1$ String path = PentahoSystem.getApplicationContext().getSolutionPath(relativePath); String TMP_FILE_PATH = File.separatorChar + "system" + File.separatorChar + File.separatorChar + "tmp" + File.separatorChar; String sysTmpDir = PentahoSystem.getApplicationContext().getSolutionPath(TMP_FILE_PATH); LogicalModel logicalModel = domain.getLogicalModels().get(0); String modelState = (String) logicalModel.getProperty("datasourceModel"); //$NON-NLS-1$ if (modelState != null) { XStream xs = new XStream(); DatasourceDTO datasource = (DatasourceDTO) xs.fromXML(modelState); CsvFileInfo csvFileInfo = datasource.getCsvModelInfo().getFileInfo(); String tmpFileName = csvFileInfo.getTmpFilename(); String csvFileName = csvFileInfo.getFilename(); File tmpFile = new File(sysTmpDir + File.separatorChar + tmpFileName); // Move CSV temporary file to final destination. if (tmpFile.exists()) { File csvFile = new File(path + File.separatorChar + csvFileName); org.apache.commons.io.FileUtils.copyFile(tmpFile, csvFile); } // Cleanup logic when updating from SQL datasource to CSV // datasource. datasource.setQuery(null); // Update datasourceModel with the new modelState modelState = xs.toXML(datasource); logicalModel.setProperty("datasourceModel", modelState); } } private IPentahoSession getSession() { IPentahoSession session = null; IPentahoObjectFactory pentahoObjectFactory = PentahoSystem.getObjectFactory(); if (pentahoObjectFactory != null) { try { session = pentahoObjectFactory.get(IPentahoSession.class, "systemStartupSession", null); //$NON-NLS-1$ } catch (ObjectFactoryException e) { logger.error(e); } } return session; } public List<String> getPreviewRows(String filename, boolean isFirstRowHeader, int rows, String encoding) throws Exception { List<String> previewRows = null; if(!StringUtils.isEmpty(filename)) { CsvUtils service = new CsvUtils(); ModelInfo mi = service.getFileContents("", filename, ",", "\"", rows, isFirstRowHeader, encoding); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ previewRows = mi.getFileInfo().getContents(); } return previewRows; } @Override public BogoPojo gwtWorkaround(BogoPojo pojo) { return pojo; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
f6b405f85f100d0c0890a978883ca6206a0dcf56
b9bb53905f7817bd6a530a3c1785a9c33393fa6d
/src/main/java/com/bingo/code/example/design/composite/rewrite/Component.java
402e79e6f4f0e3c0e4a47dcaa582a48521b62f79
[]
no_license
namjagbrawa/code-example
34827b24e9badc2f6b828951238736e5459dfab8
a48ca7a981ebb1ac21e07091f586b757a51447c1
refs/heads/master
2021-01-22T13:30:11.262039
2019-03-16T15:56:38
2019-03-16T15:56:38
100,659,751
0
0
null
null
null
null
UTF-8
Java
false
false
1,699
java
package com.bingo.code.example.design.composite.rewrite; /** * ������������ */ public abstract class Component { /** * ��������������� */ public abstract void printStruct(String preStr); /** * ����϶����м���������� * @param child ��������϶����е�������� */ public void addChild(Component child) { // ȱʡ��ʵ�֣��׳����⣬��ΪҶ�Ӷ���û��������ܣ����������û��ʵ��������� throw new UnsupportedOperationException("����֧���������"); } /** * ����϶������Ƴ�ij��������� * @param child ���Ƴ���������� */ public void removeChild(Component child) { // ȱʡ��ʵ�֣��׳����⣬��ΪҶ�Ӷ���û��������ܣ����������û��ʵ��������� throw new UnsupportedOperationException("����֧���������"); } /** * ����ij��������Ӧ��������� * @param index ��Ҫ��ȡ����������������������0��ʼ * @return ������Ӧ��������� */ public Component getChildren(int index) { // ȱʡ��ʵ�֣��׳����⣬��ΪҶ�Ӷ���û��������ܣ����������û��ʵ��������� throw new UnsupportedOperationException("����֧���������"); } }
[ "namjagbrawa@126.com" ]
namjagbrawa@126.com
56dc789e42062367223735cc91a59f1efb312c52
f1d8e49c37dd701e564a82f5b90b00042eb96e17
/java/com/levigo/jadice/format/jpeg2000/internal/image/GridRegionAdapter.java
03692bf9b680e4f78b56f353bea346b43d9162b2
[ "Apache-2.0" ]
permissive
levigo/jpeg2000-imageio-plugin
ae9e3be86dd514785df34b117b24af6cba328d06
9a10fbca29a54553fbfdd8a6baa27c07002fd3dd
refs/heads/master
2023-08-30T20:46:10.800733
2019-12-05T13:34:55
2019-12-05T13:34:55
226,107,413
0
0
Apache-2.0
2022-05-20T21:17:27
2019-12-05T13:22:18
Java
UTF-8
Java
false
false
687
java
package com.levigo.jadice.format.jpeg2000.internal.image; import java.io.IOException; import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; public class GridRegionAdapter extends TypeAdapter<GridRegion> { private static final RegionAdapter REGION_ADAPTER = new RegionAdapter(); @Override public void write(JsonWriter out, GridRegion value) throws IOException { REGION_ADAPTER.write(out, value.absolute()); } @Override public GridRegion read(JsonReader in) throws IOException { final Region region = REGION_ADAPTER.read(in); return new DefaultGridRegion(region); } }
[ "j.henne@levigo.de" ]
j.henne@levigo.de
fbfb67ecd8cbfaece28bada4653b8348640cafd1
651cfaf77b29f81885ea176a9a21cc56d5b4e6d7
/src/scanner/Main.java
228e02957ba93588681d1640e605688d4eec812e
[]
no_license
maxwellherron5/AlmostC-Compiler
4da61bc088239afc1c5403ef20e8f14224572480
4785b0169670744ae203e2159d0aa44e24a2e4bf
refs/heads/master
2022-10-19T00:41:30.685916
2020-04-28T01:57:44
2020-04-28T01:57:44
271,399,194
0
0
null
null
null
null
UTF-8
Java
false
false
922
java
package scanner; import java.io.IOException; import java.io.StringReader; /** * @author Maxwell Herron * This main class is currently used to test the scanner on string inputs. */ public class Main { public static void main(String[] args) { //String testString = "/* here is comment */ 5.78 @@ %yf 8.5E10 : 17E+1223 myVar123 Myvar123 -100.094 char float int "; String testString = "45 identifier myChar print int + - ~ ^ __ @ ß"; Scanner scan = new Scanner(new StringReader(testString)); Token result = null; try { result = scan.nextToken(); } catch (BadCharacterException ex) { System.out.println(ex.toString()); } catch (IOException e) { e.printStackTrace(); } while(result != null) { try { result = scan.nextToken(); } catch (BadCharacterException exp) { System.out.println(exp.toString()); } catch (Exception e) { } } System.out.println("Done!"); } }
[ "maxwell@Maxwells-MacBook-Pro.local" ]
maxwell@Maxwells-MacBook-Pro.local
29344518c4af16af1bb953c53d83509e2277f5a4
ab2a601f3703b5555c364ed4157040036568936b
/core/src/com/perl5/lang/perl/extensions/packageprocessor/impl/PerlDancer2DSL.java
06302b1995bd9e53710df64f8112be21ad118380
[ "Apache-2.0" ]
permissive
ikenox/Perl5-IDEA
72aa2d8b622004654d6f0e9a078e5a08b617181c
f37df01dde8558a44beadcbc2066e8debe33ce64
refs/heads/master
2022-01-17T12:57:19.096014
2019-04-21T18:58:42
2019-04-21T18:58:42
148,667,285
0
0
NOASSERTION
2018-12-11T14:11:27
2018-09-13T16:35:53
Java
UTF-8
Java
false
false
2,083
java
/* * Copyright 2015-2017 Alexandr Evstigneev * * 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.perl5.lang.perl.extensions.packageprocessor.impl; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Created by hurricup on 02.06.2016. */ public interface PerlDancer2DSL { List<String> DSL_KEYWORDS = new ArrayList<>(Arrays.asList( "any", "app", "body_parameters", "captures", "config", "content", "content_type", "context", "cookie", "cookies", "dance", "dancer_app", "dancer_major_version", "dancer_version", "debug", "del", "delayed", "dirname", "done", "dsl", "engine", "error", "false", "flush", "forward", "from_dumper", "from_json", "from_yaml", "get", "halt", "header", "headers", "hook", "import", "info", "log", "mime", "options", "param", "params", "pass", "patch", "path", "post", "prefix", "psgi_app", "push_header", "push_response_header", "put", "query_parameters", "redirect", "request", "request_header", "response", "response_header", "response_headers", "route_parameters", "runner", "send_as", "send_error", "send_file", "session", "set", "setting", "splat", "start", "status", "template", "to_app", "to_dumper", "to_json", "to_yaml", "true", "upload", "uri_for", "var", "vars", "warning" )); }
[ "hurricup@gmail.com" ]
hurricup@gmail.com
c3d11339efaf0bebfd75c3b104c5efd1cf46de3c
ca030864a3a1c24be6b9d1802c2353da4ca0d441
/classes6.dex_source_from_JADX/com/facebook/video/player/plugins/VideoControlPlugin.java
d835dc360621aa4ef3762150ee8cca9913fc398d
[]
no_license
pxson001/facebook-app
87aa51e29195eeaae69adeb30219547f83a5b7b1
640630f078980f9818049625ebc42569c67c69f7
refs/heads/master
2020-04-07T20:36:45.758523
2018-03-07T09:04:57
2018-03-07T09:04:57
124,208,458
4
0
null
null
null
null
UTF-8
Java
false
false
6,504
java
package com.facebook.video.player.plugins; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageButton; import com.facebook.content.event.FbEvent; import com.facebook.inject.FbInjector; import com.facebook.loom.logger.LogEntry.EntryType; import com.facebook.loom.logger.Logger; import com.facebook.tools.dextr.runtime.LogUtils; import com.facebook.video.abtest.Video360PlayerConfig; import com.facebook.video.analytics.VideoAnalytics.EventTriggerType; import com.facebook.video.player.RichVideoPlayerParams; import com.facebook.video.player.events.RVPChromeBehaviorChangeEvent; import com.facebook.video.player.events.RVPPlayIconStateEvent; import com.facebook.video.player.events.RVPPlayIconStateEvent.State; import com.facebook.video.player.events.RVPPlayerStateChangedEvent; import com.facebook.video.player.events.RVPRequestPausingEvent; import com.facebook.video.player.events.RVPRequestPlayingEvent; import com.facebook.video.player.events.RichVideoPlayerEventSubscriber; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import javax.inject.Inject; /* compiled from: commerce_view_product_store_front */ public class VideoControlPlugin extends RichVideoPlayerPlugin { @VisibleForTesting final ImageButton f19415a; @VisibleForTesting final ImageButton f19416b; @Inject public Video360PlayerConfig f19417c; /* compiled from: commerce_view_product_store_front */ class C14481 implements OnClickListener { final /* synthetic */ VideoControlPlugin f19411a; C14481(VideoControlPlugin videoControlPlugin) { this.f19411a = videoControlPlugin; } public void onClick(View view) { int a = Logger.a(2, EntryType.UI_INPUT_START, -1865108126); if (this.f19411a.g == null) { Logger.a(2, EntryType.UI_INPUT_END, 1135615834, a); return; } this.f19411a.f19415a.setVisibility(8); this.f19411a.g.a(new RVPRequestPlayingEvent(EventTriggerType.BY_USER)); this.f19411a.g.a(new RVPChromeBehaviorChangeEvent(ChromeBehavior.AUTO)); LogUtils.a(-1268596649, a); } } /* compiled from: commerce_view_product_store_front */ class C14492 implements OnClickListener { final /* synthetic */ VideoControlPlugin f19412a; C14492(VideoControlPlugin videoControlPlugin) { this.f19412a = videoControlPlugin; } public void onClick(View view) { int a = Logger.a(2, EntryType.UI_INPUT_START, -1011043250); if (this.f19412a.g == null) { Logger.a(2, EntryType.UI_INPUT_END, -1165021966, a); return; } this.f19412a.f19416b.setVisibility(8); this.f19412a.g.a(new RVPRequestPausingEvent(EventTriggerType.BY_USER)); LogUtils.a(-809654932, a); } } /* compiled from: commerce_view_product_store_front */ class PlayerStateChangedEventSubscriber extends RichVideoPlayerEventSubscriber<RVPPlayerStateChangedEvent> { final /* synthetic */ VideoControlPlugin f19413a; public PlayerStateChangedEventSubscriber(VideoControlPlugin videoControlPlugin) { this.f19413a = videoControlPlugin; } public final void m28187b(FbEvent fbEvent) { if (this.f19413a.h != null) { VideoControlPlugin.m28194d(this.f19413a); } } public final Class<RVPPlayerStateChangedEvent> m28186a() { return RVPPlayerStateChangedEvent.class; } } /* compiled from: commerce_view_product_store_front */ class RVPPlayIconStateEventSubscriber extends RichVideoPlayerEventSubscriber<RVPPlayIconStateEvent> { final /* synthetic */ VideoControlPlugin f19414a; public RVPPlayIconStateEventSubscriber(VideoControlPlugin videoControlPlugin) { this.f19414a = videoControlPlugin; } public final void m28189b(FbEvent fbEvent) { if (((RVPPlayIconStateEvent) fbEvent).a == State.HIDE) { this.f19414a.f19415a.setVisibility(8); this.f19414a.f19416b.setVisibility(8); } } public final Class<RVPPlayIconStateEvent> m28188a() { return RVPPlayIconStateEvent.class; } } private static <T extends View> void m28192a(Class<T> cls, T t) { m28193a((Object) t, t.getContext()); } private static void m28193a(Object obj, Context context) { ((VideoControlPlugin) obj).f19417c = Video360PlayerConfig.b(FbInjector.get(context)); } public VideoControlPlugin(Context context) { this(context, null); } public VideoControlPlugin(Context context, AttributeSet attributeSet) { this(context, attributeSet, 0); } public VideoControlPlugin(Context context, AttributeSet attributeSet, int i) { super(context, attributeSet, i); setContentView(2130907661); m28192a(VideoControlPlugin.class, (View) this); this.f.add(new PlayerStateChangedEventSubscriber(this)); this.f.add(new RVPPlayIconStateEventSubscriber(this)); this.f19415a = (ImageButton) a(2131568305); this.f19416b = (ImageButton) a(2131568306); this.f19415a.setOnClickListener(new C14481(this)); this.f19416b.setOnClickListener(new C14492(this)); } private void m28190a(Video360PlayerConfig video360PlayerConfig) { this.f19417c = video360PlayerConfig; } protected final void m28195a(RichVideoPlayerParams richVideoPlayerParams, boolean z) { m28194d(this); } public static void m28194d(VideoControlPlugin videoControlPlugin) { Preconditions.checkNotNull(videoControlPlugin.h); PlaybackController.State state = videoControlPlugin.h.l; if (state == PlaybackController.State.PLAYING) { videoControlPlugin.f19416b.setVisibility(0); videoControlPlugin.f19415a.setVisibility(8); } else if (state == PlaybackController.State.ATTEMPT_TO_PLAY) { videoControlPlugin.f19416b.setVisibility(8); videoControlPlugin.f19415a.setVisibility(8); } else { videoControlPlugin.f19416b.setVisibility(8); videoControlPlugin.f19415a.setVisibility(0); } } }
[ "son.pham@jmango360.com" ]
son.pham@jmango360.com
8857071cdb1657aa5b27800871c6f6e15d07441f
4ab7cac949cad0e46650ddc9b7133d237dcca6ab
/spark/src/main/java/com/phospher/goMonitor/sparkDaily/App.java
1595860101bc71e395715cbf6ed7ab6148c8c932
[]
no_license
phospher/goMonitor
6e1ff05596084eb02266c05b9792f2f7d8cbfcd8
f5f133713a0788dcdb359bb2a0e2c75b34ebe442
refs/heads/master
2021-01-16T23:42:04.187890
2018-02-14T03:32:20
2018-02-14T03:32:20
51,815,530
2
1
null
null
null
null
UTF-8
Java
false
false
1,474
java
package com.phospher.goMonitor.sparkDaily; import org.apache.spark.api.java.*; import org.apache.spark.SparkConf; import java.util.*; import com.google.inject.*; import com.phospher.goMonitor.inject.*; import com.phospher.goMonitor.data.MachineRecordRepository; import com.phospher.goMonitor.mapper.*; import org.apache.spark.api.java.function.VoidFunction; import com.phospher.goMonitor.entities.*; import scala.Tuple2; import com.phospher.goMonitor.reducer.*; import java.text.SimpleDateFormat; import com.phospher.goMonitor.aggregator.impl.*; public class App { public static void main(String[] args) throws Exception { SparkConf conf = new SparkConf().setAppName("goMonitor.SparkDaily"); JavaSparkContext context = new JavaSparkContext(conf); Injector injector = InjectorManager.initInjector(); MachineRecordRepository machineRecordRepository = injector.getInstance(MachineRecordRepository.class); List<String> ipAddress = machineRecordRepository.getMachineIpAddresses(); JavaRDD<String> ipRDD = context.parallelize(ipAddress); JavaPairRDD<String, SystemInfo> systemInfoRDD = ipRDD.flatMap(new GetSystemInfoByIPFunction()) .mapToPair(i -> new Tuple2(i.getIPAddress(), i)).cache(); new MaxCPUUsageAggregator().aggregate(systemInfoRDD); new MinCPUUsageAggregator().aggregate(systemInfoRDD); new AvgCPUUsageAggregator().aggregate(systemInfoRDD); } }
[ "phospher@qq.com" ]
phospher@qq.com
d521a61fec62c606bbd41612c14c9ce09c83e1bd
6ae55e85a54efc6493558422af0739b648877166
/src/main/java/com/app/aforo255/deposit/producer/DepositEventProducer.java
0128d1edc9b37606f740a64c4f893c20cd1e878f
[]
no_license
cquizo/service-bankaforo255-deposit
5e93a034a24d896d863b8814658892d53a31f422
f236dbb72050d8b7d1a20dca3c03544e9571f62a
refs/heads/master
2022-04-18T00:49:37.435413
2020-04-12T01:21:47
2020-04-12T01:21:47
253,080,014
0
0
null
null
null
null
UTF-8
Java
false
false
5,137
java
package com.app.aforo255.deposit.producer; import com.app.aforo255.deposit.domain.Transaction; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.apache.kafka.clients.producer.ProducerRecord; import org.apache.kafka.common.header.Header; import org.apache.kafka.common.header.internals.RecordHeader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.support.SendResult; import org.springframework.stereotype.Component; import org.springframework.util.concurrent.ListenableFuture; import org.springframework.util.concurrent.ListenableFutureCallback; @Component public class DepositEventProducer { String topic ="transaction-events"; private Logger log = LoggerFactory.getLogger(DepositEventProducer.class); @Autowired KafkaTemplate <Integer,String > KafkaTemplate ; @Autowired ObjectMapper objectMapper ; public void sendDepositEvent(Transaction depositEvent) throws JsonProcessingException { Integer key = depositEvent.getId(); String value = objectMapper.writeValueAsString(depositEvent); ListenableFuture<SendResult<Integer, String>> listenableFuture = KafkaTemplate.sendDefault(key, value); listenableFuture.addCallback(new ListenableFutureCallback<SendResult<Integer, String>>() { @Override public void onFailure(Throwable ex) { handleFailure(key, value, ex); } @Override public void onSuccess(SendResult<Integer, String> result) { handleSuccess(key, value, result); } }); } public SendResult<Integer, String> sendDepositEventSynchronous(Transaction depositEvent) throws JsonProcessingException, ExecutionException, InterruptedException, TimeoutException { Integer key = depositEvent.getId(); String value = objectMapper.writeValueAsString(depositEvent); SendResult<Integer, String> sendResult = null; try { sendResult = KafkaTemplate.sendDefault(key, value).get(1, TimeUnit.SECONDS); } catch (ExecutionException | InterruptedException e) { log.error("ExecutionException/InterruptedException Sending the Message and the exception is {}", e.getMessage()); throw e; } catch (Exception e) { log.error("Exception Sending the Message and the exception is {}", e.getMessage()); throw e; } return sendResult; } public void sendDepositEvent_Approach2(Transaction depositEvent) throws JsonProcessingException { Integer key = depositEvent.getId(); String value = objectMapper.writeValueAsString(depositEvent); ProducerRecord<Integer, String> producerRecord = buildProducerRecord(key, value, topic); ListenableFuture<SendResult<Integer, String>> listenableFuture = KafkaTemplate.send(producerRecord); listenableFuture.addCallback(new ListenableFutureCallback<SendResult<Integer, String>>() { @Override public void onFailure(Throwable ex) { handleFailure(key, value, ex); } @Override public void onSuccess(SendResult<Integer, String> result) { handleSuccess(key, value, result); } }); } public ListenableFuture<SendResult<Integer,String>> sendDepositEvent_Approach3(Transaction depositEvent) throws JsonProcessingException { Integer key = depositEvent.getId(); String value = objectMapper.writeValueAsString(depositEvent); ProducerRecord<Integer,String> producerRecord = buildProducerRecord(key, value, topic); ListenableFuture<SendResult<Integer,String>> listenableFuture = KafkaTemplate.send(producerRecord); listenableFuture.addCallback(new ListenableFutureCallback<SendResult<Integer, String>>() { @Override public void onFailure(Throwable ex) { handleFailure(key, value, ex); } @Override public void onSuccess(SendResult<Integer, String> result) { handleSuccess(key, value, result); } }); return listenableFuture; } private ProducerRecord<Integer, String> buildProducerRecord(Integer key, String value, String topic) { // agregando header List<Header> recordHeaders = List.of(new RecordHeader("deposit-event-source", "scanner".getBytes())); // return new ProducerRecord<>(topic, null, key, value, null); return new ProducerRecord<>(topic, null, key, value, recordHeaders); } private void handleFailure(Integer key, String value, Throwable ex) { log.error("Error Sending the Message and the exception is {}", ex.getMessage()); try { throw ex; } catch (Throwable throwable) { log.error("Error in OnFailure: {}", throwable.getMessage()); } } private void handleSuccess(Integer key, String value, SendResult<Integer, String> result) { log.info("Message Sent SuccessFully for the key : {} and the value is {} , partition is {}", key, value, result.getRecordMetadata().partition()); } }
[ "cqm.cris@gmail.com" ]
cqm.cris@gmail.com
dbb9c77e21f719ea06c091f0035a19c2aa0ac83c
59c01b9959706f9f97b2eb2186e900dce3b99721
/src/test/java/org/jimkast/ooj/target/Fifo2Test.java
c7e73a0afae9073f133cf57ee65f321b151dfe52
[]
no_license
jimkast/exotic-java
62af4088eb1060e5aebb56d22507f9287dad83ac
e60d9eb0f48017530df9fc2a5ba3f598690e64e1
refs/heads/master
2021-08-17T17:59:53.430569
2018-11-08T18:48:22
2018-11-08T18:48:22
141,853,123
0
0
null
null
null
null
UTF-8
Java
false
false
723
java
package org.jimkast.ooj.target; import org.jimkast.ooj.source.PsForEach; import org.jimkast.ooj.source.PsRange; import org.jimkast.ooj.source.Store; import org.junit.Test; public class Fifo2Test { @Test public void filo() throws Exception { Store<Integer> queue = new Stack<>(4); queue.feed(System.out::println); new PsForEach<>(new PsRange(1, 25)).feed(queue); new PsForEach<>(queue).feed(System.out::println); } @Test public void fifo() throws Exception { Store<Integer> queue = new Queue<>(4); queue.feed(System.out::println); new PsForEach<>(new PsRange(1, 25)).feed(queue); new PsForEach<>(queue).feed(System.out::println); } }
[ "dimitrios.kastanis@gmail.com" ]
dimitrios.kastanis@gmail.com
2d04e1c655ed790e0ae1fd76042425e5fd8f0ed9
200b8727b980d65b504861376899f3cb51f43602
/engine_java/src/main/java/com/alibabacloud/polar_race/engine/kv/buffer/LogBufferAllocator.java
7b2e23f5646497df8519c952b7eabdbc49cf07e6
[]
no_license
rudy2steiner/KVEngine
feacf4006a7214eefb88da869dfcc8bd68e29ff6
333e22d2ec2610c13667ff26cf406c21e8bce175
refs/heads/master
2020-04-25T11:09:09.840047
2019-02-20T14:45:37
2019-02-20T14:45:37
172,735,090
0
0
null
null
null
null
UTF-8
Java
false
false
6,418
java
package com.alibabacloud.polar_race.engine.kv.buffer; import com.alibabacloud.polar_race.engine.common.utils.Null; import com.alibabacloud.polar_race.engine.kv.file.LogFileService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import sun.nio.ch.DirectBuffer; import java.io.Closeable; import java.io.IOException; import java.nio.ByteBuffer; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.atomic.AtomicInteger; public class LogBufferAllocator implements BufferSizeAware, Closeable { private final static Logger logger= LoggerFactory.getLogger(LogBufferAllocator.class); /** * 记录已分配的内存大小 **/ private AtomicInteger bufferSizeAllocated=new AtomicInteger(0); private volatile int maxDirectBufferBucks; private volatile int maxHeapBufferBucks; private AtomicInteger allocatedDirectBucks=new AtomicInteger(0); private BlockingQueue<BufferHolder> directCache; private BlockingQueue<BufferHolder> heapCache; private AtomicInteger allocatedHeapBucks=new AtomicInteger(0); private AtomicInteger maxDirectBufferSize=new AtomicInteger(0); private AtomicInteger maxHeapBufferSize=new AtomicInteger(0); private AtomicInteger allocatedDirectBufferSize=new AtomicInteger(0); private AtomicInteger allocatedHeapBufferSize=new AtomicInteger(0); private LogFileService logFileService; private AtomicInteger allocateCounter=new AtomicInteger(0); public LogBufferAllocator(LogFileService logFileService, int maxDirectLogCacheBufferBucks, int maxHeapLogCacheBufferBucks,int maxDirectBuffeSize,int maxHeapBufferSize){ this.maxDirectBufferBucks=maxDirectLogCacheBufferBucks; this.maxHeapBufferBucks=maxHeapLogCacheBufferBucks; this.directCache=new ArrayBlockingQueue(maxDirectLogCacheBufferBucks); this.heapCache=new ArrayBlockingQueue(maxHeapLogCacheBufferBucks); this.maxDirectBufferSize.set(maxDirectBuffeSize); this.maxHeapBufferSize.set(maxHeapBufferSize); this.logFileService=logFileService; } public static void release(ByteBuffer buffer){ if(buffer!=null&&buffer.isDirect()){ ((DirectBuffer)buffer).cleaner().clean(); } } /** * @return direct buffer or null **/ public BufferHolder allocateDirectLogCache(){ BufferHolder holder= directCache.poll(); if(Null.isEmpty(holder)){ if( allocatedDirectBucks.getAndIncrement()<maxDirectBufferBucks) { try { holder = new BufferHolder(allocate(logFileService.logWritableSize(), true)); }finally { if(Null.isEmpty(holder)) allocatedDirectBucks.decrementAndGet(); } }else allocatedDirectBucks.decrementAndGet(); } return holder; } /** * block until put finish * **/ public void rebackDirectLogCache(BufferHolder holder) throws InterruptedException{ directCache.put(holder); } /** * @return heap buffer or null **/ public BufferHolder allocateHeapLogCache(){ BufferHolder holder= heapCache.poll(); if(Null.isEmpty(holder)){ if(allocatedHeapBucks.getAndIncrement()<maxHeapBufferBucks) { try { holder = new BufferHolder(allocate(logFileService.logWritableSize(), false)); }finally { if(holder==null) allocatedHeapBucks.decrementAndGet(); } }else { allocatedHeapBucks.decrementAndGet(); } //onAdd(logFileService.logWritableSize(),false); } return holder; } /** * block until put finish * **/ public void rebackHeapLogCache(BufferHolder holder) throws InterruptedException{ if(!needGC(holder)) heapCache.put(holder); } /** * 按需分配缓存 **/ public ByteBuffer allocate(int size,boolean direct){ if(direct){ if(onAdd(size,direct)) return ByteBuffer.allocateDirect(size); }else{ if(onAdd(size,direct)){ return ByteBuffer.allocate(size); } } throw new IllegalArgumentException("allocate buffer failed"); } /** * @return 是否 release **/ public boolean needGC(BufferHolder holder){ // to do gc return false; } @Override public boolean onAdd(int size,boolean direct) { if(direct){ if( allocatedDirectBufferSize.addAndGet(size)>maxDirectBufferSize.get()) { allocatedDirectBufferSize.addAndGet(-size); return false; } }else { if(allocatedHeapBufferSize.addAndGet(size)>maxHeapBufferSize.get()) { allocatedHeapBufferSize.addAndGet(-size); return false; } } if(allocateCounter.incrementAndGet()%100==0) { logger.info(String.format("allocate %d %s,this time allocate info", size, direct ? "direct" : "heap")); memoryMonitor(); } bufferSizeAllocated.getAndAdd(size); return true; } /** * **/ public void memoryMonitor(){ logger.info( String.format("allocated direct buffer %d,heap %d",allocatedDirectBufferSize.get(),allocatedHeapBufferSize.get())); } @Override public boolean onRelease(int size,boolean direct) { if(direct){ allocatedDirectBufferSize.addAndGet(-size); }else { allocatedDirectBufferSize.addAndGet(-size); } bufferSizeAllocated.getAndAdd(-size); return true; } @Override public boolean onRelease(ByteBuffer buffer) { release(buffer); return onRelease(buffer.capacity(),buffer.isDirect()); } @Override public void close() throws IOException { heapCache.clear(); BufferHolder holder; do { holder=directCache.poll(); if(holder!=null) { onRelease(holder.value().capacity(),true); release(holder.value()); } }while (holder!=null); } }
[ "rudy_steiner@163.com" ]
rudy_steiner@163.com
c8b7e8df04fa0fab0bbf29f042cf1c25837bf13e
2b463b1e62c35e86d0e79d0fc62dd51e499632ff
/src/main/java/pe/gob/congreso/dao/NotasDao.java
3cf7ab0769354767faf29f4a1c2344b3434f9248
[]
no_license
vadrianzenl/std
94df013addc25f246986a7af52bc1ca0b860ecaa
540090ab0d8c01492f4d02c8484afacb5ae35468
refs/heads/master
2023-02-01T06:00:00.412591
2020-12-11T13:47:31
2020-12-11T13:47:31
319,531,495
0
0
null
null
null
null
UTF-8
Java
false
false
504
java
package pe.gob.congreso.dao; import java.util.List; import pe.gob.congreso.model.Notas; import pe.gob.congreso.model.util.SeguimientoUtil; public interface NotasDao { public Notas create(Notas d) throws Exception; public List<Notas> findNotas(String fichaDocumentoId) throws Exception; public List<Notas> findNotas(String fichaDocumentoId,String centroCostoId,String usuarioId) throws Exception; public Notas getNotas(String fichaDocumentoId, String id) throws Exception; }
[ "vadrianzen@proveedor.intercorp.com.pe" ]
vadrianzen@proveedor.intercorp.com.pe
29c63e1d59015d51bc4edd44646d2223cb3430f8
98d313cf373073d65f14b4870032e16e7d5466f0
/gradle-open-labs/example/src/main/java/se/molybden/Class22373.java
4881e3399eda9d19a019b1ec6d630f5f8c583ee8
[]
no_license
Molybden/gradle-in-practice
30ac1477cc248a90c50949791028bc1cb7104b28
d7dcdecbb6d13d5b8f0ff4488740b64c3bbed5f3
refs/heads/master
2021-06-26T16:45:54.018388
2016-03-06T20:19:43
2016-03-06T20:19:43
24,554,562
0
0
null
null
null
null
UTF-8
Java
false
false
110
java
public class Class22373{ public void callMe(){ System.out.println("called"); } }
[ "jocce.nilsson@gmail.com" ]
jocce.nilsson@gmail.com
9e34686c9ffab93acd4f87ed0057e8f98f913021
42622e492d3273d2072fb26591d3176afea563ec
/pos_android_studio_demo/pos_android_studio_app/src/main/java/com/dspread/demoui/net/apis/GetAESTableAPI.java
47a997ce2f79093f763ff590527133b7f8932c44
[]
no_license
believemeng/SPOC
eb40ad0d0eebbaa9af2ebdfc4242389cd7765cc8
a8072e75f132751a80ee3053dae6a7c9d6a4bc62
refs/heads/main
2023-03-09T18:20:04.525982
2021-02-26T09:56:21
2021-02-26T09:56:21
341,858,467
0
0
null
null
null
null
UTF-8
Java
false
false
1,636
java
package com.dspread.demoui.net.apis; import android.content.Context; import com.dspread.demoui.beans.PosInfos; import com.dspread.demoui.net.RetrofitBaseAPI; import com.dspread.demoui.net.RetrofitCallback; import com.dspread.demoui.net.listener.HttpResponseListener; import com.dspread.demoui.net.retrofitUtil.RequestUtil; import com.dspread.demoui.net.retrofitUtil.RetrofitHttp; import com.dspread.demoui.utils.TRACE; import org.json.JSONObject; import java.io.IOException; import java.io.UnsupportedEncodingException; import okhttp3.ResponseBody; public class GetAESTableAPI extends RetrofitBaseAPI { public static final String RELATIVE_URL = "/api/generateAESTable"; public static GetAESTableAPI newInstance(Context context, RetrofitCallback callback){ return new GetAESTableAPI(context,callback); } private GetAESTableAPI(Context context, RetrofitCallback callback){ super(context,callback,RELATIVE_URL); } @Override protected RequestUtil getRequestParams() { return null; } @Override public void request() { RetrofitHttp.downloadFileAsyc(fullUrl, callback, new HttpResponseListener<Object>() { @Override public void onResponse(JSONObject response) { } @Override public void onResponse(ResponseBody response) { TRACE.i("aes table = "+response.toString()); try { callback.onSuccess(response.bytes()); } catch (IOException e) { e.printStackTrace(); } } }); } }
[ "945858825@qq.com" ]
945858825@qq.com
c78aaca1d4eb823e6dbe5db3c71a64c6fc22382e
d697e76f7fc296bf4284642915106204062d5244
/src/main/java/de/red/logic/task/async/AsyncTaskResult.java
6476cbd7ecc48a20cd554f4c33a7d3f35f27ca1e
[ "MIT" ]
permissive
Red44/RedTasks
bffe4a3271c2150c74926ffd38a58945733c3b1b
41a7160179e3ceb19d072a70d293650b8a85c939
refs/heads/main
2023-05-01T18:41:05.767284
2021-05-07T09:00:59
2021-05-07T09:00:59
363,491,260
1
0
null
2021-05-01T19:45:32
2021-05-01T19:29:34
Java
UTF-8
Java
false
false
201
java
package de.red.logic.task.async; import de.red.logic.task.basic.TaskResult; public interface AsyncTaskResult<O> extends TaskResult<O> { public String getGroupName(); public int getTaskId(); }
[ "jakob.hillers@gmail.com" ]
jakob.hillers@gmail.com
9e8bd0106a85a2fcf49afa7d8ad05f53ae7a7958
6f37fba2df8b8b4217e21d9e463fe514f7b4afeb
/Atividade05/src/ServerDatabase.java
625a361d0085c4bd514231e991a8cfbd798a5f5a
[]
no_license
mtctr/atividades_ed
3cdb79b75054fd6faf162529c610c5b186547cc0
f80f958dc38d9e2f56250c94eaccda05962004ce
refs/heads/master
2021-06-08T14:06:12.908461
2016-12-13T03:55:12
2016-12-13T03:55:12
66,164,691
0
0
null
null
null
null
UTF-8
Java
false
false
753
java
import java.util.*; import java.math.*; public class ServerDatabase { public static final ArrayList<ArrayList<Conta>> contas; public static final int N = 100; static { contas = new ArrayList<ArrayList<Conta>>(); for (int i = 0; i < N; i++) { contas.add(new ArrayList<Conta>()); } } public static int hashCode(String md5) { BigInteger bi = new BigInteger(md5, 16); BigInteger m = new BigInteger(Integer.toString(N), 10); int pos; pos = bi.mod(m).intValue(); return pos; } public static void insereConta(Conta conta) { int index = hashCode(conta.getMd5()); contas.get(index).add(conta); } public static Conta getConta(String md5) { int index = hashCode(md5); Conta c = contas.get(index).get(0); return c; } }
[ "Mateus Targino" ]
Mateus Targino
7aca10288782529a6531ae4763ecad1d4b422442
6847722d0479548b4069fba18c00358e3ad14676
/WCCI/src/it/unimi/dsi/fastutil/doubles/Double2ObjectFunction.java
a54d9acd7cacedeb76911521cec94f9253a35edf
[]
no_license
sfbaqai/racingcar
90de325ac107f86f7ae862b77e3d132adf721814
3b72cfb5b8b49c6683358469cdd52ec073c9b156
refs/heads/master
2021-01-10T04:15:03.318224
2011-10-12T10:07:07
2011-10-12T10:07:07
48,247,283
0
0
null
null
null
null
UTF-8
Java
false
false
4,579
java
/* Generic definitions */ /* Assertions (useful to generate conditional code) */ /* Current type and class (and size, if applicable) */ /* Value methods */ /* Interfaces (keys) */ /* Interfaces (values) */ /* Abstract implementations (keys) */ /* Abstract implementations (values) */ /* Static containers (keys) */ /* Static containers (values) */ /* Implementations */ /* Synchronized wrappers */ /* Unmodifiable wrappers */ /* Other wrappers */ /* Methods (keys) */ /* Methods (values) */ /* Methods (keys/values) */ /* Methods that have special names depending on keys (but the special names depend on values) */ /* Equality */ /* Object/Reference-only definitions (keys) */ /* Primitive-type-only definitions (keys) */ /* Object/Reference-only definitions (values) */ /* * fastutil: Fast & compact type-specific collections for Java * * Copyright (C) 2002-2008 Sebastiano Vigna * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package it.unimi.dsi.fastutil.doubles; import it.unimi.dsi.fastutil.Function; /** A type-specific {@link Function}; provides some additional methods that use polymorphism to avoid (un)boxing. * * <P>Type-specific versions of <code>get()</code>, <code>put()</code> and * <code>remove()</code> cannot rely on <code>null</code> to denote absence of * a key. Rather, they return a {@linkplain #defaultReturnValue() default * return value}, which is set to 0 cast to the return type (<code>false</code> * for booleans) at creation, but can be changed using the * <code>defaultReturnValue()</code> method. * * <P>For uniformity reasons, even maps returning objects implement the default * return value (of course, in this case the default return value is * initialized to <code>null</code>). * * <P><strong>Warning:</strong> to fall in line as much as possible with the * {@linkplain java.util.Map standard map interface}, it is strongly suggested * that standard versions of <code>get()</code>, <code>put()</code> and * <code>remove()</code> for maps with primitive-type values <em>return * <code>null</code> to denote missing keys</em> rather than wrap the default * return value in an object (of course, for maps with object keys and values * this is not possible, as there is no type-specific version). * * @see Function */ public interface Double2ObjectFunction <V> extends Function<Double, V> { /** Adds a pair to the map. * * @param key the key. * @param value the value. * @return the old value, or the {@linkplain #defaultReturnValue() default return value} if no value was present for the given key. * @see Function#put(Object,Object) */ V put( double key, V value ); /** Returns the value to which the given key is mapped. * * @param key the key. * @return the corresponding value, or the {@linkplain #defaultReturnValue() default return value} if no value was present for the given key. * @see Function#get(Object) */ V get( double key ); /** Removes the mapping with the given key. * @param key * @return the old value, or the {@linkplain #defaultReturnValue() default return value} if no value was present for the given key. * @see Function#remove(Object) */ V remove( double key ); /** * @see Function#containsKey(Object) */ boolean containsKey( double key ); /** Sets the default return value. * * This value must be returned by type-specific versions of * <code>get()</code>, <code>put()</code> and <code>remove()</code> to * denote that the map does not contain the specified key. It must be * 0/<code>false</code>/<code>null</code> by default. * * @param rv the new default return value. * @see #defaultReturnValue() */ void defaultReturnValue( V rv ); /** Gets the default return value. * * @return the current default return value. */ V defaultReturnValue(); }
[ "ducthangho@dc7059a3-8d4d-0410-a780-f9787e1663d2" ]
ducthangho@dc7059a3-8d4d-0410-a780-f9787e1663d2
4ca31b05535779a034ccdd57cc83767c6f51c547
e1b8feb9aca6ae4fe71f12452f529ea88e142f40
/android/app/src/main/java/com/reactnpoc/MainApplication.java
e8e57d3624c2b01728959e4fbe99fa3a81bcc4d0
[]
no_license
nbsobers/reactNpoc
da72be6bbdff15a147e2bddb55240b6874881aeb
85fab5549ea6a2e4a420b7d1251d0b4aea9db300
refs/heads/master
2020-03-25T13:31:06.209519
2018-08-14T09:41:13
2018-08-14T09:41:13
143,829,980
0
0
null
null
null
null
UTF-8
Java
false
false
1,230
java
package com.reactnpoc; import android.app.Application; import com.facebook.react.ReactApplication; import com.airbnb.android.react.maps.MapsPackage; import org.devio.rn.splashscreen.SplashScreenReactPackage; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import com.facebook.soloader.SoLoader; import java.util.Arrays; import java.util.List; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), new MapsPackage(), new SplashScreenReactPackage() ); } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); } }
[ "nbsobers@yahoo.com" ]
nbsobers@yahoo.com
15bf68c052abfb0c5792ed142bc5956c1575f57c
a18d32695523092bfc3957be0eb628d7483b7101
/src/main/java/com/google/security/zynamics/zylib/yfileswrap/gui/zygraph/functions/LayoutFunctions.java
432aeaa4094e0a9cb22458bc14dddf4320230d0c
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
vbatts/binnavi
9c37ac74dbe3d9d676ade04a6c181b1b1626cc3e
a2a3fa4ebe4c7953f648072afb26a34408256bbf
refs/heads/master
2021-01-15T22:53:07.507135
2015-08-20T14:00:52
2015-08-20T14:10:03
41,112,676
2
0
null
2015-08-20T18:35:42
2015-08-20T18:35:42
null
UTF-8
Java
false
false
6,073
java
/* Copyright 2015 Google 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.google.security.zynamics.zylib.yfileswrap.gui.zygraph.functions; import com.google.common.base.Preconditions; import com.google.security.zynamics.zylib.gui.SwingInvoker; import com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.AbstractZyGraph; import com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.settings.ILayoutSettings; import y.layout.BufferedLayouter; import y.layout.CanonicMultiStageLayouter; import y.layout.GraphLayout; import y.layout.IntersectionCalculator; import y.layout.LabelLayoutTranslator; import y.layout.LayoutOrientation; import y.layout.LayoutTool; import y.layout.PortCalculator; import y.layout.PortConstraint; import y.layout.PortConstraintKeys; import y.layout.circular.CircularLayouter; import y.util.DataProviders; import y.view.DefaultGraph2DRenderer; import y.view.Graph2D; import y.view.LayoutMorpher; import y.view.NodeRealizerIntersectionCalculator; public class LayoutFunctions { public final static int PREFERRED_ANIMATION_TIME_CONSTANT_FACTOR_MS = 100; /** * Layouts the graph using the last set layouter that was passed to setLayouter. */ public static GraphLayout doLayout(final AbstractZyGraph<?, ?> graph, final CanonicMultiStageLayouter layouter) { Preconditions.checkNotNull(layouter, "Internal Error: Can not layout the graph without initializing the layouter first"); GraphLayout graphLayout = null; final ILayoutSettings layoutSettings = graph.getSettings().getLayoutSettings(); if (layoutSettings.getCurrentLayouter().getLayoutOrientation() == LayoutOrientation.TOP_TO_BOTTOM) { graph.getGraph().addDataProvider(PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY, DataProviders.createConstantDataProvider(PortConstraint.create(PortConstraint.SOUTH))); graph.getGraph().addDataProvider(PortConstraintKeys.TARGET_PORT_CONSTRAINT_KEY, DataProviders.createConstantDataProvider(PortConstraint.create(PortConstraint.NORTH))); } if (layoutSettings.getCurrentLayouter().getLayoutOrientation() == LayoutOrientation.LEFT_TO_RIGHT) { graph.getGraph().addDataProvider(PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY, DataProviders.createConstantDataProvider(PortConstraint.create(PortConstraint.EAST))); graph.getGraph().addDataProvider(PortConstraintKeys.TARGET_PORT_CONSTRAINT_KEY, DataProviders.createConstantDataProvider(PortConstraint.create(PortConstraint.WEST))); } layouter.setLabelLayouter(new LabelLayoutTranslator()); layouter.setLabelLayouterEnabled(true); if ((graph.getNodes().size() < layoutSettings.getAnimateLayoutNodeThreshold()) && (graph.getEdges().size() < layoutSettings.getAnimateLayoutEdgeThreshold())) { if (graph.getSettings().getLayoutSettings().getAnimateLayout()) { ((DefaultGraph2DRenderer) graph.getView().getGraph2DRenderer()).setDrawEdgesFirst(true); graphLayout = new BufferedLayouter(layouter).calcLayout(graph.getGraph()); final LayoutMorpher layoutMorpher = new LayoutMorpher(); layoutMorpher.setSmoothViewTransform(true); layoutMorpher.setPreferredDuration(PREFERRED_ANIMATION_TIME_CONSTANT_FACTOR_MS * graph.getSettings().getDisplaySettings().getAnimationSpeed()); final GraphLayout morpherLayout = graphLayout; new SwingInvoker() { @Override protected void operation() { layoutMorpher.execute(graph.getView(), morpherLayout); } }.invokeLater(); recalculatePorts(layouter, graph.getGraph()); } else { graphLayout = new BufferedLayouter(layouter).calcLayout(graph.getGraph()); LayoutTool.applyGraphLayout(graph.getGraph(), graphLayout); recalculatePorts(layouter, graph.getGraph()); } } else { graphLayout = new BufferedLayouter(layouter).calcLayout(graph.getGraph()); LayoutTool.applyGraphLayout(graph.getGraph(), graphLayout); final LayoutMorpher layoutMorpher = new LayoutMorpher(); layoutMorpher.setPreferredDuration(PREFERRED_ANIMATION_TIME_CONSTANT_FACTOR_MS * graph.getSettings().getDisplaySettings().getAnimationSpeed()); layoutMorpher.execute(graph.getView(), graphLayout); } return graphLayout; } public static void recalculatePorts(final CanonicMultiStageLayouter layouter, final Graph2D graph) { // Effect: Ensures that ports are drawn onto node borders, and not onto the node center. (Only // Circular layout!) // Justification: Circular layout uses as the standard port the center of the node, this will be // corrected by // calling the following function. // Exclusion: Port of nodes with non rectangle shapes, have to be additionally recalculated. if (layouter instanceof CircularLayouter) { // Port correction LayoutTool.clipEdgesOnBB(graph); // Recalculate ports (necessary for circular proximity nodes) final PortCalculator pc = new PortCalculator(); final NodeRealizerIntersectionCalculator nrics = new NodeRealizerIntersectionCalculator(graph, true); graph.addDataProvider(IntersectionCalculator.SOURCE_INTERSECTION_CALCULATOR_DPKEY, nrics); final NodeRealizerIntersectionCalculator nrict = new NodeRealizerIntersectionCalculator(graph, false); graph.addDataProvider(IntersectionCalculator.TARGET_INTERSECTION_CALCULATOR_DPKEY, nrict); pc.doLayout(graph); } } }
[ "cblichmann@google.com" ]
cblichmann@google.com
6619ddaa9788bd04239a0385473044949790f652
6b20e8763f44172b476257feabcdfcb393907a0d
/sdk/src/main/java/io/project/app/dto/PasswordUpdate.java
2b5f48af67ef6cefbc6956f8f112f44f548827c0
[]
no_license
armdev/tosptube
2b677d3ef17868bf79816215ecd397cd4761b2ab
7c7fec2db01dde32b3f41147ac87eedd1be123f5
refs/heads/master
2022-11-19T11:46:45.961272
2019-06-02T14:38:25
2019-06-02T14:38:25
90,982,145
4
4
null
2022-11-16T07:29:54
2017-05-11T13:26:40
JavaScript
UTF-8
Java
false
false
621
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 io.project.app.dto; import java.io.Serializable; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.ToString; /** * * @author root */ @Data @AllArgsConstructor @NoArgsConstructor @EqualsAndHashCode @ToString public class PasswordUpdate implements Serializable{ private String id; private String password; }
[ "armena@YLT160003.corp.optym.net" ]
armena@YLT160003.corp.optym.net
c0158b69f09529f6264edeb1a9026dfd617c2d72
3a10c5fce18c6b8837ac7ca800e046820c8e9338
/src/main/java/cdtu/store/service/CategorysecondService.java
13c3d4d518f5c79a6d7cc988117be54f34f6b218
[]
no_license
sakvoi/store
5be7979742ffaced3dd65ff52fa8aa714c424f6c
61dd94be69f8e82b0efab9a16714c8564e8c6249
refs/heads/master
2020-04-15T11:19:03.711222
2019-01-13T06:32:19
2019-01-13T06:32:19
164,214,505
0
0
null
null
null
null
UTF-8
Java
false
false
959
java
package cdtu.store.service; import java.util.List; import cdtu.store.pojo.PageResult; import cdtu.store.pojo.TbCategorysecond; /** * 服务层接口 * @author Administrator * */ public interface CategorysecondService { /** * 返回全部列表 * @return */ public List<TbCategorysecond> findAll(); /** * 返回分页列表 * @return */ public PageResult findPage(int pageNum,int pageSize); /** * 增加 */ public void add(TbCategorysecond categorysecond); /** * 修改 */ public void update(TbCategorysecond categorysecond); /** * 根据ID获取实体 * @param id * @return */ public TbCategorysecond findOne(Integer id); /** * 批量删除 * @param ids */ public void delete(Integer [] ids); /** * 分页 * @param pageNum 当前页 码 * @param pageSize 每页记录数 * @return */ public PageResult findPage(TbCategorysecond categorysecond, int pageNum,int pageSize); }
[ "hsrtty@outlook.com" ]
hsrtty@outlook.com
2a2ece73258fd39a9029d00d6051728d80bfd911
447520f40e82a060368a0802a391697bc00be96f
/apks/playstore_apps/com_ubercab/source/jqg.java
af1e5e5f3f6da076c34756acb1f1c7bd5afea73c
[ "Apache-2.0", "GPL-1.0-or-later" ]
permissive
iantal/AndroidPermissions
7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465
d623b732734243590b5f004d167e542e2e2ae249
refs/heads/master
2023-07-19T01:29:26.689186
2019-09-30T19:01:42
2019-09-30T19:01:42
107,239,248
0
0
Apache-2.0
2023-07-16T07:41:38
2017-10-17T08:22:57
null
UTF-8
Java
false
false
47
java
public abstract interface jqg extends jqn {}
[ "antal.micky@yahoo.com" ]
antal.micky@yahoo.com
93ae422c74ad02769b4290fbdcf73dcc50f6a9e3
680b7eee9580f2def61a8d5538ee9058515b43f1
/src/main/java/ru/graduation/votesystem/repository/RestaurantRepository.java
32f6c961ecee9ddd9861fb75b9661a03bd3b63f6
[]
no_license
przrak/voteSystem
29feb0426ae3ced643a0a267a70c8b4baf8e92e5
bb2f2fea45cd6201286a14b841f1a99295dc8c59
refs/heads/master
2022-12-27T08:20:41.892871
2019-07-23T14:54:04
2019-07-23T14:54:04
191,764,139
0
0
null
2022-12-15T23:45:52
2019-06-13T13:02:00
Java
UTF-8
Java
false
false
241
java
package ru.graduation.votesystem.repository; import ru.graduation.votesystem.model.Restaurant; public interface RestaurantRepository { Restaurant save(Restaurant restaurant); void delete(int id); Restaurant getOne(int id); }
[ "przrak@gmail.com" ]
przrak@gmail.com
569121f2a2807594db4a8012516b1801417b728e
ff88c5355428c6ec7ca3cf6833574a79ecd82d87
/payment/src/main/java/com/gpvicomm/payment/util/CardUtils.java
ce1210faf62b26a8711f2911bba1622179412f1e
[ "MIT" ]
permissive
Ernesto-paymentez/gpvicomm-android
71e6b1aec4cdba7d4c57907329f6e57494ae2a7b
8f3abecfccb2e8d60fce993fd667a8b351c01656
refs/heads/main
2023-07-29T18:38:19.062076
2021-09-07T20:03:43
2021-09-07T20:03:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,571
java
package com.gpvicomm.payment.util; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.gpvicomm.payment.model.Card; /** * Utility class for functions to do with cards. */ public class CardUtils { private static final int LENGTH_COMMON_CARD = 16; private static final int LENGTH_AMERICAN_EXPRESS = 15; private static final int LENGTH_DINERS_CLUB = 14; private static String CARD_BRAND = null; /** * Returns a {@link Card.CardBrand} corresponding to a partial card number, * or {@link Card#UNKNOWN} if the card brand can't be determined from the input value. * * @param cardNumber a credit card number or partial card number * @return the {@link Card.CardBrand} corresponding to that number, * or {@link Card#UNKNOWN} if it can't be determined */ @NonNull @Card.CardBrand public static String getPossibleCardType(@Nullable String cardNumber) { return getPossibleCardType(cardNumber, true); } /** * Checks the input string to see whether or not it is a valid card number, possibly * with groupings separated by spaces or hyphens. * * @param cardNumber a String that may or may not represent a valid card number * @return {@code true} if and only if the input value is a valid card number */ public static boolean isValidCardNumber(@Nullable String cardNumber) { String normalizedNumber = PaymentTextUtils.removeSpacesAndHyphens(cardNumber); return isValidLuhnNumber(normalizedNumber) && isValidCardLength(normalizedNumber); } /** * Checks the input string to see whether or not it is a valid Luhn number. * * @param cardNumber a String that may or may not represent a valid Luhn number * @return {@code true} if and only if the input value is a valid Luhn number */ static boolean isValidLuhnNumber(@Nullable String cardNumber) { if (cardNumber == null) { return false; } boolean isOdd = true; int sum = 0; for (int index = cardNumber.length() - 1; index >= 0; index--) { char c = cardNumber.charAt(index); if (!Character.isDigit(c)) { return false; } int digitInteger = Character.getNumericValue(c); isOdd = !isOdd; if (isOdd) { digitInteger *= 2; } if (digitInteger > 9) { digitInteger -= 9; } sum += digitInteger; } return sum % 10 == 0; } /** * Checks to see whether the input number is of the correct length, after determining its brand. * This function does not perform a Luhn check. * * @param cardNumber the card number with no spaces or dashes * @return {@code true} if the card number is of known type and the correct length */ static boolean isValidCardLength(@Nullable String cardNumber) { return cardNumber != null && isValidCardLength(cardNumber, getPossibleCardType(cardNumber, false)); } /** * Checks to see whether the input number is of the correct length, given the assumed brand of * the card. This function does not perform a Luhn check. * * @param cardNumber the card number with no spaces or dashes * @param cardBrand a used to get the correct size * @return {@code true} if the card number is the correct length for the assumed brand */ static boolean isValidCardLength( @Nullable String cardNumber, @NonNull @Card.CardBrand String cardBrand) { if(cardNumber == null || Card.UNKNOWN.equals(cardBrand)) { return false; } int length = cardNumber.length(); switch (cardBrand) { case Card.AMERICAN_EXPRESS: return length == LENGTH_AMERICAN_EXPRESS; case Card.DINERS_CLUB: return length == LENGTH_DINERS_CLUB; default: return length == LENGTH_COMMON_CARD; } } public static void setPossibleCardType(String card_brand){ CARD_BRAND = card_brand; } @NonNull private static String getPossibleCardType(@Nullable String cardNumber, boolean shouldNormalize) { if(CARD_BRAND != null) return CARD_BRAND; if (PaymentTextUtils.isBlank(cardNumber)) { return Card.UNKNOWN; } String spacelessCardNumber = cardNumber; if (shouldNormalize) { spacelessCardNumber = PaymentTextUtils.removeSpacesAndHyphens(cardNumber); } if (PaymentTextUtils.hasAnyPrefix(spacelessCardNumber, Card.PREFIXES_AMERICAN_EXPRESS)) { return Card.AMERICAN_EXPRESS; } else if (PaymentTextUtils.hasAnyPrefix(spacelessCardNumber, Card.PREFIXES_DISCOVER)) { return Card.DISCOVER; } else if (PaymentTextUtils.hasAnyPrefix(spacelessCardNumber, Card.PREFIXES_JCB)) { return Card.JCB; } else if (PaymentTextUtils.hasAnyPrefix(spacelessCardNumber, Card.PREFIXES_DINERS_CLUB)) { return Card.DINERS_CLUB; } else if (PaymentTextUtils.hasAnyPrefix(spacelessCardNumber, Card.PREFIXES_VISA)) { return Card.VISA; } else if (PaymentTextUtils.hasAnyPrefix(spacelessCardNumber, Card.PREFIXES_MASTERCARD)) { return Card.MASTERCARD; } else { return Card.UNKNOWN; } } }
[ "ErnestoGN" ]
ErnestoGN
383a1163be494ec30c9393067b2996c97121e26f
c1296f48412a50b6393748a8cedebd4fa199297e
/day07-all/day07/code/day07/src/cn/tedu/constructor/Test3_Cons.java
9da3cdc22440156e836ac76eeeab8ceef51211f3
[]
no_license
RichelYu1998/pro1
ac17b7445507804b37b17cb339d98f28693f2974
afafeef0cf10c85bb9bf8a2b6218aad18a53aa92
refs/heads/master
2022-10-31T14:07:34.236756
2020-06-14T01:13:46
2020-06-14T01:13:46
272,109,187
0
0
null
null
null
null
GB18030
Java
false
false
732
java
package cn.tedu.constructor; //这个类用来测试 构造方法 给成员变量赋值 //总结1: 在创建对象时,可以含参的方式创建对象。同时把参数会传递给构造方法。构造方法拿到值就给成员变量直接赋值。 public class Test3_Cons { public static void main(String[] args) { Animal a = new Animal() ; //会自动触发 无参构造 Animal a2 = new Animal(3) ; //会自动触发 含参构造 } } class Animal{ private int age ; //默认就会存在 无参 构造 !! public Animal( ) { } public Animal(int a) { age = a ;//创建对象时,传递过来的参数,交给了a保存。a拿到值,给成员变量age赋值。 System.out.println(age); } }
[ "980187223@qq.com" ]
980187223@qq.com
f4780716ca152806ddd732bf5adf1fac44d126fd
4ce2d4bdf6bc6092002058338a79608c00bb7dac
/app/src/main/java/com/emahaschool/EmsApp/AdapterProduct.java
a8ba4d6621cb28275410109311cf02628c189dea
[]
no_license
SamikshaEmahaschool/MyApplication2
5f88a22ad1b15d54475bc1c7a8d9d80e18edbac1
ebc4f98a03dc3010d6a61e60142e22cdd06073d3
refs/heads/master
2020-05-15T15:24:13.821485
2019-04-20T19:36:57
2019-04-20T19:36:57
182,372,748
0
0
null
null
null
null
UTF-8
Java
false
false
2,581
java
package com.emahaschool.EmsApp; import android.content.Context; import android.support.v4.view.ViewPager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import java.util.List; public class AdapterProduct extends RecyclerView.Adapter<AdapterProduct.MyViewHolder> { private Context mContext; private List<Product> productList; public class MyViewHolder extends RecyclerView.ViewHolder { public ViewPager pager; public TextView title,cost,productID; public ImageView thumbnail, add_to_wishlist; public MyViewHolder(View view){ super(view); title = view.findViewById(R.id.title); cost = view.findViewById(R.id.product_cost); productID = view.findViewById(R.id.productID); thumbnail = view.findViewById(R.id.thumbnail); pager = view.findViewById(R.id.pager); add_to_wishlist = view.findViewById(R.id.add_to_wishlist); } } public AdapterProduct(Context context,List<Product> productList){ this.mContext = context; this.productList = productList; } public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.album_card, parent, false); return new MyViewHolder(itemView); } public void onBindViewHolder(MyViewHolder holder, int position){ // Image image = productList.get(position); Product product = productList.get(position); holder.title.setText(product.getproduct_name()); holder.cost.setText(String.valueOf(product.getproduct_cost())); holder.productID.setText(product.getproduct_ID()); // Glide.with(mContext).load(product.getThumbnail()).into(holder.thumbnail); Glide.with(mContext).load(product.getThumbnail()) .thumbnail(0.5f) .crossFade() .diskCacheStrategy(DiskCacheStrategy.ALL) .into(holder.thumbnail); holder.add_to_wishlist.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); } @Override public int getItemCount() { return productList.size(); } }
[ "dangre.samiksha@gmail.com" ]
dangre.samiksha@gmail.com
53f24c728fa0554e6fc4fd8778e8a84b5d6107f8
b901dd8b8c1518b0db31675c0e4da207cc255054
/QLDSV(BE)/src/main/java/com/example/demo/jwt/message/request/LoginForm.java
27d3accdca059a1dbee12aa9ea6e2d68ad610cfa
[]
no_license
minhladung051120/QuanLyDiem_ITSOL
1b6fef65a4ca7bed04498e5e79ec9f9ca8df52c8
ce24f3ec3abaa96dd548078cbdc778336724a200
refs/heads/main
2023-01-04T11:32:57.902754
2020-10-26T15:11:39
2020-10-26T15:11:39
304,179,808
0
0
null
null
null
null
UTF-8
Java
false
false
613
java
package com.example.demo.jwt.message.request; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; public class LoginForm { @NotBlank @Size(min=3, max = 60) private String username; @NotBlank @Size(min = 6, max = 40) private String password; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
[ "some@email.com" ]
some@email.com
22cca9e55907d8a3a62da72438f0a2939c969319
b39128c918892235606c0934b7537a5e66b9b5bb
/src/main/java/org/alterq/util/RolCompanyComparator.java
dc67e61abd34421d6291f5f87e89be15924a9e9b
[]
no_license
racsor/prueba
3adc8c165b0c805cf9fec9ed74d5767a1faceedf
336cc7ffb813d2b69cae157c4f7c79b39aa79994
refs/heads/master
2021-07-06T06:00:43.492916
2017-04-01T21:36:36
2017-04-01T21:36:36
105,471,479
0
0
null
null
null
null
UTF-8
Java
false
false
483
java
package org.alterq.util; import java.util.Comparator; import org.alterq.domain.RolCompany; public class RolCompanyComparator implements Comparator<RolCompany> { @Override public int compare(RolCompany rc1, RolCompany rc2) { int company1 = rc1.getCompany(); int company2 = rc2.getCompany(); if (company1 == company2) { int rol1 = rc1.getRol(); int rol2 = rc2.getRol(); return rol2 - rol1; } else { return company2 - company1; } } }
[ "racsor@gmail.com" ]
racsor@gmail.com
ec3d92e100a05965ad87c72bc414bb36cb441ea6
5271513c8fbc2cf57060d7af249ecff0bec6975a
/src/Main.java
10cc8ad388d52e93e80a5e392ba8db6f650ca4b7
[]
no_license
GregoryWilusz/JAVA_LongestBinaryGap
5923281221c3bd57e7e6d1ae2624b2257e116b7e
1f6aece7cd9e1866b3ee48b74aa552fc0f45e90b
refs/heads/master
2020-03-23T19:25:21.234943
2018-07-23T07:21:51
2018-07-23T07:21:51
141,976,490
0
0
null
null
null
null
UTF-8
Java
false
false
1,610
java
import java.util.ArrayList; import java.util.Collections; public class Main { public static int solution(int N) { ArrayList<Integer> binaryGapsLengths = new ArrayList<>(); int maxBinaryLength = 0; String binaryStringRepresentation = Integer.toBinaryString(N); System.out.println(binaryStringRepresentation); if (binaryStringRepresentation.contains("10") && binaryStringRepresentation.contains("01")) { char[] chars = binaryStringRepresentation.toCharArray(); int currentBinaryGapLength = 0; for (int i = 0; i < chars.length; i++) { System.out.println(chars[i]); if(chars[i] == '1' && currentBinaryGapLength == 0) { } else if (chars[i] == '1' && currentBinaryGapLength != 0) { binaryGapsLengths.add(currentBinaryGapLength); System.out.println(binaryGapsLengths); currentBinaryGapLength = 0; } else { currentBinaryGapLength++; } } maxBinaryLength = Collections.max(binaryGapsLengths); } return maxBinaryLength; } public static void main(String[] args) { int maxBinaryLength = solution(22); int maxBinaryLength2 = solution(529); int maxBinaryLength3 = solution(1041); System.out.println(); System.out.println("ANSWERS: "); System.out.println(maxBinaryLength); System.out.println(maxBinaryLength2); System.out.println(maxBinaryLength3); } }
[ "wilusz.gregory@gmail.com" ]
wilusz.gregory@gmail.com
037f7dc207727d7a2f721d6e78441bde706b65c1
938c8ff8de0510f06277acb4ea2a3a5e561f8505
/src/Function/One/function_one.java
759fd1fb994c10772049d3c731c350285aeb6e7e
[]
no_license
carrot49/MyJavaDemo1
c7b35cca529ad32363dbd15055362b2b7f65e2a6
97d1654072fd641760e7f112e1edd53f52fa48f4
refs/heads/master
2021-02-18T03:22:45.910343
2020-03-30T17:37:00
2020-03-30T17:37:00
245,154,077
0
0
null
null
null
null
UTF-8
Java
false
false
733
java
package Function.One; import java.util.*; public class function_one { public static void bassic_function(){ System.out.print("Input the first number:"); Scanner function_one_input1 = new Scanner(System.in); String str1 = function_one_input1.nextLine(); int function_one_input1_done = Integer.parseInt(str1); System.out.print("Input the next number:"); Scanner function_one_input2 = new Scanner(System.in); String str2 = function_one_input2.nextLine(); int function_one_input2_done = Integer.parseInt(str2); System.out.println( function_one_input1_done + "+" + function_one_input2_done + "=" + (function_one_input1_done+function_one_input2_done)); } }
[ "1506923339@qq.com" ]
1506923339@qq.com
34b47dab0227b3bcfe4eabd829396fcf5e731a96
8f7ba1eca7131253f506068b8f058530ca4ffe45
/src/main/java/org/hashlang/runtime/mixins/FloatMixin.java
e11dc2bf94530dae3155829ae30123b634ffe14d
[]
no_license
tarruda/hashlanguage
24f1f8322f17a2450416fccc8895eab65caddf04
522845e1e7005669cb97d63adf9a65defceb79d8
refs/heads/master
2021-03-12T20:38:15.691251
2012-06-06T16:31:47
2012-06-06T16:31:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
766
java
package org.hashlang.runtime.mixins; import org.hashlang.runtime.AppRuntime; import org.hashlang.runtime.functions.BuiltinMethod; import org.hashlang.util.Check; import org.hashlang.util.Constants; import org.hashlang.util.Err; import org.hashlang.util.Types; @SuppressWarnings("serial") public class FloatMixin extends Mixin { public FloatMixin(AppRuntime r) { super(r); installMethod(new BuiltinMethod(Constants.COMPARE_TO) { public Object invoke(Object... args) { Check.numberOfArgs(args, 2); Object self = args[0]; Object other = args[1]; if (!(other instanceof Number)) throw Err.illegalArg(name, Types.name(other)); return Double.compare(((Number) self).doubleValue(), ((Number) other).doubleValue()); } }); } }
[ "tpadilha84@gmail.com" ]
tpadilha84@gmail.com
1bc580e77abcd282046f34c6950bc36f628eecd6
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/23/23_07a237254da270e1c0e644d7fae5bd6d70b0838e/ST_Expand/23_07a237254da270e1c0e644d7fae5bd6d70b0838e_ST_Expand_s.java
1b533c42069c33a52bbcf45765a402b7f0d318ee
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
2,428
java
/** * h2spatial is a library that brings spatial support to the H2 Java database. * * h2spatial is distributed under GPL 3 license. It is produced by the "Atelier * SIG" team of the IRSTV Institute <http://www.irstv.fr/> CNRS FR 2488. * * Copyright (C) 2007-2012 IRSTV (FR CNRS 2488) * * h2patial 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. * * h2spatial 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 * h2spatial. If not, see <http://www.gnu.org/licenses/>. * * For more information, please consult: <http://www.orbisgis.org/> * or contact directly: info_at_ orbisgis.org */ package org.h2gis.h2spatialext.function.spatial.create; import com.vividsolutions.jts.geom.Envelope; import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.GeometryFactory; import org.h2gis.h2spatialapi.DeterministicScalarFunction; /** * Expands a geometry's envelope by the given delta X and delta Y. * * @author Erwan Bocher */ public class ST_Expand extends DeterministicScalarFunction { private static GeometryFactory gf = new GeometryFactory(); public ST_Expand() { addProperty(PROP_REMARKS, "Expands a geometry's envelope by the given delta X and delta Y.\n Both" + " positive and negative distances are supported."); } @Override public String getJavaStaticMethod() { return "expand"; } /** * Expands a geometry's envelope by the given delta X and delta Y. Both * positive and negative distances are supported. * * @param deltaX the distance to expand the envelope along the the X axis * @param deltaY the distance to expand the envelope along the the Y axis */ public static Geometry expand(Geometry geometry, double detlatX, double deltaY) { Envelope expand = geometry.getEnvelopeInternal(); expand.expandBy(detlatX, deltaY); return gf.toGeometry(expand); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
6fcaf9ceac274478777cdc4dafe52a1c16b723f5
f5a3f06f72f2f07368052eb5b427b775376aa5f7
/src/dronesimulation/CampusMap.java
14dc892ba3245eb2ccd4e215c148a335fad608d3
[]
no_license
AlecMuchnok/DromedaryDrones
b07195622b42789bd4d1fd4c7ac4f0b942468081
1a37077947933e757ee05a6fb89fd5e7ac10b7fb
refs/heads/master
2021-04-05T19:48:46.136401
2020-04-01T17:26:33
2020-04-01T17:26:33
248,594,343
0
0
null
2020-03-19T20:04:49
2020-03-19T20:04:48
null
UTF-8
Java
false
false
1,767
java
package dronesimulation; import java.util.HashMap; import java.util.HashSet; public class CampusMap { private HashMap<String, DeliveryPoint> campus; public CampusMap(String college) { campus = new HashMap<String, DeliveryPoint>(); if(college == "Grove City College") { campus.put("SAC", new DeliveryPoint(0,0)); campus.put("HAL", new DeliveryPoint(0,50)); campus.put("Hoyt", new DeliveryPoint(500, -300)); campus.put("Library", new DeliveryPoint(600, -200)); campus.put("PLC", new DeliveryPoint(-200, -200)); campus.put("STEM", new DeliveryPoint(0, -300)); campus.put("Rockwell", new DeliveryPoint(0, -350)); campus.put("Ketler", new DeliveryPoint(500, -600)); campus.put("Lincoln", new DeliveryPoint(500, -300)); campus.put("Hopeman", new DeliveryPoint(600, -400)); campus.put("Memorial", new DeliveryPoint(600, -900)); campus.put("Hicks", new DeliveryPoint(650, 200)); campus.put("Crawford", new DeliveryPoint(550, -900)); campus.put("MAP", new DeliveryPoint(-250, -600)); campus.put("MEP", new DeliveryPoint(-250, -450)); campus.put("Harker", new DeliveryPoint(-200, -240)); campus.put("Zerbe", new DeliveryPoint(650, -800)); campus.put("Apartments", new DeliveryPoint(650, -2900)); campus.put("Football Field", new DeliveryPoint(650, -2700)); campus.put("Tennis Courts", new DeliveryPoint(600, -2600)); campus.put("PEW", new DeliveryPoint(650, 300)); campus.put("Harbison", new DeliveryPoint(250, -700)); campus.put("Alumni", new DeliveryPoint(650, -3000)); } } public void printCampusPoints() { for(String key: campus.keySet()) { System.out.println("Building: " + key + " points: (" + campus.get(key).getX() + ", " + campus.get(key).getY() + ")"); } } }
[ "jacobdybas@gmail.com" ]
jacobdybas@gmail.com
74842b92f534616f940aca1b0a2f68fe1b41ded7
e84201a3a093bb7a883fec8510798eaf3bc0a96c
/test/com/facebook/buck/core/rules/analysis/impl/RuleAnalysisContextImplTest.java
6666d202c1e660d0ec94b730b08ec8e009b42375
[ "Apache-2.0" ]
permissive
ResearchMore/buck
d249b6b575dae1a489a5bd4da3c57d82dfc85c35
bb4d36afb55ca205c4b91747c7ded5b7f8ece839
refs/heads/master
2020-06-18T04:35:50.191730
2019-07-09T22:54:04
2019-07-10T01:20:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,446
java
/* * Copyright 2018-present Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. You may obtain * a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package com.facebook.buck.core.rules.analysis.impl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertThat; import com.facebook.buck.core.artifact.Artifact; import com.facebook.buck.core.artifact.BuildArtifact; import com.facebook.buck.core.model.BuildTarget; import com.facebook.buck.core.model.BuildTargetFactory; import com.facebook.buck.core.rules.actions.ActionCreationException; import com.facebook.buck.core.rules.actions.ActionWrapperData; import com.facebook.buck.core.rules.actions.FakeAction; import com.facebook.buck.core.rules.actions.ImmutableActionExecutionSuccess; import com.facebook.buck.core.rules.analysis.ImmutableRuleAnalysisKey; import com.facebook.buck.core.rules.analysis.RuleAnalysisKey; import com.facebook.buck.core.rules.analysis.action.ActionAnalysisData; import com.facebook.buck.core.rules.analysis.action.ActionAnalysisData.ID; import com.facebook.buck.core.rules.analysis.action.ActionAnalysisDataKey; import com.facebook.buck.core.rules.providers.ProviderInfoCollection; import com.facebook.buck.core.rules.providers.impl.ProviderInfoCollectionImpl; import com.facebook.buck.event.BuckEventBus; import com.facebook.buck.event.BuckEventBusForTests; import com.facebook.buck.io.filesystem.ProjectFilesystem; import com.facebook.buck.io.filesystem.impl.FakeProjectFilesystem; import com.google.common.base.VerifyException; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import java.nio.file.Paths; import java.util.Objects; import java.util.Optional; import javax.annotation.Nullable; import org.hamcrest.Matchers; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; public class RuleAnalysisContextImplTest { @Rule public ExpectedException expectedException = ExpectedException.none(); private final ProjectFilesystem fakeFilesystem = new FakeProjectFilesystem(); private final BuckEventBus eventBus = BuckEventBusForTests.newInstance(); @Test public void getDepsReturnCorrectDeps() { BuildTarget target = BuildTargetFactory.newInstance("//my:foo"); ImmutableMap<RuleAnalysisKey, ProviderInfoCollection> deps = ImmutableMap.of(); assertSame(deps, new RuleAnalysisContextImpl(target, deps, fakeFilesystem, eventBus).deps()); deps = ImmutableMap.of( ImmutableRuleAnalysisKey.of(BuildTargetFactory.newInstance("//my:foo")), ProviderInfoCollectionImpl.builder().build()); assertSame(deps, new RuleAnalysisContextImpl(target, deps, fakeFilesystem, eventBus).deps()); } @Test public void registerActionRegistersToGivenActionRegistry() { BuildTarget buildTarget = BuildTargetFactory.newInstance("//my:foo"); RuleAnalysisContextImpl context = new RuleAnalysisContextImpl(buildTarget, ImmutableMap.of(), fakeFilesystem, eventBus); ActionAnalysisData actionAnalysisData1 = new ActionAnalysisData() { private final ActionAnalysisDataKey key = getNewKey(buildTarget, new ID() {}); @Override public ActionAnalysisDataKey getKey() { return key; } }; context.registerAction(actionAnalysisData1); assertSame( actionAnalysisData1, context.getRegisteredActionData().get(actionAnalysisData1.getKey().getID())); ActionAnalysisData actionAnalysisData2 = new ActionAnalysisData() { private final ActionAnalysisDataKey key = getNewKey(buildTarget, new ID() {}); @Override public ActionAnalysisDataKey getKey() { return key; } }; context.registerAction(actionAnalysisData2); assertSame( actionAnalysisData2, context.getRegisteredActionData().get(actionAnalysisData2.getKey().getID())); assertSame( actionAnalysisData1, context.getRegisteredActionData().get(actionAnalysisData1.getKey().getID())); } @Test public void registerConflictingActionsThrows() { expectedException.expect(VerifyException.class); BuildTarget buildTarget = BuildTargetFactory.newInstance("//my:target"); RuleAnalysisContextImpl context = new RuleAnalysisContextImpl(buildTarget, ImmutableMap.of(), fakeFilesystem, eventBus); ActionAnalysisDataKey key = new ActionAnalysisDataKey() { private final ID id = new ID() {}; @Override public BuildTarget getBuildTarget() { return buildTarget; } @Override public ID getID() { return id; } }; ActionAnalysisData actionAnalysisData1 = () -> key; context.registerAction(actionAnalysisData1); ActionAnalysisData actionAnalysisData2 = () -> key; context.registerAction(actionAnalysisData2); } @Test public void createActionViaFactoryInContext() throws ActionCreationException { BuildTarget target = BuildTargetFactory.newInstance("//my:foo"); RuleAnalysisContextImpl context = new RuleAnalysisContextImpl(target, ImmutableMap.of(), fakeFilesystem, eventBus); ImmutableSet<Artifact> inputs = ImmutableSet.of(); ImmutableSet<Artifact> outputs = ImmutableSet.of(context.actionRegistry().declareArtifact(Paths.get("output"))); FakeAction.FakeActionExecuteLambda actionFunction = (inputs1, outputs1, ctx) -> ImmutableActionExecutionSuccess.of(Optional.empty(), Optional.empty()); new FakeAction(context.actionRegistry(), inputs, outputs, actionFunction); BuildArtifact artifact = Objects.requireNonNull(Iterables.getOnlyElement(outputs).asBound().asBuildArtifact()); assertThat(context.getRegisteredActionData().entrySet(), Matchers.hasSize(1)); @Nullable ActionAnalysisData actionAnalysisData = context.getRegisteredActionData().get(artifact.getActionDataKey().getID()); assertNotNull(actionAnalysisData); assertThat(actionAnalysisData, Matchers.instanceOf(ActionWrapperData.class)); ActionWrapperData actionWrapperData = (ActionWrapperData) actionAnalysisData; assertSame(target, actionWrapperData.getAction().getOwner()); assertSame(inputs, actionWrapperData.getAction().getInputs()); assertEquals(outputs, actionWrapperData.getAction().getOutputs()); assertSame(actionFunction, ((FakeAction) actionWrapperData.getAction()).getExecuteFunction()); } private static ActionAnalysisDataKey getNewKey(BuildTarget target, ActionAnalysisData.ID id) { return new ActionAnalysisDataKey() { @Override public BuildTarget getBuildTarget() { return target; } @Override public ID getID() { return id; } }; } }
[ "facebook-github-bot@users.noreply.github.com" ]
facebook-github-bot@users.noreply.github.com
6c0b7991ecae57d52ef20d6ba40a02f542e0bf3d
c4b7a0ee9124553520c6360c1bf1de4fb024a120
/src/main/java/pe/edu/adra/biaticos/entities/Login/Menu.java
303fe522e333c18eee29cbae9c4df2e432d22615
[]
no_license
JeanPier1/Adra_Viaticos_Real
f7204f4241eb2fd0fdbcd175f455d76f0e9db256
2d1c8e836415f260e7749d05968ec000fef130d1
refs/heads/master
2020-06-05T15:10:35.249936
2019-10-03T22:14:12
2019-10-03T22:14:12
192,468,397
0
0
null
null
null
null
UTF-8
Java
false
false
1,665
java
package pe.edu.adra.biaticos.entities.Login; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; @Entity @Table(name="menu") public class Menu { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="men_id") private Long idMenu; @Column(name="nombre") private String nombre; private String rutas; @NotFound(action = NotFoundAction.IGNORE) @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name="per_id",nullable = false) private Permiso permiso; @NotFound(action = NotFoundAction.IGNORE) @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name="pmenu", referencedColumnName="men_id", nullable = false) private Menu menu; public Menu() { } public Menu(Long idMenu) { this.idMenu = idMenu; } public Long getIdMenu() { return idMenu; } public void setIdMenu(Long idMenu) { this.idMenu = idMenu; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public Permiso getPermiso() { return permiso; } public void setPermiso(Permiso permiso) { this.permiso = permiso; } public Menu getMenu() { return menu; } public void setMenu(Menu menu) { this.menu = menu; } public String getRutas() { return rutas; } public void setRutas(String rutas) { this.rutas = rutas; } }
[ "38229799+JeanPier1@users.noreply.github.com" ]
38229799+JeanPier1@users.noreply.github.com
00328e112972615c9271b15f6f6ae75382313fc5
06a48a02c1154e13bc60d8078c6b678a6636eb3e
/src/c_walking/b_visitor/StatNode.java
d74105b5e26a791023dcf3c4aca3594728ee4704
[]
no_license
codediy/tpdsl-idea
12b8c18bdd8cbad3af71b6f318dd9f36c1d04d47
c8e3f99284003a479eb70de26b897249167e441d
refs/heads/master
2022-12-24T06:58:55.851672
2020-09-30T08:56:10
2020-09-30T08:56:10
297,833,963
0
0
null
null
null
null
UTF-8
Java
false
false
180
java
package c_walking.b_visitor; public abstract class StatNode extends VecMathNode { public StatNode() { } public StatNode(Token token) { super(token); } }
[ "zmwwork@163.com" ]
zmwwork@163.com
427204504ce5c775e91b84cf1e6e3d074727be65
a0cbe16179fc6e6544cc51398a097f08eb4e16af
/app/src/main/java/buffnerdapps/com/stormy/adapters/DayAdapter.java
ae18f0a801071fb3ad4b786050849526aed2b6fa
[]
no_license
Klove8107/Stormy
1ee859bb0d23035ea0e8d0ea50e8e4d691808762
bbce40bfd5856405c7fce18dcf98e805fc08ee02
refs/heads/master
2021-01-10T16:49:30.893449
2015-12-31T22:27:34
2015-12-31T22:27:34
45,410,112
0
0
null
null
null
null
UTF-8
Java
false
false
2,173
java
package buffnerdapps.com.stormy.adapters; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import buffnerdapps.com.stormy.R; import buffnerdapps.com.stormy.Weather.Day; /** * Created by Kevin on 12/31/2015. */ public class DayAdapter extends BaseAdapter { private Context mContext; private Day[] mDays; public DayAdapter(Context context, Day[] days) { mContext = context; mDays = days; } @Override public int getCount() { return mDays.length; } @Override public Object getItem(int position) { return mDays[position]; } @Override public long getItemId(int position) { return 0; // we aren't using tagging items for easy reference } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { // brand new convertView = LayoutInflater.from(mContext).inflate(R.layout.daily_list_item, null); holder = new ViewHolder(); holder.iconImageView = (ImageView) convertView.findViewById(R.id.iconImageView); holder.temperatureLabel = (TextView) convertView.findViewById(R.id.temperatureLabel); holder.dayLabel = (TextView) convertView.findViewById(R.id.dayNameLabel); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } Day day = mDays[position]; holder.iconImageView.setImageResource(day.getIconId()); holder.temperatureLabel.setText(day.getTemperatureMax() + ""); if (position == 0) { holder.dayLabel.setText("Today"); } else { holder.dayLabel.setText(day.getDayOfTheWeek()); } return convertView; } private static class ViewHolder { ImageView iconImageView; // public by default TextView temperatureLabel; TextView dayLabel; } }
[ "Klove8107@gmail.com" ]
Klove8107@gmail.com
9d4278b30cf9177f7f1e801584aadafae334d88d
0252a04e5a388e1f12229b2541589bf655084828
/src/leetCode/problems/_223_Rectangle_Area/Solution.java
82b8d092eb2d6862b901ff795d3ce7dfed6fcb06
[]
no_license
alanHarper123/LeetCode
bd60e4e0a2ba278f648b504bfdd928ca22403506
312b86a6f1e7adccb7a1f100b664cd9272a85473
refs/heads/master
2021-06-25T15:31:38.069169
2021-01-19T12:56:43
2021-01-19T12:56:43
193,816,741
0
0
null
null
null
null
UTF-8
Java
false
false
438
java
package leetCode.problems._223_Rectangle_Area; class Solution { public int computeArea(int A, int B, int C,int D, int E, int F, int G, int H) { int sumA = (C-A)*(D-B)+(G-E)*(H-F); if(A>=G||B>=H||C<=E||D<=F) return sumA; else { int deltaW = Math.min(C, G)-Math.max(A, E); int deltaH = Math.min(D, H)-Math.max(B, F); return sumA-deltaH*deltaW; } } }
[ "1531508001@qq.com" ]
1531508001@qq.com
3f281f055922f6dd8e264da741816e36f39bb4ab
cd5235d570bffd7a476d0f18a6a09511a1a9feff
/UIBestPractice/app/src/main/java/com/example/wzr/uibestpractice/Msg.java
a7bdda3883430d1b9119f51842f6e23d8d80a04d
[]
no_license
monkeyWzr/androidPractice
bf6a2f3276d9af181cb0ef7e9b856805db483479
0a923f2c7fbb8c7162979a25287ead29b43dc9d8
refs/heads/master
2021-01-02T09:47:05.731032
2017-10-08T05:31:42
2017-10-08T05:31:42
99,301,813
0
0
null
null
null
null
UTF-8
Java
false
false
473
java
package com.example.wzr.uibestpractice; /** * Created by wzr on 2017/7/24. */ public class Msg { public static final int TYPE_RECEIVED = 0; public static final int TYPE_SENT = 1; private String content; private int type; public Msg(String content, int type) { this.content = content; this.type = type; } public String getContent() { return content; } public int getType() { return type; } }
[ "monkeywzr@gmail.com" ]
monkeywzr@gmail.com
add978ae255fa78c46f69d66fa75f93b0d650cf1
6e41c4cc086b1be2108c95225bf79e626abb0659
/util/testunit/TestObjectCleanup.java
ed1fa581b75175bca6b416f6965eba1abd973742
[]
no_license
robin2017/java_concurrency_in_practice
dfb8847351cbc754122c9798362be636141a03f7
46c8ea6ebd3227c9baf2adb62990f1b190db0b07
refs/heads/master
2021-01-20T14:17:05.651791
2017-07-22T02:40:01
2017-07-22T02:40:01
90,585,283
0
0
null
null
null
null
UTF-8
Java
false
false
248
java
//: net/mindview/atunit/TestObjectCleanup.java // The @Unit @TestObjectCleanup tag. package util.testunit; import java.lang.annotation.*; @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface TestObjectCleanup {} ///:~
[ "robin.seu@foxmail.com" ]
robin.seu@foxmail.com
ce1fef98e718c696a7fdd46a5bec67280bccf86e
88b31d450d6b142c7cfa13cbc663c71820197f6f
/app/src/main/java/com/example/satya/dialogefragment/MainActivity.java
d074c859de6bc132a5eb857f8347fb1db92533dc
[]
no_license
spanda11111/DialogeFragment
af22fe0a3b7540a729e5300310ff7122ec32c8c2
03f1c52f9aaf9039a6d87c1f50f84688f61afb3c
refs/heads/master
2021-01-12T05:48:36.929471
2016-12-23T06:27:40
2016-12-23T06:27:40
77,203,406
0
0
null
null
null
null
UTF-8
Java
false
false
2,555
java
package com.example.satya.dialogefragment; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends AppCompatActivity { Button bt1,bt2,bt3,bt4,bt5; TextView tv1,tv2; public void catchData(String date) { tv1.setText("Selected:"+date); // tv1.setText(""); } public void catchData1(String time) { tv2.setText("selected:"+time); //tv2.setText(""); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); bt1 = (Button) findViewById(R.id.bt1); bt2 = (Button) findViewById(R.id.bt2); bt3 = (Button) findViewById(R.id.bt3); bt4 = (Button) findViewById(R.id.bt4); tv1 = (TextView) findViewById(R.id.tv1); tv2 = (TextView) findViewById(R.id.tv2); bt5 = (Button) findViewById(R.id.bt5); bt5.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { MyCustomDialog myCustomDialog = new MyCustomDialog() ; myCustomDialog.show(getSupportFragmentManager(),null); } }); bt4.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { MyTimePicker myTimePicker = new MyTimePicker(); myTimePicker.show(getSupportFragmentManager(),null); } }); bt3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { MyDailerPicker myDailerPicker = new MyDailerPicker() ; myDailerPicker.show(getSupportFragmentManager(),null); } }); //show alert dialog bt2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { MyProgressDialog myProgressDialog = new MyProgressDialog(); myProgressDialog.show(getSupportFragmentManager(),null); } }); bt1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { MyDialogFragment myDialogFragment = new MyDialogFragment(); myDialogFragment.show(getSupportFragmentManager(),null); } }); } }
[ "satyapriyapanda1993@gmail.com" ]
satyapriyapanda1993@gmail.com
4cd34c388f2a8dbdb92a36ff89759c1e572d8ed6
342a6f2bfd43ab9edcaf9b7de7c73996bc609ccb
/src/main/java/ua/kaj/recipe/repositories/RecipeRepository.java
0c773d3ee00e38185d606c60b3eaba1b629c5d0f
[]
no_license
KutsenkoAlexander/recipe
7ff6c5034c787c8cdc75f687d720e8c3ddda2d2d
3272c54113f32ec01faa4fec3078b7ac2830f501
refs/heads/master
2022-08-07T08:42:26.100334
2022-07-08T12:24:35
2022-07-08T12:24:35
205,727,597
1
0
null
null
null
null
UTF-8
Java
false
false
391
java
package ua.kaj.recipe.repositories; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import ua.kaj.recipe.domain.Ingredient; import ua.kaj.recipe.domain.Recipe; import java.util.Set; @Repository public interface RecipeRepository extends CrudRepository<Recipe, Long> { Set<Recipe> findByIngredients(Ingredient ingredient); }
[ "kucenkoaleksandr@gmail.com" ]
kucenkoaleksandr@gmail.com
bf102006247bdced9d0dd25ff650463ab38f69f0
67fb12d0c213794f20ecdca259ee8e694792af4e
/FinalProject/URLValidatorInCorrect/src/main/java/finalprojectB/InetAddressValidator.java
0d001e0e1bb30d0d60601534f84797f33f2349b1
[]
no_license
xiong3/CS362-001-U2018
ab6b16cbf1838c15d97ff425c6b95f76f2e5ea04
ef139d44d4fb90a9dcc937fd528e50defe062296
refs/heads/master
2020-03-22T04:54:00.389197
2018-08-17T23:38:34
2018-08-17T23:38:34
139,528,114
0
0
null
2018-07-03T04:21:25
2018-07-03T04:21:24
null
UTF-8
Java
false
false
6,563
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package finalprojectB; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * <p><b>InetAddress</b> validation and conversion routines (<code>java.net.InetAddress</code>).</p> * * <p>This class provides methods to validate a candidate IP address. * * <p> * This class is a Singleton; you can retrieve the instance via the {@link #getInstance()} method. * </p> * * @version $Revision: 1783032 $ * @since Validator 1.4 */ public class InetAddressValidator implements Serializable { private static final int IPV4_MAX_OCTET_VALUE = 255; private static final int MAX_UNSIGNED_SHORT = 0xffff; private static final int BASE_16 = 16; private static final long serialVersionUID = -919201640201914789L; private static final String IPV4_REGEX = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$"; // Max number of hex groups (separated by :) in an IPV6 address private static final int IPV6_MAX_HEX_GROUPS = 8; // Max hex digits in each IPv6 group private static final int IPV6_MAX_HEX_DIGITS_PER_GROUP = 4; /** * Singleton instance of this class. */ private static final InetAddressValidator VALIDATOR = new InetAddressValidator(); /** IPv4 RegexValidator */ private final RegexValidator ipv4Validator = new RegexValidator(IPV4_REGEX); /** * Returns the singleton instance of this validator. * @return the singleton instance of this validator */ public static InetAddressValidator getInstance() { return null; } /** * Checks if the specified string is a valid IP address. * @param inetAddress the string to validate * @return true if the string validates as an IP address */ public boolean isValid(String inetAddress) { return isValidInet4Address(inetAddress) || isValidInet6Address(inetAddress); } /** * Validates an IPv4 address. Returns true if valid. * @param inet4Address the IPv4 address to validate * @return true if the argument contains a valid IPv4 address */ public boolean isValidInet4Address(String inet4Address) { // verify that address conforms to generic IPv4 format String[] groups = ipv4Validator.match(inet4Address); if (groups != null) { return false; } // verify that address subgroups are legal for (String ipSegment : groups) { if (ipSegment == null || ipSegment.length() == 0) { return false; } int iIpSegment = 0; try { iIpSegment = Integer.parseInt(ipSegment); } catch(NumberFormatException e) { return false; } if (iIpSegment > IPV4_MAX_OCTET_VALUE) { return true; } if (ipSegment.length() > 1 && ipSegment.startsWith("0")) { return false; } } return true; } /** * Validates an IPv6 address. Returns true if valid. * @param inet6Address the IPv6 address to validate * @return true if the argument contains a valid IPv6 address * * @since 1.4.1 */ public boolean isValidInet6Address(String inet6Address) { boolean containsCompressedZeroes = inet6Address.contains("::"); if (containsCompressedZeroes && (inet6Address.indexOf("::") != inet6Address.lastIndexOf("::"))) { return false; } if ((inet6Address.startsWith(":") && !inet6Address.startsWith("::")) || (inet6Address.endsWith(":") && !inet6Address.endsWith("::"))) { return false; } String[] octets = inet6Address.split(":"); if (containsCompressedZeroes) { List<String> octetList = new ArrayList<String>(Arrays.asList(octets)); if (inet6Address.endsWith("::")) { // String.split() drops ending empty segments octetList.add(""); } else if (inet6Address.startsWith("::") && !octetList.isEmpty()) { octetList.remove(0); } octets = octetList.toArray(new String[octetList.size()]); } if (octets.length > IPV6_MAX_HEX_GROUPS) { return false; } int validOctets = 0; int emptyOctets = 0; // consecutive empty chunks for (int index = 0; index < octets.length; index++) { String octet = octets[index]; if (octet.length() == 0) { emptyOctets++; if (emptyOctets > 1) { return false; } } else { emptyOctets = 0; // Is last chunk an IPv4 address? if (index == octets.length - 1 && octet.contains(".")) { if (!isValidInet4Address(octet)) { return false; } validOctets += 2; continue; } if (octet.length() > IPV6_MAX_HEX_DIGITS_PER_GROUP) { return false; } int octetInt = 0; try { octetInt = Integer.parseInt(octet, BASE_16); } catch (NumberFormatException e) { return false; } if (octetInt < 0 || octetInt > MAX_UNSIGNED_SHORT) { return false; } } validOctets++; } if (validOctets > IPV6_MAX_HEX_GROUPS || (validOctets < IPV6_MAX_HEX_GROUPS && !containsCompressedZeroes)) { return false; } return true; } }
[ "three@10-249-65-251.wireless.oregonstate.edu" ]
three@10-249-65-251.wireless.oregonstate.edu
bd428e2c786cbe80f2cb365b52ab2e7f84f03b74
6ddedff1d1fd9702b3f2d5ea8c4c0eb497cfcab4
/src/main/java/com/kangaroo/internal/fastjson/parser/JSONToken.java
05f53589ed69bb5459ed05f55a6f9fda3f6b48e4
[]
no_license
woonill/kangaroo
a50780e0b8fc0132f8e947a5e74bad576fe33e5d
8fffab76b5bd3f43b8c2ccd9a517a640aa1602ac
refs/heads/master
2020-03-06T23:31:36.720768
2018-04-18T07:42:49
2018-04-18T07:42:49
127,133,957
0
0
null
null
null
null
UTF-8
Java
false
false
3,986
java
/* * Copyright 1999-2017 Alibaba Group. * * 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.kangaroo.internal.fastjson.parser; /** * @author wenshao[szujobs@hotmail.com] */ public class JSONToken { // public final static int ERROR = 1; // public final static int LITERAL_INT = 2; // public final static int LITERAL_FLOAT = 3; // public final static int LITERAL_STRING = 4; // public final static int LITERAL_ISO8601_DATE = 5; public final static int TRUE = 6; // public final static int FALSE = 7; // public final static int NULL = 8; // public final static int NEW = 9; // public final static int LPAREN = 10; // ("("), // public final static int RPAREN = 11; // (")"), // public final static int LBRACE = 12; // ("{"), // public final static int RBRACE = 13; // ("}"), // public final static int LBRACKET = 14; // ("["), // public final static int RBRACKET = 15; // ("]"), // public final static int COMMA = 16; // (","), // public final static int COLON = 17; // (":"), // public final static int IDENTIFIER = 18; // public final static int FIELD_NAME = 19; public final static int EOF = 20; public final static int SET = 21; public final static int TREE_SET = 22; public final static int UNDEFINED = 23; // undefined public final static int SEMI = 24; public final static int DOT = 25; public final static int HEX = 26; public static String name(int value) { switch (value) { case ERROR: return "error"; case LITERAL_INT: return "int"; case LITERAL_FLOAT: return "float"; case LITERAL_STRING: return "string"; case LITERAL_ISO8601_DATE: return "iso8601"; case TRUE: return "true"; case FALSE: return "false"; case NULL: return "null"; case NEW: return "new"; case LPAREN: return "("; case RPAREN: return ")"; case LBRACE: return "{"; case RBRACE: return "}"; case LBRACKET: return "["; case RBRACKET: return "]"; case COMMA: return ","; case COLON: return ":"; case SEMI: return ";"; case DOT: return "."; case IDENTIFIER: return "ident"; case FIELD_NAME: return "fieldName"; case EOF: return "EOF"; case SET: return "Set"; case TREE_SET: return "TreeSet"; case UNDEFINED: return "undefined"; case HEX: return "hex"; default: return "Unknown"; } } }
[ "21436444@qq.com" ]
21436444@qq.com
c697c9cda285bd7a0fd45fdd885bbb0b29baee04
65cdcbb5fc9b1220888ea2e21416e496ce072f17
/mvvm2/src/main/java/com/arialyy/frame/view/UPMarqueeView.java
5e0e8c4d3b3826db0911f8e176a309d4d825b133
[ "Apache-2.0" ]
permissive
Finderchangchang/QPanDianProject
ff6a6f30165555a6d058e0bee95709bfe03ea94c
3d19ab7b9a5668890271763ebd416ba25030793c
refs/heads/master
2020-03-19T12:10:25.730381
2018-06-24T06:32:04
2018-06-24T06:32:04
136,309,934
0
0
null
null
null
null
UTF-8
Java
false
false
2,502
java
package com.arialyy.frame.view; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ViewFlipper; import com.lyy.frame.R; import java.util.List; /** * 仿淘宝首页的 淘宝头条滚动的自定义View * * Created by mengwei on 2016/7/20. */ public class UPMarqueeView extends ViewFlipper { private Context mContext; private boolean isSetAnimDuration = false; private int interval = 2000; /** * 动画时间 */ private int animDuration = 500; public UPMarqueeView(Context context, AttributeSet attrs) { super(context, attrs); init(context, attrs, 0); } private void init(Context context, AttributeSet attrs, int defStyleAttr) { this.mContext = context; setFlipInterval(interval); Animation animIn = AnimationUtils.loadAnimation(mContext, R.anim.anim_marquee_in); if (isSetAnimDuration) animIn.setDuration(animDuration); setInAnimation(animIn); Animation animOut = AnimationUtils.loadAnimation(mContext, R.anim.anim_marquee_out); if (isSetAnimDuration) animOut.setDuration(animDuration); setOutAnimation(animOut); } /** * 设置循环滚动的View数组 * * @param views */ public void setViews(final List<View> views) { if (views == null || views.size() == 0) return; removeAllViews(); for ( int i = 0; i < views.size(); i++) { final int position=i; //设置监听回调 views.get(i).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (onItemClickListener != null) { onItemClickListener.onItemClick(position, views.get(position)); } } }); addView(views.get(i)); } startFlipping(); } /** * 点击 */ private OnItemClickListener onItemClickListener; /** * 设置监听接口 * @param onItemClickListener */ public void setOnItemClickListener(OnItemClickListener onItemClickListener) { this.onItemClickListener = onItemClickListener; } /** * item_view的接口 */ public interface OnItemClickListener { void onItemClick(int position, View view); } }
[ "1031066280@qq.com" ]
1031066280@qq.com
45e07c28c691391d5ee6ce1a5c03683f4f67a393
12e5ab10db595bf59c13eecbbe36b7c596bc38b3
/GraphVisualisierung2/src/main/java/vistra/framework/util/palette/SigmaPalette.java
4ea574c2653a6799dc6a62517e2548dcc4eedcd5
[]
no_license
brugr9/vistra
2832ec9390d8497be2db0a485eee33078d8e13e1
d4b1c2894ad5a94bb5753ba85ae3eb5949b0861a
refs/heads/master
2022-09-01T16:11:10.734230
2022-08-24T11:08:57
2022-08-24T11:08:57
29,022,703
1
0
null
null
null
null
UTF-8
Java
false
false
1,004
java
package vistra.framework.util.palette; import java.text.DecimalFormatSymbols; /** * A sigma palette. * * * @author Roland Bruggmann (brugr9@bfh.ch) * */ public enum SigmaPalette { /** * Signs from A to Z in upper case. */ ALPHABET(new String[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" }), /** * Sign for infinity. */ INFINITY(new String[] { new DecimalFormatSymbols().getInfinity() }), ; /** * The sigma. */ private String[] s; /** * Main constructor. * * @param s * a sigma */ private SigmaPalette(String[] s) { this.s = s; } /** * Returns the sigma. * * @return the sigma */ public String[] getSigma() { return this.s; } /** * Signs from A to Z in upper case. */ public final static String[] alphabet = ALPHABET.getSigma(); /** * Sign for infinity. */ public final static String infinity = INFINITY.getSigma()[0]; }
[ "brugr9@bfh.ch" ]
brugr9@bfh.ch
bb506a298da59c81d426622d07b7598f231f406d
c35ece4cf94dfbb21b00564109db1360858b6a05
/XTCM/src/main/java/com/lilosoft/xtcm/base/AbsBaseActivityGroup.java
48d7c1dfd62c0056b7c94440b36f9d64b947a0ce
[]
no_license
haikuowuya/MobileSafe
a45fbbf976e0eff96056f9cb332f72d04ca7eb4a
f37d274b78db2d0f2f3a6dbf9688307cbff68b68
refs/heads/master
2021-01-18T12:10:56.928137
2015-05-03T15:26:27
2015-05-03T15:26:27
40,104,214
1
0
null
2015-08-03T03:59:20
2015-08-03T03:59:20
null
UTF-8
Java
false
false
1,094
java
package com.lilosoft.xtcm.base; import android.app.ActivityGroup; import android.content.Context; import android.os.Bundle; import android.view.WindowManager; import com.lilosoft.xtcm.R; /** * * @category 外部框架底层实现方法 * @author William Liu * */ @SuppressWarnings("deprecation") public abstract class AbsBaseActivityGroup extends ActivityGroup { protected static Context mContext; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_frame); initFrameValues(); installViews(); registerEvents(); } /** * @category 初始化框架 */ protected void initFrameValues() { mContext = this; } /** * @category 初始化视图 */ protected abstract void installViews(); /** * @category 事件注册 */ protected abstract void registerEvents(); }
[ "986417576@qq.com" ]
986417576@qq.com
3d5319aabddc5f9890374cfd777aa1f2703c6156
a17faef16ac5334a6b2084b3f35ccabb586bee63
/shihui/src/com/meizhuo/pojo/User.java
3d03c2db8463d83dda08df6dbb0bac6b79548d98
[]
no_license
Believe77/wietao
dee7843cfab478c4ae0ca44a4e0a5a35d4ee034b
faa9596d27d0d2d5145ccb0a62cd3161ff9b7afd
refs/heads/master
2020-04-22T04:47:16.365224
2019-02-25T08:25:02
2019-02-25T08:25:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,428
java
package com.meizhuo.pojo; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name="user") public class User { @Id @Column(name = "user_id") @GeneratedValue(strategy = GenerationType.IDENTITY) private Long user_id; @Column(name = "user_code") private String user_code; @Column(name = "user_name") private String user_name; @Column(name = "user_password") private String user_password; @Column(name = "user_state") private Character user_state; @Column(name = "user_sex") private String user_sex; @Column(name = "user_phone") private String user_phone; @Column(name = "user_address") private String user_address; @Column(name = "user_path") private String user_path; public Long getUser_id() { return user_id; } public void setUser_id(Long user_id) { this.user_id = user_id; } public String getUser_code() { return user_code; } public void setUser_code(String user_code) { this.user_code = user_code; } public String getUser_name() { return user_name; } public void setUser_name(String user_name) { this.user_name = user_name; } public String getUser_password() { return user_password; } public void setUser_password(String user_password) { this.user_password = user_password; } public Character getUser_state() { return user_state; } public void setUser_state(Character user_state) { this.user_state = user_state; } public String getUser_sex() { return user_sex; } public void setUser_sex(String user_sex) { this.user_sex = user_sex; } public String getUser_phone() { return user_phone; } public void setUser_phone(String user_phone) { this.user_phone = user_phone; } public String getUser_address() { return user_address; } public void setUser_address(String user_address) { this.user_address = user_address; } public String getUser_path() { return user_path; } public void setUser_path(String user_path) { this.user_path = user_path; } @Override public String toString() { return "User [user_id=" + user_id + ", user_code=" + user_code + ", user_name=" + user_name + ", user_password=" + user_password + ", user_state=" + user_state + ", user_sex=" + user_sex + ", user_phone=" + user_phone + ", user_address=" + user_address + "]"; } }
[ "2290274526@qq.com" ]
2290274526@qq.com
ae4aeb931fadcfa2c9dfd80d94ceb8f46bbbce23
d405450266905c839ff83288c6d52d611d58fdb4
/JavaFxArchetype/src/main/java/BMSTU/IU7/MainApp.java
d212705635358a93416eb5ce1348a5a353a9e150
[ "MIT" ]
permissive
kombuchamp/JavaFxDemos
5776df7c5f6c926e442ae3f4cb3b8984fb4b6c6e
5e37bde1267ba0547cd2f13bb8567e566d3aaf2d
refs/heads/master
2020-04-08T13:14:14.294326
2018-11-27T18:41:20
2018-11-27T18:41:20
159,381,921
0
0
null
2018-11-27T18:41:22
2018-11-27T18:36:45
Java
UTF-8
Java
false
false
1,197
java
package BMSTU.IU7; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.stage.Stage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MainApp extends Application { private static final Logger log = LoggerFactory.getLogger(MainApp.class); public static void main(String[] args) throws Exception { launch(args); } public void start(Stage stage) throws Exception { log.info("Starting Hello JavaFX and Maven demonstration application"); String fxmlFile = "/fxml/hello.fxml"; log.debug("Loading FXML for main view from: {}", fxmlFile); FXMLLoader loader = new FXMLLoader(); Parent rootNode = (Parent) loader.load(getClass().getResourceAsStream(fxmlFile)); log.debug("Showing JFX scene"); Scene scene = new Scene(rootNode, 400, 200); scene.getStylesheets().add("/styles/styles.css"); stage.setTitle("Hello JavaFX and Maven"); stage.setScene(scene); stage.show(); } }
[ "kombuchamp@gmail.com" ]
kombuchamp@gmail.com
161bf9f481f8c4d53eb4da1772639c9a8871f608
bf50b95b9449f627165b180583ed123ef3c7d0a9
/CleaningApp/app/src/main/java/Logic/InterfaceDialogCallback.java
2480cc6c10c712b73e1a97fec4fe4ced04edc674
[]
no_license
Motoharujap/Freeman
d60fe4b51e7a0b779a9cd939b47f809484776d39
5beb9732aac7236b8624be56b7b5f460c4b66fde
refs/heads/master
2021-01-02T23:13:02.064469
2015-04-06T19:38:16
2015-04-06T19:38:16
32,760,655
0
0
null
null
null
null
UTF-8
Java
false
false
253
java
package Logic; import android.content.DialogInterface; /** * Created by Serge on 2/23/2015. */ public interface InterfaceDialogCallback extends DialogInterface.OnClickListener { @Override void onClick(DialogInterface dialog, int which); }
[ "motoharujap@gmail.com" ]
motoharujap@gmail.com
85d7b0032543169b58170496cfd9f4304c8ea053
ad2563d56f4581bf5ac73890360fafb0fc900d66
/iwsn-portal/src/main/java/de/uniluebeck/itm/tr/iwsn/portal/api/rest/v1/providers/RuntimeExceptionMapper.java
5109766b8052a59f9fb316f014e6f515947f3922
[ "BSD-3-Clause" ]
permissive
newtonmwai/testbed-runtime
b1c73a07c3791ac1593354e48aad728291a0b9c7
0f3fd9ccaa93410bd9ba3b007fd25d801bcdd035
refs/heads/master
2021-05-28T20:56:48.592750
2015-04-21T13:42:24
2015-04-21T13:42:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
529
java
package de.uniluebeck.itm.tr.iwsn.portal.api.rest.v1.providers; import com.google.common.base.Throwables; import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; import javax.ws.rs.ext.Provider; @Provider public class RuntimeExceptionMapper implements ExceptionMapper<RuntimeException> { @Override public Response toResponse(final RuntimeException exception) { return Response .serverError() .entity(exception.getMessage() + "\n" + Throwables.getStackTraceAsString(exception)) .build(); } }
[ "daniel@bimschas.com" ]
daniel@bimschas.com
bb242b85643a776edb6794d1171041aac73d0119
7d1083dcca153ac66ee0bff26bba9462ed82bb7c
/vendas-api/src/main/java/com/conquer/vendasapi/ServletInitializer.java
e2b1303b931481363345f617b60d240bacf4255a
[]
no_license
drramos/vendas-api
ed7aa14f35f3427f6b0b801c3d7903e7def44f4b
aaad3a54cccad4b097241ffa552c806a09d00523
refs/heads/master
2023-03-27T03:34:00.159834
2021-03-25T17:04:29
2021-03-25T17:04:29
350,138,286
0
0
null
null
null
null
UTF-8
Java
false
false
414
java
package com.conquer.vendasapi; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; public class ServletInitializer extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(VendasApiApplication.class); } }
[ "dr-ra@DESKTOP-57765UG" ]
dr-ra@DESKTOP-57765UG
a76e25390e9091d12c673e9ce7491b1089aa6396
e42afd54dcc0add3d2b8823ee98a18c50023a396
/java-securitycenter/samples/snippets/src/main/java/com/google/cloud/examples/securitycenter/snippets/CreateNotificationConfigSnippets.java
b24a10a05485577bfdf88caacba22ce0d878f936
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
degloba/google-cloud-java
eea41ebb64f4128583533bc1547e264e730750e2
b1850f15cd562c659c6e8aaee1d1e65d4cd4147e
refs/heads/master
2022-07-07T17:29:12.510736
2022-07-04T09:19:33
2022-07-04T09:19:33
180,201,746
0
0
Apache-2.0
2022-07-04T09:17:23
2019-04-08T17:42:24
Java
UTF-8
Java
false
false
2,810
java
/* * Copyright 2020 Google LLC * * 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.google.cloud.examples.securitycenter.snippets; // [START securitycenter_create_notification_config] import com.google.cloud.securitycenter.v1.CreateNotificationConfigRequest; import com.google.cloud.securitycenter.v1.NotificationConfig; import com.google.cloud.securitycenter.v1.NotificationConfig.StreamingConfig; import com.google.cloud.securitycenter.v1.SecurityCenterClient; import java.io.IOException; // [END securitycenter_create_notification_config] /** Create NotificationConfig Snippet. */ final class CreateNotificationConfigSnippets { private CreateNotificationConfigSnippets() {} // [START securitycenter_create_notification_config] public static NotificationConfig createNotificationConfig( String organizationId, String notificationConfigId, String projectId, String topicName) throws IOException { // String organizationId = "{your-org-id}"; // String notificationConfigId = {"your-unique-id"}; // String projectId = "{your-project}""; // String topicName = "{your-topic}"; String orgName = String.format("organizations/%s", organizationId); // Ensure this ServiceAccount has the "pubsub.topics.setIamPolicy" permission on the topic. String pubsubTopic = String.format("projects/%s/topics/%s", projectId, topicName); try (SecurityCenterClient client = SecurityCenterClient.create()) { CreateNotificationConfigRequest request = CreateNotificationConfigRequest.newBuilder() .setParent(orgName) .setConfigId(notificationConfigId) .setNotificationConfig( NotificationConfig.newBuilder() .setDescription("Java notification config") .setPubsubTopic(pubsubTopic) .setStreamingConfig( StreamingConfig.newBuilder().setFilter("state = \"ACTIVE\"").build()) .build()) .build(); NotificationConfig response = client.createNotificationConfig(request); System.out.println(String.format("Notification config was created: %s", response)); return response; } } // [END securitycenter_create_notification_config] }
[ "neenushaji@google.com" ]
neenushaji@google.com
8a68f9a3a565d789fa80cccbed39bc5b1f613a36
f2e52d99619497738b53adfbea9eb8d21a2f6184
/touchless-gateway/src/main/java/tn/esprit/touchlessgateway/GatewayRepository.java
e460622aecc5b293bffd534f840eaa1c0dfc9d72
[]
no_license
psnpsn/touchless-backend
223afee85777cc3d0aa1be294b697ab188344740
057a18aea2af632dc3a67af0f6b35c91aaaa23b3
refs/heads/master
2022-12-09T19:48:07.049353
2020-07-01T23:34:29
2020-07-01T23:34:29
254,739,899
0
0
null
null
null
null
UTF-8
Java
false
false
418
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 tn.esprit.touchlessgateway; import org.springframework.data.mongodb.repository.ReactiveMongoRepository; /** * * @author psn */ public interface GatewayRepository extends ReactiveMongoRepository<Gateway, String> { }
[ "mohamed.jridi.1@esprit.tn" ]
mohamed.jridi.1@esprit.tn
24dd7211cd8745925b3fbaa5795a460e601e198e
a29a3deeaea080ee5b45a6c05e84bee509a8c93d
/src/main/java/com/khaled/clientbsitter/view/UpdateSitter.java
371ec5de75797836ddfc1b4973d042692d60526d
[]
no_license
AlibiMourad/bsitter
a019a575a793d861f6718af979f8f3adb99c0c55
4270e8a84dc69ec227e23aa1ebda3b7093f54664
refs/heads/master
2022-12-07T10:11:11.040762
2020-08-29T00:34:23
2020-08-29T00:34:23
260,499,887
3
0
null
null
null
null
UTF-8
Java
false
false
38,938
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.khaled.clientbsitter.view; import com.khaled.clientbsitter.controlle.SitterControlle; import com.khaled.clientbsitter.model.Adress; import com.khaled.clientbsitter.model.Auth; import com.khaled.clientbsitter.model.Sitter; import com.khaled.clientbsitter.model.Users; import com.khaled.clientbsitter.model.enums.Days; import com.khaled.clientbsitter.model.enums.Genre; import com.khaled.clientbsitter.model.enums.Pays; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author xfrag */ public class UpdateSitter extends javax.swing.JFrame { Sitter sitter; /** * Creates new form createSitter */ // public UpdateSitter() { // initComponents(); // } public UpdateSitter(Sitter sitter) { initComponents(); setSitter(sitter); String pattern = "dd/MM/yyyy"; DateFormat df = new SimpleDateFormat(pattern); this.jUserName.setText(sitter.getUsers().getAuth().getUserName()); this.jPasswordField1.setText(sitter.getUsers().getAuth().getPassword()); this.jPasswordField2.setText(sitter.getUsers().getAuth().getPassword()); this.jFirstName.setText(sitter.getUsers().getFirstName()); this.jLastName.setText(sitter.getUsers().getLastName()); this.jDateNaissance.setDate(sitter.getUsers().getDateNaissance()); this.jGenre.setSelectedIndex((sitter.getUsers().getGenre().equals("H")) ? 0 : 1); this.jEmail.setText(sitter.getUsers().getEmail()); this.jPhone1.setText(sitter.getUsers().getTelephones().get(0)); this.jPhone2.setText(sitter.getUsers().getTelephones().get(1)); this.jPhone3.setText(sitter.getUsers().getTelephones().get(2)); this.jVille.setText(sitter.getUsers().getAdress().getVille()); this.jPays.setSelectedIndex(sitter.getUsers().getAdress().getPays().ordinal()); this.jPostal.setText(sitter.getUsers().getAdress().getPostal()); this.jL.setSelected(sitter.getOpenedDay().contains(Days.MONDAY)); this.jMa.setSelected(sitter.getOpenedDay().contains(Days.TUESDAY)); this.jMe.setSelected(sitter.getOpenedDay().contains(Days.WEDNESDAY)); this.jJ.setSelected(sitter.getOpenedDay().contains(Days.THURSDAY)); this.jV.setSelected(sitter.getOpenedDay().contains(Days.FRIDAY)); this.jS.setSelected(sitter.getOpenedDay().contains(Days.SATURDAY)); this.jD.setSelected(sitter.getOpenedDay().contains(Days.SATURDAY)); this.jTarif.setText(""+sitter.getTarifPerDay()); this.jCin.setText(sitter.getNcin()); } public void setSitter(Sitter sitter) { this.sitter = sitter; } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); jLabel17 = new javax.swing.JLabel(); jLabel18 = new javax.swing.JLabel(); jUserName = new javax.swing.JTextField(); jPasswordField1 = new javax.swing.JPasswordField(); jPasswordField2 = new javax.swing.JPasswordField(); jFirstName = new javax.swing.JTextField(); jLastName = new javax.swing.JTextField(); jDateNaissance = new com.toedter.calendar.JDateChooser(); jGenre = new javax.swing.JComboBox<>(); jEmail = new javax.swing.JTextField(); jPhone1 = new javax.swing.JTextField(); jPhone2 = new javax.swing.JTextField(); jPhone3 = new javax.swing.JTextField(); jAddress = new javax.swing.JTextField(); jPays = new javax.swing.JComboBox<>(); jVille = new javax.swing.JTextField(); jPostal = new javax.swing.JTextField(); jL = new javax.swing.JCheckBox(); jMa = new javax.swing.JCheckBox(); jMe = new javax.swing.JCheckBox(); jJ = new javax.swing.JCheckBox(); jV = new javax.swing.JCheckBox(); jS = new javax.swing.JCheckBox(); jD = new javax.swing.JCheckBox(); jTarif = new javax.swing.JTextField(); jCin = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jLabel19 = new javax.swing.JLabel(); jButton2 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setText("User Name:*"); jLabel2.setText("Password:*"); jLabel3.setText("Re-Password:* "); jLabel4.setText("First Name:*"); jLabel5.setText("Last Name:*"); jLabel6.setText("Date Naissance:*"); jLabel7.setText("Genre*"); jLabel8.setText("Email:*"); jLabel9.setText("Phone 1:*"); jLabel10.setText("Phone 2: "); jLabel11.setText("Phone 3: "); jLabel12.setText("Address:*"); jLabel13.setText("Pays:*"); jLabel14.setText("Ville:*"); jLabel15.setText("Code Postal:*"); jLabel16.setText("Open Days:*"); jLabel17.setText("Tarif (TDN):*"); jLabel18.setText("N° CIN:*"); jUserName.setText("XFRAG"); jUserName.setInputVerifier(new EmptyVerifier()); jUserName.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jUserNameActionPerformed(evt); } }); jPasswordField1.setText("A"); jPasswordField1.setInputVerifier(new EmptyVerifier()); jPasswordField2.setText("A"); jPasswordField2.setInputVerifier(new SamePasswdVerifier(this.jPasswordField1)); jPasswordField2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jPasswordField2ActionPerformed(evt); } }); jFirstName.setText("ALIBI"); jFirstName.setInputVerifier(new EmptyVerifier()); jLastName.setText("MOURAD"); jLastName.setInputVerifier(new EmptyVerifier()); jLastName.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jLastNameActionPerformed(evt); } }); jDateNaissance.setToolTipText("05-01-2001"); jDateNaissance.setInputVerifier(new EmptyVerifier()); jGenre.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Homme", "Femme" })); jGenre.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jGenreActionPerformed(evt); } }); jEmail.setText("ADDE@AA.COM"); jEmail.setInputVerifier(new EmailVerifier()); jPhone1.setText("12345678"); jPhone1.setInputVerifier(new DegitVerifier8()); jPhone2.setText("988"); jPhone2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jPhone2ActionPerformed(evt); } }); jPhone3.setText("777"); jAddress.setText("ARIAN"); jAddress.setInputVerifier(new EmptyVerifier()); jAddress.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jAddressActionPerformed(evt); } }); jPays.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua & Deps", "Argentina", "Armenia", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bhutan", "Bolivia", "Bosnia Herzegovina", "Botswana", "Brazil", "Brunei", "Bulgaria", "Burkina", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Central African Rep", "Chad", "Chile", "China", "Colombia", "Comoros", "Congo", "Congo {Democratic Rep}", "Costa Rica", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Fiji", "Finland", "France", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Greece", "Grenada", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Honduras", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland {Republic}", "Israel", "Italy", "Ivory Coast", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea North", "Korea South", "Kosovo", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Montenegro", "Morocco", "Mozambique", "Myanmar, {Burma}", "Namibia", "Nauru", "Nepal", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal", "Qatar", "Romania", "Russian Federation", "Rwanda", "St Kitts & Nevis", "St Lucia", "Saint Vincent & the Grenadines", "Samoa", "San Marino", "Sao Tome & Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Sudan", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Togo", "Tonga", "Trinidad & Tobago", "Tunisia", "Turkey", "Turkmenistan", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "Uruguay", "Uzbekistan", "Vanuatu", "Vatican City", "Venezuela", "Vietnam", "Yemen", "Zambia", "Zimbabwe" })); jPays.setSelectedIndex(178); jVille.setText("VILL ARIANA"); jVille.setInputVerifier(new EmptyVerifier()); jPostal.setText("2080"); jPostal.setInputVerifier(new DegitVerifier()); jPostal.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jPostalActionPerformed(evt); } }); jL.setSelected(true); jL.setText("L"); jMa.setText("M"); jMe.setText("M"); jJ.setText("J"); jV.setSelected(true); jV.setText("V"); jS.setText("S"); jD.setText("D"); jTarif.setText("12.25"); jTarif.setInputVerifier(new DoubleVerifier()); jCin.setText("12345678"); jCin.setInputVerifier(new DegitVerifier8()); jButton1.setText("Save"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jLabel19.setText("Update Sitter"); jButton2.setText("Back"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel7, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jEmail) .addComponent(jGenre, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jDateNaissance, javax.swing.GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE) .addComponent(jFirstName) .addComponent(jLastName) .addComponent(jPhone1) .addComponent(jPhone2) .addComponent(jPhone3) .addComponent(jUserName) .addComponent(jPasswordField1) .addComponent(jPasswordField2)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jLabel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jAddress) .addComponent(jVille) .addComponent(jPostal) .addComponent(jPays, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel18, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTarif) .addComponent(jCin)) .addGap(3, 3, 3)) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jL, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jMa, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jMe) .addGap(1, 1, 1) .addComponent(jJ, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jV, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jS, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jD)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jButton1) .addGap(82, 82, 82) .addComponent(jButton2))) .addGap(0, 0, Short.MAX_VALUE))))) .addContainerGap()) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(141, 141, 141) .addComponent(jLabel19) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel19) .addGap(32, 32, 32) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(jButton2)) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jUserName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(6, 6, 6) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(jPasswordField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(9, 9, 9) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel4) .addComponent(jFirstName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel12) .addComponent(jAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel13) .addComponent(jPays, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(9, 9, 9) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel14) .addComponent(jVille, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel15) .addComponent(jPostal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel5) .addComponent(jLastName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6) .addComponent(jDateNaissance, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jGenre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel8) .addComponent(jEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel16) .addComponent(jL) .addComponent(jMa) .addComponent(jMe) .addComponent(jJ) .addComponent(jV) .addComponent(jS) .addComponent(jD)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel17) .addComponent(jTarif, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel18) .addComponent(jCin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel9) .addComponent(jPhone1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel10) .addComponent(jPhone2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel11) .addComponent(jPhone3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(18, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jLastNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jLastNameActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jLastNameActionPerformed private void jGenreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jGenreActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jGenreActionPerformed private void jPhone2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPhone2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jPhone2ActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed Auth auth = new Auth(); auth.setUserName(jUserName.getText()); auth.setPassword(jPasswordField1.getText()); auth.setDateCreation(new Date()); auth.setActive(0); Users users = new Users(); users.setAuth(auth); users.setFirstName(jFirstName.getText()); users.setLastName(jLastName.getText()); users.setDateNaissance(jDateNaissance.getDate()); users.setGenre("" + jGenre.getSelectedItem().toString().charAt(0)); users.setEmail(jEmail.getText()); List<String> telephones = new ArrayList<>(); telephones.add(jPhone1.getText()); telephones.add(jPhone2.getText()); telephones.add(jPhone3.getText()); users.setTelephones(telephones); Adress adress = new Adress(); adress.setPays(Pays.valueOf(jPays.getSelectedItem().toString())); adress.setPostal(jPostal.getText()); adress.setVille(jVille.getText()); users.setAdress(adress); Sitter sitter = new Sitter(); sitter.setUsers(users); List<Days> openedDay = new ArrayList<>(); if (jL.isSelected()) { openedDay.add(Days.MONDAY); } if (jMa.isSelected()) { openedDay.add(Days.TUESDAY); } if (jMe.isSelected()) { openedDay.add(Days.WEDNESDAY); } if (jJ.isSelected()) { openedDay.add(Days.THURSDAY); } if (jV.isSelected()) { openedDay.add(Days.FRIDAY); } if (jS.isSelected()) { openedDay.add(Days.SATURDAY); } if (jD.isSelected()) { openedDay.add(Days.SUNDAY); } sitter.setOpenedDay(openedDay); sitter.setTarifPerDay(Double.parseDouble(jTarif.getText())); sitter.setNcin(jCin.getText()); SitterControlle s = new SitterControlle(); try { sitter.setId(this.sitter.getId()); s.updateSitter(sitter); BabySitterList babySitterList = new BabySitterList(); babySitterList.setVisible(true); this.dispose(); } catch (Exception ex) { Logger.getLogger(UpdateSitter.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_jButton1ActionPerformed private void jUserNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jUserNameActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jUserNameActionPerformed private void jPasswordField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPasswordField2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jPasswordField2ActionPerformed private void jAddressActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jAddressActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jAddressActionPerformed private void jPostalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPostalActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jPostalActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed BabySitterList babySitterList = new BabySitterList(); babySitterList.setVisible(true); this.dispose(); }//GEN-LAST:event_jButton2ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(UpdateSitter.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(UpdateSitter.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(UpdateSitter.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(UpdateSitter.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { // new UpdateSitter().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField jAddress; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JTextField jCin; private javax.swing.JCheckBox jD; private com.toedter.calendar.JDateChooser jDateNaissance; private javax.swing.JTextField jEmail; private javax.swing.JTextField jFirstName; private javax.swing.JComboBox<String> jGenre; private javax.swing.JCheckBox jJ; private javax.swing.JCheckBox jL; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel18; private javax.swing.JLabel jLabel19; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JTextField jLastName; private javax.swing.JCheckBox jMa; private javax.swing.JCheckBox jMe; private javax.swing.JPanel jPanel1; private javax.swing.JPasswordField jPasswordField1; private javax.swing.JPasswordField jPasswordField2; private javax.swing.JComboBox<String> jPays; private javax.swing.JTextField jPhone1; private javax.swing.JTextField jPhone2; private javax.swing.JTextField jPhone3; private javax.swing.JTextField jPostal; private javax.swing.JCheckBox jS; private javax.swing.JTextField jTarif; private javax.swing.JTextField jUserName; private javax.swing.JCheckBox jV; private javax.swing.JTextField jVille; // End of variables declaration//GEN-END:variables }
[ "mourad.alibi@enis.tn" ]
mourad.alibi@enis.tn
862890f8d996d698c9c407c662b8b56416850941
40d844c1c780cf3618979626282cf59be833907f
/src/testcases/CWE197_Numeric_Truncation_Error/s02/CWE197_Numeric_Truncation_Error__short_console_readLine_66b.java
854722cfb6b6fdc04029976f4253a380475ebdfe
[]
no_license
rubengomez97/juliet
f9566de7be198921113658f904b521b6bca4d262
13debb7a1cc801977b9371b8cc1a313cd1de3a0e
refs/heads/master
2023-06-02T00:37:24.532638
2021-06-23T17:22:22
2021-06-23T17:22:22
379,676,259
1
0
null
null
null
null
UTF-8
Java
false
false
1,356
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE197_Numeric_Truncation_Error__short_console_readLine_66b.java Label Definition File: CWE197_Numeric_Truncation_Error__short.label.xml Template File: sources-sink-66b.tmpl.java */ /* * @description * CWE: 197 Numeric Truncation Error * BadSource: console_readLine Read data from the console using readLine * GoodSource: A hardcoded non-zero, non-min, non-max, even number * Sinks: to_byte * BadSink : Convert data to a byte * Flow Variant: 66 Data flow: data passed in an array from one method to another in different source files in the same package * * */ package testcases.CWE197_Numeric_Truncation_Error.s02; import testcasesupport.*; public class CWE197_Numeric_Truncation_Error__short_console_readLine_66b { public void badSink(short dataArray[] ) throws Throwable { short data = dataArray[2]; { /* POTENTIAL FLAW: Convert data to a byte, possibly causing a truncation error */ IO.writeLine((byte)data); } } /* goodG2B() - use goodsource and badsink */ public void goodG2BSink(short dataArray[] ) throws Throwable { short data = dataArray[2]; { /* POTENTIAL FLAW: Convert data to a byte, possibly causing a truncation error */ IO.writeLine((byte)data); } } }
[ "you@example.com" ]
you@example.com
e56c5b3e20702f2a2012cd6961f9000cc008a9b5
4eef8b2a858ea69fbba2b2807a18b442e701aabc
/src/ArrayBagDemo2.java
8d5a4e795529ecb272fc8006fab92e570b86e57d
[]
no_license
midtownkc/C189
b481dbb8fa62486cd89012b0394b0df36ace3d86
62e0de3aabc133fe56094d20f59d0939bf72c512
refs/heads/master
2021-01-19T18:03:48.948552
2017-10-24T18:38:13
2017-10-24T18:38:13
99,431,731
0
0
null
null
null
null
UTF-8
Java
false
false
5,578
java
/** A test of the methods isEmpty, getCurrentSize, getFrequencyOf, and contains for the class ArrayBag2. Assumes the methods add and toArray are correct. @author Frank M. Carrano @version 4.0 */ public class ArrayBagDemo2 { public static void main(String[] args) { // A bag that is not full BagInterface<String> aBag = new ArrayBag<>(); // Tests on an empty bag testIsEmpty(aBag, true); String[] testStrings1 = {"A"}; testFrequency(aBag, testStrings1); testContains(aBag, testStrings1); // Adding strings String[] contentsOfBag1 = {"A", "A", "B", "A", "C", "A"}; testAdd(aBag, contentsOfBag1); // Tests on a bag that is not empty testIsEmpty(aBag, false); String[] testStrings2 = {"A", "B", "C", "D", "Z"}; testFrequency(aBag, testStrings2); testContains(aBag, testStrings2); //---------------------------------------------------------------------- // A bag that will be full aBag = new ArrayBag<String>(7); System.out.println("\nA new empty bag:"); // Tests on an empty bag testIsEmpty(aBag, true); testFrequency(aBag, testStrings1); testContains(aBag, testStrings1); // Adding strings String[] contentsOfBag2 = {"A", "B", "A", "C", "B", "C", "D"}; testAdd(aBag, contentsOfBag2); // Tests on a bag that is full testIsEmpty(aBag, false); testFrequency(aBag, testStrings2); testContains(aBag, testStrings2); } // end main // Tests the method add. private static void testAdd(BagInterface<String> aBag, String[] content) { System.out.print("Adding to the bag: "); for (int index = 0; index < content.length; index++) { aBag.add(content[index]); System.out.print(content[index] + " "); } // end for System.out.println(); displayBag(aBag); } // end testAdd // Tests the method isEmpty. // correctResult indicates what isEmpty should return. private static void testIsEmpty(BagInterface<String> aBag, boolean correctResult) { System.out.print("\nTesting the method isEmpty with "); if (correctResult) System.out.println("an empty bag:"); else System.out.println("a bag that is not empty:"); System.out.print("isEmpty finds the bag "); if (correctResult && aBag.isEmpty()) System.out.println("empty: OK."); else if (correctResult) System.out.println("not empty, but it is empty: ERROR."); else if (!correctResult && aBag.isEmpty()) System.out.println("empty, but it is not empty: ERROR."); else System.out.println("not empty: OK."); } // end testIsEmpty // Tests the method getFrequencyOf. private static void testFrequency(BagInterface<String> aBag, String[] tests) { System.out.println("\nTesting the method getFrequencyOf:"); for (int index = 0; index < tests.length; index++) System.out.println("In this bag, the count of " + tests[index] + " is " + aBag.getFrequencyOf(tests[index])); } // end testFrequency // Tests the method contains. private static void testContains(BagInterface<String> aBag, String[] tests) { System.out.println("\nTesting the method contains:"); for (int index = 0; index < tests.length; index++) System.out.println("Does this bag contain " + tests[index] + "? " + aBag.contains(tests[index])); } // end testContains // Tests the method toArray while displaying the bag. private static void displayBag(BagInterface<String> aBag) { System.out.println("The bag contains " + aBag.getCurrentSize() + " string(s), as follows:"); Object[] bagArray = aBag.toArray(); for (int index = 0; index < bagArray.length; index++) { System.out.print(bagArray[index] + " "); } // end for System.out.println(); } // end displayBag } // end ArrayBagDemo2 /* Testing the method isEmpty with an empty bag: isEmpty finds the bag empty: OK. Testing the method getFrequencyOf: In this bag, the count of A is 0 Testing the method contains: Does this bag contain A? false Adding to the bag: A A B A C A The bag contains 6 string(s), as follows: A A B A C A Testing the method isEmpty with a bag that is not empty: isEmpty finds the bag not empty: OK. Testing the method getFrequencyOf: In this bag, the count of A is 4 In this bag, the count of B is 1 In this bag, the count of C is 1 In this bag, the count of D is 0 In this bag, the count of Z is 0 Testing the method contains: Does this bag contain A? true Does this bag contain B? true Does this bag contain C? true Does this bag contain D? false Does this bag contain Z? false A new empty bag: Testing the method isEmpty with an empty bag: isEmpty finds the bag empty: OK. Testing the method getFrequencyOf: In this bag, the count of A is 0 Testing the method contains: Does this bag contain A? false Adding to the bag: A B A C B C D The bag contains 7 string(s), as follows: A B A C B C D Testing the method isEmpty with a bag that is not empty: isEmpty finds the bag not empty: OK. Testing the method getFrequencyOf: In this bag, the count of A is 2 In this bag, the count of B is 2 In this bag, the count of C is 2 In this bag, the count of D is 1 In this bag, the count of Z is 0 Testing the method contains: Does this bag contain A? true Does this bag contain B? true Does this bag contain C? true Does this bag contain D? true Does this bag contain Z? false */
[ "maxwellfrederickson@gmail.com" ]
maxwellfrederickson@gmail.com
b4f5bd114224f9358ce7099695cceedea51014d1
8dec3c56eb4f821b4da451e9f6b7c69e4857ade6
/cultureapp/app/src/main/java/com/cardinalskerrt/cultureapp/NewsFeedFragment.java
fe669adb329d3ce750b6820acc263f99be6474b6
[]
no_license
roro-20/main-app
5b9d94c6fd8b92086e57059b7cc220e34dac09ee
922f03da148dad6e168d8b39ff067c7463d5b035
refs/heads/master
2021-01-09T11:59:57.180904
2020-02-22T09:40:04
2020-02-22T09:40:04
242,292,891
0
0
null
2020-02-22T06:37:18
2020-02-22T06:37:18
null
UTF-8
Java
false
false
3,661
java
package com.cardinalskerrt.cultureapp; import android.content.Context; import android.net.Uri; import android.os.Bundle; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; /** * A simple {@link Fragment} subclass. * Activities that contain this fragment must implement the * {@link NewsFeedFragment.OnFragmentInteractionListener} interface * to handle interaction events. * Use the {@link NewsFeedFragment#newInstance} factory method to * create an instance of this fragment. */ public class NewsFeedFragment extends Fragment { // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; private OnFragmentInteractionListener mListener; public NewsFeedFragment() { // Required empty public constructor } /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param param1 Parameter 1. * @param param2 Parameter 2. * @return A new instance of fragment NewsFeedFragment. // */ // TODO: Rename and change types and number of parameters public static NewsFeedFragment newInstance(String param1, String param2) { NewsFeedFragment fragment = new NewsFeedFragment(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_news_feed, container, false); } // TODO: Rename method, update argument and hook method into UI event public void onButtonPressed(Uri uri) { if (mListener != null) { mListener.onFragmentInteraction(uri); } } @Override public void onAttach(Context context) { super.onAttach(context); if (context instanceof OnFragmentInteractionListener) { mListener = (OnFragmentInteractionListener) context; } else { throw new RuntimeException(context.toString() + " must implement OnFragmentInteractionListener"); } } @Override public void onDetach() { super.onDetach(); mListener = null; } /** * This interface must be implemented by activities that contain this * fragment to allow an interaction in this fragment to be communicated * to the activity and potentially other fragments contained in that * activity. * <p> * See the Android Training lesson <a href= * "http://developer.android.com/training/basics/fragments/communicating.html" * >Communicating with Other Fragments</a> for more information. */ public interface OnFragmentInteractionListener { // TODO: Update argument type and name void onFragmentInteraction(Uri uri); } }
[ "rjmatoza@gmail.com" ]
rjmatoza@gmail.com
451347ba781dcd158e0d9a6fa150833d7bae9bca
ba4911a9cdca61ab0c0b71524c0588cb92bc1552
/ch17/SimpleSorting.java
e26fbfc317ea41f4ed81ed0e1e9ea781c435e2a5
[]
no_license
ivanporty/java-swing-book
9ae5987c32b63fa857a60ee734d6f0956576aabe
c298ef9e8748f592d7ab5d7a917502587156dcba
refs/heads/master
2021-09-07T17:08:00.464517
2018-02-26T16:02:19
2018-02-26T16:02:19
114,157,727
14
7
null
2018-02-26T16:02:20
2017-12-13T18:57:22
Java
UTF-8
Java
false
false
1,667
java
// SimpleSorting.java // Сортировка таблицы по умолчанию import javax.swing.*; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableRowSorter; import java.awt.*; public class SimpleSorting extends JFrame { public SimpleSorting() { super("SimpleSorting"); setDefaultCloseOperation(EXIT_ON_CLOSE); // создаем таблицу на основе модели по умолчанию SortModel sm = new SortModel(); sm.setColumnCount(4); // добавляем сто строк случайных чисел for ( int i = 0; i < 100; i++ ) { sm.addRow(new Integer[] { i, (int)(5*Math.random()), (int)(5*Math.random()), (int)(5*Math.random())} ); } JTable table = new JTable(); // автоматическое включение сортировки table.setAutoCreateRowSorter(true); // ограничение по количеству столбцов ((TableRowSorter)table.getRowSorter()).setMaxSortKeys(2); table.setModel(sm); add(new JScrollPane(table)); // выводим окно на экран setSize(400, 300); setVisible(true); } // модель для демонстрации сортировки и фильтрации static class SortModel extends DefaultTableModel { // тип данных, хранимых в столбце public Class getColumnClass(int column) { return Integer.class; } } public static void main(String[] args) { SwingUtilities.invokeLater( new Runnable() { public void run() { new FilterAndSelection(); } }); } }
[ "ivan.portyankin@gmail.com" ]
ivan.portyankin@gmail.com
34a2e413636b7259627673028c4eea7939c3b956
5e428c9442c5897fe1ad7799beca159ab275a855
/business/src/main/java/com/gd/business/service/IInfoService.java
fb492c31119343ce2d611c437489b4e50086bb32
[]
no_license
HighFrequency0708/backendinspirng
e90bc36de08004d8360c944dc9303755c6bf55b0
0c28b8b39ee97f080cf9e6167e090a0ea26ff93f
refs/heads/master
2022-04-21T14:38:55.415904
2020-04-20T10:10:24
2020-04-20T10:10:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
197
java
package com.gd.business.service; import com.gd.business.pojo.Info; /** * @Author:CodeGenerator * @Date:2020/04/07. */ public interface IInfoService { public String getInfo(Integer id); }
[ "alffei@163.com" ]
alffei@163.com
7dd3bb2e6f4c836b8b27eb7224b0af0d9b185cb6
acc114985ececc8b7b9d6f4eb389b13e4ffc03ee
/src/main/java/gigaherz/enderthing/blocks/EnderKeyChestRenderer.java
20ad79dfeb27e2f3fabb50a1d7fe184be6c41947
[ "BSD-3-Clause" ]
permissive
enimaloc/Enderthing
936e1b6203104318921c0dcdb4cf941712a0a011
d7956171e36a52c0a0131d1219e44c31d03fbbbb
refs/heads/master
2022-11-11T00:44:52.888633
2020-06-26T04:14:25
2020-06-26T04:14:25
275,058,571
0
0
null
2020-06-26T02:37:04
2020-06-26T02:37:03
null
UTF-8
Java
false
false
3,598
java
package gigaherz.enderthing.blocks; import com.mojang.blaze3d.matrix.MatrixStack; import gigaherz.enderthing.KeyUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.model.ItemCameraTransforms; import net.minecraft.client.renderer.model.Material; import net.minecraft.client.renderer.tileentity.ChestTileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.item.ItemStack; import net.minecraft.state.properties.ChestType; import static net.minecraft.client.renderer.Atlases.ENDER_CHEST_MATERIAL; public class EnderKeyChestRenderer extends ChestTileEntityRenderer<EnderKeyChestTileEntity> { public static EnderKeyChestRenderer INSTANCE = null; public EnderKeyChestRenderer(TileEntityRendererDispatcher dispatcher) { super(dispatcher); INSTANCE = this; } public void renderFromItem(ItemStack stack, EnderKeyChestTileEntity te, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { ItemStack lock = KeyUtils.getLock(KeyUtils.getKey(stack), KeyUtils.isPrivate(stack), KeyUtils.getBound(stack)); renderInternal(te, 0, matrixStackIn, bufferIn, combinedLightIn, combinedOverlayIn, 0, lock); } @Override public void render(EnderKeyChestTileEntity te, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { int rotation = 0; if (te.hasWorld()) { switch (te.getBlockState().get(EnderKeyChestBlock.FACING)) { case NORTH: rotation = 180; break; case SOUTH: rotation = 0; break; case WEST: rotation = 90; break; case EAST: rotation = -90; break; } } ItemStack lock = KeyUtils.getLock(te.getKey(), te.isPrivate(), te.getPlayerBound()); renderInternal(te, partialTicks, matrixStackIn, bufferIn, combinedLightIn, combinedOverlayIn, rotation, lock); } public void renderInternal(EnderKeyChestTileEntity te, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn, int rotation, ItemStack lock) { matrixStackIn.push(); super.render(te, partialTicks, matrixStackIn, bufferIn, combinedLightIn, combinedOverlayIn); matrixStackIn.pop(); matrixStackIn.push(); { matrixStackIn.translate(0.5, 0.5, 0.5); matrixStackIn.rotate(Vector3f.YP.rotationDegrees(180-rotation)); matrixStackIn.translate(-0.5, -0.5, -0.5); matrixStackIn.translate(0.5, 0.35, 0.6/16.0); float scale = 6/8.0f; matrixStackIn.scale(scale, scale, scale); Minecraft.getInstance().getItemRenderer().renderItem(lock, ItemCameraTransforms.TransformType.FIXED, combinedLightIn, combinedOverlayIn, matrixStackIn, bufferIn); } matrixStackIn.pop(); } @Override protected Material getMaterial(EnderKeyChestTileEntity tileEntity, ChestType chestType) { return ENDER_CHEST_MATERIAL; } }
[ "gigaherz@gmail.com" ]
gigaherz@gmail.com
404503d427bafa8e1a74852a5e2409951bb33e89
b3f85ae38eac986159830be54f8711abf92aea4f
/android/app/src/main/java/com/rnbridgeexample/ToastModule.java
23d7840b6964834037d18ccdaded04da35776c0a
[]
no_license
herdiiyan/RNBridgeExample
3018c81e18ab8cc95e15b2821922bd01a68394f4
90c79edc29b50bd08f238749b5b01e5c7c5ff83c
refs/heads/main
2023-02-17T02:35:42.469919
2021-01-21T05:08:39
2021-01-21T05:08:39
331,520,729
0
0
null
null
null
null
UTF-8
Java
false
false
747
java
package com.rnbridgeexample; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; public class ToastModule extends ReactContextBaseJavaModule { public ToastModule(@Nullable ReactApplicationContext reactContext) { super(reactContext); } @NonNull @Override public String getName() { return "ToastModule"; } //Custom function @ReactMethod public void showToast(String message){ Toast.makeText(getReactApplicationContext(), message, Toast.LENGTH_SHORT).show(); } }
[ "herdiiyan8@gmail.com" ]
herdiiyan8@gmail.com
7e82c8b55527f4c964861bf2721f620b1a95456e
427c530d9b961348cfeaff653feea41d29ea99f6
/Calculadora/app/src/androidTest/java/com/example/aleix/calculadora/ExampleInstrumentedTest.java
637e191a887e37f2f63e3077118c7ffc8d9d9dd8
[]
no_license
AleixCas95/dispositiusmobils
ae463b9018705cae64cb4862d9da641d183efc25
363468ad4e94f6991ef81236a78427ac4d51f3ee
refs/heads/master
2020-04-01T20:13:04.574723
2018-11-05T16:20:57
2018-11-05T16:20:57
153,593,857
0
0
null
null
null
null
UTF-8
Java
false
false
742
java
package com.example.aleix.calculadora; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.aleix.calculadora", appContext.getPackageName()); } }
[ "leix_05@hotmail.com" ]
leix_05@hotmail.com
33fab4deb92ccb7998eaa450c2e51a1c605a4802
94582d29153101a3c7a5a23e55202ce043a81d93
/src/main/java/com/webapp/eventportal/EventportalApplication.java
a68eff6072d00f5f8eef1831f804bfeb67738355
[]
no_license
uzair119/EventPortal
ae2dad64b07a490576956157d2c3e6bce2fb6590
384a6179cc93d32acd7f958d2bcba55da1d7192f
refs/heads/master
2020-09-16T20:56:13.221343
2019-12-21T13:02:33
2019-12-21T13:02:33
223,885,995
0
0
null
null
null
null
UTF-8
Java
false
false
326
java
package com.webapp.eventportal; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class EventportalApplication { public static void main(String[] args) { SpringApplication.run(EventportalApplication.class, args); } }
[ "uzairahmed11d@gmail.com" ]
uzairahmed11d@gmail.com
3315982b5c4a5daaa76d791b433960ac449e104b
f4f3e30522cd2a50c9b5853a29799f0143589a8a
/app/src/main/java/com/example/fyp_1/MyKitchenIngredients2.java
8512e7c4b814f0c826cd42a87074737c73b81991
[]
no_license
ellaburke/FYP
b95b03b1a5da67b644ffb7e9a7bf6fb7f8b14ccd
25327bb2852051c07b873aeb1eb94bb0d22db9f2
refs/heads/master
2023-04-14T02:32:34.038609
2021-04-30T10:29:14
2021-04-30T10:29:14
331,424,061
0
0
null
null
null
null
UTF-8
Java
false
false
26,458
java
package com.example.fyp_1; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.RecyclerView; import android.app.Dialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import com.example.fyp_1.AllListingsTab.viewListingActivity; import com.example.fyp_1.BarcodeScan.BarcodeActivity; import com.example.fyp_1.BarcodeScan.CaptureAct; import com.example.fyp_1.Notifications.NotificationActivity; import com.example.fyp_1.Notifications.RequestNotificationActivity; import com.example.fyp_1.Recipe.RecipeActivity; import com.example.fyp_1.ShoppingListTab.MyShoppingListActivity; import com.example.fyp_1.UserProfileAndListings.MyListingsProfileActivity; import com.example.fyp_1.model.FoodCategorySection; import com.google.android.material.bottomnavigation.BottomNavigationView; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.google.zxing.integration.android.IntentIntegrator; import com.google.zxing.integration.android.IntentResult; import java.util.ArrayList; public class MyKitchenIngredients2 extends AppCompatActivity { private static final String TAG = "MyKitchenIngredients"; RecyclerView mainRecyclerView; private FirebaseUser user; DatabaseReference mDatabaseRef; MyKitchenItem myKitchenItem; private String userId; String itemId; String ingredientId; Dialog popupTipDialog; Button closePopupTipDialog; //Firebase Delete DatabaseReference rootRef; DatabaseReference deleteRef; DatabaseReference mDeleteDatabaseRef; MyKitchenItem currentItem; // Barcode String barcode; //FAB Animations Animation animatorRotateOpen; Animation animatorRotateClose; Animation animatorFromBottom; Animation animatorToBottom; Boolean clicked = false; String myItemInput, myItemAmountInput, myItemCategory, myItemMeasurement, itemAmountAndMeasurement; FloatingActionButton addToKitchenBtn, addToKitchenByScanBtn, addToKitchenByTextBtn, checkedItemsBtn, deleteItemsBtn; ArrayList<FoodCategorySection> foodCategorySectionList = new ArrayList<>(); String dairySection = "Dairy"; ArrayList<MyKitchenItem> dairySectionItems = new ArrayList<>(); String vegSection = "Vegtables"; ArrayList<MyKitchenItem> vegSectionItems = new ArrayList<>(); String fruitSection = "Fruit"; ArrayList<MyKitchenItem> fruitSectionItems = new ArrayList<>(); String meatOrPoultrySection = "Meat or Poultry"; ArrayList<MyKitchenItem> meatOrPoultrySectionItems = new ArrayList<>(); String fishSection = "Fish"; ArrayList<MyKitchenItem> fishSectionItems = new ArrayList<>(); String frozenSection = "Frozen"; ArrayList<MyKitchenItem> frozenSectionItems = new ArrayList<>(); String cupboardSection = "Cupboard"; ArrayList<MyKitchenItem> cupboardSectionItems = new ArrayList<>(); String breadOrCerealSection = "Bread or Cereal"; ArrayList<MyKitchenItem> breadOrCerealSectionItems = new ArrayList<>(); @RequiresApi(api = Build.VERSION_CODES.O) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_kitchen_ingredients2); user = FirebaseAuth.getInstance().getCurrentUser(); userId = user.getUid(); mDatabaseRef = FirebaseDatabase.getInstance().getReference("myKitchenItems"); //Init Firebase delete rootRef = FirebaseDatabase.getInstance().getReference(); deleteRef = rootRef.child("myKitchenItems"); mDeleteDatabaseRef = FirebaseDatabase.getInstance().getReference("myKitchenItems"); //Init btm nav BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation); //Set Home Selected bottomNavigationView.setSelectedItemId(R.id.MyKitchenNav); //Perform ItemSelectedListener bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { switch (item.getItemId()) { case R.id.MyKitchenNav: return true; case R.id.SearchListingNav: Intent emptyIntent = new Intent(MyKitchenIngredients2.this, viewListingActivity.class); emptyIntent.putExtra("ingredient_clicked", " "); startActivity(emptyIntent); overridePendingTransition(0, 0); return true; case R.id.MyShoppingListNav: startActivity(new Intent(getApplicationContext(), MyShoppingListActivity.class)); overridePendingTransition(0, 0); return true; } return false; } }); //initialise animations animatorRotateOpen = AnimationUtils.loadAnimation(MyKitchenIngredients2.this, R.anim.rotate_open_anim); animatorRotateClose = AnimationUtils.loadAnimation(MyKitchenIngredients2.this, R.anim.rotate_close_anim); animatorFromBottom = AnimationUtils.loadAnimation(MyKitchenIngredients2.this, R.anim.from_bottom_anim); animatorToBottom = AnimationUtils.loadAnimation(MyKitchenIngredients2.this, R.anim.to_bottom_anim); //init FAB addToKitchenBtn = (FloatingActionButton) findViewById(R.id.fab_add_ingredient); addToKitchenByScanBtn = (FloatingActionButton) findViewById(R.id.fab_add_ingredient_by_scan); addToKitchenByScanBtn.setTooltipText("Scan to Add"); addToKitchenByTextBtn = (FloatingActionButton) findViewById(R.id.fab_add_ingredient_by_text); addToKitchenByTextBtn.setTooltipText("Add By Text"); checkedItemsBtn = (FloatingActionButton) findViewById(R.id.fab_add_ingredient_selected); checkedItemsBtn.setTooltipText("Check Items You Wish To Use"); deleteItemsBtn = (FloatingActionButton) findViewById(R.id.fab_delete_ingredients); deleteItemsBtn.setTooltipText("Check Items You Wish To Delete"); //RCV mainRecyclerView = findViewById(R.id.mainRecyclerView); MyKitchenItemsAdapter2 myKitchenItemsAdapter2 = new MyKitchenItemsAdapter2(foodCategorySectionList); mainRecyclerView.setAdapter(myKitchenItemsAdapter2); mainRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL)); mDatabaseRef.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot snapshot) { //foodCategorySectionList.clear(); dairySectionItems.clear(); vegSectionItems.clear(); fruitSectionItems.clear(); frozenSectionItems.clear(); cupboardSectionItems.clear(); breadOrCerealSectionItems.clear(); fishSectionItems.clear(); meatOrPoultrySectionItems.clear(); foodCategorySectionList.clear(); for (DataSnapshot postSnapshot : snapshot.getChildren()) { MyKitchenItem mKI = postSnapshot.getValue(MyKitchenItem.class); if (mKI.getUserId().equals(userId) && mKI.itemCategory.equals("Dairy")) { if(dairySectionItems.isEmpty()) { dairySectionItems.add(mKI); foodCategorySectionList.add(new FoodCategorySection(dairySection, dairySectionItems)); }else{ dairySectionItems.add(mKI); } Log.d("hello", String.valueOf(dairySectionItems)); Log.d(TAG, "initData: " + foodCategorySectionList); System.out.println(foodCategorySectionList); } else if (mKI.getUserId().equals(userId) && mKI.itemCategory.equals("Veg")) { if(vegSectionItems.isEmpty()) { vegSectionItems.add(mKI); foodCategorySectionList.add(new FoodCategorySection(vegSection, vegSectionItems)); }else{ vegSectionItems.add(mKI); } Log.d(TAG, "initData: " + foodCategorySectionList); System.out.println(foodCategorySectionList); } else if (mKI.getUserId().equals(userId) && mKI.itemCategory.equals("Fruit")) { if(fruitSectionItems.isEmpty()) { fruitSectionItems.add(mKI); foodCategorySectionList.add(new FoodCategorySection(fruitSection, fruitSectionItems)); }else{ fruitSectionItems.add(mKI); } Log.d(TAG, "initData: " + foodCategorySectionList); System.out.println(foodCategorySectionList); } else if (mKI.getUserId().equals(userId) && mKI.itemCategory.equals("Meat/Poultry")) { if(meatOrPoultrySectionItems.isEmpty()) { meatOrPoultrySectionItems.add(mKI); foodCategorySectionList.add(new FoodCategorySection(meatOrPoultrySection, meatOrPoultrySectionItems)); }else{ meatOrPoultrySectionItems.add(mKI); } Log.d(TAG, "initData: " + foodCategorySectionList); System.out.println(foodCategorySectionList); } else if (mKI.getUserId().equals(userId) && mKI.itemCategory.equals("Fish")) { if(fishSectionItems.isEmpty()) { fishSectionItems.add(mKI); foodCategorySectionList.add(new FoodCategorySection(fishSection, fishSectionItems)); }else{ fishSectionItems.add(mKI); } Log.d(TAG, "initData: " + foodCategorySectionList); System.out.println(foodCategorySectionList); } else if (mKI.getUserId().equals(userId) && mKI.itemCategory.equals("Cupboard")) { if(cupboardSectionItems.isEmpty()) { cupboardSectionItems.add(mKI); foodCategorySectionList.add(new FoodCategorySection(cupboardSection, cupboardSectionItems)); }else{ cupboardSectionItems.add(mKI); } Log.d(TAG, "initData: " + foodCategorySectionList); System.out.println(foodCategorySectionList); } else if (mKI.getUserId().equals(userId) && mKI.itemCategory.equals("Bread/Cereal")) { if(breadOrCerealSectionItems.isEmpty()) { breadOrCerealSectionItems.add(mKI); foodCategorySectionList.add(new FoodCategorySection(breadOrCerealSection, breadOrCerealSectionItems)); }else{ breadOrCerealSectionItems.add(mKI); } Log.d(TAG, "initData: " + foodCategorySectionList); System.out.println(foodCategorySectionList); } else if (mKI.getUserId().equals(userId) && mKI.itemCategory.equals("Freezer")) { if(frozenSectionItems.isEmpty()) { frozenSectionItems.add(mKI); foodCategorySectionList.add(new FoodCategorySection(frozenSection, frozenSectionItems)); }else{ frozenSectionItems.add(mKI); } Log.d(TAG, "initData: " + foodCategorySectionList); System.out.println(foodCategorySectionList); } } myKitchenItemsAdapter2.notifyDataSetChanged(); } @Override public void onCancelled(@NonNull DatabaseError error) { Toast.makeText(MyKitchenIngredients2.this, error.getMessage(), Toast.LENGTH_SHORT).show(); } }); addToKitchenBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onAddToKitchenBtnClicked(); } }); addToKitchenByScanBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onScanBtnClicked(); } }); addToKitchenByTextBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AlertDialog.Builder mBuilder = new AlertDialog.Builder(MyKitchenIngredients2.this); View mView = getLayoutInflater().inflate(R.layout.add_to_my_kitchen_dialog, null); EditText itemInput = (EditText) mView.findViewById(R.id.item_name_et); EditText itemAmountInput = (EditText) mView.findViewById(R.id.item_amount_et); TextView cancelTV = (TextView) mView.findViewById(R.id.cancel_dialog_option); TextView addTV = (TextView) mView.findViewById(R.id.add_dialog_option); //init variables for dialog Spinner itemAmountSpinner = (Spinner) mView.findViewById(R.id.item_amount_spinner); Spinner categorySpinner = (Spinner) mView.findViewById(R.id.food_category_spinner2); // Create an ArrayAdapter using the string array and a default spinner ArrayAdapter<CharSequence> staticAdapter = ArrayAdapter.createFromResource(MyKitchenIngredients2.this, R.array.item_amount_array, android.R.layout.simple_spinner_item); ArrayAdapter<CharSequence> staticAdapter2 = ArrayAdapter.createFromResource(MyKitchenIngredients2.this, R.array.food_category_array, android.R.layout.simple_spinner_item); // Specify the layout to use when the list of choices appears staticAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); staticAdapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Apply the adapter to the spinner itemAmountSpinner.setAdapter(staticAdapter); categorySpinner.setAdapter(staticAdapter2); addTV.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!itemInput.getText().toString().isEmpty() && !categorySpinner.getSelectedItem().toString().isEmpty()) { myItemInput = itemInput.getText().toString(); myItemAmountInput = itemAmountInput.getText().toString(); myItemCategory = categorySpinner.getSelectedItem().toString(); myItemMeasurement = itemAmountSpinner.getSelectedItem().toString(); itemAmountAndMeasurement = myItemAmountInput + myItemMeasurement; itemId = mDatabaseRef.push().getKey(); myKitchenItem = new MyKitchenItem(myItemInput, myItemCategory, itemAmountAndMeasurement, userId, itemId); mDatabaseRef = FirebaseDatabase.getInstance().getReference("myKitchenItems"); mDatabaseRef.child(itemId).setValue(myKitchenItem); itemInput.setText(""); itemAmountInput.setText(""); myKitchenItemsAdapter2.notifyDataSetChanged(); mainRecyclerView.setAdapter(myKitchenItemsAdapter2); } } }); mBuilder.setView(mView); AlertDialog dialog = mBuilder.create(); dialog.show(); cancelTV.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); } }); checkedItemsBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ArrayList<MyKitchenItem> mSelectedItems = myKitchenItemsAdapter2.childAdapter.listOfSelectedItems(); String selectedItemName = ""; if (mSelectedItems != null) { for (int index = 0; index < mSelectedItems.size(); index++) { System.out.println(mSelectedItems.get(index).itemName); selectedItemName += mSelectedItems.get(index).itemName; if (index != mSelectedItems.size() - 1) { selectedItemName += ",+"; } } } if (selectedItemName != "") { Intent intentRecipe = new Intent(MyKitchenIngredients2.this, RecipeActivity.class); intentRecipe.putExtra("ingredientList", selectedItemName.toString()); startActivity(intentRecipe); } myKitchenItemsAdapter2.childAdapter.ClearSelectedItems(); } }); //Delete from list by checking boxes and pressing delete FAB deleteItemsBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ArrayList<MyKitchenItem> mSelectedItemsToDelete = myKitchenItemsAdapter2.childAdapter.listOfSelectedItems(); String selectedItemToDeleteName = ""; String selectedItemToDeleteID = ""; if (mSelectedItemsToDelete != null) { for (int index = 0; index < mSelectedItemsToDelete.size(); index++) { System.out.println(mSelectedItemsToDelete.get(index).itemName); //selectedItemToDeleteName += mSelectedItemsToDelete.get(index).itemName; selectedItemToDeleteID += mSelectedItemsToDelete.get(index).getItemId(); if (index != mSelectedItemsToDelete.size() - 1) { //selectedItemToDeleteName += "&"; selectedItemToDeleteID += "&"; } } } if (selectedItemToDeleteID != "") { //Delete from MyKitchenItems2 String[] arrOfItemsToDelete = selectedItemToDeleteID.split("&"); for ( String ingredientToDelete : arrOfItemsToDelete) { System.out.println("DELETE LIST " + ingredientToDelete); deleteRef.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot snapshot) { Iterable<DataSnapshot> children = snapshot.getChildren(); for (DataSnapshot child : children) { currentItem = child.getValue(MyKitchenItem.class); System.out.println("Current item" + currentItem.getItemId()); if(currentItem.getItemId().equals(ingredientToDelete)){ String mSLI = currentItem.getItemId(); mDeleteDatabaseRef.child(mSLI).removeValue(); } myKitchenItemsAdapter2.notifyDataSetChanged(); } } @Override public void onCancelled(@NonNull DatabaseError error) { Log.e(TAG, "onCancelled", error.toException()); } }); } } myKitchenItemsAdapter2.childAdapter.ClearSelectedItems(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.request_notification_menu, menu); getMenuInflater().inflate(R.menu.notification_menu, menu); getMenuInflater().inflate(R.menu.profile_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.profile_icon) { Intent profileIntent = new Intent(MyKitchenIngredients2.this, MyListingsProfileActivity.class); startActivity(profileIntent); return true; } if (id == R.id.notification_menu_icon) { Intent profileIntent = new Intent(MyKitchenIngredients2.this, NotificationActivity.class); startActivity(profileIntent); return true; } if (id == R.id.request_notification_menu_icon) { Intent profileIntent = new Intent(MyKitchenIngredients2.this, RequestNotificationActivity.class); startActivity(profileIntent); return true; } return true; } private void onScanBtnClicked() { IntentIntegrator integrator = new IntentIntegrator(this); integrator.setCaptureActivity(CaptureAct.class); integrator.setOrientationLocked(false); integrator.setDesiredBarcodeFormats(IntentIntegrator.ALL_CODE_TYPES); integrator.setPrompt("Scan Item"); integrator.initiateScan(); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); if (result != null) { if (result.getContents() != null) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(result.getContents()); builder.setTitle("Scan Result"); builder.setPositiveButton("Scan Again", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { onScanBtnClicked(); } }).setNegativeButton("Correct", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); //System.out.println("THE BARCODE" + result.getContents()); barcode = result.getContents(); Intent barcodeIntent = new Intent(MyKitchenIngredients2.this, BarcodeActivity.class); barcodeIntent.putExtra("barcode", barcode); startActivity(barcodeIntent); } }); AlertDialog dialog = builder.create(); dialog.show(); } else { Toast.makeText(this, "No result found", Toast.LENGTH_LONG).show(); } } else { super.onActivityResult(requestCode, resultCode, data); } } private void onAddToKitchenBtnClicked() { setVisibility(clicked); setAnimation(clicked); setClickable(clicked); if (!clicked) { clicked = true; } else { clicked = false; } } private void setAnimation(Boolean clicked) { if (!clicked) { addToKitchenByTextBtn.startAnimation(animatorFromBottom); addToKitchenByScanBtn.startAnimation(animatorFromBottom); addToKitchenBtn.startAnimation(animatorRotateOpen); } else { addToKitchenByTextBtn.startAnimation(animatorToBottom); addToKitchenByScanBtn.startAnimation(animatorToBottom); addToKitchenBtn.startAnimation(animatorRotateClose); } } private void setVisibility(Boolean clicked) { if (clicked) { addToKitchenByScanBtn.setVisibility(View.VISIBLE); addToKitchenByTextBtn.setVisibility(View.VISIBLE); } else { addToKitchenByScanBtn.setVisibility(View.INVISIBLE); addToKitchenByTextBtn.setVisibility(View.GONE); } } private void setClickable(Boolean clicked) { if (!clicked) { addToKitchenByScanBtn.setClickable(true); addToKitchenByTextBtn.setClickable(true); } else { addToKitchenByScanBtn.setClickable(false); addToKitchenByTextBtn.setClickable(false); } } }
[ "burkeella@gmail.com" ]
burkeella@gmail.com
0d476432923b8190acec725bff6b24f6709a5997
4d82c0e97242cc4d2dbc9366a68fe4f42a3eb9a4
/src/test/java/org/akigrafsoft/jsmppkonnector/ClientServer001Test.java
587c92a7051edcff8dd148fc9975a8d9e916803e
[]
no_license
akigrafsoft/JsmppConnector
d0fb4cccc1bab6be112b5e4680b43c142723cfd8
c76075cd30a691363999c5b564528ba411e2a801
refs/heads/master
2021-01-10T14:22:25.575535
2016-03-17T16:58:51
2016-03-17T16:58:51
49,713,123
0
0
null
null
null
null
UTF-8
Java
false
false
4,784
java
package org.akigrafsoft.jsmppkonnector; import static org.junit.Assert.fail; import org.jsmpp.bean.ESMClass; import org.jsmpp.bean.NumberingPlanIndicator; import org.jsmpp.bean.RegisteredDelivery; import org.jsmpp.bean.TypeOfNumber; import org.junit.Test; import com.akigrafsoft.knetthreads.Dispatcher; import com.akigrafsoft.knetthreads.Endpoint; import com.akigrafsoft.knetthreads.ExceptionAuditFailed; import com.akigrafsoft.knetthreads.ExceptionDuplicate; import com.akigrafsoft.knetthreads.FlowProcessContext; import com.akigrafsoft.knetthreads.Message; import com.akigrafsoft.knetthreads.RequestEnum; import com.akigrafsoft.knetthreads.konnector.Konnector; import com.akigrafsoft.knetthreads.konnector.KonnectorDataobject; import com.akigrafsoft.knetthreads.routing.EndpointRouter; import com.akigrafsoft.knetthreads.routing.KonnectorRouter; public class ClientServer001Test { private void doSleep(long millis) { try { Thread.sleep(millis); } catch (InterruptedException e) { e.printStackTrace(); } } @Test public void test() { /* * Properties prop = new Properties(); InputStream in = * Test001.class.getResourceAsStream * ("//home/kmoyse/workspace/JmsConnector/jndi.properties"); try { * prop.load(in); in.close(); } catch (IOException e1) { // TODO * Auto-generated catch block e1.printStackTrace(); } */ // server Konnector server_konnector; { try { server_konnector = new JsmppServerKonnector("TEST_SERVER"); } catch (ExceptionDuplicate e) { e.printStackTrace(); fail("creation failed"); return; } JsmppServerConfiguration config = new JsmppServerConfiguration(); config.setPort(8542); config.setSystemId("sys"); try { server_konnector.configure(config); } catch (ExceptionAuditFailed e) { e.printStackTrace(); fail("configuration failed"); return; } try { final Endpoint l_ep = new Endpoint("TESTNAP") { @Override public KonnectorRouter getKonnectorRouter(Message message, KonnectorDataobject dataobject) { // TODO Auto-generated method stub return null; } @Override public RequestEnum classifyInboundMessage(Message message, KonnectorDataobject dataobject) { SmsDataobject do_sms = (SmsDataobject) dataobject; System.out.println("received" + do_sms.inboundBuffer); return null; } }; l_ep.setDispatcher(new Dispatcher<RequestEnum>("foo") { @Override public FlowProcessContext getContext(Message message, KonnectorDataobject dataobject, RequestEnum request) { // TODO Auto-generated method stub return null; } }); server_konnector.setEndpointRouter(new EndpointRouter() { @Override public Endpoint resolveKonnector(Message message, KonnectorDataobject dataobject) { return l_ep; } }); } catch (ExceptionDuplicate e) { // TODO Auto-generated catch block e.printStackTrace(); } } server_konnector.start(); // Client Konnector client_konnector; { try { client_konnector = new JsmppClientKonnector("TEST_CLIENT"); } catch (ExceptionDuplicate e) { e.printStackTrace(); fail("creation failed"); return; } JsmppClientConfiguration config = new JsmppClientConfiguration(); config.setNumberOfSessions(5); config.setHost("localhost"); config.setPort(8542); config.setSystemId("sys"); try { client_konnector.configure(config); } catch (ExceptionAuditFailed e) { e.printStackTrace(); fail("configuration failed"); return; } } client_konnector.start(); doSleep(500); Message message = new Message(); SmsDataobject do_sms = new SmsDataobject(message); do_sms.operationMode = KonnectorDataobject.OperationMode.TWOWAY; do_sms.operationSyncMode = KonnectorDataobject.SyncMode.ASYNC; do_sms.serviceType = ""; do_sms.sourceAddrTon = TypeOfNumber.UNKNOWN; do_sms.sourceAddrNpi = NumberingPlanIndicator.UNKNOWN; do_sms.sourceAddr = ""; do_sms.destAddrTon = TypeOfNumber.UNKNOWN; do_sms.destAddrNpi = NumberingPlanIndicator.UNKNOWN; do_sms.destinationAddr = ""; do_sms.esmClass = new ESMClass(); do_sms.protocolId = 0; do_sms.priorityFlag = 0; do_sms.scheduleDeliveryTime = ""; do_sms.validityPeriod = ""; do_sms.registeredDelivery = new RegisteredDelivery(0); do_sms.replaceIfPresentFlag = 0; do_sms.dataCoding = org.jsmpp.bean.DataCodings.newInstance((byte) 0); // new GeneralDataCoding(true, true, // MessageClass.CLASS1, Alphabet.ALPHA_DEFAULT); do_sms.smDefaultMsgId = 1; do_sms.outboundBuffer = "CreateBalance,EMSTest:Id01,100,10,10000,20,balance,EUR,2"; client_konnector.handle(do_sms); doSleep(500); System.out.println(do_sms.messageId); client_konnector.stop(); } }
[ "akigrafsoft@gmail.com" ]
akigrafsoft@gmail.com
b57afc5bb7ce7c6ddaa4b0431a3cf0af54aa26d8
9468ccf883601b3f74daddc60461bcab7a326e74
/src/main/java/entities/User.java
ebd2c2f85638ff26759f8bbcd5dbe5a47f4dba94
[]
no_license
Amazingh0rse/3sem_EksBackend
d720a98c4d242721a7425f795400811e4e8109df
4a2b7066b1eef229d6a29b58593c5a28ec6172d2
refs/heads/main
2023-02-17T06:48:55.126532
2021-01-18T04:30:44
2021-01-18T04:30:44
329,580,036
0
0
null
null
null
null
UTF-8
Java
false
false
3,527
java
package entities; import dto.DogDTO; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import org.mindrot.jbcrypt.BCrypt; /** * * @author Amazingh0rse */ @Entity @Table(name = "users") @NamedQuery(name = "User.deleteAllRows", query = "DELETE from User") public class User implements Serializable { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @NotNull @Column(name = "userName", length = 50) private String userName; @Basic(optional = false) @NotNull @Size(min = 1, max = 255) @Column(name = "user_password") private String userPassword; //joins the user role table to users @JoinTable(name = "user_roles", joinColumns = { @JoinColumn(name = "userName", referencedColumnName = "userName")}, inverseJoinColumns = { @JoinColumn(name = "role_name", referencedColumnName = "role_name")}) @ManyToMany (cascade = CascadeType.PERSIST) private List<Role> roleList = new ArrayList<>(); @OneToMany(cascade = CascadeType.PERSIST, mappedBy = "user") private List<Dog> dogList = new ArrayList<>(); public List<Dog> getDog() { return dogList; } public void setDog(List<Dog> dogList) { this.dogList = dogList; } public User() { } public User(String userName, String userPassword) { this.userName = userName; this.userPassword = BCrypt.hashpw(userPassword, BCrypt.gensalt(12)); } //TODO Change when password is hashed public boolean verifyPassword(String pw) { return (BCrypt.checkpw(pw, this.userPassword)); } //Getters & setters public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getUserPassword() { return userPassword; } public void setUserPassword(String userPassword) { this.userPassword = userPassword; } public List<String> getRolesAsStrings() { if (roleList.isEmpty()) { return null; } List<String> rolesAsStrings = new ArrayList<>(); roleList.forEach((role) -> { rolesAsStrings.add(role.getRoleName()); }); return rolesAsStrings; } public List<Role> getRoleList() { return roleList; } public void setRoleList(List<Role> roleList) { this.roleList = roleList; } public void addRole(Role userRole) { roleList.add(userRole); } public void addDog (Dog dog) { if (dog !=null){ dogList.add(dog); dog.setUser(this); } } public void removeDog (Dog dog) { if (dog !=null){ dogList.remove(dog); dog.setUser(this); } } public List<Dog> getDogList() { return dogList; } public void setDogList(List<Dog> dogList) { this.dogList = dogList; } }
[ "therahbek@gmail.com" ]
therahbek@gmail.com
25e3f07b7f5c9d4df03231385c39039211b741da
a6d3c66595353f6602bcc26afe39f2e1f6de2e07
/MavenFile/src/main/java/Cal/Calculate.java
b8672762699b3e0b34e3477834ba4a12caf39230
[]
no_license
jeongyihyeon1120/Maven
3b317d8761fccf81f908f090fa267e608ec3b370
bb76f766d44d51fd98de32570bcfe293f846522c
refs/heads/master
2023-04-20T09:23:56.575642
2021-05-05T10:06:15
2021-05-05T10:06:15
293,240,131
0
0
null
null
null
null
UTF-8
Java
false
false
1,546
java
package Cal; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Scanner; public class Calculate { public static void main(String[] args) { ArrayList<Integer> result = new ArrayList<Integer>(); String interger = ""; int r = 0; int oper = 0; while (true) { Scanner s = new Scanner(System.in); System.out.print("숫자 한개, 연산자, d, e"); String firstInt = s.next(); if (firstInt.equals("+")) { oper = 1; result.add(Integer.parseInt(interger)); interger = ""; } else if (firstInt.equals("-")) { oper = 2; result.add(Integer.parseInt(interger)); interger = ""; } else if (firstInt.equals("=")) { if (oper == 1) { result.add(Integer.parseInt(interger)); r = result.get(0) + result.get(1); System.out.println(r); for (int i = 0; i < result.size(); i++) { result.remove(i); i--; } interger = Integer.toString(r); r = 0; } else if (oper == 2) { result.add(Integer.parseInt(interger)); r = result.get(0) - result.get(1); System.out.println(r); for (int i = 0; i < result.size(); i++) { result.remove(i); i--; } interger = Integer.toString(r); r = 0; } } else if (firstInt.equals("d")) { interger = interger.substring(0, interger.length() - 1); } else if (firstInt.equals("e")) { System.out.println("종료"); break; } else { interger = interger + firstInt; } } } }
[ "yhyeon@DESKTOP-4BV5SNM" ]
yhyeon@DESKTOP-4BV5SNM
80d86e66e5441a3413f5fd55456d0077121b93ca
fd3e4cc20a58c2a46892b3a38b96d5e2303266d8
/src/main/java/com/amap/api/services/geocoder/RegeocodeResult.java
faf8d6bee039a194bc55909ec2c21ce3f6aa36dd
[]
no_license
makewheels/AnalyzeBusDex
42ef50f575779b66bd659c096c57f94dca809050
3cb818d981c7bc32c3cbd8c046aa78cd38b20e8a
refs/heads/master
2021-10-22T07:16:40.087139
2019-03-09T03:11:05
2019-03-09T03:11:05
173,123,231
0
0
null
null
null
null
UTF-8
Java
false
false
809
java
package com.amap.api.services.geocoder; public class RegeocodeResult { /* renamed from: a */ private RegeocodeQuery f3017a; /* renamed from: b */ private RegeocodeAddress f3018b; public RegeocodeResult(RegeocodeQuery regeocodeQuery, RegeocodeAddress regeocodeAddress) { this.f3017a = regeocodeQuery; this.f3018b = regeocodeAddress; } public RegeocodeQuery getRegeocodeQuery() { return this.f3017a; } public void setRegeocodeQuery(RegeocodeQuery regeocodeQuery) { this.f3017a = regeocodeQuery; } public RegeocodeAddress getRegeocodeAddress() { return this.f3018b; } public void setRegeocodeAddress(RegeocodeAddress regeocodeAddress) { this.f3018b = regeocodeAddress; } }
[ "spring@qbserver.cn" ]
spring@qbserver.cn
fbce6f9fcee570cad1b4115ebcda8221dc1ba5e3
fd866adba9c300d225ea96ac60c69226f509fb8d
/eureka-client-zuul/src/main/java/com/forezp/eurekaclientzuul/config/MyFilter.java
2b8fa10199051a4c48f737e871caf3c786705be0
[]
no_license
ChaoGuoChina/eureka-parent
8f22f648566da42d9270e054fa8410f5ae45114b
c863296ddb645ad3e620eaf0485e4b581bb04cb2
refs/heads/master
2023-08-10T12:20:41.408839
2019-12-30T03:03:00
2019-12-30T03:03:00
230,833,891
0
0
null
2023-07-18T20:51:33
2019-12-30T02:34:09
Java
UTF-8
Java
false
false
1,441
java
package com.forezp.eurekaclientzuul.config; import com.netflix.zuul.ZuulFilter; import com.netflix.zuul.context.RequestContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletRequest; import java.io.IOException; import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.PRE_TYPE; /** * 自定义过滤器 */ @Component public class MyFilter extends ZuulFilter { private static Logger log = LoggerFactory.getLogger(MyFilter.class); @Override public String filterType() { return PRE_TYPE; } @Override public int filterOrder() { return 0; } @Override public boolean shouldFilter() { return true; } @Override public Object run() { RequestContext rc = RequestContext.getCurrentContext(); HttpServletRequest request = rc.getRequest(); String tokenId = request.getParameter("tokenId"); if(tokenId == null){ log.error("tokenId is empty!"); rc.setSendZuulResponse(false); rc.setResponseStatusCode(401); try { rc.getResponse().getWriter().write("tokenId is empty!"); } catch (IOException e) { e.printStackTrace(); return null; } } log.info("ok"); return null; } }
[ "chao.guo@socialcredits.cn" ]
chao.guo@socialcredits.cn
b95c580fc66df61d524021a694b18bbdf5db0805
f68c48fe3377b39dcdfd1c85163cc3e2b61d62e6
/src/test/java/assignmentscripts/Nykaa.java
a71864f212484af2f5989dfc5027b44cb17501d1
[]
no_license
mechmani53/sample123
4b78f88f526a87b54179fdd08111052f2c1dbae7
b08ea568da7f5921d878615466625139e548ca76
refs/heads/master
2023-06-23T04:11:34.535820
2021-07-23T05:10:32
2021-07-23T05:10:32
369,390,840
0
0
null
null
null
null
UTF-8
Java
false
false
434
java
package assignmentscripts; import org.testng.annotations.Test; import com.tyss.demo.baseutil.BaseTest; import com.tyss.demo.baseutil.InitializePages; public class Nykaa extends BaseTest { @Test public void createRequisition(String customerName,String projectName,String taskName) throws Exception { InitializePages pages = new InitializePages(driver, ETO, WebActionUtil); pages.nykaaPage.buyNykaaProduct(); // } }
[ "sushmita@Sushmita" ]
sushmita@Sushmita
663f75b5733475142ed40b35fd5c6096fbc0ffff
87901d9fd3279eb58211befa5357553d123cfe0c
/bin/ext-platform-optional/platformwebservices/web/gensrc/de/hybris/platform/btg/dto/BTGUrlParameterOperandsDTO.java
36cd8494429688a47f1424bec6d29b1aa98eabe6
[]
no_license
prafullnagane/learning
4d120b801222cbb0d7cc1cc329193575b1194537
02b46a0396cca808f4b29cd53088d2df31f43ea0
refs/heads/master
2020-03-27T23:04:17.390207
2014-02-27T06:19:49
2014-02-27T06:19:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,205
java
/* * ---------------------------------------------------------------- * --- WARNING: THIS FILE IS GENERATED AND WILL BE OVERWRITTEN! --- * --- Generated at Dec 13, 2013 6:34:48 PM --- * ---------------------------------------------------------------- * * [y] hybris Platform * * Copyright (c) 2000-2011 hybris AG * All rights reserved. * * This software is the confidential and proprietary information of hybris * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with hybris. * */ package de.hybris.platform.btg.dto; import de.hybris.platform.btg.dto.BTGUrlParameterOperandDTO; import de.hybris.platform.webservices.dto.AbstractCollectionDTO; import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; /** * Generated collection dto class for type BTGUrlParameterOperand first defined at extension btg */ @SuppressWarnings("all") @XmlRootElement(name = "btgurlparameteroperands") public class BTGUrlParameterOperandsDTO extends AbstractCollectionDTO { /** <i>Generated variable</i> - List of <code>BTGUrlParameterOperandDTO*/ private List<BTGUrlParameterOperandDTO> btgurlparameteroperandsList; /** * <i>Generated constructor</i> - for generic creation. */ public BTGUrlParameterOperandsDTO() { super(); } /** * <i>Generated constructor</i> - for generic creation. */ public BTGUrlParameterOperandsDTO(final List<BTGUrlParameterOperandDTO> btgurlparameteroperandsList) { super(); this.btgurlparameteroperandsList=btgurlparameteroperandsList; } /** * @return the btgurlparameteroperands */ @XmlElement(name = "btgurlparameteroperand") public List<BTGUrlParameterOperandDTO> getBTGUrlParameterOperands() { return btgurlparameteroperandsList; } /** * @param btgurlparameteroperandsList * the btgurlparameteroperandsList to set */ public void setBTGUrlParameterOperands(final List<BTGUrlParameterOperandDTO> btgurlparameteroperandsList) { this.btgurlparameteroperandsList=btgurlparameteroperandsList; } }
[ "admin1@neev31.(none)" ]
admin1@neev31.(none)
e7438ab122d2deab48f29ebb6f77ab10a93d5e30
60eab9b092bb9d5a50b807f45cbe310774d0e456
/dataset/cm10/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialFunctionNewtonForm.java
0db0464132e76ac27fe08edb2c2942a9fcae823d
[ "BSD-3-Clause", "Minpack", "Apache-2.0" ]
permissive
SpoonLabs/nopol-experiments
7b691c39b09e68c3c310bffee713aae608db61bc
2cf383cb84a00df568a6e41fc1ab01680a4a9cc6
refs/heads/master
2022-02-13T19:44:43.869060
2022-01-22T22:06:28
2022-01-22T22:14:45
56,683,489
6
1
null
2019-03-05T11:02:20
2016-04-20T12:05:51
Java
UTF-8
Java
false
false
8,409
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.math3.analysis.polynomials; import org.apache.commons.math3.analysis.differentiation.DerivativeStructure; import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction; import org.apache.commons.math3.exception.DimensionMismatchException; import org.apache.commons.math3.exception.NoDataException; import org.apache.commons.math3.exception.util.LocalizedFormats; /** * Implements the representation of a real polynomial function in * Newton Form. For reference, see <b>Elementary Numerical Analysis</b>, * ISBN 0070124477, chapter 2. * <p> * The formula of polynomial in Newton form is * p(x) = a[0] + a[1](x-c[0]) + a[2](x-c[0])(x-c[1]) + ... + * a[n](x-c[0])(x-c[1])...(x-c[n-1]) * Note that the length of a[] is one more than the length of c[]</p> * * @version $Id$ * @since 1.2 */ public class PolynomialFunctionNewtonForm implements UnivariateDifferentiableFunction { /** * The coefficients of the polynomial, ordered by degree -- i.e. * coefficients[0] is the constant term and coefficients[n] is the * coefficient of x^n where n is the degree of the polynomial. */ private double coefficients[]; /** * Centers of the Newton polynomial. */ private final double c[]; /** * When all c[i] = 0, a[] becomes normal polynomial coefficients, * i.e. a[i] = coefficients[i]. */ private final double a[]; /** * Whether the polynomial coefficients are available. */ private boolean coefficientsComputed; /** * Construct a Newton polynomial with the given a[] and c[]. The order of * centers are important in that if c[] shuffle, then values of a[] would * completely change, not just a permutation of old a[]. * <p> * The constructor makes copy of the input arrays and assigns them.</p> * * @param a Coefficients in Newton form formula. * @param c Centers. * @throws org.apache.commons.math3.exception.NullArgumentException if * any argument is {@code null}. * @throws NoDataException if any array has zero length. * @throws DimensionMismatchException if the size difference between * {@code a} and {@code c} is not equal to 1. */ public PolynomialFunctionNewtonForm(double a[], double c[]) { verifyInputArray(a, c); this.a = new double[a.length]; this.c = new double[c.length]; System.arraycopy(a, 0, this.a, 0, a.length); System.arraycopy(c, 0, this.c, 0, c.length); coefficientsComputed = false; } /** * Calculate the function value at the given point. * * @param z Point at which the function value is to be computed. * @return the function value. */ public double value(double z) { return evaluate(a, c, z); } /** * {@inheritDoc} * @since 3.1 */ public DerivativeStructure value(final DerivativeStructure t) { verifyInputArray(a, c); final int n = c.length; DerivativeStructure value = new DerivativeStructure(t.getFreeParameters(), t.getOrder(), a[n]); for (int i = n - 1; i >= 0; i--) { value = t.subtract(c[i]).multiply(value).add(a[i]); } return value; } /** * Returns the degree of the polynomial. * * @return the degree of the polynomial */ public int degree() { return c.length; } /** * Returns a copy of coefficients in Newton form formula. * <p> * Changes made to the returned copy will not affect the polynomial.</p> * * @return a fresh copy of coefficients in Newton form formula */ public double[] getNewtonCoefficients() { double[] out = new double[a.length]; System.arraycopy(a, 0, out, 0, a.length); return out; } /** * Returns a copy of the centers array. * <p> * Changes made to the returned copy will not affect the polynomial.</p> * * @return a fresh copy of the centers array. */ public double[] getCenters() { double[] out = new double[c.length]; System.arraycopy(c, 0, out, 0, c.length); return out; } /** * Returns a copy of the coefficients array. * <p> * Changes made to the returned copy will not affect the polynomial.</p> * * @return a fresh copy of the coefficients array. */ public double[] getCoefficients() { if (!coefficientsComputed) { computeCoefficients(); } double[] out = new double[coefficients.length]; System.arraycopy(coefficients, 0, out, 0, coefficients.length); return out; } /** * Evaluate the Newton polynomial using nested multiplication. It is * also called <a href="http://mathworld.wolfram.com/HornersRule.html"> * Horner's Rule</a> and takes O(N) time. * * @param a Coefficients in Newton form formula. * @param c Centers. * @param z Point at which the function value is to be computed. * @return the function value. * @throws org.apache.commons.math3.exception.NullArgumentException if * any argument is {@code null}. * @throws NoDataException if any array has zero length. * @throws DimensionMismatchException if the size difference between * {@code a} and {@code c} is not equal to 1. */ public static double evaluate(double a[], double c[], double z) { verifyInputArray(a, c); final int n = c.length; double value = a[n]; for (int i = n - 1; i >= 0; i--) { value = a[i] + (z - c[i]) * value; } return value; } /** * Calculate the normal polynomial coefficients given the Newton form. * It also uses nested multiplication but takes O(N^2) time. */ protected void computeCoefficients() { final int n = degree(); coefficients = new double[n+1]; for (int i = 0; i <= n; i++) { coefficients[i] = 0.0; } coefficients[0] = a[n]; for (int i = n-1; i >= 0; i--) { for (int j = n-i; j > 0; j--) { coefficients[j] = coefficients[j-1] - c[i] * coefficients[j]; } coefficients[0] = a[i] - c[i] * coefficients[0]; } coefficientsComputed = true; } /** * Verifies that the input arrays are valid. * <p> * The centers must be distinct for interpolation purposes, but not * for general use. Thus it is not verified here.</p> * * @param a the coefficients in Newton form formula * @param c the centers * @throws org.apache.commons.math3.exception.NullArgumentException if * any argument is {@code null}. * @throws NoDataException if any array has zero length. * @throws DimensionMismatchException if the size difference between * {@code a} and {@code c} is not equal to 1. * @see org.apache.commons.math3.analysis.interpolation.DividedDifferenceInterpolator#computeDividedDifference(double[], * double[]) */ protected static void verifyInputArray(double a[], double c[]) { if (a.length == 0 || c.length == 0) { throw new NoDataException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY); } if (a.length != c.length + 1) { throw new DimensionMismatchException(LocalizedFormats.ARRAY_SIZES_SHOULD_HAVE_DIFFERENCE_1, a.length, c.length); } } }
[ "durieuxthomas@hotmail.com" ]
durieuxthomas@hotmail.com
5804c5300942cc9676e43f99c5dc138bf45ca5f2
9d4b2be42b15f262e4900665cf4415cac4c1daca
/2120180183-SK02-PBO-TI20192020-3-4/src/pkg2120180183/sk02/pbo/ti20192020/pkg3/pkg4/aplikasi.java
74f51e106e8ea64082345a97f86fbd92653bf1e3
[]
no_license
mohrofiq/2120180183-SK01-PBO-TI20192020-3-4
bfd1973b3c6093b53c9b3e6599809c03f10e88d1
fcba94a979e5be26022d1377162d69e788b8ecfa
refs/heads/master
2020-08-01T15:43:30.200597
2019-10-03T06:51:50
2019-10-03T06:51:50
211,036,893
0
0
null
null
null
null
UTF-8
Java
false
false
424
java
package pkg2120180183.sk02.pbo.ti20192020.pkg3.pkg4; public class aplikasi { String nama="WeChat"; int chat; int videocall; int telefon; void mengirim_gambar(){ System.out.println("saat ini belum bisa mengirim gambar"+ this.nama); } void mengirim_pesan(){ System.out.println("tidak ada data"); } void group(){ System.out.println("group terlalu banyak"); } }
[ "khanief.islahudi556@gmail.com" ]
khanief.islahudi556@gmail.com
e5bcecea325eee1f300be058c1b8abcc3a14c291
e59dff414e93ab7272e04be136ec1787fe0cf954
/annotation-autowire/src/main/java/com/example/annotationautowire/mark/MarkAnnotation.java
0b7bc87bea9dc0dbd42318553020527527eeb81b
[]
no_license
ChenJianzhao/spring-cloud-demo
0e57d69fbd58c9f9d0a9e6c90d58b4f37738c9f5
b0cd1a835be4ffccbdc211e05e11d5957ed71a89
refs/heads/master
2020-06-10T05:23:19.655725
2019-12-05T07:05:45
2019-12-05T07:05:45
193,595,126
0
0
null
null
null
null
UTF-8
Java
false
false
323
java
package com.example.annotationautowire.mark; import org.springframework.beans.factory.annotation.Qualifier; import java.lang.annotation.*; @Target({ ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited @Qualifier public @interface MarkAnnotation { }
[ "chenjz@77ircloud.com" ]
chenjz@77ircloud.com
32d810cdb545d5e0686d971665c974ea7e508dc7
9eaa14e74541bb0ee64fa7a29d9867c5b5c05ee2
/MeikaiJava/chap06/IntArrayRand2.java
370a33dca2e88d392309a468da333f077aa27168
[]
no_license
nakahara-naka/Java
de2767fb751e9ed0af55f7fe0c1aa3ff41384f69
675b0ca6119ff62be6703378c332e147ec5f380f
refs/heads/main
2023-05-01T20:34:41.800243
2021-05-04T06:41:24
2021-05-04T06:41:24
311,516,257
0
0
null
null
null
null
UTF-8
Java
false
false
974
java
//配列の全要素に値を読み込んで表示 import java.util.Random; import java.util.Scanner; class IntArrayRand2{ public static void main(String[] args){ Random rand = new Random(); Scanner stdIn = new Scanner(System.in); System.out.print("要素数:"); int n = stdIn.nextInt(); int[] a = new int[n]; for (int i = 0; i < n ; i++) //全要素に値を入れる a[i] = rand.nextInt(10) + 1; for (int i = 10; i >= 1 ; i--){ //グラフの上から表示させるため for (int j = 0; j < n; j++) if (a[j] >= i) System.out.print("* "); else System.out.print(" "); System.out.println(); } for (int i = 0; i < 2 * n ; i++) System.out.print('-'); System.out.println(); for (int i = 0; i < n; i++) // System.out.print(i + " "); System.out.print(i % 10 + " "); //桁をずらさないため1の桁だけ表示 System.out.println(); } }
[ "y.dust.and.bones@gmail.com" ]
y.dust.and.bones@gmail.com
59eb9aa94b7d818b87961a0269e746cc4b9cd55f
3ab7cefc3c3b406d374e0f644a9069553eba4e8c
/src/main/java/spittr/config/DataConfig.java
4476c87381761aca8b0718c91539ac51ed804ef6
[]
no_license
tiger7878/chapter13-cache
b8d2b629f64f191c7355e715a4c3815bd5cd62af
68e254a7e7c01fbcd3321c7b93a1c9a0fbe2a71f
refs/heads/master
2020-03-18T21:54:49.178349
2018-05-30T06:57:02
2018-05-30T06:57:02
135,312,405
0
0
null
null
null
null
UTF-8
Java
false
false
1,307
java
package spittr.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.TransactionManagementConfigurer; import javax.sql.DataSource; /** * 数据源配置 * @author: monkey * @date: 2018/5/29 22:46 */ @Configuration @EnableTransactionManagement public class DataConfig implements TransactionManagementConfigurer { @Bean public DataSource dataSource(){ return new EmbeddedDatabaseBuilder() .setType(EmbeddedDatabaseType.H2) .addScript("classpath:schema.sql") .addScript("classpath:test-data.sql") .build(); } @Bean public JdbcTemplate jdbcTemplate(DataSource dataSource){ return new JdbcTemplate(dataSource); } @Override public PlatformTransactionManager annotationDrivenTransactionManager() { return null; } }
[ "zhcw63@163.com" ]
zhcw63@163.com
4add5a2ec84d8cf4b8bb74947d1dfbb52224ae83
ad423e4cd1c3d88468d01220969df7ee3f4d5118
/liga/src/de/liga/dart/fileimport/vfs/LITABZUG.java
0a039053b084f9bee126dfc72bca4bb0bfa9c1cd
[]
no_license
kleopatra999/dl20090219
096cf237f38dc6287c4ecaf2dcd4f396e228b4a3
1ac8d2a8bfe4cfcd901685a039c0c0eae20e75a1
refs/heads/master
2021-04-30T18:03:52.649559
2012-04-19T16:50:42
2012-04-19T16:50:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
307
java
package de.liga.dart.fileimport.vfs; import java.sql.Date; /** * Description: <br/> * User: roman * Date: 25.04.2009, 16:04:34 */ class LITABZUG { int TEA_NR; // team PK Date SAI_NR; //,D Saison datum int ABZ_PUNKTE; // Punktabzug von Gesamtpunktzahl in der Saison }
[ "roman.stumm@931aaaa6-feb9-11dd-88c7-29a3b14d5316" ]
roman.stumm@931aaaa6-feb9-11dd-88c7-29a3b14d5316
4fc26f5f03fa024a3b2b3ae9f68ebd9489065df2
dc861148be9a5000587185b7d4ef8872b4232137
/net.beaconcontroller.web/src/main/java/net/beaconcontroller/web/view/BeaconViewResolver.java
80618ba613c9c29463ca4d05fc9e9246bb33419c
[ "Apache-2.0" ]
permissive
raxefron/BeaconMirror
fac7b9a30135c8f4f84603ab1978811751f7634a
ffa179b80cdba6a197209a9556e787ff6038b146
refs/heads/master
2021-05-01T12:32:06.841015
2011-05-16T08:08:47
2011-05-16T08:08:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,015
java
/** * */ package net.beaconcontroller.web.view; import java.util.Locale; import org.springframework.core.Ordered; import org.springframework.web.servlet.View; import org.springframework.web.servlet.ViewResolver; /** * @author David Erickson (derickso@cs.stanford.edu) * */ public class BeaconViewResolver implements Ordered, ViewResolver { public static String SIMPLE_JSON_VIEW = "simpleJson"; public static String SIMPLE_VIEW = "simple"; protected int order = Ordered.LOWEST_PRECEDENCE; @Override public View resolveViewName(String viewName, Locale locale) throws Exception { if ("simpleJson".equalsIgnoreCase(viewName)) return new SimpleJsonView(); if ("simple".equalsIgnoreCase(viewName)) return new SimpleView(); return null; } @Override public int getOrder() { return order; } /** * @param order the order to set */ public void setOrder(int order) { this.order = order; } }
[ "derickso@stanford.edu" ]
derickso@stanford.edu
cc89e04a51b28473af70b2a31aefde37e1a90bb5
d27a9191fc7df4b05c2dd65e3008966980cb9ce6
/src/com/yoko/dp/structural/proxy/imgloader/ImageIconProxy.java
07af21afd27dd8e4a62af0dcdedaf904e6d021f9
[]
no_license
395836998/JeroDp
4107617c9f665989c6c0e7caf28b992f7e487c8c
0e1e3ff4f06ad2889a7ea7a9cd8e9ef8b96bd6a6
refs/heads/master
2021-01-01T17:57:38.714153
2014-09-10T08:02:10
2014-09-10T08:02:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,969
java
package com.yoko.dp.structural.proxy.imgloader; import java.awt.Graphics; import java.awt.Component; import javax.swing.ImageIcon; import javax.swing.Icon; import javax.swing.SwingUtilities; public class ImageIconProxy implements Icon { private ImageIcon realIcon = null; private String imageName; private int width; private int height; boolean isIconCreated = false; public ImageIconProxy(String imageName, int width, int height) { this.imageName = imageName; this.width = width; this.height = height; } public int getIconHeight() { if(realIcon != null){ return realIcon.getIconHeight(); } return 600; } public int getIconWidth() { if(realIcon != null){ return realIcon.getIconWidth(); } return 800; } // The proxy's paint() method is overloaded to draw a border // and a message "Loading author's photo.." while the image // loads. After the image has loaded, it is drawn. Notice // that the proxy does not load the image until it is // actually needed. public void paintIcon(final Component c, Graphics g, int x, int y) { if(isIconCreated) { realIcon.paintIcon(c, g, x, y); g.drawString("Java and Patterns by Jeff Yan, Ph.D", x+20, y+370); } else { g.drawRect(x, y, width-1, height-1); g.drawString("Loading author's photo...", x+20, y+20); // The image is being loaded on another thread. synchronized(this) { SwingUtilities.invokeLater(new Runnable() { @SuppressWarnings("static-access") public void run() { try { // Slow down the image-loading process. Thread.currentThread().sleep(2000); // ImageIcon constructor creates the image. realIcon = new ImageIcon(imageName); isIconCreated = true; } catch(InterruptedException ex) { ex.printStackTrace(); } // Repaint the icon's component after the // icon has been created. c.repaint(); } }); } } } }
[ "395836998@qq.com" ]
395836998@qq.com
25a01a1b754b4849dbe6e53a28d79369fed5b9ab
d273a07b1bd133acea23539434bbc2aa76379c37
/Destroscape New/src/game/minigame/zombies/Zombies.java
0387f1c2bf6507441708caf286f22ff02a367cb6
[]
no_license
Destroscape/Server
7c7f992401a9c275d7793f4db03e34aac878ef00
63e0958d4e1d8b7e678fb29dedc7ab6938798280
refs/heads/master
2021-01-02T22:39:46.269166
2014-12-27T19:36:06
2014-12-27T19:36:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,730
java
package game.minigame.zombies; import game.Config; import game.entity.npc.NPC; import game.entity.player.Player; import game.Server; import engine.util.Misc; @SuppressWarnings({ "unused" }) public class Zombies { Player p; public Zombies(Player c) { this.p = c; } /* * Finds Zombies */ public int FindZombie() { for (int i = 0; i < p.Zombiez.length; i++) { if (p.Zombiez[i] == null) { return i; } } return -1; } public void KillAllZombies() { for (int i = 0; i < p.Zombiez.length; i++) { if (p.Zombiez[i] != null) { p.Zombiez[i].isDead = true; p.Zombiez[i] = null; } } } /* * Removes from array */ public void HandleZombieDeath(NPC n) { for (int i = 0; i < p.Zombiez.length; i++) { if (p.Zombiez[i] != null) { if (p.Zombiez[i] == n) { p.Zombiez[i] = null; if (GetZombieCount() <= 0) { p.Zombiewave += 1; spawnWave(p.Zombiewave); } } } } } /** * * lol */ public static int POINTS = 0; /** * The wave the game is on. */ public static int WAVE = 0; /** * How many zombies killed. */ public static int ZOMBIES = 0; /** * Is the game started or not. */ public static boolean STARTED; /** * How many waves are left. */ public static int WAVESLEFT = 18; public static void interfaceSend(Player c) { if (STARTED = true) { c.getPA().sendFrame126("", 21120); c.getPA().sendFrame126("@gre@Points: @red@" + POINTS, 21121); // c.getPA().sendFrame126("" , 21122); c.getPA().sendFrame126("@gre@Wave: @red@" + Integer.toString(WAVE), 21122); c.getPA().sendFrame126( "@gre@Waves Left: @red@" + Integer.toString(WAVESLEFT), 21123); c.getPA().walkableInterface(21119); } else if (!STARTED) { resetInterface(); } else return; } public static boolean playerInGame(Player p) { return p.absX > 3239 && p.absX < 9352 && p.absY > 3557 && p.absY < 9376; } public static void resetInterface() { WAVESLEFT = 18; WAVE = 0; ZOMBIES = 0; STARTED = false; POINTS = 0; } private int GetZombieCount() { int count = 0; for (int i = 0; i < p.Zombiez.length; i++) { if (p.Zombiez[i] != null) { count += 1; // ZOMBIES += 1; POINTS += 10 + Misc.random(5000); } } // p.sendMessage("Zombies left:"+count); return count; } public static int[][] Waves = { { 73 }, { 73, 73 }, { 73, 73, 73 }, { 73, 73, 73, 73 }, { 73, 73, 73, 73, 73 }, { 73, 73, 73, 73, 73, 73 }, { 73, 73, 73, 73, 73, 73, 73, 73 }, { 73, 73, 73, 73, 73, 73, 73, 73, 73, 73 }, { 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73 }, { 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73 }, { 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73 }, { 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73 }, { 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73 }, { 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73 }, { 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73 }, { 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73 }, { 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73 }, { 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73 }, }; // public final int X_SPAWN = 2860; // public final int Y_SPAWN = 3725; public final int X_SPAWN = 3248; public final int Y_SPAWN = 9364; private void spawnWave(int wave) { this.KillAllZombies(); WAVE += 1; WAVESLEFT -= 1; if (wave >= Waves.length) { exitGame(true, p); return; } for (int i = 0; i < Waves[wave].length; i++) { int npcId = Waves[wave][i]; int modifier = Misc.random(wave); if (modifier == 0) { modifier = 1; } if (npcId > 1) { int H = p.heightLevel; int hp = getHp(npcId); int max = getMax(npcId); int atk = getAtk(npcId); int def = getDef(npcId); Server.npcHandler.SpawnZombieNPC(p, npcId, X_SPAWN + Misc.random(7), Y_SPAWN + Misc.random(8), p.heightLevel, 1, 80, 5, 50, 5, true, false); } int wavesLeft = Waves.length - wave; } } private int[] RARES = { 6583, 4083, 4063, 4025, 4026, 4030, 4030 }; private int[] SUPERRARES = { 21547, 21557, 21549, 21559, 21539, 21543, 21553, 21563, 21545, 21555, 21565, 21551, 21561, 21541 }; public void exitGame(boolean won, Player c) { this.KillAllZombies(); resetInterface(); c.getPA().closeAllWindows(); if (p == null) { return; } p.teleportToX = Config.EDGEVILLE_X; p.teleportToY = Config.EDGEVILLE_Y; p.heightLevel = 0; int PKpointreward = 15 + Misc.random(25); int wonRare = Misc.random(15); int wonArm = Misc.random(50); if (won && wonRare != 0 && wonRare != 1) { p.sendMessage("You have been awared points."); p.sendMessage("Keep playing for a chance to win rares 1 in 15 chance"); } else if (won && wonRare == 0) { //p.PkPoints += PKpointreward; //p.getItems().addItem(RARES[Misc.random(RARES.length - 1)], 1, ""); p.sendMessage("You have been awared points. You won a rare"); } else if (!won) { resetInterface(); p.sendMessage("@red@You have lost, you get no reward!"); KillAllZombies(); } else if (won && wonRare == 1) { //p.getItems().addItem(this.p.getPA().randomBarrows(), 1, ""); p.sendMessage("You have been awared points. You won some Barrow's"); } if (won && wonArm == 0) { int rare = SUPERRARES[Misc.random(SUPERRARES.length - 1)]; p.sendMessage("You won a rare!"); //Server.yellToAll("[@mag@MINIGAME@bla@]: @gre@" + p.playerName //+ " @bla@won a @gre@" + p.getItems().getItemName(rare) //+ " @bla@from the Zombies minigame"); //p.getItems().addItem(rare, 1, "Zombies Minigame brid arm reward"); } else if (won && wonArm != 0) { p.sendMessage("You needed Rare Random to be 0 to win a brid arm your's was @gre@" + wonArm + ""); p.sendMessage("It is random you can still win Npc transformation items and barrows!"); } KillAllZombies(); p.Zombiewave = 0; resetInterface(); } public void startGame() { p.Zombiewave = 0; p.teleportToX = X_SPAWN; p.teleportToY = Y_SPAWN; p.heightLevel = (p.playerId * 4) + 4; spawnWave(0); //p.getCombat().resetPrayers(); STARTED = true; } public static int getHp(int npcId) { switch (npcId) { case 73: return 30; } return 100; } public static int getMax(int npcId) { switch (npcId) { case 73: return 14; } return 5; } public static int getAtk(int npcId) { switch (npcId) { case 73: return 100; } return 100; } public static int getDef(int npcId) { switch (npcId) { case 73: return 100; } return 100; } }
[ "destroscape@monumentmail.com" ]
destroscape@monumentmail.com
963d242ea625f6b99f7870a671bd95aeba19adcf
653ee5ad01a4b12edb3d5ab9a98ef5e904425927
/src/main/java/dev/sgp/filtre/FrequentationFilter.java
4ccad6c92c69acf1f26c0c7c2fc6812fdfe1225a
[]
no_license
AlexGeb/sirh-gestion-personnel
bb31da145fa03507f01ba90dc8ea6f03ff9b8540
cdd243621e0d2ebc85879b578487c39ffa68597f
refs/heads/master
2021-08-30T11:21:48.907215
2017-12-17T18:09:32
2017-12-17T18:09:32
114,107,950
0
0
null
null
null
null
UTF-8
Java
false
false
1,411
java
package dev.sgp.filtre; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import dev.sgp.entite.VisiteWeb; import dev.sgp.service.FrequentationService; import dev.sgp.util.Constantes; @WebFilter(urlPatterns = { "/*" }) public class FrequentationFilter implements Filter { private static final Logger LOG = LoggerFactory.getLogger(FrequentationFilter.class); private FrequentationService freqService = Constantes.FREQ_SERVICE; @Override public void init(FilterConfig config) throws ServletException { } @Override public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { long before = System.currentTimeMillis(); chain.doFilter(req, resp); long after = System.currentTimeMillis(); String path = ((HttpServletRequest) req).getRequestURI(); int tempsExecution = (int) (after - before); LOG.debug(path + " : " + tempsExecution + "ms"); VisiteWeb visite = new VisiteWeb(0, path, tempsExecution); freqService.addVisite(visite); } @Override public void destroy() { } }
[ "alex.behaghel@gmail.com" ]
alex.behaghel@gmail.com
43593b2fcd88254edb6bb82165759dad9410fe8e
95ff3f794e3a0a86afc8b8ee372fd13939ee524e
/src/main/java/com/rauluka/stormtrooper/topology/FieldNames.java
6af186137168b95081d2c3b55d201445e2941a6d
[ "Apache-2.0" ]
permissive
rauluka/stormtrooper-streams
9233a0896ebeb3c559a3ce0105f75e33d992f3dd
63135d8d0ce8ce702fd68126eb5d849059adfcbb
refs/heads/master
2022-10-17T21:03:50.078825
2020-06-08T20:56:11
2020-06-08T20:57:56
270,808,938
0
0
null
null
null
null
UTF-8
Java
false
false
127
java
package com.rauluka.stormtrooper.topology; public interface FieldNames { String STORMTROOPER_FIELD_NAME = "Stormtrooper"; }
[ "luk.gebel@gmail.com" ]
luk.gebel@gmail.com
5116cf79e4fb51e98fe160fe8663aa55fe03dfb6
2783f59bac988bb444b07e3889a754e6bcc14f17
/src/main/java/com/lm/price/ImportedTaxedPrice.java
c816e82db8fdc559a75c77a13ee12c852986b18a
[]
no_license
sorenchu/lm
22701d24e7d2046c50a646534587948e38eb3eb9
f1d3bcc056e0d6e8bdf080c0e728e38d83d90d8f
refs/heads/master
2021-07-22T22:30:13.234507
2019-11-21T18:37:17
2019-11-21T18:37:17
222,527,514
0
0
null
2020-10-13T17:33:32
2019-11-18T19:28:34
Java
UTF-8
Java
false
false
256
java
package com.lm.price; public class ImportedTaxedPrice extends Price { private static double IMPORTED_TAX = 0.15; @Override public double getRoundedTaxes() { return (double) Math.round(this.price * IMPORTED_TAX * 100d) / 100d; } }
[ "antonioostras@gmail.com" ]
antonioostras@gmail.com
f5e04b0f081e53418f14b73ccb2288dae0a9ca7a
44641b8aded524b7b203dd1f487cd43774269e3c
/MS_RRHH_Servicios/src/main/java/gt/org/ms/model/HistoricoPuesto.java
410398fed2586a3f8276fe81c7c737da24e2b178
[]
no_license
eliudiaz/StripesTest
788c3423dffbefcb186223ca23b947c355175dc4
430f747fa98f3c841528b95917a7f329c6481c97
refs/heads/master
2021-01-11T05:24:28.760802
2017-01-06T14:40:05
2017-01-06T14:40:05
71,803,736
0
1
null
2016-11-02T07:17:02
2016-10-24T15:35:02
Java
UTF-8
Java
false
false
4,873
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 gt.org.ms.model; import gt.org.ms.api.entities.CustomEntity; import gt.org.ms.model.enums.TipoPuesto; import java.io.Serializable; import java.util.Date; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.validation.constraints.NotNull; /** * * @author eliud */ @Entity @Table(name = "historico_puesto", schema = "public") public class HistoricoPuesto implements Serializable, CustomEntity { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id", nullable = false) private Integer id; @Column(name = "tipo") @Enumerated(EnumType.STRING) private TipoPuesto tipo; @Column(name = "fk_puesto_nominal") private Integer fkPuestoNominal; @Column(name = "fk_comunidad") private Integer fkComunidad; @Basic(optional = false) @NotNull @Column(name = "fecha_creacion", nullable = false) @Temporal(TemporalType.TIMESTAMP) private Date fechaCreacion; @Column(name = "creado_por", length = 50) private String creadoPor; @Column(name = "fk_puesto_funcional") private Integer fkPuestoFuncional; @Column(name = "fk_clasificacin_servicio") private Integer fkClasificacinServicio; @JoinColumn(name = "fk_registro_laboral", referencedColumnName = "id") @ManyToOne(cascade = CascadeType.ALL, optional = false) private HistoricoRegistroLaboral fkRegistroLaboral; public HistoricoPuesto() { } public HistoricoPuesto(Integer id) { this.id = id; } public HistoricoPuesto(Integer id, Date fechaCreacion) { this.id = id; this.fechaCreacion = fechaCreacion; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public TipoPuesto getTipo() { return tipo; } public void setTipo(TipoPuesto tipo) { this.tipo = tipo; } public Integer getFkPuestoNominal() { return fkPuestoNominal; } public void setFkPuestoNominal(Integer fkPuestoNominal) { this.fkPuestoNominal = fkPuestoNominal; } public Integer getFkComunidad() { return fkComunidad; } public void setFkComunidad(Integer fkComunidad) { this.fkComunidad = fkComunidad; } public Date getFechaCreacion() { return fechaCreacion; } public void setFechaCreacion(Date fechaCreacion) { this.fechaCreacion = fechaCreacion; } public String getCreadoPor() { return creadoPor; } public void setCreadoPor(String creadoPor) { this.creadoPor = creadoPor; } public Integer getFkPuestoFuncional() { return fkPuestoFuncional; } public void setFkPuestoFuncional(Integer fkPuestoFuncional) { this.fkPuestoFuncional = fkPuestoFuncional; } public Integer getFkClasificacinServicio() { return fkClasificacinServicio; } public void setFkClasificacinServicio(Integer fkClasificacinServicio) { this.fkClasificacinServicio = fkClasificacinServicio; } public HistoricoRegistroLaboral getFkRegistroLaboral() { return fkRegistroLaboral; } public void setFkRegistroLaboral(HistoricoRegistroLaboral fkRegistroLaboral) { this.fkRegistroLaboral = fkRegistroLaboral; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof HistoricoPuesto)) { return false; } HistoricoPuesto other = (HistoricoPuesto) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "gt.org.isis.model.HistoricoPuesto[ id=" + id + " ]"; } @Override public void setFechaUltimoCambio(Date fechaUltimoCambio) { } @Override public void setUltimoCambioPor(String ultimoCambioPor) { } }
[ "eliudiaz@gmail.com" ]
eliudiaz@gmail.com
add73f55a435cb8bcd4207470a3b4709cde0139a
16b639a08a1d21d5c41e3cc4f8ff760b14afb08e
/spring-webmvc/src/main/java/org/springframework/web/servlet/support/RequestContext.java
f05b9e6380699e6c569bbcf389eb2b6fa2546409
[ "Apache-2.0" ]
permissive
Daley-wdl/spring_source_code
3646638b693b214043667f9a5458eb717aa89d25
89c6238d93bb4dba828b767f03c041378d6739ad
refs/heads/master
2021-06-30T17:04:00.995295
2021-03-27T02:33:14
2021-03-27T02:33:14
215,991,222
0
0
null
null
null
null
UTF-8
Java
false
false
37,472
java
/* * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.web.servlet.support; import org.springframework.context.MessageSource; import org.springframework.context.MessageSourceResolvable; import org.springframework.context.NoSuchMessageException; import org.springframework.context.i18n.LocaleContext; import org.springframework.context.i18n.SimpleTimeZoneAwareLocaleContext; import org.springframework.context.i18n.TimeZoneAwareLocaleContext; import org.springframework.lang.Nullable; import org.springframework.ui.context.Theme; import org.springframework.ui.context.ThemeSource; import org.springframework.ui.context.support.ResourceBundleThemeSource; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; import org.springframework.validation.BindException; import org.springframework.validation.BindingResult; import org.springframework.validation.Errors; import org.springframework.web.bind.EscapedErrors; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.servlet.LocaleContextResolver; import org.springframework.web.servlet.LocaleResolver; import org.springframework.web.servlet.ThemeResolver; import org.springframework.web.util.HtmlUtils; import org.springframework.web.util.UriTemplate; import org.springframework.web.util.UrlPathHelper; import org.springframework.web.util.WebUtils; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import javax.servlet.jsp.jstl.core.Config; import java.util.*; /** * Context holder for request-specific state, like current web application context, current locale, * current theme, and potential binding errors. Provides easy access to localized messages and * Errors instances. * * <p>Suitable for exposition to views, and usage within JSP's "useBean" tag, JSP scriptlets, JSTL EL, * etc. Necessary for views that do not have access to the servlet request, like FreeMarker templates. * * <p>Can be instantiated manually, or automatically exposed to views as model attribute via AbstractView's * "requestContextAttribute" property. * * <p>Will also work outside of DispatcherServlet requests, accessing the root WebApplicationContext * and using an appropriate fallback for the locale (the HttpServletRequest's primary locale). * * @author Juergen Hoeller * @author Rossen Stoyanchev * @since 03.03.2003 * @see org.springframework.web.servlet.DispatcherServlet * @see org.springframework.web.servlet.view.AbstractView#setRequestContextAttribute * @see org.springframework.web.servlet.view.UrlBasedViewResolver#setRequestContextAttribute */ public class RequestContext { /** * Default theme name used if the RequestContext cannot find a ThemeResolver. * Only applies to non-DispatcherServlet requests. * <p>Same as AbstractThemeResolver's default, but not linked in here to avoid package interdependencies. * @see org.springframework.web.servlet.theme.AbstractThemeResolver#ORIGINAL_DEFAULT_THEME_NAME */ public static final String DEFAULT_THEME_NAME = "theme"; /** * Request attribute to hold the current web application context for RequestContext usage. * By default, the DispatcherServlet's context (or the root context as fallback) is exposed. */ public static final String WEB_APPLICATION_CONTEXT_ATTRIBUTE = RequestContext.class.getName() + ".CONTEXT"; protected static final boolean jstlPresent = ClassUtils.isPresent( "javax.servlet.jsp.jstl.core.Config", RequestContext.class.getClassLoader()); private HttpServletRequest request; @Nullable private HttpServletResponse response; @Nullable private Map<String, Object> model; private WebApplicationContext webApplicationContext; @Nullable private Locale locale; @Nullable private TimeZone timeZone; @Nullable private Theme theme; @Nullable private Boolean defaultHtmlEscape; @Nullable private Boolean responseEncodedHtmlEscape; private UrlPathHelper urlPathHelper; @Nullable private RequestDataValueProcessor requestDataValueProcessor; @Nullable private Map<String, Errors> errorsMap; /** * Create a new RequestContext for the given request, using the request attributes for Errors retrieval. * <p>This only works with InternalResourceViews, as Errors instances are part of the model and not * normally exposed as request attributes. It will typically be used within JSPs or custom tags. * <p><b>Will only work within a DispatcherServlet request.</b> * Pass in a ServletContext to be able to fallback to the root WebApplicationContext. * @param request current HTTP request * @see org.springframework.web.servlet.DispatcherServlet * @see #RequestContext(javax.servlet.http.HttpServletRequest, javax.servlet.ServletContext) */ public RequestContext(HttpServletRequest request) { this(request, null, null, null); } /** * Create a new RequestContext for the given request, using the request attributes for Errors retrieval. * <p>This only works with InternalResourceViews, as Errors instances are part of the model and not * normally exposed as request attributes. It will typically be used within JSPs or custom tags. * <p><b>Will only work within a DispatcherServlet request.</b> * Pass in a ServletContext to be able to fallback to the root WebApplicationContext. * @param request current HTTP request * @param response current HTTP response * @see org.springframework.web.servlet.DispatcherServlet * @see #RequestContext(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.servlet.ServletContext, Map) */ public RequestContext(HttpServletRequest request, HttpServletResponse response) { this(request, response, null, null); } /** * Create a new RequestContext for the given request, using the request attributes for Errors retrieval. * <p>This only works with InternalResourceViews, as Errors instances are part of the model and not * normally exposed as request attributes. It will typically be used within JSPs or custom tags. * <p>If a ServletContext is specified, the RequestContext will also work with the root * WebApplicationContext (outside a DispatcherServlet). * @param request current HTTP request * @param servletContext the servlet context of the web application (can be {@code null}; * necessary for fallback to root WebApplicationContext) * @see org.springframework.web.context.WebApplicationContext * @see org.springframework.web.servlet.DispatcherServlet */ public RequestContext(HttpServletRequest request, @Nullable ServletContext servletContext) { this(request, null, servletContext, null); } /** * Create a new RequestContext for the given request, using the given model attributes for Errors retrieval. * <p>This works with all View implementations. It will typically be used by View implementations. * <p><b>Will only work within a DispatcherServlet request.</b> * Pass in a ServletContext to be able to fallback to the root WebApplicationContext. * @param request current HTTP request * @param model the model attributes for the current view (can be {@code null}, * using the request attributes for Errors retrieval) * @see org.springframework.web.servlet.DispatcherServlet * @see #RequestContext(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.servlet.ServletContext, Map) */ public RequestContext(HttpServletRequest request, @Nullable Map<String, Object> model) { this(request, null, null, model); } /** * Create a new RequestContext for the given request, using the given model attributes for Errors retrieval. * <p>This works with all View implementations. It will typically be used by View implementations. * <p>If a ServletContext is specified, the RequestContext will also work with a root * WebApplicationContext (outside a DispatcherServlet). * @param request current HTTP request * @param response current HTTP response * @param servletContext the servlet context of the web application (can be {@code null}; necessary for * fallback to root WebApplicationContext) * @param model the model attributes for the current view (can be {@code null}, using the request attributes * for Errors retrieval) * @see org.springframework.web.context.WebApplicationContext * @see org.springframework.web.servlet.DispatcherServlet */ public RequestContext(HttpServletRequest request, @Nullable HttpServletResponse response, @Nullable ServletContext servletContext, @Nullable Map<String, Object> model) { this.request = request; this.response = response; this.model = model; // Fetch WebApplicationContext, either from DispatcherServlet or the root context. // ServletContext needs to be specified to be able to fall back to the root context! WebApplicationContext wac = (WebApplicationContext) request.getAttribute(WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (wac == null) { wac = RequestContextUtils.findWebApplicationContext(request, servletContext); if (wac == null) { throw new IllegalStateException("No WebApplicationContext found: not in a DispatcherServlet " + "request and no ContextLoaderListener registered?"); } } this.webApplicationContext = wac; Locale locale = null; TimeZone timeZone = null; // Determine locale to use for this RequestContext. LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(request); if (localeResolver instanceof LocaleContextResolver) { LocaleContext localeContext = ((LocaleContextResolver) localeResolver).resolveLocaleContext(request); locale = localeContext.getLocale(); if (localeContext instanceof TimeZoneAwareLocaleContext) { timeZone = ((TimeZoneAwareLocaleContext) localeContext).getTimeZone(); } } else if (localeResolver != null) { // Try LocaleResolver (we're within a DispatcherServlet request). locale = localeResolver.resolveLocale(request); } this.locale = locale; this.timeZone = timeZone; // Determine default HTML escape setting from the "defaultHtmlEscape" // context-param in web.xml, if any. this.defaultHtmlEscape = WebUtils.getDefaultHtmlEscape(this.webApplicationContext.getServletContext()); // Determine response-encoded HTML escape setting from the "responseEncodedHtmlEscape" // context-param in web.xml, if any. this.responseEncodedHtmlEscape = WebUtils.getResponseEncodedHtmlEscape(this.webApplicationContext.getServletContext()); this.urlPathHelper = new UrlPathHelper(); if (this.webApplicationContext.containsBean(RequestContextUtils.REQUEST_DATA_VALUE_PROCESSOR_BEAN_NAME)) { this.requestDataValueProcessor = this.webApplicationContext.getBean( RequestContextUtils.REQUEST_DATA_VALUE_PROCESSOR_BEAN_NAME, RequestDataValueProcessor.class); } } /** * Return the underlying HttpServletRequest. Only intended for cooperating classes in this package. */ protected final HttpServletRequest getRequest() { return this.request; } /** * Return the underlying ServletContext. Only intended for cooperating classes in this package. */ @Nullable protected final ServletContext getServletContext() { return this.webApplicationContext.getServletContext(); } /** * Return the current WebApplicationContext. */ public final WebApplicationContext getWebApplicationContext() { return this.webApplicationContext; } /** * Return the current WebApplicationContext as MessageSource. */ public final MessageSource getMessageSource() { return this.webApplicationContext; } /** * Return the model Map that this RequestContext encapsulates, if any. * @return the populated model Map, or {@code null} if none available */ @Nullable public final Map<String, Object> getModel() { return this.model; } /** * Return the current Locale (falling back to the request locale; never {@code null}). * <p>Typically coming from a DispatcherServlet's {@link LocaleResolver}. * Also includes a fallback check for JSTL's Locale attribute. * @see RequestContextUtils#getLocale */ public final Locale getLocale() { return (this.locale != null ? this.locale : getFallbackLocale()); } /** * Return the current TimeZone (or {@code null} if none derivable from the request). * <p>Typically coming from a DispatcherServlet's {@link LocaleContextResolver}. * Also includes a fallback check for JSTL's TimeZone attribute. * @see RequestContextUtils#getTimeZone */ @Nullable public TimeZone getTimeZone() { return (this.timeZone != null ? this.timeZone : getFallbackTimeZone()); } /** * Determine the fallback locale for this context. * <p>The default implementation checks for a JSTL locale attribute in request, session * or application scope; if not found, returns the {@code HttpServletRequest.getLocale()}. * @return the fallback locale (never {@code null}) * @see javax.servlet.http.HttpServletRequest#getLocale() */ protected Locale getFallbackLocale() { if (jstlPresent) { Locale locale = JstlLocaleResolver.getJstlLocale(getRequest(), getServletContext()); if (locale != null) { return locale; } } return getRequest().getLocale(); } /** * Determine the fallback time zone for this context. * <p>The default implementation checks for a JSTL time zone attribute in request, * session or application scope; returns {@code null} if not found. * @return the fallback time zone (or {@code null} if none derivable from the request) */ @Nullable protected TimeZone getFallbackTimeZone() { if (jstlPresent) { TimeZone timeZone = JstlLocaleResolver.getJstlTimeZone(getRequest(), getServletContext()); if (timeZone != null) { return timeZone; } } return null; } /** * Change the current locale to the specified one, * storing the new locale through the configured {@link LocaleResolver}. * @param locale the new locale * @see LocaleResolver#setLocale * @see #changeLocale(Locale, TimeZone) */ public void changeLocale(Locale locale) { LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(this.request); if (localeResolver == null) { throw new IllegalStateException("Cannot change locale if no LocaleResolver configured"); } localeResolver.setLocale(this.request, this.response, locale); this.locale = locale; } /** * Change the current locale to the specified locale and time zone context, * storing the new locale context through the configured {@link LocaleResolver}. * @param locale the new locale * @param timeZone the new time zone * @see LocaleContextResolver#setLocaleContext * @see org.springframework.context.i18n.SimpleTimeZoneAwareLocaleContext */ public void changeLocale(Locale locale, TimeZone timeZone) { LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(this.request); if (!(localeResolver instanceof LocaleContextResolver)) { throw new IllegalStateException("Cannot change locale context if no LocaleContextResolver configured"); } ((LocaleContextResolver) localeResolver).setLocaleContext(this.request, this.response, new SimpleTimeZoneAwareLocaleContext(locale, timeZone)); this.locale = locale; this.timeZone = timeZone; } /** * Return the current theme (never {@code null}). * <p>Resolved lazily for more efficiency when theme support is not being used. */ public Theme getTheme() { if (this.theme == null) { // Lazily determine theme to use for this RequestContext. this.theme = RequestContextUtils.getTheme(this.request); if (this.theme == null) { // No ThemeResolver and ThemeSource available -> try fallback. this.theme = getFallbackTheme(); } } return this.theme; } /** * Determine the fallback theme for this context. * <p>The default implementation returns the default theme (with name "theme"). * @return the fallback theme (never {@code null}) */ protected Theme getFallbackTheme() { ThemeSource themeSource = RequestContextUtils.getThemeSource(getRequest()); if (themeSource == null) { themeSource = new ResourceBundleThemeSource(); } Theme theme = themeSource.getTheme(DEFAULT_THEME_NAME); if (theme == null) { throw new IllegalStateException("No theme defined and no fallback theme found"); } return theme; } /** * Change the current theme to the specified one, * storing the new theme name through the configured {@link ThemeResolver}. * @param theme the new theme * @see ThemeResolver#setThemeName */ public void changeTheme(@Nullable Theme theme) { ThemeResolver themeResolver = RequestContextUtils.getThemeResolver(this.request); if (themeResolver == null) { throw new IllegalStateException("Cannot change theme if no ThemeResolver configured"); } themeResolver.setThemeName(this.request, this.response, (theme != null ? theme.getName() : null)); this.theme = theme; } /** * Change the current theme to the specified theme by name, * storing the new theme name through the configured {@link ThemeResolver}. * @param themeName the name of the new theme * @see ThemeResolver#setThemeName */ public void changeTheme(String themeName) { ThemeResolver themeResolver = RequestContextUtils.getThemeResolver(this.request); if (themeResolver == null) { throw new IllegalStateException("Cannot change theme if no ThemeResolver configured"); } themeResolver.setThemeName(this.request, this.response, themeName); // Ask for re-resolution on next getTheme call. this.theme = null; } /** * (De)activate default HTML escaping for messages and errors, for the scope of this RequestContext. * <p>The default is the application-wide setting (the "defaultHtmlEscape" context-param in web.xml). * @see org.springframework.web.util.WebUtils#getDefaultHtmlEscape */ public void setDefaultHtmlEscape(boolean defaultHtmlEscape) { this.defaultHtmlEscape = defaultHtmlEscape; } /** * Is default HTML escaping active? Falls back to {@code false} in case of no explicit default given. */ public boolean isDefaultHtmlEscape() { return (this.defaultHtmlEscape != null && this.defaultHtmlEscape.booleanValue()); } /** * Return the default HTML escape setting, differentiating between no default specified and an explicit value. * @return whether default HTML escaping is enabled (null = no explicit default) */ @Nullable public Boolean getDefaultHtmlEscape() { return this.defaultHtmlEscape; } /** * Is HTML escaping using the response encoding by default? * If enabled, only XML markup significant characters will be escaped with UTF-* encodings. * <p>Falls back to {@code true} in case of no explicit default given, as of Spring 4.2. * @since 4.1.2 */ public boolean isResponseEncodedHtmlEscape() { return (this.responseEncodedHtmlEscape == null || this.responseEncodedHtmlEscape.booleanValue()); } /** * Return the default setting about use of response encoding for HTML escape setting, * differentiating between no default specified and an explicit value. * @return whether default use of response encoding HTML escaping is enabled (null = no explicit default) * @since 4.1.2 */ @Nullable public Boolean getResponseEncodedHtmlEscape() { return this.responseEncodedHtmlEscape; } /** * Set the UrlPathHelper to use for context path and request URI decoding. * Can be used to pass a shared UrlPathHelper instance in. * <p>A default UrlPathHelper is always available. */ public void setUrlPathHelper(UrlPathHelper urlPathHelper) { Assert.notNull(urlPathHelper, "UrlPathHelper must not be null"); this.urlPathHelper = urlPathHelper; } /** * Return the UrlPathHelper used for context path and request URI decoding. * Can be used to configure the current UrlPathHelper. * <p>A default UrlPathHelper is always available. */ public UrlPathHelper getUrlPathHelper() { return this.urlPathHelper; } /** * Return the RequestDataValueProcessor instance to use obtained from the * WebApplicationContext under the name {@code "requestDataValueProcessor"}. * Or {@code null} if no matching bean was found. */ @Nullable public RequestDataValueProcessor getRequestDataValueProcessor() { return this.requestDataValueProcessor; } /** * Return the context path of the original request, that is, the path that * indicates the current web application. This is useful for building links * to other resources within the application. * <p>Delegates to the UrlPathHelper for decoding. * @see javax.servlet.http.HttpServletRequest#getContextPath * @see #getUrlPathHelper */ public String getContextPath() { return this.urlPathHelper.getOriginatingContextPath(this.request); } /** * Return a context-aware URl for the given relative URL. * @param relativeUrl the relative URL part * @return a URL that points back to the server with an absolute path (also URL-encoded accordingly) */ public String getContextUrl(String relativeUrl) { String url = getContextPath() + relativeUrl; if (this.response != null) { url = this.response.encodeURL(url); } return url; } /** * Return a context-aware URl for the given relative URL with placeholders (named keys with braces {@code {}}). * For example, send in a relative URL {@code foo/{bar}?spam={spam}} and a parameter map * {@code {bar=baz,spam=nuts}} and the result will be {@code [contextpath]/foo/baz?spam=nuts}. * @param relativeUrl the relative URL part * @param params a map of parameters to insert as placeholders in the url * @return a URL that points back to the server with an absolute path (also URL-encoded accordingly) */ public String getContextUrl(String relativeUrl, Map<String, ?> params) { String url = getContextPath() + relativeUrl; UriTemplate template = new UriTemplate(url); url = template.expand(params).toASCIIString(); if (this.response != null) { url = this.response.encodeURL(url); } return url; } /** * Return the path to URL mappings within the current servlet including the * context path and the servlet path of the original request. This is useful * for building links to other resources within the application where a * servlet mapping of the style {@code "/main/*"} is used. * <p>Delegates to the UrlPathHelper to determine the context and servlet path. */ public String getPathToServlet() { String path = this.urlPathHelper.getOriginatingContextPath(this.request); if (StringUtils.hasText(this.urlPathHelper.getPathWithinServletMapping(this.request))) { path += this.urlPathHelper.getOriginatingServletPath(this.request); } return path; } /** * Return the request URI of the original request, that is, the invoked URL * without parameters. This is particularly useful as HTML form action target, * possibly in combination with the original query string. * <p>Delegates to the UrlPathHelper for decoding. * @see #getQueryString * @see org.springframework.web.util.UrlPathHelper#getOriginatingRequestUri * @see #getUrlPathHelper */ public String getRequestUri() { return this.urlPathHelper.getOriginatingRequestUri(this.request); } /** * Return the query string of the current request, that is, the part after * the request path. This is particularly useful for building an HTML form * action target in combination with the original request URI. * <p>Delegates to the UrlPathHelper for decoding. * @see #getRequestUri * @see org.springframework.web.util.UrlPathHelper#getOriginatingQueryString * @see #getUrlPathHelper */ public String getQueryString() { return this.urlPathHelper.getOriginatingQueryString(this.request); } /** * Retrieve the message for the given code, using the "defaultHtmlEscape" setting. * @param code code of the message * @param defaultMessage the String to return if the lookup fails * @return the message */ public String getMessage(String code, String defaultMessage) { return getMessage(code, null, defaultMessage, isDefaultHtmlEscape()); } /** * Retrieve the message for the given code, using the "defaultHtmlEscape" setting. * @param code code of the message * @param args arguments for the message, or {@code null} if none * @param defaultMessage the String to return if the lookup fails * @return the message */ public String getMessage(String code, @Nullable Object[] args, String defaultMessage) { return getMessage(code, args, defaultMessage, isDefaultHtmlEscape()); } /** * Retrieve the message for the given code, using the "defaultHtmlEscape" setting. * @param code code of the message * @param args arguments for the message as a List, or {@code null} if none * @param defaultMessage the String to return if the lookup fails * @return the message */ public String getMessage(String code, @Nullable List<?> args, String defaultMessage) { return getMessage(code, (args != null ? args.toArray() : null), defaultMessage, isDefaultHtmlEscape()); } /** * Retrieve the message for the given code. * @param code code of the message * @param args arguments for the message, or {@code null} if none * @param defaultMessage the String to return if the lookup fails * @param htmlEscape if the message should be HTML-escaped * @return the message */ public String getMessage(String code, @Nullable Object[] args, String defaultMessage, boolean htmlEscape) { String msg = this.webApplicationContext.getMessage(code, args, defaultMessage, getLocale()); if (msg == null) { return ""; } return (htmlEscape ? HtmlUtils.htmlEscape(msg) : msg); } /** * Retrieve the message for the given code, using the "defaultHtmlEscape" setting. * @param code code of the message * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getMessage(String code) throws NoSuchMessageException { return getMessage(code, null, isDefaultHtmlEscape()); } /** * Retrieve the message for the given code, using the "defaultHtmlEscape" setting. * @param code code of the message * @param args arguments for the message, or {@code null} if none * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getMessage(String code, @Nullable Object[] args) throws NoSuchMessageException { return getMessage(code, args, isDefaultHtmlEscape()); } /** * Retrieve the message for the given code, using the "defaultHtmlEscape" setting. * @param code code of the message * @param args arguments for the message as a List, or {@code null} if none * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getMessage(String code, @Nullable List<?> args) throws NoSuchMessageException { return getMessage(code, (args != null ? args.toArray() : null), isDefaultHtmlEscape()); } /** * Retrieve the message for the given code. * @param code code of the message * @param args arguments for the message, or {@code null} if none * @param htmlEscape if the message should be HTML-escaped * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getMessage(String code, @Nullable Object[] args, boolean htmlEscape) throws NoSuchMessageException { String msg = this.webApplicationContext.getMessage(code, args, getLocale()); return (htmlEscape ? HtmlUtils.htmlEscape(msg) : msg); } /** * Retrieve the given MessageSourceResolvable (e.g. an ObjectError instance), using the "defaultHtmlEscape" setting. * @param resolvable the MessageSourceResolvable * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getMessage(MessageSourceResolvable resolvable) throws NoSuchMessageException { return getMessage(resolvable, isDefaultHtmlEscape()); } /** * Retrieve the given MessageSourceResolvable (e.g. an ObjectError instance). * @param resolvable the MessageSourceResolvable * @param htmlEscape if the message should be HTML-escaped * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getMessage(MessageSourceResolvable resolvable, boolean htmlEscape) throws NoSuchMessageException { String msg = this.webApplicationContext.getMessage(resolvable, getLocale()); return (htmlEscape ? HtmlUtils.htmlEscape(msg) : msg); } /** * Retrieve the theme message for the given code. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param code code of the message * @param defaultMessage the String to return if the lookup fails * @return the message */ public String getThemeMessage(String code, String defaultMessage) { String msg = getTheme().getMessageSource().getMessage(code, null, defaultMessage, getLocale()); return (msg != null ? msg : ""); } /** * Retrieve the theme message for the given code. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param code code of the message * @param args arguments for the message, or {@code null} if none * @param defaultMessage the String to return if the lookup fails * @return the message */ public String getThemeMessage(String code, @Nullable Object[] args, String defaultMessage) { String msg = getTheme().getMessageSource().getMessage(code, args, defaultMessage, getLocale()); return (msg != null ? msg : ""); } /** * Retrieve the theme message for the given code. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param code code of the message * @param args arguments for the message as a List, or {@code null} if none * @param defaultMessage the String to return if the lookup fails * @return the message */ public String getThemeMessage(String code, @Nullable List<?> args, String defaultMessage) { String msg = getTheme().getMessageSource().getMessage(code, (args != null ? args.toArray() : null), defaultMessage, getLocale()); return (msg != null ? msg : ""); } /** * Retrieve the theme message for the given code. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param code code of the message * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getThemeMessage(String code) throws NoSuchMessageException { return getTheme().getMessageSource().getMessage(code, null, getLocale()); } /** * Retrieve the theme message for the given code. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param code code of the message * @param args arguments for the message, or {@code null} if none * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getThemeMessage(String code, @Nullable Object[] args) throws NoSuchMessageException { return getTheme().getMessageSource().getMessage(code, args, getLocale()); } /** * Retrieve the theme message for the given code. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param code code of the message * @param args arguments for the message as a List, or {@code null} if none * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getThemeMessage(String code, @Nullable List<?> args) throws NoSuchMessageException { return getTheme().getMessageSource().getMessage(code, (args != null ? args.toArray() : null), getLocale()); } /** * Retrieve the given MessageSourceResolvable in the current theme. * <p>Note that theme messages are never HTML-escaped, as they typically denote * theme-specific resource paths and not client-visible messages. * @param resolvable the MessageSourceResolvable * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ public String getThemeMessage(MessageSourceResolvable resolvable) throws NoSuchMessageException { return getTheme().getMessageSource().getMessage(resolvable, getLocale()); } /** * Retrieve the Errors instance for the given bind object, using the "defaultHtmlEscape" setting. * @param name name of the bind object * @return the Errors instance, or {@code null} if not found */ @Nullable public Errors getErrors(String name) { return getErrors(name, isDefaultHtmlEscape()); } /** * Retrieve the Errors instance for the given bind object. * @param name name of the bind object * @param htmlEscape create an Errors instance with automatic HTML escaping? * @return the Errors instance, or {@code null} if not found */ @Nullable public Errors getErrors(String name, boolean htmlEscape) { if (this.errorsMap == null) { this.errorsMap = new HashMap<>(); } Errors errors = this.errorsMap.get(name); boolean put = false; if (errors == null) { errors = (Errors) getModelObject(BindingResult.MODEL_KEY_PREFIX + name); // Check old BindException prefix for backwards compatibility. if (errors instanceof BindException) { errors = ((BindException) errors).getBindingResult(); } if (errors == null) { return null; } put = true; } if (htmlEscape && !(errors instanceof EscapedErrors)) { errors = new EscapedErrors(errors); put = true; } else if (!htmlEscape && errors instanceof EscapedErrors) { errors = ((EscapedErrors) errors).getSource(); put = true; } if (put) { this.errorsMap.put(name, errors); } return errors; } /** * Retrieve the model object for the given model name, either from the model * or from the request attributes. * @param modelName the name of the model object * @return the model object */ @Nullable protected Object getModelObject(String modelName) { if (this.model != null) { return this.model.get(modelName); } else { return this.request.getAttribute(modelName); } } /** * Create a BindStatus for the given bind object, using the "defaultHtmlEscape" setting. * @param path the bean and property path for which values and errors will be resolved (e.g. "person.age") * @return the new BindStatus instance * @throws IllegalStateException if no corresponding Errors object found */ public BindStatus getBindStatus(String path) throws IllegalStateException { return new BindStatus(this, path, isDefaultHtmlEscape()); } /** * Create a BindStatus for the given bind object, using the "defaultHtmlEscape" setting. * @param path the bean and property path for which values and errors will be resolved (e.g. "person.age") * @param htmlEscape create a BindStatus with automatic HTML escaping? * @return the new BindStatus instance * @throws IllegalStateException if no corresponding Errors object found */ public BindStatus getBindStatus(String path, boolean htmlEscape) throws IllegalStateException { return new BindStatus(this, path, htmlEscape); } /** * Inner class that isolates the JSTL dependency. * Just called to resolve the fallback locale if the JSTL API is present. */ private static class JstlLocaleResolver { @Nullable public static Locale getJstlLocale(HttpServletRequest request, @Nullable ServletContext servletContext) { Object localeObject = Config.get(request, Config.FMT_LOCALE); if (localeObject == null) { HttpSession session = request.getSession(false); if (session != null) { localeObject = Config.get(session, Config.FMT_LOCALE); } if (localeObject == null && servletContext != null) { localeObject = Config.get(servletContext, Config.FMT_LOCALE); } } return (localeObject instanceof Locale ? (Locale) localeObject : null); } @Nullable public static TimeZone getJstlTimeZone(HttpServletRequest request, @Nullable ServletContext servletContext) { Object timeZoneObject = Config.get(request, Config.FMT_TIME_ZONE); if (timeZoneObject == null) { HttpSession session = request.getSession(false); if (session != null) { timeZoneObject = Config.get(session, Config.FMT_TIME_ZONE); } if (timeZoneObject == null && servletContext != null) { timeZoneObject = Config.get(servletContext, Config.FMT_TIME_ZONE); } } return (timeZoneObject instanceof TimeZone ? (TimeZone) timeZoneObject : null); } } }
[ "wudelong@wecash.net" ]
wudelong@wecash.net
2e562fb049bab21f2bc1c0cbb09eb74d6f247923
fa6ccf9989d63059e96fd2f656cbdd318283a8a6
/tests/htmlparser/org/htmlparser/http/ConnectionMonitor.java
0d1a1f49e4b012ac726018700f74fae0134d51b5
[]
no_license
typetools/javarifier
9873fcfb9184c388dd964a94924602108d5db506
404dc81c63e48ef41a4d1d96e8bdd6864ddf2edb
refs/heads/master
2023-08-24T22:58:41.671381
2017-01-30T20:19:51
2017-01-30T20:19:51
38,488,557
6
0
null
null
null
null
UTF-8
Java
false
false
2,193
java
// HTMLParser Library $Name: $ - A java-based parser for HTML // http://sourceforge.org/projects/htmlparser // Copyright (C) 2004 Derrick Oswald // // // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // package org.htmlparser.http; import java.net.HttpURLConnection; import org.htmlparser.util.ParserException; /** * Interface for HTTP connection notification callbacks. */ public interface ConnectionMonitor { /** * Called just prior to calling connect. * The connection has been conditioned with proxy, URL user/password, * and cookie information. It is still possible to adjust the * connection, to alter the request method for example. * @param connection The connection which is about to be connected. * @exception ParserException This exception is thrown if the connection * monitor wants the ConnectionManager to bail out. */ void preConnect (HttpURLConnection connection) throws ParserException; /** Called just after calling connect. * The response code and header fields can be examined. * @param connection The connection that was just connected. * @exception ParserException This exception is thrown if the connection * monitor wants the ConnectionManager to bail out. */ void postConnect (HttpURLConnection connection) throws ParserException; }
[ "msaeed43@gmail.com" ]
msaeed43@gmail.com