blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
cc8edcfd5956d7c38b26e423a3717d4459ae44d7
a2d87f7a9088776d8f6dc0db695d0beca1493b6e
/yongqing-bigdata-tools/yongqing-presto-hbase/src/main/java/com/yongqing/presto/hbase/HbaseHandleResolver.java
d43725f4155cc37a294430e00f84e8812439dd23
[ "Apache-2.0" ]
permissive
251538232/bigdata_tools
bbcfe3c52490104370132b2748abdb34aa72b3cb
f329082f0353533bc0e60c51d290bf94f77261c5
refs/heads/master
2022-12-23T15:54:37.486052
2020-09-24T08:49:48
2020-09-24T08:49:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,850
java
package com.yongqing.presto.hbase; import com.yongqing.presto.hbase.model.HbaseColumnHandle; import com.yongqing.presto.hbase.model.HbaseSplit; import com.yongqing.presto.hbase.model.HbaseTableHandle; import com.yongqing.presto.hbase.model.HbaseTableLayoutHandle; import com.yongqing.presto.hbase.model.HbaseTransactionHandle; import com.facebook.presto.spi.ColumnHandle; import com.facebook.presto.spi.ConnectorHandleResolver; import com.facebook.presto.spi.ConnectorInsertTableHandle; import com.facebook.presto.spi.ConnectorOutputTableHandle; import com.facebook.presto.spi.ConnectorSplit; import com.facebook.presto.spi.ConnectorTableHandle; import com.facebook.presto.spi.ConnectorTableLayoutHandle; import com.facebook.presto.spi.connector.ConnectorTransactionHandle; public class HbaseHandleResolver implements ConnectorHandleResolver { @Override public Class<? extends ConnectorTableLayoutHandle> getTableLayoutHandleClass() { return HbaseTableLayoutHandle.class; } @Override public Class<? extends ConnectorTableHandle> getTableHandleClass() { return HbaseTableHandle.class; } @Override public Class<? extends ConnectorInsertTableHandle> getInsertTableHandleClass() { return HbaseTableHandle.class; } @Override public Class<? extends ConnectorOutputTableHandle> getOutputTableHandleClass() { return HbaseTableHandle.class; } @Override public Class<? extends ColumnHandle> getColumnHandleClass() { return HbaseColumnHandle.class; } @Override public Class<? extends ConnectorSplit> getSplitClass() { return HbaseSplit.class; } @Override public Class<? extends ConnectorTransactionHandle> getTransactionHandleClass() { return HbaseTransactionHandle.class; } }
[ "yongqing_zh@163.com" ]
yongqing_zh@163.com
19ad9579c648c202461598ae3b03afbb8774d49f
22298236daa1f44a2a35a97d98a2b0f67e3e278a
/spring-boot/spring-boot-testing/src/test/java/com/wjz/springboot/MockWebTestClientExampleTests.java
cb885d6d346cb203315e21d722d11b1ba533c07d
[ "Apache-2.0" ]
permissive
BINGJJFLY/bingjjfly-springboot
ca20bea6b6140d47e8a0c2625aae3a514009d9fc
7564abb411c8f4695f4ce264cef9b8f871da4b8b
refs/heads/master
2020-07-02T23:35:37.224574
2020-05-16T13:24:35
2020-05-16T13:24:35
201,708,113
0
0
null
null
null
null
UTF-8
Java
false
false
791
java
package com.wjz.springboot; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.reactive.server.WebTestClient; @RunWith(SpringRunner.class) @SpringBootTest @AutoConfigureWebTestClient public class MockWebTestClientExampleTests { @Autowired private WebTestClient webClient; @Test public void exampleTest() { this.webClient.get().uri("/").exchange().expectStatus().isOk().expectBody(String.class) .isEqualTo("Hello World"); } }
[ "17091267797@163.com" ]
17091267797@163.com
15836875a51e127e6fe34d4cae33d4a8b6a15c48
0118956ece52559399cd1805dd68ac21e83ae3d9
/fitnesse/lib/src/fitlibrarySrc/fitlibrary/exception/ExceptionHandlingStandard.java
ba4e38e2ab7d71146372c2b17f06e1e3350ffc88
[]
no_license
JavaQualitasCorpus/fitlibraryforfitnesse-20110301
6588290ca08deb254e76f67aa6936d2a6f24370f
ceb5abcce236ae380cc0745a7920f82cfba69a19
refs/heads/master
2023-08-12T08:37:17.890919
2019-03-12T23:27:44
2019-03-12T23:27:44
167,004,721
0
1
null
null
null
null
UTF-8
Java
false
false
1,612
java
/* * Copyright (c) 2009 Rick Mugridge, www.RimuResearch.com * Released under the terms of the GNU General Public License version 2 or later. * 20/10/2009 */ package fitlibrary.exception; import java.io.PrintWriter; import java.io.StringWriter; import fit.Fixture; import fitlibrary.suite.BatchFitLibrary; import fitlibrary.utility.ExceptionHandler; import fitlibrary.utility.HtmlUtils; public class ExceptionHandlingStandard implements ExceptionHandling { @Override public void mustBeThreadSafe() { // } @Override public String exceptionMessage(Throwable throwable) { Throwable exception = unwrapThrowable(throwable); if (!BatchFitLibrary.SHOW_EXCEPTION_STACKS && exception instanceof IgnoredException) return ""; if (!BatchFitLibrary.SHOW_EXCEPTION_STACKS && exception instanceof FitLibraryExceptionInHtml) return "<hr/>" + Fixture.label(exception.getMessage()); if (!BatchFitLibrary.SHOW_EXCEPTION_STACKS && exception instanceof FitLibraryException) return "<hr/>" + Fixture.label(HtmlUtils.escapeHtml(exception.getMessage())); final StringWriter buf = new StringWriter(); exception.printStackTrace(new PrintWriter(buf)); return "<hr><pre><div class=\"fit_stacktrace\">" + (buf.toString()) + "</div></pre>"; } @Override public Throwable unwrapThrowable(Throwable throwable) { return ExceptionHandler.unwrap(throwable); } @Override public boolean unwrappedIsShow(Exception e) { return unwrapThrowable(e) instanceof FitLibraryShowException; } }
[ "taibi@sonar-scheduler.rd.tut.fi" ]
taibi@sonar-scheduler.rd.tut.fi
587c8441f89ca8d1489abfc7271b540cdd8b5d0a
6592455ae6b2902db48cee095952906159bf3416
/CU013_EJBs/CU013_EJBs_03/web/src/main/java/edu/masterjava/ejb/tarea03/DelayEjbClient.java
22f73f754e21766fcb0a9c63650864ab55d4d303
[]
no_license
charques/master-java-elite
1352f7730feda2e226966dd768cf63a774b54294
5a979461a5a6b5c4e39147a7848b0da2e07f5918
refs/heads/master
2021-01-25T05:21:33.381086
2013-10-01T20:38:15
2013-10-01T20:38:15
13,224,627
1
0
null
null
null
null
UTF-8
Java
false
false
857
java
/** * */ package edu.masterjava.ejb.tarea03; import java.util.Timer; import java.util.TimerTask; import javax.ejb.EJB; /** * @author carloshernandezarques * */ public class DelayEjbClient { @EJB static StateTestBeanLocal beanLocal; static Timer timer; /** * @param args */ public static void main(String[] args) { new DelayEjbClient(); } public DelayEjbClient() { StateTestBean bean = (StateTestBean) beanLocal; bean.setValue(30); timer = new Timer(); timer.schedule(new GetValueFromEjbTask(bean), 60000); } class GetValueFromEjbTask extends TimerTask { StateTestBean bean; public GetValueFromEjbTask(StateTestBean pBean) { bean = pBean; } public void run() { int valor = bean.getValue(); System.out.println("valor: " + valor); System.exit(0); } } }
[ "carloshernandezarques@gmail.com" ]
carloshernandezarques@gmail.com
fe060a1bef0720f5aba01752c7b8708d848b41a8
dcc1517f614a45f6b82b582173e6f74756343980
/smartCore/src/main/java/com/sin/smart/core/formwork/db/splitdb/ShareDbUtil.java
36429654548a02e9ff58b2986223829770c864c8
[]
no_license
EvanSole/smart-parent
3ecad46b30acb868fb0d8c2068789dfc452af9b5
9cdb31f1b44a3188bb81973456eff2d8b9edb8bf
refs/heads/master
2021-01-14T10:57:40.877287
2016-09-22T08:57:15
2016-09-22T08:57:15
68,709,623
0
1
null
null
null
null
UTF-8
Java
false
false
1,093
java
package com.sin.smart.core.formwork.db.splitdb; import com.sin.smart.core.formwork.db.util.DbShareField; import com.sin.smart.core.formwork.db.vo.DbShardVO; import com.sin.smart.entity.CurrentUserEntity; public class ShareDbUtil { public static DbShardVO getDbShardVO(CurrentUserEntity user, long warehouseId, DbShareField...source){ DbShardVO dbShardVO = DbShardVO.getInstance(user); dbShardVO.setWarehouseId(warehouseId); if(null != source && source.length > 0 ){ dbShardVO.setSource(source[0]); if(source[0] == DbShareField.DEFAULT){ dbShardVO.setShardTableId(user.getTenantId()+""); } } return dbShardVO; } public static DbShardVO getNewDbsharedVO(DbShardVO dbShardVO, DbShareField source, String splietDbKey, String splitTableKey) { DbShardVO dbShardVONew = new DbShardVO(); dbShardVONew.setCurrentUser(dbShardVO.getCurrentUser()); dbShardVONew.setShardTableId(splitTableKey); dbShardVONew.setSource(source); dbShardVONew.setShardDbId(splietDbKey); dbShardVONew.setWarehouseId(dbShardVO.getWarehouseId()); return dbShardVONew; } }
[ "wang_china@foxmail.com" ]
wang_china@foxmail.com
f7a5dcddabb41841b51968eab3a2e62236d36721
c94df2a4d391fa6e674e67763ebb7720221f6cf6
/RadioAstronomia/src/main/java/com/craam/wellington/isrcsr/GenericSource.java
a0c159f0fce7aa4f2aba4d478ea640b3ed02f311
[]
no_license
faganello60/API-calculation-of-solar-explosions-in-frequency-Terahertz
4984ed0a4e7a62a6b919e51b0fb1b08e27924251
c31bcf204d97a0bdc0f5e9e3e0dc76134b1486b8
refs/heads/master
2021-09-07T02:41:20.350280
2018-02-16T00:36:38
2018-02-16T00:36:38
79,847,202
1
2
null
null
null
null
UTF-8
Java
false
false
14,386
java
package com.craam.wellington.isrcsr; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; import com.craam.wellington.statics.Constants; import com.craam.wellington.utils.MathUtils; public class GenericSource { //Setado pelo usuário protected Double size; // Tamanho da fonte protected Double height; // Altura da fonte protected Enviroment enviroment; //Calculado internamente protected Double radius; protected Double area; protected Double omega; protected Double volume; protected Double density; protected Integer viewAngle; protected Boolean useRazin = true; public GenericSource(Enviroment enviroment){ this.enviroment = enviroment; } public Double getSize(){ return size; } public Double getHeight(){ return height; } public Double getRadius() { return radius; } public Double getArea() { return area; } public Double getOmega() { return omega; } public Double getVolume() { return volume; } public Double getDensity() { return density; } public Enviroment getEnviroment(){ return enviroment; } public Boolean getUseRazin() { return useRazin; } public GenericSource setHeight(Double height){ this.height = height; if(this.area != null) this.setVolume(); return this; } protected GenericSource setVolume(){ this.volume = this.area * this.height; return this; } public GenericSource setViewAngle(int viewAngle){ this.viewAngle = viewAngle; return this; } public void setUseRazin(Boolean useRazin) { this.useRazin = useRazin; } public class Frequency { protected Integer frequencyIndex; protected Double frequencyValue; protected Double frequencyHarmonic; protected RefractionPolarization refractionPolarization; protected Radiation radiation; protected Double energyTreshould, microbunchTreshould; protected Double cos, sin; protected Double ordEmissivityLow=0., extraordEmissivityLow=0., ordEmissivityHigh=0., extraordEmissivityHigh=0.; protected Double ordAbsorptionLow=0., extraordAbsorptionLow=0., ordAbsorptionHigh=0., extraordAbsorptionHigh=0.; protected Double ordEmissivity, extraordEmissivity; public Frequency(Integer index, Double frequencyValue, int energyLower, int energuUpper, Double energyEspectrum, Double energyTreshould, Double microbunchTreshould){ this.cos = Math.cos(viewAngle * Constants.DEGREE_TO_RAD); this.sin = Math.sin(viewAngle * Constants.DEGREE_TO_RAD); this.frequencyIndex = index; this.frequencyValue = frequencyValue; this.frequencyHarmonic = frequencyValue / getEnviroment().getGyroFrequency(); this.refractionPolarization = new RefractionPolarization(); this.energyTreshould = energyTreshould; this.microbunchTreshould = microbunchTreshould; // Faz a integração sobre a energia Double el,eu,em; for(int i=energyLower; i<=energuUpper; i++){ el = Math.pow(10, (0.05*(i-1)-2)); eu = Math.pow(10, (0.05*i-2)); em = Math.pow(10, (0.05*(i-0.5)-2)); Double de = eu-el; Double gamma = em / Constants.ELECTRON_REST_ENERGY + 1; radiation = new Radiation(gamma); if(em < microbunchTreshould){ // Low Energy Electrons ordEmissivityLow += getEmissivity(em, de, energyEspectrum, radiation.getOrdEmissivityIndex()); ordAbsorptionLow += getAbsorption(em, de, energyEspectrum, gamma, radiation.getOrdEmissivityIndex()); extraordEmissivityLow += getEmissivity(em, de, energyEspectrum, radiation.getExtraordEmissivityIndex()); extraordAbsorptionLow += getAbsorption(em, de, energyEspectrum, gamma, radiation.getExtraordEmissivityIndex()); } else { // High Energy Electrons ordEmissivityHigh += getEmissivity(em, de, energyEspectrum, radiation.getOrdEmissivityIndex()); ordAbsorptionHigh += getAbsorption(em, de, energyEspectrum, gamma, radiation.getOrdEmissivityIndex()); extraordEmissivityHigh += getEmissivity(em, de, energyEspectrum, radiation.getExtraordEmissivityIndex()); extraordAbsorptionHigh += getAbsorption(em, de, energyEspectrum, gamma, radiation.getExtraordEmissivityIndex()); } } ordEmissivity = ordEmissivityLow + ordEmissivityHigh; extraordEmissivity = extraordEmissivityHigh + extraordEmissivityLow; } public Double getFrequencyValue(){ return frequencyValue; } public Double getFrequencyHarmonic(){ return frequencyHarmonic; } public RefractionPolarization getRefractionPolarization(){ return refractionPolarization; } public Double getEmissivity(Double em, Double de, Double energyEspectrum, Double emissivityIndex){ return (emissivityIndex * Math.pow(em, -energyEspectrum) * de * getEnviroment().getMagneticField() * Constants.EMISSIVITY_FACTOR); } public Double getAbsorption(Double em, Double de, Double energyEspectrum, Double gamma, Double emissivityIndex) { return (emissivityIndex * Math.pow(em, -energyEspectrum) * de / Math.pow(frequencyHarmonic, 2) / getEnviroment().getMagneticField() * Constants.ABSORPTION_FACTOR * (energyEspectrum * gamma *(gamma + 1 ) + 2 *Math.pow(gamma, 2) -1) / gamma / (Math.pow(gamma, 2)-1)); } protected class RefractionPolarization { private Double ordRefractionIndex, extraordRefractionIndex; private Double ordPolarizationCoefficient, extraordPolarizationCoefficient; private RefractionPolarization(){ // Refraction Index Double refractionNum = 2 * Math.pow(getEnviroment().getFrequencyRatio(),2) * (Math.pow(getEnviroment().getFrequencyRatio(),2) - Math.pow(getFrequencyHarmonic(),2)); Double ordRefractionDnum = +Math.sqrt(Math.pow(getFrequencyHarmonic(),4) * Math.pow(sin,4) + 4 * Math.pow(getFrequencyHarmonic(),2)*Math.pow((Math.pow(getEnviroment().getFrequencyRatio(),2)-Math.pow(getFrequencyHarmonic(),2)), 2) * Math.pow(cos,2)) - 2 * Math.pow(getFrequencyHarmonic(),2) * (Math.pow(getEnviroment().getFrequencyRatio(),2) - Math.pow(getFrequencyHarmonic(),2)) - Math.pow(getFrequencyHarmonic(), 2) * Math.pow(sin, 2); Double extraordRefractionDnum = -Math.sqrt(Math.pow(getFrequencyHarmonic(),4) * Math.pow(sin,4) + 4 * Math.pow(getFrequencyHarmonic(),2)*Math.pow((Math.pow(getEnviroment().getFrequencyRatio(),2)-Math.pow(getFrequencyHarmonic(),2)), 2) * Math.pow(cos,2)) - 2 * Math.pow(getFrequencyHarmonic(),2) * (Math.pow(getEnviroment().getFrequencyRatio(),2) - Math.pow(getFrequencyHarmonic(),2)) - Math.pow(getFrequencyHarmonic(), 2) * Math.pow(sin, 2); this.ordRefractionIndex = 1 + refractionNum / ordRefractionDnum; this.extraordRefractionIndex = 1 + refractionNum / extraordRefractionDnum; // Polarization Index Double polarizationNum = 2 * getFrequencyHarmonic() * (Math.pow(getEnviroment().getFrequencyRatio(),2) - Math.pow(getFrequencyHarmonic(),2)) * cos; Double ordPolarizationDnum = +Math.sqrt(Math.pow(getFrequencyHarmonic(), 4) * Math.pow(sin,4) + 4 * Math.pow(getFrequencyHarmonic(), 2) * Math.pow((Math.pow(getEnviroment().getFrequencyRatio(), 2) - Math.pow(getFrequencyHarmonic(), 2)), 2)* Math.pow(cos, 2)) - Math.pow(getFrequencyHarmonic(),2) * Math.pow(sin,2); Double extraordPolarizationDnum = -Math.sqrt(Math.pow(getFrequencyHarmonic(), 4) * Math.pow(sin,4) + 4 * Math.pow(getFrequencyHarmonic(), 2) * Math.pow((Math.pow(getEnviroment().getFrequencyRatio(), 2) - Math.pow(getFrequencyHarmonic(), 2)), 2)* Math.pow(cos, 2)) - Math.pow(getFrequencyHarmonic(),2) * Math.pow(sin,2); this.ordPolarizationCoefficient = -polarizationNum / ordPolarizationDnum; this.extraordPolarizationCoefficient = -polarizationNum / extraordPolarizationDnum; } public Double getOrdRefractionIndex(){ return ordRefractionIndex; } public Double getExtraordRefractionIndex(){ return extraordRefractionIndex; } public Double getOrdPolarizationCoefficient(){ return ordPolarizationCoefficient; } public Double getExtraordPolarizationCoefficient(){ return extraordPolarizationCoefficient; } } protected class Radiation { Double gamma, gammaTreshould; Double ordEmissivityIndex = 0.; Double extraordEmissivityIndex = 0.; Double refraction = 0.; Double polarization= 0.; protected Radiation(Double gamma){ this.gamma = gamma; this.gammaTreshould = energyTreshould / Constants.ELECTRON_REST_ENERGY + 1; if(this.gamma < this.gammaTreshould){ if(getFrequencyHarmonic() > getEnviroment().getFrequencyRatio()){ this.refraction = Math.sqrt(refractionPolarization.getOrdRefractionIndex()); this.polarization = refractionPolarization.getOrdPolarizationCoefficient(); this.ordEmissivityIndex = this.GyroSincrotron(); } if(getUseRazin()){ if(getFrequencyHarmonic() > (Math.sqrt(Math.pow(getEnviroment().getFrequencyRatio(),2) + 0.25) + 0.5)){ this.refraction = Math.sqrt(refractionPolarization.getExtraordRefractionIndex()); this.polarization = refractionPolarization.getExtraordPolarizationCoefficient(); this.extraordEmissivityIndex = this.GyroSincrotron(); } } } else if(this.gamma >= this.gammaTreshould){ if(getUseRazin()){ if(getFrequencyHarmonic() > (Math.sqrt(Math.pow(getEnviroment().getFrequencyRatio(),2) + 0.25) + 0.5)){ Double ssyValue = this.Synchrotron(); this.ordEmissivityIndex = ssyValue; this.extraordEmissivityIndex = ssyValue; } } else { Double ssyValue = this.Synchrotron(); this.ordEmissivityIndex = ssyValue; this.extraordEmissivityIndex = ssyValue; } } } protected Double GyroSincrotron(){ Double beta = Math.sqrt(gamma*gamma-1)/gamma; Double ffc = getFrequencyHarmonic() * 2. / 3. / sin / gamma / gamma; if(ffc >= 20){ return 0.; } else { Double ordS = (getFrequencyHarmonic() * gamma * (1 - this.refraction * beta * cos) +1); Double extraordS = (getFrequencyHarmonic() * gamma * (1 + this.refraction * beta * cos)); Double sum = 0.; for(Double i=Math.floor(ordS); i<=Math.floor(extraordS); i++){ Double cosPhi = (1 -i/getFrequencyHarmonic()/gamma) / beta / cos / this.refraction; Double sinPhi = Math.sqrt(1 -Math.pow(cosPhi, 2)); Double xs = i * this.refraction * beta * sin * sinPhi / (1 -this.refraction * beta * cos * cosPhi); Double xstr; if(getFrequencyHarmonic() > 50){ xstr = 0.8; if(gamma > 5) xstr = 0.9; if(gamma > 10) xstr = 0.95; if(gamma > 15) xstr = 0.96; if(xs < (xstr*i)) { continue; } } if(getFrequencyHarmonic() > 250){ xstr = 0.9; if(gamma > 5) xstr = 0.92; if(gamma > 10) xstr = 0.97; if(gamma > 15) xstr = 0.98; if(xs < (xstr*i)){ continue; } } Double bessel = MathUtils.Bessel(i.intValue(), xs); Double besselPr = MathUtils.BesselPr(i.intValue(), xs); Double f = Math.pow((-beta * sinPhi * besselPr + polarization * (cos / sin / refraction - beta * cosPhi / sin)*bessel),2); Double oldSum = sum; sum = sum + f; if(oldSum >0) if( ((sum-oldSum)/oldSum) < (1e-4)){ break; } } return sum / beta / 2 / cos * getFrequencyHarmonic() / (1 + Math.pow(polarization,2)); } } protected Double Synchrotron(){ Double f =0.; Double ffc = getFrequencyHarmonic()*2 / 3 / sin / gamma / gamma * Math.pow((1 + 9 / 4 * (Math.pow(gamma, 2) -1) / Math.pow(getEnviroment().getRazinParameter(), 2) / Math.pow(getFrequencyHarmonic(), 2)), 1.5); if(ffc <= Constants.SSY_XD[0]){ f = 2.15*ffc*0.333*(1-0.844*ffc*0.666); } else if(ffc > Constants.SSY_XD[33]){ f = 1.253 * Math.exp(-ffc) * Math.sqrt(ffc) * (1 + 55/72/ffc); } else { f = this.Sear(ffc); } return (0.138 * sin * f) / 2; } protected Double Sear(Double ffc){ int i=0; while(i < Constants.SSY_XD.length){ if(Constants.SSY_XD[i] >= ffc) return (Constants.SSY_FD[i] * (ffc-Constants.SSY_XD[i-1]) + Constants.SSY_FD[i-1] * (Constants.SSY_XD[i] - ffc)) / (Constants.SSY_XD[i]-Constants.SSY_XD[i-1]); i++; } return 0.; } protected Double getOrdEmissivityIndex() { return this.ordEmissivityIndex; } protected Double getExtraordEmissivityIndex() { return this.extraordEmissivityIndex; } protected Double getRefraction(){ return this.refraction; } } protected class Stokes { protected Double Q,V; protected Stokes(Double phiOrd, Double phiExtraord){ this.Q = this.Q(phiOrd, phiExtraord); this.V = this.V(phiOrd, phiExtraord); } public Double Q(Double phiOrd, Double phiExtraord){ return (phiOrd * (1 - Math.pow(getRefractionPolarization().getOrdPolarizationCoefficient(),2)) / (1 + Math.pow(getRefractionPolarization().getOrdPolarizationCoefficient(),2))) + (phiExtraord * (1 - Math.pow(getRefractionPolarization().getExtraordPolarizationCoefficient(),2)) / (1 + Math.pow(getRefractionPolarization().getExtraordPolarizationCoefficient(),2))); } public Double V(Double phiOrd, Double phiExtraord){ return 2 * (phiOrd * getRefractionPolarization().getOrdPolarizationCoefficient() / (1 + Math.pow(getRefractionPolarization().getOrdPolarizationCoefficient(), 2))) + (phiExtraord * getRefractionPolarization().getExtraordPolarizationCoefficient() / (1 + Math.pow(getRefractionPolarization().getExtraordPolarizationCoefficient(), 2))); } public Double getQ() { return Q; } public Double getV() { return V; } } protected class Fluxes { protected Double FluxPolarization(Double phiTotal, Double phiOrd, Double phiExtraord){ return (phiTotal > 0) ? (phiExtraord-phiOrd) / phiTotal : 0.; } protected Double Phi(Double emissivity, Double absorption, Double sourceHeight, Double sourceVolume, Double sourceOmega){ Double phi; Double arg = absorption * sourceHeight; if(arg < 1e-3){ phi = emissivity * sourceVolume / Math.pow(Constants.UA, 2); } else { phi = sourceOmega * emissivity / absorption * (1 - Math.exp(-arg)); } return phi; } } } }
[ "bruno.faganello.neto@gmail.com" ]
bruno.faganello.neto@gmail.com
5886797a8ecf02178a7c337e3cfa3c8fc0d1d519
f163fe225b9c5db1f3373c4fc85a1c4f15dd7ffd
/src/main/java/com/bambidating/model/responseModel/enums/ClientResponseUserStatus.java
2a82c8fe4e4ab2b60d64b1cb8e05b36a793ddeb5
[]
no_license
sarenos/bambidating
4668481fe560422b1b89d21a4d3cbecb6716d808
88b5e8073e77e7d869e0d487b494db09df2b8575
refs/heads/master
2021-05-08T18:34:05.063098
2018-01-30T13:55:00
2018-01-30T13:55:01
119,522,594
0
0
null
null
null
null
UTF-8
Java
false
false
375
java
package com.bambidating.model.responseModel.enums; public enum ClientResponseUserStatus { NO_ERROR(0), USER_LOGGED(1), USER_NOT_FOUND(2), WRONG_PASSWORD(3), EMAIL_USED(4); private int userStatus; ClientResponseUserStatus(int userStatus) { this.userStatus = userStatus; } public int value() { return userStatus; } }
[ "eugene_oleynyak@epam.com" ]
eugene_oleynyak@epam.com
4eefce1221c85d77369fb150ddfa03352e8187c7
9cb4496a42ec549b9f15caff64aa1129bbe84ec1
/src/main/java/com/udacity/jwdnd/course1/cloudstorage/config/SecurityConfig.java
1fd8b51011b43aa258a952c0c974a501ea290a64
[]
no_license
voduro/cloudstorage
00576d542d7420f5c17f95c075532467a6327cec
3a48153276bee8fc65cdef20e246d44f726d7eee
refs/heads/master
2022-12-20T01:09:12.809909
2020-09-17T07:30:21
2020-09-17T07:30:21
288,982,209
0
1
null
null
null
null
UTF-8
Java
false
false
1,773
java
package com.udacity.jwdnd.course1.cloudstorage.config; import com.udacity.jwdnd.course1.cloudstorage.service.AuthenticationService; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler; @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { private AuthenticationService authenticationService; //Constructor public SecurityConfig(AuthenticationService authenticationService){ this.authenticationService = authenticationService; } @Override protected void configure(AuthenticationManagerBuilder auth) { auth.authenticationProvider(this.authenticationService); } @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/signup", "/css/**", "/js/**").permitAll() .antMatchers("/home", "/result").authenticated() .anyRequest().authenticated(); http.formLogin() .loginPage("/login") .permitAll(); http.formLogin() .defaultSuccessUrl("/home", true); http.logout(logout -> logout .logoutUrl("/logout") .addLogoutHandler(new SecurityContextLogoutHandler()) ); } }
[ "info@villome.com" ]
info@villome.com
8c999fecce88d4586aab2a2b1b3c9f02e09e86fe
1f096eeb888fa8ce6378792f2d2a10a3ec7a325a
/src/com/chaoxing/oa/util/data/ClobUtil.java
1cf74375cb1e1c96bcc25fc7f6086e04fd2ff542
[]
no_license
xixily/cxoa_websocket
8f2d0792711b28319c66be0ec8a0ace780cab82c
18c5d6c55de1b69a056a1a37f7c1d00fa3e31a9d
refs/heads/master
2020-12-31T00:12:17.649663
2017-08-11T05:33:26
2017-08-11T05:33:26
86,549,798
4
1
null
null
null
null
UTF-8
Java
false
false
1,227
java
package com.chaoxing.oa.util.data; import java.io.BufferedReader; import java.io.IOException; import java.sql.Clob; import java.sql.SQLException; import javax.sql.rowset.serial.SerialClob; import javax.sql.rowset.serial.SerialException; public class ClobUtil { /** * 获得字符串 * * @param c * java.sql.Clob * @return 字符串 */ public static String getString(Clob c) { StringBuffer s = new StringBuffer(); if (c != null) { try { BufferedReader bufferRead = new BufferedReader(c.getCharacterStream()); try { String str; while ((str = bufferRead.readLine()) != null) { s.append(str); } } catch (IOException e) { e.printStackTrace(); } } catch (SQLException e) { e.printStackTrace(); } } return s.toString(); } /** * 获得Clob * * @param s * 字符串 * @return java.sql.Clob */ public static Clob getClob(String s) { Clob c = null; try { if (s != null) { c = new SerialClob(s.toCharArray()); } } catch (SerialException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } return c; } }
[ "570341093@qq.com" ]
570341093@qq.com
95734d86b09a3101d3acad3d0f423e763bfe636f
9cf074aa4973b0b70f38d4fcd111dd3eed7a9bad
/shopping/src/main/java/com/app/server/repository/aaaboundedcontext/authorization/AppMenusRepository.java
2956fba489365b666eefce494c92e75d707107be
[]
no_license
applifireAlgo/shoppingtwo
deb59b2190751880d68e63abb733d5d19522584e
d646ffc2ad3bb1c0051cd62f80cdd7534b27428f
refs/heads/master
2021-01-10T13:56:26.293467
2016-03-31T14:19:01
2016-03-31T14:19:01
55,156,196
0
0
null
null
null
null
UTF-8
Java
false
false
1,304
java
package com.app.server.repository.aaaboundedcontext.authorization; import com.athena.server.repository.SearchInterface; import com.athena.annotation.Complexity; import com.athena.annotation.SourceCodeAuthorClass; import com.athena.framework.server.exception.repository.SpartanPersistenceException; import java.util.List; import com.athena.framework.server.exception.biz.SpartanConstraintViolationException; @SourceCodeAuthorClass(createdBy = "q@yc.com", updatedBy = "", versionNumber = "1", comments = "Repository for AppMenus Master table Entity", complexity = Complexity.LOW) public interface AppMenusRepository<T> extends SearchInterface { public List<T> findAll() throws SpartanPersistenceException; public T save(T entity) throws SpartanPersistenceException, SpartanConstraintViolationException; public List<T> save(List<T> entity) throws SpartanPersistenceException, SpartanConstraintViolationException; public void delete(String id) throws SpartanPersistenceException; public void update(T entity) throws SpartanPersistenceException, SpartanConstraintViolationException; public void update(List<T> entity) throws SpartanPersistenceException, SpartanConstraintViolationException; public T findById(String menuId) throws Exception, SpartanPersistenceException; }
[ "applifire@72e4844fff71" ]
applifire@72e4844fff71
1c853e30ca8aee7ac7d14714f10859988a3e4e67
573a66e4f4753cc0f145de8d60340b4dd6206607
/JS-CS-Detection-byExample/Dataset (ALERT 5 GB)/1438167/pmd-src-4.0/pmd-4.0/src/net/sourceforge/pmd/AbstractRule.java
5201d6e34610fa0b787a04102a63e31b725922b4
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
mkaouer/Code-Smells-Detection-in-JavaScript
3919ec0d445637a7f7c5f570c724082d42248e1b
7130351703e19347884f95ce6d6ab1fb4f5cfbff
refs/heads/master
2023-03-09T18:04:26.971934
2022-03-23T22:04:28
2022-03-23T22:04:28
73,915,037
8
3
null
2023-02-28T23:00:07
2016-11-16T11:47:44
null
UTF-8
Java
false
false
15,002
java
/** * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ package net.sourceforge.pmd; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; import net.sourceforge.pmd.ast.ASTClassOrInterfaceDeclaration; import net.sourceforge.pmd.ast.ASTCompilationUnit; import net.sourceforge.pmd.ast.ASTImportDeclaration; import net.sourceforge.pmd.ast.JavaParserVisitorAdapter; import net.sourceforge.pmd.ast.Node; import net.sourceforge.pmd.ast.SimpleNode; public abstract class AbstractRule extends JavaParserVisitorAdapter implements Rule { private String name = getClass().getName(); private Properties properties = new Properties(); // TODO - remove when ready private String message; private String description; private List<String> examples = new ArrayList<String>(); private String ruleSetName; private boolean include; private boolean usesDFA; private boolean usesTypeResolution; private int priority = LOWEST_PRIORITY; private String externalInfoUrl; private List<String> ruleChainVisits = new ArrayList<String>(); private static final boolean inOldPropertyMode = true; // temporary flag during conversion protected static Map<String, PropertyDescriptor> asFixedMap(PropertyDescriptor[] descriptors) { Map<String, PropertyDescriptor> descsById = new HashMap<String, PropertyDescriptor>(descriptors.length); for (PropertyDescriptor descriptor : descriptors) { descsById.put(descriptor.name(), descriptor); } return Collections.unmodifiableMap(descsById); } protected static Map<String, PropertyDescriptor> asFixedMap(PropertyDescriptor descriptor) { return asFixedMap(new PropertyDescriptor[] {descriptor}); } public String getRuleSetName() { return ruleSetName; } public void setRuleSetName(String ruleSetName) { this.ruleSetName = ruleSetName; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public List<String> getExamples() { return examples; } /** * Still used by the JDeveloper plugin * * @deprecated use getExamples(), since we now support multiple examples */ public String getExample() { if (examples.isEmpty()) { return null; } else { //We return the last example, so the override still works return examples.get(examples.size()-1); } } public void addExample(String example) { examples.add(example); } /** * @deprecated - property values will be guaranteed available via default values */ public boolean hasProperty(String name) { return inOldPropertyMode ? // TODO -remove properties.containsKey(name) : propertiesByName().containsKey(name); } /** * @deprecated */ public void addProperty(String name, String value) { properties.setProperty(name, value); } /** * @deprecated */ public void addProperties(Properties properties) { this.properties.putAll(properties); } public double[] getDoubleProperties(PropertyDescriptor descriptor) { Number[] values = (Number[])getProperties(descriptor); double[] doubles = new double[values.length]; for (int i=0; i<doubles.length; i++) doubles[i] = values[i].doubleValue(); return doubles; } /** * @deprecated - use getDoubleProperty(PropertyDescriptor) instead */ public double getDoubleProperty(String name) { return Double.parseDouble(properties.getProperty(name)); } public double getDoubleProperty(PropertyDescriptor descriptor) { return ((Number)getProperty(descriptor)).doubleValue(); } public int[] getIntProperties(PropertyDescriptor descriptor) { Number[] values = (Number[])getProperties(descriptor); int[] ints = new int[values.length]; for (int i=0; i<ints.length; i++) ints[i] = values[i].intValue(); return ints; } /** * @deprecated - use getIntProperty(PropertyDescriptor) instead */ public int getIntProperty(String name) { return Integer.parseInt(properties.getProperty(name)); } public int getIntProperty(PropertyDescriptor descriptor) { return ((Number)getProperty(descriptor)).intValue(); } public Class[] getTypeProperties(PropertyDescriptor descriptor) { return (Class[])getProperties(descriptor); } public Class getTypeProperty(PropertyDescriptor descriptor) { return (Class)getProperty(descriptor); } public boolean[] getBooleanProperties(PropertyDescriptor descriptor) { Boolean[] values = (Boolean[])getProperties(descriptor); boolean[] bools = new boolean[values.length]; for (int i=0; i<bools.length; i++) bools[i] = values[i].booleanValue(); return bools; } public boolean getBooleanProperty(PropertyDescriptor descriptor) { return ((Boolean)getProperty(descriptor)).booleanValue(); } /** * @deprecated - use getBooleanProperty(PropertyDescriptor) instead */ public boolean getBooleanProperty(String name) { return Boolean.parseBoolean(properties.getProperty(name)); } /** * @deprecated - use setProperty(PropertyDescriptor, Object) instead * * @param name * @param flag */ public void setBooleanProperty(String name, boolean flag) { properties.setProperty(name, Boolean.toString(flag)); } public String[] getStringProperties(PropertyDescriptor descriptor) { return (String[])getProperties(descriptor); } /** * @deprecated - use getStringProperty(PropertyDescriptor) instead */ public String getStringProperty(String name) { return properties.getProperty(name); } public String getStringProperty(PropertyDescriptor descriptor) { return (String)getProperty(descriptor); } private Object getProperty(PropertyDescriptor descriptor) { if (descriptor.maxValueCount() > 1) propertyGetError(descriptor, true); String rawValue = properties.getProperty(descriptor.name()); return rawValue == null || rawValue.length() == 0 ? descriptor.defaultValue() : descriptor.valueFrom(rawValue); } public void setProperty(PropertyDescriptor descriptor, Object value) { if (descriptor.maxValueCount() > 1) propertySetError(descriptor, true); properties.setProperty(descriptor.name(), descriptor.asDelimitedString(value)); } private Object[] getProperties(PropertyDescriptor descriptor) { if (descriptor.maxValueCount() == 1) propertyGetError(descriptor, false); String rawValue = properties.getProperty(descriptor.name()); return rawValue == null || rawValue.length() == 0 ? (Object[])descriptor.defaultValue() : (Object[])descriptor.valueFrom(rawValue); } public void setProperties(PropertyDescriptor descriptor, Object[] values) { if (descriptor.maxValueCount() == 1) propertySetError(descriptor, false); properties.setProperty(descriptor.name(), descriptor.asDelimitedString(values)); } private void propertyGetError(PropertyDescriptor descriptor, boolean requestedSingleValue) { if (requestedSingleValue) { throw new RuntimeException("Cannot retrieve a single value from a multi-value property field"); } throw new RuntimeException("Cannot retrieve multiple values from a single-value property field"); } private void propertySetError(PropertyDescriptor descriptor, boolean setSingleValue) { if (setSingleValue) { throw new RuntimeException("Cannot set a single value within a multi-value property field"); } throw new RuntimeException("Cannot set multiple values within a single-value property field"); } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getExternalInfoUrl() { return externalInfoUrl; } public void setExternalInfoUrl(String url) { this.externalInfoUrl = url; } /** * Test if rules are equals. Rules are equals if * 1. they have the same implementation class * 2. they have the same name * 3. they have the same priority * 4. they share the same properties/values */ public boolean equals(Object o) { if (o == null) { return false; // trivial } if (this == o) { return true; // trivial } Rule rule = null; boolean equality = this.getClass().getName().equals(o.getClass().getName()); if (equality) { rule = (Rule) o; equality = this.getName().equals(rule.getName()) && this.getPriority() == rule.getPriority() && this.getProperties().equals(rule.getProperties()); } return equality; } /** * Return a hash code to conform to equality. Try with a string. */ public int hashCode() { String s = getClass().getName() + getName() + getPriority() + getProperties().toString(); return s.hashCode(); } public void apply(List acus, RuleContext ctx) { visitAll(acus, ctx); } /** * @deprecated - retrieve by name using get<type>Property or get<type>Properties */ public Properties getProperties() { return properties; } public boolean include() { return include; } public void setInclude(boolean include) { this.include = include; } public int getPriority() { return priority; } public String getPriorityName() { return PRIORITIES[getPriority() - 1]; } public void setPriority(int priority) { this.priority = priority; } public void setUsesDFA() { this.usesDFA = true; } public boolean usesDFA() { return this.usesDFA; } public void setUsesTypeResolution() { this.usesTypeResolution = true; } public boolean usesTypeResolution() { return this.usesTypeResolution; } protected void visitAll(List acus, RuleContext ctx) { for (Iterator i = acus.iterator(); i.hasNext();) { ASTCompilationUnit node = (ASTCompilationUnit) i.next(); visit(node, ctx); } } /** * Adds a violation to the report. * * @param ctx the RuleContext * @param node the node that produces the violation */ protected final void addViolation(Object data, SimpleNode node) { RuleContext ctx = (RuleContext) data; ctx.getReport().addRuleViolation(new RuleViolation(this, ctx, node)); } /** * Adds a violation to the report. * * @param ctx the RuleContext * @param node the node that produces the violation * @param msg specific message to put in the report */ protected final void addViolationWithMessage(Object data, SimpleNode node, String msg) { RuleContext ctx = (RuleContext) data; ctx.getReport().addRuleViolation(new RuleViolation(this, ctx, node, msg)); } /** * Adds a violation to the report. * * @param ctx the RuleContext * @param node the node that produces the violation * @param embed a variable to embed in the rule violation message */ protected final void addViolation(Object data, SimpleNode node, String embed) { RuleContext ctx = (RuleContext) data; ctx.getReport().addRuleViolation(new RuleViolation(this, ctx, node, MessageFormat.format(getMessage(), embed))); } /** * Adds a violation to the report. * * @param ctx the RuleContext * @param node the node that produces the violation, may be null, in which case all line and column info will be set to zero * @param args objects to embed in the rule violation message */ protected final void addViolation(Object data, Node node, Object[] args) { RuleContext ctx = (RuleContext) data; ctx.getReport().addRuleViolation(new RuleViolation(this, ctx, (SimpleNode) node, MessageFormat.format(getMessage(), args))); } /** * Gets the Image of the first parent node of type ASTClassOrInterfaceDeclaration or <code>null</code> * * @param node the node which will be searched */ protected final String getDeclaringType(SimpleNode node) { ASTClassOrInterfaceDeclaration c = node.getFirstParentOfType(ASTClassOrInterfaceDeclaration.class); if (c != null) return c.getImage(); return null; } public static boolean isQualifiedName(SimpleNode node) { return node.getImage().indexOf('.') != -1; } public static boolean importsPackage(ASTCompilationUnit node, String packageName) { List<ASTImportDeclaration> nodes = node.findChildrenOfType(ASTImportDeclaration.class); for (ASTImportDeclaration n: nodes) { if (n.getPackageName().startsWith(packageName)) { return true; } } return false; } /** * Return all the relevant properties for the receiver by * overriding in subclasses as necessary. * * @return Map */ protected Map<String, PropertyDescriptor> propertiesByName() { return Collections.emptyMap(); } /** * Return the indicated property descriptor or null if not found. * * @param propertyName String * @return PropertyDescriptor */ public PropertyDescriptor propertyDescriptorFor(String propertyName) { PropertyDescriptor desc = propertiesByName().get(propertyName); if (desc == null) throw new IllegalArgumentException("unknown property: " + propertyName); return desc; } public boolean usesRuleChain() { return !getRuleChainVisits().isEmpty(); } public List<String> getRuleChainVisits() { return ruleChainVisits; } public void addRuleChainVisit(String astNodeName) { if (!ruleChainVisits.contains(astNodeName)) { ruleChainVisits.add(astNodeName); } } }
[ "mmkaouer@umich.edu" ]
mmkaouer@umich.edu
7caa09af8772dfb5bbf9a971a84d26bd4f347c66
5e257b17045ff2146d2b39a319dccbe6c4226518
/src/main/java/it/comuni/comuniitaliani/model/Zona.java
a458b9be14456c2bb5e97f97498ca57041de518c
[]
no_license
hawk87/comuni-italiani
d2a823a6bbc5199fcb0b360f1a880e8191062ae8
9b4f06f516476907b5a98aa1c40b1ad30b8fb95c
refs/heads/master
2020-04-26T13:27:14.680399
2019-03-03T14:59:56
2019-03-03T14:59:56
130,211,246
0
0
null
null
null
null
UTF-8
Java
false
false
328
java
package it.comuni.comuniitaliani.model; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.Entity; import javax.persistence.Id; @Data @Entity @NoArgsConstructor @AllArgsConstructor public class Zona { @Id private Integer codice; private String nome; }
[ "tidus.rm@libero.it" ]
tidus.rm@libero.it
99cf9b80b3fcad5ae6ac3960fc4b7be9ce049a10
5ce9373b55b64c17932f893fe44bc2efd3f48ed2
/src/main/java/com/faisalarkan/config/Dbconf.java
402cf5c91f89603026e633bd970b43556f5016e8
[]
no_license
faisalarkan21/java-servlet-maven-jdbc
2a3902f5a20cbb420e8c192b0a321f779c49a3d0
125a96fab6f54972249145bf16e0bd790086bb21
refs/heads/master
2021-01-13T14:50:26.206307
2016-12-15T12:45:21
2016-12-15T12:45:21
76,558,528
0
0
null
null
null
null
UTF-8
Java
false
false
898
java
package com.faisalarkan.config; import java.io.InputStream; import java.sql.DriverManager; import java.util.Properties; import java.sql.Connection; public class Dbconf { private static Connection connection = null; public static Connection getConnection (){ if (connection != null){ return connection; }else{ try { Properties prop = new Properties (); InputStream fileProperties = Dbconf.class.getClassLoader().getResourceAsStream("/db.properties"); prop.load(fileProperties); String driver = prop.getProperty("driver"); String url = prop.getProperty("url"); String user = prop.getProperty("user"); String pass = prop.getProperty("password"); Class.forName(driver); connection = DriverManager.getConnection(url, user, pass); }catch (Exception e){ } return connection; } } }
[ "faisalarkan21@gmail.com" ]
faisalarkan21@gmail.com
d2e30d85cf4a1774874575a85aa59d3eee6af089
eb2556a43cc0a8d1c525fb21bb00d5a6158da4ad
/basex-tests/src/test/java/org/basex/server/ServerMemTest.java
6ad60fd336ed8d24dad588a6f52230318f18dd0d
[ "BSD-3-Clause" ]
permissive
SirOlrac/basex
ee22c8336f2430ae38e962399f1cdc89c9a657d3
b97a3bbf961178d0c3dc8c65d389c8299fc5d517
refs/heads/master
2020-06-13T20:08:21.217244
2016-12-02T21:48:49
2016-12-02T21:48:49
75,557,973
1
0
null
2016-12-04T19:08:45
2016-12-04T19:08:45
null
UTF-8
Java
false
false
1,774
java
package org.basex.server; import org.basex.*; import org.basex.api.client.*; import org.junit.*; /** * This class performs a client/server memory stress tests with a specified * number of threads and queries. * * @author BaseX Team 2005-16, BSD License * @author Christian Gruen */ public final class ServerMemTest extends SandboxTest { /** Query to be run. */ private static final String QUERY = "(for $i in 1 to 50000 order by $i return $i)[1]"; /** Server reference. */ BaseXServer server; /** * Runs the test. * @throws Exception exception */ @Test public void clients10() throws Exception { run(10); } /** * Runs the test. * @throws Exception exception */ @Test public void clients100() throws Exception { run(100); } /** * Runs the stress test. * @param clients number of clients * @throws Exception exception */ private void run(final int clients) throws Exception { //run server instance server = createServer(); // run clients final Client[] cl = new Client[clients]; for(int i = 0; i < clients; ++i) cl[i] = new Client(); for(final Client c : cl) c.start(); for(final Client c : cl) c.join(); // stop server stopServer(server); } /** Single client. */ static final class Client extends Thread { /** Client session. */ private final ClientSession session; /** * Default constructor. * @throws Exception exception */ Client() throws Exception { session = createClient(); } @Override public void run() { try { // Perform query session.execute("xquery " + QUERY); session.close(); } catch(final Exception ex) { ex.printStackTrace(); } } } }
[ "christian.gruen@gmail.com" ]
christian.gruen@gmail.com
a16ab06c30e0a4812ef66699ac7ed4ed2db9abf4
272085da27702ed419773826cab86af359e76d0a
/app/src/main/java/yu/com/Wifi/wifiway/WebServiceGet.java
4d98bbbf3e869a7aee26824c2b8fb39ae744d1ba
[ "Apache-2.0" ]
permissive
WifiWay0/WifiWay
9576f1918f7d12c1f9703eaa594c186e77313f10
d6e90ef1a29c82b3a3391862eb76c6c80baeb7c5
refs/heads/master
2020-04-13T01:07:01.212748
2018-12-30T10:04:33
2018-12-30T10:04:33
162,864,704
1
0
null
null
null
null
UTF-8
Java
false
false
5,145
java
package yu.com.Wifi.wifiway; import android.os.Looper; import android.util.Log; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLEncoder; import java.util.Map; import yu.com.Wifi.MainInterface; /** * 使用get方法获取Http服务器数据 */ public class WebServiceGet { public static String executeHttpGet(String username, String password, String address){//用户密码 HttpURLConnection connection = null; InputStream in = null; try{ String Url = "http:/39.108.0.16/Web/" + address; String path = Url + "?username=" + username + "&password=" + password; Log.i("WebServiceGet", "Url="+Url); Log.i("WebServiceGet", "path="+path); try { URL url = new URL(path); connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("GET"); connection.setConnectTimeout(10000);//建立连接超时 connection.setReadTimeout(8000);//传递数据超时 in = connection.getInputStream(); return parseInfo(in); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }catch (Exception e){ e.printStackTrace(); }finally { //意外退出时,连接关闭保护 if(connection != null){ connection.disconnect(); } if(in != null){ try{ in.close(); }catch (Exception e){ e.printStackTrace(); } } } return null; } //得到字节输入流,将字节输入流转化为String类型 public static String parseInfo(InputStream inputStream){ BufferedReader reader = null; String line = ""; StringBuilder response = new StringBuilder(); try { reader = new BufferedReader(new InputStreamReader(inputStream)); while((line = reader.readLine()) != null){ response.append(line); } Log.e("WebServiceGet", "response="+response.toString()); return response.toString(); }catch (Exception e){ e.printStackTrace(); }finally { if(reader != null){ try{ reader.close(); }catch (Exception e){ e.printStackTrace(); } } } return null; } public static String appexecuteHttpGet(String appmessage,String address){//APP数据 HttpURLConnection connection = null; InputStream in = null; String netType; switch (Login.networkState) { case 0:netType="null Internet";break; case 1:netType="wifi";Login.operatorName=Login.SSID;break; case 2:netType="2G";break; case 3:netType="3G";break; case 4:netType="4G";break; case 5:netType="traffic";break; default:netType="null"; } try{ String Url = "http://39.108.0.16/Web/" + address; String path; if(Login.user!=null){ String time = Time.TimeOut(); String location = MainInterface.loc; path = Url + "?user=" + URLEncoder.encode(Login.user, "UTF-8") +"&time=" + URLEncoder.encode(time, "UTF-8") +"&location=" + URLEncoder.encode(location, "UTF-8")+"&netType=" + URLEncoder.encode(netType, "UTF-8")+"&netmessage=" + URLEncoder.encode(Login.operatorName, "UTF-8") +"&appmessage=" + URLEncoder.encode(appmessage, "UTF-8") ; }else return null; Log.e("WebServiceGet", "Url="+Url); Log.e("WebServiceGet", "path="+path); try { URL url = new URL(path); connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("GET"); connection.setConnectTimeout(10000);//建立连接超时 connection.setReadTimeout(8000);//传递数据超时 in = connection.getInputStream(); //return parseInfo(in); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }catch (Exception e){ e.printStackTrace(); }finally { //意外退出时,连接关闭保护 if(connection != null){ connection.disconnect(); } if(in != null){ try{ in.close(); }catch (Exception e){ e.printStackTrace(); } } } return null; } }
[ "durey@foxmail.com" ]
durey@foxmail.com
9d84b85a2e3f3079786756acca165b8673162ea9
bae27f50e9b123dcfaad48f4a71ed65c514f3bd9
/app/src/main/java/com/szmy/pigapp/adapter/AgentAdapter.java
ce790ea4bc88b07c8087e4359f48d3c17e713fac
[]
no_license
amyleedev/PigApp
8d0e69f8936981d6781bc0998eb99f6ebb77151e
af27a64eae4657290d32bf6afd8b794ba55f867e
refs/heads/master
2021-01-21T10:13:52.726516
2017-08-31T09:01:26
2017-08-31T09:01:26
101,974,701
1
0
null
null
null
null
UTF-8
Java
false
false
3,918
java
package com.szmy.pigapp.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.ImageView; import android.widget.TextView; import com.szmy.pigapp.R; import com.szmy.pigapp.entity.AgentEntry; import com.szmy.pigapp.utils.AppStaticUtil; import com.szmy.pigapp.utils.UrlEntry; import java.util.List; public class AgentAdapter extends BaseAdapter { private List<AgentEntry> list; private LayoutInflater mInflater; private Context ctx; public AgentAdapter(Context ctx, List<AgentEntry> list) { this.ctx = ctx; mInflater = LayoutInflater.from(ctx); this.list = list; } @Override public int getCount() { return list.size(); } @Override public AgentEntry getItem(int arg0) { return list.get(arg0); } @Override public long getItemId(int arg0) { return arg0; } @Override public View getView(int arg0, View convertView, ViewGroup arg2) { if (convertView == null) { convertView = mInflater.inflate(R.layout.item_broker, null); new ViewHolder(convertView); } final ViewHolder holder = (ViewHolder) convertView.getTag(); final AgentEntry entry = getItem(arg0); // holder.tvName.setText(entry.getRealName()); // holder.tvBusiness.setText(entry.getBusiness()); // holder.tvIntro.setText(entry.getIntro()); // holder.tvCompanyName.setText(entry.getCompanyName()); // String str = entry.getPhone(); // if(str.length()>=11){ // str = str.substring(0, 11); // holder.tvPhone.setText(str.substring(0,str.length()-(str.substring(3)).length())+"****"+str.substring(7)); // }else{ // holder.tvPhone.setText(str.substring(0, str.length())+"***"); // } // holder.tvQQ.setText(entry.getQQ()); // holder.tvAddress.setText(entry.getProvince() + entry.getCity() // + entry.getArea()); if(TextUtils.isEmpty(entry.getRealName())){ holder.name.setText(entry.getCompanyName()); }else { holder.name.setText(entry.getRealName()); } holder.address.setText(entry.getProvince() + " " + entry.getCity() + " " + entry.getArea()); holder.business.setText(entry.getBusiness()); if (entry.getIntro().equals("")) { holder.intro.setText("暂无介绍"); } else { holder.intro.setText(entry.getIntro()); } if (!TextUtils.isEmpty(entry.getPicture())) { com.nostra13.universalimageloader.core.ImageLoader.getInstance() .displayImage(UrlEntry.ip + entry.getPicture(), holder.picture, AppStaticUtil.getOptions()); } else { holder.picture.setImageResource(R.drawable.photo); } return convertView; } private class ViewHolder { TextView tvName; // TextView tvType; TextView tvStar; TextView tvBusiness; TextView tvIntro; TextView tvCompanyName; TextView tvPhone; TextView tvQQ; TextView tvAddress; TextView name; TextView address; TextView business; TextView intro; ImageView picture; public ViewHolder(View view) { // tvName = (TextView) view.findViewById(R.id.tv_name); // // tvType = (TextView) view.findViewById(R.id.tv_type); // tvStar = (TextView) view.findViewById(R.id.tv_star); // tvBusiness = (TextView) view.findViewById(R.id.tv_business); // tvIntro = (TextView) view.findViewById(R.id.tv_intro); // tvCompanyName = (TextView) // view.findViewById(R.id.tv_company_name); // tvPhone = (TextView) view.findViewById(R.id.tv_phone); // tvQQ = (TextView) view.findViewById(R.id.tv_qq); // tvAddress = (TextView) view.findViewById(R.id.tv_address); name = (TextView) view.findViewById(R.id.broker_name); address = (TextView) view.findViewById(R.id.broker_address); business = (TextView) view.findViewById(R.id.broker_business); intro = (TextView) view.findViewById(R.id.broker_intro); picture = (ImageView) view.findViewById(R.id.imageview_broker); view.setTag(this); } } }
[ "qing210qing@sina.com" ]
qing210qing@sina.com
1ce296ded1d5a2d463bde55f2ead11837a6d6b3c
017b6dd7d3a526ff1664c3f5734d7943c4a30815
/src/main/java/com/bfsi/mfi/dao/AgentValidationDao.java
34314729e76401be96fbc5f3a0d7d9885cafb351
[ "Apache-2.0" ]
permissive
ltphan/egalite-web-service
bfa3418cfecc750303a73c1234dbd237119bc3b1
8f47a544b5508a490ef18d45b62621857915c156
refs/heads/develop
2021-01-22T00:30:01.371799
2016-08-07T18:14:00
2016-08-07T18:14:00
63,091,292
0
0
null
2016-07-11T18:15:18
2016-07-11T18:15:17
null
UTF-8
Java
false
false
254
java
package com.bfsi.mfi.dao; import com.bfsi.mfi.entity.AgentValidationServiceRequest; /** * * @author Shabu * */ //EGA-MN15-000017 public interface AgentValidationDao { public String checkAgentValidity(AgentValidationServiceRequest p_request); }
[ "mgeiss@mifos.org" ]
mgeiss@mifos.org
ad504794c05f145618b2be1585e1c22e100bc739
e936cfc81c23f1c6e9891bdbd76518b15fe9710c
/src/main/java/mine/algo/company/box/onsite/db/facade/Transaction.java
64cc696dc1de7703fab31830a6e9ece1a7ea6aff
[]
no_license
pratapmn/Concepts
6f14c59057760f28eb0d062114e85035d66c0bbf
8cdeb85e8d05537e65b4ae8d772a2462e6253beb
refs/heads/master
2020-12-29T03:35:50.423578
2016-05-11T23:22:21
2016-05-11T23:22:21
55,474,772
0
0
null
null
null
null
UTF-8
Java
false
false
349
java
package mine.algo.company.box.onsite.db.facade; import mine.algo.company.box.onsite.db.InMemDB.DB; /** * Created by pratapn on 4/27/16. */ public abstract class Transaction implements Operation{ public Transaction(DB db){ if(!db.tStack.empty()){ db.tStack.push(this); } } public Transaction(){ } }
[ "pratapn@yahoo-inc.com" ]
pratapn@yahoo-inc.com
1f75cdf59be57c6cab550e294de6652c15917339
3f5decde0d2c5eea282f64ca05efb72c7cb3060f
/src/Arrays/GeneralizandoArrays/Vetor.java
3997f4f72e39554d8cfce1e6c086ac9896fbde43
[]
no_license
danilosilvadev/EstudosEstruturadeDados
b6a1e4669ce6162bdc094a97d017e62bb86311db
c231dd96215498429a1a4a74b9539ed172fa5e59
refs/heads/master
2021-01-11T17:00:49.100701
2016-10-05T14:08:17
2016-10-05T14:08:17
68,827,477
2
0
null
null
null
null
UTF-8
Java
false
false
2,346
java
package Arrays.GeneralizandoArrays; /** * Created by sg-0036936 on 20/09/2016. */ public class Vetor { private Object[] elementos; private int tamanho; public Vetor(int capacidade) { this.elementos = new Object[capacidade]; this.tamanho = 0; } public boolean adiciona(Object elemento) { if (this.tamanho < this.elementos.length) { this.elementos[this.tamanho] = elemento; this.tamanho++; return true; } else { return false; } } //Método overload que move os itens do array para a posição seguinte abrindo espaço public boolean adiciona(int posicao, Object elemento) { if (!(posicao >= 0 && posicao < tamanho)) { throw new IllegalArgumentException("Posição inválida"); } this.aumentaCapacidade(); //mover todos os elementos for (int i = this.tamanho - 1; i >= posicao; i--) { this.elementos[i + 1] = this.elementos[i]; } this.elementos[posicao] = elemento; this.tamanho++; return true; } //Aumentar a capacidade de um array private void aumentaCapacidade() { if (this.tamanho == this.elementos.length) { Object[] elementosNovos = new Object[this.elementos.length * 2]; for (int i = 0; i < this.elementos.length; i++) { elementosNovos[i] = this.elementos[i]; } this.elementos = elementosNovos; } } //Bloco que busca elemento sem saber a posição public int busca(Object elemento) { for (int i = 0; i < this.tamanho; i++) { if (this.elementos[i].equals(elemento)) { return i; } } return -1; } //Esse método substitui o ponteiro da alocação na memória // criado pelo array pela string correspondente dos elementos. @Override public String toString() { StringBuilder s = new StringBuilder(); s.append("["); for (int i = 0; i < this.tamanho - 1; i++) { s.append(this.elementos[i]); s.append(", "); } if (this.tamanho > 0) { s.append(this.elementos[this.tamanho - 1]); } s.append("]"); return s.toString(); } }
[ "danilosilvaweb@hotmail.com" ]
danilosilvaweb@hotmail.com
066737d70523282f208abe8f07e5ec7a5dc54448
f75bc889ab2cc3937dbf12899a66b86dd28583d1
/basedatabindingcomponents/src/main/java/com/tanveershafeeprottoy/basedatabindingcomponents/bindingadapters/SpinnerBindingAdapters.java
b632deb82a7e9ff27d30dcf18ea4e47fb0e19f2e
[]
no_license
tanveerprottoy/base-databinding-components-android
53cd9ffbcad10c565f8d2e96b690793bd6b6f298
2dce0c9b8c47ba1f04ee0cef467ccc55b475ab16
refs/heads/master
2020-04-07T05:25:29.774129
2019-01-14T17:05:21
2019-01-14T17:05:21
158,096,155
0
0
null
null
null
null
UTF-8
Java
false
false
1,756
java
package com.tanveershafeeprottoy.basedatabindingcomponents.bindingadapters; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import androidx.appcompat.widget.AppCompatSpinner; import androidx.databinding.BindingAdapter; import androidx.databinding.InverseBindingAdapter; import androidx.databinding.InverseBindingListener; /** * @author Tanveer Shafee Prottoy */ public class SpinnerBindingAdapters { @BindingAdapter(value = {"selectedValue", "selectedValueAttrChanged"}, requireAll = false) public static void bindSpinnerData(AppCompatSpinner appCompatSpinner, Object newSelectedValue, InverseBindingListener inverseBindingListener) { appCompatSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if(newSelectedValue != null && newSelectedValue == parent.getSelectedItem()) { return; } inverseBindingListener.onChange(); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); if(newSelectedValue != null) { if(appCompatSpinner.getAdapter() == null) { return; } appCompatSpinner.setSelection(((ArrayAdapter<Object>) appCompatSpinner.getAdapter()).getPosition(newSelectedValue), true); } } @InverseBindingAdapter(attribute = "selectedValue", event = "selectedValueAttrChanged") public static Object retrieveSelectedValue(AppCompatSpinner appCompatSpinner) { return appCompatSpinner.getSelectedItem(); } }
[ "tanvir.shafi@parkkori.com" ]
tanvir.shafi@parkkori.com
defbe9b4bb00fc16437ca7bd51b5bc05ece07616
6252c165657baa6aa605337ebc38dd44b3f694e2
/org.eclipse.epsilon.egl.sync/Scalability-Tests/boiler-To-Generate-900-Files/boiler-To-Generate-900-Files/syncregions-900Files/BoilerActuator1381.java
42f1f8a13d953b06f4ccd16a029792b39ff9db04
[]
no_license
soha500/EglSync
00fc49bcc73f7f7f7fb7641d0561ca2b9a8ea638
55101bc781349bb14fefc178bf3486e2b778aed6
refs/heads/master
2021-06-23T02:55:13.464889
2020-12-11T19:10:01
2020-12-11T19:10:01
139,832,721
0
1
null
2019-05-31T11:34:02
2018-07-05T10:20:00
Java
UTF-8
Java
false
false
263
java
package syncregions; public class BoilerActuator1381 { public execute(int temperatureDifference1381, boolean boilerStatus1381) { //sync _bfpnGUbFEeqXnfGWlV1381, behaviour Half Change - return temperature - targetTemperature; //endSync } }
[ "sultanalmutairi@172.20.10.2" ]
sultanalmutairi@172.20.10.2
e8d2a4528c2985d97314c673b152dc6643a15f05
f5d5fd75dea2437cb96ef24c38d8cefb73b63dba
/gs-spring-boot-complete/src/main/java/hello/WebMvcConfiguration.java
5ba2c3278e3e2ae4a56c47776e41559fb4e78c7f
[]
no_license
fourgates/PandoraTwo
8570d7d47123d82f0ce90c66876a0adea0df91d4
47986d44d2ccdb0e2c0b8b50637349b6041c4c1e
refs/heads/master
2021-01-10T11:40:33.408513
2016-03-12T21:43:17
2016-03-12T21:43:17
53,754,784
0
0
null
null
null
null
UTF-8
Java
false
false
435
java
package hello; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; public class WebMvcConfiguration extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/assets/**").addResourceLocations("classpath:/assets"); } }
[ "Phillip@phillips-mbp.home" ]
Phillip@phillips-mbp.home
d6ee2a019062c46cca3a187ec1444d807ba8b95f
b5a6ed2797fa3eb27cbedc172ac9b6f379b3c17a
/src/main/java/com/mycompany/webapp/controller/Exam01Controller.java
f8caebb0e0617abfb9075aa7d9becfca26031d8a
[]
no_license
angelatto/SpringLegacy_Study
e22d5407f1e59a6646943575a5f13a90f6b856bf
2bdf6e86b24ff00876a8f4d85f20edd5c6bec52e
refs/heads/master
2023-03-15T04:21:02.547775
2021-03-28T10:21:23
2021-03-28T10:21:23
348,289,049
0
0
null
null
null
null
UTF-8
Java
false
false
1,783
java
package com.mycompany.webapp.controller; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import com.mycompany.webapp.dto.Board; @Controller public class Exam01Controller { // 현재 클래스 이름과 똑같이 주기. 로그가 어디서 출력되는지 위치를 알려주는 역할 private static final Logger logger = LoggerFactory.getLogger(Exam01Controller.class); @RequestMapping(value = "/home") public String home() { // 메소드 이름이 로그 레벨이다. logger.error("error 메세지"); logger.warn("warn 메세지"); // error level 일때는 출력이 안됨 logger.info("info 메세지"); // warn level 일때는 출력이 안됨 logger.debug("debug 메세지"); // info level 일때는 출력이 안됨 return "home"; } @RequestMapping(value = "/exam01/boardlist") public String getBoardList(HttpServletRequest request, HttpServletResponse response) { // 요청 내용을 확인 System.out.println("클라이언트 IP: " + request.getRemoteHost()); // 누가 나한테 요청했는지 // data 생성 및 JSP 전달 List<Board> list = new ArrayList<>(); for(int i = 1; i < 10; i++) { Board board = new Board(); board.setBno(i); board.setBtitle("제목" + i); board.setBcontent("내용" + i); board.setBwriter("spring"); list.add(board); } request.setAttribute("list", list); return "exam01/boardlist"; } }
[ "pudri109@gmail.com" ]
pudri109@gmail.com
265930f2f36d7c230400daaa780614bf808c6dc0
40640403951ffee6e65ca4967faddcaac079445c
/Mymvnproj/src/test/java/Yahoo_Prg/MainClass.java
7c44fe2b60d6161241ab91a9f3b003367cd68a16
[]
no_license
batch2991/mar_2020
15de166bf3b5e841876cd202c8f44eefb25012c5
e314cce831af952b18664ddcffa1e369f1f02b7e
refs/heads/master
2023-07-01T15:14:34.771579
2020-06-07T01:55:59
2020-06-07T01:55:59
256,515,115
0
0
null
2021-08-02T17:21:25
2020-04-17T13:46:37
Java
UTF-8
Java
false
false
1,620
java
package Yahoo_Prg; import org.apache.log4j.Logger; import org.openqa.selenium.WebDriver; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeSuite; import com.aventstack.extentreports.ExtentReports; import com.aventstack.extentreports.ExtentTest; import com.aventstack.extentreports.reporter.ExtentHtmlReporter; import com.aventstack.extentreports.reporter.configuration.ChartLocation; import com.aventstack.extentreports.reporter.configuration.Theme; public class MainClass { public static WebDriver driver; public Logger lg =Logger.getLogger("logfile"); public static ExtentHtmlReporter htmlreport; public static ExtentReports ext; public static ExtentTest log; @BeforeSuite public void init() { htmlreport = new ExtentHtmlReporter("d:\\Mar_2020\\yahooreport.html"); ext = new ExtentReports(); ext.attachReporter(htmlreport); ext.setSystemInfo("Host Name", "Venkatgn"); //name of thesystem ext.setSystemInfo("Environment", "Test Env"); ext.setSystemInfo("User Name", "Venkat"); htmlreport.config().setDocumentTitle("Yahoo"); htmlreport.config().setReportName("Yahoo Functional Testing"); htmlreport.config().setTestViewChartLocation(ChartLocation.TOP); htmlreport.config().setTheme(Theme.STANDARD); } @AfterSuite public void save() { ext.flush(); //save the report try { Runtime.getRuntime().exec("taskkill /f /im chromedriver.exe"); Runtime.getRuntime().exec("taskkill /f /im geckodriver.exe"); }catch(Exception e) {} } }
[ "venkatgn@gmail.com" ]
venkatgn@gmail.com
006c9670fe29b6bf448357486d5fb64801be6e4e
9b2f96efbbcb2aed25ef8ff38b426758c64f56bd
/app/src/main/java/cn/edu/gdmec/android/mobileguard/m1home/utils/VersionUpdateUtils.java
456390ef8ae5c396d5c80bcfeeebf32b1b45f8b4
[]
no_license
Hulovepi/MobileGuard
4b51a079b908a0dd62a249a2b0429facbf536b8a
435287037efd826c9069cc1bbe5d7a330b7c5577
refs/heads/master
2021-09-01T06:41:37.761091
2017-12-25T12:11:10
2017-12-25T12:11:10
102,855,460
0
0
null
null
null
null
UTF-8
Java
false
false
8,972
java
package cn.edu.gdmec.android.mobileguard.m1home.utils; import android.app.Activity; import android.app.AlertDialog; import android.app.DownloadManager; import android.app.ProgressDialog; import android.content.BroadcastReceiver; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.net.Uri; import android.os.Handler; import android.os.Message; import android.webkit.MimeTypeMap; import android.widget.Toast; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.params.HttpConnectionParams; import org.apache.http.util.EntityUtils; import org.json.JSONException; import org.json.JSONObject; import java.io.IOException; import java.util.regex.Matcher; import java.util.regex.Pattern; import cn.edu.gdmec.android.mobileguard.R; import cn.edu.gdmec.android.mobileguard.m1home.entity.VersionEntity; import static android.content.Context.DOWNLOAD_SERVICE; /** * Created by Administrator on 2017/9/26. */ public class VersionUpdateUtils { //声明常量 private static final int MESSAGE_IO_ERROR = 102; private static final int MESSAGE_JSON_ERROR = 103; private static final int MESSAGE_SHOW_DIALOG = 104; private static final int MESSAGE_ENTERHOME = 105; //声明类属性 private String mVersion; private Activity context; private ProgressDialog mProgressDialog; private VersionEntity versionEntity; //下一个activtiy的class private Class<?> nextActivty; //下载完成后的回调 private DownloadCallback downloadCallback; //下载任务的id private long downloadId; //下载完毕的广播接收者 private BroadcastReceiver broadcastReceiver; //构造方法 public VersionUpdateUtils(String mVersion, Activity context,DownloadCallback downloadCallback,Class<?> nextActivty) { this.mVersion = mVersion; this.context = context; this.downloadCallback = downloadCallback; this.nextActivty = nextActivty; } //发送进入主界面消息 private void enterHome(){ handler.sendEmptyMessageDelayed(MESSAGE_ENTERHOME,2000); } private Handler handler = new Handler(){ @Override public void handleMessage(Message msg) { switch(msg.what){ case MESSAGE_IO_ERROR: Toast.makeText(context,"IO异常",Toast.LENGTH_LONG).show(); enterHome(); break; case MESSAGE_JSON_ERROR: Toast.makeText(context,"JSON解析异常",Toast.LENGTH_LONG).show(); enterHome(); break; case MESSAGE_SHOW_DIALOG: showUpdataDialog(versionEntity); break; case MESSAGE_ENTERHOME: if(nextActivty!=null) { Intent intent = new Intent(context, nextActivty); context.startActivity(intent); context.finish(); } break; } } }; /** * 获取服务器版本号*/ public void getCloudVersion(String url){ try { HttpClient client = new DefaultHttpClient(); /*连接超时*/ HttpConnectionParams.setConnectionTimeout(client.getParams(), 5000); /*请求超时*/ HttpConnectionParams.setSoTimeout(client.getParams(), 5000); HttpGet httpGet = new HttpGet(url); HttpResponse execute = client.execute(httpGet); if (execute.getStatusLine().getStatusCode() == 200) { // 请求和响应都成功了 HttpEntity entity = execute.getEntity(); String result = EntityUtils.toString(entity, "utf-8"); // 创建jsonObject对象 System.out.println(result); JSONObject jsonObject = new JSONObject(result); versionEntity = new VersionEntity(); String code = jsonObject.getString("code"); versionEntity.versioncode = code; String des = jsonObject.getString("des"); versionEntity.description = des; String apkurl = jsonObject.getString("apkurl"); versionEntity.apkurl = apkurl; if (!mVersion.equals(versionEntity.versioncode)) { // 版本号不一致 handler.sendEmptyMessage(MESSAGE_SHOW_DIALOG); } } } catch (IOException e) { handler.sendEmptyMessage(MESSAGE_IO_ERROR); e.printStackTrace(); } catch (JSONException e) { handler.sendEmptyMessage(MESSAGE_JSON_ERROR); e.printStackTrace(); } } private void showUpdataDialog(final VersionEntity versionEntity){ //创建dialog AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle("检查到有新版本:"+versionEntity.versioncode); builder.setMessage(versionEntity.description); builder.setCancelable(false); builder.setIcon(R.mipmap.ic_launcher_round); builder.setPositiveButton("立刻升级", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { //下载apk downloadNewApk(versionEntity.apkurl); enterHome(); } }); builder.setNegativeButton("暂不升级", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); enterHome(); } }); builder.show(); } protected void downloadNewApk(String apkurl){ DownloadUtils downLoadUtils = new DownloadUtils(); String filename = "downloadfile"; String suffixes="avi|mpeg|3gp|mp3|mp4|wav|jpeg|gif|jpg|png|apk|exe|pdf|rar|zip|docx|doc|apk|db"; Pattern pat=Pattern.compile("[\\w]+[\\.]("+suffixes+")");//正则判断 Matcher mc=pat.matcher(apkurl);//条件匹配 while(mc.find()){ filename = mc.group();//截取文件名后缀名 } downapk(apkurl, filename, context); } public void downapk(String url,String targetFile,Context context){ //创建下载任务 DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); request.setAllowedOverRoaming(false);//漫游网络是否可以下载 //设置文件类型,可以在下载结束后自动打开该文件 MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton(); String mimeString = mimeTypeMap.getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(url)); request.setMimeType(mimeString); //在通知栏中显示,默认就是显示的 request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE); request.setVisibleInDownloadsUi(true); //sdcard的目录下的download文件夹,必须设置 request.setDestinationInExternalPublicDir("/download/", targetFile); //request.setDestinationInExternalFilesDir(),也可以自己制定下载路径 //将下载请求加入下载队列 DownloadManager downloadManager = (DownloadManager) context.getSystemService(DOWNLOAD_SERVICE); //加入下载队列后会给该任务返回一个long型的id, //通过该id可以取消任务,重启任务等等,看上面源码中框起来的方法 downloadId = downloadManager.enqueue(request); listener(downloadId,targetFile); } private void listener(final long Id,final String filename) { // 注册广播监听系统的下载完成事件。 IntentFilter intentFilter = new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE); broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { long ID = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1); if (ID == Id) { Toast.makeText(context.getApplicationContext(), "下载编号:" + Id +"的"+filename+" 下载完成!", Toast.LENGTH_LONG).show(); } context.unregisterReceiver(broadcastReceiver); downloadCallback.afterDownload(filename); } }; context.registerReceiver(broadcastReceiver, intentFilter); } public interface DownloadCallback{ void afterDownload(String filename); } }
[ "807697194@qq.com" ]
807697194@qq.com
56cc963b4d815fa8254597fc2ed950d230a3926e
2387726ddc53380dfaca706ca273216c98c9107a
/BookStore/src/bookstore/user/dao/UserDao.java
8919677b866feaa898b589673eef33a0f5fd3b39
[]
no_license
bestbelief/homework
0553c1a4c5935dd95a4f4760100646ad48cc214b
c921e4c8904e0cf7c4856c8ed0d7a7b270a0c7db
refs/heads/master
2021-05-06T11:03:01.096363
2018-01-21T10:59:28
2018-01-21T10:59:28
113,305,741
0
0
null
null
null
null
UTF-8
Java
false
false
2,548
java
package bookstore.user.dao; import bookstore.user.domain.User; import bookstore.util.C3P0Util; import org.apache.commons.dbutils.QueryRunner; import org.apache.commons.dbutils.handlers.BeanHandler; import java.sql.Connection; import java.sql.SQLException; public class UserDao { private User user = new User(); private QueryRunner qr = new QueryRunner(); public User findByUsername(String username){ String sql ="select * from tb_user where username =?"; Connection conn = C3P0Util.getConnection(); try { user=qr.query(conn,sql,new BeanHandler<User>(User.class),username); } catch (SQLException e) { e.printStackTrace(); } try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } return user; } public User findByEmail(String emile){ String sql = "select * from tb_user where username=?"; Connection conn =C3P0Util.getConnection(); try { user = qr.query(conn,sql,new BeanHandler<User>(User.class),emile); } catch (SQLException e) { e.printStackTrace(); } try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } return user; } public User findByCode(String code){ String sql = "select * from tb_user where code=?"; Connection conn = C3P0Util.getConnection(); try { user =qr.query(conn,sql,new BeanHandler<User>(User.class),code); } catch (SQLException e) { e.printStackTrace(); } try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } return user; } public void add(User user){ String sql = "insert into tb_user values(?,?,?,?,?,?)"; Connection conn = C3P0Util.getConnection(); System.out.println(user.getUsername()); System.out.println(user.getUid()); try { qr.update(conn,sql,user.getUid(),user.getUsername(),user.getPassword() ,user.getEmail(),user.getCode(),user.getState()); } catch (SQLException e) { e.printStackTrace(); } try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } } public void updateState(String uid,String state){ if (user.getUid().equals(uid)){ user.setState("1"); } } }
[ "34058047+bestbelief@users.noreply.github.com" ]
34058047+bestbelief@users.noreply.github.com
6f0ee1a436029518272db90813e854f2637fee97
2e52908990389a052fd882083447abb8a15a209e
/GeeksForGeeks/src/com/geeks/arrays/PairWithGivenDifference.java
368068443092f856392aaf5db55ac387ed1bff97
[]
no_license
cksharma/coding
656a7053c9f7cdb5aaed6bb58ed27bff87ab7d0e
4ae82c20dc8671a5ad0e6f967f1a123b934af247
refs/heads/master
2021-01-18T11:53:40.908684
2020-10-13T01:01:43
2020-10-13T01:01:43
29,038,027
0
0
null
2020-10-13T01:01:44
2015-01-09T22:22:55
Java
UTF-8
Java
false
false
959
java
package com.geeks.arrays; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; public class PairWithGivenDifference { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); TaskD solver = new TaskD(); solver.solve(1, in, out); out.close(); } } class TaskD { public void solve(int testNumber, InputReader in, PrintWriter out) { int n = in.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = in.nextInt(); } int diff = in.nextInt(); Arrays.sort(arr); int i = 0, j = 1; while (i < arr.length && j < arr.length) { if (arr[j] - arr[i] == diff) { out.println(arr[j] + " " + arr[i]); i++; j++; } else if (arr[j] - arr[i] > diff) { i++; } else { j++; } } } }
[ "cksharma.skt@gmail.com" ]
cksharma.skt@gmail.com
9ee967dfe17c42429e5b3f73fd4e9172e8ef76df
3b320eefee9006512b004bf592500dee8c9381ef
/Moonstone/src/moonstone/rule/InferenceRule.java
90ebc32935a0215a4d0cfce240fd38ef8d90ee67
[]
no_license
leenlp/Moonstone
0f48707f31fcfc9e73d082032ad7c1706fa9928a
07dfd8c0f2f2635afc050f48e861f38135a3f6e9
refs/heads/master
2021-01-18T23:36:55.268542
2018-10-10T03:32:00
2018-10-10T03:32:00
152,357,622
1
0
null
null
null
null
UTF-8
Java
false
false
2,683
java
package moonstone.rule; import java.util.Vector; import moonstone.annotation.AnnotationIntegrationMaps; import tsl.expression.form.sentence.ImplicationSentence; import tsl.expression.term.constant.ObjectConstant; import tsl.expression.term.relation.RelationSentence; import tsl.knowledge.knowledgebase.KnowledgeBase; import tsl.tsllisp.Sexp; import tsl.tsllisp.TLUtils; public class InferenceRule extends Rule { private ImplicationSentence implicationSentence = null; public InferenceRule(KnowledgeBase kb, Sexp sexp) { kb.clearFields(); this.setPattern(TLUtils.convertSexpToJVector(sexp)); this.setPropertiesFromPattern(this.getPattern()); this.setRuleType("inferencerule"); String idstr = this.getStringProperty("ruleid"); this.setRuleID(idstr); Sexp s = (Sexp) sexp.getSecond(); Vector sv = TLUtils.convertSexpToJVector(s); this.implicationSentence = (ImplicationSentence) ImplicationSentence .createImplicationSentence(sv); this.implicationSentence.setName(this.getRuleID()); this.implicationSentence.setSexp(sexp); this.implicationSentence.setContainingObject(this); kb.initializeAndAddForm(this.implicationSentence); } public InferenceRule(KnowledgeBase kb, Sexp sexp, String idstr) { kb.clearFields(); this.setRuleType("inferencerule"); this.setRuleID(idstr); Vector sv = TLUtils.convertSexpToJVector(sexp); this.implicationSentence = (ImplicationSentence) ImplicationSentence .createImplicationSentence(sv); this.implicationSentence.setSexp(sexp); this.implicationSentence.setContainingObject(this); kb.initializeAndAddForm(this.implicationSentence); } public static InferenceRule createInferenceRule(KnowledgeBase kb, Sexp sexp) { if (isInferenceRule(sexp)) { return new InferenceRule(kb, sexp); } return null; } public static boolean isInferenceRule(Sexp sexp) { return (sexp.getLength() == 2 && TLUtils.isCons(sexp.getSecond()) && ImplicationSentence .isImpllicationSentence((Sexp) sexp.getSecond())); } public ImplicationSentence getImplicationSentence() { return implicationSentence; } public String getConsequentConcept() { if (this.getImplicationSentence() != null && this.getImplicationSentence().getConsequent() != null) { RelationSentence consequent = this.getImplicationSentence() .getConsequentRelationSentence(); if (consequent.getTermCount() > 0) { for (Object o : consequent.getTerms()) { if (o instanceof ObjectConstant) { ObjectConstant uo = (ObjectConstant) o; String str = uo.getObject().toString(); if (AnnotationIntegrationMaps.getCUI(str) != null) { return str; } } } } } return null; } }
[ "leenlp@q.com" ]
leenlp@q.com
16f83d60f290e1ace6c4a8095efda5730b922913
cf4995155e914ed191262c9f791962a9e11b7577
/app/src/main/java/com/sivavignesh/rampus/theme.java
fdace0a529db33522695598be0b9332b90162011
[]
no_license
Siva-Vignesh/Rampus
9a1291910cb003e0ba773caf316709e91a942b81
5aa312e0955d33c2e352f8128d32a49c44fbc732
refs/heads/main
2023-01-24T06:33:31.194582
2020-12-04T13:50:48
2020-12-04T13:50:48
318,531,284
1
0
null
null
null
null
UTF-8
Java
false
false
4,369
java
package com.sivavignesh.rampus; import android.content.Intent; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.util.DisplayMetrics; import android.view.Gravity; import android.view.View; import android.view.WindowManager; import android.widget.Button; public class theme extends AppCompatActivity { Button theme1,theme2,theme3,theme4,theme5,theme6,theme7,theme8; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.theme); DisplayMetrics dm=new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); int width=dm.widthPixels; int height=dm.heightPixels; getWindow().setLayout((int)(width*.8),(int)(height*.7)); WindowManager.LayoutParams params=getWindow().getAttributes(); params.gravity= Gravity.CENTER; params.x=0; params.y=-20; getWindow().setAttributes(params); theme1=findViewById(R.id.theme1); theme2=findViewById(R.id.theme2); theme3=findViewById(R.id.theme3); theme4=findViewById(R.id.theme4); theme5=findViewById(R.id.theme5); theme6=findViewById(R.id.theme6); theme7=findViewById(R.id.theme7); theme8=findViewById(R.id.theme8); theme1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String n="theme1"; Intent intent=new Intent(v.getContext(),MainActivity.class); intent.putExtra("variable",n); startActivity(intent); finish(); } }); theme2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String n="theme2"; Intent intent=new Intent(v.getContext(),MainActivity.class); intent.putExtra("variable",n); startActivity(intent); finish(); } }); theme3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String n="theme3"; Intent intent=new Intent(v.getContext(),MainActivity.class); intent.putExtra("variable",n); startActivity(intent); finish(); } }); theme4.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String n="theme4"; Intent intent=new Intent(v.getContext(),MainActivity.class); intent.putExtra("variable",n); startActivity(intent); finish(); } }); theme5.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String n="theme5"; Intent intent=new Intent(v.getContext(),MainActivity.class); intent.putExtra("variable",n); startActivity(intent); finish(); } }); theme6.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String n="theme6"; Intent intent=new Intent(v.getContext(),MainActivity.class); intent.putExtra("variable",n); startActivity(intent); finish(); } }); theme7.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String n="theme7"; Intent intent=new Intent(v.getContext(),MainActivity.class); intent.putExtra("variable",n); startActivity(intent); finish(); } }); theme8.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String n="theme8"; Intent intent=new Intent(v.getContext(),MainActivity.class); intent.putExtra("variable",n); finish(); startActivity(intent); } }); } }
[ "Siva-Vignesh@users.noreply.github.com" ]
Siva-Vignesh@users.noreply.github.com
23d6b42f93ad7d01ccb8bcddeb2e5aff33640677
7c4ad9f1ee659545bc735c8d171a7ac7c857dc7d
/guli-ucenter/src/main/java/com/guli/ucenter/config/EduConfig.java
06759755e40ef039be216f382b9c7060a008bb02
[]
no_license
duolai0701/guli
15d141c45acf6b4607ee561a5f408e22e62a5875
2b136fa189f4c80c51eed99c9404b8b73feda1ce
refs/heads/master
2020-12-03T16:48:07.186752
2019-11-29T06:48:15
2019-11-29T06:48:15
231,395,851
1
0
null
2020-01-02T14:16:15
2020-01-02T14:16:15
null
UTF-8
Java
false
false
1,652
java
package com.guli.ucenter.config; import com.baomidou.mybatisplus.core.injector.ISqlInjector; import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector; import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor; import org.mybatis.spring.annotation.MapperScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; import org.springframework.transaction.annotation.EnableTransactionManagement; @Configuration @EnableTransactionManagement @ComponentScan("com.guli.ucenter") @MapperScan("com.guli.ucenter.mapper") public class EduConfig { /** * SQL 执行性能分析插件 * 开发环境使用,线上不推荐。 maxTime 指的是 sql 最大执行时长 */ @Bean @Profile({"dev","test"})// 设置 dev test 环境开启 public PerformanceInterceptor performanceInterceptor() { PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor(); performanceInterceptor.setMaxTime(1000);//ms,超过此处设置的ms则sql不执行 performanceInterceptor.setFormat(true); return performanceInterceptor; } /** * 逻辑删除插件 */ @Bean public ISqlInjector sqlInjector() { return new LogicSqlInjector(); } /** * 分页插件 */ @Bean public PaginationInterceptor paginationInterceptor() { return new PaginationInterceptor(); } }
[ "2313212421@qq.com" ]
2313212421@qq.com
c4ca0054327a72fe42aa0af30c1a179df2bb1acc
14e59a9bc6066c6edc35f667a658e1237bd2e58e
/SpringBoot/authontication copy/src/main/java/com/example/authontication/model/User.java
de48ff6974d769d38a5ad07aad3204ccc1a99e2f
[]
no_license
nassersayeh/JavaStack
a923c090aeaf9ba28fb861a38e1db33449100bc6
be8b8b600b53f0ba9a96088b5873a24cd5f7fb13
refs/heads/master
2023-06-07T13:05:52.324723
2021-06-29T21:54:05
2021-06-29T21:54:05
375,309,548
0
0
null
null
null
null
UTF-8
Java
false
false
1,835
java
package com.example.authontication.model; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; import javax.persistence.Table; import javax.persistence.Transient; // imports removed for brevity @Entity @Table(name="users") public class User { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long id; private String email; private String password; @Transient private String passwordConfirmation; @Column(updatable=false) private Date createdAt; private Date updatedAt; public User() { } // other getters and setters removed for brevity @PrePersist protected void onCreate(){ this.createdAt = new Date(); } @PreUpdate protected void onUpdate(){ this.updatedAt = new Date(); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getPasswordConfirmation() { return passwordConfirmation; } public void setPasswordConfirmation(String passwordConfirmation) { this.passwordConfirmation = passwordConfirmation; } public Date getCreatedAt() { return createdAt; } public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } public Date getUpdatedAt() { return updatedAt; } public void setUpdatedAt(Date updatedAt) { this.updatedAt = updatedAt; } }
[ "nasser.sayeh89@gmail.com" ]
nasser.sayeh89@gmail.com
5dea87d2a64d509834c3c4aad03f94c3397dab7a
7df1b3729630bbde6d368b117048809c84dcef4f
/src/DSAprep/D9PalindromePartitioning.java
e1f110eaf6fd62e6fdf38b3b6a49d89a3b13bb72
[]
no_license
Karthikb777/SDE-sheet-practice
015a3086e7dff6235dfa95856b2767fff385f348
19a1b92494ec7ad4e647ed1cb9096cd4ccc8bc1d
refs/heads/main
2023-08-15T16:47:12.857835
2021-10-05T01:22:47
2021-10-05T01:22:47
395,721,993
2
0
null
null
null
null
UTF-8
Java
false
false
1,403
java
package DSAprep; import java.util.ArrayList; import java.util.List; /* * palindrome partitioning: * recursive solution: * TODO * */ public class D9PalindromePartitioning { private static void recur(int index, String s, List<List<String>> ans, List<String> ds) { // base case if (index == s.length()) { ans.add(new ArrayList<>(ds)); return; } // loop for (int i = index; i < s.length(); i++) { if (isPalindrome(s, index, i)) { ds.add(s.substring(index, i+1)); recur(index+1, s, ans, ds); ds.remove(ds.size() - 1); } } } private static boolean isPalindrome(String str, int start, int end) { while (start <= end) { if (str.charAt(start++) != str.charAt(end--)) return false; } return true; } public static List<List<String>> solve(String s) { List<List<String>> ans = new ArrayList<>(); recur(0, s, ans, new ArrayList<>()); return ans; } public static void main(String[] args) { String a = "aab"; List<List<String>> ans = solve(a); for (List<String> substr : ans) { for (String s : substr) { System.out.print(s + " "); } System.out.println(); } } }
[ "karthik.barati.777@gmail.com" ]
karthik.barati.777@gmail.com
88890b8c845e8e543778a130648477d3991a228a
bc65803b3a5dcbb6d0449b51034104acce471271
/src/main/java/top/daoyang/creation/factory/AbstractFactory.java
b2fce769fd5c64273af1bf4c9a0a0038e46e09e0
[]
no_license
DaoYangM/design-pattern
53514279af3aca1deebc4909f68f10c99afc7785
277c4dab454f1b26e1eef03da1d9c3bad0adfb36
refs/heads/master
2022-08-09T10:22:24.412286
2020-05-20T13:43:50
2020-05-20T13:43:50
257,911,568
0
0
null
null
null
null
UTF-8
Java
false
false
1,766
java
package top.daoyang.creation.factory; /** * 抽象工厂 * 抽象工厂涉及到产品族和产品等级的概念 * * AMD CPU 和 AMD GPU 是同一个产品族 * AMD CPU 和 INTEL CPU 是同一个产品等级 * * 优点: 增加产品族的时候能保证开闭原则 * 缺点: 增加产品等级的手时候不能保证开闭原则,需要修改大量的类 */ public class AbstractFactory { public interface CPU { void describe(); } public interface GPU { void describe(); } static class AMDCPU implements CPU { @Override public void describe() { System.out.println("AMD CPU"); } } static class IntelCPU implements CPU { @Override public void describe() { System.out.println("Intel CPU"); } } static class AMDGPU implements GPU { @Override public void describe() { System.out.println("AMD GPU"); } } static class IntelGPU implements GPU { @Override public void describe() { System.out.println("Intel GPU"); } } public interface ComputerFactory { CPU getCPU(); GPU getGPU(); } public static class AMDComputerFactory implements ComputerFactory { @Override public CPU getCPU() { return new AMDCPU(); } @Override public GPU getGPU() { return new AMDGPU(); } } public static class IntelComputerFactory implements ComputerFactory { @Override public CPU getCPU() { return new IntelCPU(); } @Override public GPU getGPU() { return new IntelGPU(); } } }
[ "deyangye@gmail.com" ]
deyangye@gmail.com
e91cc72ae847c40b3368d162608d6c9a1fff2df6
e07eb539a8092548a857d652183a8d1836d8be76
/gmall-cart-web/src/main/java/com/atguigu/gmall/cart/GmallCartWebApplication.java
0eddb99a58ed932678a22f3cf248b78f085d00b1
[]
no_license
1697278868/gmall
01dea55337ab42bfb2aebd9d89b1624e24561038
06310c1055927cd106e004ddac99d51b17729f98
refs/heads/master
2022-09-18T02:01:23.655297
2019-09-29T07:23:46
2019-09-29T07:23:56
206,240,574
2
0
null
2022-09-01T23:12:39
2019-09-04T05:43:23
CSS
UTF-8
Java
false
false
424
java
package com.atguigu.gmall.cart; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; @SpringBootApplication @ComponentScan("com.atguigu.gmall") public class GmallCartWebApplication { public static void main(String[] args) { SpringApplication.run(GmallCartWebApplication.class, args); } }
[ "1697278868.qq.com" ]
1697278868.qq.com
6b8469a866de303271663032b57b9273eae42709
a113d34a64054fe897057e5d732d5a30b6007415
/photon-core/src/test/java/com/github/molcikas/photon/tests/unit/h2/myonetomanytable/MyOneToManyTableFetchTests.java
3a810bc90ca2c130fbee1ec7b56c136d48b9c6b8
[ "MIT" ]
permissive
molcikas/photon
9b2f6d88275586dc77380da1dccdfcf0d60015a9
27b30af288bcb89b1b2ee43d8b06a51fb6ad9e61
refs/heads/master
2021-01-11T22:29:29.914072
2018-07-22T00:29:04
2018-07-22T00:29:04
78,969,994
13
0
MIT
2018-02-25T02:01:54
2017-01-14T22:18:20
Java
UTF-8
Java
false
false
8,501
java
package com.github.molcikas.photon.tests.unit.h2.myonetomanytable; import com.github.molcikas.photon.blueprints.entity.ChildCollectionConstructor; import com.github.molcikas.photon.blueprints.table.ColumnDataType; import com.github.molcikas.photon.exceptions.PhotonException; import com.github.molcikas.photon.tests.unit.entities.myonetomanytable.MyOneToManyMapTable; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import com.github.molcikas.photon.Photon; import com.github.molcikas.photon.PhotonTransaction; import com.github.molcikas.photon.tests.unit.entities.myonetomanytable.MyThirdTable; import com.github.molcikas.photon.tests.unit.entities.myonetomanytable.MyManyTable; import com.github.molcikas.photon.tests.unit.entities.myonetomanytable.MyOneToManyTable; import java.util.Collection; import java.util.HashMap; import java.util.Map; import static org.junit.Assert.*; public class MyOneToManyTableFetchTests { private Photon photon; @Before public void setupDatabase() { photon = MyOneToManyTableDbSetup.setupDatabase(); } @Test public void aggregateQuery_fetchByIdOneToOneWithMatch_returnsAggregate() { registerMyOneToManyTableAggregate(); try(PhotonTransaction transaction = photon.beginTransaction()) { MyOneToManyTable myOneToManyTable = transaction .query(MyOneToManyTable.class) .fetchById(6); assertNotNull(myOneToManyTable); assertEquals(Integer.valueOf(6), myOneToManyTable.getId()); assertEquals("my6dbvalue", myOneToManyTable.getMyvalue()); assertEquals(3, myOneToManyTable.getMyManyTables().size()); MyManyTable myManyTable = myOneToManyTable.getMyManyTables().get(2); assertEquals(Integer.valueOf(9), myManyTable.getId()); assertEquals(Integer.valueOf(6), myManyTable.getParent()); assertEquals("my63otherdbvalue", myManyTable.getMyOtherValueWithDiffName()); assertEquals(2, myManyTable.getMyThirdTables().size()); MyThirdTable myThirdTable = myManyTable.getMyThirdTables().get(0); assertEquals(Integer.valueOf(3), myThirdTable.getId()); assertEquals(Integer.valueOf(9), myThirdTable.getParent()); assertEquals("thirdtableval3", myThirdTable.getVal()); } } @Test public void aggregateQuery_fetchByIdNoChildren_returnsAggregateWithEmptyNotNullChildList() { registerMyOneToManyTableAggregate(); try(PhotonTransaction transaction = photon.beginTransaction()) { MyOneToManyTable myOneToManyTable = transaction .query(MyOneToManyTable.class) .fetchById(1); assertNotNull(myOneToManyTable); assertNotNull(myOneToManyTable.getMyManyTables()); assertEquals(0, myOneToManyTable.getMyManyTables().size()); } } @Test public void aggregateQuery_fetchByIdExcludeChild_returnsAggregateWithNullChild() { registerMyOneToManyTableAggregate(); try(PhotonTransaction transaction = photon.beginTransaction()) { MyOneToManyTable myOneToManyTable = transaction .query(MyOneToManyTable.class) .exclude("myManyTables") .fetchById(6); assertNotNull(myOneToManyTable); assertEquals(Integer.valueOf(6), myOneToManyTable.getId()); assertEquals("my6dbvalue", myOneToManyTable.getMyvalue()); assertEquals(0, myOneToManyTable.getMyManyTables().size()); } } @Test public void aggregateQuery_fetchByIdExcludeGrandchild_returnsAggregateWithNullGrandchild() { registerMyOneToManyTableAggregate(); try(PhotonTransaction transaction = photon.beginTransaction()) { MyOneToManyTable myOneToManyTable = transaction .query(MyOneToManyTable.class) .exclude("myManyTables.myThirdTables") .fetchById(6); assertNotNull(myOneToManyTable); assertEquals(Integer.valueOf(6), myOneToManyTable.getId()); assertEquals("my6dbvalue", myOneToManyTable.getMyvalue()); assertEquals(3, myOneToManyTable.getMyManyTables().size()); MyManyTable myManyTable = myOneToManyTable.getMyManyTables().get(2); assertEquals(Integer.valueOf(9), myManyTable.getId()); assertEquals(Integer.valueOf(6), myManyTable.getParent()); assertEquals("my63otherdbvalue", myManyTable.getMyOtherValueWithDiffName()); assertEquals(0, myManyTable.getMyThirdTables().size()); } } @Test public void aggregateQuery_fetchByIdExcludeNonexistentChild_returnsAggregate() { registerMyOneToManyTableAggregate(); try(PhotonTransaction transaction = photon.beginTransaction()) { MyOneToManyTable myOneToManyTable = transaction .query(MyOneToManyTable.class) .exclude("myManyTables.notARealField") .fetchById(6); Assert.fail("Failed to throw PhotonException"); } catch (PhotonException ex) { assertTrue(ex.getMessage().contains("notARealField")); } } @Test public void aggregateQuery_fieldAsMap_returnsAggregate() { photon.registerAggregate(MyOneToManyMapTable.class) .withTableName("MyOneToManyTable") .withId("myOneToManyMapTableId") .withDatabaseColumn("id", "myOneToManyMapTableId") .withPrimaryKeyAutoIncrement() .withChild("myManyTables", MyManyTable.class) .withChildCollectionConstructor(new ChildCollectionConstructor<Map<Integer, MyManyTable>, MyManyTable, MyOneToManyMapTable>() { @Override public Collection<MyManyTable> toCollection(Map<Integer, MyManyTable> fieldValue, MyOneToManyMapTable parentEntityInstance) { return null; } @Override public Map<Integer, MyManyTable> toFieldValue(Collection<MyManyTable> collection, MyOneToManyMapTable parentEntityInstance) { Map<Integer, MyManyTable> map = new HashMap<>(); for(MyManyTable myManyTable : collection) { map.put(myManyTable.getId(), myManyTable); } return map; } }) .withId("id", true) .withForeignKeyToParent("parent") .withDatabaseColumn("myothervalue", "myOtherValueWithDiffName", ColumnDataType.VARCHAR) .addAsChild() .register(); try(PhotonTransaction transaction = photon.beginTransaction()) { MyOneToManyMapTable myOneToManyTable = transaction .query(MyOneToManyMapTable.class) .fetchById(6); assertNotNull(myOneToManyTable); assertNotNull(myOneToManyTable.getMyManyTables()); assertEquals(HashMap.class, myOneToManyTable.getMyManyTables().getClass()); assertEquals(3, myOneToManyTable.getMyManyTables().size()); MyManyTable myManyTable = myOneToManyTable.getMyManyTables().get(9); assertEquals(Integer.valueOf(9), myManyTable.getId()); assertEquals(Integer.valueOf(6), myManyTable.getParent()); assertEquals("my63otherdbvalue", myManyTable.getMyOtherValueWithDiffName()); } } private void registerMyOneToManyTableAggregate() { photon.registerAggregate(MyOneToManyTable.class) .withId("id") .withPrimaryKeyAutoIncrement() .withChild("myManyTables", MyManyTable.class) .withId("id", true) .withForeignKeyToParent("parent") .withDatabaseColumn("myothervalue", "myOtherValueWithDiffName", ColumnDataType.VARCHAR) .withChild("myThirdTables", MyThirdTable.class) .withId("id") .withPrimaryKeyAutoIncrement() .withForeignKeyToParent("parent") .addAsChild() .addAsChild() .register(); } }
[ "matthew.olcikas@gmail.com" ]
matthew.olcikas@gmail.com
a09e77c7f54f68317452068ae086d751027fa264
eb896775e7d6b764ee73767f83eae87444c49b26
/educacion-continua-web/src/main/java/ec/edu/espe/arquitectura/educacion/CursoBean.java
7c198ce37a102d3b2c52279da40ff58c85562eb1
[]
no_license
jscajape/EducacionContinua_EvaluacionDocente
ad6d5fd775dff50c9c87d38ecf607c5f500bcd33
64a5fa02daa777138c610ec32ec318bde28bc247
refs/heads/master
2020-03-18T15:37:24.209728
2018-06-06T01:50:58
2018-06-06T01:50:58
134,918,388
0
1
null
null
null
null
UTF-8
Java
false
false
5,274
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package ec.edu.espe.arquitectura.educacion; import ec.edu.espe.arquitectura.educacion.enums.EstadoCursoEnum; import ec.edu.espe.arquitectura.educacion.model.InsArea; import ec.edu.espe.arquitectura.educacion.model.InsClase; import ec.edu.espe.arquitectura.educacion.model.InsCurso; import ec.edu.espe.arquitectura.educacion.service.InsAreaServ; import ec.edu.espe.arquitectura.educacion.service.InsCursoServ; import ec.edu.espe.arquitectura.educacion.web.util.FacesUtil; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.annotation.PostConstruct; import javax.ejb.Stateless; import javax.faces.view.ViewScoped; import javax.inject.Inject; import javax.inject.Named; /** * * @author ALCI */ @Named @ViewScoped public class CursoBean extends BaseBean implements Serializable { // Add business logic below. (Right-click in editor and choose // "Insert Code > Add Business Method")} private List<InsCurso> cursos; private InsCurso curso; private InsCurso cursosel; private Integer codarea; private List<InsArea> areas; private InsArea area; private String estado; @Inject private InsCursoServ cursoserv; @Inject private InsAreaServ areaserv; public List<InsArea> getAreas() { return areas; } public void setAreas(List<InsArea> areas) { this.areas = areas; } @PostConstruct public void init() { this.cursos = this.cursoserv.obtenerTodos(); this.areas = this.areaserv.obtenerTodos(); // this.cursos = new ArrayList<>(); this.area = new InsArea(); this.curso = new InsCurso(); // this.cursos = this.cursoserv.buscarporArea(codarea); } public void IngresarDatos() { this.area.setCodigo(codarea); this.curso.setInsArea(area); } public InsArea getArea() { return area; } public String getEstado() { return estado; } public void setEstado(String estado) { this.estado = estado; } public void setArea(InsArea area) { this.area = area; } public List<InsCurso> getCursos() { return cursos; } public void setCursos(List<InsCurso> cursos) { this.cursos = cursos; } public InsCurso getCurso() { return curso; } public void setCurso(InsCurso curso) { this.curso = curso; } public InsCurso getCursosel() { return cursosel; } public void setCursosel(InsCurso cursosel) { this.cursosel = cursosel; } public InsCursoServ getCursoserv() { return cursoserv; } public void setCursoserv(InsCursoServ cursoserv) { this.cursoserv = cursoserv; } @Override public void agregar() { this.curso = new InsCurso(); super.agregar(); } public Integer getCodarea() { return codarea; } public void setCodarea(Integer codarea) { this.codarea = codarea; } @Override public void modificar() { super.modificar(); this.curso = new InsCurso(); this.curso.setCosto(this.cursosel.getCosto()); this.curso.setDescripcion(this.cursosel.getDescripcion()); this.curso.setEstado(this.cursosel.getEstado()); this.curso.setHorasDuracion(this.cursosel.getHorasDuracion()); } @Override public void detalles() { super.detalles(); this.curso = this.curso; } public void cancelar() { super.reset(); this.curso = new InsCurso(); } public void guardar() { IngresarDatos(); try { if (this.enAgregar) { this.cursoserv.crear(this.curso); FacesUtil.addMessageInfo("Se agreg\u00f3 el item al men\u00fa: " + this.curso.getDescripcion()); } else { this.cursoserv.modificar(this.curso); FacesUtil.addMessageInfo("Se modific\u00f3 el item del men\u00fa con el nombre: " + this.curso.getDescripcion()); } } catch (Exception ex) { FacesUtil.addMessageError(null, "Ocurrí\u00f3 un error al actualizar la informaci\u00f3n"); } super.reset(); this.curso = new InsCurso(); this.cursos = this.cursoserv.obtenerTodos(); } public EstadoCursoEnum[] getTiposCursos() { return EstadoCursoEnum.values(); } public void eliminar() { try { //this.cursoserv.eliminar(this.cursosel.getCodigo()); this.cursos = this.cursoserv.obtenerTodos(); FacesUtil.addMessageInfo("Se elimino el registro."); this.cursosel = null; } catch (Exception e) { FacesUtil.addMessageError(null, "No se puede eliminar el registro seleccionado. Verifique que no tenga informacion relacionada."); } } }
[ "yop_dm@hotmail.com" ]
yop_dm@hotmail.com
bfafaf290a4d829e65613c41c5bec519c01ac007
6b165dec5431d6b7d43fe15fc0504c77edad4e90
/medes-android-maps_lib/src/fr/medes/android/maps/app/LocationFromBestAvailable.java
6c00f2f3c28c5a586fc6dbb6ed1a027fdca29bf0
[]
no_license
medes-imps/imogene.android
82f4decd5c7b577287e3c06ed19e7e9588735245
bd140736fc78f3c99ad2a9123c1d11f984557eb9
refs/heads/master
2021-01-17T03:33:54.125090
2015-09-07T08:47:04
2015-09-07T08:47:04
32,326,073
0
0
null
null
null
null
UTF-8
Java
false
false
511
java
package fr.medes.android.maps.app; import android.content.Context; import android.location.Criteria; import android.location.LocationManager; public class LocationFromBestAvailable extends LocationFromSensor { @Override protected String obtainProvider() { LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); return manager.getBestProvider(criteria, true); }; }
[ "julien.dupouy.fr@gmail.com" ]
julien.dupouy.fr@gmail.com
57bcb2eb0f9c877b05e33bb6fd25f97790d15725
1f331c27e7167c8eeaa46f0df32d1026738fd621
/currency-exchange-service/src/main/java/com/in28minutes/microservices/CurrencyExchangeRepository.java
ec010fcb8c8350120d44b151b660408a838b3998
[]
no_license
roopamalemath/Zipkin-distributed-tracing-server
e8c3ed1957c3eb43a5203d06af3b557346181f4d
6b58bbb05af82ce58663a3f40e7b8c243b3552fb
refs/heads/master
2022-12-02T08:37:34.428343
2020-07-31T18:17:59
2020-07-31T18:17:59
284,098,750
0
0
null
null
null
null
UTF-8
Java
false
false
320
java
package com.in28minutes.microservices; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface CurrencyExchangeRepository extends JpaRepository<ExchangeValue, Long>{ public ExchangeValue findByFromAndTo(String from,String to); }
[ "roopa.malemath.dvg@gmail.com" ]
roopa.malemath.dvg@gmail.com
780679f1debf8fc4c7b64d3ee75b554c9004f0fb
3650ed995c0c1a3835e1905a66bc45d8850d2be0
/MobileSafeDEMO/src/com/zhuolei/mobilesafe/clean/StrongSpeedUp.java
2aa9e8a3c40398086110c6aefbd8ea66eed64630
[]
no_license
maxdeny/test
7d38f42296822dc4174e25f2e056ef09c2374d9f
1408429cbf5cc896cf4dfaeb21c6c6faaa9932c7
refs/heads/master
2021-01-10T07:25:33.543500
2016-04-08T06:00:10
2016-04-08T06:00:10
55,743,264
0
0
null
null
null
null
GB18030
Java
false
false
13,025
java
package com.zhuolei.mobilesafe.clean; import java.util.ArrayList; import java.util.List; import android.R.integer; import android.app.Service; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.os.AsyncTask; import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.widget.ExpandableListView; import android.widget.ExpandableListView.OnChildClickListener; import android.widget.TextView; import android.widget.Toast; import com.zhuolei.mabilesafe.adapter.MyExpandableListAdapter; import com.zhuolei.mobilesafe.base.MyBaseActivity; import com.zhuolei.mobilesafe.components.dialog.CustomProgessDialog; import com.zhuolei.mobilesafe.components.dialog.MyDialog; import com.zhuolei.mobilesafe.main.R; import com.zhuolei.mobilesafe.model.AutoStartItem; import com.zhuolei.mobilesafe.model.ExpListviewPostion; public class StrongSpeedUp extends MyBaseActivity implements OnClickListener{ private static final String TAG = "StrongSpeedUp"; private TextView optimize; private ExpandableListView exListView; private Context mine = this; private MyExpandableListAdapter myELAdapter; private MyDialog alertDialog; private String packageName;//child item 点击后的应用包名 private String appName;//child item 点击后的应用名 private List<ComponentName> mComponentNames; // private int mGroupPosition = 0; //父位置 // private int mChildPosition = 0; //子列表位置 private ExpListviewPostion mExpListviewPostion; //子列表集合 private List<List<AutoStartItem>> childs; @Override protected void setContentView() { // TODO Auto-generated method stub setContentView(R.layout.expandable_activity_strongpeedup); } @Override protected void findViewById() { // TODO Auto-generated method stub optimize = (TextView) findViewById(R.id.btn_optimize); exListView = (ExpandableListView) findViewById(R.id.ex_listview); } @Override protected void initView() { mExpListviewPostion = ExpListviewPostion.getInstance(); // TODO Auto-generated method stub optimize.setOnClickListener(this); exListView.setOnChildClickListener(new OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView arg0, View arg1, int groupPosition, int childPosition, long rowId) { // TODO Auto-generated method stub AutoStartItem aSitem = (AutoStartItem)(myELAdapter.getChild(groupPosition, childPosition)); packageName = aSitem.appPN; appName = aSitem.appLable; mExpListviewPostion.setGroupPosition(groupPosition); mExpListviewPostion.setChildPosition(childPosition); if(groupPosition == 1) { int enabled = childs.get(mExpListviewPostion.getGroupPosition()).get(mExpListviewPostion.getChildPosition()).enableFlag; if(enabled == 2) { setAutoStart(); }else{ showMyDialog(appName); } } else if(groupPosition == 0){ setAutoStart(); } Log.v(TAG, "childclick position:" + String.valueOf(groupPosition)+ ":" +String.valueOf(childPosition)); return true; } }); } @Override protected void controll() { // TODO Auto-generated method stub new AutoStartScanThread().execute(); } private void showMyDialog(String packageName) { // TODO Auto-generated method stub LayoutInflater layoutInflater = getLayoutInflater(); View dialogView = layoutInflater.inflate(R.layout.activity_strongspeedup_dialog, null); TextView title = (TextView) dialogView.findViewById(R.id.title); TextView positive = (TextView) dialogView.findViewById(R.id.positive); TextView negative = (TextView) dialogView.findViewById(R.id.negative); positive.setOnClickListener(this); negative.setOnClickListener(this); title.setText(packageName); //方法一 ok // AlertDialog.Builder builder = new Builder(this); // alertDialog = builder.create(); // alertDialog.setIcon(Color.parseColor("#FFFFFF")); // alertDialog.setView(dialogView, 0, 0, 0, 0); //去除边框 // alertDialog.show(); //方法二 alpha只对对话布局有影响 不能消除阴影 // AlertDialog alertDialog =new AlertDialog.Builder(this) // .setView(dialogView) // .create(); // Window window = alertDialog.getWindow(); // WindowManager.LayoutParams lp = window.getAttributes(); // lp.width = WindowManager.LayoutParams.WRAP_CONTENT; // lp.height = DisplayUtil.dip2px(mine, 70); // alertDialog.show(); //方法三 自定义失败 // Dialog dialog = null; // MyAlertDialog.Builder customBuilder = new MyAlertDialog.Builder(this); // dialog = customBuilder.create(); // dialog.show(); //方法四 dialog 内容阴影 // alertDialog = new Dialog(mine, R.style.Dialog1); // alertDialog.setContentView(R.layout.activity_strongspeedup_dialog); // alertDialog.show(); //方法五 testDialog 自定义 alertDialog = new MyDialog(mine,280,180,dialogView,R.style.mydialog); alertDialog.show(); } public class AutoStartScanThread extends AsyncTask<Void, Integer, List<List<AutoStartItem>>>{ private CustomProgessDialog progessDialog; @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); progessDialog = new CustomProgessDialog(mine, "test"); progessDialog.setText("扫描中··"); progessDialog.show(); } @Override protected List<List<AutoStartItem>> doInBackground(Void... params) { // TODO Auto-generated method stub childs = new ArrayList<List<AutoStartItem>>(); Intent intent = new Intent("android.intent.action.BOOT_COMPLETED"); List<ResolveInfo> resolveInfo = getPackageManager().queryBroadcastReceivers(intent, PackageManager.GET_DISABLED_COMPONENTS); if(resolveInfo != null && resolveInfo.size() > 0){ ApplicationInfo appInfo; //系统应用 List<ApplicationInfo> systemAppInfos = new ArrayList<ApplicationInfo>(); //白名单 目前没有实现此功能 List<ApplicationInfo> whiteListAppInfos = new ArrayList<ApplicationInfo>(); //普通应用 List<ApplicationInfo> commAppInfos = new ArrayList<ApplicationInfo>(); //已禁止名单 List<ApplicationInfo> forbidenAppInfos = new ArrayList<ApplicationInfo>(); //enableFlag 普通应用广播enable、disable标志 List<Integer> commEnableFlag = new ArrayList<Integer>(); //enableFlag 系统应用广播enable、disable标志 List<Integer> sysEnableFlag = new ArrayList<Integer>(); //ComponnetNames 用在禁止开机自启动项 mComponentNames = new ArrayList<ComponentName>(); for(int i = 0; i < resolveInfo.size(); i++){ appInfo = resolveInfo.get(i).activityInfo.applicationInfo; ComponentName mComponentName = new ComponentName(resolveInfo.get(i).activityInfo.packageName, resolveInfo.get(i).activityInfo.name); mComponentNames.add(mComponentName); int enable = getPackageManager().getComponentEnabledSetting(mComponentName); Log.v(TAG, "enable:"+String.valueOf(enable)); if((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0){ //普通应用 未区分白名单 commEnableFlag.add(Integer.valueOf(enable)); commAppInfos.add(appInfo); }else{ sysEnableFlag.add(Integer.valueOf(enable)); systemAppInfos.add(appInfo); } } List<AutoStartItem> commAppItems = new ArrayList<AutoStartItem>(); // List<AutoStartItem> forbidAppItems = new ArrayList<AutoStartItem>(); List<AutoStartItem> sysAppItems = new ArrayList<AutoStartItem>(); if(commAppInfos.size() > 0){ Log.v(TAG, "commAppInfos size"+String.valueOf(commAppInfos.size())); commAppItems = dataProcess(commAppInfos,commEnableFlag,0); } // if(forbidenAppInfos.size() > 0){ // Log.v(TAG, "commAppInfos size"+String.valueOf(commAppInfos.size())); // forbidAppItems = dataProcess(forbidenAppInfos,0); // } if(systemAppInfos.size() > 0){ Log.v(TAG, "systemAppInfos size"+String.valueOf(systemAppInfos.size())); sysAppItems = dataProcess(systemAppInfos,sysEnableFlag,0); } //child 是ExPandableListAdapter 子列表 childs.add(commAppItems); childs.add(sysAppItems); Log.v(TAG, String.valueOf(resolveInfo.size())); }else{ Log.v(TAG, "resolveInfo is null"); } return childs; } /** * * @param appInfos * @param styleFlags 1=后台启动 0=开机启动 * @return */ private List<AutoStartItem> dataProcess( List<ApplicationInfo> appInfos,List<Integer> enableFlag, int styleFlags) { // TODO Auto-generated method stub String autoStartStyle = null; if(styleFlags == 0){ autoStartStyle = "开机启动"; }else if(styleFlags == 1){ autoStartStyle = "后台启动"; } List<AutoStartItem> ASitems = new ArrayList<AutoStartItem>(); for(int i = 0; i < appInfos.size(); i++){ AutoStartItem item = new AutoStartItem(); item.appIcon = getPackageManager().getApplicationIcon(appInfos.get(i)); item.appPN = appInfos.get(i).packageName; item.appLable =(String) getPackageManager().getApplicationLabel(appInfos.get(i)); item.autoStartStyle = autoStartStyle; item.enableFlag = enableFlag.get(i); ASitems.add(item); } return ASitems; } @Override protected void onPostExecute(List<List<AutoStartItem>> child) { // TODO Auto-generated method stub updataView(child); progessDialog.dismiss(); } } private void updataView(List<List<AutoStartItem>> child) { // TODO Auto-generated method stub if(child != null && child.size() > 0){ Log.v(TAG, "common child size"+String.valueOf(child.get(0).size())); Log.v(TAG, "system child size"+String.valueOf(child.get(1).size())); initAdapterData(child); if(myELAdapter != null) exListView.setAdapter(myELAdapter); exListView.expandGroup(0); exListView.expandGroup(1); } } private void initAdapterData(List<List<AutoStartItem>> childs) { // TODO Auto-generated method stub List<String> groups = new ArrayList<String>(); groups.add("普通应用程序"); groups.add("系统核心程序"); myELAdapter = new MyExpandableListAdapter(this,groups,childs); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch(v.getId()){ case R.id.positive: Log.v(TAG, "positive"); alertDialog.dismiss(); setAutoStart(); break; case R.id.negative: alertDialog.dismiss(); Log.v(TAG, "negative"); break; case R.id.tv_back: this.onBackPressed(); break; } } public String getPackageName() { return packageName; } public void setPackageName(String packageName) { this.packageName = packageName; } private void setAutoStart() { // TODO Auto-generated method stub String forbidOrOpen; ComponentName componentName; int enabled = 0; if(mExpListviewPostion.getGroupPosition() == 0){ componentName = mComponentNames.get(mExpListviewPostion.getChildPosition()); }else //==1 { componentName = mComponentNames.get(childs.get(0).size() + mExpListviewPostion.getChildPosition() + 1); } enabled = childs.get(mExpListviewPostion.getGroupPosition()).get(mExpListviewPostion.getChildPosition()).enableFlag; Log.v(TAG, "修改前 enableflag:" + String.valueOf(enabled)); getPackageManager().setComponentEnabledSetting(componentName, (enabled == 2) ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); enabled = getPackageManager().getComponentEnabledSetting(componentName); Log.v(TAG, "修改后 enableflag:" + String.valueOf(enabled)); childs.get(mExpListviewPostion.getGroupPosition()).get(mExpListviewPostion.getChildPosition()).enableFlag = enabled; myELAdapter.notifyDataSetChanged(); if(enabled == 2){ forbidOrOpen = ":AutoStart is forbidden"; }else{ forbidOrOpen = ":AutoStart is Open"; } Toast.makeText(this, appName + forbidOrOpen, Toast.LENGTH_SHORT).show(); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK)) { this.finish(); return true; }else { return super.onKeyDown(keyCode, event); } } }
[ "iamzhuolei@gmail.com" ]
iamzhuolei@gmail.com
70e462ecdb0c9a48d0f06d95385c2b74460e6ca5
c0efa1280ccc3d24566b139e46c3a1eed73d7625
/app/src/main/java/com/naioush/capture/addPost.java
e91820364d9ca148e46b242c2d1709470619c168
[]
no_license
olalafi1/capture
9699df45c1605beb4558c6350f1947de0b9ef285
81e22bb98d79abacc435a8e7a990d06cbab339a6
refs/heads/main
2023-08-14T18:53:54.864565
2021-09-22T16:59:15
2021-09-22T16:59:15
389,272,105
0
0
null
null
null
null
UTF-8
Java
false
false
8,074
java
package com.naioush.capture; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.Switch; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.tasks.Continuation; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import com.google.firebase.storage.UploadTask; import com.naioush.capture.R; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.text.BreakIterator; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.Locale; import java.util.Map; import static com.naioush.capture.Login.userKey; public class addPost extends AppCompatActivity { SharedPreferences sp; private static final int PICK_PHOTO_FOR_AVATAR =1 ; ImageView img; Button addPost; EditText titleEt; TextView addLocation; Switch privacyS; String formattedDate; RadioButton homeR,compitionR; Uri selectedImageUri; InputStream inputStream; String Date,title,NO_likes,Comments,photo,classification,location,privacy,status; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_post2); sp = getSharedPreferences("loginSaved", Context.MODE_PRIVATE); img=findViewById(R.id.post_photo); addPost=findViewById(R.id.post); titleEt=findViewById(R.id.title); addLocation=findViewById(R.id.addlocation); privacyS=findViewById(R.id.privacy); homeR=findViewById(R.id.home); compitionR=findViewById(R.id.compition); pickImage(); Object calendar = Calendar.getInstance(); java.util.Date c = Calendar.getInstance().getTime(); System.out.println("Current time => " + sp.getString("userKey",null)); SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy", Locale.getDefault()); formattedDate = df.format(c); addPost.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Date=formattedDate; title=titleEt.getText().toString(); NO_likes="0"; Comments = null; FirebaseStorage storage = FirebaseStorage.getInstance(); StorageReference storageRef = storage.getReference(); StorageReference myRef = storageRef.child("images/"+selectedImageUri.getLastPathSegment()); UploadTask uploadTask = myRef.putFile(selectedImageUri); Task<Uri> urlTask = uploadTask.continueWithTask(new Continuation<UploadTask.TaskSnapshot, Task<Uri>>() { @Override public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception { if (!task.isSuccessful()) { throw task.getException(); } // Continue with the task to get the download URL return myRef.getDownloadUrl(); } }).addOnCompleteListener(new OnCompleteListener<Uri>() { @Override public void onComplete(@NonNull Task<Uri> task) { if (task.isSuccessful()) { Uri downloadUri = task.getResult(); photo=downloadUri.toString(); Log.e("URL",downloadUri.toString()+""); if(privacyS.isChecked()){ privacy="private"; } else privacy="public"; if(compitionR.isActivated()){ status="compition"; } else status="home"; addPost(); } else { // Handle failures // ... } } }); } }); classification="1"; addLocation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(addPost.this); alertDialog.setTitle("Add Location"); alertDialog.setMessage("Enter Location"); final EditText input = new EditText(addPost.this); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); input.setLayoutParams(lp); alertDialog.setView(input); alertDialog.setIcon(android.R.drawable.ic_menu_mylocation); alertDialog.setPositiveButton("done", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { input.getText(); location=input.getText().toString(); addLocation.setText(input.getText().toString()); } }); alertDialog.setNegativeButton("الغاء", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); alertDialog.show(); } }); } public void addPost(){ Log.e("user!!!",userKey); FirebaseDatabase FBD=FirebaseDatabase.getInstance(); DatabaseReference DBRef=FBD.getReference("Posts"); String postKey=DBRef.push().getKey(); Post post= new Post(postKey,formattedDate,title,photo,classification,location,privacy,status,userKey); Map<String,String> Post=new HashMap<>(); Post.put("Date",post.Date); Post.put("key",post.key); Post.put("title",post.title); Post.put("photo",post.photo); Post.put("classification",post.classification); Post.put("privacy",post.privacy); Post.put("status",post.status); Post.put("location",post.location); Post.put("createdBy",userKey); DBRef.child(postKey).setValue(post); Toast.makeText(addPost.this,R.string.addedSuccessfully,Toast.LENGTH_LONG).show(); onBackPressed(); } public void pickImage() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); startActivityForResult(intent, PICK_PHOTO_FOR_AVATAR); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == PICK_PHOTO_FOR_AVATAR && resultCode == Activity.RESULT_OK) { if (data == null) { //Display an error return; } try { inputStream = this.getContentResolver().openInputStream(data.getData()); selectedImageUri = data.getData(); img.setImageURI(selectedImageUri); } catch (FileNotFoundException e) { e.printStackTrace(); } //Now you can do whatever you want with your inpustream, save it as file, upload to a server, decode a bitmap... } } }
[ "olalafi297@gmail.com" ]
olalafi297@gmail.com
d2b3e81152440b13ebf10d66571715f0abd7ff48
2afff715ed39e74bbad963b34028b0cd726b6c9b
/app/src/main/java/com/allen/soundrecorder/ui/record/RecordContract.java
435e042f65012a71fbd2640e7e81746ef15d7d60
[]
no_license
princebb/SimpleSoundRecorder
8011b67adc582d7a305d50106ed0b09bf9f21fc4
f1329519fb5c9d2cd26f15909c8679db204d6ad2
refs/heads/master
2020-04-11T01:29:38.757596
2020-03-15T16:10:46
2020-03-15T16:10:46
161,417,273
1
0
null
null
null
null
UTF-8
Java
false
false
568
java
package com.allen.soundrecorder.ui.record; import android.app.Activity; import android.content.Context; import com.allen.soundrecorder.BasePresenter; import com.allen.soundrecorder.BaseView; /** * author: Allen <br> * date: 2018/11/21 18:02<br> * description:sound recording's contract */ public interface RecordContract { interface View extends BaseView<Presenter> { void showRecordingState(); void showNormalState(); } interface Presenter extends BasePresenter { void startRecord(); void stopRecord(); } }
[ "allen@princebb.cn" ]
allen@princebb.cn
f6d4044db25a41f2742d057a2f77ca517ddab001
3561399262feb57c38dbfa179345a69883a63c80
/src/main/java/ca/frar/jjjrmi/jsbuilder/code/JSArrayRead.java
66e4d45568a32880f57499c608901266f3f057ba
[]
no_license
Thaerious/JJJRMI
d6bb076a424d6d80fbadf18a2f5a88f3540d1350
a7e39ce00aa01b2451f2d659e4de5f2369160ab5
refs/heads/master
2023-01-09T07:13:57.954867
2020-07-19T18:20:30
2020-07-19T18:20:30
108,174,300
1
0
null
null
null
null
UTF-8
Java
false
false
860
java
package ca.frar.jjjrmi.jsbuilder.code; import ca.frar.jjjrmi.jsbuilder.JSCodeElement; import ca.frar.jjjrmi.jsbuilder.AbstractJSCodeElement; import static ca.frar.jjjrmi.Global.LOGGER; import spoon.reflect.code.CtArrayRead; public class JSArrayRead extends AbstractJSCodeElement { private final JSCodeElement target; private final JSCodeElement index; public JSArrayRead(CtArrayRead<?> ctArrayRead) { LOGGER.trace(this.getClass().getSimpleName()); target = this.generate(ctArrayRead.getTarget()); index = this.generate(ctArrayRead.getIndexExpression()); } @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(target); builder.append("["); builder.append(index); builder.append("]"); return builder.toString(); } }
[ "ed@frar.ca" ]
ed@frar.ca
3102592d009809a0516fbcba9aef7ceb1421d3b4
28bb340866285c28346eb88533d6f9704f5d0de6
/System/src/RmiServer.java
6243446178d27a25ba2cefec58c766aaa12def3b
[]
no_license
GreenGearX/Time-Consistent-Message-Passing
9902bb4e984fc89a8d1f2f1924bf0f6415845a25
508385c14ec81c6a80ae90384d046191c58b8395
refs/heads/master
2020-09-24T18:36:31.547598
2019-12-20T15:23:47
2019-12-20T15:23:47
225,818,105
0
0
null
null
null
null
UTF-8
Java
false
false
7,251
java
import java.rmi.Naming; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; import java.rmi.registry.*; import java.util.LinkedList; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.Random; public class RmiServer extends UnicastRemoteObject implements RmiServerIntf { static Queue<Message> messages = new LinkedList<>(); static int nextNodeId; static int id; static int numberOfNodes; static int numberOfMessages; static RmiServerIntf nextNode; static TestServerIntf testServer; static NodeInfo[] nodes; static ConcurrentLinkedQueue<Envelope> inbox = new ConcurrentLinkedQueue<>(); static ConcurrentLinkedQueue<Envelope> outbox = new ConcurrentLinkedQueue<>(); static int send_messages = 0; static int received_confirmations = 0; static String testServerIP; static String nextNodeIP; static String ownIP; public RmiServer() throws RemoteException { super(0); // required to avoid the 'rmic' step, see below } public void sendEnvelope(Envelope envelope) throws RemoteException { inbox.add(envelope.clone()); } static public void processEnvelope(Envelope envelope) throws RemoteException { switch (envelope.type) { case Envelope.MESSAGE: handleMessage(envelope); break; case Envelope.CONFIRMATION: handleConfirmation(envelope); break; case Envelope.UPDATE: handleUpdate(envelope); break; } } static public void handleConfirmation(Envelope envelope) throws RemoteException{ if (envelope.destination == id) { // if the confirmation reaches its destination, update the timestamp to the next message updateTimestamp(); received_confirmations++; } else { //otherwise, relay the confirmation outbox.add(envelope.clone()); } } static public void handleMessage(Envelope envelope) throws RemoteException { if (envelope.destination == id) { // if the message has arrived at the destination, send a confirmation back processMessage(envelope.message); outbox.add(new Envelope(null, envelope.senderInfo.id, envelope.senderInfo.clone(), Envelope.CONFIRMATION)); } else { // otherwise, relay the message to the next node outbox.add(envelope.clone()); } } static public void handleUpdate(Envelope envelope) { if (envelope.senderInfo.id == id) { // if the update has arrived back at the node which sent it, ignore it received_confirmations++; } else { // otherwise, change info on the sender and relay the update nodes[envelope.senderInfo.id].nextTimestamp = envelope.senderInfo.nextTimestamp; nodes[envelope.senderInfo.id].done = envelope.senderInfo.done; outbox.add(envelope.clone()); } } static public void processMessage(Message message) throws RemoteException { testServer.getTimestamp(message.timeStamp); } public static void main(String args[]) throws Exception { id = Integer.parseInt(args[0]); numberOfNodes = Integer.parseInt(args[1]); numberOfMessages = Integer.parseInt(args[2]); nextNodeId = (id + 1) % numberOfNodes; Random rand = new Random(999); nodes = new NodeInfo[numberOfNodes]; testServerIP = args[4]; nextNodeIP = args[3]; ownIP = args[5]; for (int i = 0; i < numberOfNodes; i++) { nodes[i] = new NodeInfo(i); } // generate messages {int i = 0; while(messages.size() < numberOfMessages / numberOfNodes) { if (id == rand.nextInt(numberOfNodes + 20)) { // StringBuilder sb = new StringBuilder(); // int someRand = rand.nextInt(); // sb.append(String.valueOf(someRand).repeat(10000)); // messages.add(new Message(sb.toString(), i, i)); messages.add(new Message("KcZC8tdeIh7tfKMQFrU3nQlamhcOkExst2BAorW5luzSArTZPL6T4KnGsxOa1yb0", i, i)); System.out.println(i); } i++; }} // listen for previous node try { //special exception handler for registry creation LocateRegistry.createRegistry(1099); } catch (RemoteException e) { //do nothing, error means registry already exists } //Instantiate RmiServer System.setProperty("java.rmi.server.hostname", ownIP); RmiServer server = new RmiServer(); Naming.rebind("//"+ ownIP + "/" + args[0], server); // connect to next node while (true) { try { nextNode = (RmiServerIntf) Naming.lookup("//" + nextNodeIP + "/" + nextNodeId); break; } catch (Exception e) { } } // connect to test server while (true) { try { testServer = (TestServerIntf) Naming.lookup("//"+ testServerIP +"/" + "test"); break; } catch (Exception e) { } } // broadcast initial nextTimeStamp updateTimestamp(); while (true) { while (inbox.size() > 0) { processEnvelope(inbox.remove()); } while (outbox.size() > 0) { nextNode.sendEnvelope(outbox.remove()); } if (messages.size() > 0 && !nodes[id].done && nodes[id].nextTimestamp == minTimestamp(nodes) && nodes[id].nextTimestamp == messages.peek().timeStamp) { outbox.add(new Envelope(messages.peek(), nodeDestination(messages.remove().destination), nodes[id].clone(), Envelope.MESSAGE)); send_messages++; } if (allNodesDone(nodes) && inbox.size() == 0 && outbox.size() == 0 && send_messages == received_confirmations) { System.exit(0); } } } static void updateTimestamp() throws RemoteException{ if (messages.size() > 0) { // if there is a message in the queue, set the next timestamp nodes[id].nextTimestamp = messages.peek().timeStamp; } else { // otherwise, the node is done testServer.updateDone(); nodes[id].done = true; } outbox.add(new Envelope(null, id, nodes[id].clone(), Envelope.UPDATE)); send_messages++; } static int minTimestamp(NodeInfo[] nodes) { int result = nodes[id].nextTimestamp; for (int i = 0; i < nodes.length; i++) { if (!nodes[i].done) { result = Integer.min(result, nodes[i].nextTimestamp); } } return result; } static int nodeDestination(int destination) { return destination % numberOfNodes; } static boolean allNodesDone(NodeInfo[] nodes) { boolean allDone = true; for (int i = 0; i < nodes.length; i++) { allDone = allDone && nodes[i].done; } return allDone; } }
[ "g.p.s.frankhuizen@vu.nl" ]
g.p.s.frankhuizen@vu.nl
681fc9e7391447d301eaa0c0524e4b32faa9175b
07e12d96f32b26ac3071f41976073a7d305d1fd7
/src/main/java/com/zhongtian/datascene/auth/service/IUserService.java
dd32dec492484b9d5e428c37d008af2703f67f6a
[]
no_license
yvwulei/datascene
aa9577ef4fa9f38fc9517db02cf94cc63f2574fc
32290d62e395d0cd88f5852281bdfa122f4fba22
refs/heads/master
2021-01-10T00:58:16.058378
2016-03-17T04:30:39
2016-03-17T04:30:39
53,109,756
0
0
null
null
null
null
UTF-8
Java
false
false
1,023
java
package com.zhongtian.datascene.auth.service; import java.util.List; import com.zhongtian.datascene.auth.vo.UserEntity; import com.zhongtian.datascene.auth.web.viewvo.UserViewVO; public interface IUserService { /** * 将用户注册页面信息的model对象存入数据库 * @param model * @return */ public UserEntity addUser(UserViewVO user); /** * 根据用户名字判断此用户是否应经被注册 true:已被注册false:未被注册 * @param username * @return */ public Boolean userExist(String username); /** * 通过用户名和密码验证用户合法性 * @param username * @param password * @return */ public UserEntity findUser(String username, String password); /** * 通过用户名查找用户 * @param username * @return */ public UserEntity findUser(String username); /** * 查找所有用户 * @return */ public List<UserEntity> findAllUsers(); }
[ "4201870@qq.com" ]
4201870@qq.com
97a33a2486cfd6503b2e31c83333be65f6ae6988
c8655251bb853a032ab7db6a9b41c13241565ff6
/jframe-utils/src/main/java/com/alipay/api/domain/KoubeiAdvertCommissionAdvchannelBindModel.java
b2ea0242adfe0551f275872515ef0790d8cacfdd
[]
no_license
jacksonrick/JFrame
3b08880d0ad45c9b12e335798fc1764c9b01756b
d9a4a9b17701eb698b957e47fa3f30c6cb8900ac
refs/heads/master
2021-07-22T21:13:22.548188
2017-11-03T06:49:44
2017-11-03T06:49:44
107,761,091
1
0
null
null
null
null
UTF-8
Java
false
false
979
java
package com.alipay.api.domain; import java.util.List; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; import com.alipay.api.internal.mapping.ApiListField; /** * 添加广告的渠道关系接口 * * @author auto create * @since 1.0, 2017-01-17 10:33:28 */ public class KoubeiAdvertCommissionAdvchannelBindModel extends AlipayObject { private static final long serialVersionUID = 3791739828686872555L; /** * 广告id */ @ApiField("adv_id") private String advId; /** * 渠道ID列表 */ @ApiListField("channel_id_list") @ApiField("string") private List<String> channelIdList; public String getAdvId() { return this.advId; } public void setAdvId(String advId) { this.advId = advId; } public List<String> getChannelIdList() { return this.channelIdList; } public void setChannelIdList(List<String> channelIdList) { this.channelIdList = channelIdList; } }
[ "809573150@qq.com" ]
809573150@qq.com
489880935b0a2d8c6ea2c51d99f697a03f72fc31
77abb8ca6b451cf47f31e92c1c2bc235a570f768
/src/main/java/com/example/demo/EasymovBackEndApplication.java
2ee1edd86439578882ef21adbdc820fd902e8fe1
[]
no_license
ademait/EasyMov-BackEnd
c11917e9630953e78907fbeb7d08c6754cbfb505
7ce84299f9eb2fe3f1ed2d965aece0f2012f8af3
refs/heads/master
2021-01-04T03:11:57.913007
2020-02-13T20:32:22
2020-02-13T20:32:22
240,351,927
0
0
null
null
null
null
UTF-8
Java
false
false
326
java
package com.example.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class EasymovBackEndApplication { public static void main(String[] args) { SpringApplication.run(EasymovBackEndApplication.class, args); } }
[ "fontbx@gmail.com" ]
fontbx@gmail.com
3e84bfaadac6db74b86984e91222d9fe433c376f
268e768f9d749849166d2d6001b484d2063e9afa
/app/src/main/java/com/datalicious/demo/datalicious/Tweet.java
b335a5d5349ed3346c3ece3c7c378180bc7c7bf9
[]
no_license
adityakumarb92/Datalicious
64a5af9634e23c5c42a29a5a5f4d48481a05e35c
d2462fc73e4add17b43203091e9a5ab2f7422e89
refs/heads/master
2021-01-18T21:17:56.826507
2016-06-06T03:12:41
2016-06-06T03:12:41
60,494,967
0
0
null
null
null
null
UTF-8
Java
false
false
106
java
package com.datalicious.demo.datalicious; /** * Created by enguru on 6/6/16. */ public class Tweet { }
[ "sjaideepp93@gmail.com" ]
sjaideepp93@gmail.com
dbefbe6c7781a0511b693f667bf39a952eda2812
996e64b72adc1aab9d49340a7048e146d1472f92
/Developpement_Android_TPDesing-master/ChannelMessaging/app/src/main/java/albion/shabani/channelmessaging/Acticity/ChannelActivity.java
66767d9841497b01d521e696d112bef6107df47d
[]
no_license
AlbionS/Evento_France
f96e7af27c5491ded10fd9d51ebe73531d1251ca
52b5a69edb810b4a515f3ac74c53ffc2a208dac2
refs/heads/master
2020-03-19T17:06:46.787780
2018-06-09T15:30:57
2018-06-09T15:30:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
459
java
package albion.shabani.channelmessaging.Acticity; import android.app.Activity; import android.os.Bundle; import albion.shabani.channelmessaging.R; /** * Created by shabania on 22/01/2018. */ public class ChannelActivity extends Activity { public ChannelActivity() { } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.channelactivity); } }
[ "albi.dony@hotmail.com" ]
albi.dony@hotmail.com
9117a0cf196611c8070e6a12c9153cc1863bddf2
c13e56d75bee1d85a816d419de512e32a50466f7
/app/src/main/java/net/multimeter/iot/chart/units/TimeBase.java
e36d8cfa776d953f4a9069849e41bfa240d53ad1
[]
no_license
binhdev/Multimeter
3ab71ddee409393d1d54823466e7a866b6777d4b
85fa4f9c6dd2f59258d80e2b6144993c5e573375
refs/heads/master
2020-04-07T06:35:16.803727
2018-12-09T15:58:51
2019-01-03T15:34:55
158,141,887
0
0
null
2018-11-30T02:00:01
2018-11-19T00:46:03
Java
UTF-8
Java
false
false
1,299
java
package net.multimeter.iot.chart.units; import java.util.HashMap; import java.util.Map; public enum TimeBase { HDIV_1mS(0.001f), HDIV_2mS(0.002f), HDIV_5mS(0.005f), HDIV_10mS(0.01f), HDIV_20mS(0.02f), HDIV_50mS(0.05f), HDIV_100mS(0.1f), HDIV_200mS(0.2f); /* renamed from: I */ private static TimeBase[] values; /* renamed from: J */ private float mValue; static { values = TimeBase.values(); } private TimeBase(float i) { this.mValue = i; } /* renamed from: a */ public float value() { return this.mValue; } private static final Map<Float, TimeBase> _map = new HashMap<>(); static { for (TimeBase timeBase : TimeBase.values()) _map.put(timeBase.mValue, timeBase); } /** * Get difficulty from value * @param value Value * @return Difficulty */ public static TimeBase from(float value) { return _map.get(value); } public static int size() { return values().length; } public static float[] getRange() { float[] arr = new float[_map.size()]; for(int i=0; i < TimeBase.values().length; i++){ arr[i] = TimeBase.values()[i].value(); } return arr; } }
[ "ttbinh@hueic.edu.vn" ]
ttbinh@hueic.edu.vn
1886819ab051622ee5808f26f266b848bf05d1d8
550365a6bba8eb1235e325be4291d01c0d6e6896
/ProveedorServicios/src/ar/edu/unicen/exa/galvarez/patogis/servidor/logica/EspecieMapper.java
60ff9570e0948aa7cd4bba7384157e158f5c2fca
[]
no_license
gabriel-tandil/PatoGIS
4f0943c325a901f6c802b26a7d619dc913da7d7f
eecb09a5017cf3178fe3b043983cb242a06abf45
refs/heads/master
2020-05-19T15:44:58.726314
2012-12-26T00:42:21
2012-12-26T00:42:21
2,019,144
1
0
null
null
null
null
UTF-8
Java
false
false
2,829
java
package ar.edu.unicen.exa.galvarez.patogis.servidor.logica; import ar.edu.unicen.exa.galvarez.patogis.servidor.modelo.Especie; import ar.edu.unicen.exa.galvarez.patogis.servidor.modelo.EspecieExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface EspecieMapper { /** * This method was generated by MyBatis Generator. This method corresponds to the database table public.especie * @mbggenerated Tue Oct 25 20:22:19 ART 2011 */ int countByExample(EspecieExample example); /** * This method was generated by MyBatis Generator. This method corresponds to the database table public.especie * @mbggenerated Tue Oct 25 20:22:19 ART 2011 */ int deleteByExample(EspecieExample example); /** * This method was generated by MyBatis Generator. This method corresponds to the database table public.especie * @mbggenerated Tue Oct 25 20:22:19 ART 2011 */ int deleteByPrimaryKey(Integer id); /** * This method was generated by MyBatis Generator. This method corresponds to the database table public.especie * @mbggenerated Tue Oct 25 20:22:19 ART 2011 */ int insert(Especie record); /** * This method was generated by MyBatis Generator. This method corresponds to the database table public.especie * @mbggenerated Tue Oct 25 20:22:19 ART 2011 */ int insertSelective(Especie record); /** * This method was generated by MyBatis Generator. This method corresponds to the database table public.especie * @mbggenerated Tue Oct 25 20:22:19 ART 2011 */ List<Especie> selectByExample(EspecieExample example); /** * This method was generated by MyBatis Generator. This method corresponds to the database table public.especie * @mbggenerated Tue Oct 25 20:22:19 ART 2011 */ Especie selectByPrimaryKey(Integer id); /** * This method was generated by MyBatis Generator. This method corresponds to the database table public.especie * @mbggenerated Tue Oct 25 20:22:19 ART 2011 */ int updateByExampleSelective(@Param("record") Especie record, @Param("example") EspecieExample example); /** * This method was generated by MyBatis Generator. This method corresponds to the database table public.especie * @mbggenerated Tue Oct 25 20:22:19 ART 2011 */ int updateByExample(@Param("record") Especie record, @Param("example") EspecieExample example); /** * This method was generated by MyBatis Generator. This method corresponds to the database table public.especie * @mbggenerated Tue Oct 25 20:22:19 ART 2011 */ int updateByPrimaryKeySelective(Especie record); /** * This method was generated by MyBatis Generator. This method corresponds to the database table public.especie * @mbggenerated Tue Oct 25 20:22:19 ART 2011 */ int updateByPrimaryKey(Especie record); List<Especie> selectConCantidadObs(); }
[ "gabriel.tandil@gmail.com" ]
gabriel.tandil@gmail.com
917b831c4ec69a5e456c9b90eabf7a6e338feef2
1594dd260cb1c0799a718e4273c92b1be0806255
/src/main/java/SpringPractice/entity/Comment.java
ec12a16dae2b9a3d3e2f2fb8d090e1084ed10450
[]
no_license
imdshare/SpringPractice
56a79e86c07c80291b47f62302c3b5be84c0d448
a0c1feb61b3f68187dea0ad7c26b1a497e3efc05
refs/heads/master
2023-02-15T06:56:39.764198
2021-01-14T08:55:41
2021-01-14T08:55:41
317,116,702
0
0
null
null
null
null
UTF-8
Java
false
false
969
java
package SpringPractice.entity; import java.time.LocalDate; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EntityListeners; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import lombok.Data; @Data @EntityListeners(AuditingEntityListener.class) @Entity public class Comment { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long commentNo; //댓글 번호 @Column (nullable = false) private Long boardNo; // 게시물 번호 @Column private String writerNm; // 작성자 이름 @Column (nullable = false) private String writerId; // 작성자 아이디 @Column private String comment; // 댓글내용 @CreatedDate @Column(updatable = false) //등록 날짜 private LocalDate regDt; }
[ "jihye@jihyepc" ]
jihye@jihyepc
b994a7ce83361520bb525631af0ad2182c4d8a39
21a86e9664c4c2d176353358de566f5074d9dce9
/src/main/java/com/example/repository/CarRepositoryImpl.java
1e294ac88436d43968a53f0ef31a758b587f699c
[]
no_license
Pyshankov/optimistic_locking
746ba5a85059df13c8cd2c5c40faf24bce331b40
464bb05a907941cb430b81151b2984198cc78903
refs/heads/master
2021-01-17T08:42:04.210726
2016-08-09T12:29:44
2016-08-09T12:29:44
61,894,576
0
0
null
null
null
null
UTF-8
Java
false
false
613
java
package com.example.repository; import com.example.domain.Car; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.stereotype.Repository; /** * Created by pyshankov on 01.08.16. */ @Component public class CarRepositoryImpl extends OptimisticRepository<Car,Long> { @Autowired private CarRepository repository; @Override protected Car performSave(Car s) { return repository.save(s); } @Override protected Car performGet(long aLong) { return repository.findOne(aLong); } }
[ "pyshankov@gmail.com" ]
pyshankov@gmail.com
569a6887d30c285f935239c31ff04f5450ea72c4
22b4b05601995186cc05ded4a9e3d34d46f38a30
/src/main/java/rozetka/steps/CheckoutWindowPageBL.java
614ae23ca3973f9a9d6fd441506932d235acfbde
[]
no_license
Alex7mob1/Epam-Jenkins-HW12
17936cff51002c2fbad2d51f476ed0570e24660d
92e3c7ccfcf39af569f1a28f3e57fd3b72cc3d19
refs/heads/master
2023-08-10T23:49:53.840634
2021-09-20T11:16:58
2021-09-20T11:16:58
407,979,663
0
0
null
null
null
null
UTF-8
Java
false
false
395
java
package rozetka.steps; import rozetka.pages.CheckoutWindowPage; public class CheckoutWindowPageBL { private CheckoutWindowPage checkoutWindowPage; public CheckoutWindowPageBL() { checkoutWindowPage = new CheckoutWindowPage(); } public CheckoutPageBL clickOnCheckoutBtn() { checkoutWindowPage.clickOnCheckoutBtn(); return new CheckoutPageBL(); } }
[ "oles.mob1@gmail.com" ]
oles.mob1@gmail.com
438611bda68910bcb11b04c430df8e7792957e95
4e8d52f594b89fa356e8278265b5c17f22db1210
/WebServiceArtifacts/BookingAPI/_170/_0/_168/_192/tt/bookingapi/ArrayOfWSTicket.java
571153579815fee8b9a044f87738f815cc656bbd
[]
no_license
ouniali/WSantipatterns
dc2e5b653d943199872ea0e34bcc3be6ed74c82e
d406c67efd0baa95990d5ee6a6a9d48ef93c7d32
refs/heads/master
2021-01-10T05:22:19.631231
2015-05-26T06:27:52
2015-05-26T06:27:52
36,153,404
1
2
null
null
null
null
UTF-8
Java
false
false
1,893
java
package _170._0._168._192.tt.bookingapi; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for ArrayOfWSTicket complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="ArrayOfWSTicket"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="WSTicket" type="{http://192.168.0.170/TT/BookingAPI}WSTicket" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ArrayOfWSTicket", propOrder = { "wsTicket" }) public class ArrayOfWSTicket { @XmlElement(name = "WSTicket", nillable = true) protected List<WSTicket> wsTicket; /** * Gets the value of the wsTicket property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the wsTicket property. * * <p> * For example, to add a new item, do as follows: * <pre> * getWSTicket().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link WSTicket } * * */ public List<WSTicket> getWSTicket() { if (wsTicket == null) { wsTicket = new ArrayList<WSTicket>(); } return this.wsTicket; } }
[ "ouni_ali@yahoo.fr" ]
ouni_ali@yahoo.fr
896991638dd55f5316bf66656f83288eb73d341f
e4471ff5585f0a9c6f2beab465fd013febca0c80
/demo/src/main/java/com/example/demo/repo/dao/impl/ImageDAOImpl.java
bbe98a91b83b96bfe5d267263de637c45846add2
[]
no_license
TerenceFung90/spring-boot-angular-demo
8fca0a87ae5a162e9fcb1ba7d7caab4ea7ea4bbf
2bf853e3edd4674214e0c7bcdc01c77d2128b932
refs/heads/master
2023-07-22T04:09:27.458220
2023-07-09T18:22:54
2023-07-09T18:22:54
233,751,950
0
0
null
2023-07-09T18:22:55
2020-01-14T03:53:53
TypeScript
UTF-8
Java
false
false
814
java
package com.example.demo.repo.dao.impl; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; import org.springframework.stereotype.Repository; import com.example.demo.repo.dao.ImageDAOCustom; import com.example.demo.repo.model.Image; @Repository public class ImageDAOImpl implements ImageDAOCustom { @PersistenceContext EntityManager entityManager; @SuppressWarnings("unchecked") @Override public List<Image> findByCriteriaAndPage(Boolean autoCorrect, Integer pageNumber, Integer pageSize, String q, Boolean safeSearch) { Query query = entityManager.createQuery("From Image"); query.setFirstResult((pageNumber-1) * pageSize); query.setMaxResults(pageSize); return query.getResultList(); } }
[ "57140421+TerenceFung90@users.noreply.github.com" ]
57140421+TerenceFung90@users.noreply.github.com
23ff26c753a962201d2988e9a9db75b53441cef5
c0150f98771ce8cecd2ac88e46f57810abebef81
/src/main/java/fr/m2i/exoSpring/ExoSpringApplication.java
31155f8b20b246f9b701bdd36b8a8e42c7138dd5
[]
no_license
ValereGB/ExoSpring
443662b8662280ae5ad8c7e64a22a48b36193b78
4ba9c46cf1f10a2f79a91271e2bfd905b0249411
refs/heads/main
2023-02-25T14:26:29.227751
2021-01-22T15:26:31
2021-01-22T15:26:31
331,976,136
0
0
null
null
null
null
UTF-8
Java
false
false
315
java
package fr.m2i.exoSpring; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ExoSpringApplication { public static void main(String[] args) { SpringApplication.run(ExoSpringApplication.class, args); } }
[ "valeregbv@gmail.com" ]
valeregbv@gmail.com
2331d2bea51de733132bb4ce07a57a457bc4ca34
feefb2aad2b70f1e66936b61439685782682cb94
/jlatex/jlatex.api/src/main/java/jlatex/organization/LatexSubSection.java
9bdd6d18c4b3eeed01fde79ac3102883885b6c41
[ "MIT" ]
permissive
bashterm/JLatex
3192d2026ccd2fd1408a2203bb8660252d18c43f
31cd37bf40a70406f7d3c0ef6f60b4522ea6780a
refs/heads/master
2022-11-05T13:38:27.039248
2022-10-19T06:55:01
2022-10-19T06:55:01
92,948,683
0
1
MIT
2022-01-04T12:58:28
2017-05-31T13:30:43
Java
UTF-8
Java
false
false
269
java
package jlatex.organization; /** * Represents a \\subsection{name} * * @author Michael Oland * */ public class LatexSubSection extends LatexDivision<LatexSubSection> { /** * Creates the subsection */ public LatexSubSection() { super("subsection"); } }
[ "michael@uthanda.com" ]
michael@uthanda.com
c1d5f81220ae1a2c252210323ef46eb645fb4499
a13afae04178040b185dbd282e61ab3a3b57921e
/src/main/java/com/udacity/sandwichclub/IngredientsFragment.java
d5e153d4e8e40f2cca4b8c04c457e810b1733b1a
[]
no_license
gulsahbulan/SandwichClub
c0c3619fb6e2ce9743af7c08b2bfec9969d03dcd
56e7660070299294efda3d7b87de6dc1f83e6f71
refs/heads/master
2022-06-17T23:39:51.741324
2020-05-12T05:50:08
2020-05-12T05:50:08
263,207,176
0
0
null
null
null
null
UTF-8
Java
false
false
2,676
java
package com.udacity.sandwichclub; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.text.TextUtils; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import com.udacity.sandwichclub.databinding.IngredientsFragmentBinding; import com.udacity.sandwichclub.model.Sandwich; import java.util.ArrayList; import java.util.List; public class IngredientsFragment extends Fragment { private static final String INGREDIENTS = "ingredients"; private List<String> ingredientsList; public IngredientsFragment() { } static IngredientsFragment newInstance(Sandwich sandwich) { IngredientsFragment ingredientsFragment = new IngredientsFragment(); Bundle bundle = new Bundle(); bundle.putStringArrayList(INGREDIENTS, (ArrayList<String>) sandwich.getIngredients()); ingredientsFragment.setArguments(bundle); return ingredientsFragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle bundle = this.getArguments(); if (bundle != null) { ingredientsList = getArguments().getStringArrayList(INGREDIENTS); } } private void init(IngredientsFragmentBinding binding) { if (ingredientsList != null && !ingredientsList.isEmpty()) { // Convert the ingredientsList to a String separated with delimiter String ingredients = TextUtils.join("\n\n", capitalizeFirstLetter(ingredientsList)); // Set the text on the ingredientsTv TextView binding.ingredientsTv.setText(ingredients); } else { // Set the view invisible without taking up space in the layout binding.ingredientsTv.setVisibility(View.GONE); } } @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { IngredientsFragmentBinding binding = IngredientsFragmentBinding.inflate(inflater, container, false); View view = binding.getRoot(); init(binding); return view; } private ArrayList<String> capitalizeFirstLetter(List<String> ingredients) { ArrayList<String> output = new ArrayList<String>(); for (String ingredient : ingredients) { String item = "⦿ " + ingredient.substring(0, 1).toUpperCase() + ingredient.substring(1).toLowerCase(); output.add(item); } return output; } }
[ "gulsah.bulan@gmail.com" ]
gulsah.bulan@gmail.com
edda1fa1da66fdc93fff6cbe1a9b5da2eeb709fb
c64058d1675bfc3c89790a54221fa5cf68291fdf
/sintaxe-variaveis-e-fluxo/src/Variaveis/TesteIR.java
c5a81f94367234fc42950d2d99b550ea112b8655
[]
no_license
diogo-luzardo/Java
ee868409d4b71f134e405fb93f09a25ae40b47da
793fa8f565827062aeb74a869d670fbd11adbd1f
refs/heads/master
2022-12-22T10:00:28.868023
2020-01-26T10:07:20
2020-01-26T10:07:20
217,701,583
0
0
null
2022-12-15T23:57:23
2019-10-26T11:53:56
HTML
ISO-8859-1
Java
false
false
709
java
package Variaveis; public class TesteIR { public static void main(String[] args) { double salario = 5000.0; if(salario >= 1900.0 && salario <= 2800.0) { System.out.println("o IR é de 7.5% e pode deduzir na declaração o valor de R$ 142"); } else if(salario >= 2900.01 && salario <= 3751.0) { System.out.println("o IR é de 15% e pode deduzir R$ 350"); } else if(salario >= 3752.0 && salario <= 4667.0) { System.out.println("o IR é de 22.5% e pode deduzir R$ 636"); } else if(salario > 4664.0) { System.out.println("Seu IR é de 27.5% e pode deduzir na declaraç R$ 1.282,6" ); } else { System.out.println("você não entra no regime de IR"); } } }
[ "54155950+diogo-luzardo@users.noreply.github.com" ]
54155950+diogo-luzardo@users.noreply.github.com
0468679895fbc7a414161669bb35409670168024
ff37f31b88bd52714431fe3c7d796a70580e1936
/src/main/java/dev/runefox/ptg/noise/simplex/InverseFractalSimplex2D.java
598b8f78e5a15c588f3e1a7ca559c46bbf21538b
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
FoxSamu/PTG
0208584bc89615fe0e4ab018ab4d89e6d4713175
26dcb87936aee6e566bcc0f556799bdd96ca4771
refs/heads/master
2023-06-23T13:03:38.343688
2023-06-17T12:25:59
2023-06-17T12:25:59
227,571,299
0
0
null
null
null
null
UTF-8
Java
false
false
2,800
java
/* * Copyright (c) 2023 Runefox Dev * Licensed under Apache 2.0 license */ package dev.runefox.ptg.noise.simplex; import dev.runefox.ptg.noise.BaseNoise2D; /** * Inverse-Fractal-Simplex noise generator for 2D space. This generator uses a specified amount of {@link * Simplex2D}-instances as octaves. */ public class InverseFractalSimplex2D extends BaseNoise2D { private final Simplex2D[] noiseOctaves; /** * Constructs a Inverse-Fractal-Simplex noise generator. * * @param seed The seed, may be any {@code int}. * @param octaves The amount of octaves. */ public InverseFractalSimplex2D(int seed, int octaves) { super(seed); if (octaves < 1) { throw new IllegalArgumentException("There should be at least one octave."); } noiseOctaves = new Simplex2D[octaves]; for (int i = 0; i < octaves; i++) { noiseOctaves[i] = new Simplex2D(seed + i); } } /** * Constructs a Inverse-Fractal-Simplex noise generator. * * @param seed The seed, may be any {@code int}. * @param scale The coordinate scaling along every axis. * @param octaves The amount of octaves. */ public InverseFractalSimplex2D(int seed, double scale, int octaves) { super(seed, scale); if (octaves < 1) { throw new IllegalArgumentException("There should be at least one octave."); } noiseOctaves = new Simplex2D[octaves]; for (int i = 0; i < octaves; i++) { noiseOctaves[i] = new Simplex2D(seed); } } /** * Constructs a Fractal-Simplex noise generator. * * @param seed The seed, may be any {@code int}. * @param scaleX The coordinate scaling along X axis. * @param scaleY The coordinate scaling along Y axis. * @param octaves The amount of octaves. */ public InverseFractalSimplex2D(int seed, double scaleX, double scaleY, int octaves) { super(seed, scaleX, scaleY); if (octaves < 1) { throw new IllegalArgumentException("There should be at least one octave."); } noiseOctaves = new Simplex2D[octaves]; for (int i = 0; i < octaves; i++) { noiseOctaves[i] = new Simplex2D(seed); } } @Override public double generate(double x, double y) { x /= scaleX; y /= scaleY; double d = 1; double n = 0; for (Simplex2D noise : noiseOctaves) { n += noise.generate(x / d, y / d) * d; d *= 2; } return n; } @Override public void setSeed(int seed) { this.seed = seed; for (Simplex2D noise : noiseOctaves) { noise.setSeed(seed++); } } }
[ "onankman@gmail.com" ]
onankman@gmail.com
a37e561ae7db1e638601eff97249dd73c10a26f1
d0c63f293cd2ab0032f14e034a4ae46739d5d18c
/Java 163 AA/chapter 3/Lesson - 3 Andrew Meiling/Interest.java
7d0c314fb06b8ab4eebbb96b7d045361699c546d
[]
no_license
AndrewSC208/Java-163-AA
0501b331d2d47fafc4001a99653a16a35817ae16
3287e2df67eeda69b75c3d7fb35967eda31e3f23
refs/heads/master
2021-01-12T17:22:08.224822
2016-09-28T17:23:29
2016-09-28T17:23:29
69,486,738
0
0
null
null
null
null
UTF-8
Java
false
false
1,124
java
/* Filename Interest.java */ /* Written by Andrew Meiling */ /* Written on February 15th, 2014 */ /* Chapter 3 */ /* Exercise # 8 */ /* Pg 152 */ /* CIS163AA - Java Programming: level 1 */ /* Class # 11681 */ import javax.swing.JOptionPane; public class Interest { public static void main(String[] args) { // Method Calls: interestCalculation(promptUserAmount()); } // user prompt method: public static double promptUserAmount() { // variables double startAmount; String startAmountString; startAmountString = JOptionPane.showInputDialog(null, "What is the starting value of the investment?", "Starting value dialog", JOptionPane.QUESTION_MESSAGE); startAmount = Double.parseDouble(startAmountString); return startAmount; } // interestCalculation method: public static void interestCalculation(double x) { // Variables final double INTEREST_RATE = .05; double amount; double total; // Math: amount = INTEREST_RATE * x; total = amount + x; // Print statement: System.out.println("The total is of the investment after a five percent increase is: $" + total); } }
[ "ameiling@ameiling2-w7.luthresearch.net" ]
ameiling@ameiling2-w7.luthresearch.net
63cf4fcf583260e45ddfc24564acf463a0bef2c3
b57cca88d26063f81caeb9736c07e9552f5dc943
/gen/com/example/control/R.java
301e89656b3993eb28c6943b7dd1d401a633e947
[]
no_license
mhajabi/control
151d4aa9ca2869637d412f6bd2ed34a9ea4fc236
4c55db6dd71a892d82acf1e80d2f8fa8825f44f5
refs/heads/master
2020-08-06T15:33:25.276859
2014-01-24T18:03:34
2014-01-24T18:03:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,445
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.example.control; public final class R { public static final class anim { public static final int rotate=0x7f040000; } public static final class attr { } public static final class dimen { /** Default screen margins, per the Android Design guidelines. Customize dimensions originally defined in res/values/dimens.xml (such as screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. */ public static final int activity_horizontal_margin=0x7f050000; public static final int activity_vertical_margin=0x7f050001; } public static final class drawable { public static final int gear=0x7f020000; public static final int ic_launcher=0x7f020001; public static final int loading=0x7f020002; public static final int wallpaper1=0x7f020003; public static final int wallpaper2=0x7f020004; public static final int wifi_1_secured=0x7f020005; public static final int wifi_1_unsecured=0x7f020006; public static final int wifi_1secured=0x7f020007; public static final int wifi_2_secured=0x7f020008; public static final int wifi_2_unsecured=0x7f020009; public static final int wifi_3_secured=0x7f02000a; public static final int wifi_3_unsecured=0x7f02000b; } public static final class id { public static final int PHONE=0x7f09001e; public static final int TV=0x7f09001d; public static final int action_settings=0x7f09001a; public static final int btnAudio=0x7f09000e; public static final int btnBluetooth=0x7f09000d; public static final int btnBluetoothState=0x7f090013; public static final int btnCancel=0x7f09000b; public static final int btnIrOFF=0x7f090001; public static final int btnIrON=0x7f090000; public static final int btnNo=0x7f090018; public static final int btnON=0x7f090002; public static final int btnOk=0x7f090009; public static final int btnPhone=0x7f090007; public static final int btnTurrnOFF=0x7f090017; public static final int btnTv=0x7f090006; public static final int btnWifi=0x7f09000f; public static final int btnWifiState=0x7f090012; public static final int etPass=0x7f09000a; public static final int group1=0x7f09001c; public static final int ivImage=0x7f090004; public static final int ivLoading=0x7f090015; public static final int lvElements=0x7f090005; public static final int sbAudio=0x7f090011; public static final int settings=0x7f09001b; public static final int tvAudio=0x7f090010; public static final int tvInfo=0x7f090008; public static final int tvMessage=0x7f090016; public static final int tvScanning=0x7f090014; public static final int tvText=0x7f090003; public static final int tvTitle=0x7f090019; public static final int tvinput=0x7f09000c; } public static final class layout { public static final int activity_tv=0x7f030000; public static final int element_layout=0x7f030001; public static final int elements_view=0x7f030002; public static final int main_landscape=0x7f030003; public static final int main_portrait=0x7f030004; public static final int password=0x7f030005; public static final int phone_landscape=0x7f030006; public static final int phone_portrait=0x7f030007; public static final int scanning=0x7f030008; public static final int turn_off=0x7f030009; } public static final class menu { public static final int element=0x7f080000; public static final int main=0x7f080001; public static final int phone=0x7f080002; public static final int tv=0x7f080003; } public static final class string { public static final int action_settings=0x7f060001; public static final int app_name=0x7f060000; public static final int hello_world=0x7f060002; public static final int title_activity_element=0x7f060004; public static final int title_activity_tv=0x7f060003; } public static final class style { /** Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. API 11 theme customizations can go here. Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. API 14 theme customizations can go here. */ public static final int AppBaseTheme=0x7f070000; /** Application theme. */ public static final int AppTheme=0x7f070001; } }
[ "mhajabi@yahoo.com" ]
mhajabi@yahoo.com
73ba22da1c0f083bafbcb9dc19afc2c4755c6411
72cbb22560559912fc1a2ab4b6348fe111a66cb0
/spring-restdocs-core/src/main/java/org/springframework/restdocs/payload/PayloadHandlingException.java
38bc2bf0ff4c2c560fe5dfff102367e96d82c84d
[ "Apache-2.0" ]
permissive
helpermethod/spring-restdocs
2ef199ae1bc67a7cc42bff2adfd5cccd3854d65f
24c1746b363d08a0d369565134ef338cd8069350
refs/heads/master
2020-04-01T23:52:36.071654
2018-10-04T11:26:50
2018-10-04T11:26:50
153,777,173
1
0
null
2018-10-19T12:09:31
2018-10-19T12:09:30
null
UTF-8
Java
false
false
1,278
java
/* * Copyright 2014-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.restdocs.payload; /** * Thrown to indicate that a failure has occurred during payload handling. * * @author Andy Wilkinson * */ @SuppressWarnings("serial") class PayloadHandlingException extends RuntimeException { /** * Creates a new {@code PayloadHandlingException} with the given {@code message}. * @param message the message * @since 1.2.0 */ PayloadHandlingException(String message) { super(message); } /** * Creates a new {@code PayloadHandlingException} with the given {@code cause}. * @param cause the cause of the failure */ PayloadHandlingException(Throwable cause) { super(cause); } }
[ "awilkinson@pivotal.io" ]
awilkinson@pivotal.io
59698f095d0e67408e23980b879654ea86ea533b
3ca3dc07eb6afffe2fb5c858f7e7dbde5bebaa28
/jBPM64Ex023_taskReassignment/src/test/java/com/sample/ProcessJPATest.java
5b27214e2b8bab4e177fce2b8083f829b67fe1b0
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
tkobayas/BxMS64examples
040c9c50939d522f7298e30e549869eec7e1c71b
daeadc50a2487c2c160b37b2dfbfe8b01dbcac04
refs/heads/master
2022-11-01T06:57:02.524135
2021-12-10T06:50:32
2021-12-10T06:50:32
97,538,348
1
0
null
2022-10-05T19:02:59
2017-07-18T01:28:11
Java
UTF-8
Java
false
false
6,854
java
package com.sample; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import org.h2.tools.Server; import org.jbpm.process.audit.JPAAuditLogService; import org.jbpm.runtime.manager.impl.RuntimeEnvironmentBuilder; import org.jbpm.services.task.identity.JBossUserGroupCallbackImpl; import org.jbpm.test.JBPMHelper; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.kie.api.io.ResourceType; import org.kie.api.runtime.KieSession; import org.kie.api.runtime.manager.RuntimeEngine; import org.kie.api.runtime.manager.RuntimeEnvironment; import org.kie.api.runtime.manager.RuntimeManager; import org.kie.api.runtime.manager.RuntimeManagerFactory; import org.kie.api.runtime.process.ProcessInstance; import org.kie.api.task.TaskService; import org.kie.api.task.UserGroupCallback; import org.kie.api.task.model.TaskSummary; import org.kie.internal.io.ResourceFactory; import org.kie.internal.runtime.manager.context.EmptyContext; import org.kie.internal.runtime.manager.context.ProcessInstanceIdContext; import bitronix.tm.BitronixTransactionManager; import bitronix.tm.TransactionManagerServices; import bitronix.tm.resource.jdbc.PoolingDataSource; /** * This is a sample file to launch a process. */ public class ProcessJPATest { private static final boolean H2 = true; private static EntityManagerFactory emf; private static Server h2Server; private static PoolingDataSource ds; @Before public void setup() { if (H2) { // for H2 datasource h2Server = JBPMHelper.startH2Server(); ds = JBPMHelper.setupDataSource(); } else { // for external database datasource ds = setupDataSource(); } Map configOverrides = new HashMap(); configOverrides.put("hibernate.hbm2ddl.auto", "create"); // Uncomment if you don't want to clean up tables if (H2) { configOverrides.put("hibernate.dialect", "org.hibernate.dialect.H2Dialect"); } else { configOverrides.put("hibernate.dialect", "org.hibernate.dialect.MySQL5InnoDBDialect"); // Change for other DB } emf = Persistence.createEntityManagerFactory("org.jbpm.example", configOverrides); } @After public void teardown() { if (ds != null) { ds.close(); } if (h2Server != null) { h2Server.shutdown(); } } @Test public void testProcess() throws Exception { try { RuntimeManager manager = getRuntimeManager("sample.bpmn"); RuntimeEngine runtime = manager.getRuntimeEngine(ProcessInstanceIdContext.get()); KieSession ksession = runtime.getKieSession(); // JPAAuditLogService logService = new JPAAuditLogService(ksession.getEnvironment()); BitronixTransactionManager transactionManager = TransactionManagerServices.getTransactionManager(); transactionManager.setTransactionTimeout(3600); // longer timeout for a debugger // start a new process instance Map<String, Object> params = new HashMap<String, Object>(); ProcessInstance pi = ksession.startProcess("com.sample.bpmn.hello", params); long piid = pi.getId(); System.out.println("A process instance started : pid = " + piid); TaskService taskService = runtime.getTaskService(); // ------------ { List<TaskSummary> list = taskService.getTasksAssignedAsPotentialOwner("john", "en-UK"); for (TaskSummary taskSummary : list) { System.out.println("john has a task : taskId = " + taskSummary.getId()); } } // ----------- { List<TaskSummary> list = taskService.getTasksAssignedAsPotentialOwner("mary", "en-UK"); for (TaskSummary taskSummary : list) { System.out.println("mary has a task : taskId = " + taskSummary.getId()); } } // Without dispose, scheduler thread will be blocked by processEngineLock manager.disposeRuntimeEngine(runtime); System.out.println("sleeping..."); Thread.sleep(5000); RuntimeEngine runtime2 = manager.getRuntimeEngine(ProcessInstanceIdContext.get(piid)); TaskService taskService2 = runtime2.getTaskService(); // ------------ { List<TaskSummary> list = taskService2.getTasksAssignedAsPotentialOwner("john", "en-UK"); for (TaskSummary taskSummary : list) { System.out.println("john has a task : taskId = " + taskSummary.getId()); } } // ----------- { List<TaskSummary> list = taskService2.getTasksAssignedAsPotentialOwner("mary", "en-UK"); for (TaskSummary taskSummary : list) { System.out.println("mary has a task : taskId = " + taskSummary.getId()); } } // ----------- manager.disposeRuntimeEngine(runtime2); } catch (Throwable th) { th.printStackTrace(); } } private static RuntimeManager getRuntimeManager(String process) { Properties properties = new Properties(); properties.setProperty("krisv", ""); properties.setProperty("mary", ""); properties.setProperty("john", ""); UserGroupCallback userGroupCallback = new JBossUserGroupCallbackImpl(properties); RuntimeEnvironment environment = RuntimeEnvironmentBuilder.getDefault().persistence(true) .entityManagerFactory(emf).userGroupCallback(userGroupCallback) .addAsset(ResourceFactory.newClassPathResource(process), ResourceType.BPMN2).get(); return RuntimeManagerFactory.Factory.get().newPerProcessInstanceRuntimeManager(environment); } public static PoolingDataSource setupDataSource() { // Please edit here when you want to use your database PoolingDataSource pds = new PoolingDataSource(); pds.setUniqueName("jdbc/jbpm-ds"); pds.setClassName("bitronix.tm.resource.jdbc.lrc.LrcXADataSource"); pds.setMaxPoolSize(5); pds.setAllowLocalTransactions(true); pds.getDriverProperties().put("user", "mysql"); pds.getDriverProperties().put("password", "mysql"); pds.getDriverProperties().put("url", "jdbc:mysql://localhost:3306/testbpms640"); pds.getDriverProperties().put("driverClassName", "com.mysql.jdbc.Driver"); pds.init(); return pds; } }
[ "toshiyakobayashi@gmail.com" ]
toshiyakobayashi@gmail.com
c9fea1ef1ceb9adf563a6860555bef4679b71e56
f56e768ca1d7d0b26bb0f6af31d3f77ed33b810f
/ServerTest.java
8d95826a336b128f2850b2f8b3165269d13dd00b
[]
no_license
whjl-/Source-File-Repository
c0c4097c68aba01f3b162267b633b6fdd03ac11e
e71a8c24d9a01a64e4da3e0eca86da2d990916aa
refs/heads/master
2021-01-10T18:07:13.339489
2012-09-29T08:15:16
2012-09-29T08:15:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
224
java
import javax.swing.JFrame; public class ServerTest { public static void main(String[] args) { Server obje = new Server(); obje.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); obje.startRunning(); } }
[ "langfordwill@sky.com" ]
langfordwill@sky.com
b78af44fcceb089b6e2d5cc8b574cc73467da8c6
d2ee07ebc5e2994cb46c7647cc15ecd31dff2d4a
/src/main/java/com/mage/crm/service/PermissionService.java
bde977a00fc31bd23b582fb0d3e2e0c13ebe2dec
[]
no_license
JOJO-atr/JOJO-sRep
da6b438d60ab7b6b866cc2408c3323717d96a83e
362cf2f551cf0aabc1183ffa641931b84a8bb2fc
refs/heads/master
2022-12-22T06:45:16.923460
2019-11-02T09:29:45
2019-11-02T09:29:45
219,088,479
1
0
null
2022-12-16T09:49:43
2019-11-02T01:41:06
HTML
UTF-8
Java
false
false
1,314
java
package com.mage.crm.service; import com.mage.crm.dao.PermissionDao; import com.mage.crm.util.AssertUtil; import com.mage.crm.vo.Permission; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.ArrayList; import java.util.Date; import java.util.List; @Service public class PermissionService { @Resource private PermissionDao permissionDao; public void addPermission(Integer rid, int[] moduleIds) { //先删除 //查询是否有权限 int count=permissionDao.queryPermissionByRid(rid); if(count>0){ AssertUtil.isTrue(permissionDao.deletePermission(rid)<count,"授权失败!"); } List<Permission> list=new ArrayList<>(); //再添加 for(int i=0;i<moduleIds.length;i++){ Permission permission = new Permission(); //查询aclValue String aclValue=permissionDao.queryAcValueByMid(moduleIds[i]); permission.setAclValue(aclValue); permission.setRoleId(rid); permission.setModuleId(moduleIds[i]); permission.setCreateDate(new Date()); permission.setUpdateDate(new Date()); list.add(permission); } AssertUtil.isTrue(permissionDao.insertBatch(list)<list.size(),"授权失败!"); } }
[ "1043580949@qq.com" ]
1043580949@qq.com
5f11ea03ea36b2b66b77078e4706396d33fd61f2
c66c55e29461770ad0dbf2738061d075c66027fc
/OA/src/main/java/com/android/tongzhiyuan/base/fragment/BaseSearchFragment.java
cf5473032d93a52a68f0f188be5779d58b7b46b1
[]
no_license
dylan2021/tzy_2.0
c39c0b33a479ab8c1bcd4c051c236d06880437ac
37d69bfb9e5f5152cbce5b044150f51a975bafa4
refs/heads/master
2022-12-18T06:04:01.584864
2020-09-30T07:56:05
2020-09-30T07:56:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,793
java
package com.android.tongzhiyuan.base.fragment; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.content.LocalBroadcastManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; /** * Created by gaopan on 2017-1-14. */ public abstract class BaseSearchFragment extends BaseLazyFragment { protected abstract int getContentViewLayoutID(); protected abstract View getLoadView(View view); protected final static String TAG = "777"; // private LoadViewHelper loadViewHelper; @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { if (getContentViewLayoutID() != 0) { return inflater.inflate(getContentViewLayoutID(), null); } else { return super.onCreateView(inflater, container, savedInstanceState); } } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); initLoadView(getLoadView(view)); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(getActivity()); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction("android.intent.action.SEARCHCLICK");//建议把它写一个公共的变量,这里方便阅读就不写了。 BroadcastReceiver mItemViewListClickReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { // System.out.println("OK"); onUIReceive(); } }; broadcastManager.registerReceiver(mItemViewListClickReceiver, intentFilter); } /** * 广播接收封装,子类选择实现 */ public void onUIReceive() { } public void initLoadView(View view) { } public void showError(String errorText, String buttonText, View.OnClickListener onClickListener) { } public void search(String key) { } /** * 设置添加屏幕的背景透明度 * * @param bgAlpha */ public void backgroundAlpha(float bgAlpha) { WindowManager.LayoutParams lp = getActivity().getWindow().getAttributes(); lp.alpha = bgAlpha; //0.0-1.0 getActivity().getWindow().setAttributes(lp); } }
[ "157308001@qq.com" ]
157308001@qq.com
520791066f5c29254f66fdd8c3e7d99aa6b34926
0dbd987d03145e5864e2031d3523dab013102031
/ioanarucareanu/QLJava/src/org/uva/sea/ql/interpreter/EnabledQuestions.java
c989a03b8cf976ba02a4b2aa6c1dcee8b50b1e4c
[]
no_license
slvrookie/sea-of-ql
52041a99159327925e586389a9c60c4d708c95f2
1c41ce46ab1e2c5de124f425d2e0e3987d1b6a32
refs/heads/master
2021-01-16T20:47:40.370047
2013-07-15T11:26:56
2013-07-15T11:26:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,167
java
package org.uva.sea.ql.interpreter; import org.uva.sea.ql.ast.expr.value.Val; import org.uva.sea.ql.ast.ql.Question; import org.uva.sea.ql.interpreter.controller.QuestionWithAnswer; import org.uva.sea.ql.semanticchecker.ReturnType; import java.util.ArrayList; import java.util.List; public class EnabledQuestions implements ReturnType { private List<QuestionWithAnswer> questions; public EnabledQuestions() { questions = new ArrayList<QuestionWithAnswer>(); } public EnabledQuestions(List<QuestionWithAnswer> questions) { questions = new ArrayList<QuestionWithAnswer>(questions); } public List<QuestionWithAnswer> getQuestions() { return questions; } public void addQuestion(Question question) { questions.add(new QuestionWithAnswer(question, true)); } public void addQuestionWithAnswer(Question question, Val answer, boolean editable) { questions.add(new QuestionWithAnswer(question, answer, editable)); } public void addAll(EnabledQuestions enabledQuestions) { this.questions.addAll(enabledQuestions.getQuestions()); } public void setQuestions(List<QuestionWithAnswer> questions) { this.questions = questions; } }
[ "ioana@codefabriek.com" ]
ioana@codefabriek.com
fe8a54441d4f44fdd1e2980dccafeb6cfde15482
70e16d746b9a3c6ec2628bff7c986c9ea4ccf0df
/lib_zxing/lib_my_zxing3/src/main/java/com/google/myzxing3/datamatrix/encoder/ErrorCorrection_S.java
6b6cd197cf305c6935e76edb0f1e1652e0d07177
[]
no_license
66668/FastQrcode3
9e1020bdfe4c17fb92dd401c9ade1a96e171c2fa
d2bbc751349cf2b9e887de68ec2891ed4af1e4fb
refs/heads/master
2020-06-29T21:23:32.503807
2019-08-08T04:12:08
2019-08-08T04:12:08
200,628,505
0
1
null
null
null
null
UTF-8
Java
false
false
7,213
java
/* * Copyright 2006 Jeremias Maerki. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this string_b except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.myzxing3.datamatrix.encoder; /** * Error Correction Code for ECC200. */ public final class ErrorCorrection_S { /** * Lookup table which factors to use for which number of error correction codewords. * See FACTORS. */ private static final int[] FACTOR_SETS = {5, 7, 10, 11, 12, 14, 18, 20, 24, 28, 36, 42, 48, 56, 62, 68}; /** * Precomputed polynomial factors for ECC 200. */ private static final int[][] FACTORS = { {228, 48, 15, 111, 62}, {23, 68, 144, 134, 240, 92, 254}, {28, 24, 185, 166, 223, 248, 116, 255, 110, 61}, {175, 138, 205, 12, 194, 168, 39, 245, 60, 97, 120}, {41, 153, 158, 91, 61, 42, 142, 213, 97, 178, 100, 242}, {156, 97, 192, 252, 95, 9, 157, 119, 138, 45, 18, 186, 83, 185}, {83, 195, 100, 39, 188, 75, 66, 61, 241, 213, 109, 129, 94, 254, 225, 48, 90, 188}, {15, 195, 244, 9, 233, 71, 168, 2, 188, 160, 153, 145, 253, 79, 108, 82, 27, 174, 186, 172}, {52, 190, 88, 205, 109, 39, 176, 21, 155, 197, 251, 223, 155, 21, 5, 172, 254, 124, 12, 181, 184, 96, 50, 193}, {211, 231, 43, 97, 71, 96, 103, 174, 37, 151, 170, 53, 75, 34, 249, 121, 17, 138, 110, 213, 141, 136, 120, 151, 233, 168, 93, 255}, {245, 127, 242, 218, 130, 250, 162, 181, 102, 120, 84, 179, 220, 251, 80, 182, 229, 18, 2, 4, 68, 33, 101, 137, 95, 119, 115, 44, 175, 184, 59, 25, 225, 98, 81, 112}, {77, 193, 137, 31, 19, 38, 22, 153, 247, 105, 122, 2, 245, 133, 242, 8, 175, 95, 100, 9, 167, 105, 214, 111, 57, 121, 21, 1, 253, 57, 54, 101, 248, 202, 69, 50, 150, 177, 226, 5, 9, 5}, {245, 132, 172, 223, 96, 32, 117, 22, 238, 133, 238, 231, 205, 188, 237, 87, 191, 106, 16, 147, 118, 23, 37, 90, 170, 205, 131, 88, 120, 100, 66, 138, 186, 240, 82, 44, 176, 87, 187, 147, 160, 175, 69, 213, 92, 253, 225, 19}, {175, 9, 223, 238, 12, 17, 220, 208, 100, 29, 175, 170, 230, 192, 215, 235, 150, 159, 36, 223, 38, 200, 132, 54, 228, 146, 218, 234, 117, 203, 29, 232, 144, 238, 22, 150, 201, 117, 62, 207, 164, 13, 137, 245, 127, 67, 247, 28, 155, 43, 203, 107, 233, 53, 143, 46}, {242, 93, 169, 50, 144, 210, 39, 118, 202, 188, 201, 189, 143, 108, 196, 37, 185, 112, 134, 230, 245, 63, 197, 190, 250, 106, 185, 221, 175, 64, 114, 71, 161, 44, 147, 6, 27, 218, 51, 63, 87, 10, 40, 130, 188, 17, 163, 31, 176, 170, 4, 107, 232, 7, 94, 166, 224, 124, 86, 47, 11, 204}, {220, 228, 173, 89, 251, 149, 159, 56, 89, 33, 147, 244, 154, 36, 73, 127, 213, 136, 248, 180, 234, 197, 158, 177, 68, 122, 93, 213, 15, 160, 227, 236, 66, 139, 153, 185, 202, 167, 179, 25, 220, 232, 96, 210, 231, 136, 223, 239, 181, 241, 59, 52, 172, 25, 49, 232, 211, 189, 64, 54, 108, 153, 132, 63, 96, 103, 82, 186}}; private static final int MODULO_VALUE = 0x12D; private static final int[] LOG; private static final int[] ALOG; static { //Create log and antilog table LOG = new int[256]; ALOG = new int[255]; int p = 1; for (int i = 0; i < 255; i++) { ALOG[i] = p; LOG[p] = i; p *= 2; if (p >= 256) { p ^= MODULO_VALUE; } } } private ErrorCorrection_S() { } /** * Creates the ECC200 error correction for an encoded message. * * @param codewords the codewords * @param symbolInfo information about the symbol to be encoded * @return the codewords with interleaved error correction. */ public static String encodeECC200(String codewords, SymbolInfo_S symbolInfo) { if (codewords.length() != symbolInfo.getDataCapacity()) { throw new IllegalArgumentException( "The number of codewords does not match the selected symbol"); } StringBuilder sb = new StringBuilder(symbolInfo.getDataCapacity() + symbolInfo.getErrorCodewords()); sb.append(codewords); int blockCount = symbolInfo.getInterleavedBlockCount(); if (blockCount == 1) { String ecc = createECCBlock(codewords, symbolInfo.getErrorCodewords()); sb.append(ecc); } else { sb.setLength(sb.capacity()); int[] dataSizes = new int[blockCount]; int[] errorSizes = new int[blockCount]; int[] startPos = new int[blockCount]; for (int i = 0; i < blockCount; i++) { dataSizes[i] = symbolInfo.getDataLengthForInterleavedBlock(i + 1); errorSizes[i] = symbolInfo.getErrorLengthForInterleavedBlock(i + 1); startPos[i] = 0; if (i > 0) { startPos[i] = startPos[i - 1] + dataSizes[i]; } } for (int block = 0; block < blockCount; block++) { StringBuilder temp = new StringBuilder(dataSizes[block]); for (int d = block; d < symbolInfo.getDataCapacity(); d += blockCount) { temp.append(codewords.charAt(d)); } String ecc = createECCBlock(temp.toString(), errorSizes[block]); int pos = 0; for (int e = block; e < errorSizes[block] * blockCount; e += blockCount) { sb.setCharAt(symbolInfo.getDataCapacity() + e, ecc.charAt(pos++)); } } } return sb.toString(); } private static String createECCBlock(CharSequence codewords, int numECWords) { return createECCBlock(codewords, 0, codewords.length(), numECWords); } private static String createECCBlock(CharSequence codewords, int start, int len, int numECWords) { int table = -1; for (int i = 0; i < FACTOR_SETS.length; i++) { if (FACTOR_SETS[i] == numECWords) { table = i; break; } } if (table < 0) { throw new IllegalArgumentException( "Illegal number of error correction codewords specified: " + numECWords); } int[] poly = FACTORS[table]; char[] ecc = new char[numECWords]; for (int i = 0; i < numECWords; i++) { ecc[i] = 0; } for (int i = start; i < start + len; i++) { int m = ecc[numECWords - 1] ^ codewords.charAt(i); for (int k = numECWords - 1; k > 0; k--) { if (m != 0 && poly[k] != 0) { ecc[k] = (char) (ecc[k - 1] ^ ALOG[(LOG[m] + LOG[poly[k]]) % 255]); } else { ecc[k] = ecc[k - 1]; } } if (m != 0 && poly[0] != 0) { ecc[0] = (char) ALOG[(LOG[m] + LOG[poly[0]]) % 255]; } else { ecc[0] = 0; } } char[] eccReversed = new char[numECWords]; for (int i = 0; i < numECWords; i++) { eccReversed[i] = ecc[numECWords - i - 1]; } return String.valueOf(eccReversed); } }
[ "sjy0118atsn@163.com" ]
sjy0118atsn@163.com
bf1771df47247d52116a0d2436e62a3ab88b58d5
5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1
/Code Snippet Repository/Jetty/Jetty5053.java
03bb24d3fe7d8b9247ac056192cb769218748c73
[]
no_license
saber13812002/DeepCRM
3336a244d4852a364800af3181e03e868cf6f9f5
be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9
refs/heads/master
2023-03-16T00:08:06.473699
2018-04-18T05:29:50
2018-04-18T05:29:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,168
java
@Override public V getBest(String s, int offset, int len) { TreeTrie<V> t = this; for(int i=0; i < len; i++) { byte c=(byte)(0xff&s.charAt(offset+i)); int index=c>=0&&c<0x7f?__lookup[c]:-1; if (index>=0) { if (t._nextIndex[index] == null) break; t = t._nextIndex[index]; } else { TreeTrie<V> n=null; for (int j=t._nextOther.size();j-->0;) { n=t._nextOther.get(j); if (n._c==c) break; n=null; } if (n==null) break; t=n; } // Is the next Trie is a match if (t._key!=null) { // Recurse so we can remember this possibility V best=t.getBest(s,offset+i+1,len-i-1); if (best!=null) return best; break; } } return t._value; }
[ "Qing.Mi@my.cityu.edu.hk" ]
Qing.Mi@my.cityu.edu.hk
2f3477c9ba8adfb27873782f8e688188eaaa07ea
e26f814f695d1d26fb15a7f6f04651b1790f125a
/src/main/java/com/renren/api/service/FeedResource.java
829cf25be3a9dc8fe2f260af200024575cd1d443
[]
no_license
crackerlover/renren-api2-sdk-java
70abf8e3651b853f68eff3fbf282f951abe5cfce
107a353abfbd22fd50d44d7d057f7a83affe3755
refs/heads/master
2020-12-29T00:41:42.146879
2015-02-05T08:30:44
2015-02-05T08:30:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
917
java
/** * Autogenerated by renren-api2-generator 2014-04-23 18:03:22 * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package com.renren.api.service; import java.util.*; /** * * 新鲜事包含的资源 */ public class FeedResource { /** * 资源id */ private long id; /** * 资源标题 */ private String title; /** * 资源的内容 */ private String content; /** * 资源的url地址 */ private String url; public void setId(long id) { this.id = id; } public long getId() { return this.id; } public void setTitle(String title) { this.title = title; } public String getTitle() { return this.title; } public void setContent(String content) { this.content = content; } public String getContent() { return this.content; } public void setUrl(String url) { this.url = url; } public String getUrl() { return this.url; } }
[ "platform@renren@2013" ]
platform@renren@2013
57573afb17996febd280d8a981b445e25e32213f
7fa9c6b0fa1d0726ae1cda0199716c811a1ea01b
/Crawler/data/StockInter.java
26ea8a020c04f7fa691cd4229a3de8815b580733
[]
no_license
NayrozD/DD2476-Project
b0ca75799793d8ced8d4d3ba3c43c79bb84a72c0
94dfb3c0a470527b069e2e0fd9ee375787ee5532
refs/heads/master
2023-03-18T04:04:59.111664
2021-03-10T15:03:07
2021-03-10T15:03:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,018
java
11 https://raw.githubusercontent.com/yfelvis/mtcc/master/mtcc-demo/mtcc-demo-order/src/main/java/com/hyf/mtcc/demo/order/inter/StockInter.java package com.hyf.mtcc.demo.order.inter; import com.hyf.mtcc.demo.order.request.DecreaseStockReq; import com.yf.mtcc.core.annotation.Mtcc; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import java.util.Map; @FeignClient(value = "cloud-stock", fallback = StockInterHystrix.class) public interface StockInter { @Mtcc @PostMapping("/stock/decrease") String decreaseStock(@RequestBody @Validated DecreaseStockReq req); @GetMapping("/stock/findStockByName") Map<String, Object> findStockByName(@RequestParam("productName") String productName); }
[ "veronika.cucorova@gmail.com" ]
veronika.cucorova@gmail.com
47f8f489e505d662879e5b1c86cfa3f316aee940
95a54e3f3617bf55883210f0b5753b896ad48549
/java_src/com/liber8tech/tago/android/activity/TagoDetailsActivity$onCreate$5$1$3.java
7d6df6bcba2fe9eb6c8d259798549c9eaa46f88d
[]
no_license
aidyk/TagoApp
ffc5a8832fbf9f9819f7f8aa7af29149fbab9ea5
e31a528c8f931df42075fc8694754be146eddc34
refs/heads/master
2022-12-22T02:20:58.486140
2021-05-16T07:42:02
2021-05-16T07:42:02
325,695,453
3
1
null
2022-12-16T00:32:10
2020-12-31T02:34:45
Smali
UTF-8
Java
false
false
904
java
package com.liber8tech.tago.android.activity; import io.reactivex.functions.Consumer; import kotlin.Metadata; import timber.log.Timber; /* access modifiers changed from: package-private */ @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0010\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u0003\n\u0002\b\u0002\u0010\u0000\u001a\u00020\u00012\u000e\u0010\u0002\u001a\n \u0004*\u0004\u0018\u00010\u00030\u0003H\n¢\u0006\u0002\b\u0005"}, d2 = {"<anonymous>", "", "it", "", "kotlin.jvm.PlatformType", "accept"}, k = 3, mv = {1, 1, 13}) /* compiled from: TagoDetailsActivity.kt */ public final class TagoDetailsActivity$onCreate$5$1$3<T> implements Consumer<Throwable> { public static final TagoDetailsActivity$onCreate$5$1$3 INSTANCE = new TagoDetailsActivity$onCreate$5$1$3(); TagoDetailsActivity$onCreate$5$1$3() { } public final void accept(Throwable th) { Timber.d(th); } }
[ "ai@AIs-MacBook-Pro.local" ]
ai@AIs-MacBook-Pro.local
da79c7beaee908fa0ae8390a0b3cff41cba1db78
19e190bd14cb7f08c7d39bd60fe945f68b0c61d3
/android_apps/AudioEnclave/src/menclave/android/aenclave/NowPlayingActivity.java
20064b1751c272074ed37a6ee78c0cca63c5aec0
[]
no_license
kazimuth/media-enclave
0dc9414d506eb29a6f12793b18a6ceef08a287a3
06a7b524054b329ea2171ae8d080f286ee19b783
refs/heads/master
2020-07-04T10:27:23.286083
2016-09-09T22:18:24
2016-09-09T22:23:50
67,834,970
2
0
null
2016-09-09T22:27:07
2016-09-09T21:50:44
Python
UTF-8
Java
false
false
373
java
package menclave.android.aenclave; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class NowPlayingActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView text = new TextView(this); text.setText("now playing"); setContentView(text); } }
[ "jhgilles@mit.edu" ]
jhgilles@mit.edu
d801b1baf35bb1cc861ef0aac9a5bdbc8415b022
4b5c909f3fe0d2068aa9e56d93839ef4e2c8093f
/src/main/java/com/liuhongyin/mybatispluslearn/controller/PmsProductCategoryAttributeRelationController.java
9463d791ec583ef3ee946430a1dbec1a0b35a1b4
[]
no_license
liuhongyin/mybatis-plus-learn
fc460f83650e5931e7b903ab0cb7a86b12fd02e1
0824bcc73d859ccec3f682972f4e73d6fb33d893
refs/heads/master
2020-09-02T01:56:43.243619
2019-11-07T13:46:44
2019-11-07T13:46:44
219,108,221
0
0
null
null
null
null
UTF-8
Java
false
false
507
java
package com.liuhongyin.mybatispluslearn.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * <p> * 产品的分类和属性的关系表,用于设置分类筛选条件(只支持一级分类) 前端控制器 * </p> * * @author liuhongyin * @since 2019-11-07 */ @RestController @RequestMapping("/pms-product-category-attribute-relation") public class PmsProductCategoryAttributeRelationController { }
[ "liuhongyin7761@gmail.com" ]
liuhongyin7761@gmail.com
6c83ebccc3fc3aa2ea99b24dfffe3b89aad27078
d11fb0d15b73a28742caa97e349dcfbe70d2563f
/server/iih_pub/iih.ci_pub/src/main/java/iih/ci/ord/d/CijudgeSpecillDTO.java
45b894c7dbc36d2cdfc000835b625a8982ffdff3
[]
no_license
fhis/order.client
50a363fd3e4f56d95ccc5aa288e907a0a8571031
56cfa7877f600a10c54fdb30306a32ffa28b8217
refs/heads/master
2021-08-22T20:50:59.511923
2017-12-01T07:10:27
2017-12-01T07:10:27
112,678,072
1
1
null
null
null
null
UTF-8
Java
false
false
1,457
java
package iih.ci.ord.d; import xap.mw.core.data.*; import xap.mw.coreitf.d.*; import java.math.BigDecimal; /** * ci判断特殊病药 DTO数据 * */ public class CijudgeSpecillDTO extends BaseDTO { private static final long serialVersionUID = 1L; /** * 药品 * @return String */ public String getId_mm() { return ((String) getAttrVal("Id_mm")); } /** * 药品 * @param Id_mm */ public void setId_mm(String Id_mm) { setAttrVal("Id_mm", Id_mm); } /** * 特殊病药 * @return FBoolean */ public FBoolean getFg_mmspecill() { return ((FBoolean) getAttrVal("Fg_mmspecill")); } /** * 特殊病药 * @param Fg_mmspecill */ public void setFg_mmspecill(FBoolean Fg_mmspecill) { setAttrVal("Fg_mmspecill", Fg_mmspecill); } /** * 诊断集合 * @return FMap2 */ public FMap2 getDiagmap() { return ((FMap2) getAttrVal("Diagmap")); } /** * 诊断集合 * @param Diagmap */ public void setDiagmap(FMap2 Diagmap) { setAttrVal("Diagmap", Diagmap); } /** * 扩展字段 * @return String */ public String getStr() { return ((String) getAttrVal("Str")); } /** * 扩展字段 * @param Str */ public void setStr(String Str) { setAttrVal("Str", Str); } /** * 扩展字段2 * @return String */ public String getStr2() { return ((String) getAttrVal("Str2")); } /** * 扩展字段2 * @param Str2 */ public void setStr2(String Str2) { setAttrVal("Str2", Str2); } }
[ "27696830@qq.com" ]
27696830@qq.com
af1e79d55e410faf4db777b8e0549be7edc039a2
5c74c26136a872536f58e3e89459b766d978415a
/velcomParcer/src/main/java/velcomParcer/controller/command/impl/ParserTenders.java
c453df570300b2dbe940aecb021af7ecaa1a443a
[]
no_license
Anjeymash/WebTenderParcer
a4056964eda12b34aa8149ef0ce881bd368f3f24
249c8745f75f2a43e352608ea533eef3026809c0
refs/heads/master
2021-07-19T18:40:43.487585
2017-10-26T18:38:07
2017-10-26T18:38:07
108,435,211
0
0
null
null
null
null
UTF-8
Java
false
false
1,569
java
package velcomParcer.controller.command.impl; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import velcomParcer.controller.Command; import velcomParcer.controller.datamanager.JspManager; import velcomParcer.controller.datamanager.ParameterManager; import velcomParcer.entity.Tender; import velcomParcer.service.TenderService; import velcomParcer.service.exception.ServiceException; import velcomParcer.service.factory.ServiceFactory; public class ParserTenders implements Command { private static final Logger log = LogManager.getRootLogger(); @Override public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String page = JspManager.INDEX; String num = request.getParameter(ParameterManager.TENDER_N); Tender tender; ServiceFactory serviceFactory = ServiceFactory.getInstance(); TenderService tenderService = serviceFactory.getTenderService(); try { tender = tenderService.parseTender(num); request.setAttribute(ParameterManager.TENDER, tender); } catch (ServiceException e) { request.setAttribute(ParameterManager.ERROR_MES, e.getMessage()); log.error("error in ParserTenders", e); } RequestDispatcher dispatcher = request.getRequestDispatcher(page); dispatcher.forward(request, response); } }
[ "Anjeymash@DESKTOP-489AFBA" ]
Anjeymash@DESKTOP-489AFBA
3c6555d011354583a2b82bbb8af632d8713a1ee6
6cae5b4a2e67841d09332c618a936c8ab3e0baa4
/aws-java-sdk-codecommit/src/main/java/com/amazonaws/services/codecommit/model/transform/BatchDisassociateApprovalRuleTemplateFromRepositoriesResultJsonUnmarshaller.java
e281ff4bc0dc1c1ab925e32faabbb87d3d28d2fe
[ "Apache-2.0" ]
permissive
Carey-AWS/aws-sdk-java
1acf693c1c10b2a16d25e80225c00a4e2c303ca9
77b9d46aa281e2db7134e743337f98509029cd3d
refs/heads/master
2022-11-09T01:24:59.030331
2020-06-22T20:55:41
2020-06-22T20:55:41
274,238,406
0
0
Apache-2.0
2020-06-22T20:44:55
2020-06-22T20:44:54
null
UTF-8
Java
false
false
3,909
java
/* * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.codecommit.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.codecommit.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * BatchDisassociateApprovalRuleTemplateFromRepositoriesResult JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class BatchDisassociateApprovalRuleTemplateFromRepositoriesResultJsonUnmarshaller implements Unmarshaller<BatchDisassociateApprovalRuleTemplateFromRepositoriesResult, JsonUnmarshallerContext> { public BatchDisassociateApprovalRuleTemplateFromRepositoriesResult unmarshall(JsonUnmarshallerContext context) throws Exception { BatchDisassociateApprovalRuleTemplateFromRepositoriesResult batchDisassociateApprovalRuleTemplateFromRepositoriesResult = new BatchDisassociateApprovalRuleTemplateFromRepositoriesResult(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return batchDisassociateApprovalRuleTemplateFromRepositoriesResult; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("disassociatedRepositoryNames", targetDepth)) { context.nextToken(); batchDisassociateApprovalRuleTemplateFromRepositoriesResult.setDisassociatedRepositoryNames(new ListUnmarshaller<String>(context .getUnmarshaller(String.class)).unmarshall(context)); } if (context.testExpression("errors", targetDepth)) { context.nextToken(); batchDisassociateApprovalRuleTemplateFromRepositoriesResult .setErrors(new ListUnmarshaller<BatchDisassociateApprovalRuleTemplateFromRepositoriesError>( BatchDisassociateApprovalRuleTemplateFromRepositoriesErrorJsonUnmarshaller.getInstance()).unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return batchDisassociateApprovalRuleTemplateFromRepositoriesResult; } private static BatchDisassociateApprovalRuleTemplateFromRepositoriesResultJsonUnmarshaller instance; public static BatchDisassociateApprovalRuleTemplateFromRepositoriesResultJsonUnmarshaller getInstance() { if (instance == null) instance = new BatchDisassociateApprovalRuleTemplateFromRepositoriesResultJsonUnmarshaller(); return instance; } }
[ "" ]
3ac7040d2eb1b814ae58adecd18aca8bc6dd6b3c
495586b5f64308a633b666cfe263f62b5c84a038
/src/main/java/com/vvishnoi/classified/model/Category.java
ad5c72ba121fea1350c0da46ed8b3b778d238093
[ "MIT" ]
permissive
vvishnoi/simple-classified-app
55b9fce47a1359672e73d676287e6da20ec9d824
b3123c3169b2614b5b64ec12db9023d3bad761b4
refs/heads/master
2016-09-02T00:35:00.453480
2015-08-15T16:44:16
2015-08-15T16:44:16
40,276,549
0
0
null
null
null
null
UTF-8
Java
false
false
773
java
package com.vvishnoi.classified.model; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.OneToMany; import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonManagedReference; @Entity @Table(name = "categories") public class Category extends NamedEntity { public Category() { } @JsonManagedReference(value="category-subcategory") @OneToMany(mappedBy = "category", cascade=CascadeType.ALL, fetch = FetchType.EAGER) private Set<SubCategory> subCategories; public Set<SubCategory> getSubCategories() { return subCategories; } public void setSubCategories(Set<SubCategory> subCategories) { this.subCategories = subCategories; } }
[ "vvishnoi@users.noreply.github.com" ]
vvishnoi@users.noreply.github.com
c36dee0a22f34d9d8ced2279b1c0758ba5a52e7e
9f907527f44fdfc33b5add9f8d313bbeb96d1192
/src/uva/volume003/Network.java
a1fe923e29e8b0d02c34363ef9db6c4da85ea548
[]
no_license
kocko/algorithms
7af7052b13a080992dcfbff57171a2cac7c50c67
382b6b50538220a26e1af1644e72a4e1796374b6
refs/heads/master
2023-08-03T21:15:27.070471
2023-08-03T14:39:45
2023-08-03T14:39:45
45,342,667
5
0
null
null
null
null
UTF-8
Java
false
false
2,137
java
package uva.volume003; import java.io.Closeable; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; import static java.lang.Integer.min; public class Network implements Closeable { private Scanner in = new Scanner(System.in); private PrintWriter out = new PrintWriter(System.out); public void solve() { while ((n = Integer.parseInt(in.nextLine())) != 0) { reset(); for (int i = 0; i <= n; i++) { graph.add(new ArrayList<>()); } String[] split; while ((split = in.nextLine().split("\\s+")).length > 1) { int u = Integer.parseInt(split[0]); for (int i = 1; i < split.length; i++) { int v = Integer.parseInt(split[i]); graph.get(u).add(v); graph.get(v).add(u); } } dfs(1, 0); int result = 0; for (int i = 1; i <= n; i++) { if (articulationPoint[i]) { result++; } } out.println(result); } } private int n; private int[] low, level; private boolean[] articulationPoint; private List<List<Integer>> graph; private void reset() { graph = new ArrayList<>(); level = new int[n + 1]; low = new int[n + 1]; Arrays.fill(low, Integer.MAX_VALUE); articulationPoint = new boolean[n + 1]; } private void dfs(int v, int p) { level[v] = low[v] = level[p] + 1; int children = 0; for (int to : graph.get(v)) { if (to == p) continue; if (level[to] != 0) { low[v] = min(low[v], level[to]); } else { dfs(to, v); low[v] = min(low[v], low[to]); if (low[to] >= level[v] && p != 0) { articulationPoint[v] = true; } ++children; } } if (p == 0 && children > 1) { articulationPoint[v] = true; } } @Override public void close() throws IOException { in.close(); out.close(); } public static void main(String[] args) throws IOException { try (Network instance = new Network()) { instance.solve(); } } }
[ "konstantin.yovkov@gmail.com" ]
konstantin.yovkov@gmail.com
8561e73882539b8f8e9f5f3d658097c40bf851e7
11a96b13d052eedb79790ae6a8e274c596ba364b
/src/edu/ocpjp/streams/Q153.java
b2a6b2536a5d2ad195b487733afec8e1fb6b9352
[]
no_license
rmanojcse06/ocpjp8
eac1200a672dbfde01df0660a227bd3eb1426bbb
1efe3ecc9c3cc83515262c6db47e45255c706fd3
refs/heads/master
2023-04-12T08:04:42.650735
2021-04-28T08:50:43
2021-04-28T08:50:43
362,399,196
0
0
null
null
null
null
UTF-8
Java
false
false
283
java
package edu.ocpjp.streams; import java.util.stream.IntStream; import java.util.stream.Stream; public class Q153 { public static void main(String[] args) { IntStream s=Stream.of(1,2,3,4).flatMapToInt(a->IntStream.of(a)); System.out.println("dVal-"+s.average().getAsDouble()); } }
[ "Ravikumar.Manoj@in.bosch.com" ]
Ravikumar.Manoj@in.bosch.com
866c4d15abd9196b4b715a6d765ff5fb779596ed
d3335117302307e3be0e1d2ade493b9089252c2d
/src/main/java/controller/UsuarioController.java
0d67e2f8d9dbb9063c626641db41fe54da2b6da3
[]
no_license
jofernando/projetopi
a2624125756840a1b974bc4c9e28b1e56452c987
f48716c1e2021068c22892353755aa2a279394c2
refs/heads/master
2021-08-31T14:27:57.621401
2017-12-03T15:58:01
2017-12-03T15:58:01
85,520,125
1
0
null
null
null
null
UTF-8
Java
false
false
2,505
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package controller; import java.util.List; import javax.faces.application.FacesMessage; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import javax.faces.context.FacesContext; import model.UsuarioModel; import model.entidades.Usuario; /** * * @author Fernando */ @ManagedBean @ViewScoped public class UsuarioController { private UsuarioModel model = null; private Usuario usuario; private boolean estadoLogin; public UsuarioController() { model = new UsuarioModel(UsuarioModel.BANCODADOS); usuario = new Usuario(); estadoLogin = true; } public void inserirAction() { if (model.inserir(usuario)) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Usuário cadastrado", null)); } /*else { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Usuário não cadastrado", null)); }*/ } public void alterarAction() { if (model.alterar(usuario)) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Usuário alterado", null)); } } public void deletarAction() { if (model.deletar(usuario)) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Usuário deletado", null)); } } public Usuario buscarAction(int id) { return model.buscar(id); } public List<Usuario> buscarTodosAction() { return model.buscarTodos(); } public void loginAction() { if (model.login(usuario.getUsername(), usuario.getPassword())) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Usuário logado", null)); } } public void logoutAction() { model.logout(); } public Usuario getUsuario() { return usuario; } public void setUsuario(Usuario usuario) { this.usuario = usuario; } public boolean isEstadoLogin() { return estadoLogin; } public void setEstadoLogin(boolean estadoLogin) { this.estadoLogin = estadoLogin; } public void limpar() { usuario = new Usuario(); } public void preparaCadastrar() { limpar(); estadoLogin = false; } public void preparaLogin() { limpar(); estadoLogin = true; } }
[ "fmdinho3@gmail.com" ]
fmdinho3@gmail.com
f84d1d5d5d564b30bdd3196a0f991329ec62b5b0
4bd5fe4952685f226eb23f270a02d8bd8652ff67
/app/src/main/java/cn/njit/cookbook/ui/FoodListActivity.java
8647dbd2391539760aa078543388b5950a4be8c9
[]
no_license
weizai666/CookBook
190acdde247be6d6232b951ec68bd0e790bdc8bd
5c90b214c33ca668b854cf6dac60424124c6e989
refs/heads/master
2020-12-15T20:37:50.096135
2020-02-13T08:35:19
2020-02-13T08:35:19
235,248,164
0
1
null
null
null
null
UTF-8
Java
false
false
3,338
java
package cn.njit.cookbook.ui; import android.os.Bundle; import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.SimpleItemAnimator; import androidx.recyclerview.widget.LinearLayoutManager; import android.view.View; import cn.njit.cookbook.R; import cn.njit.cookbook.model.FoodBean; import cn.njit.cookbook.model.FoodTypeBean; import cn.njit.cookbook.net.BasePresenter; import cn.njit.cookbook.net.FoodPresenter; import cn.njit.cookbook.ui.adapter.BaseAdapter; import cn.njit.cookbook.ui.adapter.BaseViewHolder; import java.util.List; import butterknife.Bind; public class FoodListActivity extends BaseActivity<FoodPresenter> { @Bind(R.id.recyclerView) RecyclerView mRecyclerView; private BaseAdapter mAdapter; private FoodTypeBean.ListBean mData = null; @Override protected int getLayoutResource() { return R.layout.activity_food_list; } @Override protected void setStatusBarColor() { } @Override protected FoodPresenter createPresenter() { return new FoodPresenter(this,this); } @Override protected void initView(Bundle savedInstanceState) { super.initView(savedInstanceState); mData = getIntent().getParcelableExtra(FoodListActivity.class.getSimpleName()); setLeftBack(); setTitle(mData != null ? mData.getName() : ""); LinearLayoutManager manager = new LinearLayoutManager(mActivity); manager.setInitialPrefetchItemCount(5); mRecyclerView.setLayoutManager(manager); //关闭动效提升效率 // ((SimpleItemAnimator) mRecyclerView.getItemAnimator()).setSupportsChangeAnimations(false); //Item高度固定,避免浪费资源 mRecyclerView.setHasFixedSize(true); mRecyclerView.setItemViewCacheSize(5); mAdapter = new BaseAdapter<FoodBean>(this, R.layout.item_food_list) { @Override public void convert(BaseViewHolder holder, int position, final FoodBean data) { List<String> list = data.getAlbums(); holder.setText(data.getTitle(), R.id.item_title) .setText(data.getImtro(), R.id.item_descript) .setText("阅读 " + data.getId(), R.id.item_read) .setText("步骤 " + data.getSteps().size() + "步", R.id.item_count) .setRoundImageResource((list != null && list.size() != 0) ? list.get(0) : "", R.dimen.dp_5, R.id.item_image) .itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openActivity(FoodDetailActivity.class, data); } }); } }; mAdapter.bindRecyclerView(mRecyclerView); } @Override protected void initData() { super.initData(); mPresenter.getFoodListData(mData.getId()); } @Override public void showData(Object o) { super.showData(o); if (o instanceof List) { List<FoodBean> list = (List<FoodBean>) o; mAdapter.setData(list); } } }
[ "1025941300@qq.com" ]
1025941300@qq.com
6b8d0d2ce06a1fce0f7cf5b94239a62d6f5b31f3
24470b3510bb4f16ad41b4d4e397ca27fbabef82
/MoneyManager/src/com/atp/moneymanager/Thread/Asyncgetpass.java
ba30fbd360cea2240577a82ee6ed2cf9a6487d47
[]
no_license
ragnakrorn77/linhtcps01817
a420ecb9abc2b7573b735a955a32439045cf0587
39decc5ebd28446b022a00bff6260c34a2c045b4
refs/heads/master
2020-09-17T04:19:07.878758
2016-08-18T12:29:54
2016-08-18T12:29:54
65,994,887
0
0
null
null
null
null
UTF-8
Java
false
false
3,426
java
package com.atp.moneymanager.Thread; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.URI; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import com.atp.moneymanager.FuncDungChung; import com.atp.moneymanager.activity.dangky; import com.atp.moneymanager.activity.getpass; import android.content.Context; import android.os.AsyncTask; import android.view.View; import android.widget.LinearLayout; import android.widget.RelativeLayout; public class Asyncgetpass extends AsyncTask<String,Void,String>{ Context mContext; String email; RelativeLayout loading; LinearLayout linearLayout1; public Asyncgetpass(Context mContext,RelativeLayout loading,LinearLayout linearLayout1) { this.mContext = mContext; this.email = email; this.loading = loading; this.linearLayout1 = linearLayout1; } @Override protected void onPreExecute() { super.onPreExecute(); loading.setVisibility(View.VISIBLE); linearLayout1.setVisibility(View.GONE); } @Override protected String doInBackground(String... arg0) { try{ String username = (String)arg0[0]; String passcode = (String)arg0[1]; String link = FuncDungChung.linkhost + "getpass.php?email=" + username + "&passcode=" + passcode; URL url = new URL(link); HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(); request.setURI(new URI(link)); HttpResponse response = client.execute(request); BufferedReader in = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); StringBuffer sb = new StringBuffer(""); String line=""; while ((line = in.readLine()) != null) { sb.append(line); break; } in.close(); return sb.toString(); } catch(Exception e){ return new String("Exception: " + e.getMessage()); } } @Override protected void onPostExecute(String result){ if (result.indexOf("error") > -1) { if (FuncDungChung.GetLanguage(mContext) == 0) { dangky.popupWindow = FuncDungChung.ShowPopupThongBao(mContext, getpass.back_dim_layout, getpass.back_dim_layout, "Email is wrong or passcode is wrong", "Error"); } else { dangky.popupWindow = FuncDungChung.ShowPopupThongBao(mContext, getpass.back_dim_layout, getpass.back_dim_layout, "Sai tài khoản hoặc passcode", "Thông báo"); } } else { if (FuncDungChung.GetLanguage(mContext) == 0) { dangky.popupWindow = FuncDungChung.ShowPopupThongBao(mContext, getpass.back_dim_layout, getpass.back_dim_layout, result, "Your Password"); } else { dangky.popupWindow = FuncDungChung.ShowPopupThongBao(mContext, getpass.back_dim_layout, getpass.back_dim_layout, result, "Password của bạn"); } } loading.setVisibility(View.GONE); linearLayout1.setVisibility(View.VISIBLE); System.out.println(result); } }
[ "datthanh1911@gmail.com" ]
datthanh1911@gmail.com
8a0f752b4c51e7f802a72c54229cce9b32c31112
b751d8f11bce2e230d8829e12d6d40ab58a46256
/fant/6-7-60/src/projects/history_page.java
dc71b7c91392141c42d1be5ac00230eba2e484d7
[]
no_license
fant2477/TEAM
14a8780284e42a58421111f990eca0ee90d01a2e
f9e21953dbecc4d8feabebe837ee5ff88cda7953
refs/heads/master
2021-01-25T06:35:59.080907
2017-07-21T09:04:21
2017-07-21T09:04:21
93,591,833
0
1
null
2017-06-07T04:28:39
2017-06-07T04:16:27
null
UTF-8
Java
false
false
3,514
java
package projects; import java.io.IOException; import java.util.List; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import project_db.ConnectionDB; import project_db.Log; import project_db.User; /** * Servlet implementation class history_page */ @WebServlet("/history_page") public class history_page extends HttpServlet { String change_page; String from_page; User current_user; private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public history_page() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("in history_page get"); response.setContentType("text/html"); current_user = (User) request.getSession().getAttribute("current_user"); request.getSession(false).invalidate(); ConnectionDB.connect(); List<String[]> lg = Log.getLog(1,100); request.getSession().setAttribute("lg", lg); // go to fn same as sent fn (sent by post go to post ) RequestDispatcher dispatcher = request.getRequestDispatcher("history_ui.jsp"); dispatcher.forward(request, response); ConnectionDB.disconnect(); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("in history_page post"); response.setContentType("text/html"); String bt = request.getParameter("bt"); if (bt == null) { //no button has been selected System.out.println("no bt was press"); change_page = "history_page"; from_page = "history_page"; } else if (bt.equals("Main Page")) { //Register button was pressed System.out.println("Back bt was press"); change_page = "main_page"; from_page = "history_page"; } else if (bt.equals("Add Page")) { //Register button was pressed System.out.println("Add page was press"); change_page = "add_doc_page"; from_page = "history_page"; } else if (bt.equals("Delete Page")) { //Register button was pressed System.out.println("Delete Page was press"); change_page = "delete_doc_page"; from_page = "history_page"; } else if (bt.equals("User_info")) { //Login button was pressed System.out.println("User_info was press"); change_page = "user_info_page"; from_page = "history_page"; } else if (bt.equals("Log Out")) { //Login button was pressed System.out.println("logout was press"); change_page = "login_page"; from_page = "history_page"; } else { //someone has altered the HTML and sent a different value! System.out.println("? bt was press"); change_page = "history_page"; from_page = "history_page"; } request.getSession().setAttribute("change_page", change_page); request.getSession().setAttribute("from_page", from_page); request.getSession().setAttribute("current_user", current_user); System.out.println("change_page: "+ change_page); //go to get fn response.sendRedirect("UI_Manager"); } }
[ "fant_2477@hotmail.com" ]
fant_2477@hotmail.com
f48e972fac88b35fee118285625eb36f23931d70
dc3772807075c90f72bb7000ef2ac893f6e2b626
/Chapter_5/DotCom.java
97b822301fc3109e298e84f5a5869a6556fd9cdb
[]
no_license
MarcusCalgar/Head-First-Java
cca3a3c2bf414a165189897b7b2f78340691cebf
19e61f1cfe92c0f1540de5b771754f088606f261
refs/heads/main
2023-02-15T20:02:40.974569
2021-01-11T15:23:44
2021-01-11T15:23:44
315,051,664
0
0
null
null
null
null
UTF-8
Java
false
false
497
java
class SimpleDotCom { int[] locationCells; int numOfHits = 0; public void setLocationCells(int[] locs){ locationCells = locs; } public String checkYourself(String stringGuess) { int guess = Integer.parseInt(stringGuess); String result = "miss"; for(int cell : locationCells){ if(guess == cell){ result = "hit"; numOfHits++; break; } } if(numOfHits == locationCells.length){ result = "kill"; } System.out.println(result); return result; } }
[ "paraszthybalazs@gmail.com" ]
paraszthybalazs@gmail.com
edd7f96aae972272ae2b0e8e7b64f8dc71dccab6
065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be
/eclipsejdt_cluster/22909/tar_1.java
f5b556fb4f9b5007beb93c3e740e0ab4aebe0e95
[]
no_license
martinezmatias/GenPat-data-C3
63cfe27efee2946831139747e6c20cf952f1d6f6
b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4
refs/heads/master
2022-04-25T17:59:03.905613
2020-04-15T14:41:34
2020-04-15T14:41:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
63,533
java
/******************************************************************************* * Copyright (c) 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * Stephan Herrmann - Contribution for * Bug 377883 - NPE on open Call Hierarchy *******************************************************************************/ package org.eclipse.jdt.core.tests.model; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; import junit.framework.Test; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IMethod; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.search.IJavaSearchConstants; import org.eclipse.jdt.core.search.IJavaSearchScope; import org.eclipse.jdt.core.search.SearchEngine; import org.eclipse.jdt.core.search.SearchMatch; import org.eclipse.jdt.core.search.SearchPattern; import org.eclipse.jdt.internal.core.search.matching.MethodPattern; // The size of JavaSearchBugsTests.java is very big, Hence continuing here. public class JavaSearchBugsTests2 extends AbstractJavaSearchTests { public JavaSearchBugsTests2(String name) { super(name); this.endChar = ""; } static { //TESTS_NAMES = new String[] {"testBug378390"}; } public static Test suite() { return buildModelTestSuite(JavaSearchBugsTests2.class); } class TestCollector extends JavaSearchResultCollector { public List matches = new ArrayList(); public void acceptSearchMatch(SearchMatch searchMatch) throws CoreException { super.acceptSearchMatch(searchMatch); this.matches.add(searchMatch); } } protected void setUp() throws Exception { super.setUp(); this.resultCollector = new TestCollector(); this.resultCollector.showAccuracy(true); } /** * Test that missing types in the class shouldn't impact the search of a type in an inner class */ public void testBug362633() throws CoreException, IOException { try { IJavaProject p = createJavaProject("P", new String[] {}, new String[] { "/P/lib325418.jar", "JCL15_LIB" }, "", "1.5"); org.eclipse.jdt.core.tests.util.Util.createJar(new String[] { "p325418M/Missing.java", "package p325418M;\n" + "public class Missing{}\n" }, p.getProject().getLocation().append("lib325418M.jar").toOSString(), "1.5"); org.eclipse.jdt.core.tests.util.Util.createJar( new String[] { "p325418/Test.java", "package p325418;\n" + "public class Test{\n" + " public void foo(p325418M.Missing a) {}\n" + " public <T> T foo(int a) {\n" + " return new Inner<T>() {T run() { return null; }}.run();\n" + " }\n" + "}\n", "p325418/Inner.java", "package p325418;\n" + "abstract class Inner <T> {\n" + " abstract T run();\n" + "}\n" }, null, p.getProject().getLocation().append("lib325418.jar").toOSString(), new String[] { p.getProject().getLocation().append("lib325418M.jar").toOSString() }, "1.5"); refresh(p); int mask = IJavaSearchScope.APPLICATION_LIBRARIES | IJavaSearchScope.SOURCES; IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { p }, mask); search("Inner.run()", IJavaSearchConstants.METHOD, IJavaSearchConstants.DECLARATIONS, scope, this.resultCollector); assertSearchResults( "Unexpected search results!", "lib325418.jar T p325418.Inner.run() [No source] EXACT_MATCH\n" + "lib325418.jar T p325418.<anonymous>.run() [No source] EXACT_MATCH", this.resultCollector); } finally { deleteProject("P"); } } /** * @bug 123836: [1.5][search] for references to overriding method with bound type variable is not polymorphic * @test Search for references to an overridden method with bound variables should yield. * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=123836" */ public void testBug123836a() throws CoreException { IJavaProject project = null; try { project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Sub.java", "abstract class Sup<C> {\n" + " protected void m(C classifier) {}\n"+ " public void use(C owner) { m (owner); }\n" + "}\n" + "public class Sub extends Sup<String>{\n" + " @Override\n"+ " protected void m(String classifier) {}\n"+ "}\n"); IType type = getCompilationUnit("/P/Sub.java").getType("Sub"); IMethod method = type.getMethod("m", new String[]{"QString;"}); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Sub.java void Sup.use(C) [m (owner)] EXACT_MATCH"); } finally { deleteProject(project); } } // Search for a non-overridden method with same name as which could have been overridden should // not have results public void testBug123836b() throws CoreException { IJavaProject project = null; try { project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Sub.java", "abstract class Sup<C> {\n" + " protected void m(C classifier) {}\n"+ " public void use(C owner) { m (owner); }\n" + "}\n" + "public class Sub extends Sup<String>{\n" + " @Override\n"+ " protected void m(String classifier) {}\n"+ " protected void m(Sub classifier) {}\n"+ "}\n" ); // search IType type = getCompilationUnit("/P/Sub.java").getType("Sub"); IMethod method = type.getMethod("m", new String[]{"QSub;"}); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults(""); } finally { deleteProject(project); } } // another variant of the testcase public void testBug123836c() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Test.java", "class Test {\n"+ " void calc(Property prop, Property<? extends Serializable> p2) {\n"+ " prop.compute(null);\n"+ " p2.compute(null);\n"+ " }\n"+ "}\n"+ "abstract class Property<E> {\n"+ " public abstract void compute(E e);\n"+ "}\n"+ "class StringProperty extends Property<String> {\n"+ " @Override public void compute(String e) {\n"+ " System.out.println(e);\n"+ " }"); IType type = getCompilationUnit("/P/Test.java").getType("StringProperty"); IMethod method = type.getMethod("compute", new String[]{"QString;"}); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH\n" + "Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH"); } finally { deleteProject(project); } } // Test inner class public void testBug123836d() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Test.java", "class Test {\n"+ " void calc(Property prop, Property<? extends Serializable> p2) {\n"+ " prop.compute(null);\n"+ " p2.compute(null);\n"+ " }\n"+ " class StringProperty extends Property<String> {\n"+ " @Override public void compute(String e) {\n"+ " System.out.println(e);\n"+ " }\n"+ "}\n"+ "abstract class Property<E> {\n"+ " public abstract void compute(E e);\n"+ "}"); IType type = getCompilationUnit("/P/Test.java").getType("Test").getType("StringProperty"); IMethod method = type.getMethod("compute", new String[]{"QString;"}); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH\n" + "Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH"); } finally { deleteProject(project); } } // Test local class public void testBug123836e() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Test.java", "class Test {\n"+ " void calc(Property prop, Property<? extends Serializable> p2) {\n"+ " prop.compute(null);\n"+ " p2.compute(null);\n"+ " class StringProperty extends Property<String> {\n"+ " @Override public void compute(String e) {\n"+ " System.out.println(e);\n"+ " }\n"+ " }\n"+ " }\n"+ "}\n"+ "abstract class Property<E> {\n"+ " public abstract void compute(E e);\n"+ "}"); IMethod method = selectMethod(getCompilationUnit("/P/Test.java"), "compute", 3); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH\n" + "Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH"); } finally { deleteProject(project); } } // test inner class public void testBug123836f() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Test.java", "class Test {\n"+ " void calc(Property prop, Property<? extends Serializable> p2) {\n"+ " prop.compute(null);\n"+ " p2.compute(null);\n"+ " new Property<String>() {\n"+ " @Override public void compute(String e) {\n"+ " System.out.println(e);\n"+ " }\n"+ " };\n"+ " }\n"+ "}\n"+ "abstract class Property<E> {\n"+ " public abstract void compute(E e);\n"+ "}"); IMethod method = selectMethod(getCompilationUnit("/P/Test.java"), "compute", 3); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH\n" + "Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH"); } finally { deleteProject(project); } } // test in initializer block public void testBug123836g() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Test.java", "class Test {\n"+ " {\n" + " new Property<String>() {\n" + " @Override public void compute(String e) {}\n" + " };\n"+ " }\n"+ " void calc(Property prop, Property<? extends Serializable> p2) {\n"+ " prop.compute(null);\n"+ " p2.compute(null);\n"+ " }\n"+ "}\n"+ "abstract class Property<E> {\n"+ " public abstract void compute(E e);\n"+ "}"); IMethod method = selectMethod(getCompilationUnit("/P/Test.java"), "compute", 1); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH\n" + "Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH"); } finally { deleteProject(project); } } // test in static initializer public void testBug123836h() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Test.java", "class Test {\n"+ " static {\n" + " new Property<String>() {\n" + " @Override public void compute(String e) {}\n" + " };\n"+ " }\n"+ " void calc(Property prop, Property<? extends Serializable> p2) {\n"+ " prop.compute(null);\n"+ " p2.compute(null);\n"+ " }\n"+ "}\n"+ "abstract class Property<E> {\n"+ " public abstract void compute(E e);\n"+ "}"); IMethod method = selectMethod(getCompilationUnit("/P/Test.java"), "compute", 1); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH\n" + "Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH"); } finally { deleteProject(project); } } // test in static initializer public void testBug123836i() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Test.java", "class Test {\n"+ " Property <?>p = new Property<String>() {\n" + " @Override public void compute(String e) {}\n" + " };\n"+ " void calc(Property prop, Property<? extends Serializable> p2) {\n"+ " prop.compute(null);\n"+ " p2.compute(null);\n"+ " }\n"+ "}\n"+ "abstract class Property<E> {\n"+ " public abstract void compute(E e);\n"+ "}"); IMethod method = selectMethod(getCompilationUnit("/P/Test.java"), "compute", 1); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH\n" + "Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH"); } finally { deleteProject(project); } } public void testBug123836j() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Test.java", "class Test {\n"+ " void calc(Property prop, Property<? extends Serializable> p2) {\n"+ " prop.compute(null);\n"+ " p2.compute(null);\n"+ " }\n"+ "}\n"+ "abstract class Property<E> {\n"+ " public abstract void compute(E e);\n"+ "}\n"+ "class StringProperty extends Property<String> {\n"+ " @Override public void compute(String e) {\n"+ " new Property<String>() {\n"+ " @Override public void compute(String e) {\n"+ " new Property<String>() {\n"+ " @Override public void compute(String e) {}\n"+ " };\n"+ " }\n"+ " };\n"+ " }\n"+ "}"); IMethod method = selectMethod(getCompilationUnit("/P/Test.java"), "compute", 6); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH\n" + "Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH"); } finally { deleteProject(project); } } // test search of name public void _testBug123836g1() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Sub.java", "abstract class Sup<C> {\n" + " protected void m(C classifier) {}\n"+ " public void use(C owner) { m (owner); }\n" + "}\n" + "public class Sub extends Sup<String>{\n" + " @Override\n"+ " protected void m(String classifier) {}\n"+ " protected void m(Sub classifier) {}\n"+ "}\n" ); waitUntilIndexesReady(); // search SearchPattern pattern = SearchPattern.createPattern("Sub.m(String)", METHOD, REFERENCES, EXACT_RULE); search(pattern, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Sub.java void Sup.use(C) [m (owner)] EXACT_MATCH"); } finally { deleteProject(project); } } // test search of name (negative) public void _testBug123836h1() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Sub.java", "abstract class Sup<C> {\n" + " protected void m(C classifier) {}\n"+ " public void use(C owner) { m (owner); }\n" + "}\n" + "public class Sub extends Sup<String>{\n" + " @Override\n"+ " protected void m(String classifier) {}\n"+ " protected void m(Sub classifier) {}\n"+ "}\n" ); // search SearchPattern pattern = SearchPattern.createPattern("Sub.m(Sub)", METHOD, REFERENCES, EXACT_RULE); search(pattern, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults(""); } finally { deleteProject(project); } } /** * @bug 297825: [search] Rename refactoring doesn't update enclosing type * @test Search for references for enclosing type's subclass should return a match. * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=297825" */ public void testBug297825a() throws CoreException { try { IJavaProject p = createJavaProject("P", new String[] { "src" }, new String[] {"JCL_LIB"}, "bin"); createFolder("/P/src/b297825"); createFile("/P/src/b297825/_Foo.java", "package b297825;\n" + "public class _Foo {\n" + " public static class Bar {\n" + " }\n" + "}" ); createFile("/P/src/b297825/Foo.java", "package b297825;\n" + "public class Foo extends _Foo {\n" + "}\n" ); createFile("/P/src/b297825/Main.java", "package b297825;\n" + "public class Main {\n" + " public static void main(String[] args) {\n" + " new Foo.Bar();\n" + " }\n" + "}" ); waitUntilIndexesReady(); IType type = getCompilationUnit("/P/src/b297825/Foo.java").getType("Foo"); IJavaSearchScope scope = SearchEngine .createJavaSearchScope(new IJavaElement[] { p }, IJavaSearchScope.SOURCES); search(type, REFERENCES, scope, this.resultCollector); assertSearchResults("src/b297825/Main.java void b297825.Main.main(String[]) [Foo] EXACT_MATCH"); } finally { deleteProject("P"); } } /** * @bug 297825: [search] Rename refactoring doesn't update enclosing type * @test Verify there is no AIOOB when searching for references for a type. * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=297825" */ public void testBug297825b() throws CoreException { try { IJavaProject p = createJavaProject("P", new String[] { "src" }, new String[] {"JCL_LIB"}, "bin"); createFile("/P/src/Foo.java", "class _Foo {\n" + " public static class Bar {\n" + " }\n" + "}" + "public class Foo extends _Foo {\n" + " public static class FooBar {\n" + " }\n" + "}" + "class Main {\n" + " public static void main(String[] args) {\n" + " new Foo.Bar();\n" + " new Foo.FooBar();\n" + " }\n" + "}" ); waitUntilIndexesReady(); IType type = getCompilationUnit("/P/src/Foo.java").getType("Foo"); IJavaSearchScope scope = SearchEngine .createJavaSearchScope(new IJavaElement[] { p }, IJavaSearchScope.SOURCES); search(type, REFERENCES, scope, this.resultCollector); assertSearchResults("src/Foo.java void Main.main(String[]) [Foo] EXACT_MATCH\n" + "src/Foo.java void Main.main(String[]) [Foo] EXACT_MATCH"); } finally { deleteProject("P"); } } /** * @bug 297825: [search] Rename refactoring doesn't update enclosing type * @test Search for references for the top level type Foo should report no match. "new _Foo.Bar.Foo()" refers to a different type. * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=297825" */ public void testBug297825c() throws CoreException { try { IJavaProject p = createJavaProject("P", new String[] { "src" }, new String[] {"JCL_LIB"}, "bin"); createFolder("/P/src/b297825"); createFile("/P/src/b297825/_Foo.java", "package b297825;\n" + "public class _Foo {\n" + " public static class Bar {\n" + " public static class Foo {\n" + " }\n" + " }\n" + "}" ); createFile("/P/src/b297825/Foo.java", "package b297825;\n" + "public class Foo extends _Foo {\n" + "}" ); createFile("/P/src/b297825/Main.java", "package b297825;\n" + "class Main {\n" + " public static void main(String[] args) {\n" + " new _Foo.Bar.Foo();\n" + " }\n" + "}" ); waitUntilIndexesReady(); IType type = getCompilationUnit("/P/src/b297825/Foo.java").getType("Foo"); IJavaSearchScope scope = SearchEngine .createJavaSearchScope(new IJavaElement[] { p }, IJavaSearchScope.SOURCES); search(type, REFERENCES, scope, this.resultCollector); assertSearchResults(""); } finally { deleteProject("P"); } } /** * @bug 297825: [search] Rename refactoring doesn't update enclosing type * @test Search for references for enclosing type's subclass should return a match. The inner type is parameterized. * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=297825" */ public void testBug297825d() throws CoreException { try { IJavaProject p = createJavaProject("P", new String[] { "src" }, new String[] {"JCL_LIB"}, "bin"); createFolder("/P/src/b297825"); createFile("/P/src/b297825/_Foo.java", "package b297825;\n" + "public class _Foo {\n" + " public static class Bar<T> {\n" + " }\n" + "}" ); createFile("/P/src/b297825/Foo.java", "package b297825;\n" + "public class Foo extends _Foo {\n" + "}\n" ); createFile("/P/src/b297825/Main.java", "package b297825;\n" + "public class Main {\n" + " public static void main(String[] args) {\n" + " new Foo.Bar<String>();\n" + " }\n" + "}" ); waitUntilIndexesReady(); IType type = getCompilationUnit("/P/src/b297825/Foo.java").getType("Foo"); IJavaSearchScope scope = SearchEngine .createJavaSearchScope(new IJavaElement[] { p }, IJavaSearchScope.SOURCES); search(type, REFERENCES, scope, this.resultCollector); assertSearchResults("src/b297825/Main.java void b297825.Main.main(String[]) [Foo] EXACT_MATCH"); } finally { deleteProject("P"); } } /** * @bug 342393: Anonymous class' occurrence count is incorrect when two methods in a class have the same name. * @test Search for Enumerators with anonymous types * * @throws CoreException * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=342393" */ public void testBug342393() throws CoreException { try { IJavaProject project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "bin", "1.5"); String content = "package b342393;\n" + "class Generic {\n" + "enum A {\n" + "ONE {\n" + "A getSquare() {\n" + "return ONE;\n" + "}\n" + "},\n" + "TWO {\n" + "A getSquare() {\n" + "return TWO;\n" + "}\n" + "};\n" + "abstract A getSquare();\n" + "}\n" + "}"; createFolder("/P/b342393"); createFile("/P/b342393/Generic.java", content); IJavaSearchScope scope = SearchEngine. createJavaSearchScope( new IJavaElement[] { project }, IJavaSearchScope.SOURCES); search("getSquare", METHOD, DECLARATIONS, EXACT_RULE, scope, this.resultCollector); assertSearchResults("b342393/Generic.java A b342393.Generic$A.ONE:<anonymous>#1.getSquare() [getSquare] EXACT_MATCH\n" + "b342393/Generic.java A b342393.Generic$A.TWO:<anonymous>#1.getSquare() [getSquare] EXACT_MATCH\n" + "b342393/Generic.java A b342393.Generic$A.getSquare() [getSquare] EXACT_MATCH"); } finally { deleteProject("P"); } } /** * @bug 376673: DBCS4.2 Can not rename the class names when DBCS (Surrogate e.g. U+20B9F) is in it * @test Search for DBCS type should report the match * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=376673" */ public void testBug376673a() throws CoreException { try { if ("macosx".equals(System.getProperty("osgi.os"))) { System.out.println("testBug376673* may fail on macosx"); return; } IJavaProject project = createJavaProject("P", new String[] {""}, new String[] {"JCL17_LIB"}, "bin", "1.7"); String content = "package pkg;\n" + "class \uD842\uDF9F1 {}\n"; createFolder("/P/pkg"); try { IFile file = createFile("/P/pkg/\uD842\uDF9F1.java", content, "UTF-8"); file.setCharset("UTF-8", null); } catch (UnsupportedEncodingException e) { System.out.println("unsupported encoding"); } waitUntilIndexesReady(); IJavaSearchScope scope = SearchEngine. createJavaSearchScope( new IJavaElement[] { project }, IJavaSearchScope.SOURCES); search("\uD842\uDF9F1", TYPE, DECLARATIONS, EXACT_RULE, scope, this.resultCollector); assertSearchResults("pkg/\uD842\uDF9F1.java pkg.\uD842\uDF9F1 [\uD842\uDF9F1] EXACT_MATCH"); } finally { deleteProject("P"); } } // Search for DBCS method should report the match public void testBug376673b() throws CoreException { try { if ("macosx".equals(System.getProperty("osgi.os"))) { return; } IJavaProject project = createJavaProject("P", new String[] {""}, new String[] {"JCL17_LIB"}, "bin", "1.7"); String content = "package pkg;\n" + "class \uD842\uDF9F1 {" + " public void \uD842\uDF9Fm() {}\n" + "}\n"; createFolder("/P/pkg"); try { IFile file = createFile("/P/pkg/\uD842\uDF9F1.java", content, "UTF-8"); file.setCharset("UTF-8", null); } catch (UnsupportedEncodingException e) { System.out.println("unsupported encoding"); } waitUntilIndexesReady(); IJavaSearchScope scope = SearchEngine. createJavaSearchScope( new IJavaElement[] { project }, IJavaSearchScope.SOURCES); search("\uD842\uDF9Fm", METHOD, DECLARATIONS, EXACT_RULE, scope, this.resultCollector); assertSearchResults("pkg/\uD842\uDF9F1.java void pkg.\uD842\uDF9F1.\uD842\uDF9Fm() [\uD842\uDF9Fm] EXACT_MATCH"); } finally { deleteProject("P"); } } // Search for DBCS constructor should report the match public void testBug376673c() throws CoreException { try { if ("macosx".equals(System.getProperty("osgi.os"))) { return; } IJavaProject project = createJavaProject("P", new String[] {""}, new String[] {"JCL17_LIB"}, "bin", "1.7"); String content = "package pkg;\n" + "class \uD842\uDF9F1 {" + " public \uD842\uDF9F1() {}\n" + "}\n"; createFolder("/P/pkg"); try { IFile file = createFile("/P/pkg/\uD842\uDF9F1.java", content, "UTF-8"); file.setCharset("UTF-8", null); } catch (UnsupportedEncodingException e) { System.out.println("unsupported encoding"); } waitUntilIndexesReady(); IJavaSearchScope scope = SearchEngine. createJavaSearchScope( new IJavaElement[] { project }, IJavaSearchScope.SOURCES); search("\uD842\uDF9F1", CONSTRUCTOR, DECLARATIONS, EXACT_RULE, scope, this.resultCollector); assertSearchResults("pkg/\uD842\uDF9F1.java pkg.\uD842\uDF9F1() [\uD842\uDF9F1] EXACT_MATCH"); } finally { deleteProject("P"); } } // Search for DBCS field should report the match public void testBug376673d() throws CoreException { try { if ("macosx".equals(System.getProperty("osgi.os"))) { return; } IJavaProject project = createJavaProject("P", new String[] {""}, new String[] {"JCL17_LIB"}, "bin", "1.7"); String content = "package pkg;\n" + "class \uD842\uDF9F1 {" + " public int \uD842\uDF9Ff;\n" + "}\n"; createFolder("/P/pkg"); try { IFile file = createFile("/P/pkg/\uD842\uDF9F1.java", content, "UTF-8"); file.setCharset("UTF-8", null); } catch (UnsupportedEncodingException e) { System.out.println("unsupported encoding"); } waitUntilIndexesReady(); IJavaSearchScope scope = SearchEngine. createJavaSearchScope( new IJavaElement[] { project }, IJavaSearchScope.SOURCES); search("\uD842\uDF9Ff", FIELD, DECLARATIONS, EXACT_RULE, scope, this.resultCollector); assertSearchResults("pkg/\uD842\uDF9F1.java pkg.\uD842\uDF9F1.\uD842\uDF9Ff [\uD842\uDF9Ff] EXACT_MATCH"); } finally { deleteProject("P"); } } // Search for DBCS package name from a jar also should report the match public void testBug376673e() throws CoreException, IOException { try { if ("macosx".equals(System.getProperty("osgi.os"))) { return; } IJavaProject p = createJavaProject("P", new String[] {}, new String[] { "/P/lib376673.jar", "JCL17_LIB" }, "", "1.7"); org.eclipse.jdt.core.tests.util.Util.createJar( new String[] { "p\uD842\uDF9F/i\uD842\uDF9F/Test.java", "package p\uD842\uDF9F.i\uD842\uDF9F;\n" + "public class Test{}\n" }, p.getProject().getLocation().append("lib376673.jar").toOSString(), "1.7"); refresh(p); waitUntilIndexesReady(); int mask = IJavaSearchScope.APPLICATION_LIBRARIES | IJavaSearchScope.SOURCES; IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { p }, mask); search("Test", TYPE, DECLARATIONS, scope, this.resultCollector); assertSearchResults("lib376673.jar p\uD842\uDF9F.i\uD842\uDF9F.Test [No source] EXACT_MATCH"); } finally { deleteProject("P"); } } /** * @bug 357547: [search] Search for method references is returning methods as overridden even if the superclass's method is only package-visible * @test Search for a non-overridden method because of package visibility should not be found * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=357547" */ public void testBug357547a() throws CoreException { IJavaProject project = null; try { project = createJavaProject("P"); createFolder("/P/p1"); createFile("/P/p1/B.java", "package p1;\n" + "import p2.*;\n" + "public class B extends A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "}\n"); createFolder("/P/p2"); createFile("/P/p2/A.java", "package p2;\n" + "public class A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "public long m(){\n"+ "return new A().k();\n" + "}\n"+ "}\n"); IType type = getCompilationUnit("/P/p1/B.java").getType("B"); IMethod method = type.getMethod("k", new String[]{}); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Should not get any results", "", this.resultCollector); } finally { deleteProject(project); } } // search for the method name should also not return matches if not-overridden because of package-visible public void testBug357547b() throws CoreException { IJavaProject project = null; try { project = createJavaProject("P"); createFolder("/P/p1"); createFile("/P/p1/B.java", "package p1;\n" + "import p2.*;\n" + "public class B extends A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "}\n"); createFolder("/P/p2"); createFile("/P/p2/A.java", "package p2;\n" + "public class A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "public long m(){\n"+ "return new A().k();\n" + "}\n"+ "}\n"); waitUntilIndexesReady(); // search SearchPattern pattern = SearchPattern.createPattern("p*.B.k()", METHOD, REFERENCES , 0 ); search(pattern, SearchEngine.createJavaSearchScope(new IJavaElement[] { project }), this.resultCollector); assertSearchResults("Should not get any results", "", this.resultCollector); } finally { deleteProject(project); } } // search for the method name should return the match if same package public void testBug357547c() throws CoreException { IJavaProject project = null; try { project = createJavaProject("P"); createFolder("/P/p2"); createFile("/P/p2/B.java", "package p2;\n" + "public class B extends A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "}\n"); createFile("/P/p2/A.java", "package p2;\n" + "public class A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "public long m(){\n"+ "return new A().k();\n" + "}\n"+ "}\n"); waitUntilIndexesReady(); // search SearchPattern pattern = SearchPattern.createPattern("B.k()", METHOD, REFERENCES, EXACT_RULE); search(pattern, SearchEngine.createJavaSearchScope(new IJavaElement[] { project }), this.resultCollector); assertSearchResults("Wrong results", "p2/A.java long p2.A.m() [k()] EXACT_MATCH", this.resultCollector); } finally { deleteProject(project); } } public void testBug357547d() throws CoreException { IJavaProject project = null; try { project = createJavaProject("P"); createFolder("/P/p1"); createFile("/P/p1/B.java", "package p1;\n" + "import p2.*;\n" + "public class B extends A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "}\n"); createFolder("/P/p2"); createFile("/P/p2/A.java", "package p2;\n" + "public class A{ \n" + "long k(){\n" + "return 0;\n" + "}\n" + "public long m(){\n"+ "return new A().k();\n" + "}\n"+ "}\n"); createFile("/P/p2/B.java", "package p2;\n" + "public class B {\n" + "}\n"); waitUntilIndexesReady(); // search SearchPattern pattern = SearchPattern.createPattern("B.k()", METHOD, REFERENCES, EXACT_RULE); search(pattern, SearchEngine.createJavaSearchScope(new IJavaElement[] { project }), this.resultCollector); assertSearchResults("Should not get any results", "", this.resultCollector); } finally { deleteProject(project); } } // search for the method name should also not return matches if not-overridden because of package-visible // even if they are in jars public void testBug357547e() throws CoreException, IOException { IJavaProject project = null; try { project = createJavaProject("P", new String[] {""}, new String[] { "/P/lib357547.jar", "JCL15_LIB" }, "", "1.5"); org.eclipse.jdt.core.tests.util.Util.createJar(new String[] { "p2/A.java", "package p2;\n" + "public class A{}\n" }, project.getProject().getLocation().append("libStuff.jar").toOSString(), "1.5"); org.eclipse.jdt.core.tests.util.Util.createJar( new String[] { "p1/B.java", "package p1;\n"+ "import p2.*;\n"+ "public class B extends A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "}\n"}, null, project.getProject().getLocation().append("lib357547.jar").toOSString(), new String[] { project.getProject().getLocation().append("libStuff.jar").toOSString() }, "1.5"); refresh(project); createFolder("/P/p2"); createFile("/P/p2/A.java", "package p2;\n" + "public class A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "public long m(){\n"+ "return new A().k();\n" + "}\n"+ "}\n"); waitUntilIndexesReady(); // search SearchPattern pattern = SearchPattern.createPattern("B.k()", METHOD, REFERENCES, EXACT_RULE); search(pattern, SearchEngine.createJavaSearchScope(new IJavaElement[] { project }, IJavaSearchScope.APPLICATION_LIBRARIES | IJavaSearchScope.SOURCES), this.resultCollector); assertSearchResults("Wrong results", "", this.resultCollector); } finally { deleteProject(project); } } // search for the method name should also not return matches if not-overridden because of package-visible // even if they are in jars public void testBug357547f() throws CoreException, IOException { IJavaProject project = null; try { project = createJavaProject("P", new String[] {""}, new String[] { "/P/lib357547.jar", "JCL15_LIB" }, "", "1.5"); org.eclipse.jdt.core.tests.util.Util.createJar(new String[] { "p2/A.java", "package p2;\n" + "public class A{}\n" }, project.getProject().getLocation().append("libStuff.jar").toOSString(), "1.5"); org.eclipse.jdt.core.tests.util.Util.createJar( new String[] { "p2/B.java", "package p2;\n" + "import p2.*;\n" + "public class B extends A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "}\n"}, null, project.getProject().getLocation().append("lib357547.jar").toOSString(), new String[] { project.getProject().getLocation().append("libStuff.jar").toOSString() }, "1.5"); refresh(project); createFolder("/P/p2"); createFile("/P/p2/A.java", "package p2;\n" + "public class A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "public long m(){\n"+ "return new A().k();\n" + "}\n"+ "}\n"); waitUntilIndexesReady(); // search SearchPattern pattern = SearchPattern.createPattern("B.k()", METHOD, REFERENCES, EXACT_RULE); search(pattern, SearchEngine.createJavaSearchScope(new IJavaElement[] { project }, IJavaSearchScope.APPLICATION_LIBRARIES | IJavaSearchScope.SOURCES), this.resultCollector); assertSearchResults("Wrong results", "p2/A.java long p2.A.m() [k()] EXACT_MATCH", this.resultCollector); } finally { deleteProject(project); } } // search for declarations also should take care of default public void testBug357547g() throws CoreException { IJavaProject project = null; try { project = createJavaProject("P"); createFolder("/P/p1"); createFile("/P/p1/B.java", "package p1;\n" + "import p2.*;\n" + "public class B extends A {\n" + "long k(int a){\n" + "return 0;\n" + "}\n" + "}\n"); createFile("/P/p1/C.java", "package p1;\n" + "public class C extends B {\n" + "long k(int a){\n" + "return 0;\n" + "}\n" + "}\n"); createFolder("/P/p2"); createFile("/P/p2/A.java", "package p2;\n" + "public class A{ \n" + "long k(int a){\n" + "return 0;\n" + "}\n" + "public long m(){\n"+ "return new A().k(0);\n" + "}\n"+ "}\n"); createFile("/P/p2/B.java", "package p2;\n" + "public class B {\n" + "}\n"); waitUntilIndexesReady(); // search SearchPattern pattern = SearchPattern.createPattern("A.k(int)", METHOD, DECLARATIONS, EXACT_RULE); search(pattern, SearchEngine.createJavaSearchScope(new IJavaElement[] { project }), this.resultCollector); assertSearchResults("Wrong results", "p2/A.java long p2.A.k(int) [k] EXACT_MATCH", this.resultCollector); } finally { deleteProject(project); } } public void testBug378390() throws CoreException { IJavaProject project = null; try { project = createJavaProject("P"); createFolder("/P/p1"); createFile("/P/p1/B.java", "package p1;\n" + "import p2.*;\n" + "public class B extends A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "}\n"); createFolder("/P/p2"); createFile("/P/p2/A.java", "package p2;\n" + "public class A {\n" + "class B extends A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "}\n" + "long k(){\n" + "return 0;\n" + "}\n" + "public long m(){\n"+ "return new A().k();\n" + "}\n"+ "}\n"); IType type = getCompilationUnit("/P/p2/A.java").getType("A"); type = type.getTypes()[0]; IMethod method = type.getMethod("k", new String[]{}); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Wrong results", "p2/A.java long p2.A.m() [k()] EXACT_MATCH", this.resultCollector); } finally { deleteProject(project); } } /** * @bug 375971: [search] Not finding method references with generics * @test TODO * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=375971" */ public void testBug375971a() throws CoreException { try { createJavaProject("P"); createFile("/P/InterfaceI.java", "public interface InterfaceI <K, V>{\n"+ " public void addListener();\n"+ "}\n"); createFile("/P/ClassA.java", "public class ClassA <K, V, B> implements InterfaceI<K, V>{\n"+ " public void addListener() {\n" + "}\n" + "}\n"); createFile("/P/ClassB.java", "public class ClassB extends ClassA<String, String, String>{\n"+ " public void doSomething() {" + " addListener();\n"+ "}\n" + "}\n"); waitUntilIndexesReady(); // search IType type = getCompilationUnit("/P/InterfaceI.java").getType("InterfaceI"); IMethod method = type.getMethod("addListener", new String[]{}); this.resultCollector.showRule(); search(method, REFERENCES, ERASURE_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("ClassB.java void ClassB.doSomething() [addListener()] ERASURE_MATCH"); } finally { deleteProject("P"); } } public void testBug375971b() throws CoreException { try { createJavaProject("P"); createFile("/P/InterfaceI.java", "public interface InterfaceI <K, V>{\n"+ " public void addListener();\n"+ "}\n"); createFile("/P/ClassA.java", "public class ClassA <K, V, B> {\n"+ " public void addListener() {\n" + "}\n" + "}\n"); createFile("/P/ClassB.java", "public class ClassB extends ClassA<String, String, String> implements InterfaceI<String, String>{\n"+ " public void doSomething() {" + " addListener();\n"+ "}\n" + "}\n"); waitUntilIndexesReady(); // search IType type = getCompilationUnit("/P/InterfaceI.java").getType("InterfaceI"); IMethod method = type.getMethod("addListener", new String[]{}); this.resultCollector.showRule(); search(method, REFERENCES, ERASURE_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("ClassB.java void ClassB.doSomething() [addListener()] ERASURE_MATCH"); } finally { deleteProject("P"); } } public void testBug375971c() throws CoreException { try { createJavaProject("P"); createFile("/P/InterfaceI.java", "public interface InterfaceI <K, V>{\n"+ " public void addListener();\n"+ "}\n"); createFile("/P/ClassA.java", "public class ClassA <K, V, B> {\n"+ " public void addListener() {\n" + "}\n" + "}\n"); createFile("/P/ClassB.java", "public class ClassB extends ClassA<String, String, String> implements InterfaceI<String, String>{\n"+ " public void doSomething() {" + " addListener();\n"+ "}\n" + "}\n"); waitUntilIndexesReady(); // search IType type = getCompilationUnit("/P/ClassA.java").getType("ClassA"); IMethod method = type.getMethod("addListener", new String[]{}); this.resultCollector.showRule(); search(method, REFERENCES, ERASURE_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("ClassB.java void ClassB.doSomething() [addListener()] ERASURE_MATCH"); } finally { deleteProject("P"); } } public void testBug375971d() throws CoreException { try { createJavaProject("P"); createFile("/P/InterfaceI.java", "public interface InterfaceI <K, V>{\n"+ " public void addListener();\n"+ "}\n"); createFile("/P/ClassA.java", "public class ClassA <K, V, B> implements InterfaceI<K, V>{\n"+ " public void addListener() {\n" + "}\n" + "}\n"); createFile("/P/ClassB.java", "public class ClassB {\n"+ " public void doSomething(ClassA a) {" + " a.addListener();\n"+ "}\n" + "}\n"); waitUntilIndexesReady(); // search IType type = getCompilationUnit("/P/InterfaceI.java").getType("InterfaceI"); IMethod method = type.getMethod("addListener", new String[]{}); this.resultCollector.showRule(); search(method, REFERENCES, ERASURE_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("ClassB.java void ClassB.doSomething(ClassA) [addListener()] ERASURE_RAW_MATCH"); } finally { deleteProject("P"); } } public void testBug375971e() throws CoreException { try { createJavaProject("P"); createFile("/P/InterfaceI.java", "public interface InterfaceI <K, V>{\n"+ " public void addListener();\n"+ "}\n"); createFile("/P/ClassA.java", "public class ClassA <K, V, B> implements InterfaceI<K, V> {\n"+ " public void addListener() {\n" + "}\n" + "}\n"); createFile("/P/ClassB.java", "public class ClassB implements InterfaceI<String, String> {\n"+ " public void doSomething() {" + " addListener();\n"+ "}\n" + "}\n"); createFile("/P/ClassC.java", "public class ClassC extends ClassA<Integer, String, String> {\n"+ " public void doSomething() {" + " addListener();\n"+ "}\n" + "}\n"); waitUntilIndexesReady(); // search ICompilationUnit unit = getCompilationUnit("/P/ClassB.java"); IMethod method = selectMethod(unit, "addListener"); this.resultCollector.showRule(); search(method, REFERENCES, ERASURE_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("ClassB.java void ClassB.doSomething() [addListener()] EXACT_MATCH\n" + "ClassC.java void ClassC.doSomething() [addListener()] ERASURE_MATCH"); } finally { deleteProject("P"); } } public void testBug375971f() throws CoreException { try { createJavaProject("P"); createFile("/P/InterfaceI.java", "public interface InterfaceI {\n"+ " public void addListener();\n"+ "}\n"); createFile("/P/ClassA.java", "public class ClassA <K, V, B> implements InterfaceI{\n"+ " public void addListener() {\n" + "}\n" + "}\n"); createFile("/P/ClassB.java", "public class ClassB extends ClassA<String, String, String>{\n"+ " public void doSomething() {" + " addListener();\n"+ "}\n" + "}\n"); waitUntilIndexesReady(); // search IType type = getCompilationUnit("/P/InterfaceI.java").getType("InterfaceI"); IMethod method = type.getMethod("addListener", new String[]{}); this.resultCollector.showRule(); search(method, REFERENCES, ERASURE_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("ClassB.java void ClassB.doSomething() [addListener()] EXACT_MATCH"); } finally { deleteProject("P"); } } public void testBug375971g() throws CoreException { try { createJavaProject("P"); createFile("/P/InterfaceI.java", "public interface InterfaceI {\n"+ " public void addListener();\n"+ "}\n"); createFile("/P/ClassA.java", "public class ClassA <K, V, B> implements InterfaceI{\n"+ " public void addListener() {\n" + "}\n" + "}\n"); createFile("/P/ClassB.java", "public class ClassB<K, V, B> extends ClassA<K, V, B>{\n"+ " public void doSomething() {" + " addListener();\n"+ "}\n" + "}\n"); waitUntilIndexesReady(); // search IType type = getCompilationUnit("/P/InterfaceI.java").getType("InterfaceI"); IMethod method = type.getMethod("addListener", new String[]{}); this.resultCollector.showRule(); search(method, REFERENCES, ERASURE_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("ClassB.java void ClassB.doSomething() [addListener()] EXACT_MATCH"); } finally { deleteProject("P"); } } public void testBug375971h() throws CoreException { try { createJavaProject("P"); createFile("/P/InterfaceI.java", "public interface InterfaceI<K,V> {\n"+ " public void addListener();\n"+ "}\n"); createFile("/P/ClassA.java", "public class ClassA <K, V, B> implements InterfaceI<K, V>{\n"+ " public void addListener() {\n" + "}\n" + "}\n"); createFile("/P/ClassB.java", "public class ClassB<K, V, B> extends ClassA<K, V, B>{\n"+ " public void doSomething(InterfaceI<String, String> i) {" + " i.addListener();\n"+ "}\n" + "}\n"); waitUntilIndexesReady(); // search IType type = getCompilationUnit("/P/ClassA.java").getType("ClassA"); IMethod method = type.getMethod("addListener", new String[]{}); this.resultCollector.showRule(); search(method, REFERENCES, ERASURE_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("ClassB.java void ClassB.doSomething(InterfaceI<String,String>) [addListener()] EXACT_MATCH"); } finally { deleteProject("P"); } } public void testBug375971i() throws CoreException { try { createJavaProject("P"); createFile("/P/InterfaceI.java", "public interface InterfaceI<K,V> {\n"+ " public void addListener(K k);\n"+ "}\n"); createFile("/P/ClassA.java", "public class ClassA <K, V, B> implements InterfaceI<K, V>{\n"+ "public void addListener(K k) {\n" + "}\n" + "}\n"); createFile("/P/ClassB.java", "public class ClassB<K, V, B> extends ClassA<K, V, B>{\n"+ " public void doSomething(K k) {" + " addListener(k);\n"+ "}\n" + "}\n"); waitUntilIndexesReady(); // search IType type = getCompilationUnit("/P/InterfaceI.java").getType("InterfaceI"); IMethod method = type.getMethods()[0]; this.resultCollector.showRule(); search(method, REFERENCES, ERASURE_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("ClassB.java void ClassB.doSomething(K) [addListener(k)] ERASURE_MATCH"); } finally { deleteProject("P"); } } // search for constructor declarations in javadoc public void testBug381567a() throws CoreException { try { IJavaProject p = createJavaProject("P", new String[] { "src" }, new String[] {"JCL_LIB"}, "bin"); createFolder("/P/src/b381567"); createFile("/P/src/b381567/A.java", "package b381567;\n" + "/**\n" + "* {@link B#equals(java.lang.Object)}\n" + "*/\n" + "public class A {\n" + " A() {}\n" + "}"); createFile("/P/src/b381567/B.java", "package b381567;\n" + "public class B {\n" + "}"); waitUntilIndexesReady(); IJavaSearchScope scope = SearchEngine .createJavaSearchScope(new IJavaElement[] { p }, IJavaSearchScope.SOURCES); SearchPattern pattern = SearchPattern.createPattern("*", CONSTRUCTOR, DECLARATIONS, SearchPattern.R_PATTERN_MATCH); this.resultCollector.showInsideDoc(); search(pattern, scope, this.resultCollector); assertSearchResults("src/b381567/A.java b381567.A() [A] EXACT_MATCH OUTSIDE_JAVADOC"); } finally { deleteProject("P"); } } // search for all constructor occurrences (declarations and references) in javadoc public void testBug381567b() throws CoreException { try { IJavaProject p = createJavaProject("P", new String[] { "src" }, new String[] {"JCL_LIB"}, "bin"); createFolder("/P/src/b381567"); createFile("/P/src/b381567/A.java", "package b381567;\n" + "class A {\n" + " A(Exception ex) {}\n" + " class B { \n" + " /**\n" + " * Link {@link #A(Exception)} OK\n" + " */\n" + " public B(String str) {}\n" + " }\n" + "}" ); waitUntilIndexesReady(); IMethod[] methods = getCompilationUnit("/P/src/b381567/A.java") .getType("A").getMethods(); assertEquals("Invalid number of methods", 1, methods.length); assertTrue(methods[0].isConstructor()); IJavaSearchScope scope = SearchEngine .createJavaSearchScope(new IJavaElement[] { p }); this.resultCollector.showInsideDoc(); search(methods[0], ALL_OCCURRENCES, scope); assertSearchResults("src/b381567/A.java b381567.A(Exception) [A] EXACT_MATCH OUTSIDE_JAVADOC\n" + "src/b381567/A.java b381567.A$B(String) [A(Exception)] EXACT_MATCH INSIDE_JAVADOC"); } finally { deleteProject("P"); } } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=382778, Call hierarchy missing valid callers probably because java search marks exact matches as potential public void testBug382778() throws CoreException { try { IJavaProject p = createJavaProject("P", new String[] { "src" }, new String[] {"JCL_LIB"}, "bin"); createFolder("/P/src/b382778"); createFile("/P/src/b382778/Impl2.java", "package b382778;\n" + "public class Impl2 implements PublicInterface2 {\n" + " private final String name;\n" + " public Impl2(String name) {\n" + " this.name = name;\n" + " }\n" + " public String getName() {\n" + " return name;\n" + " }\n" + "}\n" ); createFile("/P/src/b382778/Main.java", "package b382778;\n" + "public class Main {\n" + " public static void main(String[] args) {\n" + " broken();\n" + " ok();\n" + " }\n" + " private static void broken() {\n" + " PublicInterface2 impl2 = new Impl2(\"Name Broken\");\n" + " Static.printIt(impl2.getName());\n" + " }\n" + " private static void ok() {\n" + " PublicInterface2 impl2 = new Impl2(\"Name OK\");\n" + " String name = impl2.getName();\n" + " Static.printIt(name);\n" + " }\n" + "}\n" ); createFile("/P/src/b382778/MainBroken.java", "package b382778;\n" + "public class MainBroken {\n" + " public static void main(String[] args) {\n" + " PublicInterface2 impl2 = new Impl2(\"Name Broken\");\n" + " Static.printIt(impl2.getName());\n" + " }\n" + "}\n" ); createFile("/P/src/b382778/MainOK.java", "package b382778;\n" + "public class MainOK {\n" + " public static void main(String[] args) {\n" + " PublicInterface2 impl2 = new Impl2(\"Name OK\");\n" + " String name = impl2.getName();\n" + " Static.printIt(name);\n" + " }\n" + "}\n" ); createFile("/P/src/b382778/PublicInterface1.java", "package b382778;\n" + "public interface PublicInterface1 extends PackageInterface1Getters {\n" + "}\n" + "/* package */interface PackageInterface1Getters {\n" + "String getName();\n" + "}" ); createFile("/P/src/b382778/PublicInterface2.java", "package b382778;\n" + "public interface PublicInterface2 extends PackageInterface2Getters {\n" + "}\n" + "/* package */interface PackageInterface2Getters extends PackageInterface1Getters {\n" + "}\n" ); createFile("/P/src/b382778/Static.java", "package b382778;\n" + "public class Static {\n" + "public static void printIt(String it) {\n" + "System.out.println(it);\n" + "}\n" + "}" ); waitUntilIndexesReady(); ICompilationUnit unit = getCompilationUnit("/P/src/b382778/Static.java"); IMethod method = unit.getType("Static").getMethod("printIt", new String[] { "QString;" }); IJavaSearchScope scope = SearchEngine .createJavaSearchScope(new IJavaElement[] { p }, IJavaSearchScope.SOURCES); search(method, REFERENCES, scope, this.resultCollector); assertSearchResults("src/b382778/Main.java void b382778.Main.broken() [printIt(impl2.getName())] EXACT_MATCH\n" + "src/b382778/Main.java void b382778.Main.ok() [printIt(name)] EXACT_MATCH\n" + "src/b382778/MainBroken.java void b382778.MainBroken.main(String[]) [printIt(impl2.getName())] EXACT_MATCH\n" + "src/b382778/MainOK.java void b382778.MainOK.main(String[]) [printIt(name)] EXACT_MATCH"); } finally { deleteProject("P"); } } public void testBug383315a() throws CoreException { try { IJavaProject p = createJavaProject("P", new String[] {}, new String[] { "JCL15_LIB" }, "", "1.5"); IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { p }, IJavaSearchScope.SOURCES); search("java.lang.Object.hashCode()", METHOD, ALL_OCCURRENCES, scope, this.resultCollector); assertSearchResults(""); // an NPE was thrown without the fix } finally { deleteProject("P"); } } public void testBug383315b() throws CoreException { try { IJavaProject p = createJavaProject("P"); createFolder("/P/pkg"); createFile("/P/pkg/A.java", "package pkg;\n"+ "public class A {\n"+ " void a() {\n"+ " }\n"+ "}"); createFile("/P/pkg/B.java", "package pkg;\n"+ "public class B extends A {\n"+ " void a() {\n"+ " }\n"+ "}"); createFile("/P/pkg/C.java", "package pkg;\n"+ "public class C extends B {\n"+ " void a() {\n"+ " }\n"+ "}"); createFile("/P/pkg/D.java", "package pkg;\n"+ "public class D extends C {\n"+ " void a() {\n"+ " }\n"+ " void d() {\n"+ " new A().a();\n"+ " }\n"+ "}"); IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { p }, IJavaSearchScope.SOURCES); search("C.a()", METHOD, REFERENCES, scope, this.resultCollector); assertSearchResults("pkg/D.java void pkg.D.d() [a()] EXACT_MATCH"); } finally { deleteProject("P"); } } public void testBug395348() throws CoreException { try { IJavaProject project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/X.java", "public class X {\n"+ " static void f() {\n" + " new Y<C2>() {\n"+ " public int compare(C2 o1) {\n" + " return 0;\n" + " }\n" + " };\n"+ " }\n" + "}\n" + "interface Y<T> {\n" + " public abstract int compare(T o1);\n" + "}\n" + "class C2 {}\n" ); IMethod method = selectMethod(getCompilationUnit("/P/X.java"), "compare", 0); MethodPattern pattern = (MethodPattern) SearchPattern.createPattern(method, DECLARATIONS|IGNORE_DECLARING_TYPE|IGNORE_RETURN_TYPE, EQUIVALENT_RULE|EXACT_RULE); IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { project }, IJavaSearchScope.SOURCES); search(pattern, scope, this.resultCollector); assertSearchResults("X.java int void X.f():<anonymous>#1.compare(C2) [compare] EXACT_MATCH\n" + "X.java int Y.compare(T) [compare] EXACT_MATCH"); // an NPE was thrown without the fix } finally { deleteProject("P"); } } public void testBug401272() throws CoreException, IOException { // the strategy of this test was outlined in https://bugs.eclipse.org/bugs/show_bug.cgi?id=401272#c16 try { IJavaProject p = createJavaProject("P", new String[] { "src" }, new String[] { "JCL15_LIB", "/P/libStuff.jar" }, "bin", "1.5"); org.eclipse.jdt.core.tests.util.Util.createJar( new String[] { // this class must be our possibleMatch #401 // it must be binary to trigger the ClassFileMatchLocator // the match must be impossible-due-to-mismatching-type-variables to trigger matchLocator.getMethodBinding(this.pattern); "p2/A.java", "package p2;\n" + "public class A<E> {\n" + " public int test(E b) { return 1; }\n" + " void bar() {\n" + " test(null);\n" + " }\n" + "}\n", // this class contains the method we search for, possibleMatch #402 // (must be > 401 possibleMatches to trigger environment cleanup) "p2/B.java", "package p2;\n" + "public class B<T> {\n" + " public int test(T t) {\n" + " return 0;\n" + " }\n" + "}\n" }, p.getProject().getLocation().append("libStuff.jar").toOSString(), "1.5"); refresh(p); createFolder("/P/src/pkg"); // 400 matches, which populate MatchLocator.unitScope // all 400 matches are processed in one go of MatchLocator.locateMatches(JavaProject, PossibleMatch[], int, int) // next round will call nameEnvironment.cleanup() but reuse MatchLocator.unitScope ==> BOOM for (int i = 0; i < 400; i++) { createFile("/P/src/pkg/Bug"+i+".java", "package pkg;\n"+ "public class Bug"+i+" {\n"+ " String[] test(p2.B<String> b) {\n" + " return b.test(\"S\");\n" + " }\n" + "}"); } waitUntilIndexesReady(); IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { p }, IJavaSearchScope.SOURCES|IJavaSearchScope.SYSTEM_LIBRARIES|IJavaSearchScope.APPLICATION_LIBRARIES); IMethod method = p.findType("p2.B").getMethods()[1]; search(method, METHOD, ALL_OCCURRENCES, scope, this.resultCollector); assertSearchResults("libStuff.jar int p2.B.test(T) [No source] EXACT_MATCH"); // an NPE was thrown without the fix } finally { deleteProject("P"); } } /** * @bug 423409: [search] Search shows references to fields as potential matches * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=423409" */ public void testBug423409() throws CoreException, JavaModelException { try { createJavaProject("P", new String[] { "src" }, new String[] {"JCL_LIB"}, "bin"); createFolder("/P/src/com/test"); createFile("/P/src/com/test/Test2.java", "package com.test;\n" + "\n" + "class Test2 {\n" + " public static final FI fi/*here*/ = null; // find references of 'fi' via Ctrl+Shift+G\n" + " \n" + " {\n" + " fun1(fi);\n" + " }\n" + " \n" + " private FI fun1(FI x) {\n" + " System.out.println(fi);\n" + " return fi;\n" + " }\n" + "}\n" ); createFile("/P/src/com/test/Test1.java", "package com.test;\n" + "\n" + "class Test1 {\n" + " public static final FI fi = null;\n" + "}\n" ); createFile("/P/src/com/test/T.java", "package com.test;\n" + "\n" + "interface FI {\n" + " int foo(int x);\n" + "}\n"); waitUntilIndexesReady(); IType type = getCompilationUnit("/P/src/com/test/Test2.java").getType("Test2"); IJavaElement field = type.getField("fi"); search(field, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults( "src/com/test/Test2.java com.test.Test2.{} [fi] EXACT_MATCH\n" + "src/com/test/Test2.java FI com.test.Test2.fun1(FI) [fi] EXACT_MATCH\n" + "src/com/test/Test2.java FI com.test.Test2.fun1(FI) [fi] EXACT_MATCH"); } finally { deleteProject("P"); } } }
[ "375833274@qq.com" ]
375833274@qq.com
716772d952e1fcf295e042d33571e35e2c4f1014
12c20ca957a984a26b0412715796e17a5952286f
/src/main/java/com/design/spicsback/dao/LikeDao.java
582820a12e7019c278f282af7c69bb95e9ca1b57
[]
no_license
K-ON-RMTY/spics-back
2146d794d23c61dc1345cfe236c7bb0e5d0d54b7
c09e4d5bb4239a719e239be9a68728ce9ed40f2b
refs/heads/master
2023-04-07T03:32:39.526549
2021-04-18T00:51:04
2021-04-18T00:51:04
338,952,224
0
0
null
null
null
null
UTF-8
Java
false
false
1,287
java
package com.design.spicsback.dao; import com.design.spicsback.entity.Like; import org.apache.ibatis.annotations.Param; import java.util.List; /** * (TLike)表数据库访问层 * * @author jj * @since 2021-02-15 09:07:48 */ public interface LikeDao { /** * 通过ID查询单条数据 * * @param id 主键 * @return 实例对象 */ Like queryById(Integer id); /** * 查询指定行数据 * * @param offset 查询起始位置 * @param limit 查询条数 * @return 对象列表 */ List<Like> queryAllByLimit(@Param("offset") int offset, @Param("limit") int limit); /** * 通过实体作为筛选条件查询 * * @param like 实例对象 * @return 对象列表 */ List<Like> queryAll(Like like); /** * 新增数据 * * @param like 实例对象 * @return 影响行数 */ int insert(Like like); /** * 修改数据 * * @param like 实例对象 * @return 影响行数 */ int update(Like like); /** * 通过主键删除数据 * * @param id 主键 * @return 影响行数 */ int deleteById(Integer id); Like addOne(Like like); boolean deleteByUserIdAndPicId(Like like); }
[ "2746452802@qq.com" ]
2746452802@qq.com
77d57a2127abdc4d9a31a7ba4f2f31734bbcb857
69953f4c2f730eadaf21ec76706400c8e1404a30
/libvlc/src/main/java/org/videolan/libvlc/VLCEvent.java
68c57622e1994cc7589e69a9d227e7412ee171c4
[]
no_license
jacksunshine6/VlcVideoView
7770601a6ea138443bde7b34c461e72d4e90a9d6
672f27ac5c46a76b377a1ee64711c1757ac662b2
refs/heads/master
2022-03-23T13:13:10.611432
2019-12-19T03:15:40
2019-12-19T03:15:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
957
java
package org.videolan.libvlc; abstract class VLCEvent { public final int type; protected final long arg1; protected final long arg2; protected final float argf1; VLCEvent(int type) { this.type = type; this.arg1 = this.arg2 = 0; this.argf1 = 0.0f; } VLCEvent(int type, long arg1) { this.type = type; this.arg1 = arg1; this.arg2 = 0; this.argf1 = 0.0f; } VLCEvent(int type, long arg1, long arg2) { this.type = type; this.arg1 = arg1; this.arg2 = arg2; this.argf1 = 0.0f; } VLCEvent(int type, float argf) { this.type = type; this.arg1 = this.arg2 = 0; this.argf1 = argf; } void release() { /* do nothing */ } /** * Listener for libvlc events * * @see VLCEvent */ public interface Listener<T extends VLCEvent> { void onEvent(T event); } }
[ "547372220@qq.com" ]
547372220@qq.com
25f6536663899af8303f19f2339cdd04bf97f270
827a3793f1e3efb51065349c878328adba0c2af5
/COAT/src/dao/exp/SynchronizationCons_list.java
098654b9c26c433a7f4aec7320d9bf8aeff01cb2
[]
no_license
zhangzhengwu/zhangzhengwu.github.io
76b158b40808736016b7aa96bfac7efacb856ba5
af6a30f3ffe6081a920b0808f9d5d8f87aa04c9f
refs/heads/master
2021-07-16T11:20:08.826103
2020-07-11T11:23:04
2020-07-11T11:23:04
187,379,186
1
0
null
null
null
null
UTF-8
Java
false
false
1,488
java
package dao.exp; import java.util.Timer; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import org.apache.log4j.Logger; public class SynchronizationCons_list implements ServletContextListener { private Timer timers=null; Logger logger = Logger.getLogger(SynchronizationCons_list.class); public void contextDestroyed(ServletContextEvent event) { // TODO Auto-generated method stub //在这里关闭监听器,同时关闭定时器 timers.cancel(); event.getServletContext().log("SynchronizationCons_list-->系统同步定时器销毁....."); logger.info("SynchronizationCons_list-->系统同步定时器销毁....."); } public void contextInitialized(ServletContextEvent event) { // TODO Auto-generated method stub timers=new Timer(); event.getServletContext().log("SynchronizationCons_list-->系统同步定时器初始化完毕....."); logger.info("SynchronizationCons_list-->系统同步定时器初始化完毕....."); //调用exportHistoryBean,0表示任务无延迟,5*1000表示每隔5秒执行任务,60*60*1000表示一个小时 timers.schedule(new SpecifiedTask(event.getServletContext()), 30*1000, 60*60*1000); //timer.schedule(new Task(), 0, 10*1000); event.getServletContext().log("SynchronizationCons_list-->系统同步任务已经添加....."); logger.info("SynchronizationCons_list-->系统同步任务已经添加....."); } }
[ "zhangzw368319@163.com" ]
zhangzw368319@163.com
d5f3db580ab0a68573f0b242dc3d8422a0408f5c
d3e69255d14935261684a8377852ae3bf0e02696
/etc/MyApplication_alarm/app/src/main/java/com/example/osujeong/myapplication_alarm/MainActivity.java
ab7bba66641c0e0803c5c06b83c425b3bd1176c4
[]
no_license
Dongjuooo/jaksimsamli
68d43bdc34d374c19f005a298b4ac2ab99484027
2ce0f5d5fbc0add50ef2c248492060e7e79df311
refs/heads/master
2020-04-07T11:58:37.623692
2018-12-15T17:59:36
2018-12-15T17:59:36
158,349,541
0
0
null
null
null
null
UTF-8
Java
false
false
923
java
package com.example.osujeong.myapplication_alarm; import android.content.Intent; import android.provider.AlarmClock; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button = (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent =new Intent(AlarmClock. ACTION_SET_ALARM); intent.putExtra(AlarmClock.EXTRA_HOUR,23); intent.putExtra(AlarmClock.EXTRA_MINUTES,40); startActivity(intent); } }); } }
[ "dbehdwn90@naver.com" ]
dbehdwn90@naver.com
b5dffa162eff5db45c56d5746eb2c391d4d602c7
917b59ed8c4c4733f02038a63f1506e5417e194b
/shop_vin/src/main/java/kr/vin/mapper/UserMapper.java
a8b77e76f087a1840e77d6a8ae7d8e39049069b1
[]
no_license
kasandra1471/shopvin
6c1af5d84ed1f0e5a03dd2f58d072ecef9dd987c
3f078f8ae93a4d9ebba3824005d4ee695b981250
refs/heads/master
2022-12-14T11:00:00.242088
2020-09-02T09:13:58
2020-09-02T09:13:58
292,234,717
0
0
null
null
null
null
UTF-8
Java
false
false
808
java
package kr.vin.mapper; import java.util.ArrayList; import java.util.List; import kr.vin.domain.UserVO; public interface UserMapper { // @Select("select * from user_tbl") public List<UserVO> getList(); public void insert(UserVO user) throws Exception; public void insertSelectKey(UserVO user) throws Exception; public UserVO read(String userId) throws Exception; public int delete(String userId) throws Exception; public int update(UserVO user) throws Exception; public UserVO idCheck(String id) throws Exception; public int checkOverId(String userId); public ArrayList<UserVO> idCheck(UserVO vo); public UserVO id_all_check(String id); public void Member_dete(String userId); public void memberUpdate(UserVO vo) throws Exception; }
[ "63571188+kasandra1471@users.noreply.github.com" ]
63571188+kasandra1471@users.noreply.github.com
e444b4f8752b125f8e213964992291637bb37742
b4cc706ff17e9a79738d676c5ffd5e8369b97f5b
/livehub-common/src/main/java/com/livehub/common/exception/file/FileException.java
5bf13369c9422a4fb3b32190448ebcb0b26dbefa
[]
no_license
livehub-root/livehub-java
d46fcb86e543d56ed7c0b5dee54945d5f65759cb
b077da787a64c4943a65ad5368ec52647cd2a95c
refs/heads/master
2022-07-27T01:00:37.877873
2020-01-14T09:25:20
2020-01-14T09:25:20
216,455,077
1
0
null
2022-07-06T20:45:02
2019-10-21T01:43:50
Java
UTF-8
Java
false
false
349
java
package com.livehub.common.exception.file; import com.livehub.common.exception.base.BaseException; /** * 文件信息异常类 */ public class FileException extends BaseException { private static final long serialVersionUID = 1L; public FileException(String code, Object[] args) { super("file", code, args, null); } }
[ "407987823@qq.com" ]
407987823@qq.com
4d38aa24fc1e7d3a944e04c48f2e6a6677213cc7
dee3aa7388db0aef11305f65f628844bf7698deb
/src/thi/common/iservices/IBuchService.java
e7b4f29fe17e69374bfc88f3a98125b976ef1d32
[]
no_license
cindyputri/Lagerverwaltung
3ee289a0e220c675b9849a071fdfa08d6ec18f90
8667cd242aece02057584c8ecc9a3e0bd6d4bb19
refs/heads/master
2021-09-03T20:36:35.141833
2018-01-11T20:50:38
2018-01-11T20:50:38
115,561,010
0
0
null
null
null
null
UTF-8
Java
false
false
1,452
java
package thi.common.iservices; import java.util.List; import thi.common.modell.BuchExemplar; import thi.common.modell.BuchTyp; import thi.common.modell.Regal; /** * This interface defines the abstract view of a Buch service * that has all methods necessary to manage business logic level * of BuchTyp and BuchExemplar objects * * @author cindy * */ public interface IBuchService { /** * Buch Anlegen * @param String isbn * @throws EeaLibraryException */ public void createBuch( String isbn ); /** * Search Function to find book by keyword * @param keyword can be a part of ISBN * @return List of possible BuchTyps */ public List<BuchTyp> searchBook( String keyword ); /** * Put the book exemplar in the Regal * @param buchExemplar * @param regal */ public void buchEinlagern(BuchExemplar buchExemplar, Regal regal); /** * Put the book exemplar in the new Regal * @param buchExemplar * @param neuRegal */ public void buchUmlagern(BuchExemplar buchExemplar, Regal neuRegal); /** * Take the book exemplar out * @param buchExemplar */ public void buchAuslagern(BuchExemplar buchExemplar); /** * Get all Book * @return List of all BuchTyp */ public List<BuchTyp> getBuchTyps(); /** * Get Book Type from the given isbn * unnecessary characters will be deleted * @param isbn String * @return List of BuchTyps */ public List<BuchTyp> getBuchTypByISBN(String isbn); }
[ "cip9206@thi.de" ]
cip9206@thi.de
6a4f0b6c3728e4d56d375c71ea77e3deebc15fcf
72acd11c9ca43f6b3f340f6404544a7cc043d7f2
/src/main/java/com/eventswarm/MutableTarget.java
b828e7df471be32f3fe47dc984342c134929c369
[ "Apache-2.0" ]
permissive
eventswarm/eventswarm
270b32afac104f2f96056151bb8afbeee6987976
ec9701c30464b10952cb288b8776c0b72bb99ee5
refs/heads/master
2021-08-07T11:37:12.211214
2020-04-18T05:15:32
2020-04-18T05:15:32
227,041,307
0
0
Apache-2.0
2020-10-13T18:06:18
2019-12-10T06:05:00
Java
UTF-8
Java
false
false
1,255
java
/** * Copyright 2007-2014 Ensift Pty Ltd as trustee for the Avaz Trust and other contributors * * 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.eventswarm; import com.eventswarm.events.Event; /** * Interface for classes that receive both Add and Remove event actions * * Created with IntelliJ IDEA. * User: andyb */ public interface MutableTarget extends AddEventAction, RemoveEventAction { /** * Simple MutableTarget that ignores any add/remove actions, i.e. a bit bucket */ public static MutableTarget BITBUCKET = new MutableTarget() { public void execute(AddEventTrigger trigger, Event event) { } public void execute(RemoveEventTrigger trigger, Event event) { } }; }
[ "andyb@deontik.com" ]
andyb@deontik.com
12917634db5471a071b63f6608dd1976e0b98e42
401f7d4909562a00485fa5822a43d7ab51331847
/src/main/java/com/disasterrecovery/model/Machine.java
92964db6762c6a8a977b6c6cb577326c5d86dab2
[]
no_license
utmalone/disaster-recovery
005f28f9aec8d162ef5de03a0da34106916ce3b5
0013829d27d6f68bef1a91ad8b6fdb6974bb59c2
refs/heads/main
2023-04-30T16:58:15.931386
2021-05-19T03:15:49
2021-05-19T03:15:49
367,523,616
0
0
null
null
null
null
UTF-8
Java
false
false
1,646
java
package com.disasterrecovery.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public class Machine { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String machineCode; private String description; private double hourlyRent; private double maxHoursPerDay; public Machine() { } public Machine(String machineCode, String description, double hourlyRent, double maxHoursPerDay) { this.machineCode = machineCode; this.description = description; this.hourlyRent = hourlyRent; this.maxHoursPerDay = maxHoursPerDay; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getMachineCode() { return machineCode; } public void setMachineCode(String machineCode) { this.machineCode = machineCode; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public double getHourlyRent() { return hourlyRent; } public void setHourlyRent(double hourlyRent) { this.hourlyRent = hourlyRent; } public double getMaxHoursPerDay() { return maxHoursPerDay; } public void setMaxHoursPerDay(double maxHoursPerDay) { this.maxHoursPerDay = maxHoursPerDay; } @Override public String toString() { return "Machine `" + machineCode + "` rents out at $" + hourlyRent + " per hour and can work up to " + maxHoursPerDay + " hours per day."; } }
[ "70651540+utmalone@users.noreply.github.com" ]
70651540+utmalone@users.noreply.github.com
feaee6098f127bedb0d242cbac244253ca4e7e87
fd37da06db73f2704f9dcca93db71d99a583f8cc
/Java-Book-Practices/src/chapter19practices/SerialNumberGenerator13.java
6da653b4fd657ff58c3613371ff8653aeedc4651
[]
no_license
SergiyEnsary/Thinking-In-Java-Exercises
9d0b30a884d385a9d45b78fa62328aa18b578efb
9dcd60bd5dd851ed7b97131615d835e0bfb45387
refs/heads/master
2020-05-31T19:12:17.033435
2019-11-26T02:14:33
2019-11-26T02:14:33
190,451,924
0
0
null
null
null
null
UTF-8
Java
false
false
200
java
package chapter19practices; public class SerialNumberGenerator13 { private static volatile int serialNumber = 0; public static synchronized int nextSerialNumber() { return serialNumber++; } }
[ "sergiyensary@gmail.com" ]
sergiyensary@gmail.com
e4a606e44d77f533974ae4d278026fccb9a59d80
0f515602bdd2bcdf77a4e4edd52efb30c986d303
/src/main/java/ReadMEJava.java
e96bdc20a2023181e708b6320962024774a6f6f6
[]
no_license
felixnilantha/spark-java
b7d8ff57be47a0b2c1020e77733d2eacbeefc1c5
e772d6c183ac5f800b3b6c33480b99c7e77426ea
refs/heads/master
2020-12-03T00:21:37.533689
2017-07-02T11:55:04
2017-07-02T11:55:04
96,020,237
0
0
null
null
null
null
UTF-8
Java
false
false
995
java
import org.apache.spark.SparkConf; import org.apache.spark.api.java.JavaRDD; import org.apache.spark.api.java.JavaSparkContext; import org.apache.spark.api.java.function.Function; public class ReadMEJava { @SuppressWarnings("serial") public static void main(String[] args) { boolean javaVersion = false; SparkConf conf = new SparkConf().setMaster("local").setAppName("My App"); JavaSparkContext sc = new JavaSparkContext(conf); JavaRDD<String> lines = sc.textFile("/Users/sooriyasilva/Documents/spark-2.1.1-bin-hadoop2.7/README.md"); JavaRDD<String> pythonLines; // Java 7 example if (javaVersion == true) { pythonLines = lines.filter( new Function<String, Boolean>() { @Override public Boolean call(String line) throws Exception { return line.contains("Spark"); } } ); } else { // Java 8 lambda pythonLines = lines.filter(line -> line.contains("Python")); } System.out.println(pythonLines.first()); sc.close(); } }
[ "felixnilantha@gmail.com" ]
felixnilantha@gmail.com
fedae6acf5479ce98d1d537062d8f46217b6a321
1de459e77271d753efb7c6cab368bfe39b2dc026
/hello-spring-cloud/src/main/java/demo/serviceprovider/ServiceProviderBoot.java
a1a447bfdb1a85cddb78ad728cba0f96952b64a1
[]
no_license
bureos/hello-java1.3
7e02b2f04a15e7c58f1ad1b1ffb90bef6338c489
4164446c6d53811ff46d376f54681bddb838b660
refs/heads/master
2023-04-14T23:38:42.804574
2022-11-16T07:45:58
2022-11-16T07:45:58
217,962,729
0
0
null
2023-03-31T15:19:48
2019-10-28T03:57:10
Java
UTF-8
Java
false
false
466
java
package demo.serviceprovider; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; @EnableDiscoveryClient @SpringBootApplication public class ServiceProviderBoot { public static void main(String[] args) { new SpringApplicationBuilder(ServiceProviderBoot.class).profiles("service-provider").run(args); } }
[ "1021618813@qq.com" ]
1021618813@qq.com
165f83ea69bf819b30949d23986b83abcb27a3c3
165857a62f2d7f9656f28ae3ac208d621cb78c39
/hbase-common/src/main/java/cn/enncloud/metric/config/EnnMetricsConfig.java
d6e490f30ae7385060870ecee8f9b619de881f24
[ "Apache-2.0", "CC-BY-3.0", "BSD-3-Clause", "MIT", "LicenseRef-scancode-protobuf" ]
permissive
dpjeca/hbase
036d352d557109108826073fd60df72ea6d7b28b
100e61653de1b99145201bef8f78ea889aaf1c57
refs/heads/master
2020-12-11T07:19:32.804763
2016-10-08T07:22:22
2016-10-08T07:22:22
68,525,347
0
0
null
2016-10-08T07:22:23
2016-09-18T14:07:33
Java
UTF-8
Java
false
false
2,992
java
package cn.enncloud.metric.config; import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; /** Created by jessejia on 16/9/2. */ public class EnnMetricsConfig { private String hostname; private String ipAddress; private int freqInSeconds; private EnnMetricsConfig() {} public String getHostname() { return hostname; } public String getIpAddress() { return ipAddress; } public int getFreqInSeconds() { return freqInSeconds; } @Override public String toString() { return "EnnMetricsConfig{" + "hostname='" + hostname + '\'' + ", ipAddress='" + ipAddress + '\'' + ", freqInSeconds=" + freqInSeconds + '}'; } public static Builder newBuilder() { return new Builder(); } public static EnnMetricsConfig getDefaultConfig() throws UnknownHostException, IOException { return getConfigWithFreq(1); } /** * Get EnnMetricsConfig with specified frequency. * * @param freqInSeconds frequency in seconds * @return EnnMetricsConfig with specified frequency * @throws UnknownHostException while can not get the local host * @throws IOException will not meet this exception in this method */ public static EnnMetricsConfig getConfigWithFreq(int freqInSeconds) throws UnknownHostException, IOException { InetAddress localHost = InetAddress.getLocalHost(); String hostname = localHost.getHostName(); String ip = localHost.getHostAddress(); return newBuilder() .setHostname(hostname) .setIpAddress(ip) .setFreqInSeconds(freqInSeconds) .build(); } public static final class Builder { private String hostname; private String ipAddress; private int freqInSeconds = -1; private Builder() {} /** * The only method to build EnnMetricsConfig. * * @return EnnMetricsConfig * @throws IOException while not giving required parameters */ public EnnMetricsConfig build() throws IOException { validateConfig(); EnnMetricsConfig config = new EnnMetricsConfig(); config.hostname = this.hostname; config.ipAddress = this.ipAddress; config.freqInSeconds = this.freqInSeconds; return config; } private void validateConfig() throws IOException { // For now, only check the parameter was set or not if (this.freqInSeconds == -1 || this.hostname == null || this.ipAddress == null) { throw new IOException("EnnMetricsConfig need theses parameters: hostname, ipAddress and freqInSeconds"); } } public Builder setHostname(String hostname) { this.hostname = hostname; return this; } public Builder setIpAddress(String ipAddress) { this.ipAddress = ipAddress; return this; } public Builder setFreqInSeconds(int freqInSeconds) { this.freqInSeconds = freqInSeconds; return this; } } }
[ "dpjeca@163.com" ]
dpjeca@163.com