blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
a3fd0e5d8749359a2cea83c258b1b8f99946ca2e
f8379e29a849a9390959cf1899f75d2099955753
/src/main/java/com/java/classicmodels/service/EmployeeServiceImpl.java
dbc12f00400499b4794a71f41e428117080f8ce0
[]
no_license
padalakrishna/spring-core
a55c2011785747bfd2cce1a348687b962320d90e
0d708aa9afe342edc1782f24e5e9b9de3bea944d
refs/heads/main
2023-05-15T08:20:34.061403
2021-06-10T16:33:26
2021-06-10T16:33:26
375,763,555
0
0
null
null
null
null
UTF-8
Java
false
false
554
java
package com.java.classicmodels.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.java.classicmodels.dao.ClassicModelsDao; import com.java.classicmodels.entity.Employee; @Component("employeeService") public class EmployeeServiceImpl implements EmployeeService { //private ClassicModelsDao dao = new ClassicModelsDaoImpl(); @Autowired private ClassicModelsDao dao; public Employee getEmployee(int id) { return dao.getEmployee(id); } }
57be8bd0927b43a5adbd2c4d5ed6b4a065794ec2
2adbdc8832756dea8be62a6b9d456f394b9b2e9a
/timeseries-sources/alphavantage4j/src/main/java/org/patriques/output/technicalindicators/HT_DCPHASE.java
e2feb8df70b3a884a13370b53bf81bc0cd6d0181
[ "Apache-2.0" ]
permissive
leonarduk/pension-risk-management-system
71ba4db9a4d1d3ba8bd0917e54c7e903cab2acae
a4236001e4a4fd9f6a40f43ff96b217152dd1dfa
refs/heads/master
2023-08-17T04:23:13.608411
2023-08-15T17:24:21
2023-08-15T17:24:21
87,567,764
0
0
null
2023-09-06T06:10:25
2017-04-07T16:52:07
Java
UTF-8
Java
false
false
1,994
java
package org.patriques.output.technicalindicators; import org.patriques.input.technicalindicators.Interval; import org.patriques.output.JsonParser; import org.patriques.output.technicalindicators.data.IndicatorData; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * Representation of the Hilbert transform, dominant cycle phase (HT_DCPHASE) response from api. * * @see TechnicalIndicatorResponse */ public class HT_DCPHASE extends TechnicalIndicatorResponse<IndicatorData> { private HT_DCPHASE(final Map<String, String> metaData, final List<IndicatorData> indicators) { super(metaData, indicators); } /** * Creates {@code HT_DCPHASE} instance from json. * * @param interval specifies how to interpret the date key to the data json object * @param json string to parse * @return HT_DCPHASE instance */ public static HT_DCPHASE from(Interval interval, String json) { Parser parser = new Parser(interval); return parser.parseJson(json); } /** * Helper class for parsing json to {@code HT_DCPHASE}. * * @see TechnicalIndicatorParser * @see JsonParser */ private static class Parser extends TechnicalIndicatorParser<HT_DCPHASE> { public Parser(Interval interval) { super(interval); } @Override String getIndicatorKey() { return "Technical Analysis: HT_DCPHASE"; } @Override HT_DCPHASE resolve(Map<String, String> metaData, Map<String, Map<String, String>> indicatorData) { List<IndicatorData> indicators = new ArrayList<>(); indicatorData.forEach((key, values) -> indicators.add(new IndicatorData( resolveDate(key), Double.parseDouble(values.get("HT_DCPHASE")) ))); return new HT_DCPHASE(metaData, indicators); } } }
16affce2b1bcb4d89abbd8c55e8c866642ae7e81
4f725e2596813d9ecd00b0b103e90800d48fb24e
/prj/src/main/java/co/park/prj/common/Home.java
36c7815ede608af74ca7eddb32e40db0933af886
[]
no_license
dngur1278/JSP
cb1385547b77ac4a65df6781a839dfce42dea8bf
7496ded0ed9f4c5902572d7c118edb33e08f6833
refs/heads/master
2023-06-27T19:17:11.413240
2021-08-02T18:17:38
2021-08-02T18:17:38
388,379,149
0
0
null
null
null
null
UTF-8
Java
false
false
322
java
package co.park.prj.common; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class Home implements Command { @Override public String execute(HttpServletRequest request, HttpServletResponse response) { // TODO Auto-generated method stub return "home/home"; } }
6d04e507fc43aef47073b6acb21dca937e27c4be
d4dbd8c7e6093bf108c6073838744e4ab42ec111
/src/main/java/com/ya/model/user/Credential.java
a64e4eb26cd4c9fecac00641dc86c236ace117a8
[]
no_license
alefebvre-fixit/ya-app
176de925cf4479c9e7497e667d649fc59535a914
51f3bb8e35ddadc05e53019435763216b21112d4
refs/heads/master
2021-05-04T10:49:00.605506
2017-07-21T15:42:29
2017-07-21T15:42:29
48,670,132
0
0
null
null
null
null
UTF-8
Java
false
false
883
java
package com.ya.model.user; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; @Document(collection = "Credential") public class Credential { public Credential() { } public Credential(String username, String password) { this.username = username; this.password = password; } @Override public String toString() { return "Credential [username=" + username + ", password=" + password + "]"; } @Id private String username; public String password; public void setPassword(String password) { this.password = password; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public boolean authenticate(String password) { return this.password.equals(password); } }
a2b932f69e1078e2083405cdbd76ba369dbf7f5a
7f261a1e2bafd1cdd98d58f00a2937303c0dc942
/src/ANXCamera/sources/android/support/v4/provider/RawDocumentFile.java
db03374e77e7f75800d8ecb4ee1154e05adb0be0
[]
no_license
xyzuan/ANXCamera
7614ddcb4bcacdf972d67c2ba17702a8e9795c95
b9805e5197258e7b980e76a97f7f16de3a4f951a
refs/heads/master
2022-04-23T16:58:09.592633
2019-05-31T17:18:34
2019-05-31T17:26:48
259,555,505
3
0
null
2020-04-28T06:49:57
2020-04-28T06:49:57
null
UTF-8
Java
false
false
4,164
java
package android.support.v4.provider; import android.net.Uri; import android.util.Log; import android.webkit.MimeTypeMap; import java.io.File; import java.io.IOException; import java.util.ArrayList; class RawDocumentFile extends DocumentFile { private File mFile; RawDocumentFile(DocumentFile parent, File file) { super(parent); this.mFile = file; } public DocumentFile createFile(String mimeType, String displayName) { String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mimeType); if (extension != null) { StringBuilder sb = new StringBuilder(); sb.append(displayName); sb.append("."); sb.append(extension); displayName = sb.toString(); } File target = new File(this.mFile, displayName); try { target.createNewFile(); return new RawDocumentFile(this, target); } catch (IOException e) { StringBuilder sb2 = new StringBuilder(); sb2.append("Failed to createFile: "); sb2.append(e); Log.w("DocumentFile", sb2.toString()); return null; } } public DocumentFile createDirectory(String displayName) { File target = new File(this.mFile, displayName); if (target.isDirectory() || target.mkdir()) { return new RawDocumentFile(this, target); } return null; } public Uri getUri() { return Uri.fromFile(this.mFile); } public String getName() { return this.mFile.getName(); } public String getType() { if (this.mFile.isDirectory()) { return null; } return getTypeForName(this.mFile.getName()); } public boolean isDirectory() { return this.mFile.isDirectory(); } public boolean isFile() { return this.mFile.isFile(); } public long lastModified() { return this.mFile.lastModified(); } public long length() { return this.mFile.length(); } public boolean canRead() { return this.mFile.canRead(); } public boolean canWrite() { return this.mFile.canWrite(); } public boolean delete() { deleteContents(this.mFile); return this.mFile.delete(); } public boolean exists() { return this.mFile.exists(); } public DocumentFile[] listFiles() { ArrayList<DocumentFile> results = new ArrayList<>(); File[] files = this.mFile.listFiles(); if (files != null) { for (File file : files) { results.add(new RawDocumentFile(this, file)); } } return (DocumentFile[]) results.toArray(new DocumentFile[results.size()]); } public boolean renameTo(String displayName) { File target = new File(this.mFile.getParentFile(), displayName); if (!this.mFile.renameTo(target)) { return false; } this.mFile = target; return true; } private static String getTypeForName(String name) { int lastDot = name.lastIndexOf(46); if (lastDot >= 0) { String mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension(name.substring(lastDot + 1).toLowerCase()); if (mime != null) { return mime; } } return "application/octet-stream"; } private static boolean deleteContents(File dir) { boolean success; File[] arr$; File[] files = dir.listFiles(); boolean success2 = true; if (files != null) { for (File file : files) { if (file.isDirectory()) { success2 &= deleteContents(file); } if (!file.delete()) { StringBuilder sb = new StringBuilder(); sb.append("Failed to delete "); sb.append(file); Log.w("DocumentFile", sb.toString()); success2 = false; } } } return success; } }
47251d9f7dd5174050561f4ac29fa10603d88d82
0f01c393193d0d8ab4bf5f1a6e0064c9d99477ab
/utils/EsperaComboTerValor.java
1095d418a0d0c55a59d24c9215a73a341f851ab9
[ "MIT" ]
permissive
raffathamires/SeleniumAvancado
ea6d267479e21c9c8390c1e0f6a50184210729c8
6a4339d1f9f5f05ef23a7a2c327a32e7af6ac392
refs/heads/master
2020-03-27T11:02:49.500014
2018-09-11T18:22:24
2018-09-11T18:22:24
146,461,492
0
0
null
null
null
null
UTF-8
Java
false
false
527
java
package utils; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.Select; public class EsperaComboTerValor implements ExpectedCondition { private WebDriver driver; private By combo; public EsperaComboTerValor(By combo) { this.combo = combo; } public Object apply(Object o) { driver = (WebDriver) o; return new Select (driver.findElement(combo)). getFirstSelectedOption().isSelected(); } }
ca29f13e41140cfdb75a91d8437d04d2ad3f28c6
daff5f6fe8747ac3e11124cbc3fcf5f7f412abd8
/Sesion5/src/exceptions/Calculadora.java
a19bac1a8b0bf45419f5856ce789f82b76e23112
[]
no_license
jalmx/diplomado-java-2019
b2f38f5e13e4dec0cbaf8922bc13eae93bef7bd3
9dbc0c7c141fef85467a325a69ed393ef87f8259
refs/heads/master
2020-06-08T07:53:36.993651
2019-08-14T20:53:29
2019-08-14T20:53:29
193,190,911
0
0
null
null
null
null
UTF-8
Java
false
false
1,319
java
package exceptions; import java.util.InputMismatchException; import java.util.Scanner; public class Calculadora { public static void main(String[] args) { Scanner sc = new Scanner(System.in); //Bloque try-catch // try { // //aqui todo el codigo // } catch (Exception/*tipo de Exceptio*/ e /*de la exception*/) { // //aqui codigo que se ejecuta en caso que algo haya fallado // //esto se ejecuta cuando sucede una Exception(Error) // } boolean salir; do { try {//inicia el bloque try System.out.println("Calculadora que solo divide"); System.out.println("Dar un valor"); int a = sc.nextInt(); System.out.println("Dar el segundo valor"); int b = sc.nextInt(); double resultado = (double) a / b; System.out.println(resultado); salir = false; sc.close(); } catch (InputMismatchException e) {//inicia el catch // e.printStackTrace(); System.out.println("Solo se permiten digitos"); System.out.println("Intente de nuevo"); salir = true; } } while (salir); } }
5d571b42b3e910f23320358b47481f924cf8c11b
58229cf30ce3a20fc7c06cec57f0dbe4b2e97378
/src/main/java/frc/robot/commands/ToggleOperatorControls.java
1f46b78d701ebea0368261b0b960a617cd7de4a5
[]
no_license
discobots2587/2019-DeepSpace
42145be54d1f712478a1e8b1bffa6f76359ac770
430913c7435db1105c9d999d9fe8f248533c5928
refs/heads/master
2020-04-16T08:06:54.068143
2019-04-03T02:10:23
2019-04-03T02:10:23
165,412,269
2
0
null
2020-02-12T22:29:07
2019-01-12T16:54:39
Java
UTF-8
Java
false
false
1,428
java
/*----------------------------------------------------------------------------*/ /* Copyright (c) 2018 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ package frc.robot.commands; import edu.wpi.first.wpilibj.command.Command; import frc.robot.Robot; public class ToggleOperatorControls extends Command { public ToggleOperatorControls() { // Use requires() here to declare subsystem dependencies // eg. requires(chassis); } // Called just before this Command runs the first time @Override protected void initialize() { } // Called repeatedly when this Command is scheduled to run @Override protected void execute() { Robot.m_oi.toggleDriverOperatorControls(); } // Make this return true when this Command no longer needs to run execute() @Override protected boolean isFinished() { return true; } // Called once after isFinished returns true @Override protected void end() { } // Called when another command which requires one or more of the same // subsystems is scheduled to run @Override protected void interrupted() { } }
6ff64b8fb9e0082b6209a93be1b2eb3e63cf03d2
2ec14c0ec6b9460a370bc3c181b2dac40188f327
/Project_Folder/group14/app/src/main/java/calculotprototype/g14/cmpt276/calculot_prototype/Classes/CrystalBall.java
0e5043ca21389092c295f01645382ba83f6f81e7
[]
no_license
jacebedo/Calculot_276
13694b653da20af97f06ecea415d4dd5a4fe4125
eddb676a76efc08146d0f330460ae0283f24dd36
refs/heads/master
2021-01-22T17:53:05.574697
2017-09-04T22:21:29
2017-09-04T22:21:29
102,407,251
0
0
null
null
null
null
UTF-8
Java
false
false
978
java
package calculotprototype.g14.cmpt276.calculot_prototype.Classes; public class CrystalBall { //fields private float Mass = 360; //initial shell filled (+1%)? for second chance private int ShellLevel = 1; private int ShellLevelMax; float ShellWidth; //Constructor CrystalBall(int _ShellLevelMax, int _sidelength) { ShellLevelMax = _ShellLevelMax; ShellWidth = _sidelength / (_ShellLevelMax + 1); setShellLevel(); } //Private Methods private void setShellLevel() { ShellLevel = (int) Math.floor(Mass / 360); } //Public Methods public void changeMass(int _mass) { Mass += (float) _mass; setShellLevel(); } public float getMass() { return Mass; } public int getShellLevel() { return ShellLevel; } public float getShellWidth() { return ShellWidth; } public int getShellLevelMax() { return ShellLevelMax; } }
57c68dc44972f1908559321ab77ec100432f3d09
1019d840bbf3228909a0ae0283d31e39293c4900
/src/main/java/com/kosenkova/telegrambot/model/InteractiveMode.java
6a046ebb2bda79d9c8c1691194944b5b9b847575
[]
no_license
MaximUlianov/telegram-bot
73283b45c29d23ccc37190694727a75a414675b8
a75bed51bc5234e12f98fb034a776b01df1ada35
refs/heads/master
2023-05-03T07:56:57.289137
2021-05-24T21:16:49
2021-05-24T21:16:49
369,853,188
0
0
null
null
null
null
UTF-8
Java
false
false
102
java
package com.kosenkova.telegrambot.model; public enum InteractiveMode { QUESTION, REQUEST }
f666b08cae8abdea992f792da990298b5c1b6bb4
3dbb0236fa811637ecc99bf385985fcf64e9dd04
/ssh/src/main/java/es/ssh/ssh/SSHAuthenticator.java
99ad18f03a0c379fb996c81c337939bcbe5c44dc
[]
no_license
jonanFan/mediplus
f50a7c304ef2858d28f0112de693feb951ffe8c2
7371665f77293bb7e87993ad89df8dafa0c996b2
refs/heads/master
2021-05-31T06:21:30.346812
2016-04-25T15:42:04
2016-04-25T15:42:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,680
java
/****************************************************************************** * * Copyright (c) 1998,99 by Mindbright Technology AB, Stockholm, Sweden. * www.mindbright.se, [email protected] * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * ***************************************************************************** * $Author: josh $ * $Date: 2001/02/03 00:47:00 $ * $Name: $ *****************************************************************************/ package es.ssh.ssh; import java.io.*; import es.ssh.security.RSAPublicKey; public interface SSHAuthenticator { public String getUsername(SSHClientUser origin) throws IOException; public String getPassword(SSHClientUser origin) throws IOException; public String getChallengeResponse(SSHClientUser origin, String challenge) throws IOException; public int[] getAuthTypes(SSHClientUser origin); public int getCipher(SSHClientUser origin); public SSHRSAKeyFile getIdentityFile(SSHClientUser origin) throws IOException; public String getIdentityPassword(SSHClientUser origin) throws IOException; public boolean verifyKnownHosts(RSAPublicKey hostPub) throws IOException; }
adbb80dc435424ab1403f6fad72537a64ffa653e
aca4645d833d1c07db1c891f1869d39ec391cc40
/src/test/java/MybatisTest.java
76f0ac022db02e2572fed733ac004fbcb6ed3459
[]
no_license
JXY3511088jxy/mybatis-demo
2d0442dfd6aaf467752a4cec24aee6fba08d2d95
50eca743aebb29e6af204fd976ff280eb891f28c
refs/heads/master
2022-07-24T00:45:37.907589
2019-11-13T09:47:51
2019-11-13T09:47:51
221,164,385
0
0
null
2022-06-21T02:13:18
2019-11-12T08:12:09
Java
UTF-8
Java
false
false
1,139
java
import com.jxy.mybatis.pojo.User; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import java.io.InputStream; public class MybatisTest { public static void main(String[] args) throws Exception { // 指定全局配置文件 String resource = "mybatis-config.xml"; // 读取配置文件 InputStream inputStream = Resources.getResourceAsStream(resource); // 构建sqlSessionFactory SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); // 获取sqlSession SqlSession sqlSession = sqlSessionFactory.openSession(); try { // 操作CRUD,第一个参数:指定statement,规则:命名空间+“.”+statementId // 第二个参数:指定传入sql的参数:这里是用户id User user = sqlSession.selectOne("MyMapper.selectUser", 1); System.out.println(user); } finally { sqlSession.close(); } } }
ab534d0d6d7a650172c5d73331de3cee1195cf0f
c1e595db067fa273803cb6923a87daca0425c494
/jypx/jypx_webcontent/src/main/java/com/geekcattle/ServletInitializer.java
ef98814dd9e9b3b3d07855c5f53eb260eb316fca
[]
no_license
beichentest/jypx
859d944cfd14b2dd85a85fdcaf43a06f2c7877fb
28679f09323652579f0636456f27491c54ef591f
refs/heads/master
2021-09-03T21:15:33.147268
2018-01-12T02:32:43
2018-01-12T02:32:43
117,177,161
0
0
null
null
null
null
UTF-8
Java
false
false
573
java
package com.geekcattle; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.support.SpringBootServletInitializer; /** * Title: ServletInitializer Description: �൱������Web.xml Company: * blog.csdn.net/lu1005287365/ * * @author L lulu * @version 1.0 */ public class ServletInitializer {//extends SpringBootServletInitializer { //@Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); } }
01ed4a16409a0cedcd27ae9e3d2b55b2d964c33f
23c4d67762414a2c05805b00d88469574e9a776f
/src/test/java/live/gatisoft/storerequestscontrol/common/schema/UserTest.java
ce8533762dc1f4598e0a9d65856b08fcbabf8e01
[]
no_license
viniciusgati/store-requests-control
aeb155b5e570e8b95cfe1c4b0104a58b256dd66b
504453676d1db49bb57e9a49eb7e6662a4cb0f76
refs/heads/master
2023-08-27T12:11:09.855242
2021-10-26T21:54:53
2021-10-26T21:54:53
401,453,837
0
0
null
2021-09-17T20:00:11
2021-08-30T18:55:06
Java
UTF-8
Java
false
false
1,622
java
package live.gatisoft.storerequestscontrol.common.schema; import live.gatisoft.storerequestscontrol.security.services.BCryptService; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; class UserTest { User user = new User(); @Test @DisplayName("User should set the id") public void getAndSetId() { Long id = 1234L; user.setId(id); assertEquals(user.getId(), id); } @Test @DisplayName("User should set the email") public void getAndSetEmail() { String email = "[email protected]"; user.setEmail(email); assertEquals(user.getEmail(), email); } @Test @DisplayName("User should set the document") public void getAndSetDocument() { String sample = "11144477735"; user.setDocument(sample); assertEquals(user.getDocument(), sample); } @Test @DisplayName("User should set the passwordResetToken") public void getAndSetPasswordResetToken() { String sample = "1823809127839021"; user.setPasswordResetToken(sample); assertEquals(user.getPasswordResetToken(), sample); } @Test @DisplayName("User should set the encryptedPassword") public void getAndSetEncryptedPassword() { String sample = "8asd89a7d978asd789a6s7"; user.setPassword(sample); assertNotEquals(user.getEncryptedPassword(), sample); assertFalse(user.getEncryptedPassword().isBlank()); assertTrue(BCryptService.passwordMatches(sample, user.getEncryptedPassword())); } }
cab52d63d81a241b2fd5594a4fb6b773e3813200
4e2d11b5c8565c6bc49188a8d5c9fc941633b3aa
/fbs/order-service-consumer/src/main/java/com/atguigu/gmall/MainApplication.java
9dd4ccf0c2c504d276dbe0562a4d2a12f1323e7c
[]
no_license
amor949/test
87f673c82f22c4af58c6c27f22be9c1f6235c446
2ac08ddbbc5b66dbbdaa9ed650e3e772eee646d3
refs/heads/master
2020-04-03T21:01:36.856028
2018-10-31T14:02:39
2018-10-31T14:02:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
557
java
package com.atguigu.gmall; import gmall.service.OrderService; import org.springframework.context.support.ClassPathXmlApplicationContext; import java.io.IOException; public class MainApplication { public static void main(String[] args) throws IOException { ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext("consumer.xml"); OrderService orderService = classPathXmlApplicationContext.getBean(OrderService.class); orderService.initOrder("1"); System.in.read(); } }
03e36276ef2049ab3b35eee7319d5033ba1c52f0
206790e1a951303f303761eb1fedad885e84879b
/Leetcode/findMinHeightTrees.java
f03b18ec8a1fd6765b2cef0147fd33282902cf6a
[]
no_license
Mehvix/competitive-programming
b8a8026797b6bb192eefaa68ac49b5db86e02e06
4f11b8f59d475cea4419806725c2652f95bab4bc
refs/heads/master
2022-11-04T10:39:57.381488
2020-06-22T15:47:00
2020-06-22T15:47:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,971
java
import sun.awt.image.ImageWatched; import java.util.*; // Definition for a Node. class Node { public int val; public List<Node> children; public Node() {} public Node(int _val) { val = _val; } public Node(int _val, List<Node> _children) { val = _val; children = _children; } }; class Solution { public List<Integer> findMinHeightTrees(int n, int[][] edges) { /*2 solutions: * 1.) Find the farthest node from any arbitrary point, then repeat again with the new node. This will be the * farthest. Find the middle (two) node(s) * 2.) Find all leafs, and remove all leaves until there are two or less*/ // boolean[][] connections = new boolean[n][n]; List<Set<Integer>> connections = new ArrayList<>(n); for (int i = 0; i < n; i++) connections.add(new HashSet<>()); for (int[] b : edges) { int from = b[0]; int to = b[1]; connections.get(from).add(to); connections.get(to).add(from); // connections[from][to] = true; // connections[to][from] = true; } ArrayList<Integer> leafs = new ArrayList<>(); for(int i = 0; i < n; i++){ if (connections.get(i).size() == 1) leafs.add(i); } System.out.println(connections); while (n > 2){ n -= leafs.size(); ArrayList<Integer> tmp = new ArrayList<>(); for (int leaf : leafs) { int parent = connections.get(leaf).iterator().next(); connections.get(parent).remove(leaf); if (connections.get(parent).size() == 1) tmp.add(parent); } leafs = tmp; } return leafs; } public static void main(String[] args) { Solution obj = new Solution(); System.out.println(obj.findMinHeightTrees(4, new int[][]{{1, 0}, {1, 2}, {1, 3}})); } }
1247b037a716230839f6d6ba62cca41fc79d5749
ba3b25d6cf9be46007833ce662d0584dc1246279
/droidsafe_modified/modeling/api/android/filterfw/core/GLEnvironment.java
718396b1b868fd67a7d870abb9587e6653e12f42
[]
no_license
suncongxd/muDep
46552d4156191b9dec669e246188080b47183a01
b891c09f2c96ff37dcfc00468632bda569fc8b6d
refs/heads/main
2023-03-20T20:04:41.737805
2021-03-01T19:52:08
2021-03-01T19:52:08
326,209,904
8
0
null
null
null
null
UTF-8
Java
false
false
17,275
java
/* * Copyright (C) 2015, Massachusetts Institute of Technology * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Please email [email protected] if you need additional * information or have any questions. * * * This file incorporates work covered by the following copyright and * permission notice: * * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /***** THIS FILE HAS BEEN MODIFIED FROM THE ORIGINAL BY THE DROIDSAFE PROJECT. *****/ package android.filterfw.core; import droidsafe.annotations.*; import droidsafe.runtime.*; import droidsafe.helpers.*; import android.filterfw.core.NativeAllocatorTag; import android.graphics.SurfaceTexture; import android.os.Looper; import android.util.Log; import android.view.Surface; import android.media.MediaRecorder; /** * @hide */ public class GLEnvironment { @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-24 16:06:02.658 -0400", hash_original_method = "1FCEF7B108BFE391FB4BC8B6CECB7E8B", hash_generated_method = "E1A963699602D8A833F4C18A5C0A4196") public static boolean isAnyContextActive() { return nativeIsAnyContextActive(); } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-25 14:24:42.460 -0400", hash_original_method = "7E165335DF678FE191719A49D7F5E9E3", hash_generated_method = "C8D3034C9C23B502815A4D20602D820B") private static boolean nativeIsAnyContextActive(){ //Formerly a native method double taintDouble = 0; return ((taintDouble) == 1); } @DSGeneratedField(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-24 16:06:02.638 -0400", hash_original_field = "5312F3B11B036D51457E62D19332CB5B", hash_generated_field = "836AF212C39306A6DE9B2DAD8EABBB66") private int glEnvId; @DSSafe(DSCat.SAFE_OTHERS) @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-24 16:06:02.640 -0400", hash_original_method = "6BF09C2B2AC02D6ACF79B3F082CF910E", hash_generated_method = "4F784C38633A25CFD964176E01A19EE7") public GLEnvironment() { nativeAllocate(); } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-24 16:06:02.643 -0400", hash_original_method = "E774A0245A01F31414BEAF92CE237DA7", hash_generated_method = "7BCB47B1B6AC6FE44B5288A5D22767AB") private GLEnvironment(NativeAllocatorTag tag) { } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-24 16:06:02.645 -0400", hash_original_method = "4A98176CF70A46DE3389A04080AC575A", hash_generated_method = "22C56FC8AE7AFC2D1B778B2D214733F3") public synchronized void tearDown() { if (glEnvId != -1) { nativeDeallocate(); glEnvId = -1; } } @DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-24 16:06:02.647 -0400", hash_original_method = "1634EBECADA1FE321270115B4A33248F", hash_generated_method = "089C66A5C5C16B1989FEE832F678C8A4") @Override protected void finalize() throws Throwable { tearDown(); } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-24 16:06:02.649 -0400", hash_original_method = "DBA4311C8BEB49D7625023654ECB2564", hash_generated_method = "8D4662FEF5D3754F53EE2B20797AB1B8") public void initWithNewContext() { if (!nativeInitWithNewContext()) { throw new RuntimeException("Could not initialize GLEnvironment with new context!"); } } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-24 16:06:02.652 -0400", hash_original_method = "3F714784F6FDFF8E7C79ED5E256A0C8A", hash_generated_method = "4C6BE2E9C2E2B805CBA2665ADD862F45") public void initWithCurrentContext() { if (!nativeInitWithCurrentContext()) { throw new RuntimeException("Could not initialize GLEnvironment with current context!"); } } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-24 16:06:02.654 -0400", hash_original_method = "40F70B43CD990D8E6F924BC24492C478", hash_generated_method = "B0A10BFE6A63D2F15EE137148AB5C02F") public boolean isActive() { return nativeIsActive(); } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-24 16:06:02.656 -0400", hash_original_method = "B5821792B1F6CD5CA372390DBC83BF8E", hash_generated_method = "58300013EE6F04F87D68226F763DE65B") public boolean isContextActive() { return nativeIsContextActive(); } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-24 16:06:02.660 -0400", hash_original_method = "A75F1E6FFBEB73935A107A83CA349540", hash_generated_method = "992E30CC12DF036F812E2ABEF6838BE0") public void activate() { if (Looper.myLooper() != null && Looper.myLooper().equals(Looper.getMainLooper())) { Log.e("FilterFramework", "Activating GL context in UI thread!"); } if (!nativeActivate()) { throw new RuntimeException("Could not activate GLEnvironment!"); } } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-24 16:06:02.662 -0400", hash_original_method = "EF0BD8149FED207AD95DDA9C650C9AB0", hash_generated_method = "5A11A2E13D75B85A67EF5ADBA24A6324") public void deactivate() { if (!nativeDeactivate()) { throw new RuntimeException("Could not deactivate GLEnvironment!"); } } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-24 16:06:02.665 -0400", hash_original_method = "7B09BC2FD30599B151E2E77BC2B45EF3", hash_generated_method = "A58AB82996C45A6E33A865530A2386D1") public void swapBuffers() { if (!nativeSwapBuffers()) { throw new RuntimeException("Error swapping EGL buffers!"); } } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-24 16:06:02.667 -0400", hash_original_method = "9FDDB1F16B4D13C2E81D7BBDB2FF76CB", hash_generated_method = "BE2A2C7A984F84D513380D1F8ADCE32A") public int registerSurface(Surface surface) { int result = nativeAddSurface(surface); if (result < 0) { throw new RuntimeException("Error registering surface " + surface + "!"); } return result; } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-24 16:06:02.669 -0400", hash_original_method = "E4EAF0AE202932A17B9153690990AB13", hash_generated_method = "C1114146EC0C79F4D3DDFB44C0B62638") public int registerSurfaceTexture(SurfaceTexture surfaceTexture, int width, int height) { int result = nativeAddSurfaceTexture(surfaceTexture, width, height); if (result < 0) { throw new RuntimeException("Error registering surfaceTexture " + surfaceTexture + "!"); } return result; } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-24 16:06:02.672 -0400", hash_original_method = "370EF558D086DB46FA01A76C72C10B50", hash_generated_method = "311421589503D60B7AC78A83BAA187F5") public int registerSurfaceFromMediaRecorder(MediaRecorder mediaRecorder) { int result = nativeAddSurfaceFromMediaRecorder(mediaRecorder); if (result < 0) { throw new RuntimeException("Error registering surface from " + "MediaRecorder" + mediaRecorder + "!"); } return result; } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-24 16:06:02.674 -0400", hash_original_method = "A155702CFF453083CA4E74B28A861912", hash_generated_method = "490901797E489517A3CC0162B5184180") public void activateSurfaceWithId(int surfaceId) { if (!nativeActivateSurfaceId(surfaceId)) { throw new RuntimeException("Could not activate surface " + surfaceId + "!"); } } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-24 16:06:02.676 -0400", hash_original_method = "82E691F8E1D7DAE4DF603DCFDF093301", hash_generated_method = "0BBA7A11314FCAE9575192A3457CFFFF") public void unregisterSurfaceId(int surfaceId) { if (!nativeRemoveSurfaceId(surfaceId)) { throw new RuntimeException("Could not unregister surface " + surfaceId + "!"); } } static { System.loadLibrary("filterfw"); } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-24 16:06:02.678 -0400", hash_original_method = "0860545AC6501C695E7D8AD77E72C93F", hash_generated_method = "58CA36A839B399077D90C6EA5FCF2F6C") public void setSurfaceTimestamp(long timestamp) { if (!nativeSetSurfaceTimestamp(timestamp)) { throw new RuntimeException("Could not set timestamp for current surface!"); } } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-25 14:24:42.449 -0400", hash_original_method = "164BA1662464D454FF905E81D8586F92", hash_generated_method = "D7C7AC933FE6150680313167A707F79A") private boolean nativeInitWithNewContext(){ //Formerly a native method double taintDouble = 0; return ((taintDouble) == 1); } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-25 14:24:42.452 -0400", hash_original_method = "27823144E2C3DC027BFB63BA7141BEFA", hash_generated_method = "EEFDAFBA818C390091ACBD91000F6F65") private boolean nativeInitWithCurrentContext(){ //Formerly a native method double taintDouble = 0; return ((taintDouble) == 1); } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-25 14:24:42.455 -0400", hash_original_method = "8F19BBE56160A05D8AABF421C6AE0D71", hash_generated_method = "99ED90BA556BACB91A59E41431E03057") private boolean nativeIsActive(){ //Formerly a native method double taintDouble = 0; return ((taintDouble) == 1); } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-25 14:24:42.457 -0400", hash_original_method = "429D16685BCAC565C484E3FE04151D47", hash_generated_method = "C2D2A3DA3AC8F95A0ABD0B8E813C447E") private boolean nativeIsContextActive(){ //Formerly a native method double taintDouble = 0; return ((taintDouble) == 1); } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-25 14:24:42.463 -0400", hash_original_method = "57D25A50BBF10FA53BB44C7D6DF9FC93", hash_generated_method = "1F9B755D93F5F98E49C7FA9AE1BFF840") private boolean nativeActivate(){ //Formerly a native method double taintDouble = 0; return ((taintDouble) == 1); } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-25 14:24:42.466 -0400", hash_original_method = "E698B26A12BBCE8DC563A41F7DDD333D", hash_generated_method = "87B74D5717ED71A95C08BA91E285589E") private boolean nativeDeactivate(){ //Formerly a native method double taintDouble = 0; return ((taintDouble) == 1); } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-25 14:24:42.469 -0400", hash_original_method = "1EF329BDA254D0F92DB2285897276B31", hash_generated_method = "24322855273E2A735603C3B7A3428FD0") private boolean nativeSwapBuffers(){ //Formerly a native method double taintDouble = 0; return ((taintDouble) == 1); } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-25 14:24:42.471 -0400", hash_original_method = "6301909CA2626FBD0F9D5CE1EA448C05", hash_generated_method = "BCA8B32BD11B1B2D2C036C109DB889BF") private boolean nativeAllocate(){ //Formerly a native method double taintDouble = 0; return ((taintDouble) == 1); } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-25 14:24:42.474 -0400", hash_original_method = "C5D13A7D2DE40061D17A5A19349F9B46", hash_generated_method = "B240A7932BE0CB51D42FA1BDE6059C94") private boolean nativeDeallocate(){ //Formerly a native method double taintDouble = 0; return ((taintDouble) == 1); } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-25 14:14:20.182 -0400", hash_original_method = "6B6DE041197588F0ED616D34566A1756", hash_generated_method = "D11BD7811306F9B16B5680082CCC3231") private int nativeAddSurface(Surface surface){ //Formerly a native method double taintDouble = 0; taintDouble += surface.getTaintInt(); addTaint(taintDouble); return (int)taintDouble; } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-25 14:14:20.186 -0400", hash_original_method = "63EB4D7192027BD0A7824E00CCA4B45F", hash_generated_method = "1F59E75B993DF69C9160B91A280A9582") private int nativeAddSurfaceTexture(SurfaceTexture surface, int width, int height){ //Formerly a native method double taintDouble = 0; taintDouble += surface.getTaintInt(); taintDouble += width; taintDouble += height; addTaint(taintDouble); return (int)taintDouble; } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-25 14:14:20.191 -0400", hash_original_method = "3B3AC83D0E7A1374F6DBFF6D280A1EF2", hash_generated_method = "C16D8CA5E8CBFB8B55005FA575944903") private int nativeAddSurfaceFromMediaRecorder(MediaRecorder mediaRecorder){ //Formerly a native method double taintDouble = 0; taintDouble += mediaRecorder.getTaintInt(); addTaint(taintDouble); return (int)taintDouble; } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-25 14:14:20.195 -0400", hash_original_method = "87A12BA53060BB423546F41F38880C6B", hash_generated_method = "4DCCC2DE7133EC84EF8A5A7ACAE7D6F9") private boolean nativeDisconnectSurfaceMediaSource(MediaRecorder mediaRecorder){ //Formerly a native method double taintDouble = 0; taintDouble += mediaRecorder.getTaintInt(); addTaint(taintDouble); return ((taintDouble) == 1); } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-25 14:14:20.198 -0400", hash_original_method = "5F17AFC2D1F31F7702F1B3326F4F54F4", hash_generated_method = "B1734C22791173017A02857BF102618F") private boolean nativeActivateSurfaceId(int surfaceId){ //Formerly a native method double taintDouble = 0; taintDouble += surfaceId; addTaint(taintDouble); return ((taintDouble) == 1); } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-25 14:14:20.202 -0400", hash_original_method = "B15325895F651CA9C5F158C2C8B63A15", hash_generated_method = "3D2FF8D4E55475985C4C2DA8C30A29D0") private boolean nativeRemoveSurfaceId(int surfaceId){ //Formerly a native method double taintDouble = 0; taintDouble += surfaceId; addTaint(taintDouble); return ((taintDouble) == 1); } @DSGenerator(tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2014-03-25 14:14:20.206 -0400", hash_original_method = "660A7742E0B8992B12FFDC85C87113E3", hash_generated_method = "70CBB6019EB959FA49DDC6E9145D0842") private boolean nativeSetSurfaceTimestamp(long timestamp){ //Formerly a native method double taintDouble = 0; taintDouble += timestamp; addTaint(taintDouble); return ((taintDouble) == 1); } }
0faf968d49eb9b3b1dfcb8e7a6c09670cf66493c
8b5ff60ca76b06fb5b664d445ca6ccf9af43aca9
/app/src/main/java/com/example/cabbyapp/Login.java
21ffe612d3cc5e6e8cbf7c066e69a04421465155
[]
no_license
erickkaiserk/CabbyApp
ec35c71e64763e4311c1ad59644fd5d6594021b1
c0bf4450b874879b89b2542122d0fd9be1c8e8b9
refs/heads/master
2023-01-13T15:01:20.271766
2020-05-13T21:32:55
2020-05-13T21:32:55
263,747,847
0
0
null
null
null
null
UTF-8
Java
false
false
2,951
java
package com.example.cabbyapp; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.app.AlertDialog; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast; import com.example.cabbyapp.Includes.ToolBar; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.android.material.textfield.TextInputEditText; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import dmax.dialog.SpotsDialog; public class Login extends AppCompatActivity { TextInputEditText mTxtCorreo; TextInputEditText mTxtPassword; Button mButtonIngresar; FirebaseAuth mAuth; DatabaseReference mDatabase; AlertDialog mDialog; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); ToolBar.show(this,"Login de usuario", true); mTxtCorreo=findViewById(R.id.txtCorreo); mTxtPassword=findViewById(R.id.txtPassword); mButtonIngresar=findViewById(R.id.btnIngresar); mAuth=FirebaseAuth.getInstance(); mDatabase= FirebaseDatabase.getInstance().getReference(); mDialog= new SpotsDialog.Builder().setContext(Login.this).setMessage("Espere un momento").build(); mButtonIngresar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { login(); } }); } private void login() { String correo=mTxtCorreo.getText().toString(); String password=mTxtPassword.getText().toString(); if(!correo.isEmpty() && !password.isEmpty()){ if(password.length()>=6){ mDialog.show(); mAuth.signInWithEmailAndPassword(correo,password).addOnCompleteListener(new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if(task.isSuccessful()){ Toast.makeText(Login.this, "Login realizado exitosamente", Toast.LENGTH_SHORT).show(); }else{ Toast.makeText(Login.this, "La contraseña es incorrecta", Toast.LENGTH_SHORT).show(); } mDialog.dismiss(); } }); }else{ Toast.makeText(Login.this, "La contraseña debe tener mas de 6 caractéres", Toast.LENGTH_SHORT).show(); } }else{ Toast.makeText(Login.this, "El correo y la contraseña son obligatorios", Toast.LENGTH_SHORT).show(); } } }
a883f20a5a3cf415e8785fae335c298e71eca737
396a67f596ef792558eee4e775a0596542bfca23
/src/main/java/ch/thn/datatree/printer/TreePrinterUtil.java
defa2a30a4fc89597f5a478fb015a9f09b6da3bf
[ "Apache-2.0" ]
permissive
thnaeff/DataTree
6e70c50a236308826790b4a20fd7ac4dc58eaa50
3a44202518ae382f6d33675fd53ee07a919c7e6b
refs/heads/master
2021-01-14T08:22:55.818663
2017-02-04T16:56:33
2017-02-04T16:56:33
47,307,304
0
0
null
null
null
null
UTF-8
Java
false
false
5,215
java
/** * Copyright 2015 Thomas Naeff (github.com/thnaeff) * * 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 ch.thn.datatree.printer; import java.util.List; import ch.thn.datatree.printer.generic.TreePrinterLine; /** * Some useful methods for the tree printer * * * * @author Thomas Naeff (github.com/thnaeff) * */ public class TreePrinterUtil { public static final String RIGHT_ALIGN_CONNECTOR = "──"; public static final String RIGHT_ALIGN_SPACE = " "; /** * Looks through all the lines to find the count of the most prefixes.<br /> * * <pre> * Key-Value test -> 0 prefixes * ├─ Child 1 -> 1 prefix * │ │ Test -> 2 prefixes * │ ├─ Child 1.1 -> 3 prefixes * │ │ Test -> 4 prefixes * </pre> * * @param lines * @return */ public static int getMaxPrefixCount(List<? extends TreePrinterLine<?>> lines) { int maxPrefixCount = 0; for (TreePrinterLine<?> line : lines) { int prefixesCount = line.getColumnIndex(TreePrinterLine.LABEL_LAST_PREFIX) - line.getColumnIndex(TreePrinterLine.LABEL_FIRST_PREFIX); if (prefixesCount > maxPrefixCount) { maxPrefixCount = prefixesCount; } } return maxPrefixCount; } /** * Looks through all the lines to find the count of the most values.<br /> * * As example, a plain text printer which prints each value in brackets [] * <pre> * [Key-Value test] -> 1 value * ├─ [Child 1][abc] -> 2 values * │ │ [Test][def] -> 2 values * │ ├─ [Child 1.1] -> 1 value * │ │ [Test] -> 1 value * </pre> * * @param lines * @return */ public static int getMaxValueCount(List<? extends TreePrinterLine<?>> lines) { int maxValueCount = 0; for (TreePrinterLine<?> line : lines) { int valueCount = line.getColumnIndex(TreePrinterLine.LABEL_LAST_VALUE) - line.getColumnIndex(TreePrinterLine.LABEL_FIRST_VALUE); if (valueCount > maxValueCount) { maxValueCount = valueCount; } } return maxValueCount; } /** * Looks through all the lines to find the maximal node depth.<br /> * * <pre> * Key-Value test -> depth 0 * ├─ Child 1 -> depth 1 * │ │ Test -> depth 1 * │ ├─ Child 1.1 -> depth 2 * │ │ Test -> depth 2 * </pre> * * @param lines * @return */ public static int getMaxDepth(List<? extends TreePrinterLine<?>> lines) { int depth = 0; for (TreePrinterLine<?> line : lines) { if (line.getDepth() > depth) { depth = line.getDepth(); } } return depth; } /** * Sets the index of the first label as the index of the second label. This * is useful if only one index is set, but both should be present. For example * the fist prefix and the last prefix in a {@link TreePrinterLine}. If only * one single prefix is added to the line (with the label {@link TreePrinterLine#LABEL_FIRST_PREFIX}), * there should also be the label {@link TreePrinterLine#LABEL_LAST_PREFIX} * to close the prefix range. * * @param line * @param takeIndexOfThisLabel * @param matchWithThisLabel */ public static void matchLabeledColumns(TreePrinterLine<?> line, Object takeIndexOfThisLabel, Object matchWithThisLabel) { line.setColumnLabel(matchWithThisLabel, line.getColumnIndex(takeIndexOfThisLabel)); } /** * Adds additional connectors so that all values are aligned * * @param lines */ public static void alignValuesRight(List<TreePrinterLine<String>> lines) { //Find the maximal prefix count int maxPrefixCount = TreePrinterUtil.getMaxPrefixCount(lines); //Align so that every line has the same number of prefixes as the maximal prefix count for (TreePrinterLine<String> line : lines) { // +1 will result in an index of 0 for the tree head int lastPrefixIndex = line.getColumnIndex(TreePrinterLine.LABEL_LAST_PREFIX); int firstPrefixIndex = line.getColumnIndex(TreePrinterLine.LABEL_FIRST_PREFIX); int prefixCount = lastPrefixIndex - firstPrefixIndex; if (line.getNodeValueIndex() == 0) { //Add lines to connect for (int i = 0; i < maxPrefixCount - prefixCount; i++) { //Add after the last prefix //Since the newly added prefix is now the last prefix, increase the lastPrefixIndex line.addWithLabel(++lastPrefixIndex, RIGHT_ALIGN_CONNECTOR, TreePrinterLine.LABEL_LAST_PREFIX); } } else { //Add spaces for any additional node value lines for (int i = 0; i < maxPrefixCount - prefixCount; i++) { //Add after the last prefix //Since the newly added prefix is now the last prefix, increase the lastPrefixIndex line.addWithLabel(++lastPrefixIndex, RIGHT_ALIGN_SPACE, TreePrinterLine.LABEL_LAST_PREFIX); } } } } }
5a42b485a91bff159252235c77f2a8eb9899b241
f81ad73366cd4fede5c43851ad91a457f07c5f4f
/Java OOP Basics 20 Jun 2016/Hm02Methods/src/pr08_CarTrip/Car.java
d621a7a0211e29ecc8fe6341ee622b1f1e15555d
[]
no_license
aangelovangelov/Homeworks
ee4afb9067249c5720a621cb2700dde93e677821
58dfbebdbf87972f0205c61e172cb3ef00e372fd
refs/heads/master
2021-01-24T09:17:22.455566
2016-10-06T13:42:34
2016-10-06T13:42:34
69,881,493
0
0
null
null
null
null
UTF-8
Java
false
false
1,966
java
package pr08_CarTrip; public class Car { private Double speed; private Double fuel; private Double fuelEconomy; private Double distanceTraveled; public Car(Double speed, Double fuel, Double fuelEconomy) { this.speed = speed; this.fuel = fuel; this.fuelEconomy = fuelEconomy; this.distanceTraveled = 0d; } public void executor(String[] commands) { switch (commands[0]) { case "Travel": this.travel(Double.parseDouble(commands[1])); break; case "Distance": this.getDistanceTraveled(); break; case "Time": this.getTime(); break; case "Fuel": this.getFuel(); break; case "Refuel": this.refuel(Double.parseDouble(commands[1])); break; } } private void getFuel() { System.out.printf("Fuel left: %.1f liters%n", this.fuel); } private void refuel(Double liters) { this.fuel += liters; } private void getDistanceTraveled() { System.out.printf("Total distance: %.1f kilometers%n", this.distanceTraveled); } private void getTime() { Double totalMins = this.distanceTraveled / this.speed * 60; System.out.printf("Total time: %d hours and %d minutes%n", totalMins.intValue() / 60, totalMins.intValue() % 60); } private void travel(Double distance) { Double fuelForMove = this.neededFuel(distance); if (fuelForMove <= this.fuel) { this.distanceTraveled += distance; this.fuel -= fuelForMove; } else { this.distanceTraveled += this.fuel / this.fuelEconomy * 100; this.fuel = 0d; } } private Double neededFuel(Double distance) { return distance / 100 * this.fuelEconomy; } }
42eacc5a6f04568e0ae7184b14b5afb223cfc59c
f27c06d466cd65128d0d53c51542ee144d28e87c
/src/util/math/BinaryOperator.java
b063d09de786b3fb2c2a6ea7af8d4e2e3e749606
[]
no_license
leronen/leronen-java
f552217d0695795812a453340db5151031ad4a4c
8cc87472d2271afc44b06d050ca39f41929b1668
refs/heads/master
2021-12-10T05:51:48.941099
2021-11-30T08:26:02
2021-11-30T08:26:02
3,139,499
0
1
null
null
null
null
UTF-8
Java
false
false
125
java
package util.math; public interface BinaryOperator { public double calculate(double p1, double p2); }
485419dabe2b3e9829a2623e88f9362f243d20c0
10aa61921217f4f6ea746ba3972653f2f0632817
/ACBH/ACBH.Droid/obj/Debug/android/src/md59913b075367b1ceab014c008cde85c21/MainActivity.java
a587be69a63db0a36527a226d090da2b8befe28a
[]
no_license
breeny/ACBH
34284e92a3f63a4583a9daa2307a72fd1e2cffd3
4f0f8283d594351d8c474e3514cb417b51ffbae7
refs/heads/master
2016-08-11T19:50:30.891099
2016-04-03T01:26:51
2016-04-03T01:26:51
55,289,389
0
0
null
null
null
null
UTF-8
Java
false
false
1,168
java
package md59913b075367b1ceab014c008cde85c21; public class MainActivity extends android.support.v7.app.AppCompatActivity implements mono.android.IGCUserPeer { static final String __md_methods; static { __md_methods = "n_onCreate:(Landroid/os/Bundle;)V:GetOnCreate_Landroid_os_Bundle_Handler\n" + ""; mono.android.Runtime.register ("ACBH.Droid.MainActivity, ACBH.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", MainActivity.class, __md_methods); } public MainActivity () throws java.lang.Throwable { super (); if (getClass () == MainActivity.class) mono.android.TypeManager.Activate ("ACBH.Droid.MainActivity, ACBH.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "", this, new java.lang.Object[] { }); } public void onCreate (android.os.Bundle p0) { n_onCreate (p0); } private native void n_onCreate (android.os.Bundle p0); java.util.ArrayList refList; public void monodroidAddReference (java.lang.Object obj) { if (refList == null) refList = new java.util.ArrayList (); refList.add (obj); } public void monodroidClearReferences () { if (refList != null) refList.clear (); } }
43d81014b289b4512825d9714b172a30423f7bb3
6ef645e3d013afa56c80794da831ce540d13bb4f
/jleopard/src/test/java/org/jleopard/jleopard/ApplicationTest.java
83584e4d5b624351e83918f0cbbe23c428160605
[]
no_license
imdog/jleopard
8c8f58b1a18fe5dfaa643a74897fdaccca1cd62f
c27f7d9e3a838d3c1edc2a1ec69e934288411ffe
refs/heads/master
2020-03-26T21:23:42.160586
2018-08-20T02:02:24
2018-08-20T02:02:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,930
java
package org.jleopard.jleopard; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import org.jleopard.core.Factory; import org.jleopard.core.sql.CreateTableSql; import org.jleopard.core.sql.SelectSql; import org.jleopard.core.sql.Sql; import org.jleopard.exception.SqlSessionException; import org.jleopard.jdbc.BaseDataSource; import org.jleopard.session.SqlSession; import org.jleopard.session.sessionFactory.SessionFactory; import org.jleopard.xml.XmlFactoryBuilder; import org.junit.Test; import test.entity.Article; import test.entity.User; /** * @Copyright (c) 2018, Chen_9g 陈刚 ([email protected]). * @DateTime Jul 24, 2018 11:03:11 AM * * Find a way for success and not make excuses for failure. * */ public class ApplicationTest { @Test public void xmlTest(){ XmlFactoryBuilder builder=new XmlFactoryBuilder(ClassLoader.getSystemResource("config.xml").getPath()); XmlFactoryBuilder.XmlFactory factory=builder.getFactory(); BaseDataSource db=(BaseDataSource) factory.getBean("dataSource"); Connection conn=db.getConnection(); String sql="select k.column_name FROM information_schema.table_constraints t\n" + "JOIN information_schema.key_column_usage k\n" + "USING (constraint_name,table_name)\n" + "WHERE t.constraint_type='PRIMARY KEY'\n" + " AND t.table_name='user'"; try { Statement stm=conn.createStatement(); ResultSet res=stm.executeQuery(sql); while (res.next()){ System.out.println(res.getString(1)); } } catch (SQLException e) { e.printStackTrace(); } } @Test public void SQLTTt(){ User user=new User(); user.setId(8); user.setPhone("15770549440"); user.setName("leopard"); user.setAddress("China"); SelectSql selectsql=new SelectSql(user); System.out.println("Sql 语句:"+selectsql.getSql()); System.out.println("Sql value:"+selectsql.getValues()); } @Test public void SqlTest(){ User user=new User(); user.setId(10); user.setPhone("15770549440"); user.setName("leopard"); user.setAddress("China002"); // System.out.println("Sql value:"+FieldUtil.getAllColumnName_Value(user)); Sql insert=new CreateTableSql(Article.class); System.out.println("Sql 语句:"+insert.getSql()); SessionFactory factory=Factory.getSessionFactory("classpath:config.xml"); SqlSession session=factory.openSession(); Article a=new Article(); // a.setId(1003); a.setName("GGG"); a.setUser(user); try { System.out.println(session.Get(Article.class,User.class,"")); session.Commit(); session.Stop(); } catch (SqlSessionException e) { e.printStackTrace(); } } /* @Test public void GeneratorTest(){ GeneratorFactory factory=Factory.getGeneratorFactory("classpath:config.xml"); try { factory.openGenerator(); } catch (Exception e) { e.printStackTrace(); } } #Jleopard框架是什么? 1. jleopard是一款完全orm框架,像我们熟悉的Hibernate一样,封装好了大量的sql,足以让我们解放双手,达到极速开发体验。 2. jleopard目前能实现基本的CRUD,包括多表外键链接,关联查询,分页查询,逆向工程。 3. 使用jleopard开发只需配置好数据源,实体类扫描包路径即可,其余全采用注解自动处理。 [hr] 1. 从配置文件开始 [pre] <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE jleopard-configuration PUBLIC "-// jleopard.org//DTD Config 1.0//EN" "http://www.jleopard.org/dtd/jleopard.dtd"> <jleopard-configuration> <!-- 配置扫描实体类所在包 --> <config> <entityScan value="com.leopardframework.entity"></entityScan> <dev value="true"></dev> </config> <!-- 逆向工程生成javabean的路径配置 --> <generator> <target package="com.leopardframework.entity" project="/src/"/> </generator> <!-- 数据原配置 id="dataSource" 不能更改 --> <dataSource class="org.jleopard.jdbc.BaseDataSource" id="dataSource"> <property name="driver" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://127.0.0.1:3306/jleopardDemo?characterEncoding=UTF-8"/> <property name="username" value="root"/> <property name="password" value="chg122345"/> </dataSource> </jleopard-configuration> [/pre] 2. 在实体类上标注注解 @Table("tablename") 注解在类上 value 值为数据库对应的表名 @Column(value="colunmName",isPrimary = EnumPrimary.YES , allowNull = false , relation= "") value对应数据库的字段名,isPrimary是否为主键,有三种类型(不是主键,是主键,自增主键,allowNull是否允许为空,relation作为外键连接哪一个字段名 [pre] @Table("user") public class User { @Column(value="ID",isPrimary = EnumPrimary.YES ) private Integer id; @Column("NAME") private String name; @Column("PHONE") private String phone; @Column("ADDRESS") private String address; //省略.... } @Table("article") public class Article { @Column(isPrimary = EnumPrimary.AUTOINCREMENT) private int id; @Column(allowNull = true) private String name; //把user_id作为外键连接user表的id @Column(value = "user_id",relation = "user_id") private User user; //省略.... [/pre] 3. 获取sqlSession操作数据库表 (1)写一个工具类获取sessionFactory [pre] public static SessionFactory getSessionFactory() { //传入配置文件路径 SessionFactory factory=Factory.getSessionFactory("classpath:config.xml"); return factory; } [/pre] (2)获取sqlSession进行操作 [pre] public int save(User user) throws SqlSessionException { SqlSession session =Getsession.getSessionFactory().openSession(); int temp = session.Save(user); session.Commit(); session.Stop(); return temp; } [/pre] [hr] 4. 所有方法操作详解 [pre] @Test public void Test(){ SessionFactory factory=Factory.getSessionFactory("classpath:config.xml"); //获取session 传入我们的配置文件 SqlSession session=factory.openSession(); User user=new User(); user.setId(10086); user.setName("Leopard"); user.setPhone("10010"); user.setAddress("China"); List list=new ArrayList(); list.add(user); try { //所有操作均有SqlSessionException异常 session.Save(user); //传一个具体的对象 session.SaveMore(list); //多个对象放入list 好比批量操作,实际上并没有用到批量 session.Delete(user); //删除条件即为对象的数据 session.Delete(User.class, 10086, 10010, 10000); //根据唯一主键删除数据 ,传一个或多个主键值 session.Update(user,10086);//根据主键修改数据 目标数据是该对象里的数据 session.Get(User.class); // 查询所有数据 session.Get(user); //查询单条数据 查询条件即为对象的数据 如果匹配到多条数据,则只返回第一条 session.Get(User.class,10000,10086);// 一样按主键查找 session.Get(Article.class,User.class,"") //查询article和所属user 关联查询 session.Get(User.class,"where id=? order by id desc",10086); //自定义条件查询 动态sql session.Get(User.class,1,5); //分页查询 查询第一页数据 每页显示5 条数据 PageInfo来接收(下问文详细介绍) session.Get("",""); //自定义动态sql 返回的是结果集 session.Commit(); //每一次对更新数据库操作都要提交事物 不然数据不会写入数据库 session.Stop(); //每执行完一次都要将其暂停 session.Close(); // 关闭此次Session 下次要用时要重新获取 } catch (SqlSessionException e) { e.printStackTrace(); } } [/pre] 分页详解 [pre] @Test public void PageTest(){ 目前仅封装了我们开发中常用的一些数据信息。 获取分页信息 :getPage(); // 获取当前查询的页数 getTotalPages(); //获取总页数 getPageSize(); //获取每页显示的数据数量 getTotalRows(); //获取总记录数 getList(); //获取目标数据,也就是我们要查询的数据 SessionFactory factory=Factory.getSessionFactory("classpath:config.xml"); //获取session工厂 SqlSession session=factory.openSession(); //打开session连接 开始操作 try { PageInfo temp=session.Get(User.class,3,10); //分页查询开始 用封装好的pageInfo接收查询结果 session.Stop(); session.Close(); List<User> users=temp.getList(); for (User u :users){ System.out.println(u.toString()); } temp.description(); // System.out.println(" 结果:"+temp); } catch (SqlSessionException e) { e.printStackTrace(); } } [/pre]*/ /****************************************************/ /* github = github.com/chg122345/jleopard */ /* QQ = 80588183 */ /* jleopard暂时还没有maven依赖 */ /* github有发布的版本开发jar包 */ /***************************************************/ }
1473f4e35cfe1768814deaa249735f3c9647ea0d
782a1438f7b8dc0e1d569199490a75049bd4f5c3
/Car Sharing/Car Sharing/task/src/carsharing/CustomerAccount.java
4967564da1b818d13a53eb7fda41e6c6da214208
[]
no_license
shubha360/Hyperskill_Projects-Java
5bcd857c297ae4661cd29d27541cebd58a1700a8
ea04309168f446220173b07f77a8ee3526f3006f
refs/heads/main
2023-06-02T19:13:13.285056
2021-06-23T12:32:13
2021-06-23T12:32:13
346,686,810
8
3
null
null
null
null
UTF-8
Java
false
false
1,374
java
package carsharing; import java.util.Scanner; public class CustomerAccount { int id; String name; int rentedCarId; public CustomerAccount(int id, String name, int rentedCarId) { this.id = id; this.name = name; this.rentedCarId = rentedCarId; } public CustomerAccount(CustomerAccount customerAccount) { this.id = customerAccount.id; this.name = customerAccount.name; this.rentedCarId = customerAccount.rentedCarId; } void startInteraction() { Scanner scanner = new Scanner(System.in); while (true) { printCustomerMenu(); int selection = Integer.parseInt(scanner.nextLine()); System.out.println(); switch (selection) { case 1: DB_Handler.rentACar(this); break; case 2: DB_Handler.returnCar(this); break; case 3: DB_Handler.getCustomersRentedCar(this); break; case 0: return; } } } private void printCustomerMenu() { System.out.println("1. Rent a car\n" + "2. Return a rented car\n" + "3. My rented car\n" + "0. Back"); } }
c3a041ff19af9bb1e5b6752965edc9db0b1833d1
ae62c476c4e9e4415638863deb5e03fab5744853
/planesonar25/src/main/java/project/model/FlightLoader.java
daae2b50434d0cf3b3cdbb9ca5c76b4fdd530a8f
[]
no_license
DChaps14/PlaneSonar25
53b8a3b502c5f7aa4232a3e835ffa02c51506c27
a000386c0f2d1b0f12c97e3e924bf6dc25428244
refs/heads/main
2023-07-22T12:35:26.714087
2021-08-31T01:59:59
2021-08-31T01:59:59
401,538,845
0
0
null
null
null
null
UTF-8
Java
false
false
3,832
java
package project.model; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; /** * A Class that implements FlightLoader using methods to turn a .dat file containing Flight data into a * an Flight object to use for the record */ public class FlightLoader { /** * Loads a flight in from a particular file and appends the: statuses, locations, altitudes, latitudes * and longitudes to arraylists, which are returned in the Flight object. * * @param path The path at which the flight file is contained. * @return The particular flight being loaded in, which may contain some null values. * @throws IOException If the flight file loaded is invalid. */ public Flight loadFlightFile(String path) throws IOException { ArrayList<String> statuses = new ArrayList<String>(); ArrayList<String> locations = new ArrayList<String>(); ArrayList<Integer> altitudes = new ArrayList<Integer>(); ArrayList<Double> latitudes = new ArrayList<Double>(); ArrayList<Double> longitudes = new ArrayList<Double>(); int risk = 0; // Placeholder BufferedReader dataReader = new BufferedReader(new FileReader(path)); boolean breaker = false; while (!breaker) { String row = dataReader.readLine(); if (row == null) { breaker = true; } else { String[] data = row.split(","); String status; try { status = data[0]; } catch (Exception e) { status = null; } String location; try { location = data[1]; } catch (Exception e) { location = null; } int altitude; try { altitude = Integer.parseInt(data[2]); } catch (Exception e) { altitude = -1; } double latitude; try { latitude = Double.parseDouble(data[3]); } catch (Exception e) { latitude = 360; // Error case, latitude can't be 360. } double longitude; try { longitude = Double.parseDouble(data[4]); } catch (Exception e) { longitude = 360; // Error case, longitude can't be 360. } statuses.add(status); locations.add(location); altitudes.add(altitude); latitudes.add(latitude); longitudes.add(longitude); } } dataReader.close(); return new Flight(latitudes, longitudes, altitudes, locations, statuses, risk); } /** * Checks to make sure that the flight has the exact number of attributes to be a * valid flight. * * @param path The path at which the flight file is contained. * @return true if the flight has exactly 5 attributes, false otherwise. * @throws IOException If the flight loaded is invalid. */ public boolean loadFlightErrorCheck(String path) throws IOException { BufferedReader dataReader = new BufferedReader(new FileReader(path)); String row = dataReader.readLine(); if (row == null) { return false; } else { String[] data = row.split(","); if (data.length == 5) { return true; } } dataReader.close(); return false; } }
91b5a0ad72639540550472ee1dffcdbd58cf5d71
d56975dd9b322ae1687d5d8e9b656330c9baa927
/user-batics-server/src/main/java/com/vendor/service/IUserService.java
4317769728a9bd62c5c95b4b30c76db441c4bd29
[]
no_license
lipengyao2016/vendorSystem
04545bf50c5bdf92ba820dbe9b6c43ab92c56b59
9a2e5b57c5401ad97e0783fa59275ac349bd49aa
refs/heads/master
2022-06-26T14:45:47.679464
2019-06-17T08:11:43
2019-06-17T08:11:43
185,566,011
0
0
null
2022-06-21T01:08:52
2019-05-08T08:36:54
Lua
UTF-8
Java
false
false
587
java
package com.vendor.service; import com.vendor.entity.ListResponse; import com.vendor.bean.user.UserRoleOrgs; import com.vendor.bean.user.Users; import com.vendor.queryvo.user.UserCreateVo; import com.vendor.queryvo.user.UserQueryVo; import com.vendor.bean.user.UserRoleOrgQueryVo; public interface IUserService extends IBaseService<Users,UserQueryVo> { public Users create(UserCreateVo userCreateVo); public Users update(UserCreateVo userCreateVo); public ListResponse<UserRoleOrgs> getUserRole(UserRoleOrgQueryVo userRoleOrgQueryVo, Integer page, Integer rows); }
69a59c31fd275a20c698522e98b5e14a42bb670e
67cb2770ae5fcf7ba800c473c4d908cd9f8f8065
/src/main/java/dymn/demo/exception/BaseException.java
5091ad0e883d9017212dfbbd39c666479f59b7c7
[]
no_license
gregorio67/spring-boot
4dad2f7307d6792fa67934c5ea1ed262a7a4dfd1
ccb76f5fa883364f4ab52684a76b6d98a5ce70d2
refs/heads/master
2020-03-28T02:52:51.621534
2018-09-06T02:14:00
2018-09-06T02:14:00
147,604,620
0
0
null
null
null
null
UTF-8
Java
false
false
2,638
java
package dymn.demo.exception; import java.io.PrintWriter; import java.io.StringWriter; import java.util.Locale; import org.springframework.context.MessageSource; public class BaseException extends RuntimeException { private static final long serialVersionUID = 1L; private String message; private String code; private Object[] param; public BaseException() { super(); message = ""; code = ""; param = null;; } public BaseException(String message) { super(message); this.code = ""; this.param = null; this.message = message; } public BaseException(String code, Object[] param) { super(); this.message=""; this.code = code; this.param = param; } public BaseException(Throwable cause) { super(cause); this.message = ""; this.code = ""; this.param = null; } public BaseException(String code, String message) { super(message); this.message = message; this.code = code; this.param = null; } public BaseException(String code, String message, Object[] param) { super(message); this.message = message; this.code = code; this.param = param; } public BaseException(String message, Throwable cause) { super(message, cause); this.message = ""; this.code = ""; this.message = message; } public BaseException(String code, MessageSource messageSource) { this(messageSource.getMessage(code, null, Locale.getDefault())); this.code = code; } public BaseException(String code, MessageSource messageSource, Object messageParameters[]) { this(messageSource.getMessage(code, messageParameters, Locale.getDefault())); this.code = code; } public BaseException(String code, MessageSource messageSource, Object messageParameters[], Locale locale) { this(messageSource.getMessage(code, messageParameters, locale)); this.code = code; } public String getMessage() { return message; } protected void setMessage(String message) { this.message = message; } protected void setCode(String code) { this.code = code; } public String getCode() { return code; } public Object[] getParam() { return param; } public void setParam(Object[] param) { this.param = param; } public Throwable getRootCause() { Throwable tempCause; for (tempCause = getCause(); tempCause != null && tempCause.getCause() != null; tempCause = tempCause .getCause()) ; return tempCause; } public String getStackTraceString() { StringWriter s = new StringWriter(); super.printStackTrace(new PrintWriter(s)); return s.toString(); } public void printStackTrace(PrintWriter log) { log.println(getStackTraceString()); } }
9d4eba6d85a5cc03fec0dfc23ffa02d0f1943e88
9e82f75a6fea6e3a00310ac0beb1414d4ca8bde6
/src/com/metacube/questionbank/controller/UserController.java
8f99cdbfb1330cf79041aa0f471014372a805792
[]
no_license
laveenaBachani/QuestionBank
56717fa414d136556a85167abe19c211e982aa8f
6d7db78b90897a0f8134e87e1df905c8b8696cb7
refs/heads/master
2021-08-30T11:46:50.391471
2017-12-17T20:27:24
2017-12-17T20:27:24
105,613,986
0
0
null
null
null
null
UTF-8
Java
false
false
4,354
java
package com.metacube.questionbank.controller; import javax.mail.internet.MimeMessage; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; //import net.tanesha.recaptcha.ReCaptchaImpl; //import net.tanesha.recaptcha.ReCaptchaResponse; import net.tanesha.recaptcha.ReCaptchaImpl; import net.tanesha.recaptcha.ReCaptchaResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mail.javamail.JavaMailSenderImpl; import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.mail.javamail.MimeMessagePreparator; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import com.metacube.questionbank.model.User; import com.metacube.questionbank.service.impl.UserServiceImpl; import com.metacube.questionbank.utility.Validator; @Controller public class UserController { String password =""; @Autowired UserServiceImpl userservice; @Autowired private JavaMailSenderImpl mailSender; @RequestMapping(value="register") public ModelAndView registerPerson() { return new ModelAndView("register"); } @RequestMapping(value="insert",method=RequestMethod.POST) public ModelAndView insertData(User user,HttpServletRequest request) { ReCaptchaImpl captcha = new ReCaptchaImpl(); captcha.setPrivateKey("6Lel2PsSAAAAAGpmnVpRQURTVFlPXeVv4b_CUXbF"); String challenge = request.getParameter("recaptcha_challenge_field"); String uresponse = request.getParameter("recaptcha_response_field"); ReCaptchaResponse reCaptchaResponse = captcha.checkAnswer(request.getRemoteAddr(), challenge, uresponse ); String error="There was a problem in registering"; if(user ==null) { return new ModelAndView("register","error",error); } else if(reCaptchaResponse.isValid()) { userservice.insertUser(user); } else { return new ModelAndView("register","error",error +"invalid captacha"); } return new ModelAndView("home"); } @RequestMapping(value="edit") public ModelAndView editUserDetails(User user) { userservice.updateDetails(user); return new ModelAndView("viewDetails"); } @RequestMapping(value="forgotpassword.htm",method=RequestMethod.GET) public ModelAndView forgotPasswordPage() { System.out.println("in forgotpassword get requ"); return new ModelAndView("forgotpassword"); } @RequestMapping(value="forgotpassword.htm",method=RequestMethod.POST) public ModelAndView forgotpassword(HttpServletRequest request ) { String to_address= request.getParameter("email"); if(password.isEmpty()) { return new ModelAndView("forgotpassword").addObject("error","invalid status"); } else { // takes input from e-mail form String subject="Password Recovery"; // forwards to the view named "Result" mailSender.send(new MimeMessagePreparator() { public void prepare(MimeMessage mimeMessage) throws Exception { MimeMessageHelper messageHelper = new MimeMessageHelper( mimeMessage, true, "UTF-8"); messageHelper.setTo(to_address); messageHelper.setSubject(subject); messageHelper.setText(password); } }); return new ModelAndView("Index"); } } @RequestMapping(value="login.htm") public ModelAndView loginpage() { return new ModelAndView("login"); } @RequestMapping(value="loginuser.htm" ,method=RequestMethod.POST) public ModelAndView loginuser(User user,HttpServletRequest request,HttpSession httpSession) { boolean flag=false; if(Validator.Email(user.getEmail()) && Validator.checkEmpty(user.getPassword())) { User tempref=userservice.authenticate(user); if(tempref!=null) { System.out.println(tempref.getEmail() + "EMail in controller "); System.out.println(tempref.getName() + "name "); httpSession.setAttribute("user",user); return new ModelAndView("index","user",httpSession); } else { return new ModelAndView("login","error","unautho"); } } else { return new ModelAndView("login"); } } }
db17a6b203f9bbb6acadb91d72a6a4c3720a307a
2e93bf4173c590b430949a06319a945b6c4b1143
/hibernate-inheritance/src/com/hexaware/DBUtility.java
f57a7070e1ae1685bec09ca6d9599116aac43142
[]
no_license
priyanshudaksh-projects/Hibernate
7896e1a9724f95539ef44347d20ed0f50194d0bd
046f2c23c9f248f543a861e51002950b8a15d87c
refs/heads/master
2022-12-02T23:58:35.167580
2019-11-21T13:23:51
2019-11-21T13:23:51
222,623,789
0
0
null
2022-11-24T06:19:28
2019-11-19T06:23:24
Java
UTF-8
Java
false
false
320
java
package com.hexaware; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; public class DBUtility { public static SessionFactory createSessionFactory() { Configuration config = new Configuration(); config.configure(); SessionFactory sf = config.buildSessionFactory(); return sf; } }
11f8390603d1ba239eec5ca5f7a6285364cf359a
2a541959ca43a6819046643c2a1a018ac187115c
/src/java/org/dom4j/io/SAXModifier.java
818fe42b468fe2825179b6f06d8f9f3ed2bc31b9
[ "Plexus" ]
permissive
jenkinsci/dom4j
0f156d7562fd06e52daf0e83f69323c56a61050d
d309ee334f29a01e3fe6cc59512629284de32d82
refs/heads/patched
2023-06-02T04:51:54.331307
2017-11-27T20:29:12
2017-11-27T20:29:12
501,730
3
10
NOASSERTION
2020-02-11T01:59:00
2010-02-04T02:19:17
Java
UTF-8
Java
false
false
15,348
java
/* * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved. * * This software is open source. * See the bottom of this file for the licence. */ package org.dom4j.io; import java.io.File; import java.io.InputStream; import java.io.Reader; import java.net.URL; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.DocumentFactory; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; /** * The SAXModifier reads, modifies and writes XML documents using SAX. * * <p> * Registered {@link ElementModifier}objects can provide modifications to (part * of) the xml tree, while the document is still being processed. This makes it * possible to change large xml documents without having them in memory. * </p> * * <p> * The modified document is written when the {@link XMLWriter}is specified. * </p> * * @author Wonne Keysers (Realsoftware.be) * * @see org.dom4j.io.SAXReader * @see org.dom4j.io.XMLWriter */ public class SAXModifier { private XMLWriter xmlWriter; private XMLReader xmlReader; private boolean pruneElements; private SAXModifyReader modifyReader; private HashMap modifiers = new HashMap(); /** * Creates a new modifier. <br> * The XMLReader to parse the source will be created via the * org.xml.sax.driver system property or JAXP if the system property is not * set. */ public SAXModifier() { } /** * Creates a new modifier. <br> * The XMLReader to parse the source will be created via the * org.xml.sax.driver system property or JAXP if the system property is not * set. * * @param pruneElements * Set to true when the modified document must NOT be kept in * memory. */ public SAXModifier(boolean pruneElements) { this.pruneElements = pruneElements; } /** * Creates a new modifier that will the specified {@link * org.xml.sax.XMLReader} to parse the source. * * @param xmlReader * The XMLReader to use */ public SAXModifier(XMLReader xmlReader) { this.xmlReader = xmlReader; } /** * Creates a new modifier that will the specified {@link * org.xml.sax.XMLReader} to parse the source. * * @param xmlReader * The XMLReader to use * @param pruneElements * Set to true when the modified document must NOT be kept in * memory. */ public SAXModifier(XMLReader xmlReader, boolean pruneElements) { this.xmlReader = xmlReader; } /** * Reads a Document from the given {@link java.io.File}and writes it to the * specified {@link XMLWriter}using SAX. Registered {@linkElementModifier} * objects are invoked on the fly. * * @param source * is the <code>File</code> to read from. * * @return the newly created Document instance * * @throws DocumentException * DocumentException org.dom4j.DocumentException} if an error * occurs during parsing. */ public Document modify(File source) throws DocumentException { try { return installModifyReader().read(source); } catch (SAXModifyException ex) { Throwable cause = ex.getCause(); throw new DocumentException(cause.getMessage(), cause); } } /** * Reads a Document from the given {@link org.xml.sax.InputSource}and * writes it to the specified {@link XMLWriter}using SAX. Registered * {@link ElementModifier}objects are invoked on the fly. * * @param source * is the <code>org.xml.sax.InputSource</code> to read from. * * @return the newly created Document instance * * @throws DocumentException * DocumentException org.dom4j.DocumentException} if an error * occurs during parsing. */ public Document modify(InputSource source) throws DocumentException { try { return installModifyReader().read(source); } catch (SAXModifyException ex) { Throwable cause = ex.getCause(); throw new DocumentException(cause.getMessage(), cause); } } /** * Reads a Document from the given {@link java.io.InputStream}and writes it * to the specified {@link XMLWriter}using SAX. Registered {@link * ElementModifier} objects are invoked on the fly. * * @param source * is the <code>java.io.InputStream</code> to read from. * * @return the newly created Document instance * * @throws DocumentException * DocumentException org.dom4j.DocumentException} if an error * occurs during parsing. */ public Document modify(InputStream source) throws DocumentException { try { return installModifyReader().read(source); } catch (SAXModifyException ex) { Throwable cause = ex.getCause(); throw new DocumentException(cause.getMessage(), cause); } } /** * Reads a Document from the given {@link java.io.InputStream}and writes it * to the specified {@link XMLWriter}using SAX. Registered {@link * ElementModifier} objects are invoked on the fly. * * @param source * is the <code>java.io.InputStream</code> to read from. * @param systemId * DOCUMENT ME! * * @return the newly created Document instance * * @throws DocumentException * DocumentException org.dom4j.DocumentException} if an error * occurs during parsing. */ public Document modify(InputStream source, String systemId) throws DocumentException { try { return installModifyReader().read(source); } catch (SAXModifyException ex) { Throwable cause = ex.getCause(); throw new DocumentException(cause.getMessage(), cause); } } /** * Reads a Document from the given {@link java.io.Reader}and writes it to * the specified {@link XMLWriter}using SAX. Registered {@link * ElementModifier} objects are invoked on the fly. * * @param source * is the <code>java.io.Reader</code> to read from. * * @return the newly created Document instance * * @throws DocumentException * DocumentException org.dom4j.DocumentException} if an error * occurs during parsing. */ public Document modify(Reader source) throws DocumentException { try { return installModifyReader().read(source); } catch (SAXModifyException ex) { Throwable cause = ex.getCause(); throw new DocumentException(cause.getMessage(), cause); } } /** * Reads a Document from the given {@link java.io.Reader}and writes it to * the specified {@link XMLWriter}using SAX. Registered {@link * ElementModifier} objects are invoked on the fly. * * @param source * is the <code>java.io.Reader</code> to read from. * @param systemId * DOCUMENT ME! * * @return the newly created Document instance * * @throws DocumentException * DocumentException org.dom4j.DocumentException} if an error * occurs during parsing. */ public Document modify(Reader source, String systemId) throws DocumentException { try { return installModifyReader().read(source); } catch (SAXModifyException ex) { Throwable cause = ex.getCause(); throw new DocumentException(cause.getMessage(), cause); } } /** * Reads a Document from the given {@link java.net.URL}and writes it to the * specified {@link XMLWriter}using SAX. Registered {@linkElementModifier} * objects are invoked on the fly. * * @param source * is the <code>java.net.URL</code> to read from. * * @return the newly created Document instance * * @throws DocumentException * DocumentException org.dom4j.DocumentException} if an error * occurs during parsing. */ public Document modify(URL source) throws DocumentException { try { return installModifyReader().read(source); } catch (SAXModifyException ex) { Throwable cause = ex.getCause(); throw new DocumentException(cause.getMessage(), cause); } } /** * Reads a Document from the given URL or filename and writes it to the * specified {@link XMLWriter}using SAX. Registered {@linkElementModifier} * objects are invoked on the fly. * * @param source * is the URL or filename to read from. * * @return the newly created Document instance * * @throws DocumentException * DocumentException org.dom4j.DocumentException} if an error * occurs during parsing. */ public Document modify(String source) throws DocumentException { try { return installModifyReader().read(source); } catch (SAXModifyException ex) { Throwable cause = ex.getCause(); throw new DocumentException(cause.getMessage(), cause); } } /** * Adds the {@link ElementModifier}to be called when the specified element * path is encounted while parsing the source. * * @param path * The element path to be handled * @param modifier * The {@link ElementModifier}to be called by the event based * processor. */ public void addModifier(String path, ElementModifier modifier) { this.modifiers.put(path, modifier); } /** * Removes all registered {@link ElementModifier}instances from the event * based processor. */ public void resetModifiers() { this.modifiers.clear(); getSAXModifyReader().resetHandlers(); } /** * Removes the {@link ElementModifier}from the event based processor, for * the specified element path. * * @param path * The path to remove the {@link ElementModifier}for. */ public void removeModifier(String path) { this.modifiers.remove(path); getSAXModifyReader().removeHandler(path); } /** * Get the {@link org.dom4j.DocumentFactory}used to create the DOM4J * document structure * * @return <code>DocumentFactory</code> that will be used */ public DocumentFactory getDocumentFactory() { return getSAXModifyReader().getDocumentFactory(); } /** * Sets the {@link org.dom4j.DocumentFactory}used to create the DOM4J * document tree. * * @param factory * <code>DocumentFactory</code> to be used */ public void setDocumentFactory(DocumentFactory factory) { getSAXModifyReader().setDocumentFactory(factory); } /** * Returns the current {@link XMLWriter}. * * @return XMLWriter */ public XMLWriter getXMLWriter() { return this.xmlWriter; } /** * Sets the {@link XMLWriter}used to write the modified document. * * @param writer * The writer to use. */ public void setXMLWriter(XMLWriter writer) { this.xmlWriter = writer; } /** * Returns true when xml elements are not kept in memory while parsing. The * {@link org.dom4j.Document}returned by the modify methods will be null. * * @return Returns the pruneElements. */ public boolean isPruneElements() { return pruneElements; } private SAXReader installModifyReader() throws DocumentException { try { SAXModifyReader reader = getSAXModifyReader(); if (isPruneElements()) { modifyReader.setDispatchHandler(new PruningDispatchHandler()); } reader.resetHandlers(); Iterator modifierIt = this.modifiers.entrySet().iterator(); while (modifierIt.hasNext()) { Map.Entry entry = (Map.Entry) modifierIt.next(); SAXModifyElementHandler handler = new SAXModifyElementHandler( (ElementModifier) entry.getValue()); reader.addHandler((String) entry.getKey(), handler); } reader.setXMLWriter(getXMLWriter()); reader.setXMLReader(getXMLReader()); return reader; } catch (SAXException ex) { throw new DocumentException(ex.getMessage(), ex); } } private XMLReader getXMLReader() throws SAXException { if (this.xmlReader == null) { xmlReader = SAXHelper.createXMLReader(false); } return this.xmlReader; } private SAXModifyReader getSAXModifyReader() { if (modifyReader == null) { modifyReader = new SAXModifyReader(); } return modifyReader; } } /* * Redistribution and use of this software and associated documentation * ("Software"), with or without modification, are permitted provided that the * following conditions are met: * * 1. Redistributions of source code must retain copyright statements and * notices. Redistributions must also contain a copy of this document. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The name "DOM4J" must not be used to endorse or promote products derived * from this Software without prior written permission of MetaStuff, Ltd. For * written permission, please contact [email protected]. * * 4. Products derived from this Software may not be called "DOM4J" nor may * "DOM4J" appear in their names without prior written permission of MetaStuff, * Ltd. DOM4J is a registered trademark of MetaStuff, Ltd. * * 5. Due credit should be given to the DOM4J Project - http://www.dom4j.org * * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved. */
ab0d4fb2cb864ed1abcd9558b70bc10f551fb7bf
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-14263-38-29-PESA_II-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/internal/template/DefaultTemplateManager_ESTest_scaffolding.java
628debb50e4ad00e89079667eea6217a2f26d220
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
458
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Sat Apr 04 05:49:03 UTC 2020 */ package com.xpn.xwiki.internal.template; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class DefaultTemplateManager_ESTest_scaffolding { // Empty scaffolding for empty test suite }
a2a9b0e876b0907a1026ee4628d5a2cae6ade5dc
ec2f1b12cf0c75f5d367d8463e0bea14ad44f57a
/app/serviceImpl/RecommendationServiceImpl.java
4b33631953092e3bdac259cbdb8228ef2f1724c6
[ "Apache-2.0" ]
permissive
SeWitt/StoreNRent
2358177e34a273ba018f9dda6cfd25529f43523f
277258ba0983d0f794a50cad8af0995841070c22
refs/heads/master
2021-01-21T08:01:50.689888
2014-06-29T22:06:25
2014-06-29T22:06:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,430
java
package serviceImpl; import java.util.Date; import java.util.List; import service.RecommendationService; import repository.RecommendationRepository; import models.Person; import models.Recommendation; import models.RecommendationSummary; /** * @author Sebastian * @version 1.0 * @created 23-Mai-2014 16:53:27 */ public class RecommendationServiceImpl implements RecommendationService { private RecommendationRepository recommRepo = new RecommendationRepository();; public RecommendationServiceImpl(){ } @Override public Recommendation createRecommendation(Recommendation recomm) { recomm.createdDate = new Date(); recomm.isActive = true; recomm.lastEditedDate = recomm.createdDate; return recommRepo.createRecommendation(recomm); } @Override public Recommendation updateRecommendation(Recommendation recomm) { if(recomm.isActive = true){ recomm.lastEditedDate = new Date(); recomm = recommRepo.updateRecommendation(recomm); } return recomm; } @Override public void deleteRecommendation(Recommendation recomm) { recomm.isActive = false; recommRepo.updateRecommendation(recomm); } @Override public RecommendationSummary getRecommendationSummary(Person person) { return recommRepo.getRecommendationSummary(person); } @Override public List<Recommendation> findRecommendationsByReceiver(Person person) { return recommRepo.findRecommendationByReceiver(person); } }
e9f06c3ed43d5dd7a5d4dbfdba9a6f2acdce4fd0
8613229c0dbfe5018245136aaa88859fc07325cc
/src/SimpleTomcat/Server/ServletInstance/Shutdown.java
7f941eae20119681a41f7b427cc8cb1d2a0aca4f
[]
no_license
shangyin/SimpleTest
27c2d0c67e4af82f35f72398703adec4ab42578e
c5bfe867ec2862259bada5aedf750a36b3900187
refs/heads/master
2020-07-08T00:00:54.628347
2016-09-11T08:08:58
2016-09-11T08:08:58
67,815,528
0
0
null
null
null
null
UTF-8
Java
false
false
427
java
package SimpleTomcat.Server.ServletInstance; import SimpleTomcat.Server.Request; import SimpleTomcat.Server.Response; import static SimpleTomcat.Util.*; /** * Created by 41237 on 2016/7/12. */ public class Shutdown implements Servlet { @Override public void service(Request request, Response response) { init.write2Db(); response.addPara(CODE, ANSWER_PERMIT); response.flush(); } }
82dbcd42e56a376bfb569485080ed662418fb0ff
a5d8ad024ca0085e79c5aaf0d2d0f758587ee3fa
/multithreadprogramming/src/chapter02/section03/thread_2_3_7/project_1_synchronizedUpdateNewValue/ThreadB.java
b4e6e913011a79c59e4bb583c3da0dc1c6b5673b
[ "Apache-2.0" ]
permissive
youaresherlock/multithreadingforjavanotes
12f99b19ed08b38466af31b993add67e8aff3818
b93b32f97f1d989ede69fdf39ab86687556828de
refs/heads/master
2020-03-27T06:28:01.585537
2018-11-05T14:42:15
2018-11-05T14:42:15
146,108,281
0
0
null
null
null
null
UTF-8
Java
false
false
282
java
package chapter02.section03.thread_2_3_7.project_1_synchronizedUpdateNewValue; public class ThreadB extends Thread{ private Service service; public ThreadB(Service service) { super(); this.service = service; } @Override public void run() { service.stopMethod(); } }
4a6408674e1ce7533e1767547ea203b340423763
8299350cf0b5167ba0246ffa745f89c433510d4c
/src/main/java/cybersoft/project/Elearning/role/service/RoleGroupServiceimpl.java
4e2c687096d7bb923eeacffb3c886f79694d2798
[]
no_license
lenguyenkhang1904/Elearning-main
7e96c39f0f5302a1264cdfad1a5450cc4b0b5230
364fedfcf0bbeefa982d5bbc7db67c2ee6579ef7
refs/heads/main
2023-07-11T07:15:20.723346
2021-08-29T14:06:51
2021-08-29T14:06:51
401,053,250
0
0
null
null
null
null
UTF-8
Java
false
false
1,169
java
package cybersoft.project.Elearning.role.service; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import cybersoft.project.Elearning.role.dto.RoleDto; import cybersoft.project.Elearning.role.model.Role; import cybersoft.project.Elearning.role.model.RoleGroup; import cybersoft.project.Elearning.role.repository.RoleGroupRepository; import cybersoft.project.Elearning.role.repository.RoleRepository; @Service public class RoleGroupServiceimpl implements RoleGroupService { @Autowired private RoleGroupRepository repository; @Autowired private RoleRepository repositoryRole; @Override public RoleGroup addRole(@Valid Role role, Long groupId) { // TODO Auto-generated method stub RoleGroup roleGroup=repository.getOne(groupId); roleGroup.addRole(role); return repository.save(roleGroup); } @Override public RoleGroup updateRoleInfo(@Valid RoleDto dto, Long roleid) { // TODO Auto-generated method stub return null; } @Override public void deleteRole(Long roleid) { // TODO Auto-generated method stub } }
064be35422e6b1ecf470ed7e92aa50aba6fc08b3
08be78ee28957fe393bea727228fbe13e5c00df1
/modules/webcloud/modules/webcloud-pseudocode/src/main/java/com/pseudocode/netflix/hystrix/core/HystrixCircuitBreaker.java
4adfdc439392eb87dbdc5bfa6feae42e85fcd9cc
[]
no_license
javachengwc/java-apply
432259eadfca88c6f3f2b80aae8e1e8a93df5159
98a45c716f18657f0e4181d0c125a73feb402b16
refs/heads/master
2023-08-22T12:30:05.708710
2023-08-15T08:21:15
2023-08-15T08:21:15
54,971,501
10
4
null
2022-12-16T11:03:56
2016-03-29T11:50:21
Java
UTF-8
Java
false
false
9,499
java
package com.pseudocode.netflix.hystrix.core; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import com.pseudocode.netflix.hystrix.core.HystrixCommandMetrics.HealthCounts; import rx.Subscriber; import rx.Subscription; //hystrix断路器 public interface HystrixCircuitBreaker { boolean allowRequest(); boolean isOpen(); void markSuccess(); void markNonSuccess(); //是否可执行正常逻辑 boolean attemptExecution(); class Factory { private static ConcurrentHashMap<String, HystrixCircuitBreaker> circuitBreakersByCommand = new ConcurrentHashMap<String, HystrixCircuitBreaker>(); public static HystrixCircuitBreaker getInstance(HystrixCommandKey key, HystrixCommandGroupKey group, HystrixCommandProperties properties, HystrixCommandMetrics metrics) { HystrixCircuitBreaker previouslyCached = circuitBreakersByCommand.get(key.name()); if (previouslyCached != null) { return previouslyCached; } HystrixCircuitBreaker cbForCommand = circuitBreakersByCommand.putIfAbsent(key.name(), new HystrixCircuitBreakerImpl(key, group, properties, metrics)); if (cbForCommand == null) { return circuitBreakersByCommand.get(key.name()); } else { return cbForCommand; } } public static HystrixCircuitBreaker getInstance(HystrixCommandKey key) { return circuitBreakersByCommand.get(key.name()); } static void reset() { circuitBreakersByCommand.clear(); } } //完整的断路器实现 class HystrixCircuitBreakerImpl implements HystrixCircuitBreaker { //配置 private final HystrixCommandProperties properties; //统计信息 private final HystrixCommandMetrics metrics; //状态枚举,关,开,半开 enum Status { CLOSED, OPEN, HALF_OPEN; } //状态 private final AtomicReference<Status> status = new AtomicReference<Status>(Status.CLOSED); //断路器打开时间 private final AtomicLong circuitOpened = new AtomicLong(-1); //当前统计的订阅 private final AtomicReference<Subscription> activeSubscription = new AtomicReference<Subscription>(null); protected HystrixCircuitBreakerImpl(HystrixCommandKey key, HystrixCommandGroupKey commandGroup, final HystrixCommandProperties properties, HystrixCommandMetrics metrics) { this.properties = properties; this.metrics = metrics; //On a timer, this will set the circuit between OPEN/CLOSED as command executions occur //订阅统计 Subscription s = subscribeToStream(); activeSubscription.set(s); } //向HystrixMetrics对请求量统计Observable发起订阅 private Subscription subscribeToStream() { return metrics.getHealthCountsStream() .observe() .subscribe(new Subscriber<HealthCounts>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { } @Override public void onNext(HealthCounts hc) { // check if we are past the statisticalWindowVolumeThreshold if (hc.getTotalRequests() < properties.circuitBreakerRequestVolumeThreshold().get()) { //请求量没超过20,20是默认值 // we are not past the minimum volume threshold for the stat window, // so no change to circuit status. // if it was CLOSED, it stays CLOSED // if it was half-open, we need to wait for a successful command execution // if it was open, we need to wait for sleep window to elapse } else { if (hc.getErrorPercentage() < properties.circuitBreakerErrorThresholdPercentage().get()) { //错误率没超过50% //we are not past the minimum error threshold for the stat window, // so no change to circuit status. // if it was CLOSED, it stays CLOSED // if it was half-open, we need to wait for a successful command execution // if it was open, we need to wait for sleep window to elapse } else { // our failure rate is too high, we need to set the state to OPEN if (status.compareAndSet(Status.CLOSED, Status.OPEN)) { //断路器打开 circuitOpened.set(System.currentTimeMillis()); } } } } }); } //尝试调用正常逻辑成功,半开变成关闭,关闭断路器 @Override public void markSuccess() { if (status.compareAndSet(Status.HALF_OPEN, Status.CLOSED)) { //This thread wins the race to close the circuit - it resets the stream to start it over from 0 //统计重置 metrics.resetStream(); //取消之前的订阅 Subscription previousSubscription = activeSubscription.get(); if (previousSubscription != null) { previousSubscription.unsubscribe(); } //重新订阅 Subscription newSubscription = subscribeToStream(); activeSubscription.set(newSubscription); //打开时间初始 circuitOpened.set(-1L); } } //尝试调用正常逻辑失败,半开变成打开,重新打开断路器 @Override public void markNonSuccess() { if (status.compareAndSet(Status.HALF_OPEN, Status.OPEN)) { //This thread wins the race to re-open the circuit - it resets the start time for the sleep window circuitOpened.set(System.currentTimeMillis()); } } //断路器是否打开 @Override public boolean isOpen() { if (properties.circuitBreakerForceOpen().get()) { return true; } if (properties.circuitBreakerForceClosed().get()) { return false; } return circuitOpened.get() >= 0; } @Override public boolean allowRequest() { if (properties.circuitBreakerForceOpen().get()) { return false; } if (properties.circuitBreakerForceClosed().get()) { return true; } if (circuitOpened.get() == -1) { return true; } else { if (status.get().equals(Status.HALF_OPEN)) { return false; } else { return isAfterSleepWindow(); } } } //开启断路器5秒钟后,状态变成半开状态 private boolean isAfterSleepWindow() { final long circuitOpenTime = circuitOpened.get(); final long currentTime = System.currentTimeMillis(); final long sleepWindowTime = properties.circuitBreakerSleepWindowInMilliseconds().get(); return currentTime > circuitOpenTime + sleepWindowTime; } //是否可执行正常逻辑 @Override public boolean attemptExecution() { if (properties.circuitBreakerForceOpen().get()) { return false; } if (properties.circuitBreakerForceClosed().get()) { return true; } if (circuitOpened.get() == -1) { return true; } else { if (isAfterSleepWindow()) { //半开 if (status.compareAndSet(Status.OPEN, Status.HALF_OPEN)) { //only the first request after sleep window should execute return true; } else { return false; } } else { return false; } } } } //空的断路器实现 class NoOpCircuitBreaker implements HystrixCircuitBreaker { @Override public boolean allowRequest() { return true; } @Override public boolean isOpen() { return false; } @Override public void markSuccess() { } @Override public void markNonSuccess() { } @Override public boolean attemptExecution() { return true; } } }
2bf069b71d9aea37b9f22ee25fcc9e3cab02b01f
6d6a2896e206089fed182d93f60e0691126d889c
/weka/main/java/weka/attributeSelection/CostSensitiveASEvaluation.java
bcf4a9c9fdaaadc09597fe4cf43b5dae1d3206e8
[]
no_license
azizisya/benhesrc
2291c9d9cb22171f4e382968c14721d440bbabf2
4bd27c1f6e91b2aec1bd71f0810d1bbd0db902b5
refs/heads/master
2020-05-18T08:53:54.800452
2011-02-24T09:41:17
2011-02-24T09:41:17
34,458,592
2
0
null
null
null
null
UTF-8
Java
false
false
17,976
java
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * CostSensitiveASEvaluation.java * Copyright (C) 2008 Pentaho Corporation * */ package weka.attributeSelection; import weka.core.Capabilities; import weka.core.Instance; import weka.core.Instances; import weka.core.Option; import weka.core.OptionHandler; import weka.core.Utils; import weka.core.Capabilities.Capability; import weka.core.SelectedTag; import weka.core.Tag; import weka.classifiers.CostMatrix; import weka.core.WeightedInstancesHandler; import weka.core.RevisionUtils; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.StringReader; import java.io.StringWriter; import java.io.Serializable; import java.util.Enumeration; import java.util.Random; import java.util.Vector; import java.util.ArrayList; /** * Abstract base class for cost-sensitive subset and attribute evaluators. * * @author Mark Hall (mhall{[at]}pentaho{[dot]}com) * @version $Revision: 1.1 $ */ public abstract class CostSensitiveASEvaluation extends ASEvaluation implements OptionHandler, Serializable { /** for serialization */ static final long serialVersionUID = -7045833833363396977L; /** load cost matrix on demand */ public static final int MATRIX_ON_DEMAND = 1; /** use explicit cost matrix */ public static final int MATRIX_SUPPLIED = 2; /** Specify possible sources of the cost matrix */ public static final Tag [] TAGS_MATRIX_SOURCE = { new Tag(MATRIX_ON_DEMAND, "Load cost matrix on demand"), new Tag(MATRIX_SUPPLIED, "Use explicit cost matrix") }; /** Indicates the current cost matrix source */ protected int m_MatrixSource = MATRIX_ON_DEMAND; /** * The directory used when loading cost files on demand, null indicates * current directory */ protected File m_OnDemandDirectory = new File(System.getProperty("user.dir")); /** The name of the cost file, for command line options */ protected String m_CostFile; /** The cost matrix */ protected CostMatrix m_CostMatrix = new CostMatrix(1); /** The base evaluator to use */ protected ASEvaluation m_evaluator; /** random number seed */ protected int m_seed = 1; /** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */ public Enumeration listOptions() { Vector newVector = new Vector(4); newVector.addElement(new Option( "\tFile name of a cost matrix to use. If this is not supplied,\n" +"\ta cost matrix will be loaded on demand. The name of the\n" +"\ton-demand file is the relation name of the training data\n" +"\tplus \".cost\", and the path to the on-demand file is\n" +"\tspecified with the -N option.", "C", 1, "-C <cost file name>")); newVector.addElement(new Option( "\tName of a directory to search for cost files when loading\n" +"\tcosts on demand (default current directory).", "N", 1, "-N <directory>")); newVector.addElement(new Option( "\tThe cost matrix in Matlab single line format.", "cost-matrix", 1, "-cost-matrix <matrix>")); newVector.addElement(new Option( "\tThe seed to use for random number generation.", "S", 1, "-S <integer>")); newVector.addElement(new Option( "\tFull name of base evaluator. Options after -- are " +"passed to the evaluator.\n" + "\t(default: " + defaultEvaluatorString() +")", "W", 1, "-W")); if (m_evaluator instanceof OptionHandler) { newVector.addElement(new Option( "", "", 0, "\nOptions specific to evaluator " + m_evaluator.getClass().getName() + ":")); Enumeration enu = ((OptionHandler)m_evaluator).listOptions(); while (enu.hasMoreElements()) { newVector.addElement(enu.nextElement()); } } return newVector.elements(); } /** * Parses a given list of options. <p/> * * Valid options are: <p/> * * <pre> -C &lt;cost file name&gt; * File name of a cost matrix to use. If this is not supplied, * a cost matrix will be loaded on demand. The name of the * on-demand file is the relation name of the training data * plus ".cost", and the path to the on-demand file is * specified with the -N option.</pre> * * <pre> -N &lt;directory&gt; * Name of a directory to search for cost files when loading * costs on demand (default current directory).</pre> * * <pre> -cost-matrix &lt;matrix&gt; * The cost matrix in Matlab single line format.</pre> * * <pre> -S &lt;integer&gt; * The seed to use for random number generation.</pre> * * <pre> -W * Full name of base evaluator. * (default: weka.attributeSelection.CfsSubsetEval)</pre> * * Options after -- are passed to the designated evaluator.<p> * * @param options the list of options as an array of strings * @throws Exception if an option is not supported */ public void setOptions(String[] options) throws Exception { String costFile = Utils.getOption('C', options); if (costFile.length() != 0) { try { setCostMatrix(new CostMatrix(new BufferedReader( new FileReader(costFile)))); } catch (Exception ex) { // now flag as possible old format cost matrix. Delay cost matrix // loading until buildClassifer is called setCostMatrix(null); } setCostMatrixSource(new SelectedTag(MATRIX_SUPPLIED, TAGS_MATRIX_SOURCE)); m_CostFile = costFile; } else { setCostMatrixSource(new SelectedTag(MATRIX_ON_DEMAND, TAGS_MATRIX_SOURCE)); } String demandDir = Utils.getOption('N', options); if (demandDir.length() != 0) { setOnDemandDirectory(new File(demandDir)); } String cost_matrix = Utils.getOption("cost-matrix", options); if (cost_matrix.length() != 0) { StringWriter writer = new StringWriter(); CostMatrix.parseMatlab(cost_matrix).write(writer); setCostMatrix(new CostMatrix(new StringReader(writer.toString()))); setCostMatrixSource(new SelectedTag(MATRIX_SUPPLIED, TAGS_MATRIX_SOURCE)); } String seed = Utils.getOption('S', options); if (seed.length() != 0) { setSeed(Integer.parseInt(seed)); } else { setSeed(1); } String evaluatorName = Utils.getOption('W', options); if (evaluatorName.length() > 0) { // This is just to set the evaluator in case the option // parsing fails. setEvaluator(ASEvaluation.forName(evaluatorName, null)); setEvaluator(ASEvaluation.forName(evaluatorName, Utils.partitionOptions(options))); } else { // This is just to set the classifier in case the option // parsing fails. setEvaluator(ASEvaluation.forName(defaultEvaluatorString(), null)); setEvaluator(ASEvaluation.forName(defaultEvaluatorString(), Utils.partitionOptions(options))); } } /** * Gets the current settings of the subset evaluator. * * @return an array of strings suitable for passing to setOptions */ public String[] getOptions() { ArrayList<String> options = new ArrayList<String>(); if (m_MatrixSource == MATRIX_SUPPLIED) { if (m_CostFile != null) { options.add("-C"); options.add("" + m_CostFile); } else { options.add("-cost-matrix"); options.add(getCostMatrix().toMatlab()); } } else { options.add("-N"); options.add("" + getOnDemandDirectory()); } options.add("-S"); options.add("" + getSeed()); options.add("-W"); options.add(m_evaluator.getClass().getName()); if (m_evaluator instanceof OptionHandler) { String[] evaluatorOptions = ((OptionHandler)m_evaluator).getOptions(); if (evaluatorOptions.length > 0) { options.add("--"); for (int i = 0; i < evaluatorOptions.length; i++) { options.add(evaluatorOptions[i]); } } } return options.toArray(new String[0]); } /** * @return a description of the classifier suitable for * displaying in the explorer/experimenter gui */ public String globalInfo() { return "A meta subset evaluator that makes its base subset evaluator cost-sensitive. "; } /** * Return the name of the default evaluator. * * @return the name of the default evaluator */ public String defaultEvaluatorString() { return "weka.attributeSelection.CfsSubsetEval"; } /** * @return tip text for this property suitable for * displaying in the explorer/experimenter gui */ public String costMatrixSourceTipText() { return "Sets where to get the cost matrix. The two options are" + "to use the supplied explicit cost matrix (the setting of the " + "costMatrix property), or to load a cost matrix from a file when " + "required (this file will be loaded from the directory set by the " + "onDemandDirectory property and will be named relation_name" + CostMatrix.FILE_EXTENSION + ")."; } /** * Gets the source location method of the cost matrix. Will be one of * MATRIX_ON_DEMAND or MATRIX_SUPPLIED. * * @return the cost matrix source. */ public SelectedTag getCostMatrixSource() { return new SelectedTag(m_MatrixSource, TAGS_MATRIX_SOURCE); } /** * Sets the source location of the cost matrix. Values other than * MATRIX_ON_DEMAND or MATRIX_SUPPLIED will be ignored. * * @param newMethod the cost matrix location method. */ public void setCostMatrixSource(SelectedTag newMethod) { if (newMethod.getTags() == TAGS_MATRIX_SOURCE) { m_MatrixSource = newMethod.getSelectedTag().getID(); } } /** * @return tip text for this property suitable for * displaying in the explorer/experimenter gui */ public String onDemandDirectoryTipText() { return "Sets the directory where cost files are loaded from. This option " + "is used when the costMatrixSource is set to \"On Demand\"."; } /** * Returns the directory that will be searched for cost files when * loading on demand. * * @return The cost file search directory. */ public File getOnDemandDirectory() { return m_OnDemandDirectory; } /** * Sets the directory that will be searched for cost files when * loading on demand. * * @param newDir The cost file search directory. */ public void setOnDemandDirectory(File newDir) { if (newDir.isDirectory()) { m_OnDemandDirectory = newDir; } else { m_OnDemandDirectory = new File(newDir.getParent()); } m_MatrixSource = MATRIX_ON_DEMAND; } /** * Gets the evaluator specification string, which contains the class name of * the evaluator and any options to the evaluator * * @return the evaluator string. */ protected String getEvaluatorSpec() { ASEvaluation ase = getEvaluator(); if (ase instanceof OptionHandler) { return ase.getClass().getName() + " " + Utils.joinOptions(((OptionHandler)ase).getOptions()); } return ase.getClass().getName(); } /** * @return tip text for this property suitable for * displaying in the explorer/experimenter gui */ public String costMatrixTipText() { return "Sets the cost matrix explicitly. This matrix is used if the " + "costMatrixSource property is set to \"Supplied\"."; } /** * Gets the misclassification cost matrix. * * @return the cost matrix */ public CostMatrix getCostMatrix() { return m_CostMatrix; } /** * Sets the misclassification cost matrix. * * @param newCostMatrix the cost matrix */ public void setCostMatrix(CostMatrix newCostMatrix) { m_CostMatrix = newCostMatrix; m_MatrixSource = MATRIX_SUPPLIED; } /** * Returns the tip text for this property * @return tip text for this property suitable for * displaying in the explorer/experimenter gui */ public String seedTipText() { return "The random number seed to be used."; } /** * Set the seed for random number generation. * * @param seed the seed */ public void setSeed(int seed) { m_seed = seed; } /** * Gets the seed for the random number generations. * * @return the seed for the random number generation */ public int getSeed() { return m_seed; } /** * Returns the tip text for this property * @return tip text for this property suitable for * displaying in the explorer/experimenter gui */ public String evaluatorTipText() { return "The base evaluator to be used."; } /** * Set the base evaluator. * * @param newEvaluator the evaluator to use. * @throws IllegalArgumentException if the evaluator is of the wrong type */ public void setEvaluator(ASEvaluation newEvaluator) throws IllegalArgumentException { m_evaluator = newEvaluator; } /** * Get the evaluator used as the base evaluator. * * @return the evaluator used as the base evaluator */ public ASEvaluation getEvaluator() { return m_evaluator; } /** * Returns default capabilities of the classifier. * * @return the capabilities of this classifier */ public Capabilities getCapabilities() { Capabilities result; if (getEvaluator() != null) { result = getEvaluator().getCapabilities(); } else { result = new Capabilities(this); } // class result.disableAllClasses(); result.disableAllClassDependencies(); result.enable(Capability.NOMINAL_CLASS); return result; } /** * Generates a attribute evaluator. Has to initialize all fields of the * evaluator that are not being set via options. * * @param data set of instances serving as training data * @exception Exception if the evaluator has not been * generated successfully */ public void buildEvaluator(Instances data) throws Exception { // can evaluator handle the data? getCapabilities().testWithFail(data); // remove instances with missing class data = new Instances(data); data.deleteWithMissingClass(); if (m_evaluator == null) { throw new Exception("No base evaluator has been set!"); } if (m_MatrixSource == MATRIX_ON_DEMAND) { String costName = data.relationName() + CostMatrix.FILE_EXTENSION; File costFile = new File(getOnDemandDirectory(), costName); if (!costFile.exists()) { throw new Exception("On-demand cost file doesn't exist: " + costFile); } setCostMatrix(new CostMatrix(new BufferedReader( new FileReader(costFile)))); } else if (m_CostMatrix == null) { // try loading an old format cost file m_CostMatrix = new CostMatrix(data.numClasses()); m_CostMatrix.readOldFormat(new BufferedReader( new FileReader(m_CostFile))); } Random random = null; if (!(m_evaluator instanceof WeightedInstancesHandler)) { random = new Random(m_seed); } data = m_CostMatrix.applyCostMatrix(data, random); m_evaluator.buildEvaluator(data); } /** * Provides a chance for a attribute evaluator to do any special * post processing of the selected attribute set. * * @param attributeSet the set of attributes found by the search * @return a possibly ranked list of postprocessed attributes * @exception Exception if postprocessing fails for some reason */ public int [] postProcess(int [] attributeSet) throws Exception { return m_evaluator.postProcess(attributeSet); } /** * Output a representation of this evaluator * * @return a string representation of the classifier */ public String toString() { if (m_evaluator == null) { return "CostSensitiveASEvaluation: No model built yet."; } String result = (m_evaluator instanceof AttributeEvaluator) ? "CostSensitiveAttributeEval using " : "CostSensitiveSubsetEval using "; result += "\n\n" + getEvaluatorSpec() + "\n\nEvaluator\n" + m_evaluator.toString() + "\n\nCost Matrix\n" + m_CostMatrix.toString(); return result; } /** * Returns the revision string. * * @return the revision */ public String getRevision() { return RevisionUtils.extract("$Revision: 1.1 $"); } }
[ "ben.he.src@f3485be4-0bd3-11df-ad0c-0fb4090ca1bc" ]
ben.he.src@f3485be4-0bd3-11df-ad0c-0fb4090ca1bc
839fb9187e0dbb2e9819b41538ca4dea2484c4c5
d1bd1246f161b77efb418a9c24ee544d59fd1d20
/android/mylibrary/trunk/src/org/anybox/android/library/app/MyAccountBinder.java
bc7ca7b846bcc935f3e8f1c338412d9ddce904b2
[]
no_license
navychen2003/javen
f9a94b2e69443291d4b5c3db5a0fc0d1206d2d4a
a3c2312bc24356b1c58b1664543364bfc80e816d
refs/heads/master
2021-01-20T12:12:46.040953
2015-03-03T06:14:46
2015-03-03T06:14:46
30,912,222
0
1
null
2023-03-20T11:55:50
2015-02-17T10:24:28
Java
UTF-8
Java
false
false
1,714
java
package org.anybox.android.library.app; import android.view.LayoutInflater; import android.view.View; import org.javenstudio.android.app.IActivity; import org.javenstudio.provider.app.anybox.user.AnyboxAccountBinder; import org.javenstudio.provider.app.anybox.user.AnyboxAccountProvider; public class MyAccountBinder extends AnyboxAccountBinder { //private static final Logger LOG = Logger.getLogger(MyAccountBinder.class); private final MyBinderHelper mHelper = MyBinderHelper.BLUE; public MyAccountBinder(AnyboxAccountProvider p) { super(p); } @Override protected void onBindedItemView(IActivity activity, LayoutInflater inflater, View view) { super.onBindedItemView(activity, inflater, view); if (mHelper != null) mHelper.onBindRefreshView(activity, view); } @Override public int getHomeAsUpIndicatorMenuRes() { if (mHelper != null) return mHelper.getHomeAsUpIndicatorMenuRes(); return super.getHomeAsUpIndicatorMenuRes(); } @Override public int getHomeAsUpIndicatorBackRes() { if (mHelper != null) return mHelper.getHomeAsUpIndicatorBackRes(); return super.getHomeAsUpIndicatorBackRes(); } @Override protected int getHeaderMainViewBackgroundRes() { if (mHelper != null) return mHelper.getHeaderMainViewBackgroundRes(); return super.getHeaderMainViewBackgroundRes(); } @Override protected int getHeaderActionsViewBackgroundRes() { if (mHelper != null) return mHelper.getHeaderActionsViewBackgroundRes(); return super.getHeaderActionsViewBackgroundRes(); } @Override protected int getAboveActionsViewBackgroundRes() { if (mHelper != null) return mHelper.getAboveActionsViewBackgroundRes(); return super.getAboveActionsViewBackgroundRes(); } }
85fdac27fbad00d2b1839372ffc5009a889f009d
d27be23dc0fae7fbc7109b1f820f1d5bac77f6d1
/connecter/src/main/java/com/jyl/connecter/server/MyMessageProtocol.java
30523819834d5230512ec3c907c89d3331cab17f
[]
no_license
jyl2390446138/imLearn
1a9af204f9e62516dcb6a8866528db57cba2ef9e
8a03178a8fdb4b15215f28e1886eacb73bd489e1
refs/heads/master
2023-03-28T08:27:15.584183
2021-03-18T07:49:16
2021-03-18T07:49:16
348,983,349
0
0
null
null
null
null
UTF-8
Java
false
false
485
java
package com.jyl.connecter.server; /** * 自定义协议包 */ public class MyMessageProtocol { //定义一次发送包体长度 private int len; //一次发送包体内容 private byte[] content; public int getLen() { return len; } public void setLen(int len) { this.len = len; } public byte[] getContent() { return content; } public void setContent(byte[] content) { this.content = content; } }
e62e436360fe2ee250ac2fccc990021e4a00f037
6755ca830637f7b72063182ce09341b7155eff5b
/web/src/main/java/by/saidanov/auction/commands/impl/user/GoToRegistrationCommand.java
3c3a3617cf2fc335f03b696b4fd14fc7b7212e32
[]
no_license
ArtemSaidanov/Auction
e41819398b80ccdbbaab7eecdc5b2c75513fbf6e
4aa6f81c2f38730bf1c4a9e48397dbc308a26175
refs/heads/master
2021-01-18T20:31:41.829598
2017-04-17T14:42:59
2017-04-17T14:42:59
86,975,230
1
0
null
2017-04-17T14:42:59
2017-04-02T09:10:23
Java
UTF-8
Java
false
false
605
java
package by.saidanov.auction.commands.impl.user; import by.saidanov.auction.commands.BaseCommand; import by.saidanov.auction.constants.PagePath; import by.saidanov.auction.managers.ConfigurationManager; import javax.servlet.http.HttpServletRequest; /** * Description: Redirects to the registration page * * @author Artiom Saidanov. */ public class GoToRegistrationCommand implements BaseCommand { @Override public String execute(HttpServletRequest request) { String page = ConfigurationManager.getInstance().getProperty(PagePath.REGISTRATION_PAGE_PATH); return page; } }
493bf2e2d80f1a7059f200a06bcbc720e411cf54
251536bd3c55b438538c256a1defeda78f7238e0
/opengl_tutorial/src/main/java/com/glumes/openglbasicshape/egl/EglActivity.java
615cb7f72c2cbf89bc657a20f32ce907245ff8bb
[]
no_license
glumes/AndroidOpenGLTutorial
c166671ed97f698331d97cb292e1cc16739530c0
23d87a9d52e3237c3add60d4dbb67d7ee3d553fa
refs/heads/master
2022-05-04T04:16:12.095247
2022-04-22T14:03:40
2022-04-22T14:03:40
97,850,730
273
62
null
2018-07-11T16:05:14
2017-07-20T15:23:31
Java
UTF-8
Java
false
false
1,206
java
package com.glumes.openglbasicshape.egl; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.SurfaceHolder; import android.view.SurfaceView; import com.glumes.openglbasicshape.R; public class EglActivity extends AppCompatActivity { private SurfaceView mSurfaceView; private EglDemo mEglDemo; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_egl); mSurfaceView = findViewById(R.id.eglview); mEglDemo = new EglDemo(); mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() { @Override public void surfaceCreated(SurfaceHolder holder) { mEglDemo.initEgl(); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { mEglDemo.render(mSurfaceView.getHolder().getSurface(), width, height, EglActivity.this); } @Override public void surfaceDestroyed(SurfaceHolder holder) { mEglDemo.release(); } }); } }
2dc18aa5e779f0b89ba4367f82f7c103afc1d8c4
7de460270260ece904bfff3529b767ec15850512
/alpha-web/src/main/java/com/alpha/web/module/screen/api/department/PartnerDepartmentDel.java
2826313b390eff736afcb38db83c6b694ddd871f
[]
no_license
taoxiangxiang/alpha
8b7c0f8512a3d33b13706ff2f771790e2e1c4c8a
bf69fe6792c5a5bc308b2b83510c5c4b27dfdc9e
refs/heads/master
2021-01-18T22:29:13.558534
2018-05-12T14:28:15
2018-05-12T14:28:15
87,056,789
0
0
null
null
null
null
UTF-8
Java
false
false
1,858
java
package com.alpha.web.module.screen.api.department; import com.alibaba.citrus.turbine.Context; import com.alibaba.citrus.turbine.dataresolver.Param; import com.alpha.constans.SystemConstant; import com.alpha.domain.DepartmentDO; import com.alpha.domain.PartnerDepartmentDO; import com.alpha.domain.SystemAccountDO; import com.alpha.manager.DepartmentManager; import com.alpha.manager.PartnerDepartmentManager; import com.alpha.web.common.BaseAjaxModule; import com.alpha.web.domain.Result; import javax.annotation.Resource; /** * Created by taoxiang on 2017/4/8. */ public class PartnerDepartmentDel extends BaseAjaxModule { @Resource private PartnerDepartmentManager partnerDepartmentManager; public void execute(@Param("id") int id, Context context) { Result<String> result = new Result<String>(); try { SystemAccountDO curAccountDO = this.getAccount(); if (curAccountDO == null) { print(new Result<String>("请登录系统")); return; } if (!curAccountDO.hasAuth()) { print(new Result<String>("您没有该功能权限")); return; } PartnerDepartmentDO partnerDepartmentDO = new PartnerDepartmentDO(); partnerDepartmentDO.setId(id); partnerDepartmentDO.setStatus(SystemConstant.DEPARTMENT_DELETE); boolean res = partnerDepartmentManager.update(partnerDepartmentDO); if (res) { result.setData("操作成功"); } else { result.setErrMsg("操作失败,请重新操作"); } } catch (Exception e) { logger.error("InvalidVehicle execute catch exception", e); result.setErrMsg("系统异常,请重新操作"); } print(result); } }
0eee90dede772ed415e138cfd1fbb2952b4a9770
653a8dc7283b49c8ab9916cef874f325fce55c82
/Project1/src/dev/tylerdclark/Utilities.java
55b1cd2f4f0a4f49f7c2bec84889ba4150f4658d
[ "MIT" ]
permissive
owoodworth/CMSC451
a758ed5f1578e5ebee26ecb532f3bc4a0b52abea
3853fb3951bdbb2b81fff4a531fba0844d11f440
refs/heads/main
2023-08-12T15:39:22.814571
2021-10-09T03:48:40
2021-10-09T03:48:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,139
java
package dev.tylerdclark; import java.util.Arrays; public class Utilities { /** * Calculates the average using the formula: sum of data / data count * * @param data to be averaged * @return average value */ protected static double getAverage(double[] data) { double sum = Arrays.stream(data).sum(); return sum / data.length; } /** * Creates an array of random numbers between 0 and 999 * @param n length of array * @return array of random numbers */ protected static int[] getData(int n) { int[] data = new int[n]; for (int i = 0; i < n; i++) data[i] = (int) (Math.random() * 1000); return data; } /** * Calculates the standard deviation which is how close the data is to average. * Formula from https://en.wikipedia.org/wiki/Standard_deviation * * @param data to be analyzed * @return standard deviation of a collection */ protected static double getStandardDeviation(double[] data) { double sum = 0; for (double datum : data) { sum += (datum - getAverage(data)) * (datum - getAverage(data)); } return Math.sqrt(sum / (data.length - 1)); } /** * Shows the extent of variability in relation to the average. * Formula from https://en.wikipedia.org/wiki/Coefficient_of_variation * * @param data to be analyzed * @return coefficient of variance */ protected static double getCoefficientOfVariance(double[] data) { return ((getStandardDeviation(data)) / getAverage(data)) * 100; } /** * Using the manual JVM warmup method mentioned in the article: * https://www.baeldung.com/java-jvm-warmup */ protected static void JVMWarmUp() { for (int i = 0; i < 1000000; i++) { ManualClass manualClass = new ManualClass(); manualClass.method(); } } /** * Manual class to be instantiated for the purpose of JVM warmup */ public static class ManualClass { public void method() { } } }
f492c0538032d779c4cfacbc9a813afdf5c9844f
ddcb9978b31659774985c96ea1cf607df83f7ccf
/Onnix/src/com/onnix/business/dao/impl/CuentasClientesDAOImpl.java
cee7b721a42e334d43cbafbe1b213ab16fc826a2
[]
no_license
sergycg/Ocio-Indigo
b6fb7f467301ae97e67dbf7959804ab497c6794a
055cbe21c01a96e3a8cc0b025ffe2ed329f1eb13
refs/heads/master
2020-04-06T16:12:32.645852
2016-01-09T19:37:28
2016-01-09T19:37:28
42,772,426
0
0
null
null
null
null
UTF-8
Java
false
false
2,757
java
package com.onnix.business.dao.impl; import java.util.List; import org.hibernate.Criteria; import org.hibernate.Session; import org.hibernate.criterion.MatchMode; import org.hibernate.criterion.Restrictions; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import com.onnix.business.dao.ICuentasClientesDAO; import com.onnix.business.utils.StringUtils; import com.onnix.business.vo.ClienteVO; import com.onnix.business.vo.ViewCuentasClientesVO; import com.onnix.business.vo.ViewTotalesVO; public class CuentasClientesDAOImpl extends HibernateDaoSupport implements ICuentasClientesDAO{ @Override public ClienteVO loadById (Long id){ Session session = getSessionFactory().getCurrentSession(); ClienteVO vo = (ClienteVO) session.get(ClienteVO.class, id); return vo; } @Override public ViewCuentasClientesVO loadById(ViewCuentasClientesVO vo) { Criteria criteria = getSessionFactory().getCurrentSession().createCriteria(ViewCuentasClientesVO.class); criteria.add(Restrictions.eq("idCliente", vo.getIdCliente())); criteria.add(Restrictions.eq("idCuenta", vo.getIdCuenta())); ViewCuentasClientesVO resultado = new ViewCuentasClientesVO(); resultado = (ViewCuentasClientesVO) criteria.uniqueResult(); return resultado; } @Override public ViewTotalesVO loadById(ViewTotalesVO vo) { Criteria criteria = getSessionFactory().getCurrentSession().createCriteria(ViewTotalesVO.class); criteria.add(Restrictions.eq("idCliente", vo.getIdCliente())); criteria.add(Restrictions.eq("idCuenta", vo.getIdCuenta())); ViewTotalesVO resultado = new ViewTotalesVO(); resultado = (ViewTotalesVO) criteria.uniqueResult(); return resultado; } @Override public List<ViewCuentasClientesVO> findByExample(ViewCuentasClientesVO vo) { Criteria criteria = getSessionFactory().getCurrentSession().createCriteria(ViewCuentasClientesVO.class); if (StringUtils.isNotEmpty(vo.getNombre())) criteria.add(Restrictions.like("nombre", vo.getNombre(), MatchMode.ANYWHERE)); if (StringUtils.isNotEmpty(vo.getApellidos())) criteria.add(Restrictions.like("apellidos", vo.getApellidos(), MatchMode.ANYWHERE)); if (StringUtils.isNotEmpty(vo.getTelefono())) criteria.add(Restrictions.like("telefono", vo.getTelefono(), MatchMode.ANYWHERE)); if (StringUtils.isNotEmpty(vo.getCodPostal())) criteria.add(Restrictions.like("codPostal", vo.getCodPostal(), MatchMode.ANYWHERE)); if (vo.getIndActiva()!=null) criteria.add(Restrictions.eq("indActiva", vo.getIndActiva())); List listado = criteria.list(); return listado; } @Override public ClienteVO save(ClienteVO vo){ Session sesion = getSessionFactory().getCurrentSession(); sesion.saveOrUpdate(vo); return vo; } }
7baadb390a76cd540cbb946fd582ea2cc72639c0
26071175304a7636cc0473c3a8499f04e2dd864b
/person-parent/general-person-entities/src/main/java/com/kalix/general/person/entities/TeacherBean.java
257572737fe3bdf6f261a2f68b54ae03c51e06a7
[]
no_license
chenyanxu/general-parent
9a6c9badd6b0d6b89aae967bb8954d18787e2441
0dd4602def5e877f4a66e2daef33c14586ba42f3
refs/heads/master
2020-03-22T07:15:04.582780
2018-08-29T00:53:51
2018-08-29T00:53:51
139,688,751
0
0
null
null
null
null
UTF-8
Java
false
false
8,297
java
package com.kalix.general.person.entities; import com.fasterxml.jackson.annotation.JsonFormat; import com.kalix.framework.core.api.persistence.PersistentEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.persistence.Entity; import javax.persistence.Table; import javax.persistence.Transient; import java.util.Date; /** * Created by Administrator on 2017/3/3. */ @Entity @Table(name = "general_person_teacher") @ApiModel("教师信息<br>TeacherBean") public class TeacherBean extends PersistentEntity { @ApiModelProperty(value = "工号", example = "0") //@Column(unique = true) private String code; @ApiModelProperty(value = "姓名", example = "陈某") private String name; private Integer sex; //性别,字典[性别] @ApiModelProperty(value = "出生日期", example = "2010-02-01") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date birthday; @ApiModelProperty(value = "学历", example = "大学本科") private String education; @ApiModelProperty(value = "学位", example = "学士学位") private String degree; @ApiModelProperty(value = "职称", example = "高级教师") private Integer positionalTitles; //职称,字典[职称] @ApiModelProperty(value = "入校年份/启聘年份", example = "2017") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy", timezone = "GMT+8") private Date entranceYear; private String specialIdentity; //特殊身份 @ApiModelProperty(value = "民族", example = "汉族") private String nation; @ApiModelProperty(value = "籍贯", example = "吉林省") private String placeOfOrigin; @ApiModelProperty(value = "现住址", example = "吉林省长春市") private String address; @ApiModelProperty(value = "身份证号", example = "220***************") private String identificationCard; @ApiModelProperty(value = "岗位", example = "0") private Integer position; //岗位,字典[岗位名称] @ApiModelProperty(value = "是否在岗/是否聘任:(0-否 1-是)", allowableValues = "0,1", example = "1") private Integer beOnDuty = 1; @ApiModelProperty(value = "联系电话", example = "043288888888") private String phone; @ApiModelProperty(value = "邮箱", example = "[email protected]") private String email; @ApiModelProperty(value = "手机", example = "18866667777") private String mobile; @ApiModelProperty(value = "个人简历", example = "0") private String resume; @ApiModelProperty(value = "个人说明", example = "0") private String introduction; @ApiModelProperty(value = "学术研究", example = "0") private String learning; @ApiModelProperty(value = "教学情况", position = 10, example = "0") private String teaching; @ApiModelProperty(value = "擅长课程", position = 11, example = "0") private String coursesSkills; @ApiModelProperty(value = "预备知识", position = 12, example = "0") private String preliminary; private String remark; //备注 @ApiModelProperty(value = "照片", example = "http://head.png") private String icon; @ApiModelProperty(value = "所在单位id", position = 5, example = "0") private Long orgId; @Transient private String orgName; //所在单位名称 private Integer beOnExternal; //是否外聘(教师类别),0-在编,1-外聘 private String originUnit; //所属单位 public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getSex() { return sex; } public void setSex(Integer sex) { this.sex = sex; } public Date getBirthday() { return birthday; } public void setBirthday(Date birthday) { this.birthday = birthday; } public String getEducation() { return education; } public void setEducation(String education) { this.education = education; } public String getDegree() { return degree; } public void setDegree(String degree) { this.degree = degree; } public Integer getPositionalTitles() { return positionalTitles; } public void setPositionalTitles(Integer positionalTitles) { this.positionalTitles = positionalTitles; } public Date getEntranceYear() { return entranceYear; } public void setEntranceYear(Date entranceYear) { this.entranceYear = entranceYear; } public String getSpecialIdentity() { return specialIdentity; } public void setSpecialIdentity(String specialIdentity) { this.specialIdentity = specialIdentity; } public String getNation() { return nation; } public void setNation(String nation) { this.nation = nation; } public String getPlaceOfOrigin() { return placeOfOrigin; } public void setPlaceOfOrigin(String placeOfOrigin) { this.placeOfOrigin = placeOfOrigin; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getIdentificationCard() { return identificationCard; } public void setIdentificationCard(String identificationCard) { this.identificationCard = identificationCard; } public Integer getPosition() { return position; } public void setPosition(Integer position) { this.position = position; } public Integer getBeOnDuty() { return beOnDuty; } public void setBeOnDuty(Integer beOnDuty) { this.beOnDuty = beOnDuty; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public String getResume() { return resume; } public void setResume(String resume) { this.resume = resume; } public String getIntroduction() { return introduction; } public void setIntroduction(String introduction) { this.introduction = introduction; } public String getLearning() { return learning; } public void setLearning(String learning) { this.learning = learning; } public String getTeaching() { return teaching; } public void setTeaching(String teaching) { this.teaching = teaching; } public String getCoursesSkills() { return coursesSkills; } public void setCoursesSkills(String coursesSkills) { this.coursesSkills = coursesSkills; } public String getPreliminary() { return preliminary; } public void setPreliminary(String preliminary) { this.preliminary = preliminary; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } public Long getOrgId() { return orgId; } public void setOrgId(Long orgId) { this.orgId = orgId; } public String getOrgName() { return orgName; } public void setOrgName(String orgName) { this.orgName = orgName; } public Integer getBeOnExternal() { return beOnExternal; } public void setBeOnExternal(Integer beOnExternal) { this.beOnExternal = beOnExternal; } public String getOriginUnit() { return originUnit; } public void setOriginUnit(String originUnit) { this.originUnit = originUnit; } }
0fbcb419f4f4984086a55cb0dd22f70cb87a0dee
fa4528ef25b3cbb158acddfa2fcf1b0ede3a438e
/record/src/main/java/com/music/record/security/JwtAuthenticationFilter.java
897887903c2cf5da8c0a020e419009b386ab64b0
[]
no_license
lucasmaximiano/backend-music-record
15c7211c6db81d0e6c7e41231fd3ec7ce304718d
7d1510646b36f391b032fd9b2e3cce7a27ef639a
refs/heads/master
2022-12-26T10:18:40.657082
2019-11-28T23:21:34
2019-11-28T23:21:34
222,800,716
0
0
null
2022-12-16T05:07:13
2019-11-19T22:19:02
Java
UTF-8
Java
false
false
1,978
java
package com.music.record.security; import java.io.IOException; import java.util.ArrayList; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jwts; public class JwtAuthenticationFilter extends BasicAuthenticationFilter { private String secret = "beblue"; public JwtAuthenticationFilter(AuthenticationManager authenticationManager) { super(authenticationManager); } @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { String header = request.getHeader("Authorization"); if (header != null && header.startsWith("Bearer ")) { UsernamePasswordAuthenticationToken auth = getAuthentication(header.substring(7)); if (auth != null) { SecurityContextHolder.getContext().setAuthentication(auth); } } chain.doFilter(request, response); } private UsernamePasswordAuthenticationToken getAuthentication(String token) { if (isValidToken(token)) return new UsernamePasswordAuthenticationToken(getClaims(token), null, new ArrayList<>()); return null; } private Boolean isValidToken(String token) { Claims claims = getClaims(token); if (claims != null) return true; return false; } private Claims getClaims(String token) { try { return Jwts.parser().setSigningKey(secret.getBytes()).parseClaimsJws(token).getBody(); } catch (Exception e) { return null; } } }
4abda80b25c545824f7ce2d499dc20422166bba8
aecf49df2d88967b31e5b21db301166e34334794
/java/serviceconsume-feign/src/main/java/com/my/serviceconsumefeign/service/IHelloService.java
66f54efeba975bd7f81a637be5e71ff54f42cfe8
[]
no_license
DiaosX/springcloudstarting
68aa446ad523432cfd419c07ae4e289020863d86
09976e2ebb89540af33f059c1042662200dfcbe5
refs/heads/master
2022-07-26T16:32:53.523074
2019-05-30T10:18:33
2019-05-30T10:18:33
189,318,288
0
0
null
2022-07-07T23:15:24
2019-05-30T00:32:49
Java
UTF-8
Java
false
false
627
java
package com.my.serviceconsumefeign.service; import com.my.serviceconsumefeign.fallback.HelloServiceHystrix; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; @FeignClient(value = "serviceprovider", fallback = HelloServiceHystrix.class) public interface IHelloService { @RequestMapping(value = "/hello/sayHello", method = RequestMethod.GET) String sayHello(@RequestParam(name = "message", required = false) String message); }
fc927b22c74ecea5dc39f73f5b9f2ef9dc36c307
1043c01b7637098d046fbb9dba79b15eefbad509
/entity-view/api/src/main/java/com/blazebit/persistence/view/FlushOperationBuilder.java
41632df28be955212ae26b54883eefcd1eef42e9
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
ares3/blaze-persistence
45c06a3ec25c98236a109ab55a3205fc766734ed
2258e9d9c44bb993d41c5295eccbc894f420f263
refs/heads/master
2020-10-01T16:13:01.380347
2019-12-06T01:24:34
2019-12-09T09:29:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
47,480
java
/* * Copyright 2014 - 2019 Blazebit. * * 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.blazebit.persistence.view; import java.util.Set; /** * A builder for defining flush related configuration. * * @author Christian Beikov * @since 1.4.0 */ public interface FlushOperationBuilder { /** * Invoked the flush operation. */ public void flush(); /** * Registers the given listener to the current flush operation. * * @param listener The listener to register * @return This builder for method chaining */ public FlushOperationBuilder onPrePersist(PrePersistListener<?> listener); /** * Registers the given listener to the current flush operation. * * @param listener The listener to register * @return This builder for method chaining */ public FlushOperationBuilder onPrePersist(PrePersistEntityListener<?, ?> listener); /** * Registers the given listener to the current flush operation. * * @param listener The listener to register * @return This builder for method chaining */ public FlushOperationBuilder onPostPersist(PostPersistListener<?> listener); /** * Registers the given listener to the current flush operation. * * @param listener The listener to register * @return This builder for method chaining */ public FlushOperationBuilder onPostPersist(PostPersistEntityListener<?, ?> listener); /** * Registers the given listener to the current flush operation. * * @param listener The listener to register * @return This builder for method chaining */ public FlushOperationBuilder onPreUpdate(PreUpdateListener<?> listener); /** * Registers the given listener to the current flush operation. * * @param listener The listener to register * @return This builder for method chaining */ public FlushOperationBuilder onPostUpdate(PostUpdateListener<?> listener); /** * Registers the given listener to the current flush operation. * * @param listener The listener to register * @return This builder for method chaining */ public FlushOperationBuilder onPreRemove(PreRemoveListener<?> listener); /** * Registers the given listener to the current flush operation. * * @param listener The listener to register * @return This builder for method chaining */ public FlushOperationBuilder onPostRemove(PostRemoveListener<?> listener); /** * Registers the given listener to the current flush operation. * * @param listener The listener to register * @return This builder for method chaining */ public FlushOperationBuilder onPostCommit(PostCommitListener<?> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#PERSIST}. * * @param listener The listener to register * @return This builder for method chaining */ public FlushOperationBuilder onPostCommitPersist(PostCommitListener<?> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#UPDATE}. * * @param listener The listener to register * @return This builder for method chaining */ public FlushOperationBuilder onPostCommitUpdate(PostCommitListener<?> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#REMOVE}. * * @param listener The listener to register * @return This builder for method chaining */ public FlushOperationBuilder onPostCommitRemove(PostCommitListener<?> listener); /** * Registers the given listener to the current flush operation. * * @param viewTransitions The view transitions * @param listener The listener to register * @return This builder for method chaining */ public FlushOperationBuilder onPostCommit(Set<ViewTransition> viewTransitions, PostCommitListener<?> listener); /** * Registers the given listener to the current flush operation. * * @param listener The listener to register * @return This builder for method chaining */ public FlushOperationBuilder onPostRollback(PostRollbackListener<?> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#PERSIST}. * * @param listener The listener to register * @return This builder for method chaining */ public FlushOperationBuilder onPostRollbackPersist(PostRollbackListener<?> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#UPDATE}. * * @param listener The listener to register * @return This builder for method chaining */ public FlushOperationBuilder onPostRollbackUpdate(PostRollbackListener<?> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#REMOVE}. * * @param listener The listener to register * @return This builder for method chaining */ public FlushOperationBuilder onPostRollbackRemove(PostRollbackListener<?> listener); /** * Registers the given listener to the current flush operation. * * @param viewTransitions The view transitions * @param listener The listener to register * @return This builder for method chaining */ public FlushOperationBuilder onPostRollback(Set<ViewTransition> viewTransitions, PostRollbackListener<?> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPrePersist(Class<T> entityViewClass, PrePersistListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPrePersist(Class<T> entityViewClass, PrePersistEntityListener<T, ?> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostPersist(Class<T> entityViewClass, PostPersistListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostPersist(Class<T> entityViewClass, PostPersistEntityListener<T, ?> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPreUpdate(Class<T> entityViewClass, PreUpdateListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostUpdate(Class<T> entityViewClass, PostUpdateListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPreRemove(Class<T> entityViewClass, PreRemoveListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostRemove(Class<T> entityViewClass, PostRemoveListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostCommit(Class<T> entityViewClass, PostCommitListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param <T> The entity view type * @param entityViewClass The entity view type for which to register the listener * @param viewTransitions The view transitions * @param listener The listener to register * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostCommit(Class<T> entityViewClass, Set<ViewTransition> viewTransitions, PostCommitListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#PERSIST}. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostCommitPersist(Class<T> entityViewClass, PostCommitListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#UPDATE}. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostCommitUpdate(Class<T> entityViewClass, PostCommitListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#REMOVE}. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostCommitRemove(Class<T> entityViewClass, PostCommitListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostRollback(Class<T> entityViewClass, PostRollbackListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param <T> The entity view type * @param entityViewClass The entity view type for which to register the listener * @param viewTransitions The view transitions * @param listener The listener to register * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostRollback(Class<T> entityViewClass, Set<ViewTransition> viewTransitions, PostRollbackListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#PERSIST}. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostRollbackPersist(Class<T> entityViewClass, PostRollbackListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#UPDATE}. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostRollbackUpdate(Class<T> entityViewClass, PostRollbackListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#REMOVE}. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostRollbackRemove(Class<T> entityViewClass, PostRollbackListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPrePersist(Class<T> entityViewClass, Class<E> entityClass, PrePersistListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPrePersist(Class<T> entityViewClass, Class<E> entityClass, PrePersistEntityListener<T, E> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostPersist(Class<T> entityViewClass, Class<E> entityClass, PostPersistListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostPersist(Class<T> entityViewClass, Class<E> entityClass, PostPersistEntityListener<T, E> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPreUpdate(Class<T> entityViewClass, Class<E> entityClass, PreUpdateListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostUpdate(Class<T> entityViewClass, Class<E> entityClass, PostUpdateListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPreRemove(Class<T> entityViewClass, Class<E> entityClass, PreRemoveListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostRemove(Class<T> entityViewClass, Class<E> entityClass, PostRemoveListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostCommit(Class<T> entityViewClass, Class<E> entityClass, PostCommitListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param <T> The entity view type * @param <E> The entity type * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param viewTransitions The view transitions * @param listener The listener to register * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostCommit(Class<T> entityViewClass, Class<E> entityClass, Set<ViewTransition> viewTransitions, PostCommitListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#PERSIST}. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostCommitPersist(Class<T> entityViewClass, Class<E> entityClass, PostCommitListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#UPDATE}. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostCommitUpdate(Class<T> entityViewClass, Class<E> entityClass, PostCommitListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#REMOVE}. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostCommitRemove(Class<T> entityViewClass, Class<E> entityClass, PostCommitListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostRollback(Class<T> entityViewClass, Class<E> entityClass, PostRollbackListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param <T> The entity view type * @param <E> The entity type * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param viewTransitions The view transitions * @param listener The listener to register * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostRollback(Class<T> entityViewClass, Class<E> entityClass, Set<ViewTransition> viewTransitions, PostRollbackListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#PERSIST}. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostRollbackPersist(Class<T> entityViewClass, Class<E> entityClass, PostRollbackListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#UPDATE}. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostRollbackUpdate(Class<T> entityViewClass, Class<E> entityClass, PostRollbackListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#REMOVE}. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostRollbackRemove(Class<T> entityViewClass, Class<E> entityClass, PostRollbackListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPrePersist(Class<T> entityViewClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPrePersist(Class<T> entityViewClass, ViewAndEntityListener<T, ?> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostPersist(Class<T> entityViewClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostPersist(Class<T> entityViewClass, ViewAndEntityListener<T, ?> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPreUpdate(Class<T> entityViewClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostUpdate(Class<T> entityViewClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPreRemove(Class<T> entityViewClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostRemove(Class<T> entityViewClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostCommit(Class<T> entityViewClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostCommit(Class<T> entityViewClass, ViewTransitionListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param <T> The entity view type * @param entityViewClass The entity view type for which to register the listener * @param viewTransitions The view transitions * @param listener The listener to register * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostCommit(Class<T> entityViewClass, Set<ViewTransition> viewTransitions, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param <T> The entity view type * @param entityViewClass The entity view type for which to register the listener * @param viewTransitions The view transitions * @param listener The listener to register * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostCommit(Class<T> entityViewClass, Set<ViewTransition> viewTransitions, ViewTransitionListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#PERSIST}. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostCommitPersist(Class<T> entityViewClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#UPDATE}. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostCommitUpdate(Class<T> entityViewClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#REMOVE}. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostCommitRemove(Class<T> entityViewClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostRollback(Class<T> entityViewClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostRollback(Class<T> entityViewClass, ViewTransitionListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param <T> The entity view type * @param entityViewClass The entity view type for which to register the listener * @param viewTransitions The view transitions * @param listener The listener to register * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostRollback(Class<T> entityViewClass, Set<ViewTransition> viewTransitions, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param <T> The entity view type * @param entityViewClass The entity view type for which to register the listener * @param viewTransitions The view transitions * @param listener The listener to register * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostRollback(Class<T> entityViewClass, Set<ViewTransition> viewTransitions, ViewTransitionListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#PERSIST}. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostRollbackPersist(Class<T> entityViewClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#UPDATE}. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostRollbackUpdate(Class<T> entityViewClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#REMOVE}. * * @param entityViewClass The entity view type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @return This builder for method chaining */ public <T> FlushOperationBuilder onPostRollbackRemove(Class<T> entityViewClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPrePersist(Class<T> entityViewClass, Class<E> entityClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPrePersist(Class<T> entityViewClass, Class<E> entityClass, ViewAndEntityListener<T, E> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostPersist(Class<T> entityViewClass, Class<E> entityClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostPersist(Class<T> entityViewClass, Class<E> entityClass, ViewAndEntityListener<T, E> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPreUpdate(Class<T> entityViewClass, Class<E> entityClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostUpdate(Class<T> entityViewClass, Class<E> entityClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPreRemove(Class<T> entityViewClass, Class<E> entityClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostRemove(Class<T> entityViewClass, Class<E> entityClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostCommit(Class<T> entityViewClass, Class<E> entityClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostCommit(Class<T> entityViewClass, Class<E> entityClass, ViewTransitionListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param <T> The entity view type * @param <E> The entity type * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param viewTransitions The view transitions * @param listener The listener to register * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostCommit(Class<T> entityViewClass, Class<E> entityClass, Set<ViewTransition> viewTransitions, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param <T> The entity view type * @param <E> The entity type * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param viewTransitions The view transitions * @param listener The listener to register * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostCommit(Class<T> entityViewClass, Class<E> entityClass, Set<ViewTransition> viewTransitions, ViewTransitionListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#PERSIST}. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostCommitPersist(Class<T> entityViewClass, Class<E> entityClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#UPDATE}. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostCommitUpdate(Class<T> entityViewClass, Class<E> entityClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#REMOVE}. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostCommitRemove(Class<T> entityViewClass, Class<E> entityClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostRollback(Class<T> entityViewClass, Class<E> entityClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostRollback(Class<T> entityViewClass, Class<E> entityClass, ViewTransitionListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param <T> The entity view type * @param <E> The entity type * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param viewTransitions The view transitions * @param listener The listener to register * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostRollback(Class<T> entityViewClass, Class<E> entityClass, Set<ViewTransition> viewTransitions, ViewListener<T> listener); /** * Registers the given listener to the current flush operation. * * @param <T> The entity view type * @param <E> The entity type * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param viewTransitions The view transitions * @param listener The listener to register * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostRollback(Class<T> entityViewClass, Class<E> entityClass, Set<ViewTransition> viewTransitions, ViewTransitionListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#PERSIST}. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostRollbackPersist(Class<T> entityViewClass, Class<E> entityClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#UPDATE}. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostRollbackUpdate(Class<T> entityViewClass, Class<E> entityClass, ViewListener<T> listener); /** * Registers the given listener to the current flush operation for the {@link ViewTransition#REMOVE}. * * @param entityViewClass The entity view type for which to register the listener * @param entityClass The entity type for which to register the listener * @param listener The listener to register * @param <T> The entity view type * @param <E> The entity type * @return This builder for method chaining */ public <T, E> FlushOperationBuilder onPostRollbackRemove(Class<T> entityViewClass, Class<E> entityClass, ViewListener<T> listener); }
75b7efc2dba979f89d134044886602c35fad4a2e
8a787e93fea9c334122441717f15bd2f772e3843
/odfdom/src/main/java/org/odftoolkit/odfdom/dom/element/text/TextAlphabeticalIndexMarkStartElement.java
5eabfaa26d78ae61f97a2b64e9a7b0ed53109e3a
[ "Apache-2.0", "BSD-3-Clause", "MIT", "W3C", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-unknown-license-reference" ]
permissive
apache/odftoolkit
296ea9335bfdd78aa94829c915a6e9c24e5b5166
99975f3be40fc1c428167a3db7a9a63038acfa9f
refs/heads/trunk
2023-07-02T16:30:24.946067
2018-10-02T11:11:40
2018-10-02T11:11:40
5,212,656
39
45
Apache-2.0
2018-04-11T11:57:17
2012-07-28T07:00:12
Java
UTF-8
Java
false
false
9,757
java
/************************************************************************ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * * Copyright 2008, 2010 Oracle and/or its affiliates. All rights reserved. * * Use is subject to license terms. * * 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. You can also * obtain a copy of the License at http://odftoolkit.org/docs/license.txt * * 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. * ************************************************************************/ /* * This file is automatically generated. * Don't edit manually. */ package org.odftoolkit.odfdom.dom.element.text; import org.odftoolkit.odfdom.pkg.OdfElement; import org.odftoolkit.odfdom.pkg.ElementVisitor; import org.odftoolkit.odfdom.pkg.OdfFileDom; import org.odftoolkit.odfdom.pkg.OdfName; import org.odftoolkit.odfdom.dom.OdfDocumentNamespace; import org.odftoolkit.odfdom.dom.DefaultElementVisitor; import org.odftoolkit.odfdom.dom.attribute.text.TextIdAttribute; import org.odftoolkit.odfdom.dom.attribute.text.TextKey1Attribute; import org.odftoolkit.odfdom.dom.attribute.text.TextKey1PhoneticAttribute; import org.odftoolkit.odfdom.dom.attribute.text.TextKey2Attribute; import org.odftoolkit.odfdom.dom.attribute.text.TextKey2PhoneticAttribute; import org.odftoolkit.odfdom.dom.attribute.text.TextMainEntryAttribute; import org.odftoolkit.odfdom.dom.attribute.text.TextStringValuePhoneticAttribute; /** * DOM implementation of OpenDocument element {@odf.element text:alphabetical-index-mark-start}. * */ public class TextAlphabeticalIndexMarkStartElement extends OdfElement { public static final OdfName ELEMENT_NAME = OdfName.newName(OdfDocumentNamespace.TEXT, "alphabetical-index-mark-start"); /** * Create the instance of <code>TextAlphabeticalIndexMarkStartElement</code> * * @param ownerDoc The type is <code>OdfFileDom</code> */ public TextAlphabeticalIndexMarkStartElement(OdfFileDom ownerDoc) { super(ownerDoc, ELEMENT_NAME); } /** * Get the element name * * @return return <code>OdfName</code> the name of element {@odf.element text:alphabetical-index-mark-start}. */ public OdfName getOdfName() { return ELEMENT_NAME; } /** * Receives the value of the ODFDOM attribute representation <code>TextIdAttribute</code> , See {@odf.attribute text:id} * * Attribute is mandatory. * * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set and no default value defined. */ public String getTextIdAttribute() { TextIdAttribute attr = (TextIdAttribute) getOdfAttribute(OdfDocumentNamespace.TEXT, "id"); if (attr != null) { return String.valueOf(attr.getValue()); } return null; } /** * Sets the value of ODFDOM attribute representation <code>TextIdAttribute</code> , See {@odf.attribute text:id} * * @param textIdValue The type is <code>String</code> */ public void setTextIdAttribute(String textIdValue) { TextIdAttribute attr = new TextIdAttribute((OdfFileDom) this.ownerDocument); setOdfAttribute(attr); attr.setValue(textIdValue); } /** * Receives the value of the ODFDOM attribute representation <code>TextKey1Attribute</code> , See {@odf.attribute text:key1} * * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set and no default value defined. */ public String getTextKey1Attribute() { TextKey1Attribute attr = (TextKey1Attribute) getOdfAttribute(OdfDocumentNamespace.TEXT, "key1"); if (attr != null) { return String.valueOf(attr.getValue()); } return null; } /** * Sets the value of ODFDOM attribute representation <code>TextKey1Attribute</code> , See {@odf.attribute text:key1} * * @param textKey1Value The type is <code>String</code> */ public void setTextKey1Attribute(String textKey1Value) { TextKey1Attribute attr = new TextKey1Attribute((OdfFileDom) this.ownerDocument); setOdfAttribute(attr); attr.setValue(textKey1Value); } /** * Receives the value of the ODFDOM attribute representation <code>TextKey1PhoneticAttribute</code> , See {@odf.attribute text:key1-phonetic} * * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set and no default value defined. */ public String getTextKey1PhoneticAttribute() { TextKey1PhoneticAttribute attr = (TextKey1PhoneticAttribute) getOdfAttribute(OdfDocumentNamespace.TEXT, "key1-phonetic"); if (attr != null) { return String.valueOf(attr.getValue()); } return null; } /** * Sets the value of ODFDOM attribute representation <code>TextKey1PhoneticAttribute</code> , See {@odf.attribute text:key1-phonetic} * * @param textKey1PhoneticValue The type is <code>String</code> */ public void setTextKey1PhoneticAttribute(String textKey1PhoneticValue) { TextKey1PhoneticAttribute attr = new TextKey1PhoneticAttribute((OdfFileDom) this.ownerDocument); setOdfAttribute(attr); attr.setValue(textKey1PhoneticValue); } /** * Receives the value of the ODFDOM attribute representation <code>TextKey2Attribute</code> , See {@odf.attribute text:key2} * * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set and no default value defined. */ public String getTextKey2Attribute() { TextKey2Attribute attr = (TextKey2Attribute) getOdfAttribute(OdfDocumentNamespace.TEXT, "key2"); if (attr != null) { return String.valueOf(attr.getValue()); } return null; } /** * Sets the value of ODFDOM attribute representation <code>TextKey2Attribute</code> , See {@odf.attribute text:key2} * * @param textKey2Value The type is <code>String</code> */ public void setTextKey2Attribute(String textKey2Value) { TextKey2Attribute attr = new TextKey2Attribute((OdfFileDom) this.ownerDocument); setOdfAttribute(attr); attr.setValue(textKey2Value); } /** * Receives the value of the ODFDOM attribute representation <code>TextKey2PhoneticAttribute</code> , See {@odf.attribute text:key2-phonetic} * * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set and no default value defined. */ public String getTextKey2PhoneticAttribute() { TextKey2PhoneticAttribute attr = (TextKey2PhoneticAttribute) getOdfAttribute(OdfDocumentNamespace.TEXT, "key2-phonetic"); if (attr != null) { return String.valueOf(attr.getValue()); } return null; } /** * Sets the value of ODFDOM attribute representation <code>TextKey2PhoneticAttribute</code> , See {@odf.attribute text:key2-phonetic} * * @param textKey2PhoneticValue The type is <code>String</code> */ public void setTextKey2PhoneticAttribute(String textKey2PhoneticValue) { TextKey2PhoneticAttribute attr = new TextKey2PhoneticAttribute((OdfFileDom) this.ownerDocument); setOdfAttribute(attr); attr.setValue(textKey2PhoneticValue); } /** * Receives the value of the ODFDOM attribute representation <code>TextMainEntryAttribute</code> , See {@odf.attribute text:main-entry} * * @return - the <code>Boolean</code> , the value or <code>null</code>, if the attribute is not set and no default value defined. */ public Boolean getTextMainEntryAttribute() { TextMainEntryAttribute attr = (TextMainEntryAttribute) getOdfAttribute(OdfDocumentNamespace.TEXT, "main-entry"); if (attr != null) { return Boolean.valueOf(attr.booleanValue()); } return Boolean.valueOf(TextMainEntryAttribute.DEFAULT_VALUE); } /** * Sets the value of ODFDOM attribute representation <code>TextMainEntryAttribute</code> , See {@odf.attribute text:main-entry} * * @param textMainEntryValue The type is <code>Boolean</code> */ public void setTextMainEntryAttribute(Boolean textMainEntryValue) { TextMainEntryAttribute attr = new TextMainEntryAttribute((OdfFileDom) this.ownerDocument); setOdfAttribute(attr); attr.setBooleanValue(textMainEntryValue.booleanValue()); } /** * Receives the value of the ODFDOM attribute representation <code>TextStringValuePhoneticAttribute</code> , See {@odf.attribute text:string-value-phonetic} * * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set and no default value defined. */ public String getTextStringValuePhoneticAttribute() { TextStringValuePhoneticAttribute attr = (TextStringValuePhoneticAttribute) getOdfAttribute(OdfDocumentNamespace.TEXT, "string-value-phonetic"); if (attr != null) { return String.valueOf(attr.getValue()); } return null; } /** * Sets the value of ODFDOM attribute representation <code>TextStringValuePhoneticAttribute</code> , See {@odf.attribute text:string-value-phonetic} * * @param textStringValuePhoneticValue The type is <code>String</code> */ public void setTextStringValuePhoneticAttribute(String textStringValuePhoneticValue) { TextStringValuePhoneticAttribute attr = new TextStringValuePhoneticAttribute((OdfFileDom) this.ownerDocument); setOdfAttribute(attr); attr.setValue(textStringValuePhoneticValue); } @Override public void accept(ElementVisitor visitor) { if (visitor instanceof DefaultElementVisitor) { DefaultElementVisitor defaultVisitor = (DefaultElementVisitor) visitor; defaultVisitor.visit(this); } else { visitor.visit(this); } } }
e49285073985bc74cffecb81f22e83f53ff72950
b3a02d5f1f60cd584fbb6da1b823899607693f63
/04_DB Frameworks_Hibernate+Spring Data/08_Spring Data Intro EX/Problem_9_UserSystem/src/main/java/app/services/UserService.java
b9d8101cd7eb018da74b5b10b0db341b54db4c86
[ "MIT" ]
permissive
akkirilov/SoftUniProject
20bf0543c9aaa0a33364daabfddd5f4c3e400ba2
709d2d1981c1bb6f1d652fe4101c1693f5afa376
refs/heads/master
2021-07-11T02:53:18.108275
2018-12-04T20:14:19
2018-12-04T20:14:19
79,428,334
0
0
null
null
null
null
UTF-8
Java
false
false
1,145
java
package app.services; import java.util.List; import javax.transaction.Transactional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import app.entities.User; import app.repositories.UserRepository; @Service @Transactional public class UserService { @Autowired private UserRepository userRepository; public void saveAndFlush(User user) { userRepository.saveAndFlush(user); } public void save(User user) { userRepository.save(user); } public void save(List<User> users) { userRepository.saveAll(users); } public User findById(Long id) { return userRepository.getOne(id); } public User findByEmail(String email) { return userRepository.findByEmail(email); } public User findByUsername(String username) { return userRepository.findByUsername(username); } public List<User> findAll() { return userRepository.findAll(); } public boolean isExist(User user) { return userRepository.existsById(user.getId()); } public void setLastNameManual(User user, String lastName) { userRepository.setLastName(lastName, user.getId()); } }
ed4345f1899f58accc5985f96f1889996f84210e
8714a9c8271b5658a26369b16b0b6a730ce7616b
/sesionrdf/Tarea1.java
d35d469b3e2fbd893586f50585acfdf44b28fca8
[]
no_license
alfa310/gestion_del_conocimiento
1e7ba265c93259013baa37709acd25e031fdd5fa
6021110ab5ee40ac5a0aa032ecb19f6d645de8e4
refs/heads/main
2022-12-30T03:31:05.983644
2020-10-14T20:26:02
2020-10-14T20:26:02
303,585,455
0
0
null
null
null
null
UTF-8
Java
false
false
5,880
java
package sesionrdf; import java.util.*; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.Selector; import org.apache.jena.rdf.model.SimpleSelector; import org.apache.jena.rdf.model.StmtIterator; import org.apache.jena.vocabulary.VCARD; public class Tarea1 { public static void main(String[] args) { Model modeloAlumnos = ModelFactory.createDefaultModel(); Model modeloCorreos = ModelFactory.createDefaultModel(); Model modeloGrupos = ModelFactory.createDefaultModel(); modeloAlumnos.read( "https://raw.githubusercontent.com/andres-melgar/rdf/master/alumnos.rdf" ); modeloCorreos.read( "https://raw.githubusercontent.com/andres-melgar/rdf/master/correos.rdf" ); modeloGrupos.read( "https://raw.githubusercontent.com/andres-melgar/rdf/master/grupos.rdf" ); Model modelo = modeloGrupos.union(modeloAlumnos.union(modeloCorreos)); String action = args[0]; if (action.equals("codigo")) { String codigo = args[1]; String nombre = obtenerNombreDelCodigo(modelo, codigo); ArrayList<String> correos = obtenerCorreosDelCodigo(modelo, codigo); System.out.println("nombre: " + nombre); int index = 1; Iterator itr = correos.iterator(); //getting the Iterator while (itr.hasNext()) { //check if iterator has the elements System.out.println("correo " + index + ": " + itr.next()); index += 1; //printing the element and move to next } } else if (action.equals("nombre")) { int i = 2; String nombre = args[1]; while (i < args.length){ nombre += " " + args[i]; i++; } // String nombre = args[1] + " " + args[2] + " " + args[3] + " " + args[4]; String grupo = obtenerGrupoDelNombre(modelo, nombre); System.out.println("grupo: " + grupo); } else if (action.equals("grupo")) { String grupo = args[1]; ArrayList<String> correos = obtenerCorreosDelGrupo(modelo, grupo); Iterator itr = correos.iterator(); //getting the Iterator int index = 1; while (itr.hasNext()) { //check if iterator has the elements System.out.println("correo " + index + ": " + itr.next()); index += 1; //printing the element and move to next } } } public static ArrayList<String> obtenerCorreosDelGrupo( Model modelo, String grupo ) { ArrayList<String> correos = new ArrayList<String>(); Selector selector1 = new SimpleSelector( null, null, (RDFNode) modelo.createLiteral(grupo) ); StmtIterator iter1 = modelo.listStatements(selector1); if (iter1.hasNext()) { Resource grupoRes = iter1.nextStatement().getSubject(); Selector selector2 = new SimpleSelector(null, null, (RDFNode) grupoRes); StmtIterator iter2 = modelo.listStatements(selector2); ArrayList<String> codigos = new ArrayList<String>(); while (iter2.hasNext()) { codigos.add(iter2.nextStatement().getSubject().toString()); } Iterator itr = codigos.iterator(); while (itr.hasNext()) { Resource codigo = modelo.getResource(itr.next().toString()); Selector selector3 = new SimpleSelector( codigo, VCARD.EMAIL, (RDFNode) null ); StmtIterator iter3 = modelo.listStatements(selector3); while (iter3.hasNext()) { correos.add(iter3.nextStatement().getObject().toString()); } } } return correos; } public static String obtenerGrupoDelNombre(Model modelo, String nombre) { System.out.println("nombre: " + nombre); Selector selector = new SimpleSelector( null, null, (RDFNode) modelo.createLiteral(nombre) ); StmtIterator iterNombre = modelo.listStatements(selector); if (iterNombre.hasNext()) { Resource codigo = iterNombre.nextStatement().getSubject(); Property pertenece = modelo.getProperty( "https://raw.githubusercontent.com/andres-melgar/rdf/master/grupos.rdf#pertenece" ); Selector selectorNombre = new SimpleSelector( codigo, pertenece, (RDFNode) null ); StmtIterator iterGrupo = modelo.listStatements(selectorNombre); if (iterGrupo.hasNext()) { Resource grupo = iterGrupo.nextStatement().getObject().asResource(); Selector selector3 = new SimpleSelector( grupo, VCARD.GROUP, (RDFNode) null ); StmtIterator iter3 = modelo.listStatements(selector3); if (iter3.hasNext()) { return iter3.nextStatement().getObject().toString(); } } } return null; } public static String obtenerNombreDelCodigo(Model modelo, String codigo) { String codigoUri = "alum:" + codigo; Resource recurso = modelo.getResource(codigoUri); Selector selectorNombre = new SimpleSelector( recurso, VCARD.FN, (RDFNode) null ); StmtIterator iterNombre = modelo.listStatements(selectorNombre); if (iterNombre.hasNext()) { return iterNombre.nextStatement().getObject().toString(); } return null; } public static ArrayList<String> obtenerCorreosDelCodigo( Model modelo, String codigo ) { String codigoUri = "alum:" + codigo; Resource recurso = modelo.getResource(codigoUri); Selector selectorNombre = new SimpleSelector( recurso, VCARD.EMAIL, (RDFNode) null ); ArrayList<String> correos = new ArrayList<String>(); StmtIterator iter = modelo.listStatements(selectorNombre); while (iter.hasNext()) { correos.add(iter.nextStatement().getObject().toString()); } return correos; } }
21404df6d281f073a3fe54d2e94d74be2cf8412d
726b135a26ad4afb1def8a0459b0756685b7a263
/Buoi4_P1_Bai2/Main.java
df89f8f718b98829412d11969ef7cf30d443e5d0
[]
no_license
lehongnhung2k2/NITC-JavaHomework
a4f598ceb480f5613cade6fb7d35c75d8194648c
5e701a8e4737742d01d04158cacd3a74ec18c57c
refs/heads/main
2023-08-28T21:18:05.841960
2021-10-19T17:57:59
2021-10-19T17:57:59
416,146,392
0
0
null
null
null
null
UTF-8
Java
false
false
2,768
java
package QuanLyTruongHoc; import java.util.ArrayList; public class Main { public static void main(String[] args) { ArrayList<MonHoc> list_Mon = new ArrayList<MonHoc>(); list_Mon.add(new MonHoc("Toán")); list_Mon.add(new MonHoc("Lý")); list_Mon.add(new MonHoc("Hóa")); ArrayList<GiaoVien> list_GV = new ArrayList<GiaoVien>(); list_GV.add(new GiaoVien("Nguyễn Văn A", 30, "02990043", list_Mon.get(0))); list_GV.add(new GiaoVien("Nguyễn Văn B", 43, "02984743", list_Mon.get(2))); list_GV.add(new GiaoVien("Nguyễn Văn C", 25, "04628384", list_Mon.get(2))); list_GV.add(new GiaoVien("Nguyễn Văn D", 39, "03747855", list_Mon.get(1))); list_GV.add(new GiaoVien("Nguyễn Văn E", 43, "08647585", list_Mon.get(0))); ArrayList<BaoVe> list_BV = new ArrayList<BaoVe>(); list_BV.add(new BaoVe("Trần Thị A", 50, "02374849")); list_BV.add(new BaoVe("Trần Thị B", 54, "08849497")); list_BV.add(new BaoVe("Trần Thị C", 43, "08833839")); list_BV.add(new BaoVe("Trần Thị D", 65, "07364747")); list_BV.add(new BaoVe("Trần Thị E", 30, "07474889")); ArrayList<NV_VeSinh> list_VS = new ArrayList<NV_VeSinh>(); list_VS.add(new NV_VeSinh("Phạm Văn A",38 , "0374747")); list_VS.add(new NV_VeSinh("Phạm Văn B",38 , "0383745")); list_VS.add(new NV_VeSinh("Phạm Văn C",38 , "0273764")); list_VS.add(new NV_VeSinh("Phạm Văn D",38 , "0548889")); list_VS.add(new NV_VeSinh("Phạm Văn E",38 , "0478856")); ArrayList<HocSinh> list_HS = new ArrayList<HocSinh>(); list_HS.add(new HocSinh("Lê Hồng A", 19, "0737748")); list_HS.add(new HocSinh("Lê Hồng B", 19, "0484889")); list_HS.add(new HocSinh("Lê Hồng C", 19, "0937475")); list_HS.add(new HocSinh("Lê Hồng D", 19, "0948485")); list_HS.add(new HocSinh("Lê Hồng E", 19, "0774885")); System.out.println("Danh sách giáo viên:"); for (int i=0; i<5; i++) { System.out.printf("%s, %d, %s, %s\n", list_GV.get(i).getname(), list_GV.get(i).getage(), list_GV.get(i).getCCCD(), list_GV.get(i).getmon().mon); } System.out.println("\n"); System.out.println("Danh sách NV bảo vệ: "); for (int i=0; i<5; i++) { System.out.printf("%s, %d, %s\n", list_GV.get(i).getname(), list_GV.get(i).getage(), list_GV.get(i).getCCCD()); } System.out.println("\n"); System.out.println("Danh sách NV vệ sinh: "); for (int i=0; i<5; i++) { System.out.printf("%s, %d, %s\n", list_GV.get(i).getname(), list_GV.get(i).getage(), list_GV.get(i).getCCCD()); } System.out.println("\n"); System.out.println("Danh sách học sinh: "); for (int i=0; i<5; i++) { System.out.printf("%s, %d, %s\n", list_GV.get(i).getname(), list_GV.get(i).getage(), list_GV.get(i).getCCCD()); } } }
8f837da0d77e0cbb707c10abb7d993df584aa498
86dd2a15895b4eb7bc8b6a37be9f3e5b449ee3d6
/src/Controller/ModifyPartController.java
aaf6323694cdb9e44f7ac094466f297a5b7de053
[]
no_license
njhasty/Inventory-Management-System
e4d353ae71777d4aef072b55eb12128deb9ff2ed
c8660bd7c25b63b7deb0af12e76850aa9297dbf8
refs/heads/main
2023-02-24T06:36:57.032331
2021-01-30T13:27:35
2021-01-30T13:27:35
334,417,749
0
0
null
null
null
null
UTF-8
Java
false
false
11,210
java
package Controller; import Model.InHousePart; import Model.Inventory; import Model.OutSourcedPart; import Model.Part; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.input.MouseEvent; import javafx.scene.text.Text; import javafx.stage.Stage; import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; import static Controller.MainMenuController.*; import static Model.Inventory.*; /** This class manages modifying selected part of parts list */ public class ModifyPartController implements Initializable { private int partIndex = partToModifyIndex(); Stage stage; Parent scene; @FXML private TextField modMachineIDField; @FXML private Text partMachineID; @FXML private ToggleGroup modifyPartTG; @FXML private TextField modPartIdField; @FXML private TextField modPartNameField; @FXML private TextField modPartStockField; @FXML private TextField modPartMaxField; @FXML private TextField modPartMinField; @FXML private TextField modPartPriceCostField; @FXML private RadioButton inHouseRadio; @FXML private RadioButton outsourcedRadio; @FXML private TextField idField; @FXML private TextField nameField; @FXML private TextField invField; @FXML private TextField maxField; @FXML private TextField minField; @FXML private TextField priceCostField; @FXML private TextField machineIDField; @FXML private Button saveButton; @FXML private Button cancelButton; private int partID; /** This is the cancel button click event handler. * Method to cancel modified part, return to main screen. * @param event The arguments mouse event. * @return void. */ @FXML void cancelButtonClick(MouseEvent event) throws IOException { try { Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setTitle("Exit to Main Screen"); alert.setHeaderText("Are you sure you want to cancel modify part?"); alert.setContentText("Press OK to exit to the main screen. Press cancel to stay on this screen."); alert.showAndWait(); if (alert.getResult() == ButtonType.OK) { stage = (Stage) ((Button) event.getSource()).getScene().getWindow(); scene = FXMLLoader.load(getClass().getResource("/View/MainMenu.fxml")); stage.setScene(new Scene(scene)); stage.show(); } else { alert.close(); } } catch (IOException e) { } } /** This is the save button click event handler. * Method to save modified part, return to main screen. * @param event The arguments mouse event. * @return void. */ @FXML void saveButtonClick(MouseEvent event) throws IOException { int partID = getAllParts().get(partIndex).getPartID(); String partName = modPartNameField.getText(); int stock = Integer.parseInt(modPartStockField.getText()); int max = Integer.parseInt(modPartMaxField.getText()); int min = Integer.parseInt(modPartMinField.getText()); double price = Double.parseDouble(modPartPriceCostField.getText()); int machineID = Integer.parseInt(modMachineIDField.getText()); String companyName = modMachineIDField.getText(); if (partName.equals("") || partName.equals(null)) { Alert alertNameNull = new Alert(Alert.AlertType.WARNING); alertNameNull.setTitle("Modify Part Error"); alertNameNull.setHeaderText("Part Name cannot be empty"); alertNameNull.setContentText("Please type name of Part"); alertNameNull.showAndWait(); } if (stock < min || stock > max) { Alert alertStockMaxMin = new Alert(Alert.AlertType.WARNING); alertStockMaxMin.setTitle("Modify Part Error"); alertStockMaxMin.setHeaderText("Inv must be greater than min, less than max"); alertStockMaxMin.setContentText("Please type correct amount for stock"); alertStockMaxMin.showAndWait(); } if (max < min) { Alert alertStockMaxMin = new Alert(Alert.AlertType.WARNING); alertStockMaxMin.setTitle("Modify Part Error"); alertStockMaxMin.setHeaderText("Max must be greater than min"); alertStockMaxMin.setContentText("Please type correct amount for max"); alertStockMaxMin.showAndWait(); } if (min > max) { Alert alertStockMaxMin = new Alert(Alert.AlertType.WARNING); alertStockMaxMin.setTitle("Modify Part Error"); alertStockMaxMin.setHeaderText("Min must be less than Max"); alertStockMaxMin.setContentText("Please type correct amount for min"); alertStockMaxMin.showAndWait(); } if (price <= 0.00) { Alert alertPrice = new Alert(Alert.AlertType.WARNING); alertPrice.setTitle("Modify Part Error"); alertPrice.setHeaderText("Price cannot be less than or equal to 0.00"); alertPrice.setContentText("Please type correct amount for price"); alertPrice.showAndWait(); } else if (!partName.contains("") && !partName.contains(null) && stock > min && stock < max && max > min && min < max && price >=0.00) { if (inHouseRadio.isSelected()) { InHousePart inHousePart = new InHousePart(partID, partName, price, stock, min, max, machineID); Inventory.updatePart(partIndex, inHousePart); stage = (Stage) ((Button) event.getSource()).getScene().getWindow(); scene = FXMLLoader.load(getClass().getResource("/View/MainMenu.fxml")); stage.setScene(new Scene(scene)); stage.show(); } else if (outsourcedRadio.isSelected()) { OutSourcedPart outSourcedPart = new OutSourcedPart(partID, partName, price, stock, min, max, companyName); Inventory.updatePart(partIndex, outSourcedPart); stage = (Stage) ((Button) event.getSource()).getScene().getWindow(); scene = FXMLLoader.load(getClass().getResource("/View/MainMenu.fxml")); stage.setScene(new Scene(scene)); stage.show(); } } } /** This is the toggle group for in house and outsourced radio buttons. * Toggle group for in house or outsourced radio buttons. * @param actionEvent The arguments mouse event. * @return void. */ public void setModifyPartTG(ActionEvent actionEvent) { this.modifyPartTG = modifyPartTG; inHouseRadio.setToggleGroup(modifyPartTG); outsourcedRadio.setToggleGroup(modifyPartTG); } /** This is the getModifyPartTG event handler. * @param actionEvent The arguments mouse event. * @return void. */ public void getModifyPartTG(ActionEvent actionEvent) throws Exception { } /** This is the in house radio button click event handler. * Method to select radio button, update text and field. * @param event The arguments mouse event. * @return void. */ public void inHouseRadioClick(MouseEvent event) { partMachineID.setText("Machine ID"); machineIDField.setPromptText("Machine ID"); } /** This is the outsourced radio button click event handler. * Method to select radio button, update text and field. * @param event The arguments mouse event. * @return void. */ public void outsourcedRadioClick(MouseEvent event) { partMachineID.setText("Company Name"); machineIDField.setPromptText("Company Name"); } /** This is the textFieldPartID event handler. * @param actionEvent The arguments mouse event. * @return void. */ public void textFieldPartID(ActionEvent actionEvent) { } /** This is the textFieldPartName event handler. * @param actionEvent The arguments mouse event. * @return void. */ public void textFieldPartName(ActionEvent actionEvent) { } /** This is the textFieldPartStock event handler. * @param actionEvent The arguments mouse event. * @return void. */ public void textFieldPartStock(ActionEvent actionEvent) { } /** This is the textFieldPartMax event handler. * @param actionEvent The arguments mouse event. * @return void. */ public void textFieldPartMax(ActionEvent actionEvent) { } /** This is the textFieldPartMin event handler. * @param actionEvent The arguments mouse event. * @return void. */ public void textFieldPartMin(ActionEvent actionEvent) { } /** This is the textFieldPartPriceCostField event handler. * @param actionEvent The arguments mouse event. * @return void. */ public void textFieldPartPriceCostField(ActionEvent actionEvent) { } /** This is the textFieldMachineID event handler. * @param actionEvent The arguments mouse event. * @return void. */ public void textFieldMachineID(ActionEvent actionEvent) { } /** This is the initialize method for screen. * Method to opens screen that contains previously selected part to modify including if part is in house or outsourced. * @param url Pass url. * @param rb Pass rb. * @return void. */ @Override public void initialize(URL url, ResourceBundle rb) { Part part = getAllParts().get(partIndex); modPartIdField.setText("Auto Gen - Disabled "); modPartNameField.setText(part.getName()); modPartStockField.setText(Integer.toString(part.getStock())); modPartPriceCostField.setText(Double.toString(part.getPrice())); modPartMaxField.setText(Integer.toString(part.getMax())); modPartMinField.setText(Integer.toString(part.getMin())); if (part instanceof InHousePart) { modMachineIDField.setText("Machine ID"); modMachineIDField.setText(Integer.toString(((InHousePart) getAllParts().get(partIndex)).getMachineID())); inHouseRadio.setSelected(true); } else { modMachineIDField.setText("Company Name"); modMachineIDField.setText(((OutSourcedPart) getAllParts().get(partIndex)).getCompanyName()); outsourcedRadio.setSelected(true); } } }
e2a0494adadda6801abc1e1fefe57f708978e5e6
8b36b765d5e05151edb67fd4fdc060ffd19f777d
/src/test/java/com/nebhale/newrelicservicebroker/catalog/CatalogControllerTest.java
8a69adda039593220ee20df54387a64b6a00c2e2
[ "Apache-2.0" ]
permissive
amulyas/new-relic-service-broker
48ec3ee428823fb8ca4579817e4b432bf01dbddb
8302ecf2448aa9e9b400030348d32d7a04fccf0c
refs/heads/master
2021-01-18T03:26:14.836688
2015-10-23T18:54:03
2015-10-23T18:54:03
44,832,050
0
0
null
2015-10-23T18:49:25
2015-10-23T18:49:24
null
UTF-8
Java
false
false
1,317
java
/* * Copyright 2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.nebhale.newrelicservicebroker.catalog; import com.nebhale.newrelicservicebroker.AbstractControllerTest; import org.junit.Test; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; public final class CatalogControllerTest extends AbstractControllerTest { @Test public void catalog() throws Exception { this.mockMvc.perform(get("/v2/catalog")) .andExpect(status().isOk()) .andExpect(jsonPath("$.services").exists()); } }
a44048d6647dd110ca61302277f278606b86a2f1
9dcdb2c0006ab299017464337260dd09bcca3014
/app/src/test/java/com/iamtodor/contactaccess/ExampleUnitTest.java
ff8166218116aac15e4a227f71b83ede62388fef
[]
no_license
iamtodor/contact-access
fe6e66df07354a9cf6c296d27cf49d1ba87e8ec1
5187485ccf6cdacba034f827fd022832d7d2748e
refs/heads/master
2021-01-25T05:44:34.676763
2017-02-02T23:18:42
2017-02-02T23:18:42
80,674,477
0
0
null
null
null
null
UTF-8
Java
false
false
404
java
package com.iamtodor.contactaccess; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
8be0f6923f6e7bcdadad313d0812fe0b387c9ee9
10d2e01f89d94aac94c8a6226f8b050fec396769
/app/src/main/java/com/luthfy/tugas_uas_genap_2021_akb_if_9_10118379/Model/AdapterTourPlace.java
b6fcc6c857276388e48aed15a0822adaf88f41ca
[]
no_license
luthfykarliandi007/Tugas-UAS-Genap-2021-AKB-IF-9-10118379
a5e122910a01870b5a27049b7d851fce8d91b67f
68d57ab77fb5496e34aaf27f60ce9766731d73f0
refs/heads/master
2023-07-13T22:00:50.059157
2021-08-14T10:52:57
2021-08-14T10:52:57
395,941,892
0
0
null
null
null
null
UTF-8
Java
false
false
3,207
java
package com.luthfy.tugas_uas_genap_2021_akb_if_9_10118379.Model; import android.app.Activity; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.luthfy.tugas_uas_genap_2021_akb_if_9_10118379.R; import com.luthfy.tugas_uas_genap_2021_akb_if_9_10118379.View.DetailActivity; import java.util.ArrayList; import androidx.annotation.NonNull; import androidx.cardview.widget.CardView; import androidx.recyclerview.widget.RecyclerView; /** NIM : 10118379 * Nama : Luthfy Karliandi Nugraha * Kelas : IF-9 * **/ public class AdapterTourPlace extends RecyclerView.Adapter<AdapterTourPlace.TourPlaceViewHolder> { private ArrayList<TourPlace> listTourPlace = new ArrayList<>(); private Activity activity; public AdapterTourPlace(Activity activity){ this.activity = activity; } public ArrayList<TourPlace> getListNotes(){ return listTourPlace; } public void setListNotes(ArrayList<TourPlace> listNotes){ if (listNotes.size() > 0 ){ this.listTourPlace.clear(); } this.listTourPlace.addAll(listNotes); notifyDataSetChanged(); } @NonNull @Override public AdapterTourPlace.TourPlaceViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_note, parent, false); return new TourPlaceViewHolder(view); } @Override public void onBindViewHolder(@NonNull TourPlaceViewHolder holder, int position) { holder.tvNama.setText(listTourPlace.get(position).getNama()); holder.tvWaktuBuka.setText(listTourPlace.get(position).getWaktuBuka()); Glide.with(activity) .asBitmap() .load(listTourPlace.get(position).getFoto()) .into(holder.tvFoto); holder.cvNote.setOnClickListener(new CustomClickListener(position, new CustomClickListener.OnItemClickCallback() { @Override public void onItemClicked(View view, int position) { Intent intent = new Intent(activity, DetailActivity.class); intent.putExtra(DetailActivity.EXTRA_POSITION, position); intent.putExtra(DetailActivity.EXTRA_NOTE, listTourPlace.get(position)); activity.startActivityForResult(intent, DetailActivity.REQUEST_UPDATE); } })); } @Override public int getItemCount() { return listTourPlace.size(); } public class TourPlaceViewHolder extends RecyclerView.ViewHolder{ final TextView tvNama, tvWaktuBuka; final ImageView tvFoto; final CardView cvNote; public TourPlaceViewHolder(@NonNull View itemView) { super(itemView); tvNama = itemView.findViewById(R.id.nama_wisata); tvWaktuBuka = itemView.findViewById(R.id.waktuBuka); tvFoto = itemView.findViewById(R.id.gambar_wisata); cvNote = itemView.findViewById(R.id.cv_item_note); } } }
4fb49218d54040023bab8dd020ca3911d8451802
131681e98612051e8070504e991fd9b0a4425410
/src/main/java/com/cillian/bigdataanalytics/App.java
08500ac38f8504ee2d8feae726a9e09c1a0fc6ed
[]
no_license
cilliand/MahoutTrustRecommender
46d3bb6fb8b47be286db7c6eb779ba8adc3f0ddf
1c68f31e057c4e0f4e7c4ed9aae09fb38dca40f5
refs/heads/master
2021-01-10T13:43:16.241383
2016-03-19T14:16:24
2016-03-19T14:16:24
53,268,953
0
1
null
null
null
null
UTF-8
Java
false
false
12,985
java
package com.cillian.bigdataanalytics; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.TreeMap; import org.apache.mahout.cf.taste.common.Refreshable; import org.apache.mahout.cf.taste.common.TasteException; import org.apache.mahout.cf.taste.eval.IRStatistics; import org.apache.mahout.cf.taste.eval.RecommenderBuilder; import org.apache.mahout.cf.taste.eval.RecommenderEvaluator; import org.apache.mahout.cf.taste.eval.RecommenderIRStatsEvaluator; import org.apache.mahout.cf.taste.impl.common.FastByIDMap; import org.apache.mahout.cf.taste.impl.common.FastIDSet; import org.apache.mahout.cf.taste.impl.eval.AverageAbsoluteDifferenceRecommenderEvaluator; import org.apache.mahout.cf.taste.impl.eval.GenericRecommenderIRStatsEvaluator; import org.apache.mahout.cf.taste.impl.eval.RMSRecommenderEvaluator; import org.apache.mahout.cf.taste.impl.model.file.FileDataModel; import org.apache.mahout.cf.taste.impl.neighborhood.NearestNUserNeighborhood; import org.apache.mahout.cf.taste.impl.neighborhood.ThresholdUserNeighborhood; import org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender; import org.apache.mahout.cf.taste.impl.recommender.GenericUserBasedRecommender; import org.apache.mahout.cf.taste.impl.recommender.slopeone.SlopeOneRecommender; import org.apache.mahout.cf.taste.impl.similarity.EuclideanDistanceSimilarity; import org.apache.mahout.cf.taste.impl.similarity.LogLikelihoodSimilarity; import org.apache.mahout.cf.taste.impl.similarity.PearsonCorrelationSimilarity; import org.apache.mahout.cf.taste.impl.similarity.SpearmanCorrelationSimilarity; import org.apache.mahout.cf.taste.impl.similarity.TanimotoCoefficientSimilarity; import org.apache.mahout.cf.taste.model.DataModel; import org.apache.mahout.cf.taste.neighborhood.UserNeighborhood; import org.apache.mahout.cf.taste.recommender.RecommendedItem; import org.apache.mahout.cf.taste.recommender.Recommender; import org.apache.mahout.cf.taste.similarity.ItemSimilarity; import org.apache.mahout.cf.taste.similarity.PreferenceInferrer; import org.apache.mahout.cf.taste.similarity.UserSimilarity; /** * Hello world! * */ public class App { public static FastByIDMap<FastIDSet> loadTrustData() { FastByIDMap<FastIDSet> trustMap = new FastByIDMap<FastIDSet>(); try { // Read input BufferedReader br = new BufferedReader(new FileReader("trust.csv")); String line; while ((line = br.readLine()) != null) { String[] split = line.split(","); if (!trustMap.containsKey(Long.parseLong(split[0]))) { trustMap.put(Long.parseLong(split[0]), new FastIDSet()); } trustMap.get(Long.parseLong(split[0])).add(Long.parseLong(split[1])); } br.close(); } catch (IOException e) { System.out.println("Could not load trust.csv"); System.exit(0); } return trustMap; } static DataModel model; static int maxNeighbours; static BufferedWriter bw; public static void main(String[] args) throws IOException, TasteException { model = new FileDataModel(new File("ratings.csv")); maxNeighbours = 1000; bw = new BufferedWriter(new FileWriter("output.csv")); testUserBasedSimilarity(); testTrustSimilarity(); bw.flush(); bw.close(); testItemBasedSimilarity(); testSlopeOneRecommender(); } public static void testUserBasedSimilarity() throws TasteException, IOException { System.out.println("User Based Simiarlity"); System.out.println("----------------------"); for (int i = 10; i <= maxNeighbours; i += 10) { final int numNeighbours = i; RecommenderBuilder recommenderBuilder = new RecommenderBuilder() { public Recommender buildRecommender(DataModel model) throws TasteException { UserSimilarity similarity = new PearsonCorrelationSimilarity(model); UserNeighborhood neighborhood = new NearestNUserNeighborhood(numNeighbours, similarity, model); return new GenericUserBasedRecommender(model, neighborhood, similarity); } }; RecommenderEvaluator scoreEvaluator = new AverageAbsoluteDifferenceRecommenderEvaluator(); double score = scoreEvaluator.evaluate(recommenderBuilder, null, model, 0.9, 0.1); String a = "EuclideanDistanceSimilarity"; String b = "Pearson"; int diff = (a.length() - b.length())+20; System.out.format("Pearson Score: %"+diff+"s Neighbours: %3d\n", score, numNeighbours); bw.write("Pearson,"+score+","+numNeighbours+"\n"); //System.out.println("Pearons Score: " + score + " Neighbours: " + numNeighbours); } // Spearman for (int i = 10; i <= maxNeighbours; i += 10) { final int numNeighbours = i; RecommenderBuilder recommenderBuilder = new RecommenderBuilder() { public Recommender buildRecommender(DataModel model) throws TasteException { UserSimilarity similarity = new SpearmanCorrelationSimilarity(model); UserNeighborhood neighborhood = new NearestNUserNeighborhood(numNeighbours, similarity, model); return new GenericUserBasedRecommender(model, neighborhood, similarity); } }; RecommenderEvaluator scoreEvaluator = new AverageAbsoluteDifferenceRecommenderEvaluator(); double score = scoreEvaluator.evaluate(recommenderBuilder, null, model, 0.9, 0.1); String a = "EuclideanDistanceSimilarity"; String b = "Spearman"; int diff = (a.length() - b.length())+20; bw.write("Spearman,"+score+","+numNeighbours+"\n"); System.out.format("Spearman Score: %"+diff+"s Neighbours: %3d\n", score, numNeighbours); } // LogLikelihood for (int i = 10; i <= maxNeighbours; i += 10) { final int numNeighbours = i; RecommenderBuilder recommenderBuilder = new RecommenderBuilder() { public Recommender buildRecommender(DataModel model) throws TasteException { UserSimilarity similarity = new LogLikelihoodSimilarity(model); UserNeighborhood neighborhood = new NearestNUserNeighborhood(numNeighbours, similarity, model); return new GenericUserBasedRecommender(model, neighborhood, similarity); } }; RecommenderEvaluator scoreEvaluator = new AverageAbsoluteDifferenceRecommenderEvaluator(); double score = scoreEvaluator.evaluate(recommenderBuilder, null, model, 0.9, 0.1); String a = "EuclideanDistanceSimilarity"; String b = "LogLikelihoodSimilarity"; int diff = (a.length() - b.length())+20; bw.write("LogLikelihoodSimilarity,"+score+","+numNeighbours+"\n"); System.out.format("LogLikelihoodSimilarity Score: %"+diff+"s Neighbours: %3d\n", score, numNeighbours); } //EuclideanDistanceSimilarity for (int i = 10; i <= maxNeighbours; i += 10) { final int numNeighbours = i; RecommenderBuilder recommenderBuilder = new RecommenderBuilder() { public Recommender buildRecommender(DataModel model) throws TasteException { UserSimilarity similarity = new EuclideanDistanceSimilarity(model); UserNeighborhood neighborhood = new NearestNUserNeighborhood(numNeighbours, similarity, model); return new GenericUserBasedRecommender(model, neighborhood, similarity); } }; RecommenderEvaluator scoreEvaluator = new AverageAbsoluteDifferenceRecommenderEvaluator(); double score = scoreEvaluator.evaluate(recommenderBuilder, null, model, 0.9, 0.1); bw.write("EuclideanDistanceSimilarity,"+score+","+numNeighbours+"\n"); System.out.format("EuclideanDistanceSimilarity Score: %20s Neighbours: %3d\n", score, numNeighbours); } // Tanimoto for (int i = 10; i <= maxNeighbours; i += 10) { final int numNeighbours = i; RecommenderBuilder recommenderBuilder = new RecommenderBuilder() { public Recommender buildRecommender(DataModel model) throws TasteException { UserSimilarity similarity = new TanimotoCoefficientSimilarity(model); UserNeighborhood neighborhood = new NearestNUserNeighborhood(numNeighbours, similarity, model); return new GenericUserBasedRecommender(model, neighborhood, similarity); } }; RecommenderEvaluator scoreEvaluator = new AverageAbsoluteDifferenceRecommenderEvaluator(); double score = scoreEvaluator.evaluate(recommenderBuilder, null, model, 0.9, 0.1); String a = "EuclideanDistanceSimilarity"; String b = "TanimotoCoefficient"; int diff = (a.length() - b.length())+20; bw.write("TanimotoCoefficient,"+score+","+numNeighbours+"\n"); System.out.format("TanimotoCoefficient Score: %"+diff+"s Neighbours: %3d\n", score, numNeighbours); } } public static void testTrustSimilarity() throws TasteException, IOException { System.out.println("Trust Based Simiarlity"); System.out.println("----------------------"); final FastByIDMap<FastIDSet> trustMap = loadTrustData(); for (int i = 10; i <= maxNeighbours; i += 10) { final int numNeighbours = i; RecommenderBuilder recommenderBuilder = new RecommenderBuilder() { public Recommender buildRecommender(DataModel model) throws TasteException { UserSimilarity similarity = new TrustSimilarity(trustMap); UserNeighborhood neighborhood = new NearestNUserNeighborhood(numNeighbours, similarity, model); return new GenericUserBasedRecommender(model, neighborhood, similarity); } }; RecommenderEvaluator scoreEvaluator = new AverageAbsoluteDifferenceRecommenderEvaluator(); double score = scoreEvaluator.evaluate(recommenderBuilder, null, model, 0.9, 0.1); bw.write("TrustSimilarity,"+score+","+numNeighbours+"\n"); System.out.println("TrustSimilarity Score: " + score + " Neighbours: " + numNeighbours); } } public static void testItemBasedSimilarity() throws TasteException { System.out.println("Item Based Simiarlity"); System.out.println("----------------------"); RecommenderBuilder recommenderBuilder = new RecommenderBuilder() { public Recommender buildRecommender(DataModel model) throws TasteException { ItemSimilarity similarity = new PearsonCorrelationSimilarity(model); return new GenericItemBasedRecommender(model, similarity); } }; RecommenderEvaluator scoreEvaluator = new AverageAbsoluteDifferenceRecommenderEvaluator(); double score = scoreEvaluator.evaluate(recommenderBuilder, null, model, 0.9, 0.1); System.out.println("Pearson Score: " + score); // recommenderBuilder = new RecommenderBuilder() { // public Recommender buildRecommender(DataModel model) throws TasteException { // ItemSimilarity similarity = new SpearmanCorrelationSimilarity(model); // return new GenericItemBasedRecommender(model, similarity); // } // }; // // scoreEvaluator = new AverageAbsoluteDifferenceRecommenderEvaluator(); // score = scoreEvaluator.evaluate(recommenderBuilder, null, model, 0.9, 0.1); // // System.out.println("Spearman Score: " + score); recommenderBuilder = new RecommenderBuilder() { public Recommender buildRecommender(DataModel model) throws TasteException { ItemSimilarity similarity = new LogLikelihoodSimilarity(model); return new GenericItemBasedRecommender(model, similarity); } }; scoreEvaluator = new AverageAbsoluteDifferenceRecommenderEvaluator(); score = scoreEvaluator.evaluate(recommenderBuilder, null, model, 0.9, 0.1); System.out.println("LogLikelihoodSimilarity Score: " + score); recommenderBuilder = new RecommenderBuilder() { public Recommender buildRecommender(DataModel model) throws TasteException { ItemSimilarity similarity = new EuclideanDistanceSimilarity(model); return new GenericItemBasedRecommender(model, similarity); } }; scoreEvaluator = new AverageAbsoluteDifferenceRecommenderEvaluator(); score = scoreEvaluator.evaluate(recommenderBuilder, null, model, 0.9, 0.1); System.out.println("EuclideanDistanceSimilarity Score: " + score); recommenderBuilder = new RecommenderBuilder() { public Recommender buildRecommender(DataModel model) throws TasteException { ItemSimilarity similarity = new TanimotoCoefficientSimilarity(model); return new GenericItemBasedRecommender(model, similarity); } }; scoreEvaluator = new AverageAbsoluteDifferenceRecommenderEvaluator(); score = scoreEvaluator.evaluate(recommenderBuilder, null, model, 0.9, 0.1); System.out.println("Tanimoto Score: " + score); } public static void testSlopeOneRecommender() throws TasteException{ RecommenderBuilder recommenderBuilder = new RecommenderBuilder() { public Recommender buildRecommender(DataModel model) throws TasteException { Recommender recommender = new SlopeOneRecommender(model); return recommender; } }; RecommenderEvaluator scoreEvaluator = new AverageAbsoluteDifferenceRecommenderEvaluator(); double score = scoreEvaluator.evaluate(recommenderBuilder, null, model, 0.9, 0.1); System.out.println("SlopeOne Score: " + score); } }
b5502ac097f6937122b068a3cc7999f7a565c6c2
5eac9ba7487a4fb66fd23f0322799c97848b4435
/PAS/.svn/pristine/2d/2d575a46bc2bffceddd18ea1db54a9f19f654a25.svn-base
3ea4fed6a7b37392a6a1ac14819009bf7043ce8a
[]
no_license
mugi22/PAS
dbf637c18543906971dce1dc587e1fa51376a2f7
d10979e295826f648822fa577d778183beb218c7
refs/heads/master
2021-01-10T22:28:54.760297
2015-07-15T07:24:24
2015-07-15T07:24:24
35,809,023
0
0
null
null
null
null
UTF-8
Java
false
false
1,239
package co.id.pegadaian.pasg2.pojo; // Generated Mar 2, 2015 11:08:12 AM by Hibernate Tools 4.0.0 import java.math.BigDecimal; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * TblProvinsi generated by hbm2java */ @Entity @Table(name = "TBL_PROVINSI", schema = "PASG2") public class TblProvinsi extends AuditTrail implements java.io.Serializable { private String kodeProvinsi; private String namaProvinsi; public TblProvinsi() { } public TblProvinsi(String kodeProvinsi, String namaProvinsi) { this.kodeProvinsi = kodeProvinsi; this.namaProvinsi = namaProvinsi; } @Id @Column(name = "KODE_PROVINSI", unique = true, nullable = false, length = 2) public String getKodeProvinsi() { return this.kodeProvinsi; } public void setKodeProvinsi(String kodeProvinsi) { this.kodeProvinsi = kodeProvinsi; } @Column(name = "NAMA_PROVINSI", nullable = false, length = 100) public String getNamaProvinsi() { return this.namaProvinsi; } public void setNamaProvinsi(String namaProvinsi) { this.namaProvinsi = namaProvinsi; } }
74e291392c150dae0e269d1918f1906d30c09a85
6054d5bf767794ea9abcda77dc59b0459cc03e17
/strategies/failed/src/main/java/org/arquillian/smart/testing/strategies/failed/surefire/SurefireReader.java
7b0215ad4f1fbba9f5f081435d932a872dfde441
[ "Apache-2.0" ]
permissive
dipak-pawar/smart-testing
77d7f3ac72eb31447e5d7165d3201ba5830c4363
cd01522924a32a49218bb98c4eaa0a887acf7316
refs/heads/master
2021-01-21T18:25:09.294762
2017-05-18T14:25:58
2017-05-18T14:25:58
92,045,734
0
1
null
2017-05-22T11:23:40
2017-05-22T11:23:40
null
UTF-8
Java
false
false
3,617
java
package org.arquillian.smart.testing.strategies.failed.surefire; import java.io.InputStream; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.events.Attribute; import javax.xml.stream.events.EndElement; import javax.xml.stream.events.StartElement; import javax.xml.stream.events.XMLEvent; import org.arquillian.smart.testing.strategies.failed.TestResult; // TODO move to spi for others implementations // TODO should we just return failures/errors/rerunFailures or the reader should add all of them and filter later? If moved to SPI then all public class SurefireReader { public static Set<TestResult> loadTestResults(InputStream surefireInputStream) throws XMLStreamException { final Set<TestResult> testResults = new HashSet<>(); final XMLInputFactory inputFactory = XMLInputFactory.newInstance(); XMLEventReader eventReader = inputFactory.createXMLEventReader(surefireInputStream); TestResult currentTestResult = null; while (eventReader.hasNext()) { XMLEvent event = eventReader.nextEvent(); if (event.isStartElement()) { final StartElement startElement = event.asStartElement(); if ("testcase".equalsIgnoreCase(startElement.getName().getLocalPart())) { // Read attributes String name = null, classname = null, duration = null; final Iterator<Attribute> attributes = startElement.getAttributes(); while (attributes.hasNext()) { final Attribute attribute = attributes.next(); if ("classname".equalsIgnoreCase(attribute.getName().toString())) { classname = attribute.getValue(); } if ("name".equalsIgnoreCase(attribute.getName().toString())) { name = attribute.getValue(); } if ("time".equalsIgnoreCase(attribute.getName().toString())) { duration = attribute.getValue(); } } final float durationInSeconds = Float.parseFloat(duration); currentTestResult = new TestResult(classname, name, durationInSeconds); } if ("failure".equalsIgnoreCase(startElement.getName().getLocalPart())) { currentTestResult.setResult(TestResult.Result.FAILURE); } if ("error".equalsIgnoreCase(startElement.getName().getLocalPart())) { currentTestResult.setResult(TestResult.Result.ERROR); } if ("skipped".equalsIgnoreCase(startElement.getName().getLocalPart())) { currentTestResult.setResult(TestResult.Result.SKIPPED); } if ("rerunFailure".equalsIgnoreCase(startElement.getName().getLocalPart())) { currentTestResult.setResult(TestResult.Result.RE_RUN_FAILURE); } } if (event.isEndElement()) { final EndElement endElementElement = event.asEndElement(); if ("testcase".equalsIgnoreCase(endElementElement.getName().getLocalPart())) { testResults.add(currentTestResult); } } } return testResults; } }
191d9e106506d248fb91b38f7a7e552f366ba4bb
f874bd87bdb9df2f88c63e66f8120c7d1979736c
/src/org/sdu/android/util/otherUtil/CopiedIterator.java
a46452ec9297d6916ceb43970b26ed6485c8876e
[]
no_license
ywzhang909/SDUGameEngine
11aca759c0b72a5cb878484a947a311b05d86bd6
551725308812b8bc4e6049485a81a621ad32a134
refs/heads/master
2021-01-20T22:59:04.913788
2012-11-15T12:18:35
2012-11-15T12:18:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
586
java
package org.sdu.android.util.otherUtil; import java.util.Iterator; import java.util.LinkedList; public class CopiedIterator implements Iterator { private Iterator iterator = null; public CopiedIterator(Iterator itr) { LinkedList list = new LinkedList(); while (itr.hasNext()) { list.add(itr.next()); } this.iterator = list.iterator(); } public boolean hasNext() { return this.iterator.hasNext(); } public void remove( ) { throw new UnsupportedOperationException("This is a read-only iterator."); } public Object next() { return this.iterator.next(); } }
a29a3760dbbf96760b7612693bbf30b00f3a7a56
d1dabe42cc6e8402f22fdcd347720283f879d5f0
/src/main/java/com/anping/yueche/controller/YuecheController.java
a88f54f1b5a45ae7b4714361de6f8ccf77ffe148
[]
no_license
Betteronly/MyWeiXin_youtry
49600f51b31466962e0031e3fe8568e296dc6561
ba7ec7f562f76e8b2eb7a77bb5bcc2dc18b1e472
refs/heads/master
2021-01-21T17:09:45.287113
2017-07-04T15:56:28
2017-07-04T15:56:28
91,935,904
1
0
null
null
null
null
UTF-8
Java
false
false
8,070
java
package com.anping.yueche.controller; import com.anping.yueche.entity.CodeItem; import com.anping.yueche.pojo.CarOrderInfo; import com.anping.yueche.pojo.ServiceTelCallHistory; import com.anping.yueche.pojo.UserInfo; import com.anping.yueche.service.CommonService; import com.anping.yueche.service.YuecheService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import javax.servlet.ServletRequest; import javax.servlet.http.HttpServletRequest; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import static com.anping.yueche.utils.CommonConstants.*; import com.youtry.myweixin_youtry.util.SendSMSUtil; @Controller @RequestMapping("/yueche") public class YuecheController { private static Logger log = LoggerFactory.getLogger(YuecheController.class); @Autowired private YuecheService yuecheService; @Autowired private CommonService commonService; public YuecheController() { super(); } /** * 约车首页显示 * * @param httpRequest * @param model * @param openId * @param servletRequest * @return */ @RequestMapping(value = { "/yuecheIndex", "/", "/index" }, method = RequestMethod.GET) public String yuecheIndex(HttpServletRequest httpRequest, Model model, String openId, ServletRequest servletRequest) { // String openId = openId; // 参数传入方式 // String openId2 = httpRequest.getParameter("openId"); // 获取参数方式 // 微信传入用户信息 // SNSUserInfo SNSuserInfo = (SNSUserInfo) httpRequest.getAttribute("snsUserInfo"); // 状态值 // String state = (String) httpRequest.getAttribute("state"); // 微信静默方式传入OpenID查询用户信息 if (!StringUtils.isEmpty(openId)) { UserInfo userInfo = yuecheService.getUserInfo(openId); model.addAttribute("openId", openId); // 客户NO if (userInfo != null) { model.addAttribute("userNo", userInfo.getUserNo()); } else { model.addAttribute("userNo", ""); } // 客户昵称 if (userInfo != null) { model.addAttribute("nickName", userInfo.getNickName()); } else { model.addAttribute("nickName", ""); } // 客户姓名 if (userInfo != null) { model.addAttribute("name", userInfo.getName()); } else { model.addAttribute("name", ""); } // 客户手机号码 if (userInfo != null) { model.addAttribute("orderPhone", userInfo.getPhone()); } else { model.addAttribute("orderPhone", ""); } } // 出发地 List<CodeItem> addrFromList = commonService.getCodeItemList(ADDR_FROM_LIST); model.addAttribute("addrFromList", addrFromList); // 目的地 List<CodeItem> addrToList = commonService.getCodeItemList(ADDR_TO_LIST); model.addAttribute("addrToList", addrToList); // model.addAttribute("anpingServiceTel", "10086"); // 出发日期 // List<CodeItem> departDateList = commonService.getCodeItemList(DEPART_DATE_LIST); List<CodeItem> departDateList = new ArrayList<CodeItem>(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); //设置日期格式 Date today = new Date(); // 7天内预约 for (int i=0; i < 7; i++){ CodeItem codeItem = new CodeItem(); String newDay = sdf.format(new Date(today.getTime() + i * 24 * 60 * 60 * 1000)); codeItem.setKey(newDay); codeItem.setValue(newDay); departDateList.add(codeItem); } model.addAttribute("departDateList", departDateList); // 出发时刻 List<CodeItem> departTimeList = commonService.getCodeItemList(DEPART_TIME_LIST); model.addAttribute("departTimeList", departTimeList); // model.addAttribute("userInfo", (userInfo == null ? null : userInfo)); // model.addAttribute("state", state); return "anping/yueche/index"; } /** * 约车首页、约车处理 * @param carOrderInfo * @param userInfo * @param model * @return */ @RequestMapping(value = { "/orderCar" }, method = RequestMethod.POST) public String orderCar(CarOrderInfo carOrderInfo, UserInfo userInfo, Model model) { // 00:用户预约成功、10:客服确认成功、11:客服确认失败 carOrderInfo.setOrderStatus("待确认"); // 0:有效、1:无效 carOrderInfo.setDataState("0"); // 约车用户名 if (!StringUtils.isEmpty(userInfo.getName())) { carOrderInfo.setOrderName(userInfo.getName()); } else { if (!StringUtils.isEmpty(userInfo.getNickName())) { carOrderInfo.setOrderName(userInfo.getNickName()); } else { carOrderInfo.setOrderName(""); } } // 约车 boolean ret = yuecheService.doOrderCar(carOrderInfo); model.addAttribute("openId", carOrderInfo.getOpenId()); if (ret) { model.addAttribute("carOderStatus", "OK"); // 发送客服通知短信 SendSMSUtil.sendSingleSms(null, carOrderInfo.getCarOrderId()); } else { model.addAttribute("carOderStatus", "NG"); } // return "anping/yueche/ordercar_confirm"; return "anping/yueche/order_finish"; } /** * 约车信息管理 * @param model * @return */ @RequestMapping(value = { "/manage/orderCarInfo" }, method = RequestMethod.GET) public String orderInfoManage(Model model, String selectedOrderStatusList) { // 预约状态 CarOrderInfo carOrderInfo = new CarOrderInfo(); if (selectedOrderStatusList == null){ carOrderInfo.setOrderStatus("'待确认','待出发'"); //初始化 } else if ("".equals(selectedOrderStatusList)){ carOrderInfo.setOrderStatus(null); //全量检索 } else { carOrderInfo.setOrderStatus(selectedOrderStatusList); } List<CarOrderInfo> carOrderInfoList = yuecheService.getCarOrderInfo(carOrderInfo); model.addAttribute("carOrderInfoList", carOrderInfoList); List<CodeItem> orderStatusList = commonService.getCodeItemList(ORDER_STATUS); model.addAttribute("orderStatusList", orderStatusList); if (selectedOrderStatusList == null) { // 状态选择框 选择状态保持 model.addAttribute("chkbxOrderStatusWaitConfirm", true); model.addAttribute("chkbxOrderStatusWaitDepart", true); } else { // 状态选择框 选择状态保持 model.addAttribute("chkbxOrderStatusWaitConfirm", selectedOrderStatusList.contains("待确认") ? true : false); model.addAttribute("chkbxOrderStatusWaitDepart", selectedOrderStatusList.contains("待出发") ? true : false); model.addAttribute("chkbxOrderStatusFinish", selectedOrderStatusList.contains("订单完成") ? true : false); model.addAttribute("chkbxOrderStatusDelete", selectedOrderStatusList.contains("订单作废") ? true : false); } ServiceTelCallHistory serviceTelCallHistory = new ServiceTelCallHistory(); String count = yuecheService.getServiceTelCallCount(serviceTelCallHistory); model.addAttribute("countOfServiceTelCall", count); return "anping/yueche/order_info_manage"; } }
095236ec1f4e5129bd1065c4d5476882e8c8fa49
de41e4a9d737425e30dd0eba606a50822a03c264
/agents/src/main/java/cn/agent/pojo/Log.java
c36ba5a78480c54b875d8551ebee8102956e6c5f
[]
no_license
2868452694/spring-jpa-hibernate
03d7f957412642df9dfcc03a930e3aec5445e603
af5be9f6c69c660408c75dd9db8db2719197b03c
refs/heads/master
2022-07-02T07:56:12.147155
2019-07-20T07:12:01
2019-07-20T07:12:01
197,893,959
0
0
null
2022-06-17T02:19:39
2019-07-20T07:11:48
Java
UTF-8
Java
false
false
1,633
java
package cn.agent.pojo; import org.hibernate.annotations.GenericGenerator; import javax.persistence.*; import java.io.Serializable; import java.util.Date; /** * log日志表 */ @Entity @Table(name = "LOG") public class Log implements Serializable { public Log(Users users, String loginfo, Date logtime) { this.users = users; this.loginfo = loginfo; this.logtime = logtime; } public Log() { } /** * 日志id */ @Id /*@GeneratedValue(strategy = GenerationType.SEQUENCE,generator = "sql_Log") @SequenceGenerator(name = "sql_Log",sequenceName ="seqLog")*/ @GeneratedValue(generator = "increment") @GenericGenerator(name="increment",strategy = "increment") private Long logid; /* *//** * 用户id *//* @Column(name = "USERID") private Long userid;*/ /** * 用户 */ @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name ="USERID") private Users users; /** * 日志信息 */ @Column(name = "LOGINFO") private String loginfo; /** * 操作时间 */ @Column(name = "LOGTIME") private Date logtime; public Long getLogid() { return logid; } public void setLogid(Long logid) { this.logid = logid; } /* public Long getUserid() { return userid; } public void setUserid(Long userid) { this.userid = userid; }*/ public Users getUsers() { return users; } public void setUsers(Users users) { this.users = users; } public String getLoginfo() { return loginfo; } public void setLoginfo(String loginfo) { this.loginfo = loginfo; } public Date getLogtime() { return logtime; } public void setLogtime(Date logtime) { this.logtime = logtime; } }
0aaa4cd22b96b5c054b8cb1fadff65f83cb96a6f
218e122df8307430469c215084293e26d75ed0da
/src/com/mysecretwish/exceptions/PreventiviDaoException.java
d0ff09d3d51d722bdbf636b2572e97b9253c9369
[]
no_license
hseldon80/booking
65fa326133535b3b03d796cfda5e679a7630316b
7fc4f80feac20679d6f7a2897be1dd5c9d470ef9
refs/heads/master
2021-01-25T13:28:34.593977
2018-03-19T17:12:58
2018-03-19T17:12:58
123,574,558
0
0
null
null
null
null
UTF-8
Java
false
false
663
java
/* * This source file was generated by FireStorm/DAO. * * If you purchase a full license for FireStorm/DAO you can customize this header file. * * For more information please visit http://www.codefutures.com/products/firestorm */ package com.mysecretwish.exceptions; public class PreventiviDaoException extends DaoException { /** * Method 'PreventiviDaoException' * * @param message */ public PreventiviDaoException(String message) { super(message); } /** * Method 'PreventiviDaoException' * * @param message * @param cause */ public PreventiviDaoException(String message, Throwable cause) { super(message, cause); } }
c98fe55ce2a15a7a0012532dbc483b4ad1088222
4d1af4823c1a1c3ac2a338d79c514bf5f74754a7
/src/test/java/Cucumber/casestudy/login.java
95b098822a993aa2a5629dc01e5e143d45a87de9
[]
no_license
AravindSuresh7/CaseStudy
736e7d34c7d65076400e2eaae3a0e8d3487951ec
4182cbb18aa7b81fe5ac7afee41ebf3d5a74971a
refs/heads/master
2021-07-08T13:27:35.206717
2019-07-12T04:15:16
2019-07-12T04:15:16
196,507,317
0
0
null
2020-10-13T14:31:44
2019-07-12T04:13:58
Java
UTF-8
Java
false
false
1,840
java
package Cucumber.casestudy; import java.util.List; import java.util.Map; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.PageFactory; import org.testng.Assert; import cucumber.api.DataTable; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; public class login { WebDriver driver; @Given("^user must be on Login page$") public void user_must_be_on_Login_page() throws Throwable { // Write code here that turns the phrase above into concrete actions driver=utilityClass.startBrowser("chrome","http://10.232.237.143:443/TestMeApp/login.htm"); Assert.assertEquals(driver.getTitle(), "Login"); System.out.println(" login page"); } @Given("^user enters registered credentials$") public void user_enters_registered_credentials(DataTable dt) throws Throwable { // Write code here that turns the phrase above into concrete actions // For automatic transformation, change DataTable to one of // List<YourType>, List<List<E>>, List<Map<K,V>> or Map<K,V>. // E,K,V must be a scalar (String, Integer, Date, enum etc) List<Map<String,String>> list=dt.asMaps(String.class, String.class); for(int i=0;i<list.size()-1;i++) { // System.out.println(list.get(i).get("Username")+" "+ // list.get(i).get("Password")); // System.out.println("\n"); pageFactory login= PageFactory.initElements(driver, pageFactory.class); login.login_reg(list.get(i).get("value"), list.get(i+1).get("value")); System.out.println("user entered valid credentials"); } } @Then("^user must be in Home Page$") public void user_must_be_in_Home_Page() throws Throwable { // Write code here that turns the phrase above into concrete actions Assert.assertEquals(driver.getTitle(), "Home"); System.out.println(" home page"); } }
ee4b87dc3a593bc74b5a30091891086543a096e7
88b1a9f665a030ab8758a4d6f933c2164aa41287
/app/src/main/java/com/example/geoquizz/CityLoader.java
f3c06628f9d008f77de4831fc86bdc8064b23410
[]
no_license
KilianCM/GeoQuizz
77184d57f644f7a8a4d6d5c584aee16de406879b
f2784c86b2306ff3739def98ea8f10d59932b9f1
refs/heads/master
2020-04-22T12:12:58.440419
2019-03-19T17:39:25
2019-03-19T17:39:25
170,365,036
0
0
null
null
null
null
UTF-8
Java
false
false
755
java
package com.example.geoquizz; import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.content.AsyncTaskLoader; public class CityLoader extends AsyncTaskLoader<String> { private Double mLongitude; private Double mLatitude; CityLoader(Context context, Double longitude, Double latitude) { super(context); mLatitude = latitude; mLongitude = longitude; } @Nullable @Override public String loadInBackground() { return NetworkUtils.getCityInfoWithLocalisation(mLongitude,mLatitude); } @Override protected void onStartLoading() { super.onStartLoading(); forceLoad(); } }
0f1eeed98e6cc99586b3887dcbd1a934abd39823
8a48ffe0dfb90926c42367ea47a5ddbc316ef99a
/EP3/src/FreewayAppRamp.java
555ad1a4c31c7810bb969e5f09f4dcc6b0e365ee
[]
no_license
geien/MAC0209
fbdf309a8636e160409dba6ca7e5cdce2a58e0c3
1912eb27716c6d3a4c4fb5c89b7e119e34dc26a9
refs/heads/master
2021-06-18T07:29:43.131810
2017-07-04T00:54:13
2017-07-04T00:54:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,677
java
import org.opensourcephysics.controls.*; import org.opensourcephysics.frames.*; public class FreewayAppRamp extends AbstractSimulation { FreewayRamp freeway = new FreewayRamp (); DisplayFrame display = new DisplayFrame ("Freeway"); LatticeFrame spaceTime = new LatticeFrame ("space", "time", "Space Time Diagram"); public FreewayAppRamp () { display.addDrawable(freeway) ; } public void initialize () { freeway.numberOfCars = control.getInt("Number of cars"); freeway.roadLength = control.getInt("Road length"); freeway.p = control.getDouble("Slow down probability"); freeway.p2 = control.getDouble("Exiting ramp probability"); freeway.maximumVelocity = control.getInt("Maximum velocity"); display.setPreferredMinMax(0, freeway.roadLength, -3, 4); freeway.initialize(spaceTime); } public void doStep () { freeway.step(); } public void reset () { control.setValue("Number of cars", 10); control.setValue("Road length", 50); control.setValue("Slow down probability" , 0.5); control.setValue("Exiting ramp probability" , 0.5); control.setValue("Maximum velocity" , 2 ); control.setValue("Steps between plots" , 1); enableStepsPerDisplay(true); } public void resetAverages () { freeway.flow = 0; freeway.steps = 0; } public static void main (String [] args) { SimulationControl control = SimulationControl.createApp (new FreewayAppRamp()); control.addButton("resetAverages", "resetAverages"); } }
6072b414be6dfc94458b532240b415e4bf305a58
f96fe513bfdf2d1dbd582305e1cbfda14a665bec
/net.sf.smbt.jazzmutant/src-model/net/sf/smbt/jzmui/MidiVarD0ChannelPressure.java
25f1fc498f73cedcd11b87179553b7628508991e
[]
no_license
lucascraft/ubq_wip
04fdb727e7b2dc384ba1d2195ad47e895068e1e4
eff577040f21be71ea2c76c187d574f1617703ce
refs/heads/master
2021-01-22T02:28:20.687330
2015-06-10T12:38:47
2015-06-10T12:38:47
37,206,324
0
0
null
null
null
null
UTF-8
Java
false
false
454
java
/** * <copyright> * </copyright> * * $Id$ */ package net.sf.smbt.jzmui; import org.eclipse.emf.ecore.EObject; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Midi Var D0 Channel Pressure</b></em>'. * <!-- end-user-doc --> * * * @see net.sf.smbt.jzmui.JzmuiPackage#getMidiVarD0ChannelPressure() * @model * @generated */ public interface MidiVarD0ChannelPressure extends EObject { } // MidiVarD0ChannelPressure
819d05ba7889533766d769808f0e02ea919f607a
bf1a992b5adcaefbef690120265e9dc61dec3f54
/basic-api-study/src/main/java/com/yicj/study/controller/modelsupport/ModelSupportController.java
a4c864547cd168047accf468798b4ec5205c5600
[]
no_license
yichengjie/spring-mvc-study
7deda2abbf98d6d66629a4664420baf477b3280f
ac2bf38290adbd375eb6868c7bff34e3d8039a97
refs/heads/master
2022-12-15T17:59:52.825183
2020-09-20T13:24:33
2020-09-20T13:24:33
292,978,492
0
0
null
null
null
null
UTF-8
Java
false
false
1,564
java
package com.yicj.study.controller.modelsupport; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; @Controller public class ModelSupportController { @GetMapping("/forwardView") public String forwardView(Model model){ // 设置转发前的模型属性 model.addAttribute("info", "转发前的属性") ; //返回转发视图,转发目标是forwardTargetView return "forward:forwardTargetView" ; } @GetMapping("/forwardTargetView") public String forwardTargetView(Model model, HttpServletRequest request){ Object info = request.getAttribute("info"); // 设置模型属性 model.addAttribute("first", info) ; model.addAttribute("second", "转发后的属性") ; return "viewView" ; } @GetMapping("/redirectView") public String redirectView(RedirectAttributes model){ // 重定向前的模型数据 model.addFlashAttribute("first", "重定向前的属性") ; // 返回重定向视图,转发目标forwardTargetView return "redirect:redirectTargetView" ; } @GetMapping("/redirectTargetView") public String redirectTargetView(Model model){ //此时的Model已经有了重定向的属性了 model.addAttribute("second", "重定向后的属性") ; return "viewView" ; } }
e226c0960527af3b4a5970b20407fbacc50371f8
265b3f9eb40057c73d6f1450eea79b932af94181
/udemy/src/test/java/spark/udemy/AppTest.java
90df7a8a8cbb03f5959d9ea08ba53ca9cee27f8f
[]
no_license
Jaimin-Parekh/spark_udemy
a4a77f8d0560a7f77de338f3ddeb667780cefe78
3e9734ce984829003dc2f1c229217b178c491fce
refs/heads/master
2020-04-19T13:43:21.794535
2019-01-29T22:17:40
2019-01-29T22:17:40
168,224,602
0
0
null
null
null
null
UTF-8
Java
false
false
639
java
package spark.udemy; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
069bb421cdd3a164e657ab133e036389dc1eef31
d521a95d6c096082fbf49ca64f55c08ff0afe468
/src-pos/com/openbravo/data/loader/SentenceExec.java
ee13f77089b36134e3fd2af8e6f1d673f9029221
[]
no_license
rhinterndorfer/w4cash
3276adfd58dec62f8d898e942fd9c255de5706b6
896c9a3751fc378d9e85c130274fa6170b8f80a0
refs/heads/master
2023-07-06T19:36:42.316276
2023-04-28T12:40:36
2023-04-28T12:40:36
46,166,005
1
1
null
null
null
null
UTF-8
Java
false
false
1,231
java
// Openbravo POS is a point of sales application designed for touch screens. // Copyright (C) 2007-2009 Openbravo, S.L. // http://www.openbravo.com/product/pos // // This file is part of Openbravo POS. // // Openbravo POS 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. // // Openbravo POS 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 Openbravo POS. If not, see <http://www.gnu.org/licenses/>. package com.openbravo.data.loader; import com.openbravo.basic.BasicException; import com.openbravo.basic.SignatureUnitException; public interface SentenceExec { public int exec() throws BasicException; public int exec(Object params) throws BasicException; public int exec(Object... params) throws BasicException; }
a0307e23b6f4d1eef8082cf3da71fbe84a8b2a0f
a2c176b9b2f418e8d99914bec3b0a1302bcbb2f1
/app/src/main/java/br/com/ddmsoftware/sqliteandrecycleview/GroceryContract.java
c8c57e363cc094ba5e86cefbc836ab1a273c1cca
[]
no_license
douglimar/SQLiteAndRecycleView
52449c402772749a87504191941577bc72829825
f035e5afc890c4108e221022b86d9f671902aca2
refs/heads/master
2020-04-02T23:22:57.008691
2018-10-26T16:53:34
2018-10-26T16:53:34
154,865,554
0
0
null
null
null
null
UTF-8
Java
false
false
488
java
package br.com.ddmsoftware.sqliteandrecycleview; import android.provider.BaseColumns; public class GroceryContract { private GroceryContract() { } public static final class GroceryEntry implements BaseColumns { public static final String TABLE_NAME = "groceryList"; public static final String COLUMN_NAME = "name"; public static final String COLUMN_AMOUNT = "amount"; public static final String COLUMN_TIMESTAMP = "timestamp"; } }
08ad9e8b818187088673fe4a619deb06779e5d6a
9b7b7c2862ee705c4efd5491cd389bb144b084b5
/src/领扣算法/A简单题/汉明距离总和/Main.java
e0d3874648c0fea1f2d0ade1c9f704be1a95c90b
[]
no_license
g1587613421/arithmetic
5bf16083df2b9791d6ff09ea4463610184a250cb
22f99afb5f785eadb8cff57ec09c635dead69d50
refs/heads/master
2021-07-10T03:19:08.413358
2021-04-02T00:58:25
2021-04-02T00:58:25
235,080,687
1
0
null
null
null
null
UTF-8
Java
false
false
747
java
package 领扣算法.A简单题.汉明距离总和; public class Main { public int totalHammingDistance(int[] nums) { if(nums.length<=1){ return 0; } int len=nums.length; int[] sums=new int[32]; int x=0; for(int i=0;i<len;i++){//统计每个二进制位上的1出现个数 for(int j=0;j<32;j++){ sums[j]+=nums[i]&1; nums[i]=nums[i]>>1; if(nums[i]==0){ break; } } } int sum=0; for(int i=0;i<32;i++){//通过对每个二进制位上的1的个数和0的个数相乘,求和 sum+=sums[i]*(len-sums[i]); } return sum; } }
81d8e4a7da0b34a24cad6cb482f4ee7447702756
b01cb09dc5c9ed0e0cfea41cbbb6fc0de8fdbedf
/src/main/java/com/bedirhansisman/springboot/thymeleafdemo/service/EmployeeServiceImpl.java
932061522375d225840d02e132d9ab9c9654d152
[]
no_license
BedirhanSisman/SpringBootFullProjectThymeleafTemplate
86ebc2449658498e1bbb2ddb024371e0abfd9be9
9ab59155758c8b7ed100298b19ebc607bb80416a
refs/heads/master
2020-05-30T12:26:02.068120
2019-06-01T13:14:59
2019-06-01T13:14:59
189,734,438
0
0
null
null
null
null
UTF-8
Java
false
false
1,239
java
package com.bedirhansisman.springboot.thymeleafdemo.service; import java.util.List; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bedirhansisman.springboot.thymeleafdemo.dao.EmployeeRepository; import com.bedirhansisman.springboot.thymeleafdemo.entity.Employee; @Service public class EmployeeServiceImpl implements EmployeeService { private EmployeeRepository employeeRepository; @Autowired public EmployeeServiceImpl(EmployeeRepository employeeRepository) { this.employeeRepository = employeeRepository; } @Override public List<Employee> findAll() { return employeeRepository.findAllByOrderByLastNameAsc(); } @Override public Employee findById(int theId) { Optional<Employee> result = employeeRepository.findById(theId); Employee employee = null; if(result.isPresent()) { employee = result.get(); }else { throw new RuntimeException("Did not find the employee id - " + theId); } return employee; } @Override public void save(Employee employee) { employeeRepository.save(employee); } @Override public void deleteById(int theId) { employeeRepository.deleteById(theId); } }
3be42906b0e03985663ff10e87f7bf19028273f1
a719959335af6a1b3b0aaad661e369c2a86864e1
/app/src/main/java/co/herxun/impp/utils/Constant.java
744f6be40e3471d7db4a45965ec4bef7167be144
[]
no_license
fengfansky/JianKouNew
f3cf04ba48b9c76e25f2a956d3081d21f2750b14
7833d2dd7c1f0a91659f8ae0e8fd76bb502b15b6
refs/heads/master
2022-11-07T06:14:33.010667
2020-06-30T11:14:35
2020-06-30T11:14:35
275,756,242
0
0
null
null
null
null
UTF-8
Java
false
false
1,718
java
package co.herxun.impp.utils; public class Constant { public final static String PUSH_CHANNEL = "_IMPP_DEFAULT_"; public final static String FRIEND_REQUEST_KEY_TYPE = "type"; public final static String FRIEND_REQUEST_KEY_USERNAME = "username"; public final static String FRIEND_REQUEST_TYPE_SEND = "send"; public final static String FRIEND_REQUEST_TYPE_APPROVE = "approve"; public final static String FRIEND_REQUEST_TYPE_REJECT = "reject"; public final static String FRIEND_REQUEST_ID = "request_id"; public final static String INTENT_EXTRA_KEY_CLIENT = "client"; public final static String INTENT_EXTRA_KEY_ROOM = "room"; public final static String INTENT_EXTRA_KEY_POST_ID = "post"; public final static String INTENT_EXTRA_KEY_CHAT = "chat"; public final static String INTENT_EXTRA_KEY_TOPIC = "topic"; public final static String INTENT_EXTRA_KEY_TOPIC_EDIT_TYPE = "topic_edit_type"; public final static String INTENT_EXTRA_KEY_TOPIC_EDIT_FILTER_MEMBERS = "topic_edit_filter_members"; public final static String INTENT_EXTRA_KEY_PAYLOAD = "payload"; public final static int REQUESTCODE_PHOTO_TAKE = 0; public final static int REQUESTCODE_PHOTO_PICK = 1; public final static int REQUESTCODE_PHOTO_CROP = 2; public final static String ROOM_TYPE = "room"; public final static String BULLETIN_TYPE = "bulletin"; public final static int VOTE_TYPE_ALL = 1; public final static int VOTE_TYPE_MINE = 2; public final static int VOTE_TYPE_JOIN = 3; public final static String VOTE_TYPE_SINGLE = "single"; public final static String VOTE_TYPE_MULTIPLE = "multiple"; public final static String ROOM_ID = "room_id"; }
a185c112a02141bea4c19880364aeb5765a171f0
266c9b8553595acf30a96a86e0077cd87a33e3c6
/battleship-game/src/main/java/com/game/battleship/exception/BattleShipRuntimeException.java
b00e4aa7845f394f33eaa27299289124f9aac8f3
[]
no_license
zuned/battleshipGame
dd2e13b75e8dc02ac7ad0d36e0e593086b381842
1195c50ee2add6602a41c7f20f15347c20fa7525
refs/heads/master
2021-07-01T10:50:36.741363
2017-09-21T06:22:32
2017-09-21T06:22:32
104,307,795
0
0
null
null
null
null
UTF-8
Java
false
false
568
java
package com.game.battleship.exception; public class BattleShipRuntimeException extends RuntimeException{ /** * */ private static final long serialVersionUID = 1L; private final String errorCode; public BattleShipRuntimeException(final String errorCode ,final String message){ super(message); this.errorCode = errorCode; } public BattleShipRuntimeException(final String errorCode ,final String message , Throwable exception){ super(message, exception); this.errorCode = errorCode; } public String getErrorCode() { return errorCode; } }
88ca7f3c82fbf06696ae18a6d519c22390c093c0
85cfc652459ca2f015aa8c8dc55240721632cee0
/bin/custom/cartridge/cartridgestorefront/web/src/com/hybris/cartridge/storefront/controllers/pages/checkout/steps/SummaryCheckoutStepController.java
5b44881b7b976d6e219706ead3dfa4c1d6252d7c
[]
no_license
varshadhamal/Hybris-test
43e5479b9909e41e6276dfde6b4f4ff1cdae9b0e
a29c6090680110ab733e2077772c9c477d497df6
refs/heads/master
2020-03-18T06:31:01.940494
2018-05-22T11:58:12
2018-05-22T11:58:12
134,400,503
0
1
null
null
null
null
UTF-8
Java
false
false
8,852
java
/* * [y] hybris Platform * * Copyright (c) 2000-2016 SAP SE or an SAP affiliate company. * All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package com.hybris.cartridge.storefront.controllers.pages.checkout.steps; import de.hybris.platform.acceleratorservices.enums.CheckoutPciOptionEnum; import de.hybris.platform.acceleratorstorefrontcommons.annotations.PreValidateCheckoutStep; import de.hybris.platform.acceleratorstorefrontcommons.annotations.RequireHardLogIn; import de.hybris.platform.acceleratorstorefrontcommons.checkout.steps.CheckoutStep; import de.hybris.platform.acceleratorstorefrontcommons.constants.WebConstants; import de.hybris.platform.acceleratorstorefrontcommons.controllers.pages.checkout.steps.AbstractCheckoutStepController; import de.hybris.platform.acceleratorstorefrontcommons.controllers.util.GlobalMessages; import de.hybris.platform.acceleratorstorefrontcommons.forms.PlaceOrderForm; import de.hybris.platform.cms2.exceptions.CMSItemNotFoundException; import de.hybris.platform.commercefacades.order.data.CartData; import de.hybris.platform.commercefacades.order.data.OrderData; import de.hybris.platform.commercefacades.order.data.OrderEntryData; import de.hybris.platform.commercefacades.product.ProductOption; import de.hybris.platform.commercefacades.product.data.ProductData; import de.hybris.platform.commerceservices.order.CommerceCartModificationException; import de.hybris.platform.order.InvalidCartException; import de.hybris.platform.payment.AdapterException; import com.hybris.cartridge.storefront.controllers.ControllerConstants; import java.util.Arrays; import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; @Controller @RequestMapping(value = "/checkout/multi/summary") public class SummaryCheckoutStepController extends AbstractCheckoutStepController { private static final Logger LOGGER = Logger.getLogger(SummaryCheckoutStepController.class); private static final String SUMMARY = "summary"; @RequestMapping(value = "/view", method = RequestMethod.GET) @RequireHardLogIn @Override @PreValidateCheckoutStep(checkoutStep = SUMMARY) public String enterStep(final Model model, final RedirectAttributes redirectAttributes) throws CMSItemNotFoundException, // NOSONAR CommerceCartModificationException { final CartData cartData = getCheckoutFacade().getCheckoutCart(); if (cartData.getEntries() != null && !cartData.getEntries().isEmpty()) { for (final OrderEntryData entry : cartData.getEntries()) { final String productCode = entry.getProduct().getCode(); final ProductData product = getProductFacade().getProductForCodeAndOptions(productCode, Arrays.asList(ProductOption.BASIC, ProductOption.PRICE)); entry.setProduct(product); } } model.addAttribute("cartData", cartData); model.addAttribute("allItems", cartData.getEntries()); model.addAttribute("deliveryAddress", cartData.getDeliveryAddress()); model.addAttribute("deliveryMode", cartData.getDeliveryMode()); model.addAttribute("paymentInfo", cartData.getPaymentInfo()); // Only request the security code if the SubscriptionPciOption is set to Default. final boolean requestSecurityCode = CheckoutPciOptionEnum.DEFAULT.equals(getCheckoutFlowFacade() .getSubscriptionPciOption()); model.addAttribute("requestSecurityCode", Boolean.valueOf(requestSecurityCode)); model.addAttribute(new PlaceOrderForm()); storeCmsPageInModel(model, getContentPageForLabelOrId(MULTI_CHECKOUT_SUMMARY_CMS_PAGE_LABEL)); setUpMetaDataForContentPage(model, getContentPageForLabelOrId(MULTI_CHECKOUT_SUMMARY_CMS_PAGE_LABEL)); model.addAttribute(WebConstants.BREADCRUMBS_KEY, getResourceBreadcrumbBuilder().getBreadcrumbs("checkout.multi.summary.breadcrumb")); model.addAttribute("metaRobots", "noindex,nofollow"); setCheckoutStepLinksForModel(model, getCheckoutStep()); return ControllerConstants.Views.Pages.MultiStepCheckout.CheckoutSummaryPage; } @RequestMapping(value = "/placeOrder") @RequireHardLogIn public String placeOrder(@ModelAttribute("placeOrderForm") final PlaceOrderForm placeOrderForm, final Model model, final HttpServletRequest request, final RedirectAttributes redirectModel) throws CMSItemNotFoundException, // NOSONAR InvalidCartException, CommerceCartModificationException { if (validateOrderForm(placeOrderForm, model)) { return enterStep(model, redirectModel); } //Validate the cart if (validateCart(redirectModel)) { // Invalid cart. Bounce back to the cart page. return REDIRECT_PREFIX + "/cart"; } // authorize, if failure occurs don't allow to place the order boolean isPaymentUthorized = false; try { isPaymentUthorized = getCheckoutFacade().authorizePayment(placeOrderForm.getSecurityCode()); } catch (final AdapterException ae) { // handle a case where a wrong paymentProvider configurations on the store see getCommerceCheckoutService().getPaymentProvider() LOGGER.error(ae.getMessage(), ae); } if (!isPaymentUthorized) { GlobalMessages.addErrorMessage(model, "checkout.error.authorization.failed"); return enterStep(model, redirectModel); } final OrderData orderData; try { orderData = getCheckoutFacade().placeOrder(); } catch (final Exception e) { LOGGER.error("Failed to place Order", e); GlobalMessages.addErrorMessage(model, "checkout.placeOrder.failed"); return enterStep(model, redirectModel); } return redirectToOrderConfirmationPage(orderData); } /** * Validates the order form before to filter out invalid order states * * @param placeOrderForm * The spring form of the order being submitted * @param model * A spring Model * @return True if the order form is invalid and false if everything is valid. */ protected boolean validateOrderForm(final PlaceOrderForm placeOrderForm, final Model model) { final String securityCode = placeOrderForm.getSecurityCode(); boolean invalid = false; if (getCheckoutFlowFacade().hasNoDeliveryAddress()) { GlobalMessages.addErrorMessage(model, "checkout.deliveryAddress.notSelected"); invalid = true; } if (getCheckoutFlowFacade().hasNoDeliveryMode()) { GlobalMessages.addErrorMessage(model, "checkout.deliveryMethod.notSelected"); invalid = true; } if (getCheckoutFlowFacade().hasNoPaymentInfo()) { GlobalMessages.addErrorMessage(model, "checkout.paymentMethod.notSelected"); invalid = true; } else { // Only require the Security Code to be entered on the summary page if the SubscriptionPciOption is set to Default. if (CheckoutPciOptionEnum.DEFAULT.equals(getCheckoutFlowFacade().getSubscriptionPciOption()) && StringUtils.isBlank(securityCode)) { GlobalMessages.addErrorMessage(model, "checkout.paymentMethod.noSecurityCode"); invalid = true; } } if (!placeOrderForm.isTermsCheck()) { GlobalMessages.addErrorMessage(model, "checkout.error.terms.not.accepted"); invalid = true; return invalid; } final CartData cartData = getCheckoutFacade().getCheckoutCart(); if (!getCheckoutFacade().containsTaxValues()) { LOGGER.error(String .format( "Cart %s does not have any tax values, which means the tax cacluation was not properly done, placement of order can't continue", cartData.getCode())); GlobalMessages.addErrorMessage(model, "checkout.error.tax.missing"); invalid = true; } if (!cartData.isCalculated()) { LOGGER.error(String.format("Cart %s has a calculated flag of FALSE, placement of order can't continue", cartData.getCode())); GlobalMessages.addErrorMessage(model, "checkout.error.cart.notcalculated"); invalid = true; } return invalid; } @RequestMapping(value = "/back", method = RequestMethod.GET) @RequireHardLogIn @Override public String back(final RedirectAttributes redirectAttributes) { return getCheckoutStep().previousStep(); } @RequestMapping(value = "/next", method = RequestMethod.GET) @RequireHardLogIn @Override public String next(final RedirectAttributes redirectAttributes) { return getCheckoutStep().nextStep(); } protected CheckoutStep getCheckoutStep() { return getCheckoutStep(SUMMARY); } }
5b6e496be01c374816e0bfa3ca0b9843b8cce1bf
25f7be2a13a2648a7150a6d6538806ae0eed22bd
/aliyun-java-sdk-dds/src/main/java/com/aliyuncs/dds/model/v20151201/ModifyInstanceAutoRenewalAttributeResponse.java
a867debf5495f33985e62c411b29c4f770e304c7
[ "Apache-2.0" ]
permissive
llCnll/aliyun-openapi-java-sdk
4d5ddb34e672a4188cdfe7dc1463b5d89e26569c
6400549026014f1ffc2ffd22b7f29c29b37cccc6
refs/heads/master
2020-04-22T02:53:28.836935
2019-01-31T08:31:36
2019-02-01T09:15:01
170,066,708
1
0
NOASSERTION
2019-02-11T04:16:11
2019-02-11T04:16:11
null
UTF-8
Java
false
false
1,319
java
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.aliyuncs.dds.model.v20151201; import java.util.Map; import com.aliyuncs.AcsResponse; import com.aliyuncs.dds.transform.v20151201.ModifyInstanceAutoRenewalAttributeResponseUnmarshaller; import com.aliyuncs.transform.UnmarshallerContext; /** * @author auto create * @version */ public class ModifyInstanceAutoRenewalAttributeResponse extends AcsResponse { private String requestId; public String getRequestId() { return this.requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } @Override public ModifyInstanceAutoRenewalAttributeResponse getInstance(UnmarshallerContext context) { return ModifyInstanceAutoRenewalAttributeResponseUnmarshaller.unmarshall(this, context); } }
b3853f7d52d4d5e255240b5559135e220de4b1f0
c71b205558e3320bd06e97ad280de56beeb27826
/sscorp-core/src/main/java/com/superconduits/core/business/interfaces/IProjects.java
71eb6c473b6767afaac978ba93f73f6bef528d45
[]
no_license
bhaskardas/SSCorp
0f4acbdf759dbeb4cd01ae351904179c07134dcb
0df30a1f6430bc2b06be58f90884040a46105d9f
refs/heads/master
2020-06-08T17:13:38.321237
2011-10-27T06:46:53
2011-10-27T06:46:53
2,210,650
0
0
null
null
null
null
UTF-8
Java
false
false
798
java
/* * This is the main interface in the service layer to interact with the front * end layer of the application. This interface provides business functionality * to return all the projects related information of Super Sales Corporation. */ package com.superconduits.core.business.interfaces; import com.superconduits.core.to.project.ProjectCategoryTO; import com.superconduits.core.to.project.ProjectTO; import java.util.List; /** * @author bhaskar * @Created on 20th Nov 2010 * @Version : 1.0 * @ChangeLog : */ public interface IProjects { /** * Fetches the list of all the project categories that super sales * corporation is currently doing. * @param companyId * @return */ public List<ProjectCategoryTO> fetchProjectCategories(Integer companyId); }
cdc84f7ea823163fbefe6536b26b216d997926c3
731994fa30d6e344bcd8d2d804ab955497cf85e4
/src/com/zhoulychn/剑指Offer/连续子数组最大和.java
51d2071f26cb663dbb5f51df0dd118731894b48b
[]
no_license
zhoulychn/algorithm
33893cd50307ebcd7467e6247173c527dbe5a1e1
2ca6d21060cf8cb5c4be0ba0ed4e73b8bf85b151
refs/heads/master
2021-05-01T21:26:40.081735
2020-08-13T07:24:03
2020-08-13T07:24:03
120,913,518
0
0
null
null
null
null
UTF-8
Java
false
false
449
java
package com.zhoulychn.剑指Offer; public class 连续子数组最大和 { public int FindGreatestSumOfSubArray(int[] array) { if (array.length == 1) return array[0]; int result = array[0], sum = array[0]; for (int i = 1; i < array.length; i++) { if (array[i] < 0) result = Math.max(result, sum); sum = Math.max(array[i], sum + array[i]); } return Math.max(result, sum); } }
172eae96ed04c08f0f463717375a858ec190c479
a3d2ff6dee7ee79f6eeca3b145e8e74a3600c874
/src/trees/TreeStructure.java
c600f0ab65c94381a885ea3e354ec2d3fe1e736c
[]
no_license
rithuiketz/HackerRankSolutions
26772ce262693ff58c399aa6e36ebcc6be703acc
86cb9eadc5ab6d012e066fc5ffd2bf1036475cf9
refs/heads/master
2022-12-05T19:35:01.422636
2020-08-23T18:36:26
2020-08-23T18:36:26
289,745,292
0
0
null
null
null
null
UTF-8
Java
false
false
1,397
java
package trees; public class TreeStructure { private TreeNode root; protected class TreeNode { private Integer data; private TreeNode left; private TreeNode right; public TreeNode(Integer data) { this.data = data; } public void setLeft(TreeNode leftNode) { this.left = leftNode; } public void setRight(TreeNode rightNode) { this.left = rightNode; } public Integer getData() { return this.data; } public TreeNode getLeft() { return this.left; } public TreeNode getRight() { return this.right; } @Override public String toString() { // TODO Auto-generated method stub return String.valueOf(data); } } public void add(Integer data) { if (this.root == null) this.root = new TreeNode(data); else { TreeNode targetNode = this.root; TreeNode temp = null; while (targetNode.left != null && data < targetNode.data) { targetNode = targetNode.left; } while (targetNode.right != null && data > targetNode.data ) { targetNode = targetNode.right; } if (data < targetNode.data) { temp = targetNode.left; targetNode.left = new TreeNode(data); targetNode.left.left = temp; } if (data > targetNode.data) { temp = targetNode.right; targetNode.right = new TreeNode(data); targetNode.right.right = temp; } } } public TreeNode getRoot() { return this.root; } }
5e5741ca98340993eb807e696da4603a106dc7f4
d35caff96b4b2a8647ea50548114e452b6b7073e
/app/src/main/java/edu/tecii/android/practica_fragments/MainCallbacks.java
bab8488b499216690b7f6bf0dedcdc3875b2b6a6
[]
no_license
HazukiS/Practica_Fragments
50887cf8cc4b22854fe9d9b692c6b5fe07c603a9
c078a29fe6c855f6dfea9f8f85cd78b8cfc0671e
refs/heads/master
2021-01-12T12:29:09.720704
2016-11-01T06:38:23
2016-11-01T06:38:23
72,510,300
0
0
null
null
null
null
UTF-8
Java
false
false
194
java
package edu.tecii.android.practica_fragments; /** * Created by hazuk on 31/10/2016. */ public interface MainCallbacks { public void onMsgFromFragToMain (String sender,String strValue); }
2fc91b4dcec038dfcbb9cbdb2fccf4d773943efe
e9f671edda745b666d0297431c94a67304de6d50
/spring_security/src/main/java/com/spring/security/LoginFailureHandler.java
a8821213cfbd402967ef53b14be00e5fc664244d
[]
no_license
rabo2/Spring
ca026fca00fac1a8b2729b65eebcc8830afa7d18
41428dbfd94400edce338f446f02245ead269e56
refs/heads/master
2023-08-17T07:33:37.848099
2021-09-28T07:51:47
2021-09-28T07:51:47
390,545,364
0
0
null
null
null
null
UTF-8
Java
false
false
953
java
package com.spring.security; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; public class LoginFailureHandler extends SimpleUrlAuthenticationFailureHandler{ @Override public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { response.setContentType("text/html;charset=utf-8"); PrintWriter out = response.getWriter(); out.println("<script>"); out.println("alert('아이디 혹은 패스워드가 일치하지 않습니다');"); out.println("history.go(-1);"); out.println("</script>"); } }
c428ace3a8b17a96ca68bede6b1e4fb5f678fc11
be932cae69ad9e9d28950e1c6540872686cdabf9
/rongke-web/src/main/java/com/rongke/web/lianpay/vo/OrderInfo.java
a1e292a2ed115ab7cbe1237bca8aa2337f166075
[]
no_license
gaolizhan/rongke
a8af53f7810d462c8294c248c89faf8a6ae10daa
684a1aa522f182137b3b23b0ec98e2fbd4eef801
refs/heads/master
2020-04-08T08:18:49.829102
2018-11-25T14:53:35
2018-11-25T14:53:35
159,174,206
0
1
null
null
null
null
UTF-8
Java
false
false
1,488
java
package com.rongke.web.lianpay.vo; import java.io.Serializable; /** * 商户订单信息 * @author guoyx * @date:Jun 24, 2013 3:25:29 PM * @version :1.0 * */ public class OrderInfo implements Serializable{ private static final long serialVersionUID = 1L; private String no_order; // 商户唯一订单号 private String dt_order; // 商户订单时间 private String name_goods; // 商品名称 private String info_order; // 订单描述 private String money_order; // 交易金额 单位为RMB-元 public String getNo_order() { return no_order; } public void setNo_order(String no_order) { this.no_order = no_order; } public String getDt_order() { return dt_order; } public void setDt_order(String dt_order) { this.dt_order = dt_order; } public String getName_goods() { return name_goods; } public void setName_goods(String name_goods) { this.name_goods = name_goods; } public String getInfo_order() { return info_order; } public void setInfo_order(String info_order) { this.info_order = info_order; } public String getMoney_order() { return money_order; } public void setMoney_order(String money_order) { this.money_order = money_order; } }
1e4033f58706699dbed4c844d7abe62529dd7040
42a3840113043ea90162c93c32e2a08f93675843
/DesignPatterns/src/main/java/com/cosmo/PrototypePattern/Mail.java
34ac5db905be7912ac306184aec4128a88b736f7
[]
no_license
cosmohsueh/DesignPatterns
d1e0987467da3c483c0766e30760bd9aa8ab428e
03e9d3baed6875dde33183c50ae17f35abaabfc9
refs/heads/master
2021-01-01T03:51:06.643417
2016-05-04T07:15:28
2016-05-04T07:15:28
56,737,098
0
0
null
null
null
null
UTF-8
Java
false
false
1,228
java
package com.cosmo.PrototypePattern; public class Mail implements Cloneable { private String receiver; private String subject; private String appellation; private String context; private String tail; public Mail(AdvTemplate advTemplate) { this.subject = advTemplate.getAdvSubject(); this.context = advTemplate.getAdvContext(); } public String getReceiver() { return receiver; } public void setReceiver(String receiver) { this.receiver = receiver; } public String getSubject() { return subject; } public void setSubject(String subject) { this.subject = subject; } public String getAppellation() { return appellation; } public void setAppellation(String appellation) { this.appellation = appellation; } public String getContext() { return context; } public void setContext(String context) { this.context = context; } public String getTail() { return tail; } public void setTail(String tail) { this.tail = tail; } @Override protected Mail clone() { Mail mail = null; try{ mail = (Mail) super.clone(); } catch(CloneNotSupportedException e){ e.printStackTrace(); } return mail; } }
2a69bab2d29aa34841ae670c2b3b380050d6cbc4
ab30eded94edeb5687b1260c4a15dab828d66acf
/park_platform/src/main/java/com/wynlink/park_platform/service/SysUserService.java
06affc55b00837516f47994ffa7726b33fd92977
[]
no_license
shanliyun/repo1
90f9a1fcf1a2735634ba3518384c8af669c08231
744e99d2b12cc1e1d251882bfaaf9cbc650d97a2
refs/heads/master
2022-02-22T13:35:31.216902
2019-05-30T06:38:33
2019-05-30T06:38:33
189,336,742
0
0
null
2022-02-09T22:14:46
2019-05-30T03:09:15
Java
UTF-8
Java
false
false
287
java
package com.wynlink.park_platform.service; import com.wynlink.park_platform.entity.SysUser; import com.baomidou.mybatisplus.service.IService; /** * <p> * 服务类 * </p> * * @author Vincent * @since 2019-03-19 */ public interface SysUserService extends IService<SysUser> { }
61dfd010b2cc07c572de8184e5e00efe3cc416f7
dc888b07c782295a3cd181fe4836572b0d522425
/app/src/main/java/com/chocco/huy/qlsk/PaperAdapter.java
00bbf9bc3039abe520fb86e9a30134dee257b6f7
[]
no_license
hoangvu96z/QUAN-LY-SUC-KHOE
24ec6398f07fa96cd5c88e76ab3ebbf0cbc6c6ac
7905c3870c0c07a4e98f6cdf0173966cc7b7e9ce
refs/heads/master
2021-01-22T03:30:24.066642
2017-05-25T16:32:09
2017-05-25T16:32:09
92,383,101
0
0
null
null
null
null
UTF-8
Java
false
false
1,229
java
package com.chocco.huy.qlsk; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.app.FragmentStatePagerAdapter; /** * Created by ACER on 4/7/2017. */ public class PaperAdapter extends FragmentPagerAdapter { int mNumOfTabs; public PaperAdapter(FragmentManager fm,int NumOfTabs) { super(fm); this.mNumOfTabs=NumOfTabs; } @Override public Fragment getItem(int position) { switch (position) { case 0: TabFragment1 tab1 = new TabFragment1(); return tab1; case 1: TabFragment2 tab2 = new TabFragment2(); return tab2; case 2: TabFragment3 tab3 = new TabFragment3(); return tab3; case 3: TabFragment4 tab4 = new TabFragment4(); return tab4; case 4: TabFragment5 tab5 = new TabFragment5(); return tab5; default: return null; } } @Override public int getCount() { return mNumOfTabs; } }
87fb07775dc68d75bc094eef5d074e53dde102a2
f12056f89cd34b763a8532a70c9cb8c5be6c25aa
/hw1-wfeely/src/main/java/edu/cmu/cs/wfeely/hw1/BaseAnnotation_Type.java
c07a375690011de1062ef50bc95a5eb5e81d02a8
[]
no_license
wfeely/hw1-wfeely
1d5710599e75353fa96b49559d8f8d1399557be3
5bcd363a1a8aef955e03d11695bbf82c8bd21db4
refs/heads/master
2020-05-02T20:01:42.343463
2013-09-11T23:52:50
2013-09-11T23:52:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,739
java
/* First created by JCasGen Mon Sep 09 20:28:05 EDT 2013 */ package edu.cmu.cs.wfeely.hw1; import org.apache.uima.jcas.JCas; import org.apache.uima.jcas.JCasRegistry; import org.apache.uima.cas.impl.CASImpl; import org.apache.uima.cas.impl.FSGenerator; import org.apache.uima.cas.FeatureStructure; import org.apache.uima.cas.impl.TypeImpl; import org.apache.uima.cas.Type; import org.apache.uima.cas.impl.FeatureImpl; import org.apache.uima.cas.Feature; import org.apache.uima.jcas.tcas.Annotation_Type; /** Base annotation type. * Updated by JCasGen Wed Sep 11 19:14:02 EDT 2013 * @generated */ public class BaseAnnotation_Type extends Annotation_Type { /** @generated */ @Override protected FSGenerator getFSGenerator() {return fsGenerator;} /** @generated */ private final FSGenerator fsGenerator = new FSGenerator() { public FeatureStructure createFS(int addr, CASImpl cas) { if (BaseAnnotation_Type.this.useExistingInstance) { // Return eq fs instance if already created FeatureStructure fs = BaseAnnotation_Type.this.jcas.getJfsFromCaddr(addr); if (null == fs) { fs = new BaseAnnotation(addr, BaseAnnotation_Type.this); BaseAnnotation_Type.this.jcas.putJfsFromCaddr(addr, fs); return fs; } return fs; } else return new BaseAnnotation(addr, BaseAnnotation_Type.this); } }; /** @generated */ @SuppressWarnings ("hiding") public final static int typeIndexID = BaseAnnotation.typeIndexID; /** @generated @modifiable */ @SuppressWarnings ("hiding") public final static boolean featOkTst = JCasRegistry.getFeatOkTst("edu.cmu.cs.wfeely.hw1.BaseAnnotation"); /** @generated */ final Feature casFeat_source; /** @generated */ final int casFeatCode_source; /** @generated */ public String getSource(int addr) { if (featOkTst && casFeat_source == null) jcas.throwFeatMissing("source", "edu.cmu.cs.wfeely.hw1.BaseAnnotation"); return ll_cas.ll_getStringValue(addr, casFeatCode_source); } /** @generated */ public void setSource(int addr, String v) { if (featOkTst && casFeat_source == null) jcas.throwFeatMissing("source", "edu.cmu.cs.wfeely.hw1.BaseAnnotation"); ll_cas.ll_setStringValue(addr, casFeatCode_source, v);} /** @generated */ final Feature casFeat_confidence; /** @generated */ final int casFeatCode_confidence; /** @generated */ public double getConfidence(int addr) { if (featOkTst && casFeat_confidence == null) jcas.throwFeatMissing("confidence", "edu.cmu.cs.wfeely.hw1.BaseAnnotation"); return ll_cas.ll_getDoubleValue(addr, casFeatCode_confidence); } /** @generated */ public void setConfidence(int addr, double v) { if (featOkTst && casFeat_confidence == null) jcas.throwFeatMissing("confidence", "edu.cmu.cs.wfeely.hw1.BaseAnnotation"); ll_cas.ll_setDoubleValue(addr, casFeatCode_confidence, v);} /** initialize variables to correspond with Cas Type and Features * @generated */ public BaseAnnotation_Type(JCas jcas, Type casType) { super(jcas, casType); casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator()); casFeat_source = jcas.getRequiredFeatureDE(casType, "source", "uima.cas.String", featOkTst); casFeatCode_source = (null == casFeat_source) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_source).getCode(); casFeat_confidence = jcas.getRequiredFeatureDE(casType, "confidence", "uima.cas.Double", featOkTst); casFeatCode_confidence = (null == casFeat_confidence) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_confidence).getCode(); } }
14a420ba136ff90eb7261efde4c5845c04bc72e0
45c8befa5628270ef6e72552adddf2ba2d138c42
/pattern/pattern-proxy/src/main/java/com/bingo/java/pattern/proxy/cglibproxy/CGLibProxyTest.java
20f621bc5b426c9ec4b0f892bc72cf09a42cf821
[]
no_license
yyb0107/java-hub
7603f987fb50f55101b42952cec93cefb7d57d02
5f7f000317379245d92c4da3bac8b565eded16a8
refs/heads/master
2022-12-22T01:11:15.290197
2021-08-26T18:21:21
2021-08-26T18:21:21
177,807,824
0
0
null
2022-12-16T08:36:03
2019-03-26T14:41:49
Java
UTF-8
Java
false
false
661
java
package com.bingo.java.pattern.proxy.cglibproxy; import com.bingo.java.pattern.proxy.pojo.IPerson; import com.bingo.java.pattern.proxy.pojo.Person; import net.sf.cglib.core.DebuggingClassWriter; /** * @author Bingo * @title: CGLibProxyTest * @projectName java-hub * @description: TODO * @date 2019/4/5 23:08 */ public class CGLibProxyTest { public static void main(String[] args) { System.setProperty(DebuggingClassWriter.DEBUG_LOCATION_PROPERTY,"D://cglib_proxy_classes"); JobHunter hunter = new JobHunter(); IPerson person = (IPerson) hunter.getInstance(Person.class); person.findJob("this is command!"); } }
0d59c0419c12eb102a0835b96ede07467f869459
4573ee264818b8f7ee8dfa87583f004c8536e7a1
/src/main/java/com/yundaren/support/po/ProjectPo.java
e67c6b66bbbc298d24d3b8e900a8c2e32ac40ea0
[]
no_license
n1318914/make8
2e4ddcc9d47e6db2b1df6c5fd69b92d8b1660b3a
613980839235ec9a86d38a20e58d8daa3047e5f8
refs/heads/master
2021-01-19T09:55:35.301319
2017-02-16T07:20:22
2017-02-16T07:20:22
82,151,815
0
1
null
null
null
null
UTF-8
Java
false
false
1,922
java
package com.yundaren.support.po; import java.util.Date; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; @Data public class ProjectPo { // 活动ID private String id; // 需求类型 private String type; // 心里价格 private String priceRange; // 需求简述 private String name; // 需求详细描述 private String content; // 需求附件 private String attachment; // 交付周期(天) private int period; // 竞标截止时间 @DateTimeFormat(pattern = "yyyy-MM-dd") private Date bidEndTime; // 后台状态 -1审核未通过, 0审核中,1招标中,2托管中,3工作中,4验收中,5验收未通过,6验收通过, 8关闭(未选标),9关闭(任务完成),10已取消,11已评价 private int backgroudStatus = -10; // 提单人用户ID private long creatorId; // 中标人用户ID private long employeeId = -1; // 审核人 private long checkerId = -1; // 审核日期 private Date checkTime; // 审核结果 private String checkResult; // 创建时间 @DateTimeFormat(pattern = "yyyy-MM-dd") private Date createTime; // 备注 private String remark; // 发标人姓名 private String userName; // 竞标个数 private int joinCount; // 完成时间 @DateTimeFormat(pattern = "yyyy-MM-dd") private Date finishTime; // 审核通过时间 @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date acceptTime; // 审核不通过原因 private String acceptResult; // 雇主选择公开的联系方式(1手机 2邮箱 3QQ 4微信)用逗号分隔 private String publicContact; // 是否为诚意项目(0否、1是) private int isSincerity = -1; // 项目排序级别(0普通,1置顶项目,2诚意项目) private int ranking = -1; // 是否删除(0否,1是) private int deleted = -1; private String contactMobile; private String contactEmail; private String contactQq; private String contactWeixin; }
99eabfaa50d07aef58a52749e350804bb0978e5e
1466992fcbf177558e30a29ef24e8106aecdd67c
/src/main/java/com/dingzhaohua/helloworld/Swagger2.java
69ff02ab74bfd13328b4edb0d93b719635816a04
[ "MIT" ]
permissive
dzh1104/freedom
d74ba7ba806117388c7bb7c5c741c9fb00319bb9
de46a6e8d055e6e871fd8b7792180d4b0bc3489d
refs/heads/master
2020-04-06T08:45:55.934841
2018-11-27T11:53:53
2018-11-27T11:53:53
157,315,576
1
0
null
null
null
null
UTF-8
Java
false
false
1,883
java
package com.dingzhaohua.helloworld; //swagger2的配置文件,在项目的启动类的同级文件建立 import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; //swagger2的配置 @Configuration //项目启动的时候启动swagger2 @EnableSwagger2 public class Swagger2 { //swagger2的配置文件,这里可以配置swagger2的一些基本的内容,比如扫描的包等等 @Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() //为当前包路径,指的是我们在哪些类中使用swagger2来测试 .apis(RequestHandlerSelectors.basePackage("com.dingzhaohua.helloworld.Controller")) .paths(PathSelectors.any()) .build(); } //构建 api文档的详细信息函数,注意这里的注解引用的是哪个 private ApiInfo apiInfo() { return new ApiInfoBuilder() //页面标题 .title("Spring Boot 测试使用 Swagger2 构建RESTful API") //创建人 .contact(new Contact("zhding", "https://github.com/dzh1104", "[email protected]")) //版本号 .version("1.0") //描述 .description("API 描述") .build(); } }
e396a5d72dc19546f9d933b013c5326acdbb1d86
0ed456435ee6385e2f86c407982781e7a21b4c6d
/client/YYQuan/multi-image-selector/src/main/java/me/nereo/multi_image_selector/adapter/ImageGridAdapter.java
2e042f544230a43aa64f92ac96724a01c5f66db0
[ "Apache-2.0" ]
permissive
kkman2008/xmppapp
961e5c97fb1b878f630959685616278f3ad38d06
290fae6a6a65b199275d1a7992967b834bfe2483
refs/heads/master
2020-03-27T09:02:19.228855
2018-10-09T20:59:46
2018-10-09T20:59:46
146,308,835
2
1
null
null
null
null
UTF-8
Java
false
false
6,708
java
package me.nereo.multi_image_selector.adapter; import android.content.Context; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.GridView; import android.widget.ImageView; import com.squareup.picasso.Callback; import com.squareup.picasso.Picasso; import java.io.File; import java.util.ArrayList; import java.util.List; import me.nereo.multi_image_selector.R; import me.nereo.multi_image_selector.bean.Image; /** * 图片Adapter * Created by Nereo on 2015/4/7. */ public class ImageGridAdapter extends BaseAdapter { private static final int TYPE_CAMERA = 0; private static final int TYPE_NORMAL = 1; private Context mContext; private LayoutInflater mInflater; private boolean showCamera = true; private boolean showSelectIndicator = true; private List<Image> mImages = new ArrayList<>(); private List<Image> mSelectedImages = new ArrayList<>(); private int mItemSize; private GridView.LayoutParams mItemLayoutParams; public ImageGridAdapter(Context context, boolean showCamera){ mContext = context; mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); this.showCamera = showCamera; mItemLayoutParams = new GridView.LayoutParams(GridView.LayoutParams.MATCH_PARENT, GridView.LayoutParams.MATCH_PARENT); } /** * 显示选择指示器 * @param b */ public void showSelectIndicator(boolean b) { showSelectIndicator = b; } public void setShowCamera(boolean b){ if(showCamera == b) return; showCamera = b; notifyDataSetChanged(); } public boolean isShowCamera(){ return showCamera; } /** * 选择某个图片,改变选择状态 * @param image */ public void select(Image image) { if(mSelectedImages.contains(image)){ mSelectedImages.remove(image); }else{ mSelectedImages.add(image); } notifyDataSetChanged(); } /** * 通过图片路径设置默认选择 * @param resultList */ public void setDefaultSelected(ArrayList<String> resultList) { for(String path : resultList){ Image image = getImageByPath(path); if(image != null){ mSelectedImages.add(image); } } if(mSelectedImages.size() > 0){ notifyDataSetChanged(); } } private Image getImageByPath(String path){ if(mImages != null && mImages.size()>0){ for(Image image : mImages){ if(image.path.equalsIgnoreCase(path)){ return image; } } } return null; } /** * 设置数据集 * @param images */ public void setData(List<Image> images) { mSelectedImages.clear(); if(images != null && images.size()>0){ mImages = images; }else{ mImages.clear(); } notifyDataSetChanged(); } /** * 重置每个Column的Size * @param columnWidth */ public void setItemSize(int columnWidth) { if(mItemSize == columnWidth){ return; } mItemSize = columnWidth; mItemLayoutParams = new GridView.LayoutParams(mItemSize, mItemSize); notifyDataSetChanged(); } @Override public int getViewTypeCount() { return 2; } @Override public int getItemViewType(int position) { if(showCamera){ return position==0 ? TYPE_CAMERA : TYPE_NORMAL; } return TYPE_NORMAL; } @Override public int getCount() { return showCamera ? mImages.size()+1 : mImages.size(); } @Override public Image getItem(int i) { if(showCamera){ if(i == 0){ return null; } return mImages.get(i-1); }else{ return mImages.get(i); } } @Override public long getItemId(int i) { return i; } @Override public View getView(int i, View view, ViewGroup viewGroup) { int type = getItemViewType(i); if(type == TYPE_CAMERA){ view = mInflater.inflate(R.layout.list_item_camera, viewGroup, false); view.setTag(null); }else if(type == TYPE_NORMAL){ ViewHolde holde; if(view == null){ view = mInflater.inflate(R.layout.list_item_image, viewGroup, false); holde = new ViewHolde(view); }else{ holde = (ViewHolde) view.getTag(); if(holde == null){ view = mInflater.inflate(R.layout.list_item_image, viewGroup, false); holde = new ViewHolde(view); } } if(holde != null) { holde.bindData(getItem(i)); } } /** Fixed View Size */ GridView.LayoutParams lp = (GridView.LayoutParams) view.getLayoutParams(); if(lp.height != mItemSize){ view.setLayoutParams(mItemLayoutParams); } return view; } class ViewHolde { ImageView image; ImageView indicator; ViewHolde(View view){ image = (ImageView) view.findViewById(R.id.image); indicator = (ImageView) view.findViewById(R.id.checkmark); view.setTag(this); } void bindData(final Image data){ if(data == null) return; // 处理单选和多选状态 if(showSelectIndicator){ indicator.setVisibility(View.VISIBLE); if(mSelectedImages.contains(data)){ // 设置选中状态 indicator.setImageResource(R.drawable.btn_selected); }else{ // 未选择 indicator.setImageResource(R.drawable.btn_unselected); } }else{ indicator.setVisibility(View.GONE); } File imageFile = new File(data.path); if(mItemSize > 0) { // 显示图片 Picasso.with(mContext) .load(imageFile) .placeholder(R.drawable.default_error) //.error(R.drawable.default_error) .resize(mItemSize, mItemSize) .centerCrop() .into(image); } } } }
0c1d4c9f7714624b5bc17b402121082dea3db9e2
acc18fcba1c66500579b93432484c745a61c2f2d
/DanhBaContentProvider/app/src/main/java/com/example/huynh/danhba/Keyboard.java
9a78f0784f91eca8f05c04feaace334fb996d138
[]
no_license
lucfan99/DanhSachDoAn
b58a4b25cb90a596942313a00af44e66f30a0275
6ed591aad9e66d8e88679bf9a44bc311f07ea1c2
refs/heads/master
2022-12-14T17:49:51.516368
2020-09-20T12:30:22
2020-09-20T12:30:22
297,069,420
0
0
null
null
null
null
UTF-8
Java
false
false
4,404
java
package com.example.huynh.danhba; import android.content.Context; import android.text.TextUtils; import android.util.AttributeSet; import android.util.SparseArray; import android.view.LayoutInflater; import android.view.View; import android.view.inputmethod.InputConnection; import android.widget.Button; import android.widget.LinearLayout; public class Keyboard extends LinearLayout implements View.OnClickListener { // constructors public Keyboard(Context context) { this(context, null, 0); } public Keyboard(Context context, AttributeSet attrs) { this(context, attrs, 0); } public Keyboard(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context, attrs); } // keyboard keys (buttons) private Button mButton1; private Button mButton2; private Button mButton3; private Button mButton4; private Button mButton5; private Button mButton6; private Button mButton7; private Button mButton8; private Button mButton9; private Button mButton0; private Button mButtonDelete; private Button mButtonEnter; // This will map the button resource id to the String value that we want to // input when that button is clicked. SparseArray<String> keyValues = new SparseArray<>(); // Our communication link to the EditText InputConnection inputConnection; private void init(Context context, AttributeSet attrs) { // initialize buttons LayoutInflater.from(context).inflate(R.layout.keyboard_layout, this, true); mButton1 = (Button) findViewById(R.id.button_1); mButton2 = (Button) findViewById(R.id.button_2); mButton3 = (Button) findViewById(R.id.button_3); mButton4 = (Button) findViewById(R.id.button_4); mButton5 = (Button) findViewById(R.id.button_5); mButton6 = (Button) findViewById(R.id.button_6); mButton7 = (Button) findViewById(R.id.button_7); mButton8 = (Button) findViewById(R.id.button_8); mButton9 = (Button) findViewById(R.id.button_9); mButton0 = (Button) findViewById(R.id.button_0); mButtonDelete = (Button) findViewById(R.id.button_delete); mButtonEnter = (Button) findViewById(R.id.button_call); // set button click listeners mButton1.setOnClickListener(this); mButton2.setOnClickListener(this); mButton3.setOnClickListener(this); mButton4.setOnClickListener(this); mButton5.setOnClickListener(this); mButton6.setOnClickListener(this); mButton7.setOnClickListener(this); mButton8.setOnClickListener(this); mButton9.setOnClickListener(this); mButton0.setOnClickListener(this); mButtonDelete.setOnClickListener(this); mButtonEnter.setOnClickListener(this); // map buttons IDs to input strings keyValues.put(R.id.button_1, "1"); keyValues.put(R.id.button_2, "2"); keyValues.put(R.id.button_3, "3"); keyValues.put(R.id.button_4, "4"); keyValues.put(R.id.button_5, "5"); keyValues.put(R.id.button_6, "6"); keyValues.put(R.id.button_7, "7"); keyValues.put(R.id.button_8, "8"); keyValues.put(R.id.button_9, "9"); keyValues.put(R.id.button_0, "0"); } @Override public void onClick(View v) { // do nothing if the InputConnection has not been set yet if (inputConnection == null) return; // Delete text or input key value // All communication goes through the InputConnection if (v.getId() == R.id.button_delete) { CharSequence selectedText = inputConnection.getSelectedText(0); if (TextUtils.isEmpty(selectedText)) { // no selection, so delete previous character inputConnection.deleteSurroundingText(1, 0); } else { // delete the selection inputConnection.commitText("", 1); } } else { String value = keyValues.get(v.getId()); inputConnection.commitText(value, 1); } } // The activity (or some parent or controller) must give us // a reference to the current EditText's InputConnection public void setInputConnection(InputConnection ic) { this.inputConnection = ic; } }
7c9b051f0faa5056a008d6c0a4ff0156e3209ed7
d1934fc04349a410698894c51739bedee2d9c021
/Woman.java
494d5ad496790563d1f7edda505e27dc65780d80
[]
no_license
Merry123/yss-2
b844ed6dbd125859645fd5277722acad229331fd
4d229f98f6ffe3d9c257accd16996e602b557859
refs/heads/master
2021-01-19T09:21:30.829895
2017-04-10T01:36:39
2017-04-10T01:36:39
87,752,225
0
0
null
null
null
null
GB18030
Java
false
false
128
java
public class Woman implements NvWa{ public void create () { System.out.println("女娲创造了一个女人"); } }
9afe69208696f245c95683b921ca6c67043e7f31
cb3e78036b285e820049e2f1ac879d14eac6057e
/app/src/main/java/com/example/newsapp/utils/InternetConnection.java
fab8ee717f892dcf882489951b814c2ac5019567
[]
no_license
couragepaul/NewsApp
5ea6071de62bfa5e6f4f339dc8a0c74baf1156be
5b50603ad690ecb51352f43a92de7cb8c6abc530
refs/heads/master
2023-01-28T08:30:46.541812
2020-12-03T16:57:09
2020-12-03T16:57:09
318,248,611
0
0
null
null
null
null
UTF-8
Java
false
false
719
java
package com.example.newsapp.utils; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class InternetConnection { /** * check Internet connection available in system */ public static boolean isConnectingToInternet(Context context){ try { ConnectivityManager connectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivity != null){ NetworkInfo netInfo = connectivity.getActiveNetworkInfo(); if (netInfo != null && netInfo.isConnectedOrConnecting()) { return true; } } return false; } catch (Exception e) { e.printStackTrace(); return false; } } }
f7fe82b50e470f27c09d547877b27bb83837863c
9bc4e4fd32dda778d61e15fd95609a5fb74faac3
/boot-system/src/main/java/com/boot/system/domain/SysNotice.java
01ce637788ef6ab1fe5a9a79130d82b4b43e4511
[ "MIT" ]
permissive
missaouib/boot
210455e5cf87408b61852f36277e62b69fc4fff0
5340a820326ff06f6bd2a7bb1b905726c61aceb1
refs/heads/master
2023-03-02T23:42:05.000876
2021-01-13T07:03:45
2021-01-13T07:03:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,376
java
package com.boot.system.domain; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.boot.common.core.domain.BaseEntity; /** * 通知公告表 sys_notice * * @author ruoyi */ public class SysNotice extends BaseEntity { private static final long serialVersionUID = 1L; /** 公告ID */ private Long noticeId; /** 公告标题 */ private String noticeTitle; /** 公告类型(1通知 2公告) */ private String noticeType; /** 公告内容 */ private String noticeContent; /** 公告状态(0正常 1关闭) */ private String status; public Long getNoticeId() { return noticeId; } public void setNoticeId(Long noticeId) { this.noticeId = noticeId; } public void setNoticeTitle(String noticeTitle) { this.noticeTitle = noticeTitle; } @NotBlank(message = "公告标题不能为空") @Size(min = 0, max = 50, message = "公告标题不能超过50个字符") public String getNoticeTitle() { return noticeTitle; } public void setNoticeType(String noticeType) { this.noticeType = noticeType; } public String getNoticeType() { return noticeType; } public void setNoticeContent(String noticeContent) { this.noticeContent = noticeContent; } public String getNoticeContent() { return noticeContent; } public void setStatus(String status) { this.status = status; } public String getStatus() { return status; } @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) .append("noticeId", getNoticeId()) .append("noticeTitle", getNoticeTitle()) .append("noticeType", getNoticeType()) .append("noticeContent", getNoticeContent()) .append("status", getStatus()) .append("createBy", getCreateBy()) .append("createTime", getCreateTime()) .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) .append("remark", getRemark()) .toString(); } }
8a3474dc09888555ed372ca3a7dcbe037e3c3ab5
4cf0768f3f8ae53755c015aa0d468a131a5962f6
/src/test/java/studio/guoliao/DigestTest.java
2d61af4759b958f778defb7525620159bed8d418
[ "MIT", "Apache-2.0" ]
permissive
guoliao502/crypto
de060d7dd7f3db0d2bbd7cc095f78a2a73daed8c
5e551bc10ed02a1feb12bd74e3d1599364ce2261
refs/heads/master
2022-02-02T21:03:43.882476
2020-07-07T02:55:55
2020-07-07T02:55:55
198,992,538
90
9
NOASSERTION
2022-01-04T16:34:53
2019-07-26T09:53:20
Java
UTF-8
Java
false
false
1,767
java
package studio.guoliao; import org.apache.commons.codec.binary.Base64; import org.junit.Assert; import org.junit.Test; import studio.guoliao.crypto.digest.CommonDigest; import studio.guoliao.crypto.digest.HmacDigest; import studio.guoliao.crypto.model.KeyDescription; import studio.guoliao.crypto.util.KeyUtil; import javax.crypto.SecretKey; import java.security.NoSuchAlgorithmException; import java.security.spec.InvalidKeySpecException; /** * User: guoliao * Date: 2019/7/26 * Time: 下午2:46 * Description: */ public class DigestTest { @Test public void digest(){ String data = "helloworld"; byte[] tmp = CommonDigest.MD5_DIGEST.digest(data.getBytes()); System.out.println(Base64.encodeBase64String(tmp)); tmp = CommonDigest.SHA1_DIGEST.digest(data.getBytes()); System.out.println(Base64.encodeBase64String(tmp)); tmp = CommonDigest.SHA224_DIGEST.digest(data.getBytes()); System.out.println(Base64.encodeBase64String(tmp)); tmp = CommonDigest.SHA256_DIGEST.digest(data.getBytes()); System.out.println(Base64.encodeBase64String(tmp)); tmp = CommonDigest.SHA512_DIGEST.digest(data.getBytes()); System.out.println(Base64.encodeBase64String(tmp)); } @Test public void hmacDigest() throws InvalidKeySpecException, NoSuchAlgorithmException { String data = "helloworld"; KeyUtil keyUtil = new KeyUtil(); SecretKey key = keyUtil.generateSameKey(KeyDescription.DES_56, "SHA1PRNG", data.getBytes()); HmacDigest digest = new HmacDigest(HmacDigest.HMAC_MD5, key); byte[] buf = digest.digest(data.getBytes()); System.out.println(Base64.encodeBase64String(buf)); Assert.assertNotNull("", buf); } }
378e84ec66b24436722c6c60ff1d2e68152b3968
e5426870bef8c561b1a9c476384dc511f7a2c7ca
/SpringBootHomeGroup/src/main/java/com/example/demo/repository/PrayerRepository.java
3dc68671ddce0349dc4371ccfde8c66aeb18ae2f
[]
no_license
Oleg8519/System-accounting-and-attendance-in-the-organization-KJMC
902e85bc0eb6a170244ea109c6dd31334970b5c3
a0951c6a570663d5a0038f67b7b03ef5d56dceca
refs/heads/master
2020-07-28T17:44:49.294714
2019-09-19T06:54:02
2019-09-19T06:54:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
220
java
package com.example.demo.repository; import com.example.demo.model.Prayer; import org.springframework.data.jpa.repository.JpaRepository; public interface PrayerRepository extends JpaRepository<Prayer, Long> { }
da7fe6df318e5d27fb45e21bd150bcfe57e61cdb
f0a64578e206d196ed29465fa8d1115ea15534d3
/src/main/java/com/bishal/Bank/common/enums/TransactionType.java
6310482ef9f54e50753e32d7233e780539a7af22
[]
no_license
Bishalj/Bank
012c3f6816702fcb631b77ccd240920c4c544740
7bb9d69987ec5a17fd9dc93745d0002e6e29279c
refs/heads/master
2022-11-01T04:23:10.748598
2020-06-15T16:54:52
2020-06-15T16:54:52
272,141,428
0
0
null
null
null
null
UTF-8
Java
false
false
94
java
package com.bishal.Bank.common.enums; public enum TransactionType { WITHDRAW, DEPOSIT }
d12e6efe77682eed6b2c09332a4cbdfb951ec4c2
4f2466d8e4018b2af65570770e0618d463b78e3f
/pinot-core/src/test/java/org/apache/pinot/core/data/readers/RecordReaderTest.java
f6ec85d47c849774c25146972a69183915aafcba
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
hufman/incubator-pinot
9ab4970406426c2a71bfb0e486ee049c368d572c
8a231a636dd3c3a12740a4082ae04d67730171d2
refs/heads/master
2020-04-17T23:51:44.918458
2019-01-20T20:51:21
2019-01-20T20:51:21
167,053,601
0
0
null
null
null
null
UTF-8
Java
false
false
2,085
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.pinot.core.data.readers; import org.apache.pinot.common.data.FieldSpec; import org.apache.pinot.common.data.Schema; import org.apache.pinot.core.data.GenericRow; import org.testng.Assert; public abstract class RecordReaderTest { protected static final String[] COLUMNS = {"INT_SV", "INT_MV"}; protected static final Schema SCHEMA = new Schema.SchemaBuilder().addMetric(COLUMNS[0], FieldSpec.DataType.INT) .addMultiValueDimension(COLUMNS[1], FieldSpec.DataType.INT, -1) .build(); protected static final Object[][] RECORDS = {{5, new int[]{10, 15, 20}}, {25, new int[]{30, 35, 40}}, {null, null}}; private static final Object[] DEFAULT_VALUES = {0, new int[]{-1}}; protected static void checkValue(RecordReader recordReader) throws Exception { for (Object[] expectedRecord : RECORDS) { GenericRow actualRecord = recordReader.next(); int numColumns = COLUMNS.length; for (int i = 0; i < numColumns; i++) { if (expectedRecord[i] != null) { Assert.assertEquals(actualRecord.getValue(COLUMNS[i]), expectedRecord[i]); } else { Assert.assertEquals(actualRecord.getValue(COLUMNS[i]), DEFAULT_VALUES[i]); } } } Assert.assertFalse(recordReader.hasNext()); } }
f8dfc01a45b2a82f588335f45bbf735ba0a84b67
9af8fe96b774b77617e8f66846474c44f66fcf74
/AndroidUtils/src/main/java/com/nityankhanna/androidutils/DateTimeFormat.java
1b88dd23ca5644e03805bb95ab2b30920ef18dae
[ "MIT" ]
permissive
b3457m0d3/android-utils-1
82868365d070fed6b8fab729075ced0a5c41d33e
b2aecf04e28e5fa794874f391e7d9e16e80cd363
refs/heads/master
2020-12-31T03:16:11.023342
2014-03-09T04:17:55
2014-03-09T04:17:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,044
java
package com.nityankhanna.androidutils; /** * Created by Nityan Khanna on Jan 14 2014. */ public enum DateTimeFormat { DAY_MONTH_YEAR("dd/MM/yyyy"), MONTH_DAY_YEAR("MM/dd/yyyy"), YEAR_MONTH_DAY("yyyy/MM/dd"), HOUR_MINUTE_SECOND_12("hh:mm:ss"), HOUR_MINUTE_SECOND_24("kk:mm:ss"), HOUR_MINUTE_SECOND_AM_PM("hh:mm:ss aa"), DAY_MONTH_YEAR_HOUR_MINUTE_SECOND_12("dd/MM/yyyy hh:mm:ss"), DAY_MONTH_YEAR_HOUR_MINUTE_SECOND_24("dd/MM/yyyy kk:mm:ss"), MONTH_DAY_YEAR_HOUR_MINUTE_SECOND_12("MM/dd/yyyy hh:mm:ss"), MONTH_DAY_YEAR_HOUR_MINUTE_SECOND_24("MM/dd/yyyy kk:mm:ss"), YEAR_MONTH_DAY_HOUR_MINUTE_SECOND_12("yyyy/MM/dd hh:mm:ss"), YEAR_MONTH_DAY_HOUR_MINUTE_SECOND_24("yyyy/MM/dd kk:mm:ss"), DAY_MONTH_YEAR_HOUR_MINUTE_SECOND_AM_PM("dd/MM/yyyy hh:mm:ss aa"), MONTH_DAY_YEAR_HOUR_MINUTE_SECOND_AM_PM("MM/dd/yyyy hh:mm:ss aa"), YEAR_MONTH_DAY_HOUR_MINUTE_SECOND_AM_PM("yyyy/MM/dd hh:mm:ss aa"); private String value; private DateTimeFormat(String value) { this.value = value; } public String getValue() { return value; } }