blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
390
content_id
stringlengths
40
40
detected_licenses
listlengths
0
35
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
539 values
visit_date
timestamp[us]date
2016-08-02 21:09:20
2023-09-06 10:10:07
revision_date
timestamp[us]date
1990-01-30 01:55:47
2023-09-05 21:45:37
committer_date
timestamp[us]date
2003-07-12 18:48:29
2023-09-05 21:45:37
github_id
int64
7.28k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
13 values
gha_event_created_at
timestamp[us]date
2012-06-11 04:05:37
2023-09-14 21:59:18
gha_created_at
timestamp[us]date
2008-05-22 07:58:19
2023-08-28 02:39:21
gha_language
stringclasses
62 values
src_encoding
stringclasses
26 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
128
12.8k
extension
stringclasses
11 values
content
stringlengths
128
8.19k
authors
listlengths
1
1
author_id
stringlengths
1
79
7db5e7b9b3729dbee614f49010f8494a1efc6591
d6dfdc83446a0c8f4539227d0f674cf9289bdb08
/bundle/edu.gemini.dataman.app/src/main/java/edu/gemini/datasetrecord/impl/trigger/ObsRecordTriggerClient.java
94d5df28600708a8e391992a4ee1973774b435d8
[ "MIT" ]
permissive
gitter-badger/ocs
6c3c795ce288f101eff6a800d320b4735ed95571
9329213adcb1ff60cea76e4feb426ed79985361f
refs/heads/develop
2020-12-11T04:12:28.014282
2015-06-16T01:17:13
2015-06-16T01:17:13
37,540,475
0
0
null
2015-06-16T15:57:10
2015-06-16T15:57:09
null
UTF-8
Java
false
false
1,847
java
// // $Id: ObsRecordTriggerClient.java 617 2006-11-22 21:39:46Z shane $ // package edu.gemini.datasetrecord.impl.trigger; import edu.gemini.pot.spdb.IDBDatabaseService; import java.util.HashSet; import java.util.Set; /** * The ObsRecordTriggerClient hides the implementation details involved in * working with triggers in the ODB. Namely, it registers the * {@link ObsRecordTriggerCondition} and {@link ObsRecordTriggerAction} with * the ODB, and maintains the associated Lease on the registration. */ public final class ObsRecordTriggerClient { private final Set<IDBDatabaseService> _dbs = new HashSet<IDBDatabaseService>(); private final ObsRecordTriggerCondition cond = ObsRecordTriggerCondition.INSTANCE; private final ObsRecordTriggerAction action; private boolean _enabled = false; public ObsRecordTriggerClient(ObsRecordTriggerHandler handler) { action = new ObsRecordTriggerAction(handler); } private synchronized void _start() { if (!_enabled) return; for (IDBDatabaseService db: _dbs) db.registerTrigger(cond, action); } private synchronized void _stop() { for (IDBDatabaseService db: _dbs) db.unregisterTrigger(cond, action); } public synchronized boolean isEnabled() { return _enabled; } public synchronized void setEnabled(boolean enabled) { if (enabled == _enabled) return; _enabled = enabled; if (enabled) { _start(); } else { _stop(); } } public synchronized void addDatabase(IDBDatabaseService database) { _dbs.add(database); _start(); } public synchronized void removeDatabase(IDBDatabaseService database) { database.unregisterTrigger(cond, action); _dbs.remove(database); } }
[ "swalker2m@gmail.com" ]
swalker2m@gmail.com
0d1111f29abe084dbc8241af5e254d1e0cf012c3
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/31/31_cbda2061bdd88fa53686c3c976bd29e9dd8ea24e/ActionViewRequest/31_cbda2061bdd88fa53686c3c976bd29e9dd8ea24e_ActionViewRequest_t.java
5bbeabe5dc83229c17d6ecf93fc2d3b46e039e85
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
1,750
java
package nl.nikhef.jgridstart.gui; import java.awt.event.ActionEvent; import javax.swing.JFrame; import javax.swing.event.ListSelectionEvent; import nl.nikhef.jgridstart.CertificatePair; import nl.nikhef.jgridstart.CertificateSelection; import nl.nikhef.jgridstart.gui.util.BareBonesActionLaunch; import nl.nikhef.jgridstart.gui.util.TemplateWizard; /** Shows the "request new" wizard from ActionRequest, but this action * just views the form of the currently selected certificate and doesn't * create a new one. * * @author wvengen */ public class ActionViewRequest extends CertificateAction { /** Page of request wizard to show by default */ protected int defaultPage = 0; public ActionViewRequest(JFrame parent, CertificateSelection s) { super(parent, s); putValue(NAME, "View request..."); putValue(MNEMONIC_KEY, new Integer('R')); BareBonesActionLaunch.addAction("viewrequest", this); } public ActionViewRequest(JFrame parent, CertificateSelection s, int defaultPage) { this(parent, s); this.defaultPage = defaultPage; } /** Name depends on state of selected certificate */ @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { CertificatePair cert = selection.getCertificatePair(); if (cert!=null && cert.getCertificate()!=null) putValue(NAME, "View request..."); else putValue(NAME, "Continue request..."); } super.valueChanged(e); } public void actionPerformed(ActionEvent e) { logger.finer("Action: "+getValue(NAME)); TemplateWizard dlg = new RequestWizard(parent, selection.getCertificatePair()); dlg.setStep(defaultPage); dlg.setVisible(true); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
ce6252bc93cf0fb7925e24cc77f4e1f3aac75cba
dd5508d18353f06408a6b29b945dd9a495be9d79
/deprecated/com/tscp/mvne/refund/OldRefund.java
ee29fa7e793af5b22a33058eaef2ad2e8450e364
[]
no_license
pongalong/TSCPMVNA
53257d4e9e8d87c2602c0dfa5a7d43f82712949b
4ba3d403d238ffedecc6be152d54d4d053956544
refs/heads/master
2016-09-07T19:01:07.525976
2013-08-20T17:32:09
2013-08-20T17:32:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
899
java
package com.tscp.mvne.refund; import java.util.Date; public class OldRefund { private int transId; private Date refundDate; private String refundBy; private int refundReasonCode; private String notes; public int getTransId() { return transId; } public void setTransId( int transId) { this.transId = transId; } public Date getRefundDate() { return refundDate; } public void setRefundDate( Date refundDate) { this.refundDate = refundDate; } public String getRefundBy() { return refundBy; } public void setRefundBy( String refundBy) { this.refundBy = refundBy; } public int getRefundReasonCode() { return refundReasonCode; } public void setRefundReasonCode( int refundReasonCode) { this.refundReasonCode = refundReasonCode; } public String getNotes() { return notes; } public void setNotes( String notes) { this.notes = notes; } }
[ "jonathan.pong@gmail.com" ]
jonathan.pong@gmail.com
debd0fbb2ea026193cd86dbdc26b18d7f514e516
22c74db7c1d0de3db87a22fcde261e96a97ab8e1
/src/main/java/com/neodem/common/beans/AbstractSerializedBean.java
7fe2b642a7590bf67a5c2524d0cb6f903ca4e121
[]
no_license
neodem/neodem-common
e5aee70f0884585101d7126604f897c9da44d6a3
e9f61cc00da08e1ea3db51d222894f69d8614a95
refs/heads/master
2021-01-20T11:25:35.930279
2018-02-05T22:52:18
2018-02-05T22:52:18
3,393,166
0
0
null
null
null
null
UTF-8
Java
false
false
953
java
package com.neodem.common.beans; import java.io.Serializable; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; /** an empy bean that implements {@link Serializable} for general use. * Basic toString(), equals() and hashCode() methods are provided * @author Vincent Fumo * @version 1.0 */ public abstract class AbstractSerializedBean implements Serializable { public AbstractSerializedBean() { super(); } public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); } public boolean equals(Object o) { return EqualsBuilder.reflectionEquals(this, o); } public int hashCode() { return HashCodeBuilder.reflectionHashCode(this); } }
[ "neodem@gmail.com" ]
neodem@gmail.com
2b8c4fed41edaeea8e30ac34a74ac9ca7aa39bb6
23b6d6971a66cf057d1846e3b9523f2ad4e05f61
/MLMN-Alarm-Feedback/src/vo/AlDyNonFinishByAlClass.java
eaece3c431fa8f7677d2cb70cfa31d004c950917
[]
no_license
vhctrungnq/mlmn
943f5a44f24625cfac0edc06a0d1b114f808dfb8
d3ba1f6eebe2e38cdc8053f470f0b99931085629
refs/heads/master
2020-03-22T13:48:30.767393
2018-07-08T05:14:12
2018-07-08T05:14:12
140,132,808
0
1
null
2018-07-08T05:29:27
2018-07-08T02:57:06
Java
UTF-8
Java
false
false
5,752
java
package vo; import java.io.Serializable; import java.util.Date; public class AlDyNonFinishByAlClass implements Serializable { /** * This field was generated by Apache iBATIS ibator. * This field corresponds to the database column AL_DY_NON_FINISH_BY_AL_CLASS.DAY * * @ibatorgenerated Sat Jan 12 09:57:55 ICT 2013 */ private Date day; /** * This field was generated by Apache iBATIS ibator. * This field corresponds to the database column AL_DY_NON_FINISH_BY_AL_CLASS.SYSTEM * * @ibatorgenerated Sat Jan 12 09:57:55 ICT 2013 */ private String system; /** * This field was generated by Apache iBATIS ibator. * This field corresponds to the database column AL_DY_NON_FINISH_BY_AL_CLASS.ALARM_CLASS * * @ibatorgenerated Sat Jan 12 09:57:55 ICT 2013 */ private String alarmClass; /** * This field was generated by Apache iBATIS ibator. * This field corresponds to the database column AL_DY_NON_FINISH_BY_AL_CLASS.QTY * * @ibatorgenerated Sat Jan 12 09:57:55 ICT 2013 */ private Integer qty; /** * This field was generated by Apache iBATIS ibator. * This field corresponds to the database column AL_DY_NON_FINISH_BY_AL_CLASS.CREATE_DATE * * @ibatorgenerated Sat Jan 12 09:57:55 ICT 2013 */ private Date createDate; /** * This field was generated by Apache iBATIS ibator. * This field corresponds to the database table AL_DY_NON_FINISH_BY_AL_CLASS * * @ibatorgenerated Sat Jan 12 09:57:55 ICT 2013 */ private static final long serialVersionUID = 1L; /** * This method was generated by Apache iBATIS ibator. * This method returns the value of the database column AL_DY_NON_FINISH_BY_AL_CLASS.DAY * * @return the value of AL_DY_NON_FINISH_BY_AL_CLASS.DAY * * @ibatorgenerated Sat Jan 12 09:57:55 ICT 2013 */ public Date getDay() { return day; } /** * This method was generated by Apache iBATIS ibator. * This method sets the value of the database column AL_DY_NON_FINISH_BY_AL_CLASS.DAY * * @param day the value for AL_DY_NON_FINISH_BY_AL_CLASS.DAY * * @ibatorgenerated Sat Jan 12 09:57:55 ICT 2013 */ public void setDay(Date day) { this.day = day; } /** * This method was generated by Apache iBATIS ibator. * This method returns the value of the database column AL_DY_NON_FINISH_BY_AL_CLASS.SYSTEM * * @return the value of AL_DY_NON_FINISH_BY_AL_CLASS.SYSTEM * * @ibatorgenerated Sat Jan 12 09:57:55 ICT 2013 */ public String getSystem() { return system; } /** * This method was generated by Apache iBATIS ibator. * This method sets the value of the database column AL_DY_NON_FINISH_BY_AL_CLASS.SYSTEM * * @param system the value for AL_DY_NON_FINISH_BY_AL_CLASS.SYSTEM * * @ibatorgenerated Sat Jan 12 09:57:55 ICT 2013 */ public void setSystem(String system) { this.system = system; } /** * This method was generated by Apache iBATIS ibator. * This method returns the value of the database column AL_DY_NON_FINISH_BY_AL_CLASS.ALARM_CLASS * * @return the value of AL_DY_NON_FINISH_BY_AL_CLASS.ALARM_CLASS * * @ibatorgenerated Sat Jan 12 09:57:55 ICT 2013 */ public String getAlarmClass() { return alarmClass; } /** * This method was generated by Apache iBATIS ibator. * This method sets the value of the database column AL_DY_NON_FINISH_BY_AL_CLASS.ALARM_CLASS * * @param alarmClass the value for AL_DY_NON_FINISH_BY_AL_CLASS.ALARM_CLASS * * @ibatorgenerated Sat Jan 12 09:57:55 ICT 2013 */ public void setAlarmClass(String alarmClass) { this.alarmClass = alarmClass; } /** * This method was generated by Apache iBATIS ibator. * This method returns the value of the database column AL_DY_NON_FINISH_BY_AL_CLASS.QTY * * @return the value of AL_DY_NON_FINISH_BY_AL_CLASS.QTY * * @ibatorgenerated Sat Jan 12 09:57:55 ICT 2013 */ public Integer getQty() { return qty; } /** * This method was generated by Apache iBATIS ibator. * This method sets the value of the database column AL_DY_NON_FINISH_BY_AL_CLASS.QTY * * @param qty the value for AL_DY_NON_FINISH_BY_AL_CLASS.QTY * * @ibatorgenerated Sat Jan 12 09:57:55 ICT 2013 */ public void setQty(Integer qty) { this.qty = qty; } /** * This method was generated by Apache iBATIS ibator. * This method returns the value of the database column AL_DY_NON_FINISH_BY_AL_CLASS.CREATE_DATE * * @return the value of AL_DY_NON_FINISH_BY_AL_CLASS.CREATE_DATE * * @ibatorgenerated Sat Jan 12 09:57:55 ICT 2013 */ public Date getCreateDate() { return createDate; } /** * This method was generated by Apache iBATIS ibator. * This method sets the value of the database column AL_DY_NON_FINISH_BY_AL_CLASS.CREATE_DATE * * @param createDate the value for AL_DY_NON_FINISH_BY_AL_CLASS.CREATE_DATE * * @ibatorgenerated Sat Jan 12 09:57:55 ICT 2013 */ public void setCreateDate(Date createDate) { this.createDate = createDate; } private String dayStr; public String getDayStr() { return dayStr; } public void setDayStr(String dayStr) { this.dayStr = dayStr; } }
[ "trungnq@vhc.com.vn" ]
trungnq@vhc.com.vn
4373d4fa15c56843efa52c0ba78ae0fcd43fec27
844dc53bbce7aab957e037cb84a0c9a8f8922f8e
/src/ch/tsphp/common/ITypeSymbol.java
5961a6126a228940a778fa90a778a294f088011b
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
tsphp/tsphp-common
c600aef1e343a05e4316ae967a1b82a689db7715
aad23bb4852daf37ca6e9bc3ed1a1b33260f2a34
refs/heads/master
2020-04-20T14:08:06.059354
2014-08-24T18:23:26
2014-08-24T18:23:26
13,151,924
0
2
null
null
null
null
UTF-8
Java
false
false
568
java
/* * This file is part of the TSPHP project published under the Apache License 2.0 * For the full copyright and license information, please have a look at LICENSE in the * root folder or visit the project's website http://tsphp.ch/wiki/display/TSPHP/License */ package ch.tsphp.common; import java.util.Set; public interface ITypeSymbol extends ISymbol { Set<ITypeSymbol> getParentTypeSymbols(); boolean isNullable(); /** * Return the default value as ITSPHPAst, as an expression respectively. */ ITSPHPAst getDefaultValue(); }
[ "rstoll@tutteli.ch" ]
rstoll@tutteli.ch
a8f5df3fdbd029682c6f47451ab939a9661f263a
779bd0d5701654585708dcb7593b256394c1d5a8
/it.unibo.java.radar/src/eu/hansolo/steelseries/tools/GaugeType.java
9e5cc8c8b60405b7241082bbce74696311c757a9
[]
no_license
anatali/iss2019Lab
95fd9df254b1649f5907784ff1124e576f335d23
9331c0f19b634a32d01621d55d20291cf255c57e
refs/heads/master
2022-12-14T20:21:23.145244
2019-10-30T10:08:45
2019-10-30T10:08:45
172,677,977
2
0
null
2022-12-09T03:53:41
2019-02-26T09:16:52
Jupyter Notebook
UTF-8
Java
false
false
2,821
java
package eu.hansolo.steelseries.tools; /** * * @author Gerrit Grunwald <han.solo at muenster.de> */ public enum GaugeType { TYPE1(0, (1.5 * Math.PI), (0.5 * Math.PI), (Math.PI / 2.0), 180, 90, 0, new java.awt.geom.Rectangle2D.Double(0.55, 0.55, 0.55, 0.15), eu.hansolo.steelseries.tools.PostPosition.CENTER, eu.hansolo.steelseries.tools.PostPosition.MAX_CENTER_TOP, eu.hansolo.steelseries.tools.PostPosition.MIN_LEFT), TYPE2(0, (1.5 * Math.PI), (0.5 * Math.PI), Math.PI, 180, 180, 0, new java.awt.geom.Rectangle2D.Double(0.55, 0.55, 0.55, 0.15), eu.hansolo.steelseries.tools.PostPosition.CENTER, eu.hansolo.steelseries.tools.PostPosition.MIN_LEFT, eu.hansolo.steelseries.tools.PostPosition.MAX_RIGHT), TYPE3(0, Math.PI, 0, (1.5 * Math.PI), 270, 270, -90, new java.awt.geom.Rectangle2D.Double(0.4, 0.55, 0.4, 0.15), eu.hansolo.steelseries.tools.PostPosition.CENTER, eu.hansolo.steelseries.tools.PostPosition.MAX_CENTER_BOTTOM, eu.hansolo.steelseries.tools.PostPosition.MAX_RIGHT), TYPE4((Math.toRadians(60)), (Math.PI + Math.toRadians(30)), 0, Math.toRadians(300), 240, 300, -60, new java.awt.geom.Rectangle2D.Double(0.4, 0.55, 0.4, 0.15), eu.hansolo.steelseries.tools.PostPosition.CENTER, eu.hansolo.steelseries.tools.PostPosition.MIN_BOTTOM, eu.hansolo.steelseries.tools.PostPosition.MAX_BOTTOM), TYPE5(0, (1.75 * Math.PI), (0.75 * Math.PI), (Math.PI / 2.0), 180, 90, 0, new java.awt.geom.Rectangle2D.Double(0.55, 0.55, 0.55, 0.15), eu.hansolo.steelseries.tools.PostPosition.LOWER_CENTER, eu.hansolo.steelseries.tools.PostPosition.SMALL_GAUGE_MIN_LEFT, eu.hansolo.steelseries.tools.PostPosition.SMALL_GAUGE_MAX_RIGHT); final public double FREE_AREA_ANGLE; final public double ROTATION_OFFSET; final public double TICKMARK_OFFSET; final public double ANGLE_RANGE; final public double ORIGIN_CORRECTION; final public double APEX_ANGLE; final public double BARGRAPH_OFFSET; final public eu.hansolo.steelseries.tools.PostPosition[] POST_POSITIONS; final public java.awt.geom.Rectangle2D LCD_FACTORS; private GaugeType(final double FREE_AREA_ANGLE, final double ROTATION_OFFSET, final double TICKMARK_OFFSET, final double ANGLE_RANGE, final double ORIGIN_CORRECTION, final double APEX_ANGLE, final double BARGRAPH_OFFSET, final java.awt.geom.Rectangle2D LCD_FACTORS, final eu.hansolo.steelseries.tools.PostPosition... POST_POSITIONS) { this.FREE_AREA_ANGLE = FREE_AREA_ANGLE; this.ROTATION_OFFSET = ROTATION_OFFSET; this.TICKMARK_OFFSET = TICKMARK_OFFSET; this.ANGLE_RANGE = ANGLE_RANGE; this.ORIGIN_CORRECTION = ORIGIN_CORRECTION; this.APEX_ANGLE = APEX_ANGLE; this.BARGRAPH_OFFSET = BARGRAPH_OFFSET; this.POST_POSITIONS = POST_POSITIONS; this.LCD_FACTORS = LCD_FACTORS; } }
[ "antonio.natali@unibo.it" ]
antonio.natali@unibo.it
cb3718f1659fe06f8c25a6bd4695352b0263d2d0
6c75bc3f0b09f3d01765f973020b0b2a5af35deb
/enjoysdk_core_app/src/main/java/com/enjoy/sdk/core/sdk/SDKApplication.java
8d21f2198ce4d12e2a46628db3e471cae24daead
[]
no_license
luckkiss/enjoySDK
40d15593b2e31fedcdb7ca18e58381469bbc1037
7ccd4bd4a13ecf7a4376ebe0dc0ef41c7ee67c81
refs/heads/main
2023-08-31T12:34:59.553328
2021-11-08T10:28:00
2021-11-08T10:28:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,093
java
package com.enjoy.sdk.core.sdk; import android.app.Application; import android.content.Context; import com.enjoy.sdk.core.api.EnjoyConstants; import com.enjoy.sdk.core.own.EnjoyPlatformAPP; import com.enjoy.sdk.core.platform.OPlatformBean; import com.enjoy.sdk.core.sdk.config.PlatformConfig; import com.enjoy.sdk.core.sdk.config.SDKConfig; import com.enjoy.sdk.framework.utils.ReflectUtils; public class SDKApplication { private static final String[] TN_PT_ID = {"1"}; private static SDKConfig sdkConfig; private static PlatformConfig platformConfig; private IPlatformAPP platformApp; public static SDKConfig getSdkConfig() { return sdkConfig; } public static PlatformConfig getPlatformConfig() { return platformConfig; } //判断是否自营平台 public static boolean isTNPlatform() { String ptId = sdkConfig.getPtId(); for (String id : TN_PT_ID) { if (ptId.equals(id)) { return true; } } return false; } public void proxyOnCreate(Application application) { SDKData.cleanSDKData(); SDKData.setSdkGID(sdkConfig.getGameId()); SDKData.setSdkPID(sdkConfig.getPtId()); SDKData.setSdkRefer(sdkConfig.getRefer()); SDKData.setSdkVer(EnjoyConstants.SDK_VERSION); platformApp.onCreate(application); } public void proxyAttachBaseContext(Context base) { sdkConfig = SDKConfig.init(base); platformConfig = PlatformConfig.init(base); if (isTNPlatform()) { this.platformApp = (IPlatformAPP) ReflectUtils.reflect(EnjoyPlatformAPP.class).newInstance().get(); } else { this.platformApp = (IPlatformAPP) ReflectUtils.reflect(platformConfig.getAppClass()).newInstance(OPlatformBean.init(SDKApplication.getSdkConfig(), SDKApplication.getPlatformConfig())).get(); } platformApp.attachBaseContext(base); OaidHelper.init(base); } public void setLogSwitch(boolean logSwitch) { SDKData.setLogSwitch(logSwitch); } }
[ "1628103949@qq.com" ]
1628103949@qq.com
cf3c2299b1257ab1f0a18d995582df973ce9c136
8fbfdbde0c17098c1f8cd9fef26542cc6ec2047f
/src/test/java/com/mycompany/hazelcast/security/jwt/TokenProviderTest.java
313f4bbc55a74c0109e4fe5a1702239ae1bdc638
[]
no_license
l7777777b/jhipster-sample-hazelcast
b3ac2b2372622c8ed0dbee674e4d9c00d89452c8
731ba367aff57cae360cf687403c9e1848198e28
refs/heads/master
2022-12-07T00:07:11.896449
2020-09-03T10:59:01
2020-09-03T10:59:01
292,539,993
0
0
null
null
null
null
UTF-8
Java
false
false
3,888
java
package com.mycompany.hazelcast.security.jwt; import static org.assertj.core.api.Assertions.assertThat; import com.mycompany.hazelcast.security.AuthoritiesConstants; import io.github.jhipster.config.JHipsterProperties; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.io.Decoders; import io.jsonwebtoken.security.Keys; import java.security.Key; import java.util.*; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.test.util.ReflectionTestUtils; public class TokenProviderTest { private static final long ONE_MINUTE = 60000; private Key key; private TokenProvider tokenProvider; @BeforeEach public void setup() { tokenProvider = new TokenProvider(new JHipsterProperties()); key = Keys.hmacShaKeyFor( Decoders.BASE64.decode("fd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8") ); ReflectionTestUtils.setField(tokenProvider, "key", key); ReflectionTestUtils.setField(tokenProvider, "tokenValidityInMilliseconds", ONE_MINUTE); } @Test public void testReturnFalseWhenJWThasInvalidSignature() { boolean isTokenValid = tokenProvider.validateToken(createTokenWithDifferentSignature()); assertThat(isTokenValid).isEqualTo(false); } @Test public void testReturnFalseWhenJWTisMalformed() { Authentication authentication = createAuthentication(); String token = tokenProvider.createToken(authentication, false); String invalidToken = token.substring(1); boolean isTokenValid = tokenProvider.validateToken(invalidToken); assertThat(isTokenValid).isEqualTo(false); } @Test public void testReturnFalseWhenJWTisExpired() { ReflectionTestUtils.setField(tokenProvider, "tokenValidityInMilliseconds", -ONE_MINUTE); Authentication authentication = createAuthentication(); String token = tokenProvider.createToken(authentication, false); boolean isTokenValid = tokenProvider.validateToken(token); assertThat(isTokenValid).isEqualTo(false); } @Test public void testReturnFalseWhenJWTisUnsupported() { String unsupportedToken = createUnsupportedToken(); boolean isTokenValid = tokenProvider.validateToken(unsupportedToken); assertThat(isTokenValid).isEqualTo(false); } @Test public void testReturnFalseWhenJWTisInvalid() { boolean isTokenValid = tokenProvider.validateToken(""); assertThat(isTokenValid).isEqualTo(false); } private Authentication createAuthentication() { Collection<GrantedAuthority> authorities = new ArrayList<>(); authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.ANONYMOUS)); return new UsernamePasswordAuthenticationToken("anonymous", "anonymous", authorities); } private String createUnsupportedToken() { return Jwts.builder().setPayload("payload").signWith(key, SignatureAlgorithm.HS512).compact(); } private String createTokenWithDifferentSignature() { Key otherKey = Keys.hmacShaKeyFor( Decoders.BASE64.decode("Xfd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8") ); return Jwts .builder() .setSubject("anonymous") .signWith(otherKey, SignatureAlgorithm.HS512) .setExpiration(new Date(new Date().getTime() + ONE_MINUTE)) .compact(); } }
[ "jhipster-bot@jhipster.tech" ]
jhipster-bot@jhipster.tech
d452cad865f8fd90b7c9ce03c0deeda6b38db838
40d844c1c780cf3618979626282cf59be833907f
/src/testcases/CWE789_Uncontrolled_Mem_Alloc/s03/CWE789_Uncontrolled_Mem_Alloc__random_HashMap_15.java
9da7c2614a6d7511055b2df45143d296d717b14a
[]
no_license
rubengomez97/juliet
f9566de7be198921113658f904b521b6bca4d262
13debb7a1cc801977b9371b8cc1a313cd1de3a0e
refs/heads/master
2023-06-02T00:37:24.532638
2021-06-23T17:22:22
2021-06-23T17:22:22
379,676,259
1
0
null
null
null
null
UTF-8
Java
false
false
3,636
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE789_Uncontrolled_Mem_Alloc__random_HashMap_15.java Label Definition File: CWE789_Uncontrolled_Mem_Alloc.int.label.xml Template File: sources-sink-15.tmpl.java */ /* * @description * CWE: 789 Uncontrolled Memory Allocation * BadSource: random Set data to a random value * GoodSource: A hardcoded non-zero, non-min, non-max, even number * BadSink: HashMap Create a HashMap using data as the initial size * Flow Variant: 15 Control flow: switch(6) * * */ package testcases.CWE789_Uncontrolled_Mem_Alloc.s03; import testcasesupport.*; import javax.servlet.http.*; import java.security.SecureRandom; import java.util.HashMap; public class CWE789_Uncontrolled_Mem_Alloc__random_HashMap_15 extends AbstractTestCase { /* uses badsource and badsink */ public void bad() throws Throwable { int data = 0; switch (6) { case 6: /* POTENTIAL FLAW: Set data to a random value */ data = (new SecureRandom()).nextInt(); break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0; break; } /* POTENTIAL FLAW: Create a HashMap using data as the initial size. data may be very large, creating memory issues */ HashMap intHashMap = new HashMap(data); } /* goodG2B1() - use goodsource and badsink by changing the switch to switch(5) */ private void goodG2B1() throws Throwable { int data = 0; switch (5) { case 6: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0; break; default: /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */ data = 2; break; } /* POTENTIAL FLAW: Create a HashMap using data as the initial size. data may be very large, creating memory issues */ HashMap intHashMap = new HashMap(data); } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the switch */ private void goodG2B2() throws Throwable { int data = 0; switch (6) { case 6: /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */ data = 2; break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0; break; } /* POTENTIAL FLAW: Create a HashMap using data as the initial size. data may be very large, creating memory issues */ HashMap intHashMap = new HashMap(data); } public void good() throws Throwable { goodG2B1(); goodG2B2(); } /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException { mainFromParent(args); } }
[ "you@example.com" ]
you@example.com
3d65012a53bb1a3d207b0696d6b7851d2d92b059
863acb02a064a0fc66811688a67ce3511f1b81af
/sources/com/google/android/gms/internal/ads/zzsd.java
2a5a72e308b984f2a1bc0c2fb65c9eb5adda2c42
[ "MIT" ]
permissive
Game-Designing/Custom-Football-Game
98d33eb0c04ca2c48620aa4a763b91bc9c1b7915
47283462b2066ad5c53b3c901182e7ae62a34fc8
refs/heads/master
2020-08-04T00:02:04.876780
2019-10-06T06:55:08
2019-10-06T06:55:08
211,914,568
1
1
null
null
null
null
UTF-8
Java
false
false
565
java
package com.google.android.gms.internal.ads; import java.util.Collections; import java.util.HashMap; import java.util.Map; public final class zzsd { /* renamed from: a */ private final Map<String, String> f29305a = new HashMap(); /* renamed from: b */ private Map<String, String> f29306b; /* renamed from: a */ public final synchronized Map<String, String> mo32181a() { if (this.f29306b == null) { this.f29306b = Collections.unmodifiableMap(new HashMap(this.f29305a)); } return this.f29306b; } }
[ "tusharchoudhary0003@gmail.com" ]
tusharchoudhary0003@gmail.com
1e4b6020cb4efe472b7148b749208b118ffeeb38
5765c87fd41493dff2fde2a68f9dccc04c1ad2bd
/Variant Programs/1-5/4/warehouse/Storehouse.java
e52d2d2f8dfa96d978cbcabff8edfb491d17078a
[ "MIT" ]
permissive
hjc851/Dataset2-HowToDetectAdvancedSourceCodePlagiarism
42e4c2061c3f8da0dfce760e168bb9715063645f
a42ced1d5a92963207e3565860cac0946312e1b3
refs/heads/master
2020-08-09T08:10:08.888384
2019-11-25T01:14:23
2019-11-25T01:14:23
214,041,532
0
0
null
null
null
null
UTF-8
Java
false
false
4,055
java
package warehouse; import java.util.HashMap; import euphonious.AgainOfficer; import developmentElements.PhyllosilicatePreclude; import fabricator.*; import scenario.Emulation; import static java.lang.System.out; public class Storehouse { public synchronized void appendToken(developmentElements.PhyllosilicatePreclude body) throws WarehouseHeavyDeviation { if (this.warehousesDirectory.enumeration() < Storehouse.safekeepingCurb) { this.warehousesDirectory.infixEnd(body); this.halfRely += (this.halfRely + (this.numeration() - 1) * (euphonious.AgainOfficer.continuingAgain() - this.concludingSeminarMonth) / scenario.Emulation.actualPretending().againRestricted()); this.thesaurus.put(body, euphonious.AgainOfficer.continuingAgain()); this.concludingSeminarMonth = (euphonious.AgainOfficer.continuingAgain()); for (fabricator.Output equally : last) { if (equally.prevalentGovernmental() == FarmCentral.overfed) { equally.unstarve(); return; } } } else { throw new warehouse.WarehouseHeavyDeviation(); } } public double intermediateDays; public double concludingSeminarMonth; public fabricator.Output last[]; public warehouse.ThrowawayLinkageRegistry<PhyllosilicatePreclude> warehousesDirectory; public double accruedBodies; public synchronized developmentElements.PhyllosilicatePreclude followingDetail() throws ArchivingBareDistinction { if (this.numeration() > 0) { developmentElements.PhyllosilicatePreclude hamatum = this.warehousesDirectory.transferInaugural(); this.halfRely += (this.halfRely + (this.numeration() + 1) * (euphonious.AgainOfficer.continuingAgain() - this.concludingSeminarMonth) / scenario.Emulation.actualPretending().againRestricted()); double introduceClip = this.thesaurus.remove(hamatum); double absentMeter = euphonious.AgainOfficer.continuingAgain(); this.intermediateDays = ((intermediateDays * accruedBodies + (absentMeter - introduceClip)) / ++accruedBodies); for (fabricator.Output arsenic : pre) { if (arsenic.prevalentGovernmental() == FarmCentral.halt) { arsenic.unlocking(); break; } } this.concludingSeminarMonth = (euphonious.AgainOfficer.continuingAgain()); return hamatum; } else { throw new warehouse.ArchivingBareDistinction(); } } public java.util.HashMap<PhyllosilicatePreclude, Double> thesaurus; public synchronized void bentOriginal(fabricator.Output... prior) { this.pre = (prior); } public synchronized java.lang.String statistical() { return java.lang.String.format( "| %-14s | %-12.11s | %-12.11s |", this, this.intermediateDays, this.halfRely); } public fabricator.Output pre[]; public synchronized String toString() { return "Storage" + map; } public static synchronized void dictatedMemoryCircumscribe(int depotLimitation) { if (depotLimitation > 0) Storehouse.safekeepingCurb = (depotLimitation); else out.println("ERROR: The StorageLimit of all Storage objects must be larger than 0"); } public synchronized int numeration() { return this.warehousesDirectory.enumeration(); } public synchronized void placeSoon(fabricator.Output... the) { this.last = (the); } public double halfRely; public static synchronized int stowageRestricting() { return Storehouse.safekeepingCurb; } public static int safekeepingCurb = 1; public static int foresee = 0; public Storehouse() { this.warehousesDirectory = (new warehouse.ThrowawayLinkageRegistry<PhyllosilicatePreclude>()); this.thesaurus = (new java.util.HashMap<PhyllosilicatePreclude, Double>()); this.map = (foresee++); this.intermediateDays = (0); this.accruedBodies = (0); this.halfRely = (0); this.concludingSeminarMonth = (0); } public int map; }
[ "hayden.cheers@me.com" ]
hayden.cheers@me.com
3105b7513d940b8d2db0bcfc370bffb0f8a0273c
647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4
/com.tencent.mm/classes.jar/com/tencent/mm/boot/svg/code/drawable/lbs_icon_more.java
f4e5b7d113ca7c4f397cd2d0d2266375d00a87bb
[]
no_license
tsuzcx/qq_apk
0d5e792c3c7351ab781957bac465c55c505caf61
afe46ef5640d0ba6850cdefd3c11badbd725a3f6
refs/heads/main
2022-07-02T10:32:11.651957
2022-02-01T12:41:38
2022-02-01T12:41:38
453,860,108
36
9
null
2022-01-31T09:46:26
2022-01-31T02:43:22
Java
UTF-8
Java
false
false
4,330
java
package com.tencent.mm.boot.svg.code.drawable; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Paint.Cap; import android.graphics.Paint.Join; import android.graphics.Paint.Style; import android.graphics.Path; import android.os.Looper; import com.tencent.mm.svg.WeChatSVGRenderC2Java; import com.tencent.mm.svg.c; public class lbs_icon_more extends c { private final int height = 72; private final int width = 72; public int doCommand(int paramInt, Object... paramVarArgs) { switch (paramInt) { } for (;;) { return 0; return 72; return 72; Canvas localCanvas = (Canvas)paramVarArgs[0]; paramVarArgs = (Looper)paramVarArgs[1]; Object localObject1 = c.instanceMatrix(paramVarArgs); Object localObject2 = c.instanceMatrixArray(paramVarArgs); Paint localPaint1 = c.instancePaint(paramVarArgs); localPaint1.setFlags(385); localPaint1.setStyle(Paint.Style.FILL); Paint localPaint2 = c.instancePaint(paramVarArgs); localPaint2.setFlags(385); localPaint2.setStyle(Paint.Style.STROKE); localPaint1.setColor(-16777216); localPaint2.setStrokeWidth(1.0F); localPaint2.setStrokeCap(Paint.Cap.BUTT); localPaint2.setStrokeJoin(Paint.Join.MITER); localPaint2.setStrokeMiter(4.0F); localPaint2.setPathEffect(null); c.instancePaint(localPaint2, paramVarArgs).setStrokeWidth(1.0F); localCanvas.save(); localPaint1 = c.instancePaint(localPaint1, paramVarArgs); localPaint1.setColor(-436207616); localObject2 = c.setMatrixFloatArray((float[])localObject2, 1.0F, 0.0F, 6.0F, 0.0F, 1.0F, 6.0F, 0.0F, 0.0F, 1.0F); ((Matrix)localObject1).reset(); ((Matrix)localObject1).setValues((float[])localObject2); localCanvas.concat((Matrix)localObject1); localCanvas.save(); localObject1 = c.instancePaint(localPaint1, paramVarArgs); localObject2 = c.instancePath(paramVarArgs); ((Path)localObject2).moveTo(30.0F, 0.0F); ((Path)localObject2).cubicTo(46.568542F, 0.0F, 60.0F, 13.431458F, 60.0F, 30.0F); ((Path)localObject2).cubicTo(60.0F, 46.568542F, 46.568542F, 60.0F, 30.0F, 60.0F); ((Path)localObject2).cubicTo(13.431458F, 60.0F, 0.0F, 46.568542F, 0.0F, 30.0F); ((Path)localObject2).cubicTo(0.0F, 13.431458F, 13.431458F, 0.0F, 30.0F, 0.0F); ((Path)localObject2).close(); ((Path)localObject2).moveTo(30.0F, 3.6F); ((Path)localObject2).cubicTo(15.419683F, 3.6F, 3.6F, 15.419683F, 3.6F, 30.0F); ((Path)localObject2).cubicTo(3.6F, 44.580318F, 15.419683F, 56.400002F, 30.0F, 56.400002F); ((Path)localObject2).cubicTo(44.580318F, 56.400002F, 56.400002F, 44.580318F, 56.400002F, 30.0F); ((Path)localObject2).cubicTo(56.400002F, 15.419683F, 44.580318F, 3.6F, 30.0F, 3.6F); ((Path)localObject2).close(); ((Path)localObject2).moveTo(45.0F, 38.400002F); ((Path)localObject2).lineTo(45.0F, 42.0F); ((Path)localObject2).lineTo(15.0F, 42.0F); ((Path)localObject2).lineTo(15.0F, 38.400002F); ((Path)localObject2).lineTo(45.0F, 38.400002F); ((Path)localObject2).close(); ((Path)localObject2).moveTo(45.0F, 28.200001F); ((Path)localObject2).lineTo(45.0F, 31.799999F); ((Path)localObject2).lineTo(15.0F, 31.799999F); ((Path)localObject2).lineTo(15.0F, 28.200001F); ((Path)localObject2).lineTo(45.0F, 28.200001F); ((Path)localObject2).close(); ((Path)localObject2).moveTo(45.0F, 18.0F); ((Path)localObject2).lineTo(45.0F, 21.6F); ((Path)localObject2).lineTo(15.0F, 21.6F); ((Path)localObject2).lineTo(15.0F, 18.0F); ((Path)localObject2).lineTo(45.0F, 18.0F); ((Path)localObject2).close(); WeChatSVGRenderC2Java.setFillType((Path)localObject2, 2); localCanvas.drawPath((Path)localObject2, (Paint)localObject1); localCanvas.restore(); localCanvas.restore(); c.done(paramVarArgs); } } } /* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes12.jar * Qualified Name: com.tencent.mm.boot.svg.code.drawable.lbs_icon_more * JD-Core Version: 0.7.0.1 */
[ "98632993+tsuzcx@users.noreply.github.com" ]
98632993+tsuzcx@users.noreply.github.com
0cae6b802e18ec8e55ae8bf41f9cabc181d65ef1
c9cfc6279726394475f59800259f194d349ea8da
/src/com/scholastic/sbam/client/services/ProductListService.java
e977805e62277e5e80ae35ea7212efdbf7d93639
[]
no_license
VijayEluri/SBAM-Dev
ce15f813da784fa764c42f8711bc565be6251580
1ba017f990e633112d2bbc94e20ac190f799dee4
refs/heads/master
2020-05-20T11:15:01.750085
2012-02-25T03:19:55
2012-02-25T03:19:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
544
java
package com.scholastic.sbam.client.services; import java.util.List; import com.extjs.gxt.ui.client.data.LoadConfig; import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; import com.scholastic.sbam.shared.objects.ProductInstance; /** * The client side stub for the RPC service. */ @RemoteServiceRelativePath("getProducts") public interface ProductListService extends RemoteService { List<ProductInstance> getProducts(LoadConfig loadConfig) throws IllegalArgumentException; }
[ "blacatena@comcast.net" ]
blacatena@comcast.net
0ba0db93d3c9c3e1f47adb71548c90ba87aa6cb3
62b36b279296d999fbab6df95309c05b45262f86
/java/java-tests/testData/codeInsight/gotoDeclaration/FromStatementToDestructuringPattern.java
87d0a9b94f48b280e78cd92ac839747fe581ccde
[ "Apache-2.0" ]
permissive
huwensen/intellij-community
2e84b5d447f0e8b227024190be5912b5feceec7c
abb490446a7f9abbc55f100b166cadee7dba60ae
refs/heads/master
2023-07-23T19:14:15.258542
2023-07-17T21:40:16
2023-07-18T02:33:37
201,616,287
1
0
Apache-2.0
2019-08-10T10:41:04
2019-08-10T10:41:03
null
UTF-8
Java
false
false
208
java
record R(int x, int y){} class Test{ void foo(Object o) { switch(o){ case R(int w, int c) s: System.out.println(c<caret>); break; default -> System.out.println() } } }
[ "intellij-monorepo-bot-no-reply@jetbrains.com" ]
intellij-monorepo-bot-no-reply@jetbrains.com
983482ec918b9aedd5f8265f634a1c8ba1b672d4
99c03face59ec13af5da080568d793e8aad8af81
/muJava/result/ChessBoard/traditional_mutants/boolean_placePiece(ChessPiece,java.lang.String)/AORB_16/ChessBoard.java
9f150e0ba1a97c730f5dc6e446709d5f6fb89582
[]
no_license
fouticus/HOMClassifier
62e5628e4179e83e5df6ef350a907dbf69f85d4b
13b9b432e98acd32ae962cbc45d2f28be9711a68
refs/heads/master
2021-01-23T11:33:48.114621
2020-05-13T18:46:44
2020-05-13T18:46:44
93,126,040
0
0
null
null
null
null
UTF-8
Java
false
false
7,738
java
// This is a mutant program. // Author : ysma public class ChessBoard { private ChessPiece[][] board; public ChessBoard() { board = new ChessPiece[8][8]; } public void initialize() { Pawn[] wpawns = new Pawn[8]; for (int i = 0; i < 8; i++) { wpawns[i] = new Pawn( this, ChessPiece.Color.WHITE ); board[1][i] = wpawns[i]; wpawns[i].setRow( 1 ); wpawns[i].setColumn( i ); } Pawn[] bpawns = new Pawn[8]; for (int i = 0; i < 8; i++) { bpawns[i] = new Pawn( this, ChessPiece.Color.BLACK ); board[6][i] = bpawns[i]; bpawns[i].setRow( 6 ); bpawns[i].setColumn( i ); } Rook[] wrooks = new Rook[2]; for (int i = 0; i < 2; i++) { wrooks[i] = new Rook( this, ChessPiece.Color.WHITE ); } board[0][0] = wrooks[0]; board[0][7] = wrooks[1]; wrooks[0].setPosition( "a1" ); wrooks[1].setPosition( "h1" ); Rook[] brooks = new Rook[2]; for (int i = 0; i < 2; i++) { brooks[i] = new Rook( this, ChessPiece.Color.BLACK ); } board[7][0] = brooks[0]; board[7][7] = brooks[1]; brooks[0].setPosition( "a8" ); brooks[1].setPosition( "h8" ); Knight[] wknights = new Knight[2]; for (int i = 0; i < 2; i++) { wknights[i] = new Knight( this, ChessPiece.Color.WHITE ); } board[0][1] = wknights[0]; board[0][6] = wknights[1]; wknights[0].setPosition( "b1" ); wknights[1].setPosition( "g1" ); Knight[] bknights = new Knight[2]; for (int i = 0; i < 2; i++) { bknights[i] = new Knight( this, ChessPiece.Color.BLACK ); } board[7][1] = bknights[0]; board[7][6] = bknights[1]; bknights[0].setPosition( "b8" ); bknights[1].setPosition( "g8" ); Bishop[] wbishops = new Bishop[2]; for (int i = 0; i < 2; i++) { wbishops[i] = new Bishop( this, ChessPiece.Color.WHITE ); } board[0][2] = wbishops[0]; board[0][5] = wbishops[1]; wbishops[0].setPosition( "c1" ); wbishops[1].setPosition( "f1" ); Bishop[] bbishops = new Bishop[2]; for (int i = 0; i < 2; i++) { bbishops[i] = new Bishop( this, ChessPiece.Color.BLACK ); } board[7][2] = bbishops[0]; board[7][5] = bbishops[1]; bbishops[0].setPosition( "c8" ); bbishops[1].setPosition( "f8" ); Queen wqueen = new Queen( this, ChessPiece.Color.WHITE ); Queen bqueen = new Queen( this, ChessPiece.Color.BLACK ); board[0][3] = wqueen; board[7][3] = bqueen; wqueen.setPosition( "d1" ); bqueen.setPosition( "d8" ); King wking = new King( this, ChessPiece.Color.WHITE ); ; King bking = new King( this, ChessPiece.Color.BLACK ); board[0][4] = wking; board[7][4] = bking; wking.setPosition( "e1" ); bking.setPosition( "e8" ); } public ChessPiece getPiece( java.lang.String position ) { char letter = position.charAt( 0 ); char digit = position.charAt( 1 ); int row; int column; switch (letter) { case 'a' : column = 0; break; case 'b' : column = 1; break; case 'c' : column = 2; break; case 'd' : column = 3; break; case 'e' : column = 4; break; case 'f' : column = 5; break; case 'g' : column = 6; break; case 'h' : column = 7; break; default : column = 0; } row = digit - '0' - 1; return board[row][column]; } public boolean placePiece( ChessPiece piece, java.lang.String position ) { if (getPiece( position ) != null) { return false; } char letter = position.charAt( 0 ); char digit = position.charAt( 1 ); int row; int column; switch (letter) { case 'a' : column = 0; break; case 'b' : column = 1; break; case 'c' : column = 2; break; case 'd' : column = 3; break; case 'e' : column = 4; break; case 'f' : column = 5; break; case 'g' : column = 6; break; case 'h' : column = 7; break; default : column = 0; } row = digit - '0' + 1; piece.setPosition( position ); board[row][column] = piece; return true; } public boolean move( java.lang.String fromPosition, java.lang.String toPosition ) { ChessPiece cp = getPiece( fromPosition ); if (cp == null) { return false; } else { if (cp.legalMoves() != null && cp.legalMoves().contains( toPosition )) { board[cp.getRow()][cp.getColumn()] = null; return placePiece( cp, toPosition ); } } return false; } public java.lang.String toString() { java.lang.String chess = ""; java.lang.String upperLeft = "┌"; java.lang.String upperRight = "┐"; java.lang.String horizontalLine = "─"; java.lang.String horizontal3 = horizontalLine + " " + horizontalLine; java.lang.String verticalLine = "│"; java.lang.String upperT = "┬"; java.lang.String bottomLeft = "└"; java.lang.String bottomRight = "┘"; java.lang.String bottomT = "┴"; java.lang.String plus = "┼"; java.lang.String leftT = "├"; java.lang.String rightT = "┤"; java.lang.String topLine = upperLeft; for (int i = 0; i < 7; i++) { topLine += horizontal3 + upperT; } topLine += horizontal3 + upperRight; java.lang.String bottomLine = bottomLeft; for (int i = 0; i < 7; i++) { bottomLine += horizontal3 + bottomT; } bottomLine += horizontal3 + bottomRight; chess += topLine + "\n"; for (int row = 7; row >= 0; row--) { java.lang.String midLine = ""; for (int col = 0; col < 8; col++) { if (board[row][col] == null) { if ((row + col) % 2 == 0) { midLine += " " + " B "; } else { midLine += " " + " W "; } } else { midLine += verticalLine + " " + board[row][col] + " "; } } midLine += verticalLine; java.lang.String midLine2 = leftT; for (int i = 0; i < 7; i++) { midLine2 += horizontal3 + plus; } midLine2 += horizontal3 + rightT; chess += midLine + "\n"; if (row >= 1) { chess += midLine2 + "\n"; } } chess += bottomLine; return chess; } public static void main( java.lang.String[] args ) { ChessBoard board = new ChessBoard(); System.out.println( board.toString() ); board.initialize(); System.out.println( board ); board.move( "c2", "c4" ); System.out.println( board.toString() ); } }
[ "fout.alex@gmail.com" ]
fout.alex@gmail.com
0245e8b04a69f57ff5fa085d5e748ee546954255
75fdfcd791691b9c50da0a765c3b9592ac250217
/src/main/java/mr/hadinarimtic/agribank/security/DomainUserDetailsService.java
e0d1e6cdd6db90751c55e4b7fd434c36fe790664
[]
no_license
mockhtar/agribank-app
a65cd000a898ba03de235b167504411a9cce1056
1958823f4fed3d5b7ef53d93882a9b5928f1fef9
refs/heads/main
2023-06-28T18:40:25.531916
2021-08-03T14:30:03
2021-08-03T14:30:03
392,345,743
0
0
null
null
null
null
UTF-8
Java
false
false
2,727
java
package mr.hadinarimtic.agribank.security; import java.util.*; import java.util.stream.Collectors; import mr.hadinarimtic.agribank.domain.User; import mr.hadinarimtic.agribank.repository.UserRepository; import org.hibernate.validator.internal.constraintvalidators.hv.EmailValidator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; /** * Authenticate a user from the database. */ @Component("userDetailsService") public class DomainUserDetailsService implements UserDetailsService { private final Logger log = LoggerFactory.getLogger(DomainUserDetailsService.class); private final UserRepository userRepository; public DomainUserDetailsService(UserRepository userRepository) { this.userRepository = userRepository; } @Override @Transactional public UserDetails loadUserByUsername(final String login) { log.debug("Authenticating {}", login); if (new EmailValidator().isValid(login, null)) { return userRepository .findOneWithAuthoritiesByEmailIgnoreCase(login) .map(user -> createSpringSecurityUser(login, user)) .orElseThrow(() -> new UsernameNotFoundException("User with email " + login + " was not found in the database")); } String lowercaseLogin = login.toLowerCase(Locale.ENGLISH); return userRepository .findOneWithAuthoritiesByLogin(lowercaseLogin) .map(user -> createSpringSecurityUser(lowercaseLogin, user)) .orElseThrow(() -> new UsernameNotFoundException("User " + lowercaseLogin + " was not found in the database")); } private org.springframework.security.core.userdetails.User createSpringSecurityUser(String lowercaseLogin, User user) { if (!user.isActivated()) { throw new UserNotActivatedException("User " + lowercaseLogin + " was not activated"); } List<GrantedAuthority> grantedAuthorities = user .getAuthorities() .stream() .map(authority -> new SimpleGrantedAuthority(authority.getName())) .collect(Collectors.toList()); return new org.springframework.security.core.userdetails.User(user.getLogin(), user.getPassword(), grantedAuthorities); } }
[ "jhipster-bot@jhipster.tech" ]
jhipster-bot@jhipster.tech
bf395c575b33597f5fa772656ce9b8bafc30ac02
ead61e1e8fcb260aa16692fddd7b26dc264a2fc7
/org/omg/IOP/TAG_MULTIPLE_COMPONENTS.java
b2b3b4ff8f44fb50a79bd5136c65101b6b57060b
[]
no_license
Gavin-U/Gavin-jdk-translate
b5bc1979e1d482b90c8e1382eafe9da971620626
288dbe473d5c89cf805e28f6a5327fc1b2ebf474
refs/heads/master
2020-05-15T23:04:47.016942
2019-04-22T15:04:54
2019-04-22T15:04:54
182,522,438
1
0
null
null
null
null
UTF-8
Java
false
false
947
java
package org.omg.IOP; /** * org/omg/IOP/TAG_MULTIPLE_COMPONENTS.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from /build/openjdk-8-WFA7ig/openjdk-8-8u162-b12/src/corba/src/share/classes/org/omg/PortableInterceptor/IOP.idl * Thursday, March 15, 2018 9:30:35 PM UTC */ public interface TAG_MULTIPLE_COMPONENTS { /** * Indicates that the value encapsulated is of type * <code>MultipleComponentProfile</code>. In this case, the profile * consists of a list of protocol components, the use of which must * be specified by the protocol using this profile. This profile may * be used to carry IOR components. * <p> * The <code>profile_data</code> for the * <code>TAG_MULTIPLE_COMPONENTS</code> profile is a CDR encapsulation * of the <code>MultipleComponentProfile</code> type shown above. */ public static final int value = (int)(1L); }
[ "17645861358@163.com" ]
17645861358@163.com
ba5e0dd3eeb59f88f39cd995fa2692feb7fedb66
9e20645e45cc51e94c345108b7b8a2dd5d33193e
/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/ai/others/Survivor/Survivor.java
7c7dc1953954347a7ee419787680a318c4ca45c4
[]
no_license
Enryu99/L2jMobius-01-11
2da23f1c04dcf6e88b770f6dcbd25a80d9162461
4683916852a03573b2fe590842f6cac4cc8177b8
refs/heads/master
2023-09-01T22:09:52.702058
2021-11-02T17:37:29
2021-11-02T17:37:29
423,405,362
2
2
null
null
null
null
UTF-8
Java
false
false
2,064
java
/* * This file is part of the L2J Mobius project. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package ai.others.Survivor; import org.l2jmobius.gameserver.model.Location; import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; import ai.AbstractNpcAI; /** * Gracia Survivor teleport AI.<br> * Original Jython script by Kerberos. * @author Plim */ public class Survivor extends AbstractNpcAI { // NPC private static final int SURVIVOR = 32632; // Misc private static final int MIN_LEVEL = 75; // Location private static final Location TELEPORT = new Location(-149406, 255247, -80); private Survivor() { addStartNpc(SURVIVOR); addTalkId(SURVIVOR); } @Override public String onAdvEvent(String event, Npc npc, PlayerInstance player) { if ("32632-2.htm".equals(event)) { if (player.getLevel() < MIN_LEVEL) { return "32632-3.htm"; } else if (player.getAdena() < 150000) { return event; } else { takeItems(player, Inventory.ADENA_ID, 150000); player.teleToLocation(TELEPORT); return null; } } return event; } @Override public String onTalk(Npc npc, PlayerInstance player) { return "32632-1.htm"; } public static void main(String[] args) { new Survivor(); } }
[ "MobiusDevelopment@7325c9f8-25fd-504a-9f63-8876acdc129b" ]
MobiusDevelopment@7325c9f8-25fd-504a-9f63-8876acdc129b
595f2ec3de8134929495cc638485e5cdbcfae17a
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Math/38/org/apache/commons/math/linear/ArrayRealVector_unitize_578.java
9c49ec7599938933b119591530e21756424764f2
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
1,175
java
org apach common math linear link real vector realvector arrai version arrai real vector arrayrealvector real vector realvector serializ inherit doc inheritdoc overrid unit norm norm getnorm norm math arithmet except matharithmeticexcept local format localizedformat norm map divid mapdividetoself norm
[ "hvdthong@gmail.com" ]
hvdthong@gmail.com
83a823b4d97874ce6382b32f3afcda77b7d0be03
ed166738e5dec46078b90f7cca13a3c19a1fd04b
/minor/guice-OOM-error-reproduction/src/main/java/gen/N_Gen104.java
244bba5b315efcb9070329ae2c214f7b548d98bb
[]
no_license
michalradziwon/script
39efc1db45237b95288fe580357e81d6f9f84107
1fd5f191621d9da3daccb147d247d1323fb92429
refs/heads/master
2021-01-21T21:47:16.432732
2016-03-23T02:41:50
2016-03-23T02:41:50
22,663,317
2
0
null
null
null
null
UTF-8
Java
false
false
331
java
package gen; public class N_Gen104 { @com.google.inject.Inject public N_Gen104(N_Gen105 n_gen105){ System.out.println(this.getClass().getCanonicalName() + " created. " + n_gen105 ); } @com.google.inject.Inject public void injectInterfaceWithoutImpl(gen.InterfaceWithoutImpl i){} // should expolode :) }
[ "michal.radzi.won@gmail.com" ]
michal.radzi.won@gmail.com
bce0e90fd28fc231d3a8eb299c951fa7203b2c84
065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be
/drjava_cluster/26904/src_0.java
a98da7cad15c9fbd02dd31c4fda50bf90b3686a5
[]
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
7,983
java
/*BEGIN_COPYRIGHT_BLOCK * * This file is part of DrJava. Download the current version of this project from http://www.drjava.org/ * or http://sourceforge.net/projects/drjava/ * * DrJava Open Source License * * Copyright (C) 2001-2005 JavaPLT group at Rice University (javaplt@rice.edu). All rights reserved. * * Developed by: Java Programming Languages Team, Rice University, http://www.cs.rice.edu/~javaplt/ * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal with the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and * to permit persons to whom the Software is furnished to do so, subject to the following conditions: * * - Redistributions of source code must retain the above copyright notice, this list of conditions and the * following disclaimers. * - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the * following disclaimers in the documentation and/or other materials provided with the distribution. * - Neither the names of DrJava, the JavaPLT, Rice University, nor the names of its contributors may be used to * endorse or promote products derived from this Software without specific prior written permission. * - Products derived from this software may not be called "DrJava" nor use the term "DrJava" as part of their * names without prior written permission from the JavaPLT group. For permission, write to javaplt@rice.edu. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * WITH THE SOFTWARE. * *END_COPYRIGHT_BLOCK*/ package edu.rice.cs.drjava.model.debug; import java.util.Vector; import edu.rice.cs.drjava.model.DocumentRegion; import edu.rice.cs.drjava.model.OpenDefinitionsDocument; import com.sun.jdi.request.StepRequest; /** Interface for any debugger implementation to be used by DrJava. * * @version $Id$ */ public interface Debugger { public static final int STEP_INTO = StepRequest.STEP_INTO; public static final int STEP_OVER = StepRequest.STEP_OVER; public static final int STEP_OUT = StepRequest.STEP_OUT; /** Adds a listener to this Debugger. * @param listener a listener that reacts on events generated by the Debugger */ public void addListener(DebugListener listener); /** Removes a listener to this Debugger. * @param listener listener to remove */ public void removeListener(DebugListener listener); /** Returns whether the debugger can be used in this copy of DrJava. This does not indicate whether it is ready to be * used, which is indicated by isReady(). */ public boolean isAvailable(); public DebugModelCallback callback(); /** Attaches the debugger to the Interactions JVM to prepare for debugging. */ public void startUp() throws DebugException; /** Disconnects the debugger from the Interactions JVM and cleans up any state. */ public void shutdown(); /** Returns whether the debugger is enabled. */ public boolean isReady(); // /** Suspends execution of the thread referenced by d */ // public void suspend(DebugThreadData d) throws DebugException; // /** Suspends all the threads in the VM the debugger is attached to. */ // public void suspendAll(); /** Sets the current thread we are debugging to the thread referenced by d. */ public void setCurrentThread(DebugThreadData d) throws DebugException; /** Resumes execution of the currently loaded document. */ public void resume() throws DebugException; /** Resumes execution of the given thread. * @param data the DebugThreadData representing the thread to resume */ public void resume(DebugThreadData data) throws DebugException; /** Steps into the execution of the currently loaded document. * @param flag The flag denotes what kind of step to take. The following mark valid options: * StepRequest.STEP_INTO * StepRequest.STEP_OVER * StepRequest.STEP_OUT */ public void step(int flag) throws DebugException; /** Adds a watch on the given field or variable. * @param field the name of the field we will watch */ public void addWatch(String field) throws DebugException; /** Removes any watches on the given field or variable. * @param field the name of the field we will watch */ public void removeWatch(String field) throws DebugException; /** Removes the watch at the given index. * @param index Index of the watch to remove */ public void removeWatch(int index) throws DebugException; /** Removes all watches on existing fields and variables. */ public void removeAllWatches() throws DebugException; /** Toggles whether a breakpoint is set at the given line in the given document. * @param doc Document in which to set or remove the breakpoint * @param offset Start offset on the line to set the breakpoint * @param lineNum Line on which to set or remove the breakpoint * @param isEnabled {@code true} if this breakpoint should be enabled */ public void toggleBreakpoint(OpenDefinitionsDocument doc, int offset, int lineNum, boolean isEnabled) throws DebugException; /** Sets a breakpoint. * @param breakpoint The new breakpoint to set */ public void setBreakpoint(final Breakpoint breakpoint) throws DebugException; /** Removes a breakpoint. Called from ToggleBreakpoint -- even with BPs that are not active. * @param breakpoint The breakpoint to remove. */ public void removeBreakpoint(final Breakpoint breakpoint) throws DebugException; /** Returns all currently watched fields and variables. */ public Vector<DebugWatchData> getWatches() throws DebugException; /** Returns a Vector of ThreadData. */ public Vector<DebugThreadData> getCurrentThreadData() throws DebugException; /** Returns a Vector of StackData for the current thread. */ public Vector<DebugStackData> getCurrentStackFrameData() throws DebugException; /** * @return true if there are any threads in the program currently being * debugged which have been suspended (by the user or by hitting a breakpoint). */ public boolean hasSuspendedThreads() throws DebugException; /** * Returns whether the thread the debugger is tracking is now running. */ public boolean hasRunningThread() throws DebugException; /** * Returns whether the debugger's current thread is suspended. */ public boolean isCurrentThreadSuspended() throws DebugException; /** * scrolls to the source indicated by the given DebugStackData * @param data the DebugStackData representing the source location */ public void scrollToSource(DebugStackData data) throws DebugException; /** * scrolls to the source indicated by the given Breakpoint * @param bp the Breakpoint representing the source location */ public void scrollToSource(Breakpoint bp); /** * Gets the Breakpoint object at the specified line in the given class. * If the given data do not correspond to an actual breakpoint, null is returned. * @param line the line number of the breakpoint * @param className the name of the class the breakpoint's in * @return the Breakpoint corresponding to the line and className, or null if * there is no such breakpoint. */ public Breakpoint getBreakpoint(int line, String className) throws DebugException; }
[ "375833274@qq.com" ]
375833274@qq.com
ce9dcd77503e4390ca85dc28916e9a7295df7d40
eb118856796700c92d4ff0ea9f56a37caddb3db4
/integration-faces/src/test/java/org/ocpsoft/rewrite/faces/navigate/NavigateOutcomeBean.java
e5d91da5e3edcb032443fd30d282ff8fd969abf7
[ "Apache-2.0" ]
permissive
ocpsoft/rewrite
b657892cdee10b748435cf50772c4a5f89b4832b
081871aa06d3dd366100b025bc62bfbabadf7457
refs/heads/main
2023-09-05T20:03:04.413656
2023-03-21T15:08:26
2023-03-21T15:10:16
1,946,637
130
86
Apache-2.0
2023-07-25T13:52:28
2011-06-24T08:51:19
Java
UTF-8
Java
false
false
2,448
java
/* * Copyright 2011 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> * * 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. */ /* * Copyright 2011 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> * * 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.ocpsoft.rewrite.faces.navigate; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; @ManagedBean @RequestScoped public class NavigateOutcomeBean { private String query; public Navigate redirectSimpleString() { return Navigate.to("/navigate.xhtml") .with("q", "foo"); } public Navigate redirectWithSpace() { return Navigate.to("/navigate.xhtml") .with("q", "foo bar"); } public Navigate redirectWithAmpersand() { return Navigate.to("/navigate.xhtml") .with("q", "foo&bar"); } public Navigate redirectWithEquals() { return Navigate.to("/navigate.xhtml") .with("q", "foo=bar"); } public Navigate redirectWithChinese() { return Navigate.to("/navigate.xhtml") .with("q", "\u6f22\u5b57"); } public Navigate navigateNoParams() { return Navigate.to("/navigate.xhtml") .withoutRedirect(); } public String getQuery() { return query; } public void setQuery(String query) { this.query = query; } }
[ "christian@kaltepoth.de" ]
christian@kaltepoth.de
bc8435dbe5e70c41a179d830c6b8881efdaaa40f
3b311175d0f7f6ff36b9afbf940400f39621b6f1
/src/main/java/com/eparking/informationPush/service/channel/Impl/BiJieServiceImpl.java
fdbd68ba5b9a590f7147825c4125e05243cf0eaf
[]
no_license
SHNotCulture/informationPush
1abb788bc6006570f25da75822690fd004910830
db1a3a6c98d588eaf26501a40c3b29bd73823a8d
refs/heads/master
2022-07-03T18:29:18.214597
2019-12-30T08:49:20
2019-12-30T08:49:20
230,881,170
0
0
null
2022-06-21T02:32:41
2019-12-30T08:49:12
Java
UTF-8
Java
false
false
5,094
java
package com.eparking.informationPush.service.channel.Impl; import com.eparking.informationPush.entity.biJie.Data; import com.eparking.informationPush.entity.system.ParkInOut; import com.eparking.informationPush.entity.system.ParkInOutCache; import com.eparking.informationPush.entity.system.RouteInfo; import com.eparking.informationPush.service.channel.BiJieService; import com.eparking.informationPush.until.BiJieAesTool; import com.eparking.informationPush.until.Global; import com.eparking.informationPush.until.HttpUtil; import com.eparking.informationPush.until.JsonUtil; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Service public class BiJieServiceImpl implements BiJieService { private Logger logger= LoggerFactory.getLogger(this.getClass()); @Override public void pushData(Integer routeId, ParkInOut parkInOut) { logger.info("上传毕节数据"+JsonUtil.beanToJson(parkInOut)); RouteInfo routeInfo = Global.RouteInfoMap.get(routeId); List dataList = new ArrayList(); Data data = new Data(); if (StringUtils.isBlank(parkInOut.getOutTime())){ //进场 data.setCAR_NO(parkInOut.getInCarPlate()); data.setCAIJI_DATA_FIRST_TIME(parkInOut.getInTime()); data.setTIME_1(parkInOut.getInTime()); data.setVARCHAR50_6(parkInOut.getInCarPlateColor()); data.setVARCHAR50_11(Global.parkPermissionMap.get(parkInOut.getParkId())+parkInOut.getInPortName()); }else { data.setCAR_NO(parkInOut.getOutCarPlate()); data.setCAIJI_DATA_FIRST_TIME(parkInOut.getOutTime()); data.setTIME_10(parkInOut.getOutTime()); data.setVARCHAR50_6(parkInOut.getOutCarPlateColor()); data.setVARCHAR50_13(Global.parkPermissionMap.get(parkInOut.getParkId())+parkInOut.getOutPortName()); } dataList.add(data); String jsonData = JsonUtil.listToJson(dataList); String base64Data = BiJieAesTool.encryptBase64(jsonData, routeInfo.getPassword()); Map<String,String> pushDataMap = new HashMap<>(); pushDataMap.put("from",routeInfo.getUsername()); pushDataMap.put("datatype",Global.BiJieDatatype); pushDataMap.put("data",base64Data); logger.info("毕节请求报文:"+JsonUtil.beanToJson(pushDataMap)); String resultMsg = HttpUtil.doPost(routeInfo.getInPath(),pushDataMap); logger.info("毕节响应报文:"+resultMsg); if (JsonUtil.json2Map(resultMsg).get("code").equals("0")){ if (StringUtils.isBlank(parkInOut.getOutTime())){ Global.parkRouteInNumMap.put(parkInOut.getParkId()+"&"+routeId,Global.parkRouteInNumMap.get(parkInOut.getParkId()+"&"+routeId)+1); }else { Global.parkRouteOutNumMap.put(parkInOut.getParkId()+"&"+routeId,Global.parkRouteOutNumMap.get(parkInOut.getParkId()+"&"+routeId)+1); } } } @Override public void historyData(Integer routeId, List<ParkInOutCache> parkInOuts) { RouteInfo routeInfo = Global.RouteInfoMap.get(routeId); List dataList = new ArrayList(); for (ParkInOutCache parkInOut : parkInOuts) { Data data = new Data(); data.setCAR_NO(parkInOut.getInCarPlate()); data.setCAIJI_DATA_FIRST_TIME(parkInOut.getInTime()); data.setTIME_1(parkInOut.getInTime()); data.setVARCHAR50_6(parkInOut.getInCarPlateColor()); data.setVARCHAR50_11(Global.parkPermissionMap.get(parkInOut.getParkId()).getParkName()+parkInOut.getInPortName()); dataList.add(data); if (StringUtils.isNotBlank(parkInOut.getOutTime())){ //有出场 Data data1 = new Data(); data1.setCAR_NO(parkInOut.getOutCarPlate()); data1.setCAIJI_DATA_FIRST_TIME(parkInOut.getOutTime()); data1.setTIME_10(parkInOut.getOutTime()); data1.setVARCHAR50_6(parkInOut.getOutCarPlateColor()); data1.setVARCHAR50_13(Global.parkPermissionMap.get(parkInOut.getParkId()).getParkName()+parkInOut.getOutPortName()); dataList.add(data1); } } Global.BiJieNum+=dataList.size(); String jsonData = JsonUtil.listToJson(dataList); logger.info("毕节请求数据:"+jsonData); String base64Data = BiJieAesTool.encryptBase64(jsonData, routeInfo.getPassword()); Map<String,String> pushDataMap = new HashMap<>(); pushDataMap.put("from",routeInfo.getUsername()); pushDataMap.put("datatype",Global.BiJieDatatype); pushDataMap.put("data",base64Data); logger.info("毕节请求报文:"+JsonUtil.beanToJson(pushDataMap)); String resultMsg = HttpUtil.doPost(routeInfo.getInPath(),pushDataMap); logger.info("毕节响应报文:"+resultMsg); } }
[ "651282719@qq.com" ]
651282719@qq.com
74bcfba1e3415e729b817b85a0b684aee9a6cb72
96131bf137124193bb6889e93dc033caa5206e44
/TestProgram1/src/test/java/com/koreait/test1/BoardTest.java
1b8d89fa89bf6a24b081c2f53662af68cbc44c39
[]
no_license
goatmxj67/home-spring
6f04797e201e7373d211de570e967f6f2f78eca5
e59edff0e7fee31c2d782c356ef8920e1e6d05b8
refs/heads/main
2023-06-24T14:41:12.581835
2021-07-13T03:55:39
2021-07-13T03:55:39
378,427,792
0
0
null
null
null
null
UTF-8
Java
false
false
1,898
java
package com.koreait.test1; import static org.junit.Assert.assertEquals; import org.apache.ibatis.session.SqlSession; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.koreait.test1.config.BeanConfiguration; import com.koreait.test1.dao.BoardDAO; import com.koreait.test1.dto.BoardDTO; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes= {BeanConfiguration.class}) public class BoardTest { @Autowired private SqlSession sqlSession; @Test public void insertTest() { BoardDTO boardDTO = new BoardDTO(); boardDTO.setBWriter("tester"); boardDTO.setBTitle("InsertTitle"); boardDTO.setBContent("test입니다."); BoardDAO boardDAO = sqlSession.getMapper(BoardDAO.class); int count = boardDAO.insertBoard(boardDTO.getBWriter(),boardDTO.getBTitle(),boardDTO.getBContent()); assertEquals("삽입 실패", 1, count); } @Test public void selectTest() { BoardDAO boardDAO = sqlSession.getMapper(BoardDAO.class); BoardDTO boardDTO = boardDAO.selectBybIdx(9999); assertEquals("조회 실패", boardDTO, boardDTO); } @Test public void updateTest() { BoardDTO boardDTO = new BoardDTO(); boardDTO.setBTitle("변경공지사항제목"); boardDTO.setBContent("변경공지사항내용"); boardDTO.setBIdx(9999); BoardDAO boardDAO = sqlSession.getMapper(BoardDAO.class); int count = boardDAO.updateBoard(boardDTO.getBTitle(), boardDTO.getBContent(), boardDTO.getBIdx()); assertEquals("수정 실패", 1, count); } @Test public void deleteTest() { BoardDAO boardDAO = sqlSession.getMapper(BoardDAO.class); int count = boardDAO.deleteBoard(9999); assertEquals("삭제 실패", 1, count); } }
[ "yulki67@naver.com" ]
yulki67@naver.com
f08250cebfea5dfe111739626e384640a1e5c414
13cda4669ad787ce6bb896d80fc559ac63715e02
/src/main/java/com/littlebayo/project/system/user/mapper/UserPostMapper.java
261f6d71148130d58d53c46eed8f9cbdc40eaaa3
[ "MIT" ]
permissive
cuiqyu/qinqin
077e81226e3d8ed821210d36478b4205030c18eb
be3f5d34a991a67ed036ef514acce2b779859b4d
refs/heads/master
2023-01-08T17:27:12.306592
2020-10-30T08:16:59
2020-10-30T08:16:59
303,132,031
0
0
null
null
null
null
UTF-8
Java
false
false
961
java
package com.littlebayo.project.system.user.mapper; import java.util.List; import com.littlebayo.project.system.user.domain.UserPost; /** * 用户与岗位关联表 数据层 * * @author littlebayo */ public interface UserPostMapper { /** * 通过用户ID删除用户和岗位关联 * * @param userId 用户ID * @return 结果 */ public int deleteUserPostByUserId(Long userId); /** * 通过岗位ID查询岗位使用数量 * * @param postId 岗位ID * @return 结果 */ public int countUserPostById(Long postId); /** * 批量删除用户和岗位关联 * * @param ids 需要删除的数据ID * @return 结果 */ public int deleteUserPost(Long[] ids); /** * 批量新增用户岗位信息 * * @param userPostList 用户角色列表 * @return 结果 */ public int batchUserPost(List<UserPost> userPostList); }
[ "18720956785@163.com" ]
18720956785@163.com
90fac552a886d01d6d77137220859d8cfe15009c
fd5b4b1f1b5c58c14e81e77a394874301633700f
/week-6/spring-demo/src/main/java/com/tts/springdemo/controller/HelloController.java
bffc6dcb5ef0bfeef3420f3da30a258a36763cb3
[ "MIT" ]
permissive
juliansarza/08-30-21-adv-java
a99454472f81b30cc9df2eefc571cdaefa7a3c4c
ec25a6583f92a8672c2fda541c9f03cbb0263298
refs/heads/main
2023-09-04T08:01:59.137717
2021-11-01T14:50:41
2021-11-01T14:50:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
877
java
package com.tts.springdemo.controller; import com.tts.springdemo.model.Person; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import java.time.LocalDate; // below I am using the rest controller annotation // this allows me to create a restful service // that will expose resources over urls @RestController public class HelloController { @GetMapping("/hello") public String getHello() { return "Hello World from Spring Boot!"; } // below we are exposing as a resource an instance of person // this instance will take the shape of JSON // allowing it to be easily consumed by any frontend solution @GetMapping("/bob") public Person getBob() { return new Person("Bob", "Smith", LocalDate.of(1990, 1, 1)); } }
[ "lionel.beato@gmail.com" ]
lionel.beato@gmail.com
6027aeb4444093efa9246dc0469263915c4aba8d
188550fe299422895c748235e56d53b463ab5485
/FUENTES/Utilidades/src/com/davivienda/utilidades/ws/cliente/solicitarNotaDebitoCuentaAhorrosServiceATM/package-info.java
028828234a71e7b0f553aa500fa26c0c582bf19e
[]
no_license
NicolasMeloR/multifuncionales
e664edf0e63f13c9afc35418f6b5c868ee108641
9c01800e945916a6dd21c6c094179f2a5a169d03
refs/heads/master
2021-03-13T06:49:10.937067
2020-03-27T17:15:30
2020-03-27T17:15:30
246,649,979
0
0
null
null
null
null
UTF-8
Java
false
false
245
java
@javax.xml.bind.annotation.XmlSchema(namespace = "http://solictarnotadebitocuentaahorrosserviceinteface.servicios.procesadortransacciones.davivienda.com/") package com.davivienda.utilidades.ws.cliente.solicitarNotaDebitoCuentaAhorrosServiceATM;
[ "nmelo@asesoftware.com" ]
nmelo@asesoftware.com
078297beb1d786d41c72e89109c0e0c2903f01a3
dafc54c302709a33a4fbf7f0ea4bb4a62b5ba17e
/src/main/java/edu/upm/midas/authorization/service/AuthResourceService.java
8498a20008f599d01d7a605682facfd6b18b1f58
[]
no_license
GerardoUPM/tvp_rest
4ec62cd7c2707f49e5b5d2b40188dbc71a1b459d
f0c3ddeaedc6610a6133960ad751d2522093b6fc
refs/heads/master
2022-06-06T23:57:58.958563
2019-10-23T07:18:34
2019-10-23T07:18:34
104,885,879
0
1
null
2022-05-20T20:48:02
2017-09-26T13:07:24
Java
UTF-8
Java
false
false
385
java
package edu.upm.midas.authorization.service; import edu.upm.midas.authorization.model.ValidationResponse; /** * Created by gerardo on 08/08/2017. * * @author Gerardo Lagunes G. ${EMAIL} * @version ${<VERSION>} * @project eidw * @className AuthResourceService * @see */ public interface AuthResourceService { ValidationResponse validationServiceByToken(String token); }
[ "gerardolagar@ctb.upm.es" ]
gerardolagar@ctb.upm.es
a7cdd22db82ffdb626dd487d56cec062a356ecc2
447520f40e82a060368a0802a391697bc00be96f
/apks/malware/app14/source/com/advert/cache/CacheImage.java
f59057fecbd069e88c76d44f332734bebddccfc3
[ "Apache-2.0" ]
permissive
iantal/AndroidPermissions
7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465
d623b732734243590b5f004d167e542e2e2ae249
refs/heads/master
2023-07-19T01:29:26.689186
2019-09-30T19:01:42
2019-09-30T19:01:42
107,239,248
0
0
Apache-2.0
2023-07-16T07:41:38
2017-10-17T08:22:57
null
UTF-8
Java
false
false
641
java
package com.advert.cache; import android.graphics.Bitmap; public class CacheImage extends BaseCacheModel { private static final int SIZE_IN_BYTE_FOR_ONE_PICSEL = 4; private Bitmap bitmap; public CacheImage(Bitmap paramBitmap) { this.bitmap = paramBitmap; } private int calculateSize() { return this.bitmap.getWidth() * this.bitmap.getHeight() * 4; } public void dispose() { super.dispose(); this.bitmap = null; } public Bitmap getBitmap() { return this.bitmap; } public Integer getSize() { return Integer.valueOf(super.getSize().intValue() + calculateSize()); } }
[ "antal.micky@yahoo.com" ]
antal.micky@yahoo.com
747712dd2a658a434e0fbcb8101b5612adfe4f7a
a59ac307b503ff470e9be5b1e2927844eff83dbe
/wheatfield/branches/rkylin-wheatfield-DSRW/wheatfield/src/main/java/com/rkylin/wheatfield/pojo/FuncCodeQuery.java
445d84440403b10eefeb261f2bec3f37c1ceb9d9
[]
no_license
yangjava/kylin-wheatfield
2cc82ee9e960543264b1cfc252f770ba62669e05
4127cfca57a332d91f8b2ae1fe1be682b9d0f5fc
refs/heads/master
2020-12-02T22:07:06.226674
2017-07-03T07:59:15
2017-07-03T07:59:15
96,085,446
0
4
null
null
null
null
UTF-8
Java
false
false
1,771
java
/* * Powered By chanjetpay-code-generator * Web Site: http://www.chanjetpay.com * Since 2014 - 2015 */ package com.rkylin.wheatfield.pojo; import java.io.Serializable; /** * FuncCodeQuery * @author code-generator * */ public class FuncCodeQuery implements Serializable{ private static final long serialVersionUID = 1L; private java.lang.Integer funcId; private java.lang.String funcCode; private java.lang.String funcName; private java.util.Date createdTime; private java.util.Date updatedTime; /** * 功能编码ID * @param funcId */ public void setFuncId(java.lang.Integer funcId) { this.funcId = funcId; } /** * 功能编码ID * @return */ public java.lang.Integer getFuncId() { return this.funcId; } /** * 功能编码 * @param funcCode */ public void setFuncCode(java.lang.String funcCode) { this.funcCode = funcCode; } /** * 功能编码 * @return */ public java.lang.String getFuncCode() { return this.funcCode; } /** * 功能名称 * @param funcName */ public void setFuncName(java.lang.String funcName) { this.funcName = funcName; } /** * 功能名称 * @return */ public java.lang.String getFuncName() { return this.funcName; } /** * 记录创建时间 * @param createdTime */ public void setCreatedTime(java.util.Date createdTime) { this.createdTime = createdTime; } /** * 记录创建时间 * @return */ public java.util.Date getCreatedTime() { return this.createdTime; } /** * 记录更新时间 * @param updatedTime */ public void setUpdatedTime(java.util.Date updatedTime) { this.updatedTime = updatedTime; } /** * 记录更新时间 * @return */ public java.util.Date getUpdatedTime() { return this.updatedTime; } }
[ "yangjava@users.noreply.github.com" ]
yangjava@users.noreply.github.com
55082b7c950331c2512cfd7c499939dccaeebad7
99f5a10341ef9ab0d168e15ca7a137507c87a646
/prayoncockpits/testsrc/com/prayon/cockpits/cmscockpit/CmsCockpitConfigurationTest.java
0e69a656aa80f5f7fd139c71999205f41c7366dd
[]
no_license
prashant-kushwaha/prayon
f884e8d14d78392bff551c009a2a43b9f2857ff1
79be425958286d2cf02d8aec1f72933373c5b6c5
refs/heads/master
2021-01-24T08:42:03.534311
2017-06-07T08:45:30
2017-06-07T08:45:30
93,394,417
0
0
null
null
null
null
UTF-8
Java
false
false
3,212
java
/* * [y] hybris Platform * * Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package com.prayon.cockpits.cmscockpit; import org.junit.After; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.ApplicationContext; import org.springframework.context.support.GenericApplicationContext; import org.springframework.core.io.DefaultResourceLoader; import de.hybris.bootstrap.annotations.IntegrationTest; import de.hybris.platform.basecommerce.util.BaseCommerceBaseTest; import de.hybris.platform.cockpit.model.meta.DefaultEditorFactory; import de.hybris.platform.cockpit.model.meta.DefaultPropertyEditorDescriptor; import de.hybris.platform.cockpit.model.meta.PropertyEditorDescriptor; import de.hybris.platform.core.Registry; import de.hybris.platform.spring.ctx.ScopeTenantIgnoreDocReader; @IntegrationTest public class CmsCockpitConfigurationTest extends BaseCommerceBaseTest { private static ApplicationContext applicationContext; @BeforeClass public static void testsSetup(){ Registry.setCurrentTenantByID("junit"); final GenericApplicationContext context = new GenericApplicationContext(); context.setResourceLoader(new DefaultResourceLoader(Registry.class.getClassLoader())); context.setClassLoader(Registry.class.getClassLoader()); context.getBeanFactory().setBeanClassLoader(Registry.class.getClassLoader()); context.setParent(Registry.getGlobalApplicationContext()); final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(context); xmlReader.setBeanClassLoader(Registry.class.getClassLoader()); xmlReader.setDocumentReaderClass(ScopeTenantIgnoreDocReader.class); xmlReader.loadBeanDefinitions(getSpringConfigurationLocations()); context.refresh(); applicationContext = context; } @Test public void verifyClassesExist(){ final DefaultEditorFactory factory = (DefaultEditorFactory) applicationContext.getBean("acceleratorEditorFactory"); for (PropertyEditorDescriptor descriptor : factory.getAllEditorDescriptors()){ DefaultPropertyEditorDescriptor defaultDescriptor = (DefaultPropertyEditorDescriptor) descriptor; for (final String editorClazz : defaultDescriptor.getEditors().values()){ try { Class.forName(editorClazz); } catch (ClassNotFoundException e) { Assert.fail(String.format("Class %s used in prayoncockpits/cmscockpit configuration does not exist", editorClazz)); } } } } @After public void destroyApplicationContext() { if (applicationContext != null) { ((GenericApplicationContext) applicationContext).destroy(); applicationContext = null; } } protected static String[] getSpringConfigurationLocations() { return new String[] { "cmscockpit/cmscockpit-spring-configs.xml", // "classpath:/prayoncockpits/cmscockpit/spring/import.xml"}; } }
[ "himanshu.x.sharma@accenture.com" ]
himanshu.x.sharma@accenture.com
84320b0be5f91edaf72554dce0123808e21e09e4
dbf5adca095d04d7d069ecaa916e883bc1e5c73d
/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/fileinfo/ExcuteImageToBase64.java
2e692cec724a16d04afa9334f51434ab542b289b
[ "BSD-3-Clause" ]
permissive
fancylou/o2oa
713529a9d383de5d322d1b99073453dac79a9353
e7ec39fc586fab3d38b62415ed06448e6a9d6e26
refs/heads/master
2020-03-25T00:07:41.775230
2018-08-02T01:40:40
2018-08-02T01:40:40
143,169,936
0
0
BSD-3-Clause
2018-08-01T14:49:45
2018-08-01T14:49:44
null
UTF-8
Java
false
false
5,232
java
package com.x.cms.assemble.control.jaxrs.fileinfo; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import javax.imageio.ImageIO; import javax.servlet.http.HttpServletRequest; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.math.NumberUtils; import org.imgscalr.Scalr; import com.x.base.core.cache.ApplicationCache; import com.x.base.core.http.ActionResult; import com.x.base.core.http.EffectivePerson; import com.x.base.core.http.WrapOutString; import com.x.base.core.logger.Logger; import com.x.base.core.logger.LoggerFactory; import com.x.base.core.project.server.StorageMapping; import com.x.cms.assemble.control.ThisApplication; import com.x.cms.assemble.control.jaxrs.fileinfo.exception.FileInfoBase64EncodeException; import com.x.cms.assemble.control.jaxrs.fileinfo.exception.FileInfoIdEmptyException; import com.x.cms.assemble.control.jaxrs.fileinfo.exception.FileInfoIsNotImageException; import com.x.cms.assemble.control.jaxrs.fileinfo.exception.FileInfoNotExistsException; import com.x.cms.assemble.control.jaxrs.fileinfo.exception.FileInfoQueryByIdException; import com.x.cms.assemble.control.jaxrs.fileinfo.exception.FileInfoSizeInvalidException; import com.x.cms.core.entity.FileInfo; import net.sf.ehcache.Element; public class ExcuteImageToBase64 extends ExcuteBase { private Logger logger = LoggerFactory.getLogger( ExcuteImageToBase64.class ); protected ActionResult<WrapOutString> execute( HttpServletRequest request, EffectivePerson effectivePerson, String id, String size ) throws Exception { ActionResult<WrapOutString> result = new ActionResult<>(); WrapOutString wrap = null; FileInfo fileInfo = null; Integer sizeNum = null; Boolean check = true; String cacheKey = ApplicationCache.concreteCacheKey( "base64", id, size ); Element element = cache.get(cacheKey); if ((null != element) && ( null != element.getObjectValue()) ) { wrap = ( WrapOutString ) element.getObjectValue(); result.setData(wrap); } else { if( check ){ if( id == null || id.isEmpty() ){ check = false; Exception exception = new FileInfoIdEmptyException(); result.error( exception ); //logger.error( e, effectivePerson, request, null); } } if( check ){ if( size != null && !size.isEmpty() ){ if ( NumberUtils.isNumber( size ) ) { sizeNum = Integer.parseInt( size ); }else{ check = false; Exception exception = new FileInfoSizeInvalidException(); result.error( exception ); //logger.error( e, effectivePerson, request, null); } }else{ sizeNum = 800; } } if( check ){ try { fileInfo = fileInfoServiceAdv.get( id ); if( fileInfo == null ){ check = false; Exception exception = new FileInfoNotExistsException( id ); result.error( exception ); //logger.error( e, effectivePerson, request, null); } } catch (Exception e) { check = false; Exception exception = new FileInfoQueryByIdException( e, id ); result.error( exception ); logger.error( e, effectivePerson, request, null); } } if( check ){ if ( !isImage( fileInfo ) ){ check = false; Exception exception = new FileInfoIsNotImageException( id ); result.error( exception ); //logger.error( e, effectivePerson, request, null); } } BufferedImage image = null; ByteArrayInputStream input = null; ByteArrayOutputStream output_for_ftp = new ByteArrayOutputStream(); ByteArrayOutputStream output = new ByteArrayOutputStream(); StorageMapping mapping = ThisApplication.context().storageMappings().get( FileInfo.class, fileInfo.getStorage()); try{ fileInfo.readContent( mapping, output_for_ftp ); input = new ByteArrayInputStream( output_for_ftp.toByteArray() ); image = ImageIO.read( input ); int width = image.getWidth(); int height = image.getHeight(); if ( sizeNum > 0 ) { if( width * height > sizeNum * sizeNum ){ image = Scalr.resize( image, sizeNum ); } } ImageIO.write( image, "png", output ); wrap = new WrapOutString(); wrap.setValue(Base64.encodeBase64String( output.toByteArray() )); cache.put(new Element( cacheKey, wrap )); result.setData( wrap ); }catch( Exception e ){ check = false; Exception exception = new FileInfoBase64EncodeException( e, id ); result.error( exception ); logger.error( e, effectivePerson, request, null); } } return result; } private boolean isImage(FileInfo fileInfo) { if( fileInfo == null || fileInfo.getExtension() == null || fileInfo.getExtension().isEmpty() ){ return false; } if( "jpg".equalsIgnoreCase( fileInfo.getExtension() )){ return true; }else if( "png".equalsIgnoreCase( fileInfo.getExtension() )){ return true; }else if( "jpeg".equalsIgnoreCase( fileInfo.getExtension() )){ return true; }else if( "tiff".equalsIgnoreCase( fileInfo.getExtension() )){ return true; }else if( "gif".equalsIgnoreCase( fileInfo.getExtension() )){ return true; }else if( "bmp".equalsIgnoreCase( fileInfo.getExtension() )){ return true; } return false; } }
[ "caixiangyi2004@126.com" ]
caixiangyi2004@126.com
e5c719a1f12130080cfcc528256cc559be4c485a
471a1d9598d792c18392ca1485bbb3b29d1165c5
/jadx-MFP/src/main/java/com/google/android/gms/internal/measurement/zzsi.java
0d279e6b61d5962e1863656fa7e9f0c5e910123e
[]
no_license
reed07/MyPreferencePal
84db3a93c114868dd3691217cc175a8675e5544f
365b42fcc5670844187ae61b8cbc02c542aa348e
refs/heads/master
2020-03-10T23:10:43.112303
2019-07-08T00:39:32
2019-07-08T00:39:32
129,635,379
2
0
null
null
null
null
UTF-8
Java
false
false
5,467
java
package com.google.android.gms.internal.measurement; import android.annotation.SuppressLint; import android.content.Context; import android.util.Log; import java.util.concurrent.atomic.AtomicInteger; import javax.annotation.Nullable; public abstract class zzsi<T> { private static final Object zzbro = new Object(); private static boolean zzbrp = false; private static final AtomicInteger zzbrs = new AtomicInteger(); @SuppressLint({"StaticFieldLeak"}) private static Context zzri = null; private final String name; private volatile T zzall; private final zzso zzbrq; private final T zzbrr; private volatile int zzbrt; public static void zzae(Context context) { synchronized (zzbro) { Context applicationContext = context.getApplicationContext(); if (applicationContext != null) { context = applicationContext; } if (zzri != context) { synchronized (zzrx.class) { zzrx.zzbrd.clear(); } synchronized (zzsp.class) { zzsp.zzbsb.clear(); } synchronized (zzse.class) { zzse.zzbrl = null; } zzbrs.incrementAndGet(); zzri = context; } } } /* access modifiers changed from: 0000 */ public abstract T zzs(Object obj); static void zztq() { zzbrs.incrementAndGet(); } private zzsi(zzso zzso, String str, T t) { this.zzbrt = -1; if (zzso.zzbrv != null) { this.zzbrq = zzso; this.name = str; this.zzbrr = t; return; } throw new IllegalArgumentException("Must pass a valid SharedPreferences file name or ContentProvider URI"); } private final String zzfr(String str) { if (str != null && str.isEmpty()) { return this.name; } String valueOf = String.valueOf(str); String valueOf2 = String.valueOf(this.name); return valueOf2.length() != 0 ? valueOf.concat(valueOf2) : new String(valueOf); } public final String zztr() { return zzfr(this.zzbrq.zzbrx); } public final T getDefaultValue() { return this.zzbrr; } public final T get() { int i = zzbrs.get(); if (this.zzbrt < i) { synchronized (this) { if (this.zzbrt < i) { if (zzri != null) { zzso zzso = this.zzbrq; T zzts = zzts(); if (zzts == null) { zzts = zztt(); if (zzts == null) { zzts = this.zzbrr; } } this.zzall = zzts; this.zzbrt = i; } else { throw new IllegalStateException("Must call PhenotypeFlag.init() first"); } } } } return this.zzall; } @Nullable private final T zzts() { zzsb zzsb; zzso zzso = this.zzbrq; String str = (String) zzse.zzad(zzri).zzfn("gms:phenotype:phenotype_flag:debug_bypass_phenotype"); if (!(str != null && zzru.zzbqq.matcher(str).matches())) { if (this.zzbrq.zzbrv != null) { zzsb = zzrx.zza(zzri.getContentResolver(), this.zzbrq.zzbrv); } else { Context context = zzri; zzso zzso2 = this.zzbrq; zzsb = zzsp.zzi(context, null); } if (zzsb != null) { Object zzfn = zzsb.zzfn(zztr()); if (zzfn != null) { return zzs(zzfn); } } } else { String str2 = "PhenotypeFlag"; String str3 = "Bypass reading Phenotype values for flag: "; String valueOf = String.valueOf(zztr()); Log.w(str2, valueOf.length() != 0 ? str3.concat(valueOf) : new String(str3)); } return null; } @Nullable private final T zztt() { zzso zzso = this.zzbrq; Object zzfn = zzse.zzad(zzri).zzfn(zzfr(this.zzbrq.zzbrw)); if (zzfn != null) { return zzs(zzfn); } return null; } /* access modifiers changed from: private */ public static zzsi<Long> zza(zzso zzso, String str, long j) { return new zzsj(zzso, str, Long.valueOf(j)); } /* access modifiers changed from: private */ public static zzsi<Integer> zza(zzso zzso, String str, int i) { return new zzsk(zzso, str, Integer.valueOf(i)); } /* access modifiers changed from: private */ public static zzsi<Boolean> zza(zzso zzso, String str, boolean z) { return new zzsl(zzso, str, Boolean.valueOf(z)); } /* access modifiers changed from: private */ public static zzsi<Double> zza(zzso zzso, String str, double d) { return new zzsm(zzso, str, Double.valueOf(d)); } /* access modifiers changed from: private */ public static zzsi<String> zza(zzso zzso, String str, String str2) { return new zzsn(zzso, str, str2); } /* synthetic */ zzsi(zzso zzso, String str, Object obj, zzsj zzsj) { this(zzso, str, obj); } }
[ "anon@ymous.email" ]
anon@ymous.email
4111dcbe05f14a807af53d3d63840f747d121b9b
6d32f4a25a67dfd8d3d6c8fe7e7815cf2e5e2b9b
/domino/externals/javolution-core-java/src/main/java/javolution/util/internal/collection/AtomicCollectionImpl.java
76198dc5fd124f26c2b90ecf7a70ae0b1651e197
[ "BSD-2-Clause", "BSD-3-Clause", "MIT", "Apache-2.0", "ICU", "LicenseRef-scancode-unknown-license-reference" ]
permissive
rPraml/org.openntf.domino
276f23560031bb8b2ea534dbd793482b5909dde1
c6729eab92b8e16746c76d50702cf8e1f990ca64
refs/heads/master
2021-01-09T05:06:31.721936
2015-08-06T07:02:52
2015-08-06T07:02:52
13,318,958
1
1
null
2015-06-10T08:39:17
2013-10-04T07:40:39
HTML
UTF-8
Java
false
false
4,822
java
/* * Javolution - Java(TM) Solution for Real-Time and Embedded Systems * Copyright (C) 2012 - Javolution (http://javolution.org/) * All rights reserved. * * Permission to use, copy, modify, and distribute this software is * freely granted, provided that this notice is preserved. */ package javolution.util.internal.collection; import java.util.Collection; import java.util.Iterator; import javolution.util.function.Consumer; import javolution.util.function.Equality; import javolution.util.service.CollectionService; /** * An atomic view over a collection (copy-on-write). */ public class AtomicCollectionImpl<E> extends CollectionView<E> { /** Thread-Safe Iterator. */ private class IteratorImpl implements Iterator<E> { private E current; private final Iterator<E> targetIterator; public IteratorImpl() { targetIterator = targetView().iterator(); } @Override public boolean hasNext() { return targetIterator.hasNext(); } @Override public E next() { current = targetIterator.next(); return current; } @Override public void remove() { if (current == null) throw new IllegalStateException(); AtomicCollectionImpl.this.remove(current); current = null; } } private static final long serialVersionUID = 0x600L; // Version. protected volatile CollectionService<E> immutable; // The copy used by readers. protected transient Thread updatingThread; // The thread executing an update. public AtomicCollectionImpl(final CollectionService<E> target) { super(target); this.immutable = cloneTarget(); } @Override public synchronized boolean add(final E element) { boolean changed = target().add(element); if (changed && !updateInProgress()) immutable = cloneTarget(); return changed; } @Override public synchronized boolean addAll(final Collection<? extends E> c) { boolean changed = target().addAll(c); if (changed && !updateInProgress()) immutable = cloneTarget(); return changed; } @Override public synchronized void clear() { target().clear(); if (!updateInProgress()) { immutable = cloneTarget(); } } @Override public synchronized AtomicCollectionImpl<E> clone() { // Synchronized required since working with real target. AtomicCollectionImpl<E> copy = (AtomicCollectionImpl<E>) super.clone(); copy.updatingThread = null; return copy; } @Override public Equality<? super E> comparator() { return immutable.comparator(); } @Override public boolean contains(final Object o) { return targetView().contains(o); } @Override public boolean containsAll(final Collection<?> c) { return targetView().containsAll(c); } @Override public boolean equals(final Object o) { return targetView().equals(o); } @Override public int hashCode() { return targetView().hashCode(); } @Override public boolean isEmpty() { return targetView().isEmpty(); } @Override public Iterator<E> iterator() { return new IteratorImpl(); } @Override public synchronized boolean remove(final Object o) { boolean changed = target().remove(o); if (changed && !updateInProgress()) immutable = cloneTarget(); return changed; } @Override public synchronized boolean removeAll(final Collection<?> c) { boolean changed = target().removeAll(c); if (changed && !updateInProgress()) immutable = cloneTarget(); return changed; } @Override public synchronized boolean retainAll(final Collection<?> c) { boolean changed = target().retainAll(c); if (changed && !updateInProgress()) immutable = cloneTarget(); return changed; } @Override public int size() { return targetView().size(); } @Override public Object[] toArray() { return targetView().toArray(); } @Override public <T> T[] toArray(final T[] a) { return targetView().toArray(a); } @Override public synchronized void update(final Consumer<CollectionService<E>> action, final CollectionService<E> view) { updatingThread = Thread.currentThread(); // Update in progress. try { target().update(action, view); // No copy performed. } finally { updatingThread = null; immutable = cloneTarget(); // One single copy ! } } /** Returns a clone copy of target. */ protected CollectionService<E> cloneTarget() { try { return target().clone(); } catch (CloneNotSupportedException e) { throw new Error("Cannot happen since target is Cloneable."); } } /** * Returns either the immutable target or the actual target if updating thread. */ protected CollectionService<E> targetView() { return ((updatingThread == null) || (updatingThread != Thread.currentThread())) ? immutable : target(); } /** Indicates if the current thread is doing an atomic update. */ protected final boolean updateInProgress() { return updatingThread == Thread.currentThread(); } }
[ "nathan.freeman@redpilldevelopment.com" ]
nathan.freeman@redpilldevelopment.com
a4803dd03a53ca5d20429b7a840d6a8caffb4b52
f525deacb5c97e139ae2d73a4c1304affb7ea197
/gitv-DeObfuscate/src/main/java/com/push/mqttv3/MqttDeliveryToken.java
7d6ed30af8c065d5a2ebbdf0c97a905c1c9ac373
[]
no_license
AgnitumuS/gitv
93b2359e1bf9f2b6c945298c61c5c6dbfeea49b3
242c9a10a0aeb41b9589de9f254e6ce9f57bd77a
refs/heads/master
2021-08-08T00:50:10.630301
2017-11-09T08:10:33
2017-11-09T08:10:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
299
java
package com.push.mqttv3; public interface MqttDeliveryToken { MqttMessage getMessage() throws MqttException; boolean isComplete(); void waitForCompletion() throws MqttException, MqttSecurityException; void waitForCompletion(long j) throws MqttException, MqttSecurityException; }
[ "liuwencai@le.com" ]
liuwencai@le.com
bde14cc710d1433fc4e78dcc91fe348f49d260a4
9570b9c11845652aba01a90f2f3fd85dc7caae52
/com.github.sormuras.bach/test/java/com/github/sormuras/bach/internal/ToolProvidersTests.java
8ecaab089508d0f3a29d68f46c6e8540682e20b3
[ "MIT" ]
permissive
paddlelaw/bach
85a166b43ef265c94cf4821202b8b7b79ac486b6
b77af47569b52f9d47d8d226d877166c507e7daf
refs/heads/main
2023-05-31T22:56:25.989400
2021-06-21T06:46:38
2021-06-21T06:46:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
584
java
package com.github.sormuras.bach.internal; import static org.junit.jupiter.api.Assertions.assertLinesMatch; import java.util.spi.ToolProvider; import org.junit.jupiter.api.Test; class ToolProvidersTests { @Test void describeBach() { var bach = ToolProvider.findFirst("bach").orElseThrow(); assertLinesMatch( """ bach \\(EXTERNAL, com\\.github\\.sormuras\\.bach.*\\) Builds (on(ly)) Java Modules https://github.com/sormuras/bach""" .lines(), ToolProviders.describe(bach).lines()); } }
[ "sormuras@gmail.com" ]
sormuras@gmail.com
ea67d7dc5c88ca3a81e019ffddde075160775adc
bfe4cc4bb945ab7040652495fbf1e397ae1b72f7
/providers/trmk-ecloud/src/main/java/org/jclouds/trmk/ecloud/features/DataCenterOperationsClient.java
faf772669ae07b010dd2739cc90f3903ad38a3f3
[ "Apache-2.0" ]
permissive
dllllb/jclouds
348d8bebb347a95aa4c1325590c299be69804c7d
fec28774da709e2189ba563fc3e845741acea497
refs/heads/master
2020-12-25T11:42:31.362453
2011-07-30T22:32:07
2011-07-30T22:32:07
1,571,863
2
0
null
null
null
null
UTF-8
Java
false
false
1,135
java
package org.jclouds.trmk.ecloud.features; import java.net.URI; import java.util.Set; import java.util.concurrent.TimeUnit; import org.jclouds.concurrent.Timeout; import org.jclouds.trmk.vcloud_0_8.domain.DataCenter; /** * Data Center Operations access to DataCenterOperations functionality in vCloud * <p/> * There are times where knowing a data center is necessary to complete certain * operations (i.e. uploading a catalog item). The data centers for an * organization are those data centers that contain at least one of the * organization's environments. * * @see DataCenterOperationsAsyncClient * @author Adrian Cole */ @Timeout(duration = 300, timeUnit = TimeUnit.SECONDS) public interface DataCenterOperationsClient { /** * This call will get the list of data centers that contain at least one of * the organization's environments. * * * @return data centers */ Set<DataCenter> listDataCentersInOrg(URI orgId); /** * This call will get the list of data centers by list id. * * @return data centers */ Set<DataCenter> listDataCenters(URI dataCentersList); }
[ "adrian@jclouds.org" ]
adrian@jclouds.org
9015c6bb6d0cf821dabf4c60fdbfce03fa7de83d
ae9efe033a18c3d4a0915bceda7be2b3b00ae571
/jambeth/jambeth-ioc/src/main/java/com/koch/ambeth/ioc/threadlocal/IThreadLocalCleanupController.java
2a1bb2f0910a844f66190ad9fd9871c30ed57e39
[ "Apache-2.0" ]
permissive
Dennis-Koch/ambeth
0902d321ccd15f6dc62ebb5e245e18187b913165
8552b210b8b37d3d8f66bdac2e094bf23c8b5fda
refs/heads/develop
2022-11-10T00:40:00.744551
2017-10-27T05:35:20
2017-10-27T05:35:20
88,013,592
0
4
Apache-2.0
2022-09-22T18:02:18
2017-04-12T05:36:00
Java
UTF-8
Java
false
false
897
java
package com.koch.ambeth.ioc.threadlocal; import com.koch.ambeth.util.state.IStateRollback; /*- * #%L * jambeth-ioc * %% * Copyright (C) 2017 Koch Softwaredevelopment * %% * 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. * #L% */ public interface IThreadLocalCleanupController { void cleanupThreadLocal(); IForkState createForkState(); IStateRollback pushThreadLocalState(IStateRollback... rollbacks); }
[ "dennis.koch@bruker.com" ]
dennis.koch@bruker.com
52541504fbafe8af951967406a341dc245a398f1
5b5defd093d62cc7e05a7a7c798356c7983e7866
/test/src/test/java/org/zstack/test/core/thread/TestChainTaskExceptionNotCallRunNext.java
b636721c3c71cbff51fa0502e404e5c543081976
[ "Apache-2.0" ]
permissive
tbyes/zstack
0bddaf6a1be4e46e181dfffacdbd5aaff5ec803b
7f8ae92fa3d95c1e3ac876a9846f9fe0cbf63d5e
refs/heads/master
2020-06-30T20:42:07.888244
2016-11-21T09:12:13
2016-11-21T09:12:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,047
java
package org.zstack.test.core.thread; import junit.framework.Assert; import org.junit.Before; import org.junit.Test; import org.zstack.core.componentloader.ComponentLoader; import org.zstack.core.thread.ChainTask; import org.zstack.core.thread.SyncTaskChain; import org.zstack.core.thread.ThreadFacade; import org.zstack.test.BeanConstructor; import org.zstack.utils.Utils; import org.zstack.utils.logging.CLogger; import java.util.ArrayList; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; public class TestChainTaskExceptionNotCallRunNext { CLogger logger = Utils.getLogger(TestChainTaskExceptionNotCallRunNext.class); ComponentLoader loader; ThreadFacade thdf; int threadNum = 100; List<Integer> res = new ArrayList<Integer>(threadNum); CountDownLatch latch = new CountDownLatch(threadNum); class Tester extends ChainTask { int index; Tester(int index) { this.index = index; } @Override public String getName() { return "Test"; } @Override public String getSyncSignature() { return "Test"; } @Override public void run(SyncTaskChain chain) { logger.debug(String.valueOf(index)); res.add(index); latch.countDown(); throw new RuntimeException("On purpose"); } } @Before public void setUp() throws Exception { BeanConstructor con = new BeanConstructor(); loader = con.build(); thdf = loader.getComponent(ThreadFacade.class); } @Test public void test() throws InterruptedException { for (int i=0; i<threadNum; i++) { Tester t = new Tester(i); thdf.chainSubmit(t); } latch.await(2, TimeUnit.MINUTES); int si = -1; for (Integer index : res) { Assert.assertTrue(index > si); si = index; } } }
[ "xuexuemiao@yeah.net" ]
xuexuemiao@yeah.net
b2af57f8b76321f862ea7f6c23fa98d2cfa9a409
a0c7d127d08afcca3c77279d94462106e679f0b5
/src/LC809_ExpressiveWords.java
22f8147fcfc6a2066a70940348c73575dd60269f
[]
no_license
zhangchengyao/LC
0c22f2131dd9d3ef485a09f1aa44b58d15895fdb
b86525792a42d69a0d4bfd2ff023da2e612e820b
refs/heads/master
2021-07-13T21:07:06.306844
2021-06-05T22:35:09
2021-06-05T22:35:09
124,514,335
2
0
null
null
null
null
UTF-8
Java
false
false
848
java
public class LC809_ExpressiveWords { public int expressiveWords(String S, String[] words) { int res = 0; for(String word: words){ int i = 0; int j = 0; while(i < S.length() && j < word.length()){ if(S.charAt(i) == word.charAt(j)){ int p = i + 1; int q = j + 1; while(p < S.length() && S.charAt(p) == S.charAt(i)) p++; while(q < word.length() && word.charAt(q) == word.charAt(j)) q++; if(p - i == q - j || (p - i >= 3 && p - i > q - j)){ i = p; j = q; } else break; } else break; } if(i == S.length() && j == word.length()) res++; } return res; } }
[ "tc2002618@126.com" ]
tc2002618@126.com
0b96490cea5397b48738523a4f658c757bf0aca0
292eb0ad01b6c05c2878062b828ac6145dd4d438
/app/src/main/java/org/stepic/droid/util/DeviceInfoUtil.java
0c7aaa22fbd7a8da6f94c888bb80457ce6268163
[ "Apache-2.0" ]
permissive
VDenis/stepic-android
34dfef2573eef0013e1369954d8f7eddd5a97eb7
ba2004b3b78024463aba5811aa4e388af36be7fe
refs/heads/master
2021-01-18T12:28:45.840673
2016-05-23T17:36:10
2016-05-23T17:36:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,673
java
package org.stepic.droid.util; import android.annotation.SuppressLint; import android.app.Activity; import android.content.ContentResolver; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Configuration; import android.graphics.Point; import android.location.LocationManager; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.NetworkInfo.State; import android.os.Build; import android.os.Environment; import android.os.Looper; import android.os.PowerManager; import android.provider.Settings; import android.text.TextUtils; import android.view.Display; import com.yandex.metrica.YandexMetrica; import java.util.Enumeration; import java.util.Properties; public class DeviceInfoUtil { public static boolean isConnectedToMobileInternet(Context c) { // mobile State mobile = ((ConnectivityManager) c .getSystemService(Context.CONNECTIVITY_SERVICE)) .getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState(); return mobile == NetworkInfo.State.CONNECTED || mobile == NetworkInfo.State.CONNECTING; } public static boolean isInternetAvailable(Context c) { ConnectivityManager connectivityManager = (ConnectivityManager) c .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager .getActiveNetworkInfo(); return activeNetworkInfo != null; } public static String getShortInfo(Context a) { String s = ""; try { PackageInfo pInfo = a.getPackageManager().getPackageInfo( a.getPackageName(), PackageManager.GET_META_DATA); s += "\n APP Package Name: " + a.getPackageName(); s += "\n APP Version Name: " + pInfo.versionName; s += "\n APP Version Code: " + pInfo.versionCode; s += "\n"; } catch (NameNotFoundException e) { } s += "\n OS Version: " + System.getProperty("os.version") + " (" + android.os.Build.VERSION.INCREMENTAL + ")"; s += "\n OS API Level: " + android.os.Build.VERSION.SDK; s += "\n Device: " + android.os.Build.DEVICE; s += "\n Model (and Product): " + android.os.Build.MODEL + " (" + android.os.Build.PRODUCT + ")"; return s; } public static int getBuildVersion(Context a) { try { PackageInfo pInfo = a.getPackageManager().getPackageInfo( a.getPackageName(), PackageManager.GET_META_DATA); return pInfo.versionCode; } catch (NameNotFoundException e) { YandexMetrica.reportError("getBuildVersion", e); return Integer.MAX_VALUE; } } public static String getInfosAboutDevice(Context a) { String s = ""; try { PackageInfo pInfo = a.getPackageManager().getPackageInfo( a.getPackageName(), PackageManager.GET_META_DATA); s += "\n APP Package Name: " + a.getPackageName(); s += "\n APP Version Name: " + pInfo.versionName; s += "\n APP Version Code: " + pInfo.versionCode; s += "\n"; } catch (NameNotFoundException e) { } s += "\n OS Version: " + System.getProperty("os.version") + " (" + android.os.Build.VERSION.INCREMENTAL + ")"; s += "\n OS API Level: " + android.os.Build.VERSION.SDK; s += "\n Device: " + android.os.Build.DEVICE; s += "\n Model (and Product): " + android.os.Build.MODEL + " (" + android.os.Build.PRODUCT + ")"; // TODO add application version! // more from // http://developer.android.com/reference/android/os/Build.html : s += "\n Manufacturer: " + android.os.Build.MANUFACTURER; s += "\n Other TAGS: " + android.os.Build.TAGS; s += "\n Keyboard available: " + (a.getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS); s += "\n Trackball available: " + (a.getResources().getConfiguration().navigation == Configuration.NAVIGATION_TRACKBALL); s += "\n SD Card state: " + Environment.getExternalStorageState(); Properties p = System.getProperties(); Enumeration keys = p.keys(); String key = ""; while (keys.hasMoreElements()) { key = (String) keys.nextElement(); s += "\n > " + key + " = " + (String) p.get(key); } return s; } public static boolean isPositioningViaWifiEnabled(Context context) { ContentResolver cr = context.getContentResolver(); String enabledProviders = Settings.Secure.getString(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED); if (!TextUtils.isEmpty(enabledProviders)) { // not the fastest way to do that :) String[] providersList = TextUtils.split(enabledProviders, ","); for (String provider : providersList) { if (LocationManager.NETWORK_PROVIDER.equals(provider)) { return true; } } } return false; } public static boolean isScreenOn(Context context) { return ((PowerManager) context.getSystemService(Context.POWER_SERVICE)) .isScreenOn(); } public static boolean isConnectedToWifi(Context c) { State wifi = ((ConnectivityManager) c .getSystemService(Context.CONNECTIVITY_SERVICE)) .getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState(); return wifi == NetworkInfo.State.CONNECTED || wifi == NetworkInfo.State.CONNECTING; } /** * @return true if the current thread is the UI thread */ public static boolean isUiThread() { return Looper.getMainLooper().getThread() == Thread.currentThread(); } /** * @param a * @return the size with size.x=width and size.y=height */ public static Point getScreenSize(Activity a) { return getScreenSize(a.getWindowManager().getDefaultDisplay()); } @SuppressLint("NewApi") public static Point getScreenSize(Display d) { Point size = new Point(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { d.getSize(size); } else { size.x = d.getWidth(); size.y = d.getHeight(); } return size; } }
[ "kir-maka@yandex.ru" ]
kir-maka@yandex.ru
a3e94ba5af0366015e5b0454a338e4f409755166
5c77fe8667454646caf6907a676a858c207a0b6e
/sources/gnu/xquery/util/OrderedTuples.java
2410afd51ea374c44b320ba6da87c3ba2a3453ff
[]
no_license
PixalTeam/controllable_led_apk
f42c6559cd56eb48046c3f174a244c8c3da8d48a
06a8b9698ee800ea37aab73abc1b9378bf899a16
refs/heads/master
2020-11-24T16:51:43.147571
2020-05-21T15:51:37
2020-05-21T15:51:37
228,257,359
0
0
null
2020-11-15T12:57:27
2019-12-15T21:44:18
Java
UTF-8
Java
false
false
6,075
java
package gnu.xquery.util; import gnu.kawa.functions.NumberCompare; import gnu.kawa.xml.KNode; import gnu.kawa.xml.UntypedAtomic; import gnu.lists.FilterConsumer; import gnu.mapping.CallContext; import gnu.mapping.Procedure; public class OrderedTuples extends FilterConsumer { Procedure body; Object[] comps; int first; /* renamed from: n */ int f243n; int[] next; Object[] tuples = new Object[10]; public void writeObject(Object v) { if (this.f243n >= this.tuples.length) { Object[] tmp = new Object[(this.f243n * 2)]; System.arraycopy(this.tuples, 0, tmp, 0, this.f243n); this.tuples = tmp; } Object[] objArr = this.tuples; int i = this.f243n; this.f243n = i + 1; objArr[i] = v; } OrderedTuples() { super(null); } public static OrderedTuples make$V(Procedure body2, Object[] comps2) { OrderedTuples tuples2 = new OrderedTuples(); tuples2.comps = comps2; tuples2.body = body2; return tuples2; } public void run$X(CallContext ctx) throws Throwable { this.first = listsort(0); emit(ctx); } /* access modifiers changed from: 0000 */ public void emit(CallContext ctx) throws Throwable { int p = this.first; while (p >= 0) { emit(p, ctx); p = this.next[p]; } } /* access modifiers changed from: 0000 */ public void emit(int index, CallContext ctx) throws Throwable { this.body.checkN((Object[]) this.tuples[index], ctx); ctx.runUntilDone(); } /* access modifiers changed from: 0000 */ public int cmp(int a, int b) throws Throwable { int c; boolean z; for (int i = 0; i < this.comps.length; i += 3) { Procedure comparator = (Procedure) this.comps[i]; String flags = (String) this.comps[i + 1]; NamedCollator collator = (NamedCollator) this.comps[i + 2]; if (collator == null) { collator = NamedCollator.codepointCollation; } Object val1 = comparator.applyN((Object[]) this.tuples[a]); Object val2 = comparator.applyN((Object[]) this.tuples[b]); Object val12 = KNode.atomicValue(val1); Object val22 = KNode.atomicValue(val2); if (val12 instanceof UntypedAtomic) { val12 = val12.toString(); } if (val22 instanceof UntypedAtomic) { val22 = val22.toString(); } boolean empty1 = SequenceUtils.isEmptySequence(val12); boolean empty2 = SequenceUtils.isEmptySequence(val22); if (!empty1 || !empty2) { if (empty1 || empty2) { if (flags.charAt(1) == 'L') { z = true; } else { z = false; } c = empty1 == z ? -1 : 1; } else { boolean isNaN1 = (val12 instanceof Number) && Double.isNaN(((Number) val12).doubleValue()); boolean isNaN2 = (val22 instanceof Number) && Double.isNaN(((Number) val22).doubleValue()); if (!isNaN1 || !isNaN2) { if (isNaN1 || isNaN2) { c = isNaN1 == (flags.charAt(1) == 'L') ? -1 : 1; } else { c = (!(val12 instanceof Number) || !(val22 instanceof Number)) ? collator.compare(val12.toString(), val22.toString()) : NumberCompare.compare(val12, val22, false); } } } if (c != 0) { if (flags.charAt(0) == 'A') { return c; } return -c; } } } return 0; } /* access modifiers changed from: 0000 */ public int listsort(int list) throws Throwable { int e; if (this.f243n == 0) { return -1; } this.next = new int[this.f243n]; int i = 1; while (i != this.f243n) { this.next[i - 1] = i; i++; } this.next[i - 1] = -1; int insize = 1; while (true) { int p = list; list = -1; int tail = -1; int nmerges = 0; while (p >= 0) { nmerges++; int q = p; int psize = 0; for (int i2 = 0; i2 < insize; i2++) { psize++; q = this.next[q]; if (q < 0) { break; } } int qsize = insize; while (true) { if (psize > 0 || (qsize > 0 && q >= 0)) { if (psize == 0) { e = q; q = this.next[q]; qsize--; } else if (qsize == 0 || q < 0) { e = p; p = this.next[p]; psize--; } else if (cmp(p, q) <= 0) { e = p; p = this.next[p]; psize--; } else { e = q; q = this.next[q]; qsize--; } if (tail >= 0) { this.next[tail] = e; } else { list = e; } tail = e; } } p = q; } this.next[tail] = -1; if (nmerges <= 1) { return list; } insize *= 2; } } }
[ "34947108+Gumbraise@users.noreply.github.com" ]
34947108+Gumbraise@users.noreply.github.com
9f396382758e67db41170991c15fd33692c5a171
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/9/9_2abdb0580ace37b3982111496f65688abba05940/ManualJarMaker/9_2abdb0580ace37b3982111496f65688abba05940_ManualJarMaker_t.java
cfd3122f03fa49de56d96845d8ee2c3cd4ef018a
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
2,576
java
package net.ayld.facade.bundle.impl; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.Set; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.JarOutputStream; import java.util.regex.Pattern; import com.google.common.base.Splitter; import com.google.common.base.Strings; import com.google.common.collect.Sets; import net.ayld.facade.bundle.JarMaker; import net.ayld.facade.model.ClassFile; public class ManualJarMaker implements JarMaker{ private String facadeJarName = "facade.jar"; @Override public JarFile zip(Set<File> classFiles) throws IOException { makeOutputDir(); final JarOutputStream jarOut = new JarOutputStream(new FileOutputStream(new File(facadeJarName))); final Set<String> dirEntries = Sets.newHashSet(); final Set<String> classEntries = Sets.newHashSet(); for (File classFile : classFiles) { final ClassFile clazz = ClassFile.fromFile(classFile); final String simpleName = clazz.qualifiedName().shortName(); final String packages = clazz.qualifiedName().toString().replaceAll(escapeRegexChars(simpleName), ""); final StringBuilder packageDirs = new StringBuilder(); for (String packageName : Splitter.on(".").split(packages)) { if (Strings.isNullOrEmpty(packageName)) { continue; } packageDirs.append(packageName).append(File.separator); if (!dirEntries.contains(packageDirs.toString())) { jarOut.putNextEntry(new JarEntry(packageDirs.toString())); } dirEntries.add(packageDirs.toString()); } final String classEntry = packageDirs.append(classFile.getName()).toString(); if (!classEntries.contains(classEntry)) { jarOut.putNextEntry(new JarEntry(classEntry)); final FileInputStream in = new FileInputStream(classFile); int len; final byte[] buf = new byte[1024]; while ((len = in.read(buf)) > 0) { jarOut.write(buf, 0, len); } jarOut.closeEntry(); in.close(); } classEntries.add(classEntry); } jarOut.close(); return new JarFile(facadeJarName); } private String escapeRegexChars(String str) { return Pattern.quote(str); } private void makeOutputDir() { // ignoring result because it is ok for the parent to exist new File(new File(facadeJarName).getParent()).mkdirs(); } public void setZippedJarName(String zippedJarName) { this.facadeJarName = zippedJarName; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
86e1f7967a0887d47b7e32283c6fd2266a0dcabf
32129c69bccec8c6928f28b06bdbdb5bfeab9c50
/src/main/java/colt/nicity/core/lang/MutableDouble.java
6dc41df3cdc2e8630f62b632541309e2c2e8747c
[]
no_license
jnthnclt/nicity-core
1de32eb5945c13fb3fdf78b36ed5eeda21dadc84
0eda2a258c6c2165e58717029fc042a235000caa
refs/heads/master
2021-01-13T01:58:06.626621
2014-01-03T23:25:48
2014-01-03T23:26:55
704,378
0
1
null
2012-09-25T23:14:50
2010-06-05T03:58:17
Java
UTF-8
Java
false
false
2,644
java
/* * MutableDouble.java.java * * Created on 12-29-2009 03:56:00 PM * * Copyright 2009 Jonathan Colt * * 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 colt.nicity.core.lang; /** * * @author Administrator */ public class MutableDouble extends ASetObject implements Comparable { private double unit = 0; /** * */ public MutableDouble() { } /** * * @param _unit */ public MutableDouble(double _unit) { unit = _unit; } /** * * @return */ @Override public Object hashObject() { return unit; } /** * * @return */ public double doubleValue() { return unit; } /** * * @return */ public double get() { return unit; } /** * * @param _val */ public void set(double _val) { unit = _val; } /** * * @param _val */ public void min(double _val) { if (_val < unit) { unit = _val; } } /** * * @param _val */ public void max(double _val) { if (_val > unit) { unit = _val; } } /** * * @param _amount */ public void inc(double _amount) { unit += _amount; } /** * */ public void inc() { unit++; } /** * */ public void dec() { unit--; } /** * * @param _amount */ public void multiply(double _amount) { unit *= _amount; } /** * * @param _amount */ public void divide(double _amount) { unit /= _amount; } /** * */ public void reset() { unit = 0; } @Override public String toString() { Object o = hashObject(); if (o instanceof Integer) { return o.toString(); } return o.toString() + "=" + unit; } @Override public int compareTo(Object o) { double a = this.unit; double b = ((MutableDouble) o).unit; return (a < b ? -1 : (a == b ? 0 : 1)); } }
[ "jonathan.colt@jivesoftware.com" ]
jonathan.colt@jivesoftware.com
592b73ebaf5db4ed769bf6e0a3928149323cc7c5
cab2be96e03ddfca1f76108741c8cc8ffdf49be2
/Codeforces/C/58C/Trees.java
2d96ce48f1a8761b921322f91c11a67626ed6807
[]
no_license
ThePinger/ACM
ceeb3b36fc5609d869ba12f7b8783ffd87ed435b
955836e9648a2328cc9638e5af21cec5f4fb5143
refs/heads/master
2021-01-22T21:59:34.770120
2019-08-20T07:57:28
2019-08-20T07:57:28
92,749,931
3
1
null
null
null
null
UTF-8
Java
false
false
1,085
java
//58C //Trees //BruteForce import java.util.*; public class Trees { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] trees = new int[n + 1]; int max = 0; for(int i = 1 ; i < n + 1 ; i++) { trees[i] = sc.nextInt(); max = Math.max(max, trees[i]); } int size; if(max < n) size = n; else size = max; int[] good = new int[size]; int j = n; for(int i = 1; i < j ; i++) { good[Math.abs(trees[i] - i)]++; good[Math.abs(trees[j] - i)]++; j--; } if(n % 2 != 0) good[Math.abs(trees[j] - j)]++; int changes = 0; for(int i = 0; i < good.length ; i++) changes = Math.max(good[i], changes); int tmpMax = 0; if(n > 1 && ((trees[1] == 1 && trees[2] == 1) || (trees[n] == 1 && trees[n-1] == 1)) && good[0] != changes) for(int i = 0 ; i < good.length ; i++) if(good[i] != changes) tmpMax = Math.max(good[i], tmpMax); if(tmpMax != 0) changes = tmpMax; System.out.println(n - changes); } }
[ "omaremadsabry@gmail.com" ]
omaremadsabry@gmail.com
214c1d28b790a223f8df4161408c9cd5a39f46c8
ce0e785348eccfbe071648e1a32ba7b9b74ead60
/guoren-market-util/src/main/java/com/gop/util/TokenHelper.java
041e008142c4a6fe6024423610079a8cb17b1db0
[]
no_license
littleOrange8023/market
0c279e8dd92db4dd23e20aeff037e4b2998f9e0e
093ce8850624061bb6e51dd064b606c82fccbadd
refs/heads/master
2020-04-19T11:05:11.191298
2019-01-25T07:04:27
2019-01-25T07:04:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,477
java
package com.gop.util; import com.alibaba.fastjson.JSONObject; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Date; import java.util.Objects; import java.util.concurrent.TimeUnit; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Component; import org.springframework.util.Assert; @Component @Slf4j public class TokenHelper { @Autowired private StringRedisTemplate template; private static final String webName = "brokerWeb"; private static final String secret = "915fc714cf7000744c908d1bc140166f"; private SignatureAlgorithm SIGNATURE_ALGORITHM = SignatureAlgorithm.HS512; private static final String TOKEN_NAMESPACE = "broker:token:"; private static final long THIRTY_MINUTES = 1000 * 60 * 30L; public String generateToken(Integer uid) { Assert.notNull(uid, "用户id不能为空"); long currentTimeStamp = Instant.now().toEpochMilli(); Token token = new Token(); token.setUid(uid); token.setExpiration(new Date(currentTimeStamp + THIRTY_MINUTES)); token.setToken( Jwts.builder().setIssuer(webName).setSubject(JSONObject.toJSONString(uid)).setAudience("web") .setIssuedAt(new Date(currentTimeStamp)) .setExpiration(new Date(currentTimeStamp + 1000 * 60 * 60 * 24 * 180L)) .signWith(SIGNATURE_ALGORITHM, secret).compact() ); template.opsForValue().set(TOKEN_NAMESPACE + uid, JSONObject.toJSONString(token), 30L, TimeUnit.MINUTES); return token.getToken(); } public Long getFromToken(String token) { return JSONObject.parseObject(getJsonStringFromBody(token), Long.class); } public Integer validToken(String token) { long uid = getFromToken(token); Token tokenDto = JSONObject.parseObject(template.opsForValue().get(TOKEN_NAMESPACE + uid), Token.class); if (tokenDto == null || LocalDateTime.now().isAfter(tokenDto.getExpiration().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()) || !Objects.equals(token, tokenDto.getToken())) { throw new RuntimeException("TOKE_HAS_INVALID"); } tokenDto.setExpiration(new Date(Instant.now().toEpochMilli() + THIRTY_MINUTES)); template.opsForValue().set(TOKEN_NAMESPACE + uid, JSONObject.toJSONString(tokenDto), 30L, TimeUnit.MINUTES); return tokenDto.getUid(); } public void removeToken(String token) { if (token == null) { log.warn("token is empty, ignore clean"); return; } long uid = getFromToken(token); Token tokenDto = JSONObject.parseObject(template.opsForValue().get(TOKEN_NAMESPACE + uid), Token.class); if (tokenDto != null && Objects.equals(token, tokenDto.getToken())) { template.delete(TOKEN_NAMESPACE + uid); return; } log.warn("token invalid or not match, ignore clean"); } private String getJsonStringFromBody(String token) { return Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody().getSubject(); } private Claims getAllClaimsFromToken(String token) { Claims claims; try { claims = Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody(); } catch (Exception e) { claims = null; } return claims; } @Data static class Token { private Integer uid; private String token; private Date expiration; } }
[ "ydq@yangdongqiongdeMacBook-Air.local" ]
ydq@yangdongqiongdeMacBook-Air.local
5a0df58ac1a583dd434612bc271c4903704bf43e
d14e7b429f55b48aeca8b6b0139f6b72b0b63012
/Sem01/AppSuma/src/java/pe/egcc/appsuma/controller/AppController.java
84500b95dbe6ae2731fd32c1a6f88005860e7da7
[]
no_license
gcoronelc/USIL_TPW_2017_1_TT
3d1e1712bce4d1e8483b62e62a664a53ba47f68a
4605a22f1fc560b36951a23d5d074ee1ed2540d9
refs/heads/master
2021-01-22T17:29:32.876994
2017-07-21T18:34:19
2017-07-21T18:34:19
85,022,322
0
1
null
2017-07-06T15:58:58
2017-03-15T02:59:09
Java
UTF-8
Java
false
false
1,133
java
package pe.egcc.appsuma.controller; import java.io.IOException; import javax.ejb.EJB; 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 pe.egcc.appsuma.service.MateService; @WebServlet(name = "AppController", urlPatterns = {"/AppController"}) public class AppController extends HttpServlet { @EJB private MateService service; @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Datos int n1 = Integer.parseInt(request.getParameter("n1")); int n2 = Integer.parseInt(request.getParameter("n2")); // Proceso int suma = service.sumar(n1, n2); // Reporte request.setAttribute("num1", n1); request.setAttribute("num2", n2); request.setAttribute("suma", suma); // Forward RequestDispatcher rd = request.getRequestDispatcher("rpta.jsp"); rd.forward(request, response); } }
[ "gcoronelc@gmail.com" ]
gcoronelc@gmail.com
d767200627179701392f5a8d5409693113a28273
b118a9cb23ae903bc5c7646b262012fb79cca2f2
/src/com/estrongs/android/pop/app/imageviewer/bz.java
8b9d9954d259e531494feef1cde321a884570769
[]
no_license
secpersu/com.estrongs.android.pop
22186c2ea9616b1a7169c18f34687479ddfbb6f7
53f99eb4c5b099d7ed22d70486ebe179e58f47e0
refs/heads/master
2020-07-10T09:16:59.232715
2015-07-05T03:24:29
2015-07-05T03:24:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
561
java
package com.estrongs.android.pop.app.imageviewer; import com.estrongs.android.pop.app.imageviewer.gallery.f; class bz implements Runnable { bz(by paramby) {} public void run() { if (a.b.a.g != null) { a.b.a.g.e(); } if (a.b.a.e.b() == 0) { a.b.a.finish(); return; } a.b.a.a(a.b.a.c, ViewImage21.c(a.b.a)); ViewImage21.g(a.b.a).notifyDataSetChanged(); } } /* Location: * Qualified Name: com.estrongs.android.pop.app.imageviewer.bz * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "reverseengineeringer@hackeradmin.com" ]
reverseengineeringer@hackeradmin.com
66c14f888d4409308d1302ee7bbcd738ffe44c84
29acc5b6a535dfbff7c625f5513871ba55554dd2
/aws-java-sdk-inspector/src/main/java/com/amazonaws/services/inspector/model/DescribeRulesPackageResult.java
a63c4fc2ce3cb25b270d4c0f5bf874d74a4770cf
[ "JSON", "Apache-2.0" ]
permissive
joecastro/aws-sdk-java
b2d25f6a503110d156853836b49390d2889c4177
fdbff1d42a73081035fa7b0f172b9b5c30edf41f
refs/heads/master
2021-01-21T16:52:46.982971
2016-01-11T22:55:28
2016-01-11T22:55:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,608
java
/* * Copyright 2010-2016 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.inspector.model; import java.io.Serializable; /** * */ public class DescribeRulesPackageResult implements Serializable, Cloneable { /** * <p> * Information about the rules package. * </p> */ private RulesPackage rulesPackage; /** * <p> * Information about the rules package. * </p> * * @param rulesPackage * Information about the rules package. */ public void setRulesPackage(RulesPackage rulesPackage) { this.rulesPackage = rulesPackage; } /** * <p> * Information about the rules package. * </p> * * @return Information about the rules package. */ public RulesPackage getRulesPackage() { return this.rulesPackage; } /** * <p> * Information about the rules package. * </p> * * @param rulesPackage * Information about the rules package. * @return Returns a reference to this object so that method calls can be * chained together. */ public DescribeRulesPackageResult withRulesPackage(RulesPackage rulesPackage) { setRulesPackage(rulesPackage); return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getRulesPackage() != null) sb.append("RulesPackage: " + getRulesPackage()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeRulesPackageResult == false) return false; DescribeRulesPackageResult other = (DescribeRulesPackageResult) obj; if (other.getRulesPackage() == null ^ this.getRulesPackage() == null) return false; if (other.getRulesPackage() != null && other.getRulesPackage().equals(this.getRulesPackage()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getRulesPackage() == null) ? 0 : getRulesPackage() .hashCode()); return hashCode; } @Override public DescribeRulesPackageResult clone() { try { return (DescribeRulesPackageResult) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException( "Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }
[ "aws@amazon.com" ]
aws@amazon.com
b55213be24c341c5adf799f2c6ab8e6a1168f542
8dc84558f0058d90dfc4955e905dab1b22d12c08
/third_party/android_tools/sdk/sources/android-25/android/databinding/testapp/FrameLayoutBindingAdapterTest.java
5246f6b5e545507a9cc30f4d81d15ad55a33c9e5
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
meniossin/src
42a95cc6c4a9c71d43d62bc4311224ca1fd61e03
44f73f7e76119e5ab415d4593ac66485e65d700a
refs/heads/master
2022-12-16T20:17:03.747113
2020-09-03T10:43:12
2020-09-03T10:43:12
263,710,168
1
0
BSD-3-Clause
2020-05-13T18:20:09
2020-05-13T18:20:08
null
UTF-8
Java
false
false
1,813
java
/* * Copyright (C) 2015 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.databinding.testapp; import android.databinding.testapp.databinding.FrameLayoutAdapterTestBinding; import android.databinding.testapp.vo.FrameLayoutBindingObject; import android.os.Build; import android.test.UiThreadTest; import android.widget.FrameLayout; public class FrameLayoutBindingAdapterTest extends BindingAdapterTestBase<FrameLayoutAdapterTestBinding, FrameLayoutBindingObject> { FrameLayout mView; public FrameLayoutBindingAdapterTest() { super(FrameLayoutAdapterTestBinding.class, FrameLayoutBindingObject.class, R.layout.frame_layout_adapter_test); } @Override protected void setUp() throws Exception { super.setUp(); mView = mBinder.view; } @UiThreadTest public void testTint() throws Throwable { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { assertEquals(mBindingObject.getForegroundTint(), mView.getForegroundTintList().getDefaultColor()); changeValues(); assertEquals(mBindingObject.getForegroundTint(), mView.getForegroundTintList().getDefaultColor()); } } }
[ "arnaud@geometry.ee" ]
arnaud@geometry.ee
cbca95d828dab79a4248fdbffff694e9e9078067
790040ed9bf5d8133f64f7a6e6cbc7a56f4818b4
/fuente/forseti/sets/JMsjSet.java
93a1baa879e490987e4ac4bd7a3c9f9f97488e50
[]
no_license
njmube/forseti
7f60acf43bb2d240cdce2b59b9f9f42e859f8827
2a7bf7b0460c8837c2bc43b1adea6127a42eb4b1
refs/heads/master
2021-01-11T20:08:03.946857
2016-07-18T19:36:18
2016-07-18T19:36:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,897
java
/* Forseti, El ERP Gratuito para PyMEs Copyright (C) 2015 Gabriel Gutiérrez Fuentes. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ package forseti.sets; import forseti.*; import javax.servlet.http.*; import java.sql.*; public class JMsjSet extends JManejadorSet { public JMsjSet(HttpServletRequest request) { m_Select = " * FROM tbl_msj"; m_PageSize = 50; this.request = request; } public tbl_msj getRow(int row) { return (tbl_msj)m_Rows.elementAt((getFloorRow() + row)); } public tbl_msj getAbsRow(int row) { return (tbl_msj)m_Rows.elementAt(row); } @SuppressWarnings("unchecked") protected void BindRow() { try { tbl_msj pNode = new tbl_msj(); pNode.setAlc(m_RS.getString("Alc")); pNode.setMod(m_RS.getString("Mod")); pNode.setSub(m_RS.getString("Sub")); pNode.setElm(m_RS.getString("Elm")); pNode.setMsj1(m_RS.getString("Msj1")); pNode.setMsj2(m_RS.getString("Msj2")); pNode.setMsj3(m_RS.getString("Msj3")); pNode.setMsj4(m_RS.getString("Msj4")); pNode.setMsj5(m_RS.getString("Msj5")); m_Rows.addElement(pNode); } catch(SQLException e) { e.printStackTrace(); throw new RuntimeException(e.toString()); } } }
[ "g.gutierrez.f@forseti.org.mx" ]
g.gutierrez.f@forseti.org.mx
4cab2003fa27f38851cf48e4d76633ac43dd2508
436c4766c4203563c41df2b0c7b9f49028ac122c
/app/src/main/java/com/example/myapplication/MainActivity.java
d1fbabcaf894a67fba83dfbc5bbf1ac2ac7818b8
[]
no_license
xieyipeng/EnglishPlay
a7d9c2a215010a6c158768ebb9a0cc85756017ed
8bff8f515003669c74d1a53f24a1c53b04728f7f
refs/heads/master
2020-03-18T06:03:45.922003
2018-05-22T07:10:10
2018-05-22T07:10:10
134,374,514
0
0
null
null
null
null
UTF-8
Java
false
false
2,279
java
package com.example.myapplication; import android.Manifest; import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.Camera; import android.support.annotation.NonNull; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.ImageView; import android.widget.Toast; import com.baidu.idl.util.FileUtil; import com.baidu.ocr.sdk.OCR; import com.baidu.ocr.sdk.OnResultListener; import com.baidu.ocr.sdk.exception.OCRError; import com.baidu.ocr.sdk.model.AccessToken; import com.baidu.ocr.sdk.model.GeneralBasicParams; import com.baidu.ocr.sdk.model.GeneralResult; import com.baidu.ocr.sdk.model.WordSimple; import com.baidu.ocr.ui.camera.CameraActivity; import com.simon.permissionlib.core.PermissionHelper; import java.io.File; public class MainActivity extends AppCompatActivity { private ImageView see,read; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); PermissionHelper.with(this).permissions(Manifest.permission.RECORD_AUDIO).requestCode(100).lisener(this).request(); PermissionHelper.with(this).permissions(Manifest.permission.WRITE_EXTERNAL_STORAGE).requestCode(100).lisener(this).request(); PermissionHelper.with(this).permissions(Manifest.permission.CAMERA).requestCode(100).lisener(this).request(); init(); } private void init() { see = findViewById(R.id.see); read = findViewById(R.id.read); /** * 跳转相机界面 */ see.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(MainActivity.this,CameraActivity1.class); startActivity(intent); } }); read.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(MainActivity.this,ReadActivity.class); startActivity(intent); } }); } }
[ "32957035+xieyipeng@users.noreply.github.com" ]
32957035+xieyipeng@users.noreply.github.com
08fb66f74c5970d40606420a52c364fe7658e477
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Math/89/org/apache/commons/math/util/MathUtils_binomialCoefficient_172.java
662d0447701e9d2a69eada68d8045c8324f941c3
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
2,649
java
org apach common math util addit built function link math version revis date math util mathutil return exact represent href http mathworld wolfram binomi coeffici binomialcoeffici html binomi coeffici code choos code number code code element subset select code code element set strong precondit strong code code code illeg argument except illegalargumentexcept code thrown result small fit code code largest code code coeffici code long max code comput exce code long max code code arith metic except arithmeticexcept code thrown param size set param size subset count code choos code illeg argument except illegalargumentexcept precondit met arithmet except arithmeticexcept result larg repres integ binomi coeffici binomialcoeffici illeg argument except illegalargumentexcept binomi coeffici illeg argument except illegalargumentexcept binomi coeffici symmetri larg binomi coeffici binomialcoeffici formula choos choos written choos choos result naiv implement overflow result result result overflow care overflow intermedi valu result divis result overflow split filter gcd integ result divis rel prime divisor result gcd result result result overflow occur check multipl take care overflow unnecessari gcd result mul check mulandcheck result result
[ "hvdthong@gmail.com" ]
hvdthong@gmail.com
c81325f7ef2640b2cff471d0f1d2755a15bd5fee
dfd7e70936b123ee98e8a2d34ef41e4260ec3ade
/analysis/reverse-engineering/decompile-fitts-with-gradle-20191031-2200/src/main/java/com/google/android/gms/internal/firebase-perf/zzhj.java
a984dd366e3d7d745998bbe3980223c982dc8d67
[ "Apache-2.0" ]
permissive
skkuse-adv/2019Fall_team2
2d4f75bc793368faac4ca8a2916b081ad49b7283
3ea84c6be39855f54634a7f9b1093e80893886eb
refs/heads/master
2020-08-07T03:41:11.447376
2019-12-21T04:06:34
2019-12-21T04:06:34
213,271,174
5
5
Apache-2.0
2019-12-12T09:15:32
2019-10-07T01:18:59
Java
UTF-8
Java
false
false
589
java
package com.google.android.gms.internal.firebase-perf; import java.util.Iterator; final class zzhj implements Iterator<String> { private Iterator<String> zzut = this.zzuu.zzus.iterator(); private final /* synthetic */ zzhh zzuu; zzhj(zzhh zzhh) { this.zzuu = zzhh; } public final boolean hasNext() { return this.zzut.hasNext(); } public final void remove() { throw new UnsupportedOperationException(); } public final /* synthetic */ Object next() { return (String) this.zzut.next(); } }
[ "33246398+ajid951125@users.noreply.github.com" ]
33246398+ajid951125@users.noreply.github.com
3fb35f890b18205c4dd7bf410253943bbc1d23c3
3342a8518c2b290c423ff67ed78d154926135e9c
/blog-mover-web/src/main/java/com/redv/blogmover/web/IdentifyingCodeImageServlet.java
870a5bd943d9e455d72b3b1f13a291cc0fa74761
[]
no_license
sutra/blog-mover
126333d14aa1c423f25e6ccadfccdd9753730b22
800b92235574b69e1a3561f1958b8939789fc26d
refs/heads/master
2021-01-17T14:07:27.919143
2019-07-05T12:41:01
2019-07-05T12:41:01
27,595,867
0
0
null
null
null
null
UTF-8
Java
false
false
2,360
java
/** * Created on 2006-6-26 13:02:43 */ package com.redv.blogmover.web; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.redv.blogmover.UserFacade; import com.redv.blogmover.web.dwr.User; /** * @author Joe * @version 1.0 * */ public class IdentifyingCodeImageServlet extends HttpServlet { /** * */ private static final long serialVersionUID = -6310997986394657405L; /* * (non-Javadoc) * * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletResponse) */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String type = request.getParameter("type"); HttpSession session = request.getSession(true); // UserFacade userFacade = (UserFacade) WebUtils // .getOrCreateSessionAttribute(session, // User.SESSION_NAME_USER_FACADE, UserFacadeImpl.class); UserFacade userFacade = User.getUserFacade(this.getServletContext(), session); Object readerOrWriter = null; if (type.equals("reader")) { readerOrWriter = userFacade.getReader(); } else { readerOrWriter = userFacade.getWriter(); } if (readerOrWriter == null) { throw new ServletException("readerOrWriter is null."); } Method m = null; try { m = readerOrWriter.getClass().getMethod("getIdentifyingCodeImage"); } catch (SecurityException e) { throw new ServletException(e); } catch (NoSuchMethodException e) { throw new ServletException(e); } Object o; try { o = m.invoke(readerOrWriter); } catch (IllegalArgumentException e) { throw new ServletException(e); } catch (IllegalAccessException e) { throw new ServletException(e); } catch (InvocationTargetException e) { throw new ServletException(e); } byte[] bytes = (byte[]) o; try { response.addHeader("Cache-Control", "no-cache"); response.addHeader("Expires", "Thu, 01 Jan 1970 00:00:01 GMT"); response.getOutputStream().write(bytes); } catch (IOException e) { throw new ServletException(e); } } }
[ "zhoushuqun@gmail.com" ]
zhoushuqun@gmail.com
f02a70430aae397dd2f86a05a50f3b4fbf07af6e
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/35/35_2a5503d8d4c6cac09b060771f8baa6a8fc0076e9/Buildings/35_2a5503d8d4c6cac09b060771f8baa6a8fc0076e9_Buildings_t.java
30bafb1fa92a48e427015ef49bdcc03eeb4b01e0
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
3,292
java
package spaceappschallenge.moonville.factories; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import org.xmlpull.v1.XmlPullParserException; import spaceappschallenge.moonville.R; import spaceappschallenge.moonville.businessmodels.Building; import spaceappschallenge.moonville.managers.ApplicationService; import spaceappschallenge.moonville.xml_parsers.BuildingXMLParser; import android.content.Context; import android.util.Log; //singleton class public class Buildings { private static Buildings instance; protected static Context context; //a list of all possible buildings private ArrayList<Building> allBuildings; //a list of buildings that the player can build private ArrayList<Building> availableBuildings; protected InputStream inputStream = null; private Buildings() { this.allBuildings = new ArrayList<Building>(); this.availableBuildings = new ArrayList<Building>(); Buildings.context = ApplicationService.getInstance().getApplicationContext(); Log.i("Buildings","initializing all buildings"); //initAllBuildings(); } protected void initAllBuildings() { inputStream = context.getResources().openRawResource(R.raw.buildings); try { BuildingXMLParser xmlParser = new BuildingXMLParser(inputStream); try { Log.i("Buildings","parsing....."); this.allBuildings = xmlParser.parse(); Log.i("Buildings","printing....."); printAllBuildings(); } catch (IOException e) { // TODO Auto-generated catch block Log.e("Buildings","There was problem while parsing the xml file"); //e.printStackTrace(); } } catch (XmlPullParserException e) { // TODO Auto-generated catch block Log.e("Buildings","XMLParser could not be instantiated"); //e.printStackTrace(); } } public void printAllBuildings(){ for(int i=0;i<this.allBuildings.size();i++){ Building building = this.allBuildings.get(i); Log.i("Buildings",building.getName()); ArrayList<Building> buildings = building.getRequiredBuildings(); Log.i("LENGTH","size:"+buildings.size()); for(Building rbuilding: buildings){ Log.i("Buildings rb",rbuilding.getName()); } /* ArrayList<Resource> resources= building.getRequiredResources(); Log.i("LENGTH","reqd resource size:"+resources.size()); for(Resource rResource:resources){ Log.i("Buildings rr",rResource.getName()); } */ Log.i("Buildings","object: "+building); } } public static Buildings getInstance() { //TODO: when loading existing game, this factory should be replaced by the saved one, not create a new one if( Buildings.instance == null ) { Buildings.instance = new Buildings(); } return Buildings.instance; } //returns a building object according to its name public Building getBuilding( String name ) { Building foundBuilding = null; for( Building building : this.allBuildings ) { if( building.getName().equals( name ) ) { foundBuilding = building; break; } } return foundBuilding; } //returns all available buildings public ArrayList<Building> getAllBuildings() { return this.allBuildings; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
b33823f6e974fa29c7bbb92d3fab86546aa37e3a
bb5d9acb1fe05868036e70ec48989cfccb890531
/admin-web/src/main/java/com/jasmine/crawler/web/admin/service/impl/DownSystemSiteDispatchServiceImpl.java
9b8ac867e412bca330cd493e2c2462293420fa71
[]
no_license
anlei-fu/jasmine-crawler
0a46dc0daaa8197471f406be080e90dd2aec333b
af727fa68b651031cf8114bde6dbabc411419842
refs/heads/master
2022-12-28T15:18:47.997474
2020-10-11T12:51:49
2020-10-11T12:51:49
282,859,677
0
0
null
null
null
null
UTF-8
Java
false
false
1,146
java
package com.jasmine.crawler.web.admin.service.impl; import com.jasmine.crawler.common.pojo.entity.DownSystemSiteDispatch; import com.jasmine.crawler.web.admin.mapper.DownSystemSiteDispatchMapper; import com.jasmine.crawler.web.admin.pojo.vo.DownSystemSiteDispatchDetail; import com.jasmine.crawler.web.admin.service.DownSystemSiteDispatchService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class DownSystemSiteDispatchServiceImpl implements DownSystemSiteDispatchService { @Autowired private DownSystemSiteDispatchMapper downSystemSiteDispatchMapper; @Override public List<DownSystemSiteDispatchDetail> getBySourceDownSystemSiteId(Integer sourceDownSystemSiteId) { return downSystemSiteDispatchMapper.getBySourceDownSystemSiteId(sourceDownSystemSiteId); } @Override public boolean add(DownSystemSiteDispatch req) { return downSystemSiteDispatchMapper.add(req)>0; } @Override public boolean delete(Integer id) { return downSystemSiteDispatchMapper.delete(id)>0; } }
[ "767550758@qq.com" ]
767550758@qq.com
591a6ef6593851c759f230bdb4d89b12cf14a334
97ae3bd8ef6640f15d54abb196ef29091c2bbb32
/modules/extension/src/main/java/org/springside/modules/nosql/redis/JedisTemplate.java
8477518a42f9314af532561a1266749c1f96379b
[ "Apache-2.0" ]
permissive
xiaofeng320/springside4
fec7fbb94bf46eceb4f803dea9edef74cf336ac4
4af636d29aabc0dacfcffa86083bb0c35a690d55
refs/heads/master
2021-01-18T01:41:11.180071
2013-07-10T17:44:09
2013-07-10T17:44:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,933
java
package org.springside.modules.nosql.redis; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; import redis.clients.jedis.exceptions.JedisConnectionException; import redis.clients.jedis.exceptions.JedisException; /** * JedisTemplate is the template to execute jedis actions, handle the connection with the pool correctly. */ public class JedisTemplate { private static Logger logger = LoggerFactory.getLogger(JedisTemplate.class); private JedisPool jedisPool; public JedisTemplate(JedisPool jedisPool) { this.jedisPool = jedisPool; } /** * Execute with a call back action with result. */ public <T> T execute(JedisAction<T> jedisAction) throws JedisException { Jedis jedis = null; boolean broken = false; try { jedis = jedisPool.getResource(); return jedisAction.action(jedis); } catch (JedisConnectionException e) { logger.error("Redis connection lost.", e); broken = true; throw e; } finally { closeResource(jedis, broken); } } /** * Execute with a call back action without result. */ public void execute(JedisActionNoResult jedisAction) throws JedisException { Jedis jedis = null; boolean broken = false; try { jedis = jedisPool.getResource(); jedisAction.action(jedis); } catch (JedisConnectionException e) { logger.error("Redis connection lost.", e); broken = true; throw e; } finally { closeResource(jedis, broken); } } /** * Return jedis connection to the pool, call different return methods depends on the conectionBroken status. */ protected void closeResource(Jedis jedis, boolean connectionBroken) { if (jedis != null) { if (connectionBroken) { jedisPool.returnBrokenResource(jedis); } else { jedisPool.returnResource(jedis); } } } /** * Get the internal JedisPool. */ public JedisPool getJedisPool() { return jedisPool; } /** * Callback interface for template method. */ public interface JedisAction<T> { T action(Jedis jedis); } /** * Callback interface for template method without result. */ public interface JedisActionNoResult { void action(Jedis jedis); } // ////////////// 常用方法的封装 ///////////////////////// // // ////////////// Key ///////////////////////// // public Long del(final String key) { return execute(new JedisAction<Long>() { @Override public Long action(Jedis jedis) { return jedis.del(key); } }); } public void flushDB() { execute(new JedisActionNoResult() { @Override public void action(Jedis jedis) { jedis.flushDB(); } }); } // ////////////// String ///////////////////////// // public <T> T get(final String key) { return execute(new JedisAction<T>() { @Override public T action(Jedis jedis) { return (T) jedis.get(key); } }); } public void set(final String key, final String value) { execute(new JedisActionNoResult() { @Override public void action(Jedis jedis) { jedis.set(key, value); } }); } public Long incr(final String key) { return execute(new JedisAction<Long>() { @Override public Long action(Jedis jedis) { return jedis.incr(key); } }); } public Long decr(final String key) { return execute(new JedisAction<Long>() { @Override public Long action(Jedis jedis) { return jedis.decr(key); } }); } // ////////////// List ///////////////////////// // public void lpush(final String key, final String value) { execute(new JedisActionNoResult() { @Override public void action(Jedis jedis) { jedis.lpush(key, value); } }); } // ////////////// Sorted Set ///////////////////////// // public void zadd(final String key, final double score, final String value) { execute(new JedisActionNoResult() { @Override public void action(Jedis jedis) { jedis.zadd(key, score, value); } }); } }
[ "calvinxiu@gmail.com" ]
calvinxiu@gmail.com
2d1b6305c09123c83dbe723c3e79b4a28e1ae42f
8be5a1abeda189ec68b1903df72e28ad386bcfa9
/adfs-hdfs-project/adfs-hdfs/src/main/java/com/taobao/adfs/distributed/editlogger/DistributedEditLogger.java
97d83a2068286f237cd89edaddf6aa5598170e87
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
paulzhu8597/ADFS
994084d17f351176281e2e9fa8fe4e9a2b1f01f2
a52a3b070e3d9f7ff5a06e03408c7f01e9bde678
refs/heads/master
2020-03-19T07:32:21.438470
2012-06-26T09:06:01
2012-06-26T09:15:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,209
java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.taobao.adfs.distributed.editlogger; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.concurrent.Executors; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import org.apache.hadoop.conf.Configuration; import org.apache.log4j.Level; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.taobao.adfs.distributed.metrics.DistributedMetrics; import com.taobao.adfs.distributed.rpc.RPC.Invocation; import com.taobao.adfs.util.Utilities; /** * @author <a href=mailto:zhangwei.yangjie@gmail.com/jiwan@taobao.com>zhangwei/jiwan</a> */ public abstract class DistributedEditLogger { public static final Logger logger = LoggerFactory.getLogger(DistributedEditLogger.class); Configuration conf = null; Object data = null; Method invokeMethod = null; public AtomicBoolean failToApply = new AtomicBoolean(false); ThreadPoolExecutor applyThreadPoolExecutor = null; AtomicInteger workSizeInProgressAndInQueue = new AtomicInteger(0); AtomicBoolean pauseToApply = new AtomicBoolean(false); AtomicBoolean isClosing = new AtomicBoolean(false); public static DistributedEditLogger getDistributedEditLogger(Configuration conf, Object data) throws IOException { try { conf = (conf == null) ? new Configuration(false) : conf; Class<?> editLoggerClass = conf.getClass("distributed.edit.log.class.name", DistributedEditLoggerInMemory.class); Constructor<?> constructor = editLoggerClass.getConstructor(Configuration.class, Object.class); return (DistributedEditLogger) constructor.newInstance(conf, data); } catch (Throwable t) { throw new IOException(t); } } DistributedEditLogger(Configuration conf, Object data) { if (data == null) throw new IllegalArgumentException("data is null"); this.conf = (conf == null) ? new Configuration(false) : conf; this.data = data; try { invokeMethod = Invocation.getMethod(data.getClass(), "invoke", Invocation.class); } catch (Throwable t) { Utilities.logInfo(logger, "no invoke method found in ", data.getClass().getName(), ", will call directly"); } open(); } public boolean isEmpty() { return getWorkSizeInProgressAndInQueue() == 0; } public int getWorkSizeInProgressAndInQueue() { return workSizeInProgressAndInQueue.get(); } public int append(Invocation invocation) throws IOException { appendInternal(invocation); return workSizeInProgressAndInQueue.incrementAndGet(); } public void apply(Invocation invocation) { try { Utilities.waitValue(pauseToApply, false, null, false); if (invocation == null) throw new IOException("invocation is null"); if (invokeMethod == null) invocation.invoke(data); else { long startTime = System.currentTimeMillis(); invocation.setResult(invokeMethod.invoke(data, invocation)); invocation.setElapsedTime(System.currentTimeMillis() - startTime); } DistributedMetrics.timeVaryingRateInc("dataInvokeByEditLogger." + invocation.getMethodName(), invocation .getElapsedTime()); Utilities .logDebug(logger, "succeed in applying 1/", getWorkSizeInProgressAndInQueue(), " edit log: ", invocation); } catch (Throwable t) { failToApply.set(true); Utilities.log(logger, (t instanceof InterruptedException && isClosing.get()) ? Level.DEBUG : Level.ERROR, "fail to apply edit log: ", invocation, t); } finally { workSizeInProgressAndInQueue.getAndDecrement(); ThreadPoolExecutor oldThreadPoolExecutor = applyThreadPoolExecutor; if (applyThreadPoolExecutor != null) { DistributedMetrics.intValueaSet("dataInvokeByEditLogger.workSizeInProgress", oldThreadPoolExecutor .getActiveCount()); DistributedMetrics.intValueaSet("dataInvokeByEditLogger.workSizeInQueue", oldThreadPoolExecutor.getQueue() .size()); } } } abstract public void appendInternal(Invocation invocation) throws IOException; public void open() { close(true); workSizeInProgressAndInQueue = new AtomicInteger(0); Utilities.logInfo(logger, "opening edit log with ", getWorkSizeInProgressAndInQueue(), " logs"); failToApply = new AtomicBoolean(false); int rpcHandlerNumber = conf.getInt("distributed.server.handler.number", 100); applyThreadPoolExecutor = (ThreadPoolExecutor) Executors.newFixedThreadPool(rpcHandlerNumber); Utilities.logInfo(logger, "opened edit log with ", getWorkSizeInProgressAndInQueue(), " logs"); } public void close(boolean shutdownNow) { isClosing.set(true); int remainingEditLogNumber = getWorkSizeInProgressAndInQueue(); Utilities.logInfo(logger, "closing edit log with ", remainingEditLogNumber, " logs"); if (applyThreadPoolExecutor != null) { if (shutdownNow) applyThreadPoolExecutor.shutdownNow(); else applyThreadPoolExecutor.shutdown(); while (applyThreadPoolExecutor.getActiveCount() > 0) { Utilities.sleepAndProcessInterruptedException(10, logger); } applyThreadPoolExecutor = null; } Utilities.logInfo(logger, "closed edit log with ", remainingEditLogNumber, " logs"); workSizeInProgressAndInQueue.set(0); isClosing.set(false); } public void clear() { open(); } public void pauseApply() { Utilities.logInfo(logger, "pausing applying with ", getWorkSizeInProgressAndInQueue(), " logs"); pauseToApply.set(true); Utilities.logInfo(logger, "paused applying with ", getWorkSizeInProgressAndInQueue(), " logs"); } public void resumeApply() { Utilities.logInfo(logger, "resuming applying with ", getWorkSizeInProgressAndInQueue(), " logs"); pauseToApply.set(false); Utilities.logInfo(logger, "resumed applying with ", getWorkSizeInProgressAndInQueue(), " logs"); } public void waitUntilWorkSizeIsEmpty() { int remainingEditLogNumber = getWorkSizeInProgressAndInQueue(); if (remainingEditLogNumber > 0) Utilities.logInfo(logger, "waiting ", remainingEditLogNumber, " logs"); while (!isEmpty()) { Utilities.sleepAndProcessInterruptedException(10, logger); } if (remainingEditLogNumber > 0) Utilities.logInfo(logger, "waited ", remainingEditLogNumber, " logs"); } }
[ "jiwan@taobao.com" ]
jiwan@taobao.com
d22c4e3522a00573642c1e27c09bb0b4e964ee56
e5544850b20df1fe08c87c7bdec9388b6888cf9a
/1.8/src/main/java/com/mrcrayfish/furniture/tileentity/TileEntityStereo.java
df069a4314c90825b064ccd06723e2e85fcf36cc
[ "BSD-3-Clause" ]
permissive
vampirebordello/MrCrayfishFurnitureMod
b0f6eeb939f3901741ab6dac9fc4d783a98de0f9
3660f6568cb0b7b00d481958590c8b4afb7f37aa
refs/heads/master
2021-01-18T00:53:29.718394
2016-05-03T01:35:27
2016-05-03T01:35:27
57,925,661
0
0
null
2016-05-02T22:38:55
2016-05-02T22:38:55
null
UTF-8
Java
false
false
2,126
java
/** * MrCrayfish's Furniture Mod * Copyright (C) 2016 MrCrayfish (http://www.mrcrayfish.com/) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.mrcrayfish.furniture.tileentity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; public class TileEntityStereo extends TileEntity { private ItemStack record; public int count; @Override public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); if (par1NBTTagCompound.hasKey("RecordItem")) { this.setRecord(ItemStack.loadItemStackFromNBT(par1NBTTagCompound.getCompoundTag("RecordItem"))); } else if (par1NBTTagCompound.getInteger("Record") > 0) { this.setRecord(new ItemStack(Item.getItemById(par1NBTTagCompound.getInteger("Record")), 1, 0)); } this.count = par1NBTTagCompound.getInteger("count"); } @Override public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); if (this.getRecordStack() != null) { par1NBTTagCompound.setTag("RecordItem", this.getRecordStack().writeToNBT(new NBTTagCompound())); par1NBTTagCompound.setInteger("Record", Item.getIdFromItem(this.getRecordStack().getItem())); } par1NBTTagCompound.setInteger("count", count); } public ItemStack getRecordStack() { return this.record; } public void setRecord(ItemStack par1ItemStack) { this.record = par1ItemStack; this.markDirty(); } }
[ "mrcrayfish@hotmail.com" ]
mrcrayfish@hotmail.com
64756bafca17f9f97d7cd977a9280a3312fedd92
7f3f9be71479f48b6dbc75f8180f4540f590a48d
/src/main/java/com/eduspace/util/ResponseCache.java
7f9c5c309b9580d0769f0cbf3e06509ad3a828fd
[]
no_license
hechenwe/uutool
d721521f9c1b87de79633230f45ddcf49c2fb6c2
b8e66f22d3d89ba9d43d3445641aa6dcf227af58
refs/heads/master
2021-01-17T14:51:22.941572
2016-08-08T09:14:43
2016-08-08T09:14:43
55,034,318
0
0
null
null
null
null
UTF-8
Java
false
false
961
java
package com.eduspace.util; import java.util.HashMap; import java.util.Map; /** * 接口返回参数 缓存 * * @author pc * */ public class ResponseCache { private static Map<String, UnResponse> cache = new HashMap<String, UnResponse>(); static { PropertiesUtil pu = new PropertiesUtil(PathUtil.getClassPath()+"response.properties"); Map<String,String> map = pu.getKeyAndValue(); for (Map.Entry<String, String> entry : map.entrySet()) { String code = entry.getKey(); String value = entry.getValue(); String[] values = value.split("-->") ; String httpCode = values[0]; String message = values[1]; UnResponse ur = new UnResponse(); ur.setCode(code); ur.setHttpCode(httpCode); ur.setMessage(message); cache.put(code,ur); } } public static Map<String, UnResponse> getCache() { return cache; } }
[ "hechen@e-eduspace.com" ]
hechen@e-eduspace.com
8a0ed0fa4cd31392daefa5c55fce0d702a2eaa69
0af8b92686a58eb0b64e319b22411432aca7a8f3
/large-multiproject/project33/src/test/java/org/gradle/test/performance33_4/Test33_390.java
f6be104fa3252941d2aa0237f4986a0b0113e29d
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
292
java
package org.gradle.test.performance33_4; import static org.junit.Assert.*; public class Test33_390 { private final Production33_390 production = new Production33_390("value"); @org.junit.Test public void test() { assertEquals(production.getProperty(), "value"); } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
f80eec24b65b032d55886ceb2cf9c1776a768ac7
6baf1fe00541560788e78de5244ae17a7a2b375a
/hollywood/com.oculus.unifiedtelemetry-UnifiedTelemetry/sources/X/W0.java
ef7f33aecaa2cd2c331306c4aef4d68eeae28676
[]
no_license
phwd/quest-tracker
286e605644fc05f00f4904e51f73d77444a78003
3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba
refs/heads/main
2023-03-29T20:33:10.959529
2021-04-10T22:14:11
2021-04-10T22:14:11
357,185,040
4
2
null
2021-04-12T12:28:09
2021-04-12T12:28:08
null
UTF-8
Java
false
false
220
java
package X; public final class W0 extends Id<int[]> { /* Return type fixed from 'java.lang.Object' to match base method */ @Override // X.Id public final int[] A01(int i) { return new int[i]; } }
[ "cyuubiapps@gmail.com" ]
cyuubiapps@gmail.com
fbc623fdcd9df6d7a36cd8bcd67703bd4baa378b
3eeedbb4be937315a10dd272892e4da36cae9c55
/dbus-commons/src/main/java/com/creditease/dbus/commons/SupportedJsonLogDataType.java
1c0a656b186736f971750b4cc9f65d6d734a8282
[ "Apache-2.0" ]
permissive
lnnlab/DBus
35c9a6448b8403d1a990d5521af4402789723ec0
4c8ec8c25d3ff5d762975d4d23959271c3b07deb
refs/heads/master
2020-04-27T05:18:25.098429
2019-06-12T01:24:03
2019-06-12T01:24:03
174,077,772
0
0
Apache-2.0
2019-06-12T01:24:04
2019-03-06T05:29:20
Java
UTF-8
Java
false
false
1,961
java
/*- * << * DBus * == * Copyright (C) 2016 - 2018 Bridata * == * 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.creditease.dbus.commons; import java.util.HashMap; import java.util.Map; public enum SupportedJsonLogDataType { LONG, DOUBLE, VARCHAR; //BOOL、BOOLEAN在mysql中表示的数据类型都为TINYINT private static Map<String, com.creditease.dbus.commons.SupportedJsonLogDataType> map; static { map = new HashMap<>(); for (com.creditease.dbus.commons.SupportedJsonLogDataType type : com.creditease.dbus.commons.SupportedJsonLogDataType.values()) { map.put(type.name().toUpperCase(), type); } } public static boolean isSupported(String type) { boolean supported = map.containsKey(type); if (supported) return true; return false; } public static com.creditease.dbus.commons.SupportedJsonLogDataType parse(String type) { return map.get(type.toUpperCase()); } /** * 判断是否为字符类型 * @param type 类型名称 * @return */ public static boolean isCharacterType(String type) { com.creditease.dbus.commons.SupportedJsonLogDataType dataType = parse(type); if (dataType == null) return false; switch (dataType) { case VARCHAR: return true; default: return false; } } }
[ "dongwang47@creditease.cn" ]
dongwang47@creditease.cn
951d720cf711f2c3f6186b0fc15e634287ee97c5
cfbc0269503b87800eb73952c99f02a95ee00b16
/app/src/main/java/com/lockstudio/sticklocker/util/MediaPlayerUtils.java
f20e305e8271c85371c37650458e329315098ca2
[]
no_license
jv-lee/DaMaoKApp
df15f817c3be1668187ada40f9247e4c0b804caa
514d0b0abbd719b73ddbc6391316b58701f929e3
refs/heads/master
2020-04-02T16:10:08.325393
2018-10-26T03:50:28
2018-10-26T03:50:28
154,601,207
1
0
null
null
null
null
UTF-8
Java
false
false
1,411
java
package com.lockstudio.sticklocker.util; import android.content.Context; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import java.io.File; public class MediaPlayerUtils { public static void play(Context mContext, String mediaPath) { AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); if (AudioManager.RINGER_MODE_SILENT == audioManager.getRingerMode() || AudioManager.RINGER_MODE_VIBRATE == audioManager.getRingerMode()) { return; } if (new File(mediaPath).exists()) { try { MediaPlayer mediaPlayer = MediaPlayer.create(mContext, Uri.parse(mediaPath)); play(mContext, mediaPlayer); } catch (Exception e) { e.printStackTrace(); } } } public static void play(Context mContext, int mediaRes) { AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); if (AudioManager.RINGER_MODE_SILENT == audioManager.getRingerMode() || AudioManager.RINGER_MODE_VIBRATE == audioManager.getRingerMode()) { return; } try { MediaPlayer mediaPlayer = MediaPlayer.create(mContext, mediaRes); play(mContext, mediaPlayer); } catch (Exception e) { e.printStackTrace(); } } public static void play(Context mContext, MediaPlayer mediaPlayer) { if (mediaPlayer != null) { mediaPlayer.setVolume(0.5f, 0.5f); mediaPlayer.start(); } } }
[ "jv.lee@foxmail.com" ]
jv.lee@foxmail.com
990306231e44683fe9666b9b7626a45b5f23b4f8
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_40b9384ec89513607bdeb6562e6cf84a8699b88c/Graph/2_40b9384ec89513607bdeb6562e6cf84a8699b88c_Graph_t.java
e2caa4505b000ef0dba0fc86f33cb58f5e8b9ee5
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
3,917
java
package uk.ac.gla.dcs.tp3.w.algorithm; import java.util.LinkedList; import uk.ac.gla.dcs.tp3.w.league.League; import uk.ac.gla.dcs.tp3.w.league.Team; public class Graph { private Vertex[] vertices; private int[][] matrix; private Vertex source; private Vertex sink; public Graph() { this(null, null); } public Graph(League l, Team t) { if (l == null || t == null) return; // Number of team nodes is one less than total number of teams. // The team nodes do not include the team being tested for elimination. int teamTotal = l.getTeams().length; // The r-combination of teamTotal for length 2 is the number of possible // combinations for matches between the list of Teams-{t}. int gameTotal = comb(teamTotal - 1, 2); // Total number of vertices is the number of teams-1 + number of match // pairs + source + sink. vertices = new Vertex[teamTotal + gameTotal + 1]; // Set first vertex to be source, and last vertex to be sink. // Create blank vertices for source and sink. source = new Vertex(0); sink = new Vertex(vertices.length - 1); vertices[0] = source; vertices[vertices.length - 1] = sink; // Create vertices for each team node, and make them adjacent to // the sink. Team[] teams = l.getTeams(); int pos = vertices.length - 2; for (int i = 0; i < teams.length; i++) { if (teams[i] != t) { vertices[pos] = new TeamVertex(teams[i], i); vertices[pos].getAdjList().add( new AdjListNode(0, vertices[vertices.length - 1])); pos--; } } // Create vertex for each team pair and make it adjacent from the // source. // TODO Also make the team pairs adjacent to the relevant Teams pos = 1; for (int i = 0; i < teamTotal + 1; i++) { if (teams[i] == t) continue; for (int j = 1; j < teamTotal; j++) { if (teams[j] == t) continue; vertices[pos] = new PairVertex(teams[i], teams[j], pos); vertices[0].getAdjList().add(new AdjListNode(0, vertices[pos])); pos++; } } // TODO Iterate over every match, if the match hasn't been played and // doesn't involve the Team t, increment the appropriate capacity of the // edges. // TODO Create the adjacency matrix representation of the graph. } public Vertex[] getV() { return vertices; } public void setV(Vertex[] v) { this.vertices = v; } public int[][] getMatrix() { return matrix; } public int getSize() { return vertices.length; } public void setMatrix(int[][] matrix) { this.matrix = matrix; } public Vertex getSource() { return source; } public void setSource(Vertex source) { this.source = source; } public Vertex getSink() { return sink; } public void setSink(Vertex sink) { this.sink = sink; } private static int fact(int s) { // For s < 2, the factorial is 1. Otherwise, multiply s by fact(s-1) return (s < 2) ? 1 : s * fact(s - 1); } private static int comb(int n, int r) { // r-combination of size n is n!/r!(n-r)! return (fact(n) / (fact(r) * fact(n - r))); } /** * carry out a breadth first search/traversal of the graph */ public void bfs() { // TODO Read over this code, I (GR) just dropped this in here from // bfs-example. for (Vertex v : vertices) v.setVisited(false); LinkedList<Vertex> queue = new LinkedList<Vertex>(); for (Vertex v : vertices) { if (!v.getVisited()) { v.setVisited(true); v.setPredecessor(v.getIndex()); queue.add(v); while (!queue.isEmpty()) { Vertex u = queue.removeFirst(); LinkedList<AdjListNode> list = u.getAdjList(); for (AdjListNode node : list) { Vertex w = node.getVertex(); if (!w.getVisited()) { w.setVisited(true); w.setPredecessor(u.getIndex()); queue.add(w); } } } } } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
bbee33fcce2aa66d4a2785c98255afaae010b5b8
e51c210ccf72a8ac1414791d8af552662c3fb034
/passerelle-eclipse-workbench/com.isencia.passerelle.workbench.model.editor.ui/src/main/java/com/isencia/passerelle/workbench/model/editor/ui/editor/actions/CommitFlowAction.java
c64d435383d2ad5dda7ff017081b46389f9cd5c7
[]
no_license
eclipselabs/passerelle
0187efa4fba411265ab58d60b5d83e74af09b203
e327dea8f4188e4bfe5ef4a76dd2476ad6f5664d
refs/heads/master
2021-01-18T09:26:07.614275
2017-06-28T10:05:12
2017-06-28T10:05:12
36,805,342
5
3
null
2015-08-04T18:43:19
2015-06-03T13:27:15
Java
UTF-8
Java
false
false
2,373
java
package com.isencia.passerelle.workbench.model.editor.ui.editor.actions; import org.eclipse.gef.ui.actions.SelectionAction; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.actions.ActionFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ptolemy.kernel.Entity; import com.isencia.passerelle.model.Flow; import com.isencia.passerelle.workbench.model.editor.ui.Activator; import com.isencia.passerelle.workbench.model.editor.ui.editor.PasserelleModelMultiPageEditor; import com.isencia.passerelle.workbench.model.ui.wizards.NameChecker; public class CommitFlowAction extends SelectionAction implements NameChecker { private static final Logger logger = LoggerFactory .getLogger(CommitFlowAction.class); public static String ID = "CommitFlowAction"; private PasserelleModelMultiPageEditor parent; private final String icon = "icons/export.gif"; public static String CREATE_SUBMODEL = "createSubModel"; /** * Creates an empty model * * @param part */ public CommitFlowAction() { this(null, null); setId(ID); } /** * Creates an empty model * * @param part */ public CommitFlowAction(final IEditorPart part) { this(part, null); setId(ID); } /** * Creates the model from the contents of the part * * @param part * @param parent */ public CommitFlowAction(final IEditorPart part, final PasserelleModelMultiPageEditor parent) { super(part); this.parent = parent; setLazyEnablementCalculation(true); if (parent != null) setId(ID); } @Override protected void init() { super.init(); Activator.getImageDescriptor(icon); setHoverImageDescriptor(Activator.getImageDescriptor(icon)); setImageDescriptor(Activator.getImageDescriptor(icon)); setDisabledImageDescriptor(Activator.getImageDescriptor(icon)); setEnabled(false); } @Override public void run() { try { if (parent != null) { final Entity entity = parent.getSelectedContainer(); Flow flow = (Flow) entity.toplevel(); Activator.getDefault().getRepositoryService() .commitFlow(flow, "from workbench"); } } catch (Exception e) { logger.error("Cannot commit flow", e); } } public boolean isNameValid(String name) { return true; } public String getErrorMessage(String name) { return null; } @Override protected boolean calculateEnabled() { return true; } }
[ "erwindl0@gmail.com" ]
erwindl0@gmail.com
5fe2d8714c037ada0abd54ffb4024cf2c8f23690
79146d7479dea9d466e5a21c77b81cc1ec99ba77
/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVfModuleResponse.java
2395495a36623aa87b87c7ef42bd58cec0dd7f91
[ "Apache-2.0", "CC-BY-4.0" ]
permissive
onapdemo/so
b0d61b302fbac4a5c57ebfc0746fec0d6f375b0e
494af587df06635820cf184edc7a4cc453b97529
refs/heads/master
2020-03-17T20:41:00.090762
2018-05-18T08:20:53
2018-05-18T08:20:53
133,923,600
0
0
null
null
null
null
UTF-8
Java
false
false
3,130
java
/*- * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= */ package org.openecomp.mso.adapters.vnfrest; import org.openecomp.mso.logger.MsoLogger; import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; import org.codehaus.jackson.map.ObjectMapper; import org.jboss.resteasy.annotations.providers.NoJackson; import org.openecomp.mso.openstack.beans.VnfStatus; @XmlRootElement(name = "queryVfModuleResponse") @NoJackson public class QueryVfModuleResponse { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); private String vnfId; private String vfModuleId; private String vfModuleStackId; private VnfStatus vnfStatus; private Map<String,String> vfModuleOutputs; public QueryVfModuleResponse() { super(); } public QueryVfModuleResponse(String vnfId, String vfModuleId, String vfModuleStackId, VnfStatus vnfStatus, Map<String, String> vfModuleOutputs) { super(); this.vnfId = vnfId; this.vfModuleId = vfModuleId; this.vfModuleStackId = vfModuleStackId; this.vnfStatus = vnfStatus; this.vfModuleOutputs = vfModuleOutputs; } public String getVnfId() { return vnfId; } public void setVnfId(String vnfId) { this.vnfId = vnfId; } public String getVfModuleId() { return vfModuleId; } public void setVfModuleId(String vfModuleId) { this.vfModuleId = vfModuleId; } public String getVfModuleStackId() { return vfModuleStackId; } public void setVfModuleStackId(String vfModuleStackId) { this.vfModuleStackId = vfModuleStackId; } public VnfStatus getVnfStatus() { return vnfStatus; } public void setVnfStatus(VnfStatus vnfStatus) { this.vnfStatus = vnfStatus; } public Map<String, String> getVfModuleOutputs() { return vfModuleOutputs; } public void setVfModuleOutputs(Map<String, String> vfModuleOutputs) { this.vfModuleOutputs = vfModuleOutputs; } public String toJsonString() { String jsonString = null; try { ObjectMapper mapper = new ObjectMapper(); jsonString = mapper.writeValueAsString(this); } catch (Exception e) { LOGGER.debug("Exception :",e); } return jsonString; } }
[ "Sudhakar.reddy@amdocs.com" ]
Sudhakar.reddy@amdocs.com
501f0b0ad7ff31e9b15f56c32bbe3ab16d343ac0
808032fc80d529e85d6a641919607ad7adbfcf25
/src/main/java/org/rta/citizen/common/enums/KeyType.java
741cefa220c1d9921c7eb58b13560a0a24cf8e94
[]
no_license
VinayAddank/license
7d7579d10b6c4aebd7bb358b85211d00ab79d70f
4391e25592e399596037757f6c82e1b20e49a9a8
refs/heads/master
2021-01-25T11:33:51.973562
2018-03-01T09:09:00
2018-03-01T09:09:00
123,410,184
0
0
null
null
null
null
UTF-8
Java
false
false
303
java
package org.rta.citizen.common.enums; public enum KeyType { PR, TR, SERVICE, LLR, LLE, LLF, LLD, DLF, DLE, DLRE , DLCA, DLB, DLR, DLD, DLS, DLC, DLSC, DLEX, DLIN, DLI, DLM, DLFC, DLOS, TOKEN, USERREG }
[ "vinay.addanki540@gmail.com" ]
vinay.addanki540@gmail.com
b1109d3ec2da6871a248fe9f3191ab22756c03b7
d02d8c818c467c4d66fb32ad78da4abb6d96a5df
/clients/custom-swagger-codegen/impl/src/main/java/com/okta/example/sdk/impl/http/QueryString.java
b1a6d3c681d7289a1c71c2820317d74ce0d6e029
[ "Apache-2.0" ]
permissive
bdemers/generated-code-example
4d33aaeda69e13aa4f59347c90035047d10c2ecc
5c67a0b616f1cc299543e3e7eb70bbcf3d68d6d0
refs/heads/master
2021-04-30T09:38:52.835042
2019-01-18T15:25:07
2019-01-18T15:25:07
121,313,893
0
0
null
null
null
null
UTF-8
Java
false
false
4,365
java
/* * Copyright 2014 Stormpath, Inc. * Modifications Copyright 2018 Okta, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.okta.example.sdk.impl.http; import com.okta.example.sdk.impl.util.RequestUtils; import com.okta.example.sdk.impl.util.RequestUtils; import com.okta.example.sdk.lang.Collections; import com.okta.example.sdk.lang.Strings; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.Map; import java.util.TreeMap; /** * @since 0.5.0 */ public class QueryString extends TreeMap<String,String> { private static final long serialVersionUID = 42L; public QueryString(){} public QueryString(Map<String,?> source) { super(); if (!Collections.isEmpty(source)) { for(Map.Entry<String,?> entry : source.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); String sValue = value != null ? String.valueOf(value) : null; put(key, sValue); } } } public String put(String key, Object value) { if (value != null) { return super.put(key, value.toString()); } return null; } public String toString() { return toString(false); } /** * The canonicalized query string is formed by first sorting all the query * string parameters, then URI encoding both the key and value and then * joining them, in order, separating key value pairs with an '&amp;'. * * @param canonical whether or not the string should be canonicalized * @return the canonical query string */ public String toString(boolean canonical) { if (isEmpty()) { return ""; } StringBuilder sb = new StringBuilder(); for (Map.Entry<String,String> entry : entrySet()) { String key = RequestUtils.encodeUrl(entry.getKey(), false, canonical); String value = RequestUtils.encodeUrl(entry.getValue(), false, canonical); if (sb.length() > 0) { sb.append('&'); } sb.append(key).append("=").append(value); } return sb.toString(); } public static QueryString create(String query) { if (!Strings.hasLength(query)) { return null; } QueryString queryString = new QueryString(); // only returns null if string is null String[] tokens = Strings.tokenizeToStringArray(query, "&", false, false); for( String token : tokens) { applyKeyValuePair(queryString, token); } return queryString; } private static void applyKeyValuePair(QueryString qs, String kv) { String[] pair = Strings.split(kv, "="); if (pair != null) { String key = pair[0]; String value = pair[1] != null ? pair[1] : ""; try { qs.put(URLDecoder.decode(key, "UTF-8"), URLDecoder.decode(value, "UTF-8")); } catch (UnsupportedEncodingException e) { // should never happen qs.put(key, value); } } else { //no equals sign, it's just a key: qs.put(kv, null); } } /** * Build an href with query string. Only appends it queryArgs is NOT empty. * @param href URL path * @param qs query string to append to href * @return href + query string if query string is NOT empty, otherwise, just returns the href */ public static String buildHref(String href, QueryString qs) { StringBuilder sb = new StringBuilder(href); String query = qs.toString(); if (!Strings.isEmpty(query)) { sb.append('?').append(query); } return sb.toString(); } }
[ "bdemers@apache.org" ]
bdemers@apache.org
2074e059d9a5c613169a8785d50179a6166d0451
632247c51835765953ad44767f6378a34770b9bb
/src/main/java/com/example/demo/DesignPattern/GOFJava/abstractFactory/example2/ExepnsiveGPS.java
a0de1722e2b8ccf597fb4ba3d3813aa0378a7bdb
[]
no_license
rheehot/java-workspace
eae06b6ca75689c463829421ef2f737bde800994
af1e118558998fdd1eab7856126b460ed8611a5b
refs/heads/master
2022-12-25T20:59:52.849222
2020-09-29T08:56:55
2020-09-29T08:56:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
325
java
package com.example.demo.DesignPattern.GOFJava.abstractFactory.example2; /** * @author Geonguk Han * @since 2020-09-02 */ public class ExepnsiveGPS extends GPS { @Override public Location findCurrentLocation() { System.out.println("find current location with Expensive GPS"); return null; } }
[ "umanking@gmail.com" ]
umanking@gmail.com
f758229ab310ec4fcb6aaf1799dcb405f897d4f8
eb8bc68b5c716ec884fe7db0cd7b73f8ee545788
/src/williamsNotebook/easy/conversion/RestoreIpAddress.java
a3533dab500bc2ac343fc4cac706f427a36f87c4
[]
no_license
yimin12/Algorithm
af5e3fe1ded5e27627e6032d4599987a893698ee
72df21866f2444c7da9b623dbbc3eb74c53118c4
refs/heads/master
2020-08-27T00:19:02.088475
2020-04-30T19:52:43
2020-04-30T19:52:43
217,191,862
2
0
null
2020-04-30T19:52:44
2019-10-24T02:11:44
Java
UTF-8
Java
false
false
1,588
java
/** * */ package williamsNotebook.easy.conversion; import java.util.ArrayList; import java.util.List; /** * @author yimin Huang * * Given a string containing only digits, restore it by returning all possible valid IP address combinations. * For example: * Given "25525511135", * return ["255.255.11.135", "255.255.111.35"]. (Order does not matter) * * Algorithm Class */ public class RestoreIpAddress { // DFS: Time ~ O(N^4), Space ~ O(N) public List<String> restoreIpAddress(String s){ List<String> list = new ArrayList<String>(); dfs(s, 0, new StringBuilder(), list); return list; } private void dfs(String s, int numPt, StringBuilder path, List<String> list) { if (numPt == 3) { System.out.println(s); if (isValid(s)) list.add(path.toString() + s); } else { int len = path.length(); for (int i = 1; i <= 3 && i <= s.length(); i++) { String num = s.substring(0, i); if (isValid(num)) dfs(s.substring(i), numPt + 1, path.append(num).append('.'), list); path.delete(len, path.length()); } } } private boolean isValid(String s) { if(s.length() == 1 || s.length() >= 1 && s.length() <= 3 && !s.startsWith("0")) { int num = Integer.parseInt(s); if(num >= 0 && num <= 255) return true; } return false; } public static void main(String[] args) { RestoreIpAddress solution = new RestoreIpAddress(); List<String> restoreIpAddress = solution.restoreIpAddress("25525511135"); System.out.println(restoreIpAddress.toString()); } }
[ "hymlaucs@gmail.com" ]
hymlaucs@gmail.com
a50b4a28e761c84cce3ca305d800852590fb85e9
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/java/hibernate-orm/2015/8/NonTxInvalidationInterceptor.java
2e1a686a50b306aaccaa2df23ffa80e30ff2ae98
[]
no_license
rosoareslv/SED99
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
a062c118f12b93172e31e8ca115ce3f871b64461
refs/heads/main
2023-02-22T21:59:02.703005
2021-01-28T19:40:51
2021-01-28T19:40:51
306,497,459
1
1
null
2020-11-24T20:56:18
2020-10-23T01:18:07
null
UTF-8
Java
false
false
7,050
java
/* * Hibernate, Relational Persistence for Idiomatic Java * * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. */ package org.hibernate.cache.infinispan.access; import org.hibernate.cache.infinispan.util.CacheCommandInitializer; import org.infinispan.commands.CommandsFactory; import org.infinispan.commands.FlagAffectedCommand; import org.infinispan.commands.write.ClearCommand; import org.infinispan.commands.write.InvalidateCommand; import org.infinispan.commands.write.PutKeyValueCommand; import org.infinispan.commands.write.PutMapCommand; import org.infinispan.commands.write.RemoveCommand; import org.infinispan.commands.write.ReplaceCommand; import org.infinispan.commands.write.WriteCommand; import org.infinispan.commons.util.InfinispanCollections; import org.infinispan.context.Flag; import org.infinispan.context.InvocationContext; import org.infinispan.factories.annotations.Inject; import org.infinispan.factories.annotations.Start; import org.infinispan.interceptors.InvalidationInterceptor; import org.infinispan.interceptors.base.BaseRpcInterceptor; import org.infinispan.jmx.JmxStatisticsExposer; import org.infinispan.jmx.annotations.DataType; import org.infinispan.jmx.annotations.MBean; import org.infinispan.jmx.annotations.ManagedAttribute; import org.infinispan.jmx.annotations.ManagedOperation; import org.infinispan.jmx.annotations.MeasurementType; import org.infinispan.jmx.annotations.Parameter; import org.infinispan.util.logging.Log; import org.infinispan.util.logging.LogFactory; import java.util.concurrent.atomic.AtomicLong; /** * This interceptor should completely replace default InvalidationInterceptor. * We need to send custom invalidation commands with transaction identifier (as the invalidation) * since we have to do a two-phase invalidation (releasing the locks as JTA synchronization), * although the cache itself is non-transactional. * * @author Radim Vansa &lt;rvansa@redhat.com&gt; * @author Mircea.Markus@jboss.com * @author Galder Zamarreño */ @MBean(objectName = "Invalidation", description = "Component responsible for invalidating entries on remote caches when entries are written to locally.") public class NonTxInvalidationInterceptor extends BaseRpcInterceptor implements JmxStatisticsExposer { private final AtomicLong invalidations = new AtomicLong(0); private final PutFromLoadValidator putFromLoadValidator; private CommandsFactory commandsFactory; private CacheCommandInitializer commandInitializer; private boolean statisticsEnabled; private static final Log log = LogFactory.getLog(InvalidationInterceptor.class); public NonTxInvalidationInterceptor(PutFromLoadValidator putFromLoadValidator) { this.putFromLoadValidator = putFromLoadValidator; } @Override protected Log getLog() { return log; } @Inject public void injectDependencies(CommandsFactory commandsFactory, CacheCommandInitializer commandInitializer) { this.commandsFactory = commandsFactory; this.commandInitializer = commandInitializer; } @Start private void start() { this.setStatisticsEnabled(cacheConfiguration.jmxStatistics().enabled()); } @Override public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable { if (!isPutForExternalRead(command)) { return handleInvalidate(ctx, command, new Object[] { command.getKey() }); } return invokeNextInterceptor(ctx, command); } @Override public Object visitReplaceCommand(InvocationContext ctx, ReplaceCommand command) throws Throwable { return handleInvalidate(ctx, command, new Object[] { command.getKey() }); } @Override public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable { return handleInvalidate(ctx, command, new Object[] { command.getKey() }); } @Override public Object visitClearCommand(InvocationContext ctx, ClearCommand command) throws Throwable { Object retval = invokeNextInterceptor(ctx, command); if (!isLocalModeForced(command)) { // just broadcast the clear command - this is simplest! if (ctx.isOriginLocal()) { rpcManager.invokeRemotely(null, command, rpcManager.getDefaultRpcOptions(defaultSynchronous)); } } return retval; } @Override public Object visitPutMapCommand(InvocationContext ctx, PutMapCommand command) throws Throwable { if (!isPutForExternalRead(command)) { return handleInvalidate(ctx, command, command.getMap().keySet().toArray()); } return invokeNextInterceptor(ctx, command); } private Object handleInvalidate(InvocationContext ctx, WriteCommand command, Object[] keys) throws Throwable { Object retval = invokeNextInterceptor(ctx, command); if (command.isSuccessful() && keys != null && keys.length != 0) { invalidateAcrossCluster(command, keys); } return retval; } private void invalidateAcrossCluster(FlagAffectedCommand command, Object[] keys) throws Throwable { // increment invalidations counter if statistics maintained incrementInvalidations(); InvalidateCommand invalidateCommand; Object lockOwner = putFromLoadValidator.registerRemoteInvalidations(keys); if (!isLocalModeForced(command)) { if (lockOwner == null) { invalidateCommand = commandsFactory.buildInvalidateCommand(InfinispanCollections.<Flag>emptySet(), keys); } else { invalidateCommand = commandInitializer.buildBeginInvalidationCommand( InfinispanCollections.<Flag>emptySet(), keys, lockOwner); } if (log.isDebugEnabled()) { log.debug("Cache [" + rpcManager.getAddress() + "] replicating " + invalidateCommand); } rpcManager.invokeRemotely(null, invalidateCommand, rpcManager.getDefaultRpcOptions(isSynchronous(command))); } } private void incrementInvalidations() { if (statisticsEnabled) { invalidations.incrementAndGet(); } } private boolean isPutForExternalRead(FlagAffectedCommand command) { if (command.hasFlag(Flag.PUT_FOR_EXTERNAL_READ)) { log.trace("Put for external read called. Suppressing clustered invalidation."); return true; } return false; } @ManagedOperation( description = "Resets statistics gathered by this component", displayName = "Reset statistics" ) public void resetStatistics() { invalidations.set(0); } @ManagedAttribute( displayName = "Statistics enabled", description = "Enables or disables the gathering of statistics by this component", dataType = DataType.TRAIT, writable = true ) public boolean getStatisticsEnabled() { return this.statisticsEnabled; } public void setStatisticsEnabled(@Parameter(name = "enabled", description = "Whether statistics should be enabled or disabled (true/false)") boolean enabled) { this.statisticsEnabled = enabled; } @ManagedAttribute( description = "Number of invalidations", displayName = "Number of invalidations", measurementType = MeasurementType.TRENDSUP ) public long getInvalidations() { return invalidations.get(); } }
[ "rodrigosoaresilva@gmail.com" ]
rodrigosoaresilva@gmail.com
c781d64b325c12b7b82f21d96e64b7022ff7df3e
c577f5380b4799b4db54722749cc33f9346eacc1
/BugSwarm/openpnp-openpnp-111252960/buggy_files/src/main/java/org/openpnp/machine/reference/ReferenceNozzleTip.java
cd3383a869d874a87e3afdfb7baf62e5d491afdd
[]
no_license
tdurieux/BugSwarm-dissection
55db683fd95f071ff818f9ca5c7e79013744b27b
ee6b57cfef2119523a083e82d902a6024e0d995a
refs/heads/master
2020-04-30T17:11:52.050337
2019-05-09T13:42:03
2019-05-09T13:42:03
176,972,414
1
0
null
null
null
null
UTF-8
Java
false
false
6,466
java
package org.openpnp.machine.reference; import java.awt.Component; import java.awt.event.ActionEvent; import java.util.HashSet; import java.util.Set; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.JComponent; import org.openpnp.ConfigurationListener; import org.openpnp.gui.MainFrame; import org.openpnp.gui.support.Icons; import org.openpnp.gui.support.MessageBoxes; import org.openpnp.gui.support.PropertySheetWizardAdapter; import org.openpnp.gui.support.Wizard; import org.openpnp.machine.reference.wizards.ReferenceNozzleTipConfigurationWizard; import org.openpnp.model.Configuration; import org.openpnp.model.LengthUnit; import org.openpnp.model.Location; import org.openpnp.model.Part; import org.openpnp.spi.Head; import org.openpnp.spi.Nozzle; import org.openpnp.spi.NozzleTip; import org.openpnp.spi.PropertySheetHolder; import org.openpnp.spi.base.AbstractNozzleTip; import org.openpnp.util.UiUtils; import org.simpleframework.xml.Attribute; import org.simpleframework.xml.Element; import org.simpleframework.xml.ElementList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class ReferenceNozzleTip extends AbstractNozzleTip { private final static Logger logger = LoggerFactory .getLogger(ReferenceNozzleTip.class); @ElementList(required = false, entry = "id") private Set<String> compatiblePackageIds = new HashSet<>(); @Attribute(required = false) private boolean allowIncompatiblePackages; @Element(required = false) private Location changerStartLocation = new Location(LengthUnit.Millimeters); @Element(required = false) private Location changerMidLocation = new Location(LengthUnit.Millimeters); @Element(required = false) private Location changerEndLocation = new Location(LengthUnit.Millimeters); private Set<org.openpnp.model.Package> compatiblePackages = new HashSet<>(); public ReferenceNozzleTip() { Configuration.get().addListener(new ConfigurationListener.Adapter() { @Override public void configurationLoaded(Configuration configuration) throws Exception { for (String id : compatiblePackageIds) { org.openpnp.model.Package pkg = configuration.getPackage(id); if (pkg == null) { continue; } compatiblePackages.add(pkg); } } }); } @Override public boolean canHandle(Part part) { boolean result = allowIncompatiblePackages || compatiblePackages.contains(part.getPackage()); logger.debug("{}.canHandle({}) => {}", new Object[]{getName(), part.getId(), result}); return result; } public Set<org.openpnp.model.Package> getCompatiblePackages() { return new HashSet<>(compatiblePackages); } public void setCompatiblePackages( Set<org.openpnp.model.Package> compatiblePackages) { this.compatiblePackages.clear(); this.compatiblePackages.addAll(compatiblePackages); compatiblePackageIds.clear(); for (org.openpnp.model.Package pkg : compatiblePackages) { compatiblePackageIds.add(pkg.getId()); } } @Override public String toString() { return getName(); } @Override public Wizard getConfigurationWizard() { return new ReferenceNozzleTipConfigurationWizard(this); } @Override public String getPropertySheetHolderTitle() { return getClass().getSimpleName() + " " + getName(); } @Override public PropertySheetHolder[] getChildPropertySheetHolders() { // TODO Auto-generated method stub return null; } @Override public Action[] getPropertySheetHolderActions() { return new Action[] { unloadAction, loadAction }; } @Override public PropertySheet[] getPropertySheets() { return new PropertySheet[] { new PropertySheetWizardAdapter(getConfigurationWizard()) }; } public boolean isAllowIncompatiblePackages() { return allowIncompatiblePackages; } public void setAllowIncompatiblePackages(boolean allowIncompatiblePackages) { this.allowIncompatiblePackages = allowIncompatiblePackages; } public Location getChangerStartLocation() { return changerStartLocation; } public void setChangerStartLocation(Location changerStartLocation) { this.changerStartLocation = changerStartLocation; } public Location getChangerMidLocation() { return changerMidLocation; } public void setChangerMidLocation(Location changerMidLocation) { this.changerMidLocation = changerMidLocation; } public Location getChangerEndLocation() { return changerEndLocation; } public void setChangerEndLocation(Location changerEndLocation) { this.changerEndLocation = changerEndLocation; } private Nozzle getParentNozzle() { for (Head head : Configuration.get().getMachine().getHeads()) { for (Nozzle nozzle : head.getNozzles()) { for (NozzleTip nozzleTip : nozzle.getNozzleTips()) { if (nozzleTip == this) { return nozzle; } } } } return null; } public Action loadAction = new AbstractAction("Load") { { putValue(SMALL_ICON, Icons.load); putValue(NAME, "Load"); putValue(SHORT_DESCRIPTION, "Load the currently selected nozzle tip."); } @Override public void actionPerformed(final ActionEvent arg0) { UiUtils.submitUiMachineTask(() -> { getParentNozzle().loadNozzleTip(ReferenceNozzleTip.this); }); } }; public Action unloadAction = new AbstractAction("Unoad") { { putValue(SMALL_ICON, Icons.unload); putValue(NAME, "Unload"); putValue(SHORT_DESCRIPTION, "Unoad the currently loaded nozzle tip."); } @Override public void actionPerformed(final ActionEvent arg0) { UiUtils.submitUiMachineTask(() -> { getParentNozzle().unloadNozzleTip(); }); } }; }
[ "durieuxthomas@hotmail.com" ]
durieuxthomas@hotmail.com
1852f3e3f67df93ad2ca5bbc3dd9108fcd53547d
0af8b92686a58eb0b64e319b22411432aca7a8f3
/large-multiproject/project27/src/main/java/org/gradle/test/performance27_5/Production27_411.java
3de8d92e6c3a91a047cbc154b1694ad2345bfb22
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
305
java
package org.gradle.test.performance27_5; public class Production27_411 extends org.gradle.test.performance11_5.Production11_411 { private final String property; public Production27_411() { this.property = "foo"; } public String getProperty() { return property; } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
1d5cff8650035b0124ecdd8678389983ea83df4b
7cfde3b082522eeb5fb1d4546ebc6ab24a4f11a4
/wgames/gameserver/src/main/java/org/linlinjava/litemall/gameserver/process/C12802_0.java
32bc1fca2e0a5af0e00ae5765173efabf6a040be
[]
no_license
miracle-ET/DreamInMiracle
9f784e7f373e78a7011aceb2b5b78ce6f5b7c268
2587221feb4fd152fc91cabd533b383c7e44b86f
refs/heads/master
2022-07-21T21:44:55.253764
2020-01-03T03:59:17
2020-01-03T03:59:17
231,498,544
0
2
null
2022-06-21T02:33:57
2020-01-03T02:41:06
Java
UTF-8
Java
false
false
6,376
java
package org.linlinjava.litemall.gameserver.process; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import org.linlinjava.litemall.gameserver.GameHandler; import org.linlinjava.litemall.gameserver.data.GameReadTool; import org.linlinjava.litemall.gameserver.data.vo.Vo_11713_0; import org.linlinjava.litemall.gameserver.data.vo.Vo_36889_0; import org.linlinjava.litemall.gameserver.data.vo.Vo_53715_0; import org.linlinjava.litemall.gameserver.data.write.M11713_0; import org.linlinjava.litemall.gameserver.data.write.M36889_0; import org.linlinjava.litemall.gameserver.data.write.M53715_0; import org.linlinjava.litemall.gameserver.domain.Chara; import org.linlinjava.litemall.gameserver.domain.Goods; import org.linlinjava.litemall.gameserver.domain.JiNeng; import org.linlinjava.litemall.gameserver.fight.*; import org.linlinjava.litemall.gameserver.game.GameObjectChar; import org.springframework.stereotype.Service; import java.util.List; @Service public class C12802_0 implements GameHandler { @Override public void process(ChannelHandlerContext ctx, ByteBuf buff) { int id = GameReadTool.readInt(buff); int victim_id = GameReadTool.readInt(buff); int action = GameReadTool.readInt(buff); int para = GameReadTool.readInt(buff); String para1 = GameReadTool.readString(buff); String para2 = GameReadTool.readString(buff); String para3 = GameReadTool.readString(buff); String skill_talk = GameReadTool.readString(buff); final FightContainer fightContainer = FightManager.getFightContainer(); if (fightContainer == null || fightContainer.state.intValue() == 3) { return; } final Chara chara = GameObjectChar.getGameObjectChar().chara; boolean checkSkill = false; final FightObject fightObject = FightManager.getFightObject(fightContainer, id); if (fightObject.fid != chara.id && fightObject.cid != chara.id) { return; } if (fightObject.fightRequest != null) { return; } if (action == 3) { final List<JiNeng> jiNengList = fightObject.skillsList; for (JiNeng jiNeng : jiNengList) { if (jiNeng.skill_no == para) { checkSkill = true; break; } } if (!checkSkill) { return; } } FightRequest fr = new FightRequest(); fr.id = id; fr.action = action; fr.vid = victim_id; fr.para = para; fr.para1 = para1; fr.para2 = para2; fr.para3 = para3; fr.skill_talk = skill_talk; Vo_36889_0 vo_36889_0 = new Vo_36889_0(); vo_36889_0.count = 1; vo_36889_0.id = id; vo_36889_0.auto_select = 2; vo_36889_0.multi_index = 0; vo_36889_0.action = action; vo_36889_0.para = para; vo_36889_0.multi_count = 0; GameObjectChar.send(new M36889_0(), vo_36889_0); if (fightObject.type == 1) { final FightObject fightObjectPet = FightManager.getFightObjectPet(fightContainer, fightObject); if (fightObjectPet == null || fightObjectPet.isDead()) { final Vo_53715_0 vo_53715_0 = new Vo_53715_0(); vo_53715_0.attacker_id = id; vo_53715_0.victim_id = victim_id; vo_53715_0.action = action; if (para != 2) { vo_53715_0.no = para; } if (action == 4) { final Goods beibaowupin = GameUtil.beibaowupin(chara, para); if (beibaowupin != null) { vo_53715_0.no = beibaowupin.goodsInfo.type; fr.item_type = beibaowupin.goodsInfo.type; } } GameObjectChar.send(new M53715_0(), vo_53715_0); final Vo_11713_0 vo_11713_0 = new Vo_11713_0(); vo_11713_0.id = id; vo_11713_0.show = 0; GameObjectChar.send(new M11713_0(), vo_11713_0); } } else { final FightObject fightObjectChar = FightManager.getFightObject(fightContainer, chara.id); Vo_53715_0 vo_53715_0 = new Vo_53715_0(); vo_53715_0.attacker_id = fightObjectChar.fightRequest.id; vo_53715_0.victim_id = fightObjectChar.fightRequest.vid; vo_53715_0.action = fightObjectChar.fightRequest.action; if (vo_53715_0.action != 2) { vo_53715_0.no = fightObjectChar.fightRequest.para; } if (fightObjectChar.fightRequest.action == 4) { final Goods beibaowupin = GameUtil.beibaowupin(chara, fightObjectChar.fightRequest.para); if (beibaowupin != null) { vo_53715_0.no = beibaowupin.goodsInfo.type; fightObjectChar.fightRequest.item_type = beibaowupin.goodsInfo.type; } } GameObjectChar.send(new M53715_0(), vo_53715_0); vo_53715_0 = new Vo_53715_0(); vo_53715_0.attacker_id = id; vo_53715_0.victim_id = victim_id; vo_53715_0.action = action; if (para != 2) { vo_53715_0.no = para; } if (action == 4) { final Goods beibaowupin = GameUtil.beibaowupin(chara, para); if (beibaowupin != null) { vo_53715_0.no = beibaowupin.goodsInfo.type; fr.item_type = beibaowupin.goodsInfo.type; } } GameObjectChar.send(new M53715_0(), vo_53715_0); final Vo_11713_0 vo_11713_0 = new Vo_11713_0(); vo_11713_0.id = id; vo_11713_0.show = 0; GameObjectChar.send(new M11713_0(), vo_11713_0); } FightManager.changeAutoFightSkill(fightContainer, fightObject, action, para); FightManager.addRequest(fightContainer, fr); } @Override public int cmd() { return 12802; } }
[ "Administrator@DESKTOP-M4SH3SF" ]
Administrator@DESKTOP-M4SH3SF
9f07cf08b9ee2eb578614ddc2b0db12ffc74d31a
f86938ea6307bf6d1d89a07b5b5f9e360673d9b8
/CodeComment_Data/Code_Jam/val/Revenge_of_the_Pancakes/S/panackle.java
9875b70832d87a71e6c3891f6db66863152111df
[]
no_license
yxh-y/code_comment_generation
8367b355195a8828a27aac92b3c738564587d36f
2c7bec36dd0c397eb51ee5bd77c94fa9689575fa
refs/heads/master
2021-09-28T18:52:40.660282
2018-11-19T14:54:56
2018-11-19T14:54:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
909
java
package methodEmbedding.Revenge_of_the_Pancakes.S.LYD1004; import java.util.*; class panackle { public static void main(String args[]) { Scanner in = new Scanner(System.in); int t; t=in.nextInt(); in.nextLine(); for(int k=1;k<=t;k++) { String str; int flips=0; str=in.nextLine(); boolean pom=false; if(str.charAt(0)=='-') { pom=true; flips+=1; } for(int i=1;i<str.length();i++) { if(str.charAt(i)=='+') { pom=false; continue; } if(pom==true) continue; pom=true; flips+=2; } System.out.println("Case #"+k+": "+flips); } } }
[ "liangyuding@sjtu.edu.cn" ]
liangyuding@sjtu.edu.cn
a823e1e4b61f9ed102187426ed0d2ce9d0c6f78b
6b3e8853751b26ce1b2cb462ae55cc7e9c3150b2
/src/main/java/org/bian/dto/SDChannelActivityAnalysisRetrieveOutputModelServiceDomainRetrieveActionRecordControlRecordPortfolioAnalysis.java
83482859492d54fff701958b3f44a4e8647a8a55
[ "Apache-2.0" ]
permissive
bianapis/sd-channel-activity-analysis-v2.0
4d8961aad54e3f7a60912cf1e9c84921c6251a7d
6f7beecabfecf54b7042ec73f0c7da7997c3a4c4
refs/heads/master
2020-07-16T17:57:19.293133
2019-09-06T08:13:57
2019-09-06T08:13:57
204,452,987
0
0
null
null
null
null
UTF-8
Java
false
false
3,091
java
package org.bian.dto; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.Valid; /** * SDChannelActivityAnalysisRetrieveOutputModelServiceDomainRetrieveActionRecordControlRecordPortfolioAnalysis */ public class SDChannelActivityAnalysisRetrieveOutputModelServiceDomainRetrieveActionRecordControlRecordPortfolioAnalysis { private String controlRecordPortfolioAnalysisReference = null; private String controlRecordPortfolioAnalysisResult = null; private String controlRecordPortfolioAnalysisReportType = null; private Object controlRecordAnalysisReport = null; /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::ISO20022andUNCEFACT::Identifier general-info: Reference to the control record portfolio analysis view maintained by the service center * @return controlRecordPortfolioAnalysisReference **/ public String getControlRecordPortfolioAnalysisReference() { return controlRecordPortfolioAnalysisReference; } public void setControlRecordPortfolioAnalysisReference(String controlRecordPortfolioAnalysisReference) { this.controlRecordPortfolioAnalysisReference = controlRecordPortfolioAnalysisReference; } /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: The results of the portfolio analysis that can be on-going, periodic and actual and projected (can be unstructured data) * @return controlRecordPortfolioAnalysisResult **/ public String getControlRecordPortfolioAnalysisResult() { return controlRecordPortfolioAnalysisResult; } public void setControlRecordPortfolioAnalysisResult(String controlRecordPortfolioAnalysisResult) { this.controlRecordPortfolioAnalysisResult = controlRecordPortfolioAnalysisResult; } /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Code general-info: The type of external portfolio analysis report available * @return controlRecordPortfolioAnalysisReportType **/ public String getControlRecordPortfolioAnalysisReportType() { return controlRecordPortfolioAnalysisReportType; } public void setControlRecordPortfolioAnalysisReportType(String controlRecordPortfolioAnalysisReportType) { this.controlRecordPortfolioAnalysisReportType = controlRecordPortfolioAnalysisReportType; } /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Binary general-info: The external analysis report in any suitable form including selection filters where appropriate * @return controlRecordAnalysisReport **/ public Object getControlRecordAnalysisReport() { return controlRecordAnalysisReport; } public void setControlRecordAnalysisReport(Object controlRecordAnalysisReport) { this.controlRecordAnalysisReport = controlRecordAnalysisReport; } }
[ "team1@bian.org" ]
team1@bian.org
c1d5dc1df5119caa705ee47bd991a0190708d219
46ef04782c58b3ed1d5565f8ac0007732cddacde
/platform.core/core.project.data/src/org/modelio/gproject/data/ramc/ModelComponentInfos.java
afc2373d2303fc7116c5c5ed9a3af96354cd6a84
[]
no_license
daravi/modelio
844917412abc21e567ff1e9dd8b50250515d6f4b
1787c8a836f7e708a5734d8bb5b8a4f1a6008691
refs/heads/master
2020-05-26T17:14:03.996764
2019-05-23T21:30:10
2019-05-23T21:30:45
188,309,762
0
1
null
null
null
null
UTF-8
Java
false
false
5,320
java
/* * Copyright 2013-2018 Modeliosoft * * This file is part of Modelio. * * Modelio is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Modelio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Modelio. If not, see <http://www.gnu.org/licenses/>. * */ package org.modelio.gproject.data.ramc; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.modeliosoft.modelio.javadesigner.annotations.objid; import org.modelio.vbasic.version.Version; import org.modelio.vbasic.version.VersionedItem; @objid ("f124f692-cc2f-11e1-87f1-001ec947ccaf") class ModelComponentInfos implements IModelComponentInfos { @objid ("74507b6a-cc3e-11e1-87f1-001ec947ccaf") private String description; @objid ("74507b64-cc3e-11e1-87f1-001ec947ccaf") private String name; @objid ("b31eb867-4261-4166-9f14-be37fe22b235") private String provider; @objid ("374df66e-f87d-4853-a846-5e45b7dd66fd") private List<VersionedItem<?>> contributingModule = new ArrayList<>(); @objid ("887ff53e-518a-45f4-89ce-df3dab16eb60") private List<ExportedFile> exportedFiles = new ArrayList<>(); @objid ("707fce92-6dc7-429a-b754-bcb5a6723995") private List<VersionedItem<?>> requiredMetamodelFragments = new ArrayList<>(); @objid ("a91c04c3-6f25-4f57-ad14-5d844fe55656") private List<VersionedItem<?>> requiredModelComponents = new ArrayList<>(); @objid ("b047d08f-2dc9-4298-a430-260285c24ab3") private List<ModelRef> roots = new ArrayList<>(); @objid ("7d0386ee-d27d-11e1-a594-001ec947ccaf") private Version version; @objid ("b90cfb82-e950-4147-aaa3-007f5c06a82b") private Version modelioVersion; @objid ("a122b70d-242a-4ab1-915c-8d9365a80579") @Override public List<VersionedItem<?>> getContributingModules() { return Collections.unmodifiableList(this.contributingModule); } @objid ("a01e6602-cc36-11e1-87f1-001ec947ccaf") @Override public String getDescription() { return this.description; } @objid ("8f227e6f-8cd0-4eba-b242-b01aa816eef2") @Override public List<ExportedFile> getExportedFiles() { return Collections.unmodifiableList(this.exportedFiles); } @objid ("a01c03b2-cc36-11e1-87f1-001ec947ccaf") @Override public String getName() { return this.name; } @objid ("f2f23680-7d68-47c7-89df-0a3e126fc914") @Override public List<VersionedItem<?>> getRequiredMetamodelFragments() { return Collections.unmodifiableList(this.requiredMetamodelFragments); } @objid ("1a37df4b-7b85-4157-8830-56b94933e25f") @Override public List<VersionedItem<?>> getRequiredModelComponents() { return Collections.unmodifiableList(this.requiredModelComponents); } @objid ("9d139939-c9e9-49b9-a953-d0c34706b61b") @Override public List<ModelRef> getRoots() { return this.roots; } @objid ("a01e65fc-cc36-11e1-87f1-001ec947ccaf") @Override public Version getVersion() { return this.version; } @objid ("a01c03ad-cc36-11e1-87f1-001ec947ccaf") ModelComponentInfos() { } @objid ("740b57a5-cc3e-11e1-87f1-001ec947ccaf") void addFile(ExportedFile f) { this.exportedFiles.add(f); } @objid ("740b5796-cc3e-11e1-87f1-001ec947ccaf") void addModule(VersionedItem<?> module) { this.contributingModule.add(module); } @objid ("2a15388d-1c3d-4ea0-ae71-31902cb004b4") void addRequiredMetamodelFragment(VersionedItem<?> dep) { this.requiredMetamodelFragments.add(dep); } @objid ("a01e6609-cc36-11e1-87f1-001ec947ccaf") void addRequiredRamc(VersionedItem<?> dep) { this.requiredModelComponents.add(dep); } @objid ("fe7648ed-53c6-4d0c-b390-bb7df17cb36c") void addRoot(ModelRef mref) { this.roots.add(mref); } @objid ("a01e6606-cc36-11e1-87f1-001ec947ccaf") void setDescription(String description) { this.description = description; } @objid ("a01c03af-cc36-11e1-87f1-001ec947ccaf") void setName(String name) { this.name = name; } @objid ("a01c03b6-cc36-11e1-87f1-001ec947ccaf") void setVersion(Version version) { this.version = version; } @objid ("ec613ec5-475e-4778-95c2-00bdad1e2469") @Override public Version getModelioVersion() { return this.modelioVersion; } @objid ("dc39a1d5-14e8-4cd6-a7e7-8a1d50e666ab") public void setModelioVersion(Version modelioVersion) { this.modelioVersion = modelioVersion; } @objid ("0bb865cf-0c1c-43e6-b58f-a33466c69530") @Override public String getProvider() { return this.provider; } @objid ("e7dff75d-224d-4871-b027-5019342e47fd") public void setProvider(String provider) { this.provider = provider; } }
[ "puya@motionmetrics.com" ]
puya@motionmetrics.com
bbb6809bdf77212ca9f5a2c442ea3516f1e6595a
02cd2722ae6fa330005a8f42c655c0f1c2b1d816
/yukthi-data/src/test/java/com/fw/persistence/utils/TPasswordEncryptor.java
9654c306d77c72695377ec6b099b6da1f59a19a5
[]
no_license
pritam285/utils
b201020fdf6f2adc4ac31dedb10be70039503141
302211e49c24ff54be7f62d37b160ccc50a6521d
refs/heads/master
2020-04-05T23:11:54.639378
2016-11-06T08:58:20
2016-11-06T08:58:20
61,019,862
0
0
null
2016-11-06T08:58:21
2016-06-13T08:21:48
Java
UTF-8
Java
false
false
570
java
package com.fw.persistence.utils; import org.testng.Assert; import org.testng.annotations.Test; import com.yukthi.persistence.utils.PasswordEncryptor; public class TPasswordEncryptor { @Test public void testEncryption() { String password = "testPassword@123"; String encryptedValue = PasswordEncryptor.encryptPassword(password); System.out.println("Encrypted value is - " + encryptedValue); Assert.assertNotEquals(password, encryptedValue); Assert.assertTrue(PasswordEncryptor.isSamePassword(encryptedValue, password)); } }
[ "akranthikiran@gmail.com" ]
akranthikiran@gmail.com
c73ba18c6d87df54c1ecd5e95a025d687b705c07
3ec1ecc125e35f1a35a22ee944ed0c193c15fe58
/vjtop/src/main/java/com/vip/vjtools/vjtop/InteractiveTask.java
27319719077646da74846bc94cd68b085d9aaebf
[ "Apache-2.0" ]
permissive
jiangxf/vjtools
83beeb5f12cb8bda2c56dc6f107e59f0067615ac
29eee6cabee764a6a547627a9ca28c251eeb2e0e
refs/heads/master
2020-03-26T11:15:28.498369
2018-08-15T03:27:01
2018-08-15T03:27:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,320
java
package com.vip.vjtools.vjtop; import java.io.Console; import java.io.IOException; import java.io.PrintStream; import com.vip.vjtools.vjtop.VMDetailView.DetailMode; /** * 与用户交互动态的控制器 */ public class InteractiveTask implements Runnable { private VJTop app; private Console console; private PrintStream tty; public InteractiveTask(VJTop app) { this.app = app; tty = System.err; console = System.console(); } public boolean inputEnabled() { return console != null; } @Override public void run() { // background执行时,console为Null if (console == null) { return; } while (true) { try { String command = readLine(""); if (command == null) { break; } handleCommand(command); if (!app.view.shouldExit()) { tty.print(" Input command (h for help):"); } } catch (Exception e) { e.printStackTrace(tty); } } } public void handleCommand(String command) throws Exception { if (command.equals("t") || (command.startsWith("t "))) { printStacktrace(command); } else if (command.equals("a")) { displayAllThreads(); } else if (command.equals("m")) { changeDisplayMode(); } else if (command.equals("i")) { changeInterval(); } else if (command.equals("l")) { changeThreadLimit(); } else if (command.equals("q") || command.equals("quit") || command.equals("exit")) { app.exit(); return; } else if (command.equals("h") || command.equals("help")) { printHelp(); } else if (command.equals("")) { } else { tty.println(" Unkown command: " + command + ", available options:"); printHelp(); } } private void printStacktrace(String command) throws IOException { if (app.view.collectingData) { tty.println(" Please wait for top threads displayed"); return; } app.preventFlush(); String pidStr; if (command.length() == 1) { pidStr = readLine(" Input TID:"); } else { pidStr = command.substring(2); } try { long pid = Long.parseLong(pidStr); app.view.printStack(pid); waitForEnter(); } catch (NumberFormatException e) { tty.println(" Wrong number format for pid"); } finally { app.continueFlush(); } } private void displayAllThreads() throws Exception { try { app.preventFlush(); app.view.printAllThreads(); waitForEnter(); } finally { app.continueFlush(); } } private void changeDisplayMode() { app.preventFlush(); String mode = readLine( " Input number of Display Mode(1.cpu, 2.syscpu 3.total cpu 4.total syscpu 5.memory 6.total memory, current " + app.view.mode + "): "); DetailMode detailMode = DetailMode.parse(mode); if (detailMode == null) { tty.println(" Wrong option for display mode(1-6)"); } else if (detailMode == app.view.mode) { tty.println(" Nothing be changed"); } else { if (app.view.mode.isCpuMode != detailMode.isCpuMode) { app.view.cleanupThreadsHistory(); } app.view.mode = detailMode; if (app.nextFlushTime() > 1) { tty.println(" Display mode changed to " + app.view.mode + " for next flush (" + app.nextFlushTime() + "s later)"); } } app.continueFlush(); } private void changeInterval() { app.preventFlush(); String intervalStr = readLine(" Input flush interval seconds(current " + app.interval + "):"); try { int interval = Integer.parseInt(intervalStr); if (interval != app.interval) { if (app.nextFlushTime() > 1) { tty.println(" Flush interval changed to " + interval + " seconds for next flush (" + app.nextFlushTime() + "s later)"); } app.interval = interval; } else { tty.println(" Nothing be changed"); } } catch (NumberFormatException e) { tty.println(" Wrong number format for interval"); } finally { app.continueFlush(); } } private void changeThreadLimit() { app.preventFlush(); String threadLimitStr = readLine(" Input number of threads to display(current " + app.view.threadLimit + "):"); try { int threadLimit = Integer.parseInt(threadLimitStr); if (threadLimit != app.view.threadLimit) { app.view.threadLimit = threadLimit; if (app.nextFlushTime() > 1) { tty.println(" Number of threads to display changed to " + threadLimit + " for next flush (" + app.nextFlushTime() + "s later)"); } } else { tty.println(" Nothing be changed"); } } catch (NumberFormatException e) { tty.println(" Wrong number format for number of threads"); } finally { app.continueFlush(); } } private void printHelp() throws Exception { tty.println(" t [tid]: print stack trace for the thread you choose"); tty.println(" a : list all thread's id and name"); tty.println(" m : change threads display mode and ordering"); tty.println(" i : change flush interval seconds"); tty.println(" l : change number of display threads"); tty.println(" q : quit"); tty.println(" h : print help"); app.preventFlush(); String command = waitForEnter(); app.continueFlush(); if (command.length() > 0) { handleCommand(command); } } private String waitForEnter() { return readLine(" Please hit <ENTER> to continue..."); } private String readLine(String hints) { String result = console.readLine(hints); if (result != null) { return result.trim().toLowerCase(); } return null; } }
[ "calvin.xiao@vipshop.com" ]
calvin.xiao@vipshop.com
47cd31a735b5a8163016505b8961f815de0bf1fe
a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb
/slbv2-20220430/src/main/java/com/aliyun/slbv220220430/models/RemoveServersFromServerGroupRequest.java
d2dee27dc809e22cec0fdef84584dc8c1ea764b6
[ "Apache-2.0" ]
permissive
aliyun/alibabacloud-java-sdk
83a6036a33c7278bca6f1bafccb0180940d58b0b
008923f156adf2e4f4785a0419f60640273854ec
refs/heads/master
2023-09-01T04:10:33.640756
2023-09-01T02:40:45
2023-09-01T02:40:45
288,968,318
40
45
null
2023-06-13T02:47:13
2020-08-20T09:51:08
Java
UTF-8
Java
false
false
3,679
java
// This file is auto-generated, don't edit it. Thanks. package com.aliyun.slbv220220430.models; import com.aliyun.tea.*; public class RemoveServersFromServerGroupRequest extends TeaModel { @NameInMap("ClientToken") public String clientToken; @NameInMap("DryRun") public Boolean dryRun; @NameInMap("RegionId") public String regionId; @NameInMap("ServerGroupId") public String serverGroupId; @NameInMap("Servers") public java.util.List<RemoveServersFromServerGroupRequestServers> servers; public static RemoveServersFromServerGroupRequest build(java.util.Map<String, ?> map) throws Exception { RemoveServersFromServerGroupRequest self = new RemoveServersFromServerGroupRequest(); return TeaModel.build(map, self); } public RemoveServersFromServerGroupRequest setClientToken(String clientToken) { this.clientToken = clientToken; return this; } public String getClientToken() { return this.clientToken; } public RemoveServersFromServerGroupRequest setDryRun(Boolean dryRun) { this.dryRun = dryRun; return this; } public Boolean getDryRun() { return this.dryRun; } public RemoveServersFromServerGroupRequest setRegionId(String regionId) { this.regionId = regionId; return this; } public String getRegionId() { return this.regionId; } public RemoveServersFromServerGroupRequest setServerGroupId(String serverGroupId) { this.serverGroupId = serverGroupId; return this; } public String getServerGroupId() { return this.serverGroupId; } public RemoveServersFromServerGroupRequest setServers(java.util.List<RemoveServersFromServerGroupRequestServers> servers) { this.servers = servers; return this; } public java.util.List<RemoveServersFromServerGroupRequestServers> getServers() { return this.servers; } public static class RemoveServersFromServerGroupRequestServers extends TeaModel { // 服务器端口 @NameInMap("Port") public Integer port; // 服务器id @NameInMap("ServerId") public String serverId; // 服务器ip @NameInMap("ServerIp") public String serverIp; // 服务器类型 @NameInMap("ServerType") public String serverType; public static RemoveServersFromServerGroupRequestServers build(java.util.Map<String, ?> map) throws Exception { RemoveServersFromServerGroupRequestServers self = new RemoveServersFromServerGroupRequestServers(); return TeaModel.build(map, self); } public RemoveServersFromServerGroupRequestServers setPort(Integer port) { this.port = port; return this; } public Integer getPort() { return this.port; } public RemoveServersFromServerGroupRequestServers setServerId(String serverId) { this.serverId = serverId; return this; } public String getServerId() { return this.serverId; } public RemoveServersFromServerGroupRequestServers setServerIp(String serverIp) { this.serverIp = serverIp; return this; } public String getServerIp() { return this.serverIp; } public RemoveServersFromServerGroupRequestServers setServerType(String serverType) { this.serverType = serverType; return this; } public String getServerType() { return this.serverType; } } }
[ "sdk-team@alibabacloud.com" ]
sdk-team@alibabacloud.com
675ea2ff54770faa2a23df123c0e2f256043d981
e76a79816ff5203be2c4061e263a09d31072c940
/third-party/java/dx/src/com/android/dx/ssa/back/InterferenceGraph.java
5ed2f820b3e56f4bf14d4efddb443ed71373ae87
[ "Apache-2.0" ]
permissive
facebook/buck
ef3a833334499b1b44c586e9bc5e2eec8d930e09
9c7c421e49f4d92d67321f18c6d1cd90974c77c4
refs/heads/main
2023-08-25T19:30:28.803205
2023-04-19T11:32:59
2023-04-19T11:32:59
9,504,214
8,481
1,338
Apache-2.0
2023-05-04T22:13:59
2013-04-17T18:12:18
Java
UTF-8
Java
false
false
3,003
java
/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.dx.ssa.back; import com.android.dx.ssa.SetFactory; import com.android.dx.util.IntSet; import java.util.ArrayList; /** * A register interference graph */ public class InterferenceGraph { /** * {@code non-null;} interference graph, indexed by register in * both dimensions */ private final ArrayList<IntSet> interference; /** * Creates a new graph. * * @param countRegs {@code >= 0;} the start count of registers in * the namespace. New registers can be added subsequently. */ public InterferenceGraph(int countRegs) { interference = new ArrayList<IntSet>(countRegs); for (int i = 0; i < countRegs; i++) { interference.add(SetFactory.makeInterferenceSet(countRegs)); } } /** * Adds a register pair to the interference/liveness graph. Parameter * order is insignificant. * * @param regV one register index * @param regW another register index */ public void add(int regV, int regW) { ensureCapacity(Math.max(regV, regW) + 1); interference.get(regV).add(regW); interference.get(regW).add(regV); } /** * Dumps interference graph to stdout for debugging. */ public void dumpToStdout() { int oldRegCount = interference.size(); for (int i = 0; i < oldRegCount; i++) { StringBuilder sb = new StringBuilder(); sb.append("Reg " + i + ":" + interference.get(i).toString()); System.out.println(sb.toString()); } } /** * Merges the interference set for a register into a given bit set * * @param reg {@code >= 0;} register * @param set {@code non-null;} interference set; will be merged * with set for given register */ public void mergeInterferenceSet(int reg, IntSet set) { if (reg < interference.size()) { set.merge(interference.get(reg)); } } /** * Ensures that the interference graph is appropriately sized. * * @param size requested minumum size */ private void ensureCapacity(int size) { int countRegs = interference.size(); interference.ensureCapacity(size); for (int i = countRegs; i < size; i++) { interference.add(SetFactory.makeInterferenceSet(size)); } } }
[ "sdwilsh@fb.com" ]
sdwilsh@fb.com
ddf301007da7a5615dbe217ace7aba1202b8a5ac
f6899a2cf1c10a724632bbb2ccffb7283c77a5ff
/glassfish-4.1.1/appserver/webservices/jsr109-impl/src/main/java/org/glassfish/webservices/Ejb2RuntimeEndpointInfo.java
2113275a1a9518b04e2fd4bf37a22ee019acf7d0
[]
no_license
Appdynamics/OSS
a8903058e29f4783e34119a4d87639f508a63692
1e112f8854a25b3ecf337cad6eccf7c85e732525
refs/heads/master
2023-07-22T03:34:54.770481
2021-10-28T07:01:57
2021-10-28T07:01:57
19,390,624
2
13
null
2023-07-08T02:26:33
2014-05-02T22:42:20
null
UTF-8
Java
false
false
5,200
java
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development * and Distribution License("CDDL") (collectively, the "License"). You * may not use this file except in compliance with the License. You can * obtain a copy of the License at * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html * or packager/legal/LICENSE.txt. See the License for the specific * language governing permissions and limitations under the License. * * When distributing the software, include this License Header Notice in each * file and include the License file at packager/legal/LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" * exception as provided by Oracle in the GPL Version 2 section of the License * file that accompanied this code. * * Modifications: * If applicable, add the following below the License Header, with the fields * enclosed by brackets [] replaced by your own identifying information: * "Portions Copyright [year] [name of copyright owner]" * * Contributor(s): * If you wish your version of this file to be governed by only the CDDL or * only the GPL Version 2, indicate your decision by adding "[Contributor] * elects to include this software in this distribution under the [CDDL or GPL * Version 2] license." If you don't indicate a single choice of license, a * recipient has the option to distribute your version of this file under * either the CDDL, the GPL Version 2 or to extend the choice of license to * its licensees as provided above. However, if you add GPL Version 2 code * and therefore, elected the GPL Version 2 license, then the option applies * only if the new code is made subject to such option by the copyright * holder. */ package org.glassfish.webservices; import java.rmi.Remote; import com.sun.enterprise.deployment.WebServiceEndpoint; import org.glassfish.ejb.api.EjbEndpointFacade; import org.glassfish.ejb.api.EJBInvocation; import org.glassfish.internal.api.Globals; import org.glassfish.api.invocation.ComponentInvocation; import com.sun.xml.rpc.spi.runtime.Handler; import com.sun.xml.rpc.spi.runtime.Tie; /** * Runtime dispatch information about one ejb web service * endpoint. This class must support concurrent access, * since a single instance will be used for all web * service invocations through the same ejb endpoint. * * @author Kenneth Saks */ public class Ejb2RuntimeEndpointInfo extends EjbRuntimeEndpointInfo { private Class tieClass; // Lazily instantiated and cached due to overhead // of initialization. private Tie tieInstance; private Object serverAuthConfig; public Ejb2RuntimeEndpointInfo(WebServiceEndpoint webServiceEndpoint, EjbEndpointFacade ejbContainer, Object servant, Class tie) { super(webServiceEndpoint, ejbContainer, servant); tieClass = tie; if (Globals.getDefaultHabitat() != null) { org.glassfish.webservices.SecurityService secServ = Globals.get( org.glassfish.webservices.SecurityService.class); if (secServ != null) { serverAuthConfig = secServ.mergeSOAPMessageSecurityPolicies(webServiceEndpoint.getMessageSecurityBinding()); } } } public AdapterInvocationInfo getHandlerImplementor() throws Exception { ComponentInvocation inv = container.startInvocation(); AdapterInvocationInfo aInfo = new AdapterInvocationInfo(); aInfo.setInv(inv); synchronized(this) { if(tieClass == null) { tieClass = Thread.currentThread().getContextClassLoader().loadClass(getEndpoint().getTieClassName()); } if( tieInstance == null ) { tieInstance = (Tie) tieClass.newInstance(); tieInstance.setTarget((Remote) webServiceEndpointServant); } } EJBInvocation.class.cast(inv).setWebServiceTie(tieInstance); aInfo.setHandler((Handler)tieInstance); return aInfo; } /** * Called after attempt to handle message. This is coded defensively * so we attempt to clean up no matter how much progress we made in * getImplementor. One important thing is to complete the invocation * manager preInvoke(). */ @Override public void releaseImplementor(ComponentInvocation inv) { container.endInvocation(inv); } @Override public EjbMessageDispatcher getMessageDispatcher() { // message dispatcher is stateless, no need to synchronize, worse // case, we'll create too many. if (messageDispatcher==null) { messageDispatcher = new EjbWebServiceDispatcher(); } return messageDispatcher; } public Object getServerAuthConfig() { return serverAuthConfig; } }
[ "fgonzales@appdynamics.com" ]
fgonzales@appdynamics.com
5ce02dd68a41ca5d67cea8fd0425d73b4d54de6e
86505462601eae6007bef6c9f0f4eeb9fcdd1e7b
/bin/modules/china-accelerator-wechat-psp/chinesepspwechatpayservices/src/de/hybris/platform/chinesepspwechatpayservices/constants/WeChatPaymentConstants.java
0784859276fbcc9f46458cef4cc659f35df75a33
[]
no_license
jp-developer0/hybrisTrail
82165c5b91352332a3d471b3414faee47bdb6cee
a0208ffee7fee5b7f83dd982e372276492ae83d4
refs/heads/master
2020-12-03T19:53:58.652431
2020-01-02T18:02:34
2020-01-02T18:02:34
231,430,332
0
4
null
2020-08-05T22:46:23
2020-01-02T17:39:15
null
UTF-8
Java
false
false
1,855
java
/* * Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. */ package de.hybris.platform.chinesepspwechatpayservices.constants; import de.hybris.platform.payment.dto.TransactionStatus; import java.util.HashMap; import java.util.Map; /** * Global class for all WeChat constants. */ public interface WeChatPaymentConstants { /** * Basic request constants */ interface Basic { String EXTENSIONNAME = "chinesepspalipayservices"; String PAYMENT_PROVIDER = "Wechat Pay"; } /** * Controller constants */ interface Controller { String _Prefix = "/checkout/multi/summary" + "/wechat/"; String _Suffix = "Controller"; String NOTIFY_URL = _Prefix + "paymentresponse/" + "notify"; String ERROR_NOTIFY_URL = _Prefix + "pspasynresponse/" + "error" + _Suffix; String GET_REFUND_URL = _Prefix + "refund" + _Suffix; } interface Notification { String RETURN_SUCCESS = "SUCCESS"; String RETURN_FAIL = "FAIL"; String RESULT_SUCCESS = "SUCCESS"; String RESULT_FAIL = "FAIL"; } class TransactionStatusMap { static final Map<String, TransactionStatus> WeChatPayToHybris = new HashMap<String, TransactionStatus>(); private TransactionStatusMap() { throw new IllegalAccessError("TransactionStatusMap class"); } public static Map<String, TransactionStatus> getWechatpaytohybris() { return WeChatPayToHybris; } static { WeChatPayToHybris.put("SUCCESS", TransactionStatus.ACCEPTED); WeChatPayToHybris.put("USERPAYING", TransactionStatus.REVIEW); WeChatPayToHybris.put("REFUND", TransactionStatus.REVIEW); WeChatPayToHybris.put("NOTPAY", TransactionStatus.REVIEW); WeChatPayToHybris.put("CLOSED", TransactionStatus.REJECTED); WeChatPayToHybris.put("REVOKED", TransactionStatus.REJECTED); WeChatPayToHybris.put("PAYERROR", TransactionStatus.ERROR); } } }
[ "juan.gonzalez.working@gmail.com" ]
juan.gonzalez.working@gmail.com
330e0e1d51050b49c9a3388b5a3591a8935dd8f4
93c99ee9770362d2917c9494fd6b6036487e2ebd
/server/decompiled_apps/2b7122657dcb75ede8840eff964dd94a/com.bankeen.ui.categorydetail/-$$Lambda$CategoryDetailActivity$qPyGkMc8eOHM1Nra1PEvAySiXw0.java
b1928bb29a1e866fb79aae24e86f5dbdb567cf2a
[]
no_license
YashJaveri/Satic-Analysis-Tool
e644328e50167af812cb2f073e34e6b32279b9ce
d6f3be7d35ded34c6eb0e38306aec0ec21434ee4
refs/heads/master
2023-05-03T14:29:23.611501
2019-06-24T09:01:23
2019-06-24T09:01:23
192,715,309
0
1
null
2023-04-21T20:52:07
2019-06-19T11:00:47
Smali
UTF-8
Java
false
false
597
java
package com.bankeen.ui.categorydetail; import io.reactivex.c.k; /* compiled from: lambda */ public final /* synthetic */ class -$$Lambda$CategoryDetailActivity$qPyGkMc8eOHM1Nra1PEvAySiXw0 implements k { public static final /* synthetic */ -$$Lambda$CategoryDetailActivity$qPyGkMc8eOHM1Nra1PEvAySiXw0 INSTANCE = new -$$Lambda$CategoryDetailActivity$qPyGkMc8eOHM1Nra1PEvAySiXw0(); private /* synthetic */ -$$Lambda$CategoryDetailActivity$qPyGkMc8eOHM1Nra1PEvAySiXw0() { } public final boolean test(Object obj) { return ("categoryDetail".equals((String) obj) ^ 1); } }
[ "root@localhost.localdomain" ]
root@localhost.localdomain
b710f0651dffff1467b6066bed44478604c5cc15
fa057b3fe67264872c5bc06297dd0100425853d4
/fuelmis/src/com/zhiren/fuelmis/dc/dao/jih/reback/RebackHetDao.java
fba7839143662c0858b79f0177ea5631f8982dee
[]
no_license
paddy235/gdhyc
5df6a6280403784e89f52649c7710e7224a18414
9ce5925636589a9f4f2bed5f1a2fe90cefd89119
refs/heads/master
2021-06-23T22:55:17.210623
2017-09-07T09:29:50
2017-09-07T09:29:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
283
java
package com.zhiren.fuelmis.dc.dao.jih.reback; import java.util.Map; import org.springframework.stereotype.Repository; /** * 合同审批回退dao * @author ZY * */ @Repository public interface RebackHetDao { @SuppressWarnings("rawtypes") public void rebackHet(Map map); }
[ "liu@qq.com" ]
liu@qq.com
31879d9a5cb9bff628b84b046893aed78c0c5f6f
bbe34278f3ed99948588984c431e38a27ad34608
/sources/android/support/v4/view/ViewGroupCompat.java
ddbfd91dda7db2083eb0afec60ac7dfaa919eeb2
[]
no_license
sapardo10/parcial-pruebas
7af500f80699697ab9b9291388541c794c281957
938a0ceddfc8e0e967a1c7264e08cd9d1fe192f0
refs/heads/master
2020-04-28T02:07:08.766181
2019-03-10T21:51:36
2019-03-10T21:51:36
174,885,553
0
0
null
null
null
null
UTF-8
Java
false
false
3,919
java
package android.support.v4.view; import android.os.Build.VERSION; import android.support.annotation.NonNull; import android.support.annotation.RequiresApi; import android.support.compat.C0032R; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; public final class ViewGroupCompat { static final ViewGroupCompatBaseImpl IMPL; public static final int LAYOUT_MODE_CLIP_BOUNDS = 0; public static final int LAYOUT_MODE_OPTICAL_BOUNDS = 1; static class ViewGroupCompatBaseImpl { ViewGroupCompatBaseImpl() { } public int getLayoutMode(ViewGroup group) { return 0; } public void setLayoutMode(ViewGroup group, int mode) { } public void setTransitionGroup(ViewGroup group, boolean isTransitionGroup) { group.setTag(C0032R.id.tag_transition_group, Boolean.valueOf(isTransitionGroup)); } public boolean isTransitionGroup(ViewGroup group) { Boolean explicit = (Boolean) group.getTag(C0032R.id.tag_transition_group); if (explicit != null) { if (explicit.booleanValue()) { return true; } } if (group.getBackground() == null) { if (ViewCompat.getTransitionName(group) == null) { return false; } } return true; } public int getNestedScrollAxes(ViewGroup group) { if (group instanceof NestedScrollingParent) { return ((NestedScrollingParent) group).getNestedScrollAxes(); } return 0; } } @RequiresApi(18) static class ViewGroupCompatApi18Impl extends ViewGroupCompatBaseImpl { ViewGroupCompatApi18Impl() { } public int getLayoutMode(ViewGroup group) { return group.getLayoutMode(); } public void setLayoutMode(ViewGroup group, int mode) { group.setLayoutMode(mode); } } @RequiresApi(21) static class ViewGroupCompatApi21Impl extends ViewGroupCompatApi18Impl { ViewGroupCompatApi21Impl() { } public void setTransitionGroup(ViewGroup group, boolean isTransitionGroup) { group.setTransitionGroup(isTransitionGroup); } public boolean isTransitionGroup(ViewGroup group) { return group.isTransitionGroup(); } public int getNestedScrollAxes(ViewGroup group) { return group.getNestedScrollAxes(); } } static { if (VERSION.SDK_INT >= 21) { IMPL = new ViewGroupCompatApi21Impl(); } else if (VERSION.SDK_INT >= 18) { IMPL = new ViewGroupCompatApi18Impl(); } else { IMPL = new ViewGroupCompatBaseImpl(); } } private ViewGroupCompat() { } @Deprecated public static boolean onRequestSendAccessibilityEvent(ViewGroup group, View child, AccessibilityEvent event) { return group.onRequestSendAccessibilityEvent(child, event); } @Deprecated public static void setMotionEventSplittingEnabled(ViewGroup group, boolean split) { group.setMotionEventSplittingEnabled(split); } public static int getLayoutMode(ViewGroup group) { return IMPL.getLayoutMode(group); } public static void setLayoutMode(ViewGroup group, int mode) { IMPL.setLayoutMode(group, mode); } public static void setTransitionGroup(ViewGroup group, boolean isTransitionGroup) { IMPL.setTransitionGroup(group, isTransitionGroup); } public static boolean isTransitionGroup(ViewGroup group) { return IMPL.isTransitionGroup(group); } public static int getNestedScrollAxes(@NonNull ViewGroup group) { return IMPL.getNestedScrollAxes(group); } }
[ "sa.pardo10@uniandes.edu.co" ]
sa.pardo10@uniandes.edu.co
2755db82323337e66e8f99a898df510bf65acac9
180e78725121de49801e34de358c32cf7148b0a2
/dataset/protocol1/repairnator/learning/1919/BuildShouldPass.java
a5962962226ac672b7bdd1b08bbd105cd63a19e9
[]
no_license
ASSERT-KTH/synthetic-checkstyle-error-dataset
40e8d1e0a7ebe7f7711def96a390891a6922f7bd
40c057e1669584bfc6fecf789b5b2854660222f3
refs/heads/master
2023-03-18T12:50:55.410343
2019-01-25T09:54:39
2019-01-25T09:54:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,362
java
package fr.inria.spirals.repairnator.process.step.gatherinfo; import fr.inria.spirals.repairnator.process.step.StepStatus; import fr.inria.spirals.repairnator.states.LauncherMode; import fr.inria.spirals.repairnator.states.PipelineState; import fr.inria.spirals.repairnator.states.ScannedBuildStatus; import fr.inria.spirals.repairnator.config.RepairnatorConfig; import fr.inria.spirals.repairnator.process.inspectors.ProjectInspector; import fr.inria.spirals.repairnator.process.inspectors.ProjectInspector4Bears; /** * Created by fermadeiral. */ public class BuildShouldPass implements ContractForGatherTestInformation { @Override public StepStatus shouldBeStopped(GatherTestInformation gatherTestInformation) { ProjectInspector inspector = gatherTestInformation.getInspector(); if (gatherTestInformation.getNbFailingTests() + gatherTestInformation.getNbErroringTests() == 0 && gatherTestInformation.getNbRunningTests() > 0) { if (RepairnatorConfig.getInstance().getLauncherMode() == LauncherMode.BEARS && inspector instanceof ProjectInspector4Bears) { if (inspector.getBuildToBeInspected().getStatus() == ScannedBuildStatus.FAILING_AND_PASSING) { // So, 1) the current passing build can be reproduced and 2) its previous build is a failing build // with failing tests and it can also be reproduced ((ProjectInspector4Bears) inspector).setBug(true, PipelineState.BUG_FAILING_PASSING.name()); } else if (inspector.getBuildToBeInspected().getStatus() == ScannedBuildStatus.PASSING_AND_PASSING_WITH_TEST_CHANGES) { // So, 1) the current passing build can be reproduced and 2) its previous build is a passing build // that fails when tested with new tests and it can also be reproduced ((ProjectInspector4Bears) inspector).setBug(true, PipelineState.BUG_PASSING_PASSING.name()); } } return StepStatus.buildSuccess(gatherTestInformation); } if (gatherTestInformation.getNbRunningTests() == 0) { return StepStatus.buildError(gatherTestInformation, PipelineState.TESTERRORS); } else { return StepStatus.buildError(gatherTestInformation, PipelineState.TESTFAILURES); } } }
[ "bloriot97@gmail.com" ]
bloriot97@gmail.com
9a44746d5a6ad979c0408ac78ec097eb8de1a86c
99de3430565ec81e350b9a229ccb2fae99e5882c
/sg-zhixiu-app/src/main/java/com/zhixiu/app/tools/TaskJob.java
16d8b9a5ecdf7765a70bd1bc454c31a220ac2808
[]
no_license
yelantingfengyu/sg-zhixiu-backend
306310a98ec7815955d8cab48535968c7de5d0f4
f389f0720024b865f13bed5f3e7c74762cfc91a9
refs/heads/master
2022-11-08T02:57:15.581622
2020-06-12T06:46:57
2020-06-12T06:46:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,526
java
package com.zhixiu.app.tools; import java.lang.reflect.Method; import java.util.Map; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import com.zhixiu.app.model.TimerTaskPolicy; import com.zhixiu.app.util.SpringBeanUtil; /** * 自定义的任务类,负责处理执行的任务细节 * * @author : Administrator * @since : 2019年8月13日 下午3:39:29 * @see : */ @Component("taskJob") @Order(4) public class TaskJob implements Job { // @Autowired // @Order(3) // private CodeCoverageService codeCoverageService; @Autowired @Order(3) // private PipeLineService pipeLineService; private static final char SEP = '.'; private static Logger logger = LoggerFactory.getLogger(TaskJob.class); @Override public void execute(JobExecutionContext arg0) throws JobExecutionException { Object taskPloyObj = arg0.getJobDetail().getJobDataMap() .get(TaskDefine.TASK_POLICY_KEY); Object params = arg0.getJobDetail().getJobDataMap() .get(TaskDefine.OTHER_PARAMS_KEY); Map<String, Object> paramsKeyMap = null; if (params instanceof Map) { paramsKeyMap = (Map) params; } TimerTaskPolicy taskPloy = null; if (null != taskPloyObj && taskPloyObj instanceof TimerTaskPolicy) { taskPloy = (TimerTaskPolicy) taskPloyObj; // if (null != paramsKeyMap && !paramsKeyMap.entrySet().isEmpty()) { // logger.debug("传入的参数为:{}", paramsKeyMap); // executePloyWithOtherParams(taskPloy, paramsKeyMap); // } else { executePloy(taskPloy); // } } else { logger.error("策略为空"); } } private void executePloy(TimerTaskPolicy taskPolicy) { try { String code = taskPolicy.getCode(); logger.info("策略代码:{}", code); String domain = code.substring(0, code.lastIndexOf(SEP)); String method = code.substring(code.lastIndexOf(SEP) + 1); Object clazz = SpringBeanUtil.getBeanFromSpringByBeanName(domain); Method m = clazz.getClass().getMethod(method); m.invoke(clazz); } catch (Exception e) { logger.error("job执行错误", e); } } // /** // * 执行带有参数的任务 // * // * @see : // * @param : // * @return : void // * @param taskPolicy // * @param otherParams // */ // private void executePloyWithOtherParams(TimerTaskPolicy taskPolicy, // Map<String, Object> otherParams) { // try { // String code = taskPolicy.getCode(); // logger.info("策略代码:{}", code); // String domain = code.substring(0, code.lastIndexOf(SEP)); // String method = code.substring(code.lastIndexOf(SEP) + 1); // Object clazz = SpringBeanUtil.getBeanFromSpringByBeanName(domain); // // /** // * 判断是不是覆盖率信息来的数据 // */ // if (otherParams.containsKey(TaskDefine.CODE_COVERAGER_ID_KEY)) { // // Method m = clazz.getClass().getMethod(method, // // CodeCoverage.class); // // String objectValue = (String) otherParams // // .getOrDefault(TaskDefine.CODE_COVERAGER_ID_KEY, null); // // // // logger.debug("当前的参数列表:{}", otherParams); // // logger.debug("参数中有没有codeCoverageId:{}", otherParams // // .containsKey(TaskDefine.CODE_COVERAGER_ID_KEY)); // // logger.debug("获取到的codeCoverageId为:{}", objectValue); // // // // if (StringUtil.isEmpty(objectValue)) { // // logger.debug("没有找到codeCoverageId,不执行任务"); // // return; // // } // // // // codeCoverageService = (CodeCoverageService) SpringBeanUtil // // .getBeanFromSpringByBeanName("codeCoverageService"); // // // // Long codeCoverageInfoId = Long.parseLong(objectValue); // // CodeCoverage codeCoverage = codeCoverageService // // .getCodeCoverageById(codeCoverageInfoId); // // // // if (StringUtil.isEmpty(objectValue)) { // // logger.debug("没有找到codeCoverageId为:{}的覆盖率信息,不执行任务", // // codeCoverageInfoId); // // return; // // } // // m.invoke(clazz, codeCoverage); // } else if (otherParams.containsKey(TaskDefine.PIPELINE_ID_KEY)) { // // Method m = clazz.getClass().getMethod(method, // // PipeLine.class); // // String objectValue = (String) otherParams // // .getOrDefault(TaskDefine.PIPELINE_ID_KEY, null); // // // // logger.debug("当前的参数列表:{}", otherParams); // // logger.debug("参数中有没有pipeLineId:{}", // // otherParams.containsKey(TaskDefine.PIPELINE_ID_KEY)); // // logger.debug("获取到的pipeLineId为:{}", objectValue); // // // // if (StringUtil.isEmpty(objectValue)) { // // logger.debug("没有找到codeCoverageId,不执行任务"); // // return; // // } // // // // pipeLineService = (PipeLineService) SpringBeanUtil // // .getBeanFromSpringByBeanName("pipeLineService"); // // // // Long pipeLineId = Long.parseLong(objectValue); // // PipeLine pipeLine = // // pipeLineService.getPipeLineById(pipeLineId); // // // // if (StringUtil.isEmpty(objectValue)) { // // logger.debug("没有找到pipeLineId为:{}的流水线信息,不执行任务", pipeLineId); // // return; // // } // // m.invoke(clazz, pipeLine); // } else { // Method m = clazz.getClass().getMethod(method, // CodeCoverage.class); // m.invoke(clazz); // } // // } catch (Exception e) { // logger.error("job执行错误", e); // throw new BusinessValidationException("job执行异常"); // } // } }
[ "sunlpmail@126.com" ]
sunlpmail@126.com
b29726be238d131303d0d11bb6f8347b986ec5b2
bb2e9ea7f9a1f90d2aab061f5e3dae5373765bca
/src/main/java/ar/com/kfgodel/function/boxed/shorts/BoxedShortToObjectFunction.java
149821342e66c2b75efb211153fa14064df94d0b
[ "Apache-2.0" ]
permissive
kfgodel/extended-functions
85f9bb056f7e67aa5297b28930a169773ee8b5fb
990b31353a4f9adab2d70ed0b3464706c65fa75c
refs/heads/master
2021-01-01T20:18:51.712928
2019-10-13T02:00:12
2019-10-13T02:00:12
98,808,487
0
0
null
null
null
null
UTF-8
Java
false
false
238
java
package ar.com.kfgodel.function.boxed.shorts; import ar.com.kfgodel.function.objects.ObjectToObjectFunction; /** * Date: 29/07/17 - 19:57 */ public interface BoxedShortToObjectFunction<O> extends ObjectToObjectFunction<Short, O> { }
[ "dario.garcia@10pines.com" ]
dario.garcia@10pines.com
c7a03b5512f2c1044d926b4660c2c08d38e4e074
7648cbb3c77a33387f2d00a571b9e01bcf01b7a2
/live-admin/src/com/tinypig/newadmin/web/dao/AdminMenuDao.java
4d128759df882fdd0aa53732af55d610e00fec50
[]
no_license
dawei134679/live
2ea806cff38b0c763f6e7345eb208068dffeff68
ded58b6aeb47af8049ac0cd516a5fad262f3775f
refs/heads/master
2020-04-20T04:28:27.064707
2019-02-01T02:24:50
2019-02-01T02:31:19
168,628,885
1
0
null
null
null
null
UTF-8
Java
false
false
534
java
package com.tinypig.newadmin.web.dao; import java.util.List; import com.tinypig.newadmin.web.entity.AdminMenu; import com.tinypig.newadmin.web.entity.AdminMenuDto; public interface AdminMenuDao { int deleteByPrimaryKey(Integer mid); int insert(AdminMenu record); int insertSelective(AdminMenu record); AdminMenu selectByPrimaryKey(Integer mid); int updateByPrimaryKeySelective(AdminMenu record); int updateByPrimaryKey(AdminMenu record); AdminMenu selectByUrl(String url); List<AdminMenuDto> getListById(Long mid); }
[ "532231254@qq.com" ]
532231254@qq.com
1462915dd8cb326d7a2a453e4753fa6a9d8a0866
5f0a50515cb066a89f97ec5aed956c8e948f506b
/src/com/igeek/javase/day17/syn/ticket/Ticket.java
3d5ad1ef731185c9f46c3f54a298c42f40dfdcb9
[]
no_license
Team89s/javase
3617b1b620c839775f7a1500dcb519397960a94b
eb6dcfa6ec35b00e0bffbec2c7d97105ea14853a
refs/heads/master
2023-04-12T18:13:08.394061
2021-04-24T16:22:52
2021-04-24T16:22:52
361,207,239
0
0
null
null
null
null
UTF-8
Java
false
false
742
java
package com.igeek.javase.day17.syn.ticket; /** * @version 1.0 * @Description TODO * @Author chenmin * @Date 2020/12/1 10:02 */ public class Ticket implements Runnable { private int ticketId = 100; @Override public void run() { while (true){ if(ticketId==0){ break; } sellTicket(); } } public synchronized void sellTicket(){ if(ticketId>0){ try { Thread.sleep(30); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(Thread.currentThread().getName()+"购票成功,购票号为"+ticketId); ticketId--; } } }
[ "270144864@qq.com" ]
270144864@qq.com
e0fc531f8160445b5507fc65282513f09ada36c5
56d68a1ea5202f72b68d973d9401b3bd437b91f6
/examples/src/main/java/com/google/cloud/dataflow/examples/DebuggingWordCount.java
6bc7185a5a7a5d9665d1e5d02c149b93bcfa4801
[ "Apache-2.0" ]
permissive
PieterDM/DataflowJavaSDK
e2028b35adee43365f6098a7d034fdcd9de38098
53df71275fcf32dddde29a39230946d020590fb2
refs/heads/master
2021-01-22T12:26:21.186675
2015-08-11T11:05:26
2015-08-11T11:05:26
34,113,529
0
0
null
2015-04-17T11:44:23
2015-04-17T11:44:23
null
UTF-8
Java
false
false
7,802
java
/* * Copyright (C) 2015 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.google.cloud.dataflow.examples; import com.google.cloud.dataflow.examples.WordCount.WordCountOptions; import com.google.cloud.dataflow.sdk.Pipeline; import com.google.cloud.dataflow.sdk.io.TextIO; import com.google.cloud.dataflow.sdk.options.PipelineOptionsFactory; import com.google.cloud.dataflow.sdk.testing.DataflowAssert; import com.google.cloud.dataflow.sdk.transforms.Aggregator; import com.google.cloud.dataflow.sdk.transforms.DoFn; import com.google.cloud.dataflow.sdk.transforms.ParDo; import com.google.cloud.dataflow.sdk.transforms.Sum; import com.google.cloud.dataflow.sdk.values.KV; import com.google.cloud.dataflow.sdk.values.PCollection; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Arrays; import java.util.List; import java.util.regex.Pattern; /** * An example that verifies word counts in Shakespeare and includes Dataflow best practices. * * <p> This class, {@link DebuggingWordCount}, is the third in a series of four successively more * detailed 'word count' examples. You may first want to take a look at {@link MinimalWordCount} * and {@link WordCount}. After you've looked at this example, then see the * {@link WindowedWordCount} pipeline, for introduction of additional concepts. * * <p> Basic concepts, also in the MinimalWordCount and WordCount examples: * Reading text files; counting a PCollection; executing a Pipeline both locally * and using the Dataflow service; defining DoFns. * * <p> New Concepts: * <pre> * 1. Logging to Cloud Logging * 2. Controlling Dataflow worker log levels * 3. Creating a custom aggregator * 4. Testing your Pipeline via DataflowAssert * </pre> * * <p> To execute this pipeline locally, specify general pipeline configuration: * <pre>{@code * --project=YOUR_PROJECT_ID * } * </pre> * * <p> To execute this pipeline using the Dataflow service, specify pipeline configuration: * <pre>{@code * --project=YOUR_PROJECT_ID * --stagingLocation=gs://YOUR_STAGING_DIRECTORY * --runner=BlockingDataflowPipelineRunner * } * </pre> * * <p> Concept #2: Dataflow workers which execute user code are configured to log to Cloud * Logging by default at "INFO" log level and higher. One may override log levels for specific * logging namespaces by specifying: * <pre><code> * --workerLogLevelOverrides={"Name1":"Level1","Name2":"Level2",...} * </code></pre> * For example, by specifying: * <pre><code> * --workerLogLevelOverrides={"com.google.cloud.dataflow.examples":"DEBUG"} * </code></pre> * when executing this pipeline using the Dataflow service, Cloud Logging would contain only * "DEBUG" or higher level logs for the {@code com.google.cloud.dataflow.examples} package in * addition to the default "INFO" or higher level logs. In addition, the default Dataflow worker * logging configuration can be overridden by specifying * {@code --defaultWorkerLogLevel=<one of TRACE, DEBUG, INFO, WARN, ERROR>}. For example, * by specifying {@code --defaultWorkerLogLevel=DEBUG} when executing this pipeline with * the Dataflow service, Cloud Logging would contain all "DEBUG" or higher level logs. Note * that changing the default worker log level to TRACE or DEBUG will significantly increase * the amount of logs output. * * <p> The input file defaults to {@code gs://dataflow-samples/shakespeare/kinglear.txt} and can be * overridden with {@code --inputFile}. */ public class DebuggingWordCount { /** A DoFn that filters for a specific key based upon a regular expression. */ public static class FilterTextFn extends DoFn<KV<String, Long>, KV<String, Long>> { private static final long serialVersionUID = 0; /** * Concept #1: The logger below uses the fully qualified class name of FilterTextFn * as the logger. All log statements emitted by this logger will be referenced by this name * and will be visible in the Cloud Logging UI. Learn more at https://cloud.google.com/logging * about the Cloud Logging UI. */ private static final Logger LOG = LoggerFactory.getLogger(FilterTextFn.class); private final Pattern filter; public FilterTextFn(String pattern) { filter = Pattern.compile(pattern); } /** * Concept #3: A custom aggregator can track values in your pipeline as it runs. Those * values will be displayed in the Dataflow Monitoring UI when this pipeline is run using the * Dataflow service. These aggregators below track the number of matched and unmatched words. * Learn more at https://cloud.google.com/dataflow/pipelines/dataflow-monitoring-intf about * the Dataflow Monitoring UI. */ private final Aggregator<Long, Long> matchedWords = createAggregator("matchedWords", new Sum.SumLongFn()); private final Aggregator<Long, Long> unmatchedWords = createAggregator("umatchedWords", new Sum.SumLongFn()); @Override public void processElement(ProcessContext c) { if (filter.matcher(c.element().getKey()).matches()) { // Log at the "DEBUG" level each element that we match. When executing this pipeline // using the Dataflow service, these log lines will appear in the Cloud Logging UI // only if the log level is set to "DEBUG" or lower. LOG.debug("Matched: " + c.element().getKey()); matchedWords.addValue(1L); c.output(c.element()); } else { // Log at the "TRACE" level each element that is not matched. Different log levels // can be used to control the verbosity of logging providing an effective mechanism // to filter less important information. LOG.trace("Did not match: " + c.element().getKey()); unmatchedWords.addValue(1L); } } } public static void main(String[] args) { WordCountOptions options = PipelineOptionsFactory.fromArgs(args).withValidation() .as(WordCountOptions.class); Pipeline p = Pipeline.create(options); PCollection<KV<String, Long>> filteredWords = p.apply(TextIO.Read.named("ReadLines").from(options.getInputFile())) .apply(new WordCount.CountWords()) .apply(ParDo.of(new FilterTextFn("Flourish|stomach"))); /** * Concept #4: DataflowAssert is a set of convenient PTransforms in the style of * Hamcrest's collection matchers that can be used when writing Pipeline level tests * to validate the contents of PCollections. DataflowAssert is best used in unit tests * with small data sets but is demonstrated here as a teaching tool. * * <p> Below we verify that the set of filtered words matches our expected counts. Note * that DataflowAssert does not provide any output and that successful completion of the * Pipeline implies that the expectations were met. Learn more at * https://cloud.google.com/dataflow/pipelines/testing-your-pipeline on how to test * your Pipeline and see {@link DebuggingWordCountTest} for an example unit test. */ List<KV<String, Long>> expectedResults = Arrays.asList( KV.of("Flourish", 3L), KV.of("stomach", 1L)); DataflowAssert.that(filteredWords).containsInAnyOrder(expectedResults); p.run(); } }
[ "davorbonaci@users.noreply.github.com" ]
davorbonaci@users.noreply.github.com
f5d7e4e020e612aeb3d47642590ca2691c5cefd5
d39ccf65250d04d5f7826584a06ee316babb3426
/wb-mmb/wb-foundation/src/main/java/org/dwfa/bpa/gui/SpringUtilities.java
6d3f92699e711c35aced5371040f9a733be3aa90
[ "Apache-2.0" ]
permissive
va-collabnet-archive/workbench
ab4c45504cf751296070cfe423e39d3ef2410287
d57d55cb30172720b9aeeb02032c7d675bda75ae
refs/heads/master
2021-01-10T02:02:09.685099
2012-01-25T19:15:44
2012-01-25T19:15:44
47,691,158
0
0
null
null
null
null
UTF-8
Java
false
false
7,961
java
/** * Copyright (c) 2009 International Health Terminology Standards Development * Organisation * * 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.dwfa.bpa.gui; import java.awt.Component; import java.awt.Container; import javax.swing.Spring; import javax.swing.SpringLayout; /** * A 1.4 file that provides utility methods for * creating form- or grid-style layouts with SpringLayout. * These utilities are used by several programs, such as * SpringBox and SpringCompactGrid. * * From http://java.sun.com/docs/books/tutorial/uiswing/layout/examples/ * SpringUtilities.java * */ public class SpringUtilities { /** * A debugging utility that prints to stdout the component's * minimum, preferred, and maximum sizes. */ public static void printSizes(Component c) { System.out.println("minimumSize = " + c.getMinimumSize()); System.out.println("preferredSize = " + c.getPreferredSize()); System.out.println("maximumSize = " + c.getMaximumSize()); } /** * Aligns the first <code>rows</code> * <code>cols</code> components of * <code>parent</code> in * a grid. Each component is as big as the maximum * preferred width and height of the components. * The parent is made just big enough to fit them all. * * @param rows number of rows * @param cols number of columns * @param initialX x location to start the grid at * @param initialY y location to start the grid at * @param xPad x padding between cells * @param yPad y padding between cells */ public static void makeGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad) { SpringLayout layout; try { layout = (SpringLayout) parent.getLayout(); } catch (ClassCastException exc) { System.err.println("The first argument to makeGrid must use SpringLayout."); return; } Spring xPadSpring = Spring.constant(xPad); Spring yPadSpring = Spring.constant(yPad); Spring initialXSpring = Spring.constant(initialX); Spring initialYSpring = Spring.constant(initialY); int max = rows * cols; // Calculate Springs that are the max of the width/height so that all // cells have the same size. Spring maxWidthSpring = layout.getConstraints(parent.getComponent(0)).getWidth(); Spring maxHeightSpring = layout.getConstraints(parent.getComponent(0)).getWidth(); for (int i = 1; i < max; i++) { SpringLayout.Constraints cons = layout.getConstraints(parent.getComponent(i)); maxWidthSpring = Spring.max(maxWidthSpring, cons.getWidth()); maxHeightSpring = Spring.max(maxHeightSpring, cons.getHeight()); } // Apply the new width/height Spring. This forces all the // components to have the same size. for (int i = 0; i < max; i++) { SpringLayout.Constraints cons = layout.getConstraints(parent.getComponent(i)); cons.setWidth(maxWidthSpring); cons.setHeight(maxHeightSpring); } // Then adjust the x/y constraints of all the cells so that they // are aligned in a grid. SpringLayout.Constraints lastCons = null; SpringLayout.Constraints lastRowCons = null; for (int i = 0; i < max; i++) { SpringLayout.Constraints cons = layout.getConstraints(parent.getComponent(i)); if (i % cols == 0) { // start of new row lastRowCons = lastCons; cons.setX(initialXSpring); } else { // x position depends on previous component cons.setX(Spring.sum(lastCons.getConstraint(SpringLayout.EAST), xPadSpring)); } if (i / cols == 0) { // first row cons.setY(initialYSpring); } else { // y position depends on previous row cons.setY(Spring.sum(lastRowCons.getConstraint(SpringLayout.SOUTH), yPadSpring)); } lastCons = cons; } // Set the parent's size. SpringLayout.Constraints pCons = layout.getConstraints(parent); pCons.setConstraint(SpringLayout.SOUTH, Spring.sum(Spring.constant(yPad), lastCons.getConstraint(SpringLayout.SOUTH))); pCons.setConstraint(SpringLayout.EAST, Spring.sum(Spring.constant(xPad), lastCons.getConstraint(SpringLayout.EAST))); } /* Used by makeCompactGrid. */ private static SpringLayout.Constraints getConstraintsForCell(int row, int col, Container parent, int cols) { SpringLayout layout = (SpringLayout) parent.getLayout(); Component c = parent.getComponent(row * cols + col); return layout.getConstraints(c); } /** * Aligns the first <code>rows</code> * <code>cols</code> components of * <code>parent</code> in * a grid. Each component in a column is as wide as the maximum * preferred width of the components in that column; * height is similarly determined for each row. * The parent is made just big enough to fit them all. * * @param rows number of rows * @param cols number of columns * @param initialX x location to start the grid at * @param initialY y location to start the grid at * @param xPad x padding between cells * @param yPad y padding between cells */ public static void makeCompactGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad) { SpringLayout layout; try { layout = (SpringLayout) parent.getLayout(); } catch (ClassCastException exc) { System.err.println("The first argument to makeCompactGrid must use SpringLayout."); return; } // Align all cells in each column and make them the same width. Spring x = Spring.constant(initialX); for (int c = 0; c < cols; c++) { Spring width = Spring.constant(0); for (int r = 0; r < rows; r++) { width = Spring.max(width, getConstraintsForCell(r, c, parent, cols).getWidth()); } for (int r = 0; r < rows; r++) { SpringLayout.Constraints constraints = getConstraintsForCell(r, c, parent, cols); constraints.setX(x); constraints.setWidth(width); } x = Spring.sum(x, Spring.sum(width, Spring.constant(xPad))); } // Align all cells in each row and make them the same height. Spring y = Spring.constant(initialY); for (int r = 0; r < rows; r++) { Spring height = Spring.constant(0); for (int c = 0; c < cols; c++) { height = Spring.max(height, getConstraintsForCell(r, c, parent, cols).getHeight()); } for (int c = 0; c < cols; c++) { SpringLayout.Constraints constraints = getConstraintsForCell(r, c, parent, cols); constraints.setY(y); constraints.setHeight(height); } y = Spring.sum(y, Spring.sum(height, Spring.constant(yPad))); } // Set the parent's size. SpringLayout.Constraints pCons = layout.getConstraints(parent); pCons.setConstraint(SpringLayout.SOUTH, y); pCons.setConstraint(SpringLayout.EAST, x); } }
[ "wsmoak" ]
wsmoak
5ae5f938c1f36596cc9457abde5ec3875f3eae4a
41cef1fd08d371acba6b716d3c9071aae5c60cce
/src/main/java/io/jhipster/application/security/OAuth2AuthenticationSuccessHandler.java
2e6e540d80ede2aac4cafe9fec0c80288ee8e0b7
[]
no_license
alfaprima/jhipsterSample
9512f9bb96aac5afca1290c70b4af08d74358750
ae7c92164d3c7c3ed6777ac33d3b455a328dbd27
refs/heads/master
2021-04-06T13:21:25.825609
2018-03-15T17:24:24
2018-03-15T17:24:24
125,402,824
0
0
null
null
null
null
UTF-8
Java
false
false
2,601
java
package io.jhipster.application.security; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.Authentication; import org.springframework.security.web.DefaultRedirectStrategy; import org.springframework.security.web.RedirectStrategy; import org.springframework.security.web.WebAttributes; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; import static io.jhipster.application.config.OAuth2Configuration.SAVED_LOGIN_ORIGIN_URI; /** * AuthenticationSuccessHandler that looks for a saved login origin and redirects to it if it exists. */ public class OAuth2AuthenticationSuccessHandler implements AuthenticationSuccessHandler { private final Logger log = LoggerFactory.getLogger(OAuth2AuthenticationSuccessHandler.class); private RedirectStrategy redirectStrategy = new DefaultRedirectStrategy(); @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException { handle(request, response); clearAuthenticationAttributes(request); } private void handle(HttpServletRequest request, HttpServletResponse response) throws IOException { String targetUrl = determineTargetUrl(request); if (response.isCommitted()) { log.error("Response has already been committed. Unable to redirect to " + targetUrl); return; } redirectStrategy.sendRedirect(request, response, targetUrl); } private String determineTargetUrl(HttpServletRequest request) { Object savedReferrer = request.getSession().getAttribute(SAVED_LOGIN_ORIGIN_URI); if (savedReferrer != null) { String savedLoginOrigin = request.getSession().getAttribute(SAVED_LOGIN_ORIGIN_URI).toString(); log.debug("Redirecting to saved login origin URI: {}", savedLoginOrigin); request.getSession().removeAttribute(SAVED_LOGIN_ORIGIN_URI); return savedLoginOrigin; } else { return "/"; } } private void clearAuthenticationAttributes(HttpServletRequest request) { HttpSession session = request.getSession(false); if (session == null) { return; } session.removeAttribute(WebAttributes.AUTHENTICATION_EXCEPTION); } }
[ "jhipster-bot@users.noreply.github.com" ]
jhipster-bot@users.noreply.github.com
042725a6395f047799d5ffee4ec9a024303102db
cdb8c9b262c191744985f684257d1ae79c22562c
/fxqpmanager/src/main/java/com/hsic/adapter/DragDelListAdaper.java
ced43d49839250e974dbfd743493d6d63d7a6161
[]
no_license
ttttmmmmjjjj/syall
6b6c027636f0fbd56bfc70ebad02adc6f9cf7e9a
dcb6c84b42c4f732ccfa54c0e8e9aa03b9fe18a0
refs/heads/master
2021-01-02T16:12:16.694595
2019-04-28T07:26:26
2019-04-28T07:26:59
239,697,395
0
0
null
null
null
null
UTF-8
Java
false
false
3,306
java
package com.hsic.adapter; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.widget.BaseAdapter; import android.widget.RelativeLayout; import android.widget.TextView; import com.hsic.bean.UserReginCode; import com.hsic.fxqpmanager.R; import com.hsic.sy.dragdellistview.DragDelItem; import java.util.List; /** * Created by Administrator on 2018/8/29. */ public class DragDelListAdaper extends BaseAdapter { List<UserReginCode> UserReginCode_List; private Context context; public DragDelListAdaper(Context context, List<UserReginCode> UserReginCode_List){ this.context=context; this.UserReginCode_List=UserReginCode_List; } @Override public int getCount() { if(UserReginCode_List.size()>0){ return UserReginCode_List.size(); } return 0; } @Override public Object getItem(int i) { return null; } @Override public long getItemId(int i) { return 0; } @Override public void notifyDataSetChanged() { // TODO Auto-generated method stub super.notifyDataSetChanged(); } @Override public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder=null; View menuView=null; if (convertView == null) { convertView = View.inflate(context, R.layout.swipecontent, null); menuView = View.inflate(context, R.layout.swipemenu, null); convertView = new DragDelItem(convertView,menuView); holder=new ViewHolder(convertView); } else { holder = (ViewHolder) convertView.getTag(); } holder.tv_name.setText(UserReginCode_List.get(position).getUserRegionCode()+"\b\b\b\b\b\b\b\b"+UserReginCode_List.get(position).getQpName()+""); holder.tv_del.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { //进行发车,作废,结束车次等操作 String userRegionCode=UserReginCode_List.get(position).getUserRegionCode(); int i=UserReginCode_List.size(); for(int a=0;a<i;a++){ if(userRegionCode.equals(UserReginCode_List.get(a).getUserRegionCode())){ UserReginCode_List.remove(a); notifyDataSetChanged(); break; } } } }); return convertView; } class ViewHolder { TextView tv_name; TextView tv_del; RelativeLayout relativeLayout; public ViewHolder(View view) { tv_name = (TextView) view.findViewById(R.id.tv_name); tv_del=(TextView)view.findViewById(R.id.tv_del); relativeLayout = (RelativeLayout) view.findViewById(R.id.rl_layout); //改变relativeLayout宽度 WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); int width = wm.getDefaultDisplay().getWidth(); relativeLayout.setMinimumWidth(width-60); view.setTag(this); } } }
[ "ttttmmmmjjjj@sina.com" ]
ttttmmmmjjjj@sina.com
46fd6dc2cac04ec891b11121211cc692ee4b5f27
2da39b9c4579c0c27832733b57069680f9a31ab3
/src/main/java/exam04_zarovizsga/hu/nive/ujratervezes/zarovizsga/dogtypes/DogTypes.java
e2e55ff6a6cf4fe775f0ae487575872bf91a2eba
[]
no_license
exylaci/training-solutions
783874ae3f15f19cf183ae0c3f74fb88de53bc51
41ce082de1cc6b7bf901931445b6422b4ae8df64
refs/heads/master
2023-08-05T19:13:27.021645
2021-10-13T16:47:23
2021-10-13T16:47:23
309,077,220
1
4
null
null
null
null
UTF-8
Java
false
false
1,423
java
package exam04_zarovizsga.hu.nive.ujratervezes.zarovizsga.dogtypes; import javax.sql.DataSource; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; public class DogTypes { private DataSource source; public DogTypes(DataSource source) { this.source = source; } public List<String> getDogsByCountry(String country) { try (Connection connection = source.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement( "SELECT LOWER(name) AS name FROM dog_types WHERE LOWER(country)=LOWER(?) ORDER BY name")) { preparedStatement.setString(1, country); return getNames(preparedStatement); } catch (SQLException e) { throw new IllegalStateException("Cannot connect to the database!", e); } } private List<String> getNames(PreparedStatement preparedStatement) { try (ResultSet resultSet = preparedStatement.executeQuery()) { List<String> names = new ArrayList<>(); while (resultSet.next()) { names.add(resultSet.getString("name")); } return names; } catch (SQLException e) { throw new IllegalStateException("Cannot read from the database!", e); } } }
[ "exy@freemail.hu" ]
exy@freemail.hu
813331559d06c4c6a3dd18d854e914ed5ed107ad
fd4a1ae2595798fd06b73c2d888749f8c248c8a5
/core/jwt-auth/src/main/java/io/thorntail/jwt/auth/impl/undertow/JWTAuthMechanism.java
fa685962e75422ea1b7e99b53080229d7951a014
[ "Apache-2.0" ]
permissive
dandreadis/thorntail
f0bc9697780d5e1c866bd917cac3ff408cd50bdc
1d243697b9bb74e2acf308357bfa16f5558535d5
refs/heads/master
2020-03-16T23:45:55.988465
2018-05-07T15:23:07
2018-05-07T15:23:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,573
java
package io.thorntail.jwt.auth.impl.undertow; import java.security.Principal; import java.security.acl.Group; import java.util.List; import java.util.Locale; import java.util.Optional; import javax.security.auth.Subject; import io.thorntail.jwt.auth.impl.JWTAuthContextInfo; import io.thorntail.jwt.auth.impl.JsonWebTokenProducer; import io.thorntail.jwt.auth.impl.jaas.JWTCredential; import io.undertow.UndertowLogger; import io.undertow.security.api.AuthenticationMechanism; import io.undertow.security.api.SecurityContext; import io.undertow.security.idm.Account; import io.undertow.security.idm.IdentityManager; import io.undertow.server.HttpServerExchange; import org.eclipse.microprofile.jwt.JsonWebToken; //import org.wildfly.swarm.microprofile.jwtauth.deployment.principal.JWTAuthContextInfo; //import org.wildfly.swarm.microprofile.jwtauth.deployment.auth.cdi.MPJWTProducer; //import org.wildfly.swarm.microprofile.jwtauth.deployment.auth.jaas.JWTCredential; import org.jboss.security.SecurityConstants; import org.jboss.security.identity.RoleGroup; import org.jboss.security.identity.plugins.SimpleRoleGroup; import static io.undertow.util.Headers.AUTHORIZATION; import static io.undertow.util.Headers.WWW_AUTHENTICATE; import static io.undertow.util.StatusCodes.UNAUTHORIZED; /** * An AuthenticationMechanism that validates a caller based on a MicroProfile JWT bearer token */ public class JWTAuthMechanism implements AuthenticationMechanism { private JWTAuthContextInfo authContextInfo; private IdentityManager identityManager = new JWTIdentityManager(); public JWTAuthMechanism(JWTAuthContextInfo authContextInfo) { this.authContextInfo = authContextInfo; } /** * Extract the Authorization header and validate the bearer token if it exists. If it does, and is validated, this * builds the org.jboss.security.SecurityContext authenticated Subject that drives the container APIs as well as * the authorization layers. * * @param exchange - the http request exchange object * @param securityContext - the current security context that * @return one of AUTHENTICATED, NOT_AUTHENTICATED or NOT_ATTEMPTED depending on the header and authentication outcome. */ @Override public AuthenticationMechanismOutcome authenticate(HttpServerExchange exchange, SecurityContext securityContext) { List<String> authHeaders = exchange.getRequestHeaders().get(AUTHORIZATION); if (authHeaders != null) { String bearerToken = null; for (String current : authHeaders) { if (current.toLowerCase(Locale.ENGLISH).startsWith("bearer ")) { bearerToken = current.substring(7); if (UndertowLogger.SECURITY_LOGGER.isTraceEnabled()) { UndertowLogger.SECURITY_LOGGER.tracef("Bearer token: %s", bearerToken); } try { //identityManager = securityContext.getIdentityManager(); System.err.println( "idM-->" + identityManager); JWTCredential credential = new JWTCredential(bearerToken, authContextInfo); if (UndertowLogger.SECURITY_LOGGER.isTraceEnabled()) { UndertowLogger.SECURITY_LOGGER.tracef("Bearer token: %s", bearerToken); } // Install the JWT principal as the caller Account account = identityManager.verify(credential.getName(), credential); if (account != null) { JsonWebToken jwtPrincipal = (JsonWebToken) account.getPrincipal(); JsonWebTokenProducer.setJWTPrincipal(jwtPrincipal); JWTAccount jwtAccount = new JWTAccount(jwtPrincipal, account); securityContext.authenticationComplete(jwtAccount, "MP-JWT", false); // Workaround authenticated JsonWebToken not being installed as user principal // https://issues.jboss.org/browse/WFLY-9212 /* org.jboss.security.SecurityContext jbSC = SecurityContextAssociation.getSecurityContext(); Subject subject = jbSC.getUtil().getSubject(); jbSC.getUtil().createSubjectInfo(jwtPrincipal, bearerToken, subject); RoleGroup roles = extract(subject); jbSC.getUtil().setRoles(roles); */ UndertowLogger.SECURITY_LOGGER.debugf("Authenticated caller(%s) for path(%s) with roles: %s", credential.getName(), exchange.getRequestPath(), account.getRoles()); return AuthenticationMechanismOutcome.AUTHENTICATED; } else { UndertowLogger.SECURITY_LOGGER.info("Failed to authenticate JWT bearer token"); return AuthenticationMechanismOutcome.NOT_AUTHENTICATED; } } catch (Exception e) { UndertowLogger.SECURITY_LOGGER.infof(e, "Failed to validate JWT bearer token"); return AuthenticationMechanismOutcome.NOT_AUTHENTICATED; } } } } // No suitable header has been found in this request, return AuthenticationMechanismOutcome.NOT_ATTEMPTED; } @Override public ChallengeResult sendChallenge(HttpServerExchange exchange, SecurityContext securityContext) { exchange.getResponseHeaders().add(WWW_AUTHENTICATE, "Bearer {token}"); UndertowLogger.SECURITY_LOGGER.debugf("Sending Bearer {token} challenge for %s", exchange); return new ChallengeResult(true, UNAUTHORIZED); } /** * Extract the Roles group and return it as a RoleGroup * * @param subject authenticated subject * @return RoleGroup from "Roles" */ protected RoleGroup extract(Subject subject) { Optional<Principal> match = subject.getPrincipals() .stream() .filter(g -> g.getName().equals(SecurityConstants.ROLES_IDENTIFIER)) .findFirst(); Group rolesGroup = (Group) match.get(); RoleGroup roles = new SimpleRoleGroup(rolesGroup); return roles; } }
[ "bob@mcwhirter.org" ]
bob@mcwhirter.org