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
97997ee89fd1c7153c97762c3b3e2b21fdc9d846
33e47549a7f3f7621be100b68efac0df9f671553
/src/com/huaixuan/network/biz/domain/goods/ProductForTaobaoFxAdd.java
4081e0369d9d1fe6908153f344bc704e46420436
[]
no_license
Maddox-Zhao/admin
150b60074e5b89692da52bcdb0b789bdd581a915
67ff15e6a5731aa39c0b747dfca35efc4c87a121
refs/heads/master
2022-08-20T00:06:19.244070
2019-10-31T05:58:30
2019-10-31T05:58:30
218,693,988
0
0
null
null
null
null
UTF-8
Java
false
false
3,529
java
package com.huaixuan.network.biz.domain.goods; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; import org.apache.commons.lang.StringUtils; public class ProductForTaobaoFxAdd { private static final long serialVersionUID = -7399041883722516899L; public static final String sep = ";"; public static final String equ = "="; private Long goodsId; private String attrs; private Integer existNum; private String title; private double goodsPrice; private double agentPrice; private String goodsDesc; private String attrDesc; private String instanceName; private String code; private String pyCode; private String catCode; private Long productId; private String depFirstId; private Long goodsNumber; public Long getGoodsNumber() { return goodsNumber; } public void setGoodsNumber(Long goodsNumber) { this.goodsNumber = goodsNumber; } public String getDepFirstId() { return depFirstId; } public void setDepFirstId(String depFirstId) { this.depFirstId = depFirstId; } public Map<String, String> getProperties() { if (StringUtils.isBlank(attrs)) { return Collections.EMPTY_MAP; } String[] pros = attrs.split(sep); if (pros.length == 0) { return Collections.EMPTY_MAP; } Map<String, String> back = new LinkedHashMap<String, String>(); for (String s : pros) { if (StringUtils.isBlank(s)) { continue; } String[] kvpair = s.split(equ); if (kvpair == null) { continue; } if (kvpair.length == 1) { back.put(kvpair[0], null); } if (kvpair.length == 2) { back.put(kvpair[0], kvpair[1]); } } return back; } public Long getProductId() { return productId; } public void setProductId(Long productId) { this.productId = productId; } public String getCatCode() { return catCode; } public void setCatCode(String catCode) { this.catCode = catCode; } public String getPyCode() { return pyCode; } public void setPyCode(String pyCode) { this.pyCode = pyCode; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getInstanceName() { return instanceName; } public void setInstanceName(String instanceName) { this.instanceName = instanceName; } public String getAttrDesc() { return attrDesc; } public void setAttrDesc(String attrDesc) { this.attrDesc = attrDesc; } public String getGoodsDesc() { return goodsDesc; } public void setGoodsDesc(String goodsDesc) { this.goodsDesc = goodsDesc; } public double getAgentPrice() { return agentPrice; } public void setAgentPrice(double agentPrice) { this.agentPrice = agentPrice; } public double getGoodsPrice() { return goodsPrice; } public void setGoodsPrice(double goodsPrice) { this.goodsPrice = goodsPrice; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public Integer getExistNum() { return existNum; } public void setExistNum(Integer existNum) { this.existNum = existNum; } public String getAttrs() { return attrs; } public void setAttrs(String attrs) { this.attrs = attrs; } public Long getGoodsId() { return goodsId; } public void setGoodsId(Long goodsId) { this.goodsId = goodsId; } }
[ "919965842@qq.com" ]
919965842@qq.com
acca706d5366aac0fdddf755978a397c1c9fec5a
9fe800087ef8cc6e5b17fa00f944993b12696639
/batik-svggen/src/main/java/org/apache/batik/svggen/font/table/GlyfSimpleDescript.java
bcc1bc705cb19d43e90c87a51b0a91c9f05e24e9
[ "Apache-2.0" ]
permissive
balabit-deps/balabit-os-7-batik
14b80a316321cbd2bc29b79a1754cc4099ce10a2
652608f9d210de2d918d6fb2146b84c0cc771842
refs/heads/master
2023-08-09T03:24:18.809678
2023-05-22T20:34:34
2023-05-27T08:21:21
158,242,898
0
0
Apache-2.0
2023-07-20T04:18:04
2018-11-19T15:03:51
Java
UTF-8
Java
false
false
4,636
java
/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package org.apache.batik.svggen.font.table; import java.io.ByteArrayInputStream; /** * @version $Id: GlyfSimpleDescript.java 1733416 2016-03-03 07:07:13Z gadams $ * @author <a href="mailto:david@steadystate.co.uk">David Schweinsberg</a> */ public class GlyfSimpleDescript extends GlyfDescript { private int[] endPtsOfContours; private byte[] flags; private short[] xCoordinates; private short[] yCoordinates; private int count; public GlyfSimpleDescript(GlyfTable parentTable, short numberOfContours, ByteArrayInputStream bais) { super(parentTable, numberOfContours, bais); // Simple glyph description endPtsOfContours = new int[numberOfContours]; for (int i = 0; i < numberOfContours; i++) { endPtsOfContours[i] = (bais.read()<<8 | bais.read()); } // The last end point index reveals the total number of points count = endPtsOfContours[numberOfContours-1] + 1; flags = new byte[count]; xCoordinates = new short[count]; yCoordinates = new short[count]; int instructionCount = (bais.read()<<8 | bais.read()); readInstructions(bais, instructionCount); readFlags(count, bais); readCoords(count, bais); } public int getEndPtOfContours(int i) { return endPtsOfContours[i]; } public byte getFlags(int i) { return flags[i]; } public short getXCoordinate(int i) { return xCoordinates[i]; } public short getYCoordinate(int i) { return yCoordinates[i]; } public boolean isComposite() { return false; } public int getPointCount() { return count; } public int getContourCount() { return getNumberOfContours(); } /* public int getComponentIndex(int c) { return 0; } public int getComponentCount() { return 1; } */ /** * The table is stored as relative values, but we'll store them as absolutes */ private void readCoords(int count, ByteArrayInputStream bais) { short x = 0; short y = 0; for (int i = 0; i < count; i++) { if ((flags[i] & xDual) != 0) { if ((flags[i] & xShortVector) != 0) { x += (short) bais.read(); } } else { if ((flags[i] & xShortVector) != 0) { x += (short) -((short) bais.read()); } else { x += (short)(bais.read()<<8 | bais.read()); } } xCoordinates[i] = x; } for (int i = 0; i < count; i++) { if ((flags[i] & yDual) != 0) { if ((flags[i] & yShortVector) != 0) { y += (short) bais.read(); } } else { if ((flags[i] & yShortVector) != 0) { y += (short) -((short) bais.read()); } else { y += (short)(bais.read()<<8 | bais.read()); } } yCoordinates[i] = y; } } /** * The flags are run-length encoded */ private void readFlags(int flagCount, ByteArrayInputStream bais) { try { for (int index = 0; index < flagCount; index++) { flags[index] = (byte) bais.read(); if ((flags[index] & repeat) != 0) { int repeats = bais.read(); for (int i = 1; i <= repeats; i++) { flags[index + i] = flags[index]; } index += repeats; } } } catch (ArrayIndexOutOfBoundsException e) { System.out.println("error: array index out of bounds"); } } }
[ "testbot@balabit.com" ]
testbot@balabit.com
fddcfc4204ab9dcde8eb417ec83c81ae02e6ad38
3657b6f5b30ac061e2ab1db7cd745e2ca8183af3
/homeProject/src/com/house/home/bean/insales/ItemTransactionBean.java
7c74b12d23514c9bed3b2eaee30bc14752e7acbc
[]
no_license
Lxt000806/eclipse_workspace
b25f4f81bd0aa6f8d55fc834dd09cdb473af1f3f
04376681ec91c3f8dbde2908d35612c4842a868c
refs/heads/main
2023-05-23T12:05:26.989438
2021-06-13T05:49:26
2021-06-13T05:49:26
376,452,726
0
0
null
null
null
null
UTF-8
Java
false
false
4,405
java
package com.house.home.bean.insales; import java.io.Serializable; import java.util.Date; import com.house.framework.commons.excel.ExcelAnnotation; public class ItemTransactionBean implements Serializable { private static final long serialVersionUID = 1L; @ExcelAnnotation(exportName="流水号", order=1) private Integer pk; @ExcelAnnotation(exportName="产品编号", order=2) private String itCode; @ExcelAnnotation(exportName="产品名称", order=3) private String descr; @ExcelAnnotation(exportName="出库|数量", order=4) private Double ckQty; @ExcelAnnotation(exportName="出库|成本", order=5) private Double ckCost; @ExcelAnnotation(exportName="出库|金额", order=6) private Double ckAmount; @ExcelAnnotation(exportName="入库|数量", order=7) private Double lkQty; @ExcelAnnotation(exportName="入库|成本", order=8) private Double lkCost; @ExcelAnnotation(exportName="入库|金额", order=9) private Double lkAmount; @ExcelAnnotation(exportName="变动后|数量", order=10) private Double aftAllQty; @ExcelAnnotation(exportName="变动后|成本", order=11) private Double aftCost; @ExcelAnnotation(exportName="变动日期", pattern="yyyy-MM-dd HH:mm:ss", order=12) private Date date; @ExcelAnnotation(exportName="单据类型", order=13) private String prefixDesc; @ExcelAnnotation(exportName="档案号", order=14) private String document; @ExcelAnnotation(exportName="参考档案号", order=15) private String refDocument; @ExcelAnnotation(exportName="备注", order=16) private String remarks; @ExcelAnnotation(exportName="最后更新时间", pattern="yyyy-MM-dd HH:mm:ss", order=17) private Date lastUpdate; @ExcelAnnotation(exportName="最后更新人员", order=18) private String lastUpdatedBy; @ExcelAnnotation(exportName="是否过期", order=19) private String expired; @ExcelAnnotation(exportName="操作", order=20) private String actionLog; public Integer getPk() { return pk; } public void setPk(Integer pk) { this.pk = pk; } public String getItCode() { return itCode; } public void setItCode(String itCode) { this.itCode = itCode; } public String getDescr() { return descr; } public void setDescr(String descr) { this.descr = descr; } public Double getCkQty() { return ckQty; } public void setCkQty(Double ckQty) { this.ckQty = ckQty; } public Double getCkCost() { return ckCost; } public void setCkCost(Double ckCost) { this.ckCost = ckCost; } public Double getCkAmount() { return ckAmount; } public void setCkAmount(Double ckAmount) { this.ckAmount = ckAmount; } public Double getLkQty() { return lkQty; } public void setLkQty(Double lkQty) { this.lkQty = lkQty; } public Double getLkCost() { return lkCost; } public void setLkCost(Double lkCost) { this.lkCost = lkCost; } public Double getLkAmount() { return lkAmount; } public void setLkAmount(Double lkAmount) { this.lkAmount = lkAmount; } public Double getAftAllQty() { return aftAllQty; } public void setAftAllQty(Double aftAllQty) { this.aftAllQty = aftAllQty; } public Double getAftCost() { return aftCost; } public void setAftCost(Double aftCost) { this.aftCost = aftCost; } public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } public String getPrefixDesc() { return prefixDesc; } public void setPrefixDesc(String prefixDesc) { this.prefixDesc = prefixDesc; } public String getDocument() { return document; } public void setDocument(String document) { this.document = document; } public String getRefDocument() { return refDocument; } public void setRefDocument(String refDocument) { this.refDocument = refDocument; } public String getRemarks() { return remarks; } public void setRemarks(String remarks) { this.remarks = remarks; } public Date getLastUpdate() { return lastUpdate; } public void setLastUpdate(Date lastUpdate) { this.lastUpdate = lastUpdate; } public String getLastUpdatedBy() { return lastUpdatedBy; } public void setLastUpdatedBy(String lastUpdatedBy) { this.lastUpdatedBy = lastUpdatedBy; } public String getExpired() { return expired; } public void setExpired(String expired) { this.expired = expired; } public String getActionLog() { return actionLog; } public void setActionLog(String actionLog) { this.actionLog = actionLog; } }
[ "1728490992@qq.com" ]
1728490992@qq.com
fe1c7db6d022433563be88e9e12e372773e25660
56adea945b27ccaf880decadb7f7cb86de450a8d
/core/ep-core/src/test/java/com/elasticpath/service/changeset/impl/DynamicContentMetadataResolverTest.java
b579f21f7a784dd885d6aff1faca7fe286ee9da1
[]
no_license
ryanlfoster/ep-commerce-engine-68
89b56878806ca784eca453d58fb91836782a0987
7364bce45d25892e06df2e1c51da84dbdcebce5d
refs/heads/master
2020-04-16T04:27:40.577543
2013-12-10T19:31:52
2013-12-10T20:01:08
40,164,760
1
1
null
2015-08-04T05:15:25
2015-08-04T05:15:25
null
UTF-8
Java
false
false
4,126
java
/** * Copyright (c) Elastic Path Software Inc., 2008 */ package com.elasticpath.service.changeset.impl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import org.apache.commons.lang.StringUtils; import org.jmock.Expectations; import org.jmock.integration.junit4.JUnitRuleMockery; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import com.elasticpath.domain.objectgroup.BusinessObjectDescriptor; import com.elasticpath.domain.objectgroup.impl.BusinessObjectDescriptorImpl; import com.elasticpath.persistence.api.PersistenceEngine; /** * Test that dynamic content metadata gets resolved as expected. */ public class DynamicContentMetadataResolverTest { private DynamicContentMetadataResolver resolver; private PersistenceEngine persistenceEngine; @Rule public final JUnitRuleMockery context = new JUnitRuleMockery(); /** * Set up required for each test. */ @Before public void setUp() { resolver = new DynamicContentMetadataResolver(); persistenceEngine = context.mock(PersistenceEngine.class); resolver.setPersistenceEngine(persistenceEngine); } /** * Test validation behaves as required. */ @Test public void testIsValidResolverForObjectType() { assertTrue("Dynamic Content should be valid", resolver.isValidResolverForObjectType("Dynamic Content")); assertFalse("Null should not be valid", resolver.isValidResolverForObjectType(null)); assertFalse("Empty string should not be valid", resolver.isValidResolverForObjectType(StringUtils.EMPTY)); assertFalse("A different object string should not be valid", resolver.isValidResolverForObjectType("Product")); assertFalse("Abritrary string should not be valid", resolver.isValidResolverForObjectType("anything")); } /** * Test name metadata for dynamic content is retrieved by a named query. */ @Test public void testResolveMetaDataDynamicContentAssignment() { final String dcGuid = "DC1"; final BusinessObjectDescriptor objectDescriptor = new BusinessObjectDescriptorImpl(); objectDescriptor.setObjectIdentifier(dcGuid); objectDescriptor.setObjectType("Dynamic Content"); final String name = "Test Content"; final List<String> nameList = new ArrayList<String>(); nameList.add(name); context.checking(new Expectations() { { oneOf(persistenceEngine).retrieveByNamedQuery("DYNAMIC_CONTENT_NAME_BY_GUID", dcGuid); will(returnValue(nameList)); } }); Map<String, String> metadata = resolver.resolveMetaData(objectDescriptor); assertEquals("There should be metadata returned", 1, metadata.size()); assertEquals("The dynamic content name should be as expected", name, metadata.get("objectName")); } /** * Test no metadata returned if the query returns no results (e.g. dynamic content does not exist). */ @Test public void testResolveMetaDataNonExistentDynamicContent() { final String dcGuid = "NOSUCHCODE"; final BusinessObjectDescriptor objectDescriptor = new BusinessObjectDescriptorImpl(); objectDescriptor.setObjectIdentifier(dcGuid); objectDescriptor.setObjectType("Dynamic Content"); context.checking(new Expectations() { { oneOf(persistenceEngine).retrieveByNamedQuery("DYNAMIC_CONTENT_NAME_BY_GUID", dcGuid); will(returnValue(Collections.emptyList())); } }); Map<String, String> metadata = resolver.resolveMetaData(objectDescriptor); assertEquals("There should be no metadata returned", 0, metadata.size()); } /** * Test that no metadata is returned when the object is not a valid type. */ @Test public void testResolveMetaDataForNonDynamicContentObject() { final BusinessObjectDescriptor objectDescriptor = new BusinessObjectDescriptorImpl(); objectDescriptor.setObjectIdentifier("WHATEVER"); objectDescriptor.setObjectType("Product"); Map<String, String> metadata = resolver.resolveMetaData(objectDescriptor); assertEquals("There should be no metadata returned", 0, metadata.size()); } }
[ "chris.gomes@pearson.com" ]
chris.gomes@pearson.com
2863e269a94dba2773e69336c14a02c995f0f3d0
c4d3c5492d138a360ad25fde006fa15cb576686c
/src/crackingcode/Easy0101.java
b545231945dc86d7af4b33578b38b7734bfbe886
[]
no_license
sollunna/leetcode-practice
605a7757fa2870440350203642390df0d073e097
8bbc322d9014cc2728a8a8fe20f0b5542fc37a6a
refs/heads/master
2022-04-15T07:41:00.038381
2020-03-24T14:04:08
2020-03-24T14:04:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,499
java
package crackingcode; import org.junit.Test; import java.util.*; /** * 实现一个算法,确定一个字符串 s 的所有字符是否全都不同。 * * 示例 1: * * 输入: s = "leetcode" * 输出: false * 示例 2: * * 输入: s = "abc" * 输出: true * 限制: * * 0 <= len(s) <= 100 * 如果你不使用额外的数据结构,会很加分。 * * 思路: * 方法1 set查重 * 方法2 不适用额外的数据结构。。。数组,map都不能用 * 由于ASCII码字符个数为128个,而且题目说了如果你不使用额外的数据结构,会很加分。 * 因此可以使用两个64位的long变量来存储是否出现某个字符,二进制位1表示出现过, 0表示未出现过。 */ public class Easy0101 { public boolean isUnique(String astr) { Set<Character> set = new HashSet<>(); for (Character c : astr.toCharArray()) { if (set.contains(c)) return false; set.add(c); } return true; } /*方法2,位运算*/ public boolean isUnique2(String astr) { long low64 = 0; long high64 = 0; for (Character c : astr.toCharArray()) { if (c >= 64) {//在高位标记 long bitIndex = 1 << c - 64; if ((high64 & bitIndex) != 0) return false; high64 |= bitIndex; } else if (c < 64) {//在低位标记 long bitIndex = 1 << c; if ((low64 & bitIndex) != 0) return false; low64 |= bitIndex; } } return true; } @Test public void test1() { System.out.println(isUnique("leetcode")); } }
[ "546591178@qq.com" ]
546591178@qq.com
67f40483b01c22a3b4644dcf1d5a29f246301a04
4a4c12c9210f3d763690c65c3a1bb3d5255a72b1
/app/src/main/java/com/minilook/minilook/util/PermissionUtil.java
56a8e2509e8af0109697d98b0c4400dd8b543fb3
[]
no_license
sjyun87/minilook
f6fd0d745955a97eb0f9462d8623187e96baf239
5e4dfcb684cfaf00f6db46e10209a7a52671a563
refs/heads/master
2023-04-01T07:40:13.654554
2021-04-16T08:33:01
2021-04-16T08:33:01
275,824,566
0
0
null
null
null
null
UTF-8
Java
false
false
956
java
package com.minilook.minilook.util; import android.Manifest; import android.content.Context; import com.gun0912.tedpermission.PermissionListener; import com.gun0912.tedpermission.TedPermission; public class PermissionUtil { public static void checkStoragePermission(Context context, PermissionListener listener) { TedPermission.with(context) .setPermissionListener(listener) .setDeniedMessage("권한을 거부하면 서비스를 사용할 수 없습니다.") .setPermissions(Manifest.permission.READ_EXTERNAL_STORAGE) .check(); } public static void checkCameraPermission(Context context, PermissionListener listener) { TedPermission.with(context) .setPermissionListener(listener) .setDeniedMessage("권한을 거부하면 서비스를 사용할 수 없습니다.") .setPermissions(Manifest.permission.CAMERA) .check(); } }
[ "saira_@naver.com" ]
saira_@naver.com
e4af8165b7ae66e2ceedffe6c475ee23d066c8b0
ef66dadf885506c94897f7c6727c35a6b5d9b7d3
/art-extension/opttests/src/OptimizationTests/regression/test12373/Main.java
fd787b1f473f9eb3c655bea1bb284ac1835c564e
[ "Apache-2.0", "NCSA", "LicenseRef-scancode-unknown-license-reference" ]
permissive
pramulkant/https-github.com-android-art-intel-marshmallow
aef8d075498f3c19712403c271b55ea457e053ec
87e8c22f248164780b92aaa0cdea14bf6cda3859
refs/heads/master
2021-01-12T05:00:35.783906
2016-11-07T08:34:41
2016-11-07T08:34:41
77,827,976
0
0
null
null
null
null
UTF-8
Java
false
false
4,508
java
/* * Copyright (C) 2015 Intel Corporation * * 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. */ // Generated by Android Runtime Fuzzer tool (3.5.002). Mon Jun 29 14:40:30 2015 // srand = 26075427942406749592857512685083789305493408459287477330423242513955 package OptimizationTests.regression.test12373; import OptimizationTests.regression.shared.*; public class Main extends FuzzerUtils { public static final int N = 100; public static float fArrFld[]=new float[N]; static { init(fArrFld, 0.747F); } public static long fMeth_check_sum = 0; public static float fMeth(int i1, int i2) { float f=0.172F; int i3=-7, i4=-11, i5=-169, iArr1[]=new int[N]; double d=96.95063, d1=-84.110571; byte by=48, byArr[]=new byte[N]; long l=-147L, l1=2423779744L, lArr[][]=new long[N][N]; init(iArr1, -4); init(byArr, (byte)34); init(lArr, 1276702125L); for (d = 1; d < 88; d += 3) { try { i1 *= (int)(-((i1 + l) * (--f))); for (i3 = 1; i3 < 46; ++i3) { l = (i2--); by -= (byte)((iArr1[(int)(d + 1)] = byArr[i3]) + ((65 * i1) + Math.abs(i3))); d1 -= (++i2); } l += (by = (byte)((++i1) + (l * i4))); } catch (NegativeArraySizeException exc) { i4 -= (int)(((i2 - l) * (++f)) + i4); for (i5 = 2; i5 < 80; ++i5) { iArr1[i5] = (int)l1; i2 = (int)((l1 %= ((i5 * i4) | 1)) + ((i5 - 53076) * (i2 += (int)f))); } } finally { l = (long)(lArr[(int)(d + 1)][(int)(d - 1)] % (((long)(fArrFld[(int)(d)] - (l + -9))) | 1)); } } long meth_res = i1 + i2 + Double.doubleToLongBits(d) + l + Float.floatToIntBits(f) + i3 + by + Double.doubleToLongBits(d1) + i4 + i5 + l1 + checkSum(iArr1) + checkSum(byArr) + checkSum(lArr); fMeth_check_sum += meth_res; return (float)meth_res; } public static void main(String[] strArr) { boolean b=false; float f1=-78.11F, f2=2.491F; int i=-41855, i6=45566, i7=126, i8=-69, i9=44322, iArr[]=new int[N]; double d2=-2.76244; byte by1=125; short s=23725; long l2=4651179905347731838L, lArr1[]=new long[N]; init(iArr, 225); init(lArr1, -7370137526057670417L); i = 1; while (++i < 85) { iArr[i - 1] += (int)fMeth((int)(-(i + 6L)), 63850); for (f1 = 1; f1 < i; f1++) { for (i6 = 1; i6 < 4; ++i6) { i7 = (++i7); l2 -= (126 * (i7--)); l2 += (6 + (i6 * i6)); i7 <<= (i7--); lArr1[i] += ((3015 * (i8 * s)) + i7); i7 += iArr[(int)(f1)]; l2 += Math.max((int)(-(2L + by1)), 33); i8 = (i8++); } f2 += 7; b = b; for (i9 = 1; i9 < 2; ++i9) { l2 = (l2--); by1 -= (byte)((iArr[i9]--) * (f2 - (i8 + 31235))); f2 = (float)((d2 + (l2++)) + (l2 = (long)(i + 1.842F))); i8 = (int)(++d2); i7 = (int)(((f2--) - (i7 - f1)) + ((6L - (i6 - i8)) + (f2 % (i8 | 1)))); l2 = i7; i8 += (((i9 * i8) + l2) - i7); d2 *= (l2 - (--f2)); i7 = (int)((++i7) + ((i6 - -2.439F) - (i8++))); i8 = (int)f1; } } } System.out.println("i f1 i6 = " + i + "," + Float.floatToIntBits(f1) + "," + i6); System.out.println("i7 l2 i8 = " + i7 + "," + l2 + "," + i8); System.out.println("s by1 f2 = " + s + "," + by1 + "," + Float.floatToIntBits(f2)); System.out.println("b i9 d2 = " + (b ? 1 : 0) + "," + i9 + "," + Double.doubleToLongBits(d2)); System.out.println("iArr lArr1 = " + checkSum(iArr) + "," + checkSum(lArr1)); System.out.println("fArrFld = " + Double.doubleToLongBits(checkSum(fArrFld))); System.out.println("fMeth_check_sum: " + fMeth_check_sum); } }
[ "aleksey.v.ignatenko@intel.com" ]
aleksey.v.ignatenko@intel.com
746f22c3141efe2447777feebaff32e9b4e8c87b
100dbf7f6e2c5faaf8d4fc174af89b7089303a8b
/src/main/java/com/example/appnewsite/service/AuthService.java
a88900c40377409a3f847b0aa13be37a5a27e780
[]
no_license
Ilxom1992/spring_model2_lesson_7
916bd3104c02d5c762dc0e4ccbada927cd97f189
7570a59fbf12e5528d468a52e500882cc47c3dfe
refs/heads/master
2023-04-22T22:07:23.499419
2021-05-05T21:10:18
2021-05-05T21:10:18
363,046,725
0
0
null
null
null
null
UTF-8
Java
false
false
2,265
java
package com.example.appnewsite.service; import com.example.appnewsite.entity.User; import com.example.appnewsite.exceptions.RecursNotFoundExceptions; import com.example.appnewsite.payload.ApiResponse; import com.example.appnewsite.payload.RegisterDto; import com.example.appnewsite.repository.PositionRepository; import com.example.appnewsite.repository.UserRepository; import com.example.appnewsite.utils.AppConstants; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import java.util.Optional; @Service public class AuthService implements UserDetailsService { final UserRepository userRepository; final PositionRepository positionRepository; final PasswordEncoder passwordEncoder; public AuthService(UserRepository userRepository, PositionRepository positionRepository, PasswordEncoder passwordEncoder) { this.userRepository = userRepository; this.positionRepository = positionRepository; this.passwordEncoder = passwordEncoder; } public ApiResponse register(RegisterDto registerDto){ if (!registerDto.getPassword().equals(registerDto.getPrePassword())){ return new ApiResponse("parol mos emas",false); } if (userRepository.existsByUsername(registerDto.getUsername())){ return new ApiResponse("Bunday user bazada mavjud",false); } User user=new User( registerDto.getFullName(), registerDto.getUsername(), passwordEncoder.encode(registerDto.getPassword()), positionRepository.findByName(AppConstants.USER).orElseThrow(()->new RecursNotFoundExceptions("Lavozim","Name",AppConstants.USER)), true ); userRepository.save(user); return new ApiResponse("user saved",true); } public UserDetails loadUserByUsername(String username) { return userRepository.findByUsername(username).orElseThrow(()->new UsernameNotFoundException(username)); } }
[ "ilxom.xojamurodov@gmail.com" ]
ilxom.xojamurodov@gmail.com
f8fcbc39b0d43050aff993dd2ef14ac74d8e303f
ab962e8e4f4663be6bda28f30abb2bc5c52ffa37
/planner/src/main/java/edu/isi/wings/catalog/data/classes/metrics/MetricsXMLUtil.java
5c9ae712b7b9551dba9c5ceb6eee17e2ba807f32
[ "Apache-2.0" ]
permissive
m-markovic/wings
ac9aa6860c73ef09d62c65b47e22e53e180fea6a
03e175ed24b5a5a0695c0826119c4efa3102fec2
refs/heads/master
2021-01-18T16:22:12.720488
2014-08-11T22:26:26
2014-08-11T22:26:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,032
java
package edu.isi.wings.catalog.data.classes.metrics; import java.io.ByteArrayInputStream; import java.util.Calendar; import java.util.HashMap; import java.util.TimeZone; import javax.xml.bind.DatatypeConverter; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathFactory; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; import com.hp.hpl.jena.datatypes.xsd.XSDDateTime; public class MetricsXMLUtil { public static String HEADER = "<MetricResults xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " xsi:noNamespaceSchemaLocation=\"dc_results_draft.xsd\">\n"; public static String FOOTER = "</MetricResults>"; private static Object convertStringToPossibleJavaObject(String str, String type) { if ("String".equals(type)) { return str; } else if ("Boolean".equals(type)) { return Boolean.parseBoolean(str); } else if ("Integer".equals(type)) { return Integer.parseInt(str); } else if ("Float".equals(type)) { return Float.parseFloat(str); } else if ("XSDDateTime".equals(type)) { try { Calendar cal = DatatypeConverter.parseDate(str); cal.setTimeZone(TimeZone.getTimeZone("UTC")); XSDDateTime dt = new XSDDateTime(cal); dt.narrowType(XSDDatatype.XSDdate); return dt; } catch (Exception e) { } } return guessPossibleJavaObject(str); } private static Object guessPossibleJavaObject(String str) { if (str.toLowerCase().equals("false") || (str.toLowerCase().equals("true"))) { return Boolean.parseBoolean(str); } try { return Integer.parseInt(str); } catch (Exception e) { } try { return Float.parseFloat(str); } catch (Exception e) { } try { Calendar cal = DatatypeConverter.parseDate(str); cal.setTimeZone(TimeZone.getTimeZone("UTC")); XSDDateTime dt = new XSDDateTime(cal); dt.narrowType(XSDDatatype.XSDdate); return dt; // SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); // Calendar cal = Calendar.getInstance(); // cal.setTime(formatter.parse(str)); // return cal; } catch (Exception e) { } return str; } public static HashMap<String, Metric> parseMetricsXML(String metrics) { XPath xpath = XPathFactory.newInstance().newXPath(); // Convert ArrayList here to a Metric Class HashMap<String, Metric> propValMap = new HashMap<String, Metric>(); String expression = "//MetricResults/Metric"; if (metrics == null || metrics.equals("")) { return propValMap; } InputSource inputSource = new InputSource(new ByteArrayInputStream(metrics.getBytes())); try { NodeList nodes = (NodeList) xpath.evaluate(expression, inputSource, XPathConstants.NODESET); for (int i = 0; i < nodes.getLength(); i++) { // Get element Element elem = (Element) nodes.item(i); String metricName = elem.getAttribute("name"); String propName = null; Object propVal = null; for (int j = 0; j < elem.getChildNodes().getLength(); j++) { Node dim = (Node) elem.getChildNodes().item(j); if (dim.getNodeName().equals("Dimension")) { propName = ((Element) dim).getAttribute("name"); for (int k = 0; k < dim.getChildNodes().getLength(); k++) { Node tmp = (Node) dim.getChildNodes().item(k); if (tmp.getNodeName().equals("Value")) { String valueType = ((Element) tmp).getAttribute("type"); propVal = convertStringToPossibleJavaObject(tmp.getNodeValue(), valueType); break; } } break; } } if (propName != null && propVal != null) { int metricType = (metricName.equals("uri") ? Metric.URI : Metric.LITERAL); Metric m = new Metric(metricType, propVal); propValMap.put(propName, m); } } } catch (Exception e) { System.out.println(metrics); e.printStackTrace(); } return propValMap; } public static String getMetricXML(Metrics metrics) { StringBuilder result = new StringBuilder(); result.append(HEADER); HashMap<String, Metric> mmap = metrics.getMetrics(); for (String prop : mmap.keySet()) { Metric mm = mmap.get(prop); String valdtype = null; Object val = mm.getValue(); if (mm.getType() == Metric.LITERAL && val != null) { if(mm.getDatatype() != null) valdtype = mm.getDatatype(); else valdtype = val.getClass().getSimpleName(); } result.append(getMetricXML(prop, val.toString(), mm.getType(), valdtype)); } result.append(FOOTER); return result.toString(); } public static String getMetricXML(String key, Object value, int typeint, String dtype) { StringBuilder result = new StringBuilder(); String newLineChar = System.getProperty("line.separator"); String metricBegin = " <Metric name=\""; String metricEnd = "\">" + newLineChar; String metricBeginAlt = " <Metric>"; String metricClose = " </Metric>" + newLineChar; String dimensionBegin = " <Dimension name=\""; String dimensionEnd = "\">" + newLineChar; String dimensionClose = " </Dimension>" + newLineChar; String valueBegin = " <Value>"; String valueClose = "</Value>" + newLineChar; String typedValueBegin = " <Value type=\""; String typedValueEnd = "\">"; String type = typeint == Metric.URI ? "uri" : (typeint == Metric.LITERAL ? "literal" : null); if (type != null) { result.append(metricBegin); result.append(type); result.append(metricEnd); } else { result.append(metricBeginAlt); } result.append(dimensionBegin); result.append(key); result.append(dimensionEnd); if (dtype != null) { result.append(typedValueBegin); result.append(dtype); result.append(typedValueEnd); } else result.append(valueBegin); result.append(getValueString(value)); result.append(valueClose); result.append(dimensionClose); result.append(metricClose); return result.toString(); } public static String getValueString(Object value) { return value.toString(); } }
[ "varunratnakar@gmail.com" ]
varunratnakar@gmail.com
edd8f3eed7b14942c3a370a1da3e00340cf130ef
4d6f449339b36b8d4c25d8772212bf6cd339f087
/netreflected/src/Core/System.IO.IsolatedStorage,Version=4.1.2.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a/system/io/isolatedstorage/IsolatedStorageException.java
02dcd6db4df1e0546630f8d26625c8960f2561bd
[ "MIT" ]
permissive
lvyitian/JCOReflector
299a64550394db3e663567efc6e1996754f6946e
7e420dca504090b817c2fe208e4649804df1c3e1
refs/heads/master
2022-12-07T21:13:06.208025
2020-08-28T09:49:29
2020-08-28T09:49:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,610
java
/* * MIT License * * Copyright (c) 2020 MASES s.r.l. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in 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: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * 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 * AUTHORS 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 IN THE * SOFTWARE. */ /************************************************************************************** * <auto-generated> * This code was generated from a template using JCOReflector * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. * </auto-generated> *************************************************************************************/ package system.io.isolatedstorage; import org.mases.jcobridge.*; import org.mases.jcobridge.netreflection.*; import java.util.ArrayList; // Import section /** * The base .NET class managing System.IO.IsolatedStorage.IsolatedStorageException, System.IO.IsolatedStorage, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Extends {@link NetException}. * <p> * * See: <a href="https://docs.microsoft.com/en-us/dotnet/api/System.IO.IsolatedStorage.IsolatedStorageException" target="_top">https://docs.microsoft.com/en-us/dotnet/api/System.IO.IsolatedStorage.IsolatedStorageException</a> */ public class IsolatedStorageException extends NetException { /** * Fully assembly qualified name: System.IO.IsolatedStorage, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a */ public static final String assemblyFullName = "System.IO.IsolatedStorage, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; /** * Assembly name: System.IO.IsolatedStorage */ public static final String assemblyShortName = "System.IO.IsolatedStorage"; /** * Qualified class name: System.IO.IsolatedStorage.IsolatedStorageException */ public static final String className = "System.IO.IsolatedStorage.IsolatedStorageException"; static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName); /** * The type managed from JCOBridge. See {@link JCType} */ public static JCType classType = createType(); static JCEnum enumInstance = null; JCObject classInstance = null; JCNativeException jcNativeException = null; static JCType createType() { try { return bridge.GetType(className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName)); } catch (JCException jce) { if (JCOBridgeInstance.getDebug()) jce.printStackTrace(); return null; } } void addReference(String ref) throws Throwable { try { bridge.AddReference(ref); } catch (JCNativeException jcne) { throw translateException(jcne); } } public IsolatedStorageException() { super(); } public IsolatedStorageException(Object instance) { super(instance); if (instance instanceof JCObject) { classInstance = (JCObject) instance; } else if (instance instanceof JCNativeException) { jcNativeException = (JCNativeException) instance; classInstance = jcNativeException.getCLRException(); } } public IsolatedStorageException(String message) { super(message); } public IsolatedStorageException(NetException cause) { super(cause); } public IsolatedStorageException(String message, NetException cause) { super(message, cause); } public String getJCOAssemblyName() { return assemblyFullName; } public String getJCOClassName() { return className; } public String getJCOObjectName() { return className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); } public Object getJCOInstance() { return classInstance; } public void setJCOInstance(JCObject instance) { classInstance = instance; super.setJCOInstance(classInstance); } public JCType getJCOType() { return classType; } /** * Try to cast the {@link IJCOBridgeReflected} instance into {@link IsolatedStorageException}, a cast assert is made to check if types are compatible. */ public static IsolatedStorageException cast(IJCOBridgeReflected from) throws Throwable { NetType.AssertCast(classType, from); return new IsolatedStorageException(from.getJCOInstance()); } // Constructors section // Methods section // Properties section }
[ "mario.mastrodicasa@masesgroup.com" ]
mario.mastrodicasa@masesgroup.com
2e7862e2a82d5f0aac622eb26833e16a2382e31a
15aff3446c957fc934c98dc84a0668a2025f28c1
/open-metadata-implementation/access-services/stewardship-action/stewardship-action-api/src/main/java/org/odpi/openmetadata/accessservices/stewardshipaction/api/StewardshipActionInterface.java
7a1465bf17d70f2cff217c829d6628abc1969a49
[ "CC-BY-4.0", "Apache-2.0" ]
permissive
ilovechai/egeria
0865773e6deaf35991ab23a649e91f4715dc749c
c7cd3dd4bb6c960f6b81ecd71394af48cc16a23b
refs/heads/main
2023-03-15T18:15:16.154074
2023-03-03T13:10:41
2023-03-03T13:10:41
610,375,922
1
0
Apache-2.0
2023-03-06T20:57:45
2023-03-06T16:42:28
null
UTF-8
Java
false
false
726
java
/* SPDX-License-Identifier: Apache-2.0 */ package org.odpi.openmetadata.accessservices.stewardshipaction.api; /** * StewardshipActionInterface defines the client-side interface for the Stewardship Action OMAS. This includes * operations to make corrections and updates to metadata. */ public interface StewardshipActionInterface { /** * Assign a new owner to an asset. * * @param userId identifier of the user issuing the request. * @param assetGUID identifier of the asset needing a new owner. * @param owner userId of the new owner. */ void assignAssetOwner(String userId, String assetGUID, String owner); }
[ "mandy_chessell@uk.ibm.com" ]
mandy_chessell@uk.ibm.com
d9d0bdf5492c24f7dd5facdb2db1fac7e48301be
78c363757b59e62de9a6a2543ee8c1c6cbb4a4d1
/_09_Fibonacci.java
5e50c1361b6364e2a5fd89a243ab6121788cfaaa
[]
no_license
les-mockingjay/offer
547dc6bf9e21e1db28860cb724b20f4481db9855
adbd140c4fa192fde3e6da0c57a4a9f445ef63b0
refs/heads/master
2021-01-22T21:12:25.635562
2017-03-05T12:12:40
2017-03-05T12:12:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
790
java
package offer; /** * 面试题9:菲波那切数列 * 大家都知道斐波那契数列,现在要求输入一个整数n,请你输出斐波那契数列的第n项。 n<=39 */ public class _09_Fibonacci { public static void main(String[] args){ Solution09 solution09 = new Solution09(); System.out.println(solution09.Fibonacci(39)); } } class Solution09 { public int Fibonacci(int n) { int[] result={0,1}; if(n<2){ return result[n]; } long current=0; long firstNum=0; long secondNum=1; for(int i=2;i<=n;i++){ current=firstNum+secondNum; firstNum=secondNum; secondNum=current; } return Integer.parseInt(String.valueOf(current)); } }
[ "2578858653@qq.com" ]
2578858653@qq.com
49803aee5f7ecd7fc28777f58402c9cadbab853f
d9d874a3a103717657908456bbe1e1b484159df4
/jcute-core-network/src/main/java/com/jcute/core/network/NetWorkManager.java
73da079d9117d68266f60505e37813977a7e9dda
[ "Apache-2.0" ]
permissive
jcute/jcute
16c782552cd1ffb8ea6cb8a1477cd51d1a031ec5
7276aa31d99b22459e78871d843245e2414abc69
refs/heads/master
2020-03-21T22:39:06.768681
2018-07-31T01:10:19
2018-07-31T01:10:19
127,396,803
0
0
null
null
null
null
UTF-8
Java
false
false
1,597
java
package com.jcute.core.network; import io.netty.channel.EventLoopGroup; import java.util.Set; import com.jcute.core.network.net.NetClient; import com.jcute.core.network.net.NetClientOptions; import com.jcute.core.network.net.NetServer; import com.jcute.core.network.net.NetServerOptions; import com.jcute.core.network.web.WebClient; import com.jcute.core.network.web.WebClientOptions; import com.jcute.core.network.web.WebServer; import com.jcute.core.network.web.WebServerOptions; import com.jcute.core.toolkit.cycle.Stable; public interface NetWorkManager extends Stable<NetWorkManagerEvent,NetWorkManagerListener>{ public NetWorkManagerOptions getNetWorkManagerOptions(); public NetWorkThreadChecker getNetWorkThreadChecker(); public NetWorkThreadFactory getBossNetWorkThreadFactory(); public NetWorkThreadFactory getWorkNetWorkThreadFactory(); public EventLoopGroup getBossEventLoopGroup(); public EventLoopGroup getWorkEventLoopGroup(); public NetServer createNetServer(NetServerOptions options); public NetServer createNetServer(); public NetClient createNetClient(NetClientOptions options); public NetClient createNetClient(); public WebServer createWebServer(WebServerOptions options); public WebServer createWebServer(); public WebClient createWebClient(WebClientOptions options); public WebClient createWebClient(); public Set<NetServer> getNetServers(); public Set<NetClient> getNetClients(); public Set<WebServer> getWebServers(); public Set<WebClient> getWebClients(); }
[ "tb_bin@163.com" ]
tb_bin@163.com
ef761d2bd770b3e6b2588c0774424a8fc089c93a
451ab328b09d3320c3b741efec116dc405939828
/lottery-two/Lottery_two/app/src/main/java/com/le/cheng/utils/MemorySpaceCheckUtil.java
a9db42397c598bed2a89e0a9db468906847ea38d
[]
no_license
luoshihai/package
af9fa84100b6997cfc3559fdcadbf98663e73f36
4e837bbc858083f081720fb46ac5ae2742cb8e3a
refs/heads/master
2020-03-24T17:09:34.855173
2018-07-30T09:08:36
2018-07-30T09:08:36
142,851,008
0
0
null
null
null
null
UTF-8
Java
false
false
4,656
java
package com.le.cheng.utils; import android.app.ActivityManager; import android.content.Context; import android.os.Environment; import android.os.StatFs; import com.le.cheng.application.DSLApplication; import java.io.File; import java.lang.reflect.Method; /** * 检测设备存储空间 * Created by dwb on 2016/11/18. */ public class MemorySpaceCheckUtil { /** * * 计算剩余空间 * @param path * @return */ private static long getAvailableSize(String path){ StatFs fileStats = new StatFs(path); fileStats.restat(path); return (long) fileStats.getAvailableBlocks() * fileStats.getBlockSize(); // 注意与fileStats.getFreeBlocks()的区别 } /** * * 计算总空间 * @param path * @return */ private static long getTotalSize(String path){ StatFs fileStats = new StatFs(path); fileStats.restat(path); return (long) fileStats.getBlockCount() * fileStats.getBlockSize(); } /** * 检测SDCard是否可用 * * @return */ public static boolean checkSDCard() { if (Environment.getExternalStorageState().equals( Environment.MEDIA_MOUNTED)) { return true; } else { return false; } } /** * * 计算SD卡的剩余空间 * @return 剩余空间 */ public static long getSDAvailableSize(){ if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){ return getAvailableSize(Environment.getExternalStorageDirectory().toString()); } return 0; } /** * * 计算系统的剩余空间 * @return 剩余空间 */ public static long getSystemAvailableSize(){ // context.getFilesDir().getAbsolutePath(); return getAvailableSize("/data"); } /** * * 是否有足够的空间 * @param filePath * 文件路径,不是目录的路径 * @return */ public static boolean hasEnoughMemory(String filePath){ File file = new File(filePath); long length = file.length(); if (filePath.startsWith("/sdcard") || filePath.startsWith("/mnt/sdcard")){ return getSDAvailableSize() > length; }else{ return getSystemAvailableSize() > length; } } /** * * 获取SD卡的总空间 * @return */ public static long getSDTotalSize(){ if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){ return getTotalSize(Environment.getExternalStorageDirectory().toString()); } return 0; } /** * * 获取系统可读写的总空间 * @return */ public static long getSysTotalSize(){ return getTotalSize("/data"); } /** * 获取当前android可用内存大小 * @return */ public static String getAvailMemory() { Context context = DSLApplication.getInstance().getBaseContext(); ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); am.getMemoryInfo(mi); // return Formatter.formatFileSize(context, mi.availMem);// 将获取的内存大小规格化 return (mi.availMem / 1024 / 1024)+""; } /** * 获得系统总内存 * @return */ public static String getTotalMemory() { Method _readProclines = null; try { Class<?> procClass = Class.forName("android.os.Process"); Class<?> parameterTypes[] = new Class[] { String.class,String[].class, long[].class }; _readProclines = procClass.getMethod("readProcLines",parameterTypes); Object arglist[] = new Object[3]; final String[] mMemInfoFields = new String[] { "MemTotal:","MemFree:", "Buffers:", "Cached:" }; long[] mMemInfoSizes = new long[mMemInfoFields.length]; mMemInfoSizes[0] = 30; mMemInfoSizes[1] = -30; arglist[0] = new String("/proc/meminfo"); arglist[1] = mMemInfoFields; arglist[2] = mMemInfoSizes; if (_readProclines != null) { _readProclines.invoke(null, arglist); // for (int i = 0; i < mMemInfoSizes.length; i++) { // Log.d("GetFreeMem", mMemInfoFields[i] + " : "+ mMemInfoSizes[i] / 1024); // } return ""+mMemInfoSizes[0] / 1024; } return "-1"; } catch (Exception e) { return "-1"; } } }
[ "1206327668@qq.com" ]
1206327668@qq.com
caf0979eac272239e69c1479b293e95a14965762
e7e497b20442a4220296dea1550091a457df5a38
/java_workplace/renren_web_framework/commons/xiaonei-core/trunk/src/main/java/com/xiaonei/platform/core/userswitch/SwitchPool.java
414350118517e9aaef1bd04b94a8769c98cc0939
[]
no_license
gunner14/old_rr_code
cf17a2dedf8dfcdcf441d49139adaadc770c0eea
bb047dc88fa7243ded61d840af0f8bad22d68dee
refs/heads/master
2021-01-17T18:23:28.154228
2013-12-02T23:45:33
2013-12-02T23:45:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
817
java
package com.xiaonei.platform.core.userswitch; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * @author Li Weibo (weibo.leo@gmail.com) //I believe spring-brother * @since 2011-6-14 下午12:30:38 */ public class SwitchPool { private Map<String, UserSwitch> pool = new ConcurrentHashMap<String, UserSwitch>(); public UserSwitch get(String switchId) { UserSwitch switcher = pool.get(switchId); if (switcher == null) { synchronized (switchId.intern()) { switcher = pool.get(switchId); if (switcher == null) { switcher = initSwitch(switchId); pool.put(switchId, switcher); } } } return switcher; } private UserSwitch initSwitch(String switchId) { DefaultSwitcher s = new DefaultSwitcher(); s.setId(switchId); s.init(); return s; } }
[ "liyong19861014@gmail.com" ]
liyong19861014@gmail.com
25c6186ec70ef801945f58c338c544ad5e2c3318
de49ef6cc0ad2f6785bc80bfad07a026e4a2b48c
/src/main/java/com/zqi/strategy/account/AccountTrans.java
693f61da263e4bb0bc241b2fc2381bc461b52fc6
[]
no_license
herrysa/zqi
0ba3b649d93ebb9e68f25b44a69c7607bf06f238
522bc6d64b1e0dd6ae07aa54e60aa47020d3173b
refs/heads/master
2020-04-05T14:09:26.091061
2017-07-10T15:48:46
2017-07-10T15:48:46
55,677,597
0
1
null
null
null
null
UTF-8
Java
false
false
3,063
java
package com.zqi.strategy.account; public class AccountTrans implements Cloneable{ private String tradeCode; private String code; private String period; private double amount; private double remainder; private double price; private double cap; private double cost; private double cash; private double pl; private String optType; private String tradeCode2; private Long dateTime; private String speriod; private double samount; private double sprice; private double scap; private double scost; private double wcap; private double scash; public String getTradeCode() { return tradeCode; } public void setTradeCode(String tradeCode) { this.tradeCode = tradeCode; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getPeriod() { return period; } public void setPeriod(String period) { this.period = period; } public double getAmount() { return amount; } public void setAmount(double amount) { this.amount = amount; } public double getRemainder() { return remainder; } public void setRemainder(double remainder) { this.remainder = remainder; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public double getCap() { return cap; } public void setCap(double cap) { this.cap = cap; } public double getCash() { return cash; } public void setCash(double cash) { this.cash = cash; } public double getCost() { return cost; } public void setCost(double cost) { this.cost = cost; } public double getPl() { return pl; } public void setPl(double pl) { this.pl = pl; } public String getSperiod() { return speriod; } public void setSperiod(String speriod) { this.speriod = speriod; } public double getSamount() { return samount; } public void setSamount(double samount) { this.samount = samount; } public double getSprice() { return sprice; } public void setSprice(double sprice) { this.sprice = sprice; } public double getScost() { return scost; } public void setScost(double scost) { this.scost = scost; } public double getScap() { return scap; } public void setScap(double scap) { this.scap = scap; } public double getWcap() { return wcap; } public void setWcap(double wcap) { this.wcap = wcap; } public double getScash() { return scash; } public void setScash(double scash) { this.scash = scash; } public String getTradeCode2() { return tradeCode2; } public void setTradeCode2(String tradeCode2) { this.tradeCode2 = tradeCode2; } public String getOptType() { return optType; } public void setOptType(String optType) { this.optType = optType; } public Long getDateTime() { return dateTime; } public void setDateTime(Long dateTime) { this.dateTime = dateTime; } @Override public AccountTrans clone() { AccountTrans o = null; try { o = (AccountTrans) super.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } return o; } }
[ "xia_keyou@163.com" ]
xia_keyou@163.com
dda181dba8af61fbbc2ccde704326328598ba6e9
c7bdefcaa4b2c7d1a857bfd5253c556df0159cbc
/SLOTGAMES/src/test/java/stepDefinition_SkinfiriJungle/SkinfiriJungle_Balance_To_Credits_CreditWinAmountEqualsCurrencyWinAmount_Value2.java
280cb7ff6b78ce44fca9389ee3ca0e64bc92ecdf
[]
no_license
pavanysecit/SLOTGAMES_MOBILES
62a97bded1f4d0df0f50fc2176e473ce3dac267b
80bb25d81feda93b3f9137080bd2f0922e882da6
refs/heads/master
2021-02-15T04:56:59.388043
2021-01-07T09:36:44
2021-01-07T09:36:44
244,863,982
0
0
null
2020-10-13T20:03:05
2020-03-04T09:52:42
Java
UTF-8
Java
false
false
4,424
java
package stepDefinition_SkinfiriJungle; import org.junit.Assert; import org.openqa.selenium.By; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; import io.appium.java_client.AppiumDriver; import io.appium.java_client.MobileElement; public class SkinfiriJungle_Balance_To_Credits_CreditWinAmountEqualsCurrencyWinAmount_Value2 { AppiumDriver<MobileElement> driver; public SkinfiriJungle_Balance_To_Credits_CreditWinAmountEqualsCurrencyWinAmount_Value2() throws InterruptedException { this.driver = SkinfiriJungle_URL_Login.getDriver(); //this.driver = SkinfiriJungle_URL_TryNow.getDriver(); } @Given("^Chrome browser, valid URL, valid login details, Skinfiri Jungle slot game, balance, spin button, win amount in currency, credits and win amount in credits for denomination drop down value two$") public void chrome_browser_valid_URL_valid_login_details_Skinfiri_Jungle_slot_game_balance_spin_button_win_amount_in_currency_credits_and_win_amount_in_credits_for_denomination_drop_down_value_two() throws Throwable { WebDriverWait wait = new WebDriverWait(driver, 80); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("hud_Hud_txtBalance1"))); } @When("^Open the Skinfiri Jungle slot game by entering the valid URL in browser, enter the valid login details, transfer the balance, select the dinomination drop down value two, click on spin button till player wins, click on balance, check the win amount and click on balance$") public void open_the_Skinfiri_Jungle_slot_game_by_entering_the_valid_URL_in_browser_enter_the_valid_login_details_transfer_the_balance_select_the_dinomination_drop_down_value_two_click_on_spin_button_till_player_wins_click_on_balance_check_the_win_amount_and_click_on_balance() throws Throwable { //Storing the value before converting the balance into credits String preWin = driver.findElement(By.id("hud_Hud_txtBalance1")).getText(); String str = preWin.replaceAll(",", ""); System.out.println("Current balance of the account Before Converting into credits: " +str); //Selecting the credit as 0.02 from the drop down and bet amount driver.findElement(By.id("hud_txtCredit")).click(); Thread.sleep(2000); driver.findElement(By.id("hud_CreditPopup20.02")).click(); Thread.sleep(2000); String actual = driver.findElement(By.id("hud_txtCredit")).getText(); String creditValue = actual; System.out.println("Selected credit value is : " +actual); String expected = "0.02"; Assert.assertEquals(actual, expected); String betValue = driver.findElement(By.id("hud_txtBetAmount")).getText(); System.out.println("Selected bet amount is: " +betValue); Thread.sleep(2000); //Clicking on start button MobileElement start = driver.findElement(By.id("hud_btnSpin")); start.click(); Thread.sleep(2000); //Getting win amount MobileElement winE = driver.findElement(By.id("hud_Hud_txtWin1")); String winTex = winE.getText(); while(winTex.isEmpty()) { start.click(); Thread.sleep(8000); winTex= winE.getText(); System.out.println(winTex.isEmpty()); } Thread.sleep(2000); System.out.println("The Win is : "+" "+winTex); System.out.println(winTex.isEmpty()); driver.findElement(By.id("hud_Hud_txtBalance1")).click(); Thread.sleep(1000); String Wcrd = driver.findElement(By.id("hud_Hud_txtWin1")).getText(); String str1 = Wcrd.replaceAll(",", ""); System.out.println("Win amount in credits: " +str1); Thread.sleep(2000); //Converted win amount into credits and multiplying with credit value and it should equal to win amount in currency double conValue = Double.parseDouble(creditValue) * Double.parseDouble(str1); String dbi = String.format("%.2f", conValue); System.out.println("Win Amount after multiplying balance in credits with bet credit value: "+dbi); Thread.sleep(2000); Assert.assertEquals(dbi, winTex); Thread.sleep(2000); } @Then("^Win amount in credit multiplied by denomination drop down value two is equal to win amount in currency in Skinfiri Jungle slot game$") public void win_amount_in_credit_multiplied_by_denomination_drop_down_value_two_is_equal_to_win_amount_in_currency_in_Skinfiri_Jungle_slot_game() throws Throwable { Thread.sleep(2000); driver.quit(); } }
[ "pavan.kumar@ysecit.com" ]
pavan.kumar@ysecit.com
32e097da8b6d5a46eb073f4e1c55df6da33d70a7
560929b1d0ac9f4cae00ebbc2571095c79f07083
/gohttp/src/main/java/me/xiaopan/gohttp/httpclient/GzipProcessRequestInterceptor.java
727b5579e212045f3dbd00d56e8833225933bc81
[ "Apache-2.0" ]
permissive
android-xiaowei/GoHttp
551c3db60b5ffb4e1403197fde284fb5673613b3
991ceea331aaa8b6cdf1911e462c789c6321fb01
refs/heads/master
2021-01-14T08:50:23.961146
2015-07-13T16:19:00
2015-07-13T16:19:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,457
java
/* * Copyright (C) 2013 Peng fei Pan <sky@xiaopan.me> * * 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 me.xiaopan.gohttp.httpclient; import org.apache.http.HttpException; import org.apache.http.HttpRequest; import org.apache.http.HttpRequestInterceptor; import org.apache.http.protocol.HttpContext; import java.io.IOException; public class GzipProcessRequestInterceptor implements HttpRequestInterceptor{ /** * 头字段 - 接受的编码 */ public static final String HEADER_ACCEPT_ENCODING = "Accept-Encoding"; /** * 编码 - gzip */ public static final String ENCODING_GZIP = "gzip"; @Override public void process(HttpRequest request, HttpContext context) throws HttpException, IOException { //如果请求头中没有HEADER_ACCEPT_ENCODING属性就添加进去 if (!request.containsHeader(HEADER_ACCEPT_ENCODING)) { request.addHeader(HEADER_ACCEPT_ENCODING, ENCODING_GZIP); } } }
[ "sky@xiaopan.me" ]
sky@xiaopan.me
128588702ec0faa16f6925ca2d7aa7c426eaa286
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_f2e3e3f10701f8194210aa8829b7321c561cdbaf/GerritApiUtil/2_f2e3e3f10701f8194210aa8829b7321c561cdbaf_GerritApiUtil_s.java
8db86337a82642a2e16bc26d1253c61c7f9911f4
[]
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
7,019
java
/* * Copyright 2000-2011 JetBrains s.r.o. * Copyright 2013 Urs Wolfer * * 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.urswolfer.intellij.plugin.gerrit.rest; import com.google.common.base.Throwables; import com.google.gson.JsonElement; import com.google.gson.JsonParser; import com.google.gson.JsonSyntaxException; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.ThrowableConvertor; import com.intellij.util.net.HttpConfigurable; import com.urswolfer.intellij.plugin.gerrit.GerritSettings; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpMethod; import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.auth.AuthScope; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.StringRequestEntity; import org.apache.commons.httpclient.params.HttpConnectionManagerParams; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.IOException; /** * Parts based on org.jetbrains.plugins.github.GithubApiUtil * * @author Urs Wolfer */ public class GerritApiUtil { private static final int CONNECTION_TIMEOUT = 5000; private static final Logger LOG = Logger.getInstance(GerritApiUtil.class); @Nullable public static JsonElement getRequest(@NotNull String host, @NotNull String login, @NotNull String password, @NotNull String path) { return request(host, login, password, path, null, false); } @Nullable public static JsonElement postRequest(@NotNull String host, @Nullable String login, @Nullable String password, @NotNull String path, @Nullable String requestBody) { return request(host, login, password, path, requestBody, true); } @Nullable private static JsonElement request(@NotNull String host, @Nullable String login, @Nullable String password, @NotNull String path, @Nullable String requestBody, boolean post) { HttpMethod method = null; try { method = doREST(host, login, password, path, requestBody, post); String resp = method.getResponseBodyAsString(); if (method.getStatusCode() != 200) { String message = String.format("Request not successful. Message: %s. Status-Code: %s.", method.getStatusCode(), method.getStatusText()); LOG.warn(message); throw new HttpStatusException(method.getStatusCode(), method.getStatusText(), message); } if (resp == null) { String message = String.format("Unexpectedly empty response: %s.", resp); LOG.warn(message); throw new RuntimeException(message); } return parseResponse(resp); } catch (IOException e) { LOG.warn(String.format("Request failed: %s", e.getMessage()), e); throw Throwables.propagate(e); } finally { if (method != null) { method.releaseConnection(); } } } @NotNull private static HttpMethod doREST(@NotNull String host, @Nullable String login, @Nullable String password, @NotNull String path, @Nullable final String requestBody, final boolean post) throws IOException { HttpClient client = getHttpClient(login, password); String uri = host + path; return SslSupport.getInstance().executeSelfSignedCertificateAwareRequest(client, uri, new ThrowableConvertor<String, HttpMethod, IOException>() { @Override public HttpMethod convert(String uri) throws IOException { if (post) { PostMethod method = new PostMethod(uri); if (requestBody != null) { method.setRequestEntity(new StringRequestEntity(requestBody, "application/json", "UTF-8")); } return method; } return new GetMethod(uri); } }); } public static String getApiUrl() { return GerritSettings.getInstance().getHost(); } @NotNull private static HttpClient getHttpClient(@Nullable final String login, @Nullable final String password) { final HttpClient client = new HttpClient(); HttpConnectionManagerParams params = client.getHttpConnectionManager().getParams(); params.setConnectionTimeout(CONNECTION_TIMEOUT); //set connection timeout (how long it takes to connect to remote host) params.setSoTimeout(CONNECTION_TIMEOUT); //set socket timeout (how long it takes to retrieve data from remote host) client.getParams().setContentCharset("UTF-8"); // Configure proxySettings if it is required final HttpConfigurable proxySettings = HttpConfigurable.getInstance(); if (proxySettings.USE_HTTP_PROXY && !StringUtil.isEmptyOrSpaces(proxySettings.PROXY_HOST)) { client.getHostConfiguration().setProxy(proxySettings.PROXY_HOST, proxySettings.PROXY_PORT); if (proxySettings.PROXY_AUTHENTICATION) { client.getState().setProxyCredentials(AuthScope.ANY, new UsernamePasswordCredentials(proxySettings.PROXY_LOGIN, proxySettings.getPlainProxyPassword())); } } if (login != null && password != null) { client.getParams().setCredentialCharset("UTF-8"); client.getParams().setAuthenticationPreemptive(true); client.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(login, password)); } return client; } @NotNull private static JsonElement parseResponse(@NotNull String response) { try { return new JsonParser().parse(response); } catch (JsonSyntaxException jse) { throw new RuntimeException(String.format("Couldn't parse response: %n%s", response), jse); } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
8a40e16d37392794de278beb1a5cfac59e988d35
b1c1f87e19dec3e06b66b60ea32943ca9fceba81
/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/HiddenInputTagTests.java
a6c855a03d4158d14640d8b6a930b4cc71816ad8
[ "Apache-2.0" ]
permissive
JunMi/SpringFramework-SourceCode
d50751f79803690301def6478e198693e2ff7348
4918e0e6a0676a62fd2a9d95acf6eb4fa5edb82b
refs/heads/master
2020-06-19T10:55:34.451834
2019-07-13T04:32:14
2019-07-13T13:11:54
196,678,387
1
0
null
null
null
null
UTF-8
Java
false
false
3,669
java
/* * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.web.servlet.tags.form; import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.Tag; import org.junit.Test; import org.springframework.tests.sample.beans.TestBean; import org.springframework.validation.BeanPropertyBindingResult; import static org.junit.Assert.*; /** * @author Rob Harrop */ public class HiddenInputTagTests extends AbstractFormTagTests { private HiddenInputTag tag; private TestBean bean; @Override @SuppressWarnings("serial") protected void onSetUp() { this.tag = new HiddenInputTag() { @Override protected TagWriter createTagWriter() { return new TagWriter(getWriter()); } }; this.tag.setPageContext(getPageContext()); } @Test public void render() throws Exception { this.tag.setPath("name"); int result = this.tag.doStartTag(); assertEquals(Tag.SKIP_BODY, result); String output = getOutput(); assertTagOpened(output); assertTagClosed(output); assertContainsAttribute(output, "type", "hidden"); assertContainsAttribute(output, "value", "Sally Greenwood"); assertAttributeNotPresent(output, "disabled"); } @Test public void withCustomBinder() throws Exception { this.tag.setPath("myFloat"); BeanPropertyBindingResult errors = new BeanPropertyBindingResult(this.bean, COMMAND_NAME); errors.getPropertyAccessor().registerCustomEditor(Float.class, new SimpleFloatEditor()); exposeBindingResult(errors); assertEquals(Tag.SKIP_BODY, this.tag.doStartTag()); String output = getOutput(); assertTagOpened(output); assertTagClosed(output); assertContainsAttribute(output, "type", "hidden"); assertContainsAttribute(output, "value", "12.34f"); } @Test public void dynamicTypeAttribute() throws JspException { try { this.tag.setDynamicAttribute(null, "type", "email"); fail("Expected exception"); } catch (IllegalArgumentException e) { assertEquals("Attribute type=\"email\" is not allowed", e.getMessage()); } } @Test public void disabledTrue() throws Exception { this.tag.setDisabled(true); this.tag.doStartTag(); this.tag.doEndTag(); String output = getOutput(); assertTagOpened(output); assertTagClosed(output); assertContainsAttribute(output, "disabled", "disabled"); } // SPR-8661 @Test public void disabledFalse() throws Exception { this.tag.setDisabled(false); this.tag.doStartTag(); this.tag.doEndTag(); String output = getOutput(); assertTagOpened(output); assertTagClosed(output); assertAttributeNotPresent(output, "disabled"); } private void assertTagClosed(String output) { assertTrue(output.endsWith("/>")); } private void assertTagOpened(String output) { assertTrue(output.startsWith("<input ")); } @Override protected TestBean createTestBean() { this.bean = new TestBean(); bean.setName("Sally Greenwood"); bean.setMyFloat(new Float("12.34")); return bean; } }
[ "648326357@qq.com" ]
648326357@qq.com
c5757d9e266c3da254dbbe611cb08f118e463270
8464b5f858f09a715b30d42093d280e0ac625c82
/bson/src/test/unit/org/bson/codecs/pojo/entities/NestedReusedGenericsModel.java
f3756f5b4bc2deabd9c0dd28d58d75a423c08a9e
[ "Apache-2.0" ]
permissive
rozza/mongo-java-driver
be7887b438594b47d7981022cb0444ffe2a2d86c
674d1a9a618221257877b8bb8b9e4986556624c6
refs/heads/master
2023-08-07T13:56:38.785053
2023-07-11T09:20:22
2023-07-11T09:24:05
10,246,360
3
0
Apache-2.0
2023-09-13T12:54:43
2013-05-23T15:06:03
Java
UTF-8
Java
false
false
2,019
java
/* * Copyright 2008-present MongoDB, 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 org.bson.codecs.pojo.entities; import java.util.List; public final class NestedReusedGenericsModel { private ReusedGenericsModel<Long, List<SimpleModel>, String> nested; public NestedReusedGenericsModel() { } public NestedReusedGenericsModel(final ReusedGenericsModel<Long, List<SimpleModel>, String> nested) { this.nested = nested; } /** * Returns the nested * * @return the nested */ public ReusedGenericsModel<Long, List<SimpleModel>, String> getNested() { return nested; } public void setNested(final ReusedGenericsModel<Long, List<SimpleModel>, String> nested) { this.nested = nested; } @Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof NestedReusedGenericsModel)) { return false; } NestedReusedGenericsModel that = (NestedReusedGenericsModel) o; if (getNested() != null ? !getNested().equals(that.getNested()) : that.getNested() != null) { return false; } return true; } @Override public int hashCode() { return getNested() != null ? getNested().hashCode() : 0; } @Override public String toString() { return "NestedReusedGenericsModel{" + "nested=" + nested + "}"; } }
[ "ross.lawley@gmail.com" ]
ross.lawley@gmail.com
5edf1c0e3fca833fe23267a8b8ee24a707f4fbd2
95e944448000c08dd3d6915abb468767c9f29d3c
/sources/android/support/p022v4/app/C0587ab.java
40bd101ed6d4c71b5d3b10fa3ba975942661c075
[]
no_license
xrealm/tiktok-src
261b1faaf7b39d64bb7cb4106dc1a35963bd6868
90f305b5f981d39cfb313d75ab231326c9fca597
refs/heads/master
2022-11-12T06:43:07.401661
2020-07-04T20:21:12
2020-07-04T20:21:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,612
java
package android.support.p022v4.app; import android.view.View; import android.view.View.OnAttachStateChangeListener; import android.view.ViewTreeObserver; import android.view.ViewTreeObserver.OnPreDrawListener; /* renamed from: android.support.v4.app.ab */ final class C0587ab implements OnAttachStateChangeListener, OnPreDrawListener { /* renamed from: a */ private final View f2334a; /* renamed from: b */ private ViewTreeObserver f2335b; /* renamed from: c */ private final Runnable f2336c; public final boolean onPreDraw() { m2462a(); this.f2336c.run(); return true; } /* renamed from: a */ private void m2462a() { if (this.f2335b.isAlive()) { this.f2335b.removeOnPreDrawListener(this); } else { this.f2334a.getViewTreeObserver().removeOnPreDrawListener(this); } this.f2334a.removeOnAttachStateChangeListener(this); } public final void onViewDetachedFromWindow(View view) { m2462a(); } public final void onViewAttachedToWindow(View view) { this.f2335b = view.getViewTreeObserver(); } private C0587ab(View view, Runnable runnable) { this.f2334a = view; this.f2335b = view.getViewTreeObserver(); this.f2336c = runnable; } /* renamed from: a */ public static C0587ab m2461a(View view, Runnable runnable) { C0587ab abVar = new C0587ab(view, runnable); view.getViewTreeObserver().addOnPreDrawListener(abVar); view.addOnAttachStateChangeListener(abVar); return abVar; } }
[ "65450641+Xyzdesk@users.noreply.github.com" ]
65450641+Xyzdesk@users.noreply.github.com
431e90254c795b2f4895f01951d5a227d986d984
a80b14012b0b654f44895e3d454cccf23f695bdb
/corejava/src/main/java/dp/behaviour/strategy/ConcreteStrategyA.java
7af810d53bbc4f8b6f842464cd6f401caadb3f9a
[]
no_license
azhi365/lime-java
7a9240cb5ce88aefeb57baeb1283872b549bcab9
11b326972d0a0b6bb010a4328f374a3249ee4520
refs/heads/master
2023-03-31T19:08:28.736443
2018-03-02T14:40:29
2018-03-02T14:40:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
459
java
/** * * @author yzhi * @date 2012-1-20 下午04:22:48 * @copyright 2012 haitian.com All rights reserved * @version V1.0 * */ package dp.behaviour.strategy; /** * 具体策略角色A * @author YZhi * @since 1.0 */ public class ConcreteStrategyA implements Strategy { /* (non-Javadoc) * @see behaviour.strategy.Strategy#doSomething() */ @Override public void doSomething() { System.out.println("doSomething in ConcreteStrategyA"); } }
[ "yangzhi365@163.com" ]
yangzhi365@163.com
a72ac77e9480470a4276f7bb10262f72d3cd09d8
139960e2d7d55e71c15e6a63acb6609e142a2ace
/mobile_app1/module1022/src/main/java/module1022packageJava0/Foo599.java
8ef323bdd9d666628e6b321099870dab6e96a6b7
[ "Apache-2.0" ]
permissive
uber-common/android-build-eval
448bfe141b6911ad8a99268378c75217d431766f
7723bfd0b9b1056892cef1fef02314b435b086f2
refs/heads/master
2023-02-18T22:25:15.121902
2023-02-06T19:35:34
2023-02-06T19:35:34
294,831,672
83
7
Apache-2.0
2021-09-24T08:55:30
2020-09-11T23:27:37
Java
UTF-8
Java
false
false
296
java
package module1022packageJava0; import java.lang.Integer; public class Foo599 { Integer int0; public void foo0() { new module1022packageJava0.Foo598().foo3(); } public void foo1() { foo0(); } public void foo2() { foo1(); } public void foo3() { foo2(); } }
[ "oliviern@uber.com" ]
oliviern@uber.com
3b08954c192c87e2ccce439a825bfd4888600499
c81963cab526c4dc24bee21840f2388caf7ff4cf
/com/google/firebase/inappmessaging/internal/injection/modules/ProtoStorageClientModule_ProvidesProtoStorageClientForCampaignFactory.java
76326f9712d6b7284eb2aadddcd84b42352b151a
[]
no_license
ryank231231/jp.co.penet.gekidanprince
ba2f38e732828a4454402aa7ef93a501f8b7541e
d76db01eeadf228d31006e4e71700739edbf214f
refs/heads/main
2023-02-19T01:38:54.459230
2021-01-16T10:04:22
2021-01-16T10:04:22
329,815,191
0
0
null
null
null
null
UTF-8
Java
false
false
1,598
java
package com.google.firebase.inappmessaging.internal.injection.modules; import android.app.Application; import com.google.firebase.inappmessaging.internal.ProtoStorageClient; import dagger.internal.Factory; import dagger.internal.Preconditions; import javax.inject.Provider; public final class ProtoStorageClientModule_ProvidesProtoStorageClientForCampaignFactory implements Factory<ProtoStorageClient> { private final Provider<Application> applicationProvider; private final ProtoStorageClientModule module; public ProtoStorageClientModule_ProvidesProtoStorageClientForCampaignFactory(ProtoStorageClientModule paramProtoStorageClientModule, Provider<Application> paramProvider) { this.module = paramProtoStorageClientModule; this.applicationProvider = paramProvider; } public static Factory<ProtoStorageClient> create(ProtoStorageClientModule paramProtoStorageClientModule, Provider<Application> paramProvider) { return new ProtoStorageClientModule_ProvidesProtoStorageClientForCampaignFactory(paramProtoStorageClientModule, paramProvider); } public ProtoStorageClient get() { return (ProtoStorageClient)Preconditions.checkNotNull(this.module.providesProtoStorageClientForCampaign((Application)this.applicationProvider.get()), "Cannot return null from a non-@Nullable @Provides method"); } } /* Location: Y:\classes-dex2jar.jar!\com\google\firebase\inappmessaging\internal\injection\modules\ProtoStorageClientModule_ProvidesProtoStorageClientForCampaignFactory.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
[ "ryank231231@gmail.com" ]
ryank231231@gmail.com
e3d3c75932dd5e21de2b778988b89200f6defba3
3883554587c8f3f75a7bebd746e1269b8e1e5ef1
/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/FilterNestedImpl.java
89ce78123bc20366716b1c935e1944e68af4e38e
[ "Apache-2.0" ]
permissive
KamalSinghKhanna/kubernetes-client
58f663fdc0ca4b6006ae1448ac89b04b6093e46d
08261fba6c9306eb063534ec2320e9166f85c71c
refs/heads/master
2023-08-17T04:33:28.646984
2021-09-23T17:17:24
2021-09-23T17:17:24
409,863,910
1
0
Apache-2.0
2021-09-24T06:55:57
2021-09-24T06:55:57
null
UTF-8
Java
false
false
7,928
java
/** * Copyright (C) 2015 Red Hat, 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 io.fabric8.kubernetes.client.dsl.base; import io.fabric8.kubernetes.api.model.HasMetadata; import io.fabric8.kubernetes.api.model.KubernetesResourceList; import io.fabric8.kubernetes.api.model.LabelSelector; import io.fabric8.kubernetes.api.model.LabelSelectorRequirement; import io.fabric8.kubernetes.api.model.ObjectReference; import io.fabric8.kubernetes.client.dsl.FilterNested; import io.fabric8.kubernetes.client.dsl.FilterWatchListDeletable; import io.fabric8.kubernetes.client.dsl.Resource; import io.fabric8.kubernetes.client.utils.Utils; import java.lang.reflect.Array; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; final class FilterNestedImpl<T extends HasMetadata, L extends KubernetesResourceList<T>, R extends Resource<T>> implements FilterNested<FilterWatchListDeletable<T, L>> { private static final String INVOLVED_OBJECT_NAME = "involvedObject.name"; private static final String INVOLVED_OBJECT_NAMESPACE = "involvedObject.namespace"; private static final String INVOLVED_OBJECT_KIND = "involvedObject.kind"; private static final String INVOLVED_OBJECT_UID = "involvedObject.uid"; private static final String INVOLVED_OBJECT_RESOURCE_VERSION = "involvedObject.resourceVersion"; private static final String INVOLVED_OBJECT_API_VERSION = "involvedObject.apiVersion"; private static final String INVOLVED_OBJECT_FIELD_PATH = "involvedObject.fieldPath"; private final BaseOperation<T, L, R> baseOperation; private OperationContext context; FilterNestedImpl(BaseOperation<T, L, R> baseOperation) { this.baseOperation = baseOperation; // create a context copy context = this.baseOperation.context; context = this.context.copy(); // create map copies - this could be done lazily if needed context.labels = new LinkedHashMap<>(this.baseOperation.context.getLabels()); context.labelsNot = new LinkedHashMap<>(this.baseOperation.context.getLabelsNot()); context.labelsIn = new LinkedHashMap<>(this.baseOperation.context.getLabelsIn()); context.labelsNotIn = new LinkedHashMap<>(this.baseOperation.context.getLabelsNotIn()); context.fields = new LinkedHashMap<>(this.baseOperation.context.getFields()); // Use a multi-value map as its possible to define keyA != foo && keyA != bar context.fieldsNot = new LinkedHashMap<>(this.baseOperation.context.getFieldsNot()); } @Override public FilterNested<FilterWatchListDeletable<T, L>> withLabels(Map<String, String> labels) { this.context.labels.putAll(labels); return this; } @Override public FilterNested<FilterWatchListDeletable<T, L>> withoutLabels(Map<String, String> labels) { // Re-use "withoutLabel" to convert values from String to String[] labels.forEach(this::withoutLabel); return this; } @Override public FilterNested<FilterWatchListDeletable<T, L>> withLabelIn(String key, String... values) { context.labelsIn.put(key, values); return this; } @Override public FilterNested<FilterWatchListDeletable<T, L>> withLabelNotIn(String key, String... values) { context.labelsNotIn.put(key, values); return this; } @Override public FilterNested<FilterWatchListDeletable<T, L>> withLabel(String key, String value) { context.labels.put(key, value); return this; } @Override public FilterNested<FilterWatchListDeletable<T, L>> withoutLabel(String key, String value) { context.labelsNot.merge(key, new String[]{value}, (oldList, newList) -> { final String[] concatList = (String[]) Array.newInstance(String.class, oldList.length + newList.length); System.arraycopy(oldList, 0, concatList, 0, oldList.length); System.arraycopy(newList, 0, concatList, oldList.length, newList.length); return concatList; }); return this; } @Override public FilterNested<FilterWatchListDeletable<T, L>> withFields(Map<String, String> fields) { this.context.fields.putAll(fields); return this; } @Override public FilterNested<FilterWatchListDeletable<T, L>> withField(String key, String value) { this.context.fields.put(key, value); return this; } @Override public FilterNested<FilterWatchListDeletable<T, L>> withoutFields(Map<String, String> fields) { // Re-use "withoutField" to convert values from String to String[] fields.forEach(this::withoutField); return this; } @Override public FilterNested<FilterWatchListDeletable<T, L>> withoutField(String key, String value) { context.fieldsNot.merge(key, new String[]{value}, (oldList, newList) -> { if (Utils.isNotNullOrEmpty(newList[0])) { // Only add new values when not null final String[] concatList = (String[]) Array.newInstance(String.class, oldList.length + newList.length); System.arraycopy(oldList, 0, concatList, 0, oldList.length); System.arraycopy(newList, 0, concatList, oldList.length, newList.length); return concatList; } else { return oldList; } }); return this; } @Override public FilterNested<FilterWatchListDeletable<T, L>> withLabelSelector(LabelSelector selector) { Map<String, String> matchLabels = selector.getMatchLabels(); if (matchLabels != null) { withLabels(matchLabels); } List<LabelSelectorRequirement> matchExpressions = selector.getMatchExpressions(); if (matchExpressions != null) { for (LabelSelectorRequirement req : matchExpressions) { String operator = req.getOperator(); String key = req.getKey(); switch (operator) { case "In": withLabelIn(key, req.getValues().toArray(new String[]{})); break; case "NotIn": withLabelNotIn(key, req.getValues().toArray(new String[]{})); break; case "DoesNotExist": withoutLabel(key); break; case "Exists": withLabel(key); break; default: throw new IllegalArgumentException("Unsupported operator: " + operator); } } } return this; } @Override public FilterNested<FilterWatchListDeletable<T, L>> withInvolvedObject(ObjectReference objectReference) { if (objectReference.getName() != null) { context.fields.put(INVOLVED_OBJECT_NAME, objectReference.getName()); } if (objectReference.getNamespace() != null) { context.fields.put(INVOLVED_OBJECT_NAMESPACE, objectReference.getNamespace()); } if (objectReference.getKind() != null) { context.fields.put(INVOLVED_OBJECT_KIND, objectReference.getKind()); } if (objectReference.getUid() != null) { context.fields.put(INVOLVED_OBJECT_UID, objectReference.getUid()); } if (objectReference.getResourceVersion() != null) { context.fields.put(INVOLVED_OBJECT_RESOURCE_VERSION, objectReference.getResourceVersion()); } if (objectReference.getApiVersion() != null) { context.fields.put(INVOLVED_OBJECT_API_VERSION, objectReference.getApiVersion()); } if (objectReference.getFieldPath() != null) { context.fields.put(INVOLVED_OBJECT_FIELD_PATH, objectReference.getFieldPath()); } return this; } @Override public FilterWatchListDeletable<T, L> and() { return this.baseOperation.newInstance(context); } }
[ "marc@marcnuri.com" ]
marc@marcnuri.com
cf38bc7360b083d6b99872e8db32d64aac4a1d26
fff8f77f810bbd5fb6b4e5f7a654568fd9d3098d
/src/main/java/kotlinx/coroutines/channels/ChannelKt.java
45908387d8e78d01ca12640ce152c8bbacd129f4
[]
no_license
TL148/gorkiy
b6ac8772587e9e643d939ea399bf5e7a42e89f46
da8fbd017277cf72020c8c800326954bb1a0cee3
refs/heads/master
2021-05-21T08:24:39.286900
2020-04-03T02:57:49
2020-04-03T02:57:49
252,618,229
0
0
null
2020-04-03T02:54:39
2020-04-03T02:54:39
null
UTF-8
Java
false
false
1,278
java
package kotlinx.coroutines.channels; import androidx.exifinterface.media.ExifInterface; import kotlin.Metadata; @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0010\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\u001a\u001c\u0010\u0000\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0001\"\u0004\b\u0000\u0010\u00022\b\b\u0002\u0010\u0003\u001a\u00020\u0004¨\u0006\u0005"}, d2 = {"Channel", "Lkotlinx/coroutines/channels/Channel;", ExifInterface.LONGITUDE_EAST, "capacity", "", "kotlinx-coroutines-core"}, k = 2, mv = {1, 1, 16}) /* compiled from: Channel.kt */ public final class ChannelKt { public static /* synthetic */ Channel Channel$default(int i, int i2, Object obj) { if ((i2 & 1) != 0) { i = 0; } return Channel(i); } public static final <E> Channel<E> Channel(int i) { if (i == -2) { return new ArrayChannel<>(Channel.Factory.getCHANNEL_DEFAULT_CAPACITY$kotlinx_coroutines_core()); } if (i == -1) { return new ConflatedChannel<>(); } if (i == 0) { return new RendezvousChannel<>(); } if (i != Integer.MAX_VALUE) { return new ArrayChannel<>(i); } return new LinkedListChannel<>(); } }
[ "itaysontesterlab@gmail.com" ]
itaysontesterlab@gmail.com
67d2b6c0fcc79cba8f21acfe02eee9a953e6319f
d325e12ba9521a66026718dc3153ae92a47559c6
/coco/.svn/pristine/fd/fd9676f373c5251446aa9d144ae78e3be333cbf5.svn-base
c871d49b1367d4fc4afc5da18f32532dfd35d9c0
[]
no_license
niarehtni/nccode
ee69ab00a3f522832d8e4f25abe1083dfc39fdfe
b85f86e71b392a3e5883a77e921949e2249c736d
refs/heads/master
2023-01-03T21:07:34.865967
2020-10-31T06:49:33
2020-10-31T06:49:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
646
package nc.vo.ta.overtime; import nc.vo.pubapp.pattern.model.entity.bill.AbstractBill; import nc.vo.pubapp.pattern.model.meta.entity.bill.BillMetaFactory; import nc.vo.pubapp.pattern.model.meta.entity.bill.IBillMeta; @nc.vo.annotation.AggVoInfo(parentVO = "nc.vo.ta.overtime.OTLeaveBalanceVO") public class AggOTLeaveBalanceVO extends AbstractBill { @Override public IBillMeta getMetaData() { IBillMeta billMeta =BillMetaFactory.getInstance().getBillMeta(AggOTLeaveBalanceVOMeta.class); return billMeta; } @Override public OTLeaveBalanceVO getParentVO(){ return (OTLeaveBalanceVO)this.getParent(); } }
[ "sunsx@sina.com" ]
sunsx@sina.com
0f4e38fe38fbafca23a95aedeeca941ba2dcbc3d
79a68dbd94ff1261c778f65b9e4c9ce55920ed36
/teach_materials/src/com/zs/service/basic/teachmaterial/EditTeachMaterialService.java
f5345a537b4a7f8996bdb9a5511e4fc446252207
[]
no_license
Allen5413/tm
e6ca0f6c509fb163e391265c65094ab6fdcbb663
595d44ccc787588f0995d5769908e12c3c6b387f
refs/heads/master
2021-01-23T09:33:16.232580
2019-11-26T13:50:25
2019-11-26T13:50:25
34,732,908
0
0
null
null
null
null
UTF-8
Java
false
false
369
java
package com.zs.service.basic.teachmaterial; import com.feinno.framework.common.service.EntityService; import com.zs.domain.basic.TeachMaterial; /** * Created by Allen on 2015/4/29. */ public interface EditTeachMaterialService extends EntityService<TeachMaterial> { public void editTeachMaterial(TeachMaterial teachMaterial, String loginName)throws Exception; }
[ "2319772333@qq.com" ]
2319772333@qq.com
bbcaf642a909d6d6ba4e1f47741acedabb8ad3d4
5449824379ef6828cf3dacafe2ab4ab720f663f5
/app/src/main/java/byou/yadun/wallet/adapter/base/OnMultiItemClickListeners.java
a3bcc42ef8d6186a37b76454d2dfb9abd3bd83b8
[]
no_license
Xdone111/beyou
38735050db0b1daa224cc4064c0858eefc68fb84
f24acc510070b108f954e4ff1515c4918a322962
refs/heads/master
2020-03-17T00:38:40.571483
2018-05-12T07:56:17
2018-05-12T07:56:17
133,125,004
0
0
null
null
null
null
UTF-8
Java
false
false
183
java
package byou.yadun.wallet.adapter.base; /** * */ public interface OnMultiItemClickListeners<T> { void onItemClick(ViewHolder viewHolder, T data, int position, int viewType); }
[ "502180980@qq.com" ]
502180980@qq.com
204b5994bf4c87f2b747e5936137dd821c6e3d23
e12b5a858c47f6d2569350a73f7440ebbf93117a
/osrs-script/src/main/java/com/palidinodh/osrsscript/incomingpacket/command/GroupIronCommand.java
1ee617dcb2e30fe78ccaa24f2c97f4a3cf5d4569
[]
no_license
sw130637/BattleScape-Server
287ade1cc49893ff2a0784a2b114cb162c26bb9a
4d83d24c64a0881c3309e5308fc744b20cc84615
refs/heads/master
2020-09-16T03:24:43.300718
2019-11-23T18:27:20
2019-11-23T18:27:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,041
java
package com.palidinodh.osrsscript.incomingpacket.command; import com.palidinodh.osrscore.io.incomingpacket.CommandHandler; import com.palidinodh.osrscore.model.player.Player; import com.palidinodh.rs.setting.SqlUserRank; import lombok.var; public class GroupIronCommand implements CommandHandler { @Override public String getExample() { return "username"; } @Override public boolean canUse(Player player) { return player.getRights() == Player.RIGHTS_ADMIN || player.isUsergroup(SqlUserRank.COMMUNITY_MANAGER); } @Override public void execute(Player player, String username) { var player2 = player.getWorld().getPlayerByUsername(username); if (player2 == null) { player.getGameEncoder().sendMessage("Unable to find user " + username + "."); return; } player2.putAttribute("can_change_group", true); player2.getGameEncoder() .sendMessage("Your group ironman timer has been reset by " + player.getUsername()); player.getGameEncoder().sendMessage("Success"); } }
[ "palidino@Daltons-MacBook-Air.local" ]
palidino@Daltons-MacBook-Air.local
bde031eb1970cf07145008f028daca195196b689
f643eb2bffea8995b057f01347ccf9ff63e85344
/8.教育局-华网功能点/4.单点登录 - 副本/src/com/seeyon/apps/ext/oauthLogin/oauthLoginPluginInitializer.java
1e67396036122df588cc3db1e5fad6e9fc9ded1b
[]
no_license
AirSkye/A-8-code
13598ff31d554ec68f1e677c2f9284931594d0c9
008c6d21dd8c9b406c16fc86b899534b712121c4
refs/heads/master
2023-07-18T10:54:24.056687
2021-03-16T03:02:41
2021-03-16T03:02:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
373
java
package com.seeyon.apps.ext.oauthLogin; import com.seeyon.ctp.common.AbstractSystemInitializer; public class oauthLoginPluginInitializer extends AbstractSystemInitializer { @Override public void initialize() { System.out.println("加载oauthLogin"); } @Override public void destroy() { System.out.println("销毁oauthLogin"); } }
[ "741963634@qq.com" ]
741963634@qq.com
7cef0a412dc3eca74078daa610a1ba7d8b8f4fd0
4ab19457cbf69d1d41179ee8558f404673573c92
/src/main/java/lambdasinaction/chap15/ThreadExample.java
486423bb557b1e9aa53bb77edfa257b12f88bbb3
[]
no_license
BingYu-track/Java8-in-Action
1814c6960fa86d5537d615b8f17b20183a1f10a6
77c727b12af7445d6a5870d36a6997f3c2e6e2e9
refs/heads/master
2023-09-03T19:43:13.472146
2021-10-08T13:51:58
2021-10-08T13:51:58
382,866,547
1
1
null
null
null
null
UTF-8
Java
false
false
542
java
package lambdasinaction.chap15; class ThreadExample { public static void main(String[] args) throws InterruptedException { int x = 1337; Result result = new Result(); Thread t1 = new Thread(() -> { result.left = Functions.f(x); }); Thread t2 = new Thread(() -> { result.right = Functions.g(x); }); t1.start(); t2.start(); t1.join(); t2.join(); System.out.println(result.left + result.right); } private static class Result { private int left; private int right; } }
[ "525782303@qq.com" ]
525782303@qq.com
8b36487c9d6999f067e65edd95f01b7b9b9ff3ed
a3a5aeb018ab1c3e92f924e13c7e290eeec6bd06
/workspace/web-03-3-tomat-http/src/cn/wolfcode/_4_request/ServletRequestDemo.java
1a2c00f6364a76fa5d3c7da8ecf3defe4fdd942b
[]
no_license
qyl1006/JavaApps
bc21a25d9a28e98f83227af6b54b6b4859a7ff30
e47445194677531babcc7a20c8fd334f253682e1
refs/heads/master
2021-05-15T07:44:26.776608
2018-03-09T14:37:21
2018-03-09T14:37:21
111,789,114
0
0
null
null
null
null
UTF-8
Java
false
false
2,497
java
package cn.wolfcode._4_request; import java.io.IOException; import java.util.Arrays; import java.util.Enumeration; import javax.servlet.ServletException; import javax.servlet.annotation.WebInitParam; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @SuppressWarnings("serial") @WebServlet(value=("/req"), initParams={@WebInitParam(name="pwd", value="test")}) public class ServletRequestDemo extends HttpServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { //req.setCharacterEncoding("utf-8"); //getRequestURI:返回请求行中的资源名字部分:如/test/index.html System.out.println("URI: " + req.getRequestURI());// 返回String类型 //getRequestURL:返回浏览器地址栏中的所有信息 System.out.println("URL: " + req.getRequestURL());// 返回StringBuffer类型 //getContextPath:获取当前项目的上下文路劲<Context />元素的path属性值 System.out.println("Context: " + req.getContextPath()); //getRemoteAddr:返回发出请求的客户机的IP地址 System.out.println("IP: " + req.getRemoteAddr()); System.out.println("host: " + req.getRemoteHost()); System.out.println("port端口: " + req.getRemotePort()); System.out.println("User: " + req.getRemoteUser()); //String getParameter(String name):返回指定名字参数的值。 System.out.println("用户名: " + req.getParameter("username")); System.out.println("密码: " + req.getParameter("pwd")); System.out.println("城市: " + req.getParameter("city")); //String[] getParameterValues(String name):返回指定名字参数的多个参数值。 System.out.println("返回指定名字参数的多个参数值:"); String[] parameterValues = req.getParameterValues("gender"); System.out.println(Arrays.toString(parameterValues)); // Enumeration<String> getParameterNames():返回所有参数名的Enumeration对象 System.out.println("-------------分割线--------"); Enumeration<String> parameterNames = req.getParameterNames(); while(parameterNames.hasMoreElements()){ String nextElement = parameterNames.nextElement(); System.out.println("request: " + nextElement + " - " + getInitParameter(nextElement)); } //Map<String,String[]> getParameterMap():返回所有的参数和值所组成的Map对象 } }
[ "yuelinshi@qq.com" ]
yuelinshi@qq.com
291a80b9a03239e16aaf8758f5de2f9704df9fbf
e82a9f95b3b4fab0a5b816e3fb4fab79268d652b
/app/src/main/java/com/reyurnible/android/networkhistory/ProviderApplication.java
83d0c67dd56e143197898e91b101eb5ac1eb59a6
[ "Apache-2.0" ]
permissive
Reyurnible/AndroidNetworkHistory
0447ef65579bf74483f7b91eab18ff6cfcb81c75
5d2211959b75bf5f3c39b755aa72439f45dbfd96
refs/heads/master
2021-01-11T01:37:38.799609
2019-06-02T06:07:08
2019-06-02T06:07:08
70,682,767
11
2
Apache-2.0
2019-06-02T06:06:42
2016-10-12T09:08:08
Java
UTF-8
Java
false
false
387
java
package com.reyurnible.android.networkhistory; import android.app.Application; import com.reyurnible.android.networkhistory.repository.RepositoryProvider; /** * Application for Initialize repositories */ public class ProviderApplication extends Application { @Override public void onCreate() { super.onCreate(); RepositoryProvider.initialize(this); } }
[ "reyurnible@gmail.com" ]
reyurnible@gmail.com
801aba83702431430fdc622b1b9c8a44d2d28c44
fcda34dabc2da39f8aaebf825c28e6682fd9ab7e
/iam-services/openiam-esb/src/test/java/org/openiam/service/integration/provisioning/ProvisionServiceTest.java
f7f01fbcb9d9ab5f74e3d52d0280a88ec747e384
[]
no_license
cshuig/openiam-idm-ce
af1550a3bf1cb6b82465fcf3e89c24be84b6dddf
79423b496860615029a53687863e787541978440
refs/heads/master
2020-03-31T17:24:32.700815
2016-05-17T05:43:49
2016-05-17T05:43:49
58,993,586
0
0
null
2016-05-17T05:41:15
2016-05-17T05:41:15
null
UTF-8
Java
false
false
5,375
java
package org.openiam.service.integration.provisioning; import java.util.Date; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import org.openiam.base.AttributeOperationEnum; import org.openiam.base.ws.Response; import org.openiam.idm.srvc.auth.dto.Login; import org.openiam.idm.srvc.auth.ws.LoginDataWebService; import org.openiam.idm.srvc.auth.ws.LoginResponse; import org.openiam.idm.srvc.continfo.dto.Address; import org.openiam.idm.srvc.continfo.dto.EmailAddress; import org.openiam.idm.srvc.continfo.dto.Phone; import org.openiam.idm.srvc.meta.domain.MetadataTypeGrouping; import org.openiam.idm.srvc.provision.NewUserModelToProvisionConverter; import org.openiam.idm.srvc.user.dto.User; import org.openiam.idm.srvc.user.dto.UserStatusEnum; import org.openiam.provision.dto.ProvisionUser; import org.openiam.provision.resp.ProvisionUserResponse; import org.openiam.provision.service.ProvisionService; import org.openiam.service.integration.AbstractServiceTest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.testng.Assert; import org.testng.annotations.Test; public class ProvisionServiceTest extends AbstractServiceTest { @Autowired @Qualifier("provisionServiceClient") private ProvisionService provisionService; @Autowired @Qualifier("loginServiceClient") private LoginDataWebService loginServiceClient; @Test public void testIDMAPPS2488() throws Exception { for(int i = 0; i < 500; i++) { final User user = new User(); user.setFirstName(getRandomName()); user.setLastName(getRandomName()); user.setClassification(getRandomName()); user.setBirthdate(new Date()); user.setClaimDate(new Date()); user.setCostCenter(getRandomName()); user.setEmployeeId(getRandomName()); user.setEmployeeTypeId(getMetadataTypesByGrouping(MetadataTypeGrouping.USER_TYPE).get(0).getId()); user.setJobCodeId(getMetadataTypesByGrouping(MetadataTypeGrouping.JOB_CODE).get(0).getId()); user.setLocationCd(getRandomName()); user.setLocationName(getRandomName()); user.setMaidenName(getRandomName()); user.setMailCode(getRandomName()); user.setMdTypeId(getMetadataTypesByGrouping(MetadataTypeGrouping.USER_OBJECT_TYPE).get(0).getId()); user.setMiddleInit(getRandomName(1)); user.setName(getRandomName()); user.setNickname(getRandomName()); user.setPrefix(getRandomName(3)); user.setSecondaryStatus(UserStatusEnum.ACTIVE); user.setSex("M"); user.setShowInSearch(Integer.valueOf(1)); user.setStatus(UserStatusEnum.ACTIVE); user.setSuffix(getRandomName(3)); user.setTitle(getRandomName()); user.setUserTypeInd(getRandomName()); final List<Address> addresses = new LinkedList<Address>(); final Address address = new Address(); address.setAddress1(getRandomName()); address.setBldgNumber(getRandomName(2)); address.setCity(getRandomName()); address.setCountry(getRandomName()); address.setDescription(getRandomName()); address.setIsActive(true); address.setMetadataTypeId(getMetadataTypesByGrouping(MetadataTypeGrouping.ADDRESS).get(0).getId()); address.setName(getRandomName()); address.setPostalCd(getRandomName()); address.setSuite(getRandomName()); address.setOperation(AttributeOperationEnum.ADD); addresses.add(address); user.setAddresses(new HashSet<Address>(addresses)); final List<EmailAddress> emails = new LinkedList<EmailAddress>(); final EmailAddress email = new EmailAddress(); email.setDescription(getRandomName()); email.setIsActive(true); email.setMetadataTypeId(getMetadataTypesByGrouping(MetadataTypeGrouping.EMAIL).get(0).getId()); email.setName(getRandomName()); email.setEmailAddress(getRandomName() + "@" + getRandomName()); email.setOperation(AttributeOperationEnum.ADD); emails.add(email); user.setEmailAddresses(new HashSet<EmailAddress>(emails)); final List<Phone> phones = new LinkedList<Phone>(); final Phone phone = new Phone(); phone.setAreaCd(getRandomName(3)); phone.setCountryCd(getRandomName(3)); phone.setDescription(getRandomName()); phone.setMetadataTypeId(getMetadataTypesByGrouping(MetadataTypeGrouping.PHONE).get(0).getId()); phone.setName(getRandomName()); phone.setPhoneExt(getRandomName(3)); phone.setPhoneNbr(getRandomName()); phones.add(phone); user.setPhones(new HashSet<Phone>(phones)); final List<Login> loginList = new LinkedList<Login>(); final Login login = new Login(); login.setManagedSysId("0"); login.setLogin(getRandomName()); loginList.add(login); user.setPrincipalList(loginList); final ProvisionUser pUser = new ProvisionUser(user); final ProvisionUserResponse pResponse = provisionService.addUser(pUser); Assert.assertNotNull(pResponse); Assert.assertTrue(pResponse.isSuccess()); /* final LoginResponse loginResponse = loginServiceClient.getLoginByManagedSys(login.getLogin(), login.getManagedSysId()); Assert.assertNotNull(loginResponse); Assert.assertTrue(loginResponse.isSuccess()); Assert.assertNotNull(loginResponse.getPrincipal()); final Response userResponse = userServiceClient.removeUser(loginResponse.getPrincipal().getUserId()); Assert.assertNotNull(userResponse); Assert.assertTrue(userResponse.isSuccess()); */ } } }
[ "Dmitry.Zaporozhec@openiam.com" ]
Dmitry.Zaporozhec@openiam.com
5c191ccd60601459f5a06227fd0629559bc11dec
f4772134546575be4dd006f14c2a3aae2d3e89fd
/spring-kafka/src/main/java/org/springframework/kafka/listener/AfterRollbackProcessor.java
28202fbae4194574a5d372838f0a932d916b6870
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
denis554/spring-kafka
a739e2551420c6fac424125d3911fbf83039558b
e98664f4293e278a7bb148f1aae2d91bddc1a0d2
refs/heads/master
2020-05-02T16:19:58.027809
2019-03-27T16:37:01
2019-03-27T16:37:01
178,065,383
3
0
null
null
null
null
UTF-8
Java
false
false
3,002
java
/* * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.kafka.listener; import java.util.List; import org.apache.kafka.clients.consumer.Consumer; import org.apache.kafka.clients.consumer.ConsumerRecord; /** * Invoked by a listener container with remaining, unprocessed, records * (including the failed record). Implementations should seek the desired * topics/partitions so that records will be re-fetched on the next * poll. When used with a batch listener, the entire batch of records is * provided. * * @param <K> the key type. * @param <V> the value type. * * @author Gary Russell * * @since 1.3.5 * */ @FunctionalInterface public interface AfterRollbackProcessor<K, V> { /** * Process the remaining records. Recoverable will be true if the container is * processing individual records; this allows the processor to recover (skip) the * failed record rather than re-seeking it. This is not possible with a batch listener * since only the listener itself knows which record in the batch keeps failing. * IMPORTANT: If invoked in a transaction when the listener was invoked with a single * record, the transaction id will be based on the container group.id and the * topic/partition of the failed record, to avoid issues with zombie fencing. So, * generally, only its offset should be sent to the transaction. For other behavior * the process method should manage its own transaction. * @param records the records. * @param consumer the consumer. * @param exception the exception * @param recoverable the recoverable. * @since 2.2 * @see #isProcessInTransaction() */ void process(List<ConsumerRecord<K, V>> records, Consumer<K, V> consumer, Exception exception, boolean recoverable); /** * Optional method to clear thread state; will be called just before a consumer * thread terminates. * @since 2.2 */ default void clearThreadState() { // NOSONAR } /** * Return true to invoke {@link #process(List, Consumer, Exception, boolean)} in a new * transaction. Because the container cannot infer the desired behavior, the processor * is responsible for sending the offset to the transaction if it decides to skip the * failing record. * @return true to run in a transaction; default false. * @since 2.2.5 * @see #process(List, Consumer, Exception, boolean) */ default boolean isProcessInTransaction() { return false; } }
[ "denisignatenko554@gmail.com" ]
denisignatenko554@gmail.com
a1975ecd89ac84582d389170ef2d318cc4484271
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Chart/15/org/jfree/chart/axis/CyclicNumberAxis_CyclicNumberAxis_171.java
1ee4e3b76decde27800ee688831be57df16cca9a
[]
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,040
java
org jfree chart axi number axi numberaxi handl cycl tradit represent data rang pre pre rang bound axi extrem cyclic axi time split cycl time frame durat period cycl axi definit handl larger interv period pre period pre full period repres axi cycl bound number mark begin time frame pre previou cycl current cycl pre multipl period option start offset pre period offset pre definit consecut cycl bound period precis call period visual represent cyclic axi pre current cycl previou cycl pre cycl bound axi end current cycl shown cycl dynam data visual effect current cycl eras cycl grow cycl bound reach process start eras previou cycl cyclic item render provid cyclic number axi cyclicnumberaxi number axi numberaxi creat cycl number axi cyclenumberaxi period offset param period period param offset offset cyclic number axi cyclicnumberaxi period offset period offset
[ "hvdthong@gmail.com" ]
hvdthong@gmail.com
845f0ff492c584f27063407036068650aea34f0a
447520f40e82a060368a0802a391697bc00be96f
/apks/comparison_qark/at.spardat.bcrmobile/classes_dex2jar/android/support/v4/view/ak.java
cb4c4510a7ab0018594b21b7e7b98c15a30bb938
[ "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
4,369
java
package android.support.v4.view; import android.view.View; import android.view.ViewParent; public final class ak { private final View a; private ViewParent b; private boolean c; private int[] d; public final void a(boolean paramBoolean) { if (this.c) { au.k(this.a); } this.c = paramBoolean; } public final boolean a() { return this.c; } public final boolean a(float paramFloat1, float paramFloat2) { if ((this.c) && (this.b != null)) { return cg.a(this.b, this.a, paramFloat1, paramFloat2); } return false; } public final boolean a(float paramFloat1, float paramFloat2, boolean paramBoolean) { if ((this.c) && (this.b != null)) { return cg.a(this.b, this.a, paramFloat1, paramFloat2, paramBoolean); } return false; } public final boolean a(int paramInt) { if (b()) { return true; } if (this.c) { ViewParent localViewParent = this.a.getParent(); View localView = this.a; while (localViewParent != null) { if (cg.a(localViewParent, localView, this.a, paramInt)) { this.b = localViewParent; cg.b(localViewParent, localView, this.a, paramInt); return true; } if ((localViewParent instanceof View)) { localView = (View)localViewParent; } localViewParent = localViewParent.getParent(); } } return false; } public final boolean a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int[] paramArrayOfInt) { boolean bool1 = this.c; boolean bool2 = false; int k; int i; if (bool1) { ViewParent localViewParent = this.b; bool2 = false; if (localViewParent != null) { if ((paramInt1 == 0) && (paramInt2 == 0) && (paramInt3 == 0) && (paramInt4 == 0)) { break label133; } if (paramArrayOfInt == null) { break label153; } this.a.getLocationInWindow(paramArrayOfInt); k = paramArrayOfInt[0]; i = paramArrayOfInt[1]; } } for (int j = k;; j = 0) { cg.a(this.b, this.a, paramInt1, paramInt2, paramInt3, paramInt4); if (paramArrayOfInt != null) { this.a.getLocationInWindow(paramArrayOfInt); paramArrayOfInt[0] -= j; paramArrayOfInt[1] -= i; } bool2 = true; label133: do { return bool2; bool2 = false; } while (paramArrayOfInt == null); paramArrayOfInt[0] = 0; paramArrayOfInt[1] = 0; return false; label153: i = 0; } } public final boolean a(int paramInt1, int paramInt2, int[] paramArrayOfInt1, int[] paramArrayOfInt2) { boolean bool1 = this.c; boolean bool2 = false; int j; int i; if (bool1) { ViewParent localViewParent = this.b; bool2 = false; if (localViewParent != null) { if ((paramInt1 == 0) && (paramInt2 == 0)) { break label168; } if (paramArrayOfInt2 == null) { break label188; } this.a.getLocationInWindow(paramArrayOfInt2); j = paramArrayOfInt2[0]; i = paramArrayOfInt2[1]; } } for (;;) { if (paramArrayOfInt1 == null) { if (this.d == null) { this.d = new int[2]; } paramArrayOfInt1 = this.d; } paramArrayOfInt1[0] = 0; paramArrayOfInt1[1] = 0; cg.a(this.b, this.a, paramInt1, paramInt2, paramArrayOfInt1); if (paramArrayOfInt2 != null) { this.a.getLocationInWindow(paramArrayOfInt2); paramArrayOfInt2[0] -= j; paramArrayOfInt2[1] -= i; } if (paramArrayOfInt1[0] == 0) { int k = paramArrayOfInt1[1]; bool2 = false; if (k == 0) {} } else { bool2 = true; } label168: do { return bool2; bool2 = false; } while (paramArrayOfInt2 == null); paramArrayOfInt2[0] = 0; paramArrayOfInt2[1] = 0; return false; label188: i = 0; j = 0; } } public final boolean b() { return this.b != null; } public final void c() { if (this.b != null) { cg.a(this.b, this.a); this.b = null; } } }
[ "antal.micky@yahoo.com" ]
antal.micky@yahoo.com
2788ef2814a79b534aea96af7977d4fd783ee77e
8fd2e347ebff0abdb8dfef3df3f6dcc26dd7621c
/src/test/java/org/openstreetmap/atlas/utilities/collections/ParallelIterableTest.java
a981a35ae39067aba2c0b1f1d4bc687fdcdec565
[ "BSD-3-Clause" ]
permissive
osmlab/atlas
0c38770d05f7fb3d17e85365711acf7ae3969806
f525a7a3f09c95b5c96562648d8901031091e752
refs/heads/dev
2023-03-30T20:27:04.162725
2023-03-23T22:49:14
2023-03-23T22:49:14
99,717,758
216
83
BSD-3-Clause
2022-11-21T11:44:13
2017-08-08T17:14:27
Java
UTF-8
Java
false
false
3,249
java
package org.openstreetmap.atlas.utilities.collections; import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Optional; import org.junit.Assert; import org.junit.Test; /** * @author cuthbertm */ public class ParallelIterableTest { @Test public void testDifferentObjectTypes() { final List<Long> firstThree = Arrays.asList(1L, 2L, 3L); final List<String> secondThree = Arrays.asList("test1", "test2", "test3"); final List<Integer> thirdThree = Arrays.asList(7, 8, 9); final ParallelIterable parallel = new ParallelIterable(firstThree, secondThree, thirdThree); final Iterator<JoinedCollection> iterator = parallel.iterator(); int indexCounter = 0; while (iterator.hasNext()) { final JoinedCollection joined = iterator.next(); Assert.assertEquals(firstThree.get(indexCounter), joined.get(0)); Assert.assertEquals(secondThree.get(indexCounter), joined.get(1)); Assert.assertEquals(thirdThree.get(indexCounter++), joined.get(2)); } } @Test public void testMultipleLongTypes() { final List<Long> firstThree = Arrays.asList(1L, 2L, 3L); final List<Long> secondThree = Arrays.asList(4L, 5L, 6L); final List<Long> thirdThree = Arrays.asList(7L, 8L, 9L); final ParallelIterable parallel = new ParallelIterable(firstThree, secondThree, thirdThree); final Iterator<JoinedCollection> iterator = parallel.iterator(); int indexCounter = 0; while (iterator.hasNext()) { final JoinedCollection joined = iterator.next(); Assert.assertEquals(firstThree.get(indexCounter), joined.get(0)); Assert.assertEquals(secondThree.get(indexCounter), joined.get(1)); Assert.assertEquals(thirdThree.get(indexCounter++), joined.get(2)); } } @SuppressWarnings("deprecation") @Test public void testUnevenLists() { final List<Long> firstThree = Arrays.asList(1L, 2L, 3L, 12L, 45L); final List<Long> secondThree = Arrays.asList(4L, 5L, 6L); final List<Long> thirdThree = Arrays.asList(7L, 8L, 9L, 10L); final ParallelIterable parallel = new ParallelIterable(firstThree, secondThree, thirdThree); final Iterator<JoinedCollection> iterator = parallel.iterator(); int indexCounter = 0; while (iterator.hasNext()) { final JoinedCollection joined = iterator.next(); Assert.assertEquals(Optional.of(firstThree.get(indexCounter)), joined.getOption(0)); if (indexCounter > 2) { Assert.assertEquals(Optional.empty(), joined.getOption(1)); } else { Assert.assertEquals(Optional.of(secondThree.get(indexCounter)), joined.getOption(1)); } if (indexCounter > 3) { Assert.assertEquals(null, joined.get(2)); } else { Assert.assertEquals(Optional.of(thirdThree.get(indexCounter++)), joined.getOption(2)); } } } }
[ "matthieu.nahoum@gmail.com" ]
matthieu.nahoum@gmail.com
27beebbcacadb219cb9b3922f3dec0231f0dcf30
1067898863878254f94339b26481f41e17387b22
/Instantiable/GUI/ItemIconButton.java
c5f47b18ae19f19c91bb1a30cb050c80152c2f82
[]
no_license
KookykraftMC/DragonAPI
4c3ecda1b4e84c6b14ad36451fd9f99f3a45ecec
ac4b97fe30ed22f1b755543c31e07cb9cbdc3273
refs/heads/master
2021-01-17T14:03:10.013105
2016-03-07T18:35:44
2016-03-07T18:35:44
53,346,083
1
1
null
2016-03-07T17:49:04
2016-03-07T17:49:03
null
UTF-8
Java
false
false
1,908
java
/******************************************************************************* * @author Reika Kalseki * * Copyright 2015 * * All rights reserved. * Distribution of the software in any form is only allowed with * explicit, prior permission from the owner. ******************************************************************************/ package Reika.DragonAPI.Instantiable.GUI; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.ItemStack; import org.lwjgl.opengl.GL11; import Reika.DragonAPI.Libraries.IO.ReikaGuiAPI; public class ItemIconButton extends GuiButton { private int color; private boolean shadow = true; private ItemStack iconItem; private static final RenderItem itemRender = new RenderItem(); /** Draw a Gui Button with an image background. Args: id, x, y, color, itemstack */ public ItemIconButton(int par1, int par2, int par3, int par9, ItemStack is) { super(par1, par2, par3, 200, 20, null); enabled = true; visible = true; id = par1; xPosition = par2; yPosition = par3; width = 16; height = 16; displayString = null; color = par9; if (is != null) iconItem = is.copy(); } /** * Draws this button to the screen. */ @Override public void drawButton(Minecraft par1Minecraft, int par2, int par3) { if (visible) { FontRenderer var4 = par1Minecraft.fontRenderer; int tex = GL11.GL_TEXTURE_BINDING_2D; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); boolean var5 = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height; ReikaGuiAPI.instance.drawItemStack(itemRender, par1Minecraft.fontRenderer, iconItem, xPosition, yPosition); this.mouseDragged(par1Minecraft, par2, par3); GL11.glColor4d(1, 1, 1, 1); } } }
[ "reikasminecraft@gmail.com" ]
reikasminecraft@gmail.com
cfe7b671905196b176f1980db659dd44df44617e
0b5c095e1c9906f8f38674571522973175af0b0c
/business/trade/buy-biz/src/main/java/study/daydayup/wolf/business/trade/buy/biz/base/TradeFlow.java
899195b8cb7a33ff46bca30501de1c388d0d2c56
[ "MIT" ]
permissive
hunshikan/wolf
4c6fc584bea94ce994ff5a11a1a22ad5468dc52a
1435c3bd0c05f4ec477f97922a9a85ef69c42433
refs/heads/master
2022-04-16T03:54:03.051696
2020-04-09T15:50:48
2020-04-09T15:50:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,203
java
package study.daydayup.wolf.business.trade.buy.biz.base; import study.daydayup.wolf.business.trade.api.dto.buy.base.request.BuyRequest; import study.daydayup.wolf.business.trade.api.dto.buy.base.request.PayResultRequest; import study.daydayup.wolf.business.trade.api.dto.buy.base.request.PayRequest; import study.daydayup.wolf.business.trade.api.dto.buy.base.response.ConfirmResponse; import study.daydayup.wolf.business.trade.api.dto.buy.base.response.PayResultResponse; import study.daydayup.wolf.business.trade.api.dto.buy.base.response.PayResponse; import study.daydayup.wolf.business.trade.api.dto.buy.base.response.PreviewResponse; import java.util.List; /** * study.daydayup.wolf.business.trade.buy.domain.entity.flow * TODO refactor * @author Wingle * @since 2019/10/5 10:54 AM **/ public interface TradeFlow { void init(); List<TradeNode> buildConfirmFlow(); List<TradeNode> buildPreviewFlow(); List<TradeNode> buildPayFlow(); List<TradeNode> buildPayNotifyFlow(); PreviewResponse preview(BuyRequest request); ConfirmResponse confirm(BuyRequest request); PayResponse pay(PayRequest request); PayResultResponse payNotify(PayResultRequest request); }
[ "winglechen@gmail.com" ]
winglechen@gmail.com
49c75c923359eaecfbfb4583014b83a2762dac35
f79893d94abe1735b81f3366fc637f8c65b1614e
/tajo-core/src/main/java/org/apache/tajo/master/session/SessionLivelinessMonitor.java
483920fc05665fde2760943f66c4135857f9851f
[ "MIT", "Apache-2.0" ]
permissive
leusonmario/tajo
d8a031abed602cb681a809e1d81a4e0fa5b83d26
fcc5da03ad1e9a692efad20aaf90a4005f9084d0
refs/heads/master
2021-01-21T10:13:33.835562
2014-08-11T02:22:59
2014-08-11T02:22:59
101,974,461
0
0
null
2017-08-31T07:49:42
2017-08-31T07:49:42
null
UTF-8
Java
false
false
1,990
java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.tajo.master.session; import com.google.common.base.Preconditions; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.yarn.event.Dispatcher; import org.apache.hadoop.yarn.event.EventHandler; import org.apache.hadoop.yarn.util.AbstractLivelinessMonitor; import org.apache.hadoop.yarn.util.SystemClock; import org.apache.tajo.conf.TajoConf; public class SessionLivelinessMonitor extends AbstractLivelinessMonitor<String> { private EventHandler dispatcher; public SessionLivelinessMonitor(Dispatcher d) { super(SessionLivelinessMonitor.class.getSimpleName(), new SystemClock()); this.dispatcher = d.getEventHandler(); } public void serviceInit(Configuration conf) throws Exception { Preconditions.checkArgument(conf instanceof TajoConf); TajoConf systemConf = (TajoConf) conf; // seconds int expireIntvl = systemConf.getIntVar(TajoConf.ConfVars.CLIENT_SESSION_EXPIRY_TIME); setExpireInterval(expireIntvl); setMonitorInterval(expireIntvl / 3); super.serviceInit(conf); } @Override protected void expire(String id) { dispatcher.handle(new SessionEvent(id, SessionEventType.EXPIRE)); } }
[ "hyunsik@apache.org" ]
hyunsik@apache.org
f0442228dee7021913cb146fd6908ebaab076eb3
ea0fdfd66ce904fd98f21a4eee349f83b1825632
/src/erp/mod/fin/db/SDbAbpItemLink.java
520d0cb09343074223c6fa288566c91579508953
[ "MIT" ]
permissive
swaplicado/siie32
247560d152207228d59d2513107cac229bd391f1
9edd4099d69dd9e060dd64eb4a50cd91cc809c67
refs/heads/master
2023-09-01T15:42:26.706875
2023-07-28T15:41:54
2023-07-28T15:41:54
41,698,005
0
3
null
null
null
null
UTF-8
Java
false
false
6,579
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package erp.mod.fin.db; import erp.mod.SModConsts; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Date; import sa.gui.util.SUtilConsts; import sa.lib.db.SDbConsts; import sa.lib.db.SDbRegistryUser; import sa.lib.gui.SGuiSession; /** * * @author Juan Barajas */ public class SDbAbpItemLink extends SDbRegistryUser { protected int mnPkAbpItemId; protected int mnPkLinkId; protected int mnPkReferenceId; /* protected boolean mbDeleted; protected int mnFkUserInsertId; protected int mnFkUserUpdateId; protected Date mtTsUserInsert; protected Date mtTsUserUpdate; */ public SDbAbpItemLink() { super(SModConsts.FIN_ABP_ITEM_LINK); } public void setPkAbpItemId(int n) { mnPkAbpItemId = n; } public void setPkLinkId(int n) { mnPkLinkId = n; } public void setPkReferenceId(int n) { mnPkReferenceId = n; } public void setDeleted(boolean b) { mbDeleted = b; } public void setFkUserInsertId(int n) { mnFkUserInsertId = n; } public void setFkUserUpdateId(int n) { mnFkUserUpdateId = n; } public void setTsUserInsert(Date t) { mtTsUserInsert = t; } public void setTsUserUpdate(Date t) { mtTsUserUpdate = t; } public int getPkAbpItemId() { return mnPkAbpItemId; } public int getPkLinkId() { return mnPkLinkId; } public int getPkReferenceId() { return mnPkReferenceId; } public boolean isDeleted() { return mbDeleted; } public int getFkUserInsertId() { return mnFkUserInsertId; } public int getFkUserUpdateId() { return mnFkUserUpdateId; } public Date getTsUserInsert() { return mtTsUserInsert; } public Date getTsUserUpdate() { return mtTsUserUpdate; } @Override public void setPrimaryKey(int[] pk) { mnPkAbpItemId = pk[0]; mnPkLinkId = pk[1]; mnPkReferenceId = pk[2]; } @Override public int[] getPrimaryKey() { return new int[] { mnPkAbpItemId, mnPkLinkId, mnPkReferenceId }; } @Override public void initRegistry() { initBaseRegistry(); mnPkAbpItemId = 0; mnPkLinkId = 0; mnPkReferenceId = 0; mbDeleted = false; mnFkUserInsertId = 0; mnFkUserUpdateId = 0; mtTsUserInsert = null; mtTsUserUpdate = null; } @Override public String getSqlTable() { return SModConsts.TablesMap.get(mnRegistryType); } @Override public String getSqlWhere() { return "WHERE id_abp_item = " + mnPkAbpItemId + " AND " + "id_link = " + mnPkLinkId + " AND " + "id_ref = " + mnPkReferenceId + " "; } @Override public String getSqlWhere(int[] pk) { return "WHERE id_abp_item = " + pk[0] + " AND " + "id_link = " + pk[1] + " AND " + "id_ref = " + pk[2] + " "; } @Override public void computePrimaryKey(SGuiSession session) throws SQLException, Exception { throw new UnsupportedOperationException("Not supported yet."); } @Override public void read(SGuiSession session, int[] pk) throws SQLException, Exception { ResultSet resultSet = null; initRegistry(); initQueryMembers(); mnQueryResultId = SDbConsts.READ_ERROR; msSql = "SELECT * " + getSqlFromWhere(pk); resultSet = session.getStatement().executeQuery(msSql); if (!resultSet.next()) { throw new Exception(SDbConsts.ERR_MSG_REG_NOT_FOUND); } else { mnPkAbpItemId = resultSet.getInt("id_abp_item"); mnPkLinkId = resultSet.getInt("id_link"); mnPkReferenceId = resultSet.getInt("id_ref"); mbDeleted = resultSet.getBoolean("b_del"); mnFkUserInsertId = resultSet.getInt("fk_usr_ins"); mnFkUserUpdateId = resultSet.getInt("fk_usr_upd"); mtTsUserInsert = resultSet.getTimestamp("ts_usr_ins"); mtTsUserUpdate = resultSet.getTimestamp("ts_usr_upd"); mbRegistryNew = false; } mnQueryResultId = SDbConsts.READ_OK; } @Override public void save(SGuiSession session) throws SQLException, Exception { initQueryMembers(); mnQueryResultId = SDbConsts.SAVE_ERROR; if (mbRegistryNew) { verifyRegistryNew(session); } if (mbRegistryNew) { mbDeleted = false; mnFkUserInsertId = session.getUser().getPkUserId(); mnFkUserUpdateId = SUtilConsts.USR_NA_ID; msSql = "INSERT INTO " + getSqlTable() + " VALUES (" + mnPkAbpItemId + ", " + mnPkLinkId + ", " + mnPkReferenceId + ", " + (mbDeleted ? 1 : 0) + ", " + mnFkUserInsertId + ", " + mnFkUserUpdateId + ", " + "NOW()" + ", " + "NOW()" + " " + ")"; } else { mnFkUserUpdateId = session.getUser().getPkUserId(); msSql = "UPDATE " + getSqlTable() + " SET " + /* "id_abp_item = " + mnPkAbpItemId + ", " + "id_link = " + mnPkLinkId + ", " + "id_ref = " + mnPkReferenceId + ", " + */ "b_del = " + (mbDeleted ? 1 : 0) + ", " + //"fk_usr_ins = " + mnFkUserInsertId + ", " + "fk_usr_upd = " + mnFkUserUpdateId + ", " + //"ts_usr_ins = " + "NOW()" + ", " + "ts_usr_upd = " + "NOW()" + " " + getSqlWhere(); } session.getStatement().execute(msSql); mbRegistryNew = false; mnQueryResultId = SDbConsts.SAVE_OK; } @Override public SDbAbpItemLink clone() throws CloneNotSupportedException { SDbAbpItemLink registry = new SDbAbpItemLink(); registry.setPkAbpItemId(this.getPkAbpItemId()); registry.setPkLinkId(this.getPkLinkId()); registry.setPkReferenceId(this.getPkReferenceId()); registry.setDeleted(this.isDeleted()); registry.setFkUserInsertId(this.getFkUserInsertId()); registry.setFkUserUpdateId(this.getFkUserUpdateId()); registry.setTsUserInsert(this.getTsUserInsert()); registry.setTsUserUpdate(this.getTsUserUpdate()); registry.setRegistryNew(this.isRegistryNew()); return registry; } }
[ "contacto@swaplicado.com.mx" ]
contacto@swaplicado.com.mx
ffc1fdceff6de9ef7aab56d01a9dba20e5e28fe9
8cec169ea5f8bd9c427b05393a4eb57663f06757
/vjkit/src/test/java/com/vip/vjtools/vjkit/base/RuntimeUtilTest.java
3cd73e6c6db2632cbe8bd03b74bd38af7977b1d6
[ "Apache-2.0" ]
permissive
crossoverJie/vjtools
6a24153ca067c8577dc3770ca4131c52e4dcdefa
57985c6ef94dc91e60be68ad4e22404a773548e7
refs/heads/master
2020-03-28T15:36:18.953448
2018-09-13T09:02:02
2018-09-13T09:02:02
148,608,987
2
1
Apache-2.0
2018-09-13T08:43:52
2018-09-13T08:43:52
null
UTF-8
Java
false
false
607
java
package com.vip.vjtools.vjkit.base; import static org.assertj.core.api.Assertions.*; import org.junit.Test; public class RuntimeUtilTest { @Test public void testRuntime() { System.out.println("pid:" + RuntimeUtil.getPid()); assertThat(RuntimeUtil.getPid()).isNotEqualTo(-1); System.out.println("vmargs:" + RuntimeUtil.getVmArguments()); RuntimeUtil.addShutdownHook(new Runnable() { @Override public void run() { System.out.println("systemShutdowning"); } }); assertThat(RuntimeUtil.getCores()).isGreaterThan(1); System.out.println("uptime" + RuntimeUtil.getUpTime()); } }
[ "calvin.xiao@vipshop.com" ]
calvin.xiao@vipshop.com
f9a60fa1c83ab0a05fd24629704569be1f1dfdbf
4ab1a312982ca53053a3983d68189c8851b7b81e
/src/main/java/multithreading/ScheduledTask.java
481f6b8845bff30e52155e5274da92bc69d9fce7
[]
no_license
asahdev15/Java
89e791b99bd4e51d35cbbb84893c88b0ccee9d37
4f64f16b1392bb05eddc731aab57b61ff92afe27
refs/heads/master
2023-03-04T17:59:52.758237
2021-02-18T05:39:51
2021-02-18T05:39:51
245,340,771
0
0
null
null
null
null
UTF-8
Java
false
false
381
java
package multithreading; import java.util.TimerTask; public class ScheduledTask extends TimerTask { public void run() { System.out.println("Fetch checks for frequency defined...." ); System.out.println("For each, Check for website uptime/downtime...." ); System.out.println("Update DB and check if fail notification is required to send...." ); } }
[ "ashishsahdev15@yahoo.in" ]
ashishsahdev15@yahoo.in
6049d44ff3deacc6290981a9618413e8da0a6a29
8228efa27043e0a236ca8003ec0126012e1fdb02
/L2JOptimus_Core/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminLMEvent.java
99e3c59b1d01d4c2650346729693599c6c4cbb67
[]
no_license
wan202/L2JDeath
9982dfce14ae19a22392955b996b42dc0e8cede6
e0ab026bf46ac82c91bdbd048a0f50dc5213013b
refs/heads/master
2020-12-30T12:35:59.808276
2017-05-16T18:57:25
2017-05-16T18:57:25
91,397,726
0
1
null
null
null
null
UTF-8
Java
false
false
2,347
java
/** * */ package net.sf.l2j.gameserver.handler.admincommandhandlers; import net.sf.l2j.Config; import net.sf.l2j.gameserver.handler.IAdminCommandHandler; import net.sf.l2j.gameserver.model.WorldObject; import net.sf.l2j.gameserver.model.actor.instance.Player; import net.sf.l2j.gameserver.model.entity.events.LMEvent; import net.sf.l2j.gameserver.model.entity.events.LMEventTeleporter; import net.sf.l2j.gameserver.model.entity.events.LMManager; /** * @author L0ngh0rn */ public class AdminLMEvent implements IAdminCommandHandler { private static final String[] ADMIN_COMMANDS = { "admin_lm_add", "admin_lm_remove", "admin_lm_advance" }; @Override public boolean useAdminCommand(String command, Player activeChar) { if (command.equals("admin_lm_add")) { WorldObject target = activeChar.getTarget(); if (!(target instanceof Player)) { activeChar.sendMessage("You should select a player!"); return true; } add(activeChar, (Player) target); } else if (command.equals("admin_lm_remove")) { WorldObject target = activeChar.getTarget(); if (!(target instanceof Player)) { activeChar.sendMessage("You should select a player!"); return true; } remove(activeChar, (Player) target); } else if (command.equals("admin_lm_advance")) { LMManager.getInstance().skipDelay(); } return true; } @Override public String[] getAdminCommandList() { return ADMIN_COMMANDS; } private static void add(Player activeChar, Player playerInstance) { if (LMEvent.isPlayerParticipant(playerInstance)) { activeChar.sendMessage("Player already participated in the event!"); return; } if (!LMEvent.addParticipant(playerInstance)) { activeChar.sendMessage("Player instance could not be added, it seems to be null!"); return; } if (LMEvent.isStarted()) { new LMEventTeleporter(playerInstance, true, false); } } private static void remove(Player activeChar, Player playerInstance) { if (!LMEvent.removeParticipant(playerInstance)) { activeChar.sendMessage("Player is not part of the event!"); return; } new LMEventTeleporter(playerInstance, Config.LM_EVENT_PARTICIPATION_NPC_COORDINATES, true, true); } }
[ "wande@DESKTOP-DM71DUV" ]
wande@DESKTOP-DM71DUV
68ed8c6f63f8f1b17015b1c2e9f475119395d75b
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/8/8_69d3219f1a6afe9380164ce7624072b38e4820d3/SMPPGateway/8_69d3219f1a6afe9380164ce7624072b38e4820d3_SMPPGateway_t.java
1822816a50654c3b70db3b991bc8f6ca62dd48a9
[]
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
4,152
java
// SMSLib for Java v3 // A Java API library for sending and receiving SMS via a GSM modem // or other supported gateways. // Web Site: http://www.smslib.org // // Copyright (C) 2002-2012, Thanasis Delenikas, Athens/GREECE. // SMSLib is distributed under the terms of the Apache License version 2.0 // // 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.smslib.smsserver.gateways; import java.lang.reflect.Constructor; import java.util.Properties; import org.smslib.smpp.AbstractSMPPGateway; import org.smslib.smpp.Address; import org.smslib.smpp.BindAttributes; import org.smslib.smpp.Address.NumberingPlanIndicator; import org.smslib.smpp.Address.TypeOfNumber; import org.smslib.smpp.BindAttributes.BindType; /** * <b>SMSServer Application Gateway.</b> * * @author Bassam Al-Sarori */ public class SMPPGateway extends AGateway { public SMPPGateway(String myGatewayId, Properties myProps, org.smslib.smsserver.SMSServer myServer) { super(myGatewayId, myProps, myServer); setDescription(myGatewayId+" SMPP Gateway."); } @SuppressWarnings("unchecked") @Override public void create() throws Exception { String implClass=getProperty("impl"); Class<AbstractSMPPGateway> clazz=(Class<AbstractSMPPGateway>) Class.forName(implClass); Class<?>[] classArgs=new Class[]{String.class,String.class,int.class,BindAttributes.class}; Constructor<AbstractSMPPGateway> con= clazz.getConstructor(classArgs); String host=getProperty("host"); Integer port=Integer.parseInt(getProperty("port")); Object args[]=new Object[]{getGatewayId(),host,port,getBindAttributes()}; AbstractSMPPGateway gateway=con.newInstance(args); String enquireLink=getProperty("enquirelink"); if(enquireLink!=null && !enquireLink.isEmpty()){ gateway.setEnquireLink(Integer.parseInt(enquireLink)); } String ton=getProperty("sourceton"); TypeOfNumber typeOfNumber=(ton==null)?TypeOfNumber.UNKNOWN:TypeOfNumber.valueOf(Byte.parseByte(ton)); String npi=getProperty("sourcenpi"); NumberingPlanIndicator numberingPlanIndicator=(npi==null)?NumberingPlanIndicator.UNKNOWN:NumberingPlanIndicator.valueOf(Byte.parseByte(npi)); gateway.setSourceAddress(new Address(typeOfNumber, numberingPlanIndicator)); ton=getProperty("destton"); typeOfNumber=(ton==null)?TypeOfNumber.UNKNOWN:TypeOfNumber.valueOf(Byte.parseByte(ton)); npi=getProperty("destnpi"); numberingPlanIndicator=(npi==null)?NumberingPlanIndicator.UNKNOWN:NumberingPlanIndicator.valueOf(Byte.parseByte(npi)); gateway.setDestinationAddress(new Address(typeOfNumber, numberingPlanIndicator)); setGateway(gateway); } private BindAttributes getBindAttributes(){ String systemId=getProperty("systemid"); String password=getProperty("password"); String systemType=getProperty("systemtype"); BindType bindType=BindType.getByShortName(getProperty("bindtype")); String ton=getProperty("bindton"); TypeOfNumber typeOfNumber=(ton==null)?TypeOfNumber.UNKNOWN:TypeOfNumber.valueOf(Byte.parseByte(ton)); String npi=getProperty("bindnpi"); NumberingPlanIndicator numberingPlanIndicator=(npi==null)?NumberingPlanIndicator.UNKNOWN:NumberingPlanIndicator.valueOf(Byte.parseByte(npi)); return new BindAttributes(systemId, password, systemType, bindType, new Address(typeOfNumber, numberingPlanIndicator)); } private String getProperty(String name){ String propertyValue=getProperties().getProperty(getGatewayId() + "." +name); if(propertyValue!=null) return propertyValue.trim(); else return propertyValue; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
d8cac5a7c9e7726d2e94a1148db47f1039dcbd00
cf3b1c322d5f950d08be7ec96d0ce55fd1e47ee7
/dragonfly-core/src/main/java/com/agileapes/dragonfly/data/impl/AbstractProceduralDataCallback.java
6eabe55eaff6f476bd132516fa99d03311aeed1d
[ "MIT" ]
permissive
pooyaho/dragonfly
3b40ab869c3114541ace4eebfe45970bf2d1e1bd
c84c39fb7c8385b3912bc810505ecc9d4f2c7e00
refs/heads/master
2021-01-18T10:21:19.703600
2014-04-07T10:18:07
2014-04-07T10:18:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,218
java
/* * Copyright (c) 2013 AgileApes, Ltd. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in 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: * * The above copyright notice and this permission notice shall * be included in all copies or substantial portions of the * Software. */ package com.agileapes.dragonfly.data.impl; import com.agileapes.dragonfly.data.DataOperation; /** * This is an operation that is supposed to not return any values * * @author Mohammad Milad Naseri (m.m.naseri@gmail.com) * @since 1.0 (2013/9/26, 3:02) */ public abstract class AbstractProceduralDataCallback<E extends DataOperation> extends AbstractDefaultDataCallback<E> { protected abstract void executeWithoutResults(E operation); @Override public Object execute(E operation) { executeWithoutResults(operation); return null; } }
[ "m.m.naseri@gmail.com" ]
m.m.naseri@gmail.com
1a993924c211b4c7bceff3955f34cebeedec088b
8358717b853f240843ffa56784773a29b1efc19e
/service-interface-wms/src/main/java/com/jumbo/wms/exception/BusinessException.java
79a68639318259918ebb301b8ba4140cfd85d762
[]
no_license
huanglongf/enterprise_project
65ec3e2c56e4a2909f0881a9276a9966857bb9c7
de1865e638c9620e702818124f0b2deac04028c9
refs/heads/master
2020-05-07T13:25:07.223338
2018-10-21T08:44:33
2018-10-21T08:44:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,297
java
/** * Copyright (c) 2010 Jumbomart All Rights Reserved. * * This software is the confidential and proprietary information of Jumbomart. 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 Jumbo. * * JUMBOMART MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. JUMBOMART SHALL NOT BE LIABLE FOR ANY * DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS * DERIVATIVES. * */ package com.jumbo.wms.exception; import java.io.Serializable; public class BusinessException extends RuntimeException implements Serializable { private static final long serialVersionUID = 5847868283758650823L; private int errorCode; private Object[] args; private BusinessException linkedException; public BusinessException(int errorCode) { super(); this.errorCode = errorCode; } public BusinessException(int errorCode, Object[] args) { super(); this.errorCode = errorCode; this.args = args; } public BusinessException() { super(); errorCode = ErrorCode.ERROR_NOT_SPECIFIED; } public BusinessException(int errorCode, String message) { super(message); this.errorCode = errorCode; } public BusinessException(String message) { super(message); errorCode = ErrorCode.ERROR_NOT_SPECIFIED; } public BusinessException(Throwable cause) { super(cause); errorCode = ErrorCode.ERROR_NOT_SPECIFIED; } public int getErrorCode() { return errorCode; } public void setErrorCode(int errorCode) { this.errorCode = errorCode; } public Object[] getArgs() { return args; } public void setArgs(Object[] args) { this.args = args; } public BusinessException getLinkedException() { return linkedException; } public void setLinkedException(BusinessException linkedException) { this.linkedException = linkedException; } }
[ "lijg@many-it.com" ]
lijg@many-it.com
0e5a48ad177a3b7609273365fb757049f20996fe
4f63fafa16a64dc7c286b2d76d4254682c80d2ee
/aerogear-controller/src/main/java/org/jboss/aerogear/controller/routes/RoutingModule.java
082189a192e5dd76cd99ceb8b63f134010d859bc
[]
no_license
lincolnthree/aerogear-controller
d71bccd80b58b3610e619e7c3ab8c0ea2d7ac6f8
c186a8d9cde8dc18820ec3770dd8754e72e9618d
refs/heads/master
2021-01-19T06:03:00.867103
2012-04-20T06:43:06
2012-04-21T00:31:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
145
java
package org.jboss.aerogear.controller.routes; import java.util.List; public interface RoutingModule { List<? extends Route> getRoutes(); }
[ "lincolnbaxter@gmail.com" ]
lincolnbaxter@gmail.com
cfc6644ed5bb398ba605fe4aecf561785aedaf60
41ae950b46036a9ebe6a221fcc0a23601bfbf190
/LeetCode/src/problem1201_1300/Problem1260.java
10aac1c3767e686ce6df24be8ef461198590426f
[]
no_license
yuruiyin/AlgorithmLearn
f7a88a499d050fa9c5d666514a74de0f0a56d001
4224b664e6d05f233512f77088f6d1437a87cd97
refs/heads/master
2023-07-08T09:19:41.101604
2023-07-03T01:48:08
2023-07-03T01:48:08
143,147,502
4
2
null
null
null
null
UTF-8
Java
false
false
1,092
java
package problem1201_1300; import java.util.ArrayList; import java.util.List; public class Problem1260 { public List<List<Integer>> shiftGrid(int[][] grid, int k) { List<List<Integer>> ansList = new ArrayList<>(); int rowCount = grid.length; int colCount = grid[0].length; int[][] newGrid = new int[rowCount][colCount]; int n = rowCount * colCount; for (int i = 0; i < rowCount; i++) { for (int j = 0; j < colCount; j++) { int index = i * colCount + j; int newIndex = (index + k) % n; int newI = newIndex / colCount; int newJ = newIndex % colCount; newGrid[newI][newJ] = grid[i][j]; } } for (int i = 0; i < rowCount; i++) { List<Integer> list = new ArrayList<>(); for (int j = 0; j < colCount; j++) { list.add(newGrid[i][j]); } ansList.add(list); } return ansList; } public static void main(String[] args) { } }
[ "yuruiyin@cyou-inc.com" ]
yuruiyin@cyou-inc.com
705b14faa0d772ae8436e89182e84b7dee6a49f3
3b116a4821d0dfb77d3222dff541e73f7f3b5220
/src/gun9/JavaComparisonOperators.java
8257e48da47f83b51a16dacd5ac3bb31d847da79
[]
no_license
smlblc/JavaTekrarYeni
c4546b2f0192b60ea6cb7dd81f1d33a801fbdcc1
fec0afae58e805faa8d465851c7303d7d86963bf
refs/heads/master
2023-02-01T15:39:56.681319
2020-12-20T00:26:51
2020-12-20T00:26:51
293,140,050
2
3
null
null
null
null
UTF-8
Java
false
false
919
java
package gun9; public class JavaComparisonOperators { /* == Equality operator a==b false != Not Equal to operator a!=b; 10!=15 true > Greater than a>b; 10 > 15 false < Less than a<b; 10 < 15 true >= Greater than or equal to a>=b; 10 >= 15 false <= Less than or equal to a<=b; 10 <= 15 true */ public static void main(String[] args) { int a = 10; int b = 15; System.out.println( "a equals to b: " + (a == b) ); System.out.println( "a not equals to b: " + (a != b) ); System.out.println( "a greater than b: " + (a > b) ); System.out.println( "a less than b: " + (a < b) ); System.out.println( "a greater than or equals to b: " + (a >= b) ); System.out.println( "a less than or equals to b: " + (a <= b) ); String str = "123"; int i = Integer.parseInt( str ); double dnum = Double.parseDouble( str ); } }
[ "samilbalci.us@gmail.com" ]
samilbalci.us@gmail.com
89dcbac12847827103bedd955b7f2f90df37976a
3641b7a0da34c5d0a0ab7383242f88cc307ab9f6
/open-metadata-implementation/governance-servers/integration-daemon-services/integration-daemon-services-api/src/main/java/org/odpi/openmetadata/governanceservers/integrationdaemonservices/rest/IntegrationGroupSummariesResponse.java
6691e96699f4733b33b023da067535022efba440
[ "CC-BY-4.0", "Apache-2.0" ]
permissive
bogdan-sava/egeria
5b749ba308ab82e3d6f79d9127da9e31cde8037c
8dcfbd20d141d6514ca353088708c3bc9c46a7c8
refs/heads/main
2023-06-07T22:30:48.944981
2023-03-28T16:24:43
2023-03-28T16:24:43
139,545,656
0
1
Apache-2.0
2019-05-24T10:17:54
2018-07-03T07:33:22
Java
UTF-8
Java
false
false
3,595
java
/* SPDX-License-Identifier: Apache-2.0 */ /* Copyright Contributors to the ODPi Egeria project. */ package org.odpi.openmetadata.governanceservers.integrationdaemonservices.rest; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import org.odpi.openmetadata.commonservices.ffdc.rest.FFDCResponseBase; import org.odpi.openmetadata.governanceservers.integrationdaemonservices.properties.IntegrationGroupSummary; import java.util.List; import java.util.Objects; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; @JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) /** * IntegrationGroupSummariesResponse provides a container for transporting the status of a collection of integration groups. */ public class IntegrationGroupSummariesResponse extends FFDCResponseBase { private static final long serialVersionUID = 1L; private List<IntegrationGroupSummary> integrationGroupSummaries = null; /** * Default constructor */ public IntegrationGroupSummariesResponse() { } /** * Copy/clone constructor * * @param template object to copy */ public IntegrationGroupSummariesResponse(IntegrationGroupSummariesResponse template) { if (template != null) { integrationGroupSummaries = template.getIntegrationGroupSummaries(); } } /** * Return the summary of each integration group assigned to the integration daemon. * * @return list of summaries */ public List<IntegrationGroupSummary> getIntegrationGroupSummaries() { if (integrationGroupSummaries == null) { return null; } else if (integrationGroupSummaries.isEmpty()) { return null; } return integrationGroupSummaries; } /** * Set up the summary of each integration group assigned to the integration daemon. * * @param integrationGroupSummaries list of summaries */ public void setIntegrationGroupSummaries(List<IntegrationGroupSummary> integrationGroupSummaries) { this.integrationGroupSummaries = integrationGroupSummaries; } /** * JSON-style toString * * @return description of the object values */ @Override public String toString() { return "IntegrationGroupSummariesResponse{" + "integrationGroupSummaries=" + integrationGroupSummaries + '}'; } /** * Compare objects * * @param objectToCompare object * @return boolean */ @Override public boolean equals(Object objectToCompare) { if (this == objectToCompare) { return true; } if (objectToCompare == null || getClass() != objectToCompare.getClass()) { return false; } IntegrationGroupSummariesResponse that = (IntegrationGroupSummariesResponse) objectToCompare; return Objects.equals(integrationGroupSummaries, that.integrationGroupSummaries); } /** * Simple hash for the object * * @return int */ @Override public int hashCode() { return Objects.hash(integrationGroupSummaries); } }
[ "mandy.e.chessell@gmail.com" ]
mandy.e.chessell@gmail.com
b5477c26819bb7a580197a258d2c83915adefc98
995f73d30450a6dce6bc7145d89344b4ad6e0622
/Mate20-9.0/src/main/java/android/filterpacks/imageproc/ToRGBFilter.java
aff6fc657a1cccebb903754f9bf2b7b697babe02
[]
no_license
morningblu/HWFramework
0ceb02cbe42585d0169d9b6c4964a41b436039f5
672bb34094b8780806a10ba9b1d21036fd808b8e
refs/heads/master
2023-07-29T05:26:14.603817
2021-09-03T05:23:34
2021-09-03T05:23:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,359
java
package android.filterpacks.imageproc; import android.app.slice.SliceItem; import android.filterfw.core.Filter; import android.filterfw.core.FilterContext; import android.filterfw.core.Frame; import android.filterfw.core.FrameFormat; import android.filterfw.core.MutableFrameFormat; import android.filterfw.core.NativeProgram; import android.filterfw.core.Program; import android.filterfw.format.ImageFormat; public class ToRGBFilter extends Filter { private int mInputBPP; private FrameFormat mLastFormat = null; private Program mProgram; public ToRGBFilter(String name) { super(name); } public void setupPorts() { MutableFrameFormat mask = new MutableFrameFormat(2, 2); mask.setDimensionCount(2); addMaskedInputPort(SliceItem.FORMAT_IMAGE, mask); addOutputBasedOnInput(SliceItem.FORMAT_IMAGE, SliceItem.FORMAT_IMAGE); } public FrameFormat getOutputFormat(String portName, FrameFormat inputFormat) { return getConvertedFormat(inputFormat); } public FrameFormat getConvertedFormat(FrameFormat format) { MutableFrameFormat result = format.mutableCopy(); result.setMetaValue(ImageFormat.COLORSPACE_KEY, 2); result.setBytesPerSample(3); return result; } public void createProgram(FilterContext context, FrameFormat format) { this.mInputBPP = format.getBytesPerSample(); if (this.mLastFormat == null || this.mLastFormat.getBytesPerSample() != this.mInputBPP) { this.mLastFormat = format; int i = this.mInputBPP; if (i == 1) { this.mProgram = new NativeProgram("filterpack_imageproc", "gray_to_rgb"); } else if (i == 4) { this.mProgram = new NativeProgram("filterpack_imageproc", "rgba_to_rgb"); } else { throw new RuntimeException("Unsupported BytesPerPixel: " + this.mInputBPP + "!"); } } } public void process(FilterContext context) { Frame input = pullInput(SliceItem.FORMAT_IMAGE); createProgram(context, input.getFormat()); Frame output = context.getFrameManager().newFrame(getConvertedFormat(input.getFormat())); this.mProgram.process(input, output); pushOutput(SliceItem.FORMAT_IMAGE, output); output.release(); } }
[ "dstmath@163.com" ]
dstmath@163.com
1fea579a332d361cfa9c7db54ace7c113134c44d
95c49f466673952b465e19a5ee3ae6eff76bee00
/src/main/java/com/beloo/widget/chipslayoutmanager/p295d/p298c/RealAtEndPlacer.java
41f3147d3aaaee4dc078bfb9951ade65f577d311
[]
no_license
Phantoms007/zhihuAPK
58889c399ae56b16a9160a5f48b807e02c87797e
dcdbd103436a187f9c8b4be8f71bdf7813b6d201
refs/heads/main
2023-01-24T01:34:18.716323
2020-11-25T17:14:55
2020-11-25T17:14:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
580
java
package com.beloo.widget.chipslayoutmanager.p295d.p298c; import android.view.View; import androidx.recyclerview.widget.RecyclerView; /* renamed from: com.beloo.widget.chipslayoutmanager.d.c.h */ /* compiled from: RealAtEndPlacer */ class RealAtEndPlacer extends AbstractPlacer implements IPlacer { RealAtEndPlacer(RecyclerView.LayoutManager layoutManager) { super(layoutManager); } @Override // com.beloo.widget.chipslayoutmanager.p295d.p298c.IPlacer /* renamed from: a */ public void mo21757a(View view) { mo21754a().addView(view); } }
[ "seasonpplp@qq.com" ]
seasonpplp@qq.com
7e035200f6bdb01b40fdf25715d2e5ed0a481fcd
6a51be16ec62f930a0d0333e27fa029a0c88fde9
/3.JavaMultithreading/src/com/javarush/task/task27/task2712/statistic/StatisticManager.java
944ad27c70a2db6428910927c76fc3a830d74ac4
[]
no_license
ValentinJD/JavaRush
8a4345621290f19b61e3563bb103fb4cefa473bf
3f7a129633db10a69ffed284a1cd305c08bb848c
refs/heads/master
2023-05-22T18:46:31.420391
2021-06-15T19:40:11
2021-06-15T19:40:11
377,269,456
0
0
null
null
null
null
UTF-8
Java
false
false
5,328
java
package com.javarush.task.task27.task2712.statistic; import com.javarush.task.task27.task2712.kitchen.Cook; import com.javarush.task.task27.task2712.statistic.event.*; import java.time.LocalDate; import java.time.ZoneId; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; public class StatisticManager { //С его помощью будем регистрировать события в хранилище. private static StatisticManager instance = new StatisticManager(); // синглтон private StatisticStorage statisticStorage = new StatisticStorage(); //private Set<Cook> cooks = new HashSet<>(); private Map<LocalDate, Double> mapProfitInEveryDay; // Дата и заработок за день private Object EventDataRow; private Map<EventType, List<EventDataRow>> storageManager = statisticStorage.storage; private Map<LocalDate, List<EventDataRow>> mapCooksEveryDay; // Дата и список работы поваров в этот день // создаем мапу с ключом датой а значением мапа с именем повара и значением продолжительностью работы в секундах private Map<LocalDate, Map<String, Integer>> mapCooksEveryDay_mapNameCookAndTimeWork = new HashMap<>(); private StatisticManager() { } public static StatisticManager getInstance() { return instance; } public void register(EventDataRow data) { statisticStorage.put(data); }// Регистратор событий в хранилище /*public void register(Cook cook) { cooks.add(cook); }*/ /* метод который из хранилища достанет все данные, относящиеся к отображению рекламы, и посчитает общую прибыль за каждый день. */ public void calcProfitInEveryDay() { List<EventDataRow> eventDataRowList = storageManager.get(EventType.SELECTED_VIDEOS); mapProfitInEveryDay = eventDataRowList.stream() .collect(Collectors .groupingBy(eventDataRow ->{ // System.out.println(eventDataRow.getDate()); return (LocalDate) eventDataRow.getDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); } , Collectors.summingDouble(e -> ((VideoSelectedEventDataRow) e).getAmount()))); } public Map<LocalDate, Double> getMapProfitInEveryDay() { calcProfitInEveryDay(); return mapProfitInEveryDay; } public void calcLoadCooksEveryDay() { // загрузка (рабочее время) повара, сгруппировать по дням. List<EventDataRow> eventDataRowList = storageManager.get(EventType.COOKED_ORDER); mapCooksEveryDay = eventDataRowList.stream() .collect(Collectors .groupingBy(eventDataRow -> (LocalDate) eventDataRow.getDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate() )); //Comparator<String> comparator = String::compareTo; // для сортировки поваров по имени for (Map.Entry<LocalDate, List<EventDataRow>> pair: mapCooksEveryDay.entrySet() ){ LocalDate date = pair.getKey(); // дата List<EventDataRow> listEventDataRow = pair.getValue(); // Map<String, Integer> mapCooksLoadEveryDay = listEventDataRow.stream() .collect(Collectors .groupingBy( eventDataRow -> ((CookedOrderEventDataRow) eventDataRow).getCookName(), Collectors.summingInt( e -> ((CookedOrderEventDataRow)e).getTime() ) ) ); Map<String, Integer> sortedMap = new TreeMap<>(); sortedMap.putAll(mapCooksLoadEveryDay); // создаем отсортированную мап в убышвающем порядке даты mapCooksEveryDay_mapNameCookAndTimeWork.put(date, mapCooksLoadEveryDay); } } public Map<LocalDate, Map<String, Integer>> getMapLoadCooksEveryDay(){ calcLoadCooksEveryDay(); return mapCooksEveryDay_mapNameCookAndTimeWork; } private static class StatisticStorage { private Map<EventType, List<EventDataRow>> storage; // Храним тип события список событий public StatisticStorage() { storage = new HashMap<>(); for (EventType eventType : EventType.values()) { storage.put(eventType, new ArrayList<EventDataRow>()); } } private void put(EventDataRow data) { storage.get(data.getType()) .add(data); // добавляет поле data типа EventDataRow согласно одному из трех EventDataRow } } /*public Set<Cook> getCooks() { return cooks; }*/ }
[ "moysait1984@yandex.ru" ]
moysait1984@yandex.ru
b08f836efa643527e55afa6365433bb7bdd20eeb
fa1408365e2e3f372aa61e7d1e5ea5afcd652199
/src/testcases/CWE83_XSS_Attribute/CWE83_XSS_Attribute__Servlet_URLConnection_71a.java
8695c1a0dbf66e4363e1292657585b1ae64d1b85
[]
no_license
bqcuong/Juliet-Test-Case
31e9c89c27bf54a07b7ba547eddd029287b2e191
e770f1c3969be76fdba5d7760e036f9ba060957d
refs/heads/master
2020-07-17T14:51:49.610703
2019-09-03T16:22:58
2019-09-03T16:22:58
206,039,578
1
2
null
null
null
null
UTF-8
Java
false
false
4,331
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE83_XSS_Attribute__Servlet_URLConnection_71a.java Label Definition File: CWE83_XSS_Attribute__Servlet.label.xml Template File: sources-sink-71a.tmpl.java */ /* * @description * CWE: 83 Cross Site Scripting (XSS) in attributes; Examples(replace QUOTE with an actual double quote): ?img_loc=http://www.google.comQUOTE%20onerror=QUOTEalert(1) and ?img_loc=http://www.google.comQUOTE%20onerror=QUOTEjavascript:alert(1) * BadSource: URLConnection Read data from a web server with URLConnection * GoodSource: A hardcoded string * Sinks: printlnServlet * BadSink : XSS in img src attribute * Flow Variant: 71 Data flow: data passed as an Object reference argument from one method to another in different classes in the same package * * */ package testcases.CWE83_XSS_Attribute; import testcasesupport.*; import javax.servlet.http.*; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.net.URL; import java.net.URLConnection; import java.util.logging.Level; public class CWE83_XSS_Attribute__Servlet_URLConnection_71a extends AbstractTestCaseServlet { public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable { String data; data = ""; /* Initialize data */ /* read input from URLConnection */ { URLConnection urlConnection = (new URL("http://www.example.org/")).openConnection(); BufferedReader readerBuffered = null; InputStreamReader readerInputStream = null; try { readerInputStream = new InputStreamReader(urlConnection.getInputStream(), "UTF-8"); readerBuffered = new BufferedReader(readerInputStream); /* POTENTIAL FLAW: Read data from a web server with URLConnection */ /* This will be reading the first "line" of the response body, * which could be very long if there are no newlines in the HTML */ data = readerBuffered.readLine(); } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO); } finally { /* clean up stream reading objects */ try { if (readerBuffered != null) { readerBuffered.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing BufferedReader", exceptIO); } try { if (readerInputStream != null) { readerInputStream.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing InputStreamReader", exceptIO); } } } (new CWE83_XSS_Attribute__Servlet_URLConnection_71b()).badSink((Object)data , request, response ); } public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable { goodG2B(request, response); } /* goodG2B() - use goodsource and badsink */ private void goodG2B(HttpServletRequest request, HttpServletResponse response) throws Throwable { String data; /* FIX: Use a hardcoded string */ data = "foo"; (new CWE83_XSS_Attribute__Servlet_URLConnection_71b()).goodG2BSink((Object)data , request, response ); } /* 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); } }
[ "bqcuong2212@gmail.com" ]
bqcuong2212@gmail.com
4ceb853a46ef0897ca9226964ded68ec5a7ebf7d
7c23099374591bc68283712ad4e95f977f8dd0d2
/android/support/v4/text/TextUtilsCompat.java
1d503662fb398c3e87322c6f697e4bda3ad672d7
[]
no_license
eFOIA-12/eFOIA
736af184a67de80c209c2719c8119fc260e9fe3e
e9add4119191d68f826981a42fcacdb44982ac89
refs/heads/master
2021-01-21T23:33:36.280202
2015-07-14T17:47:01
2015-07-14T17:47:01
38,971,834
0
1
null
null
null
null
UTF-8
Java
false
false
1,880
java
package android.support.v4.text; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.text.ICUCompat; import java.util.Locale; public class TextUtilsCompat { private static String ARAB_SCRIPT_SUBTAG = "Arab"; private static String HEBR_SCRIPT_SUBTAG = "Hebr"; public static final Locale ROOT = new Locale("", ""); private static int getLayoutDirectionFromFirstChar(Locale var0) { switch(Character.getDirectionality(var0.getDisplayName(var0).charAt(0))) { case 1: case 2: return 1; default: return 0; } } public static int getLayoutDirectionFromLocale(@Nullable Locale var0) { if(var0 != null && !var0.equals(ROOT)) { String var1 = ICUCompat.getScript(ICUCompat.addLikelySubtags(var0.toString())); if(var1 == null) { return getLayoutDirectionFromFirstChar(var0); } if(var1.equalsIgnoreCase(ARAB_SCRIPT_SUBTAG) || var1.equalsIgnoreCase(HEBR_SCRIPT_SUBTAG)) { return 1; } } return 0; } @NonNull public static String htmlEncode(@NonNull String var0) { StringBuilder var3 = new StringBuilder(); for(int var2 = 0; var2 < var0.length(); ++var2) { char var1 = var0.charAt(var2); switch(var1) { case '\"': var3.append("&quot;"); break; case '&': var3.append("&amp;"); break; case '\'': var3.append("&#39;"); break; case '<': var3.append("&lt;"); break; case '>': var3.append("&gt;"); break; default: var3.append(var1); } } return var3.toString(); } }
[ "guest@example.edu" ]
guest@example.edu
cc31244b34e181bd095823f855e96ea16d6c067e
34ef8bf15bd67a41aa28571b1b7bdebfd73371d6
/src/main/java/com/cmi/edc/metamanagement/service/EmailAlreadyUsedException.java
2176855b701a4d1cb1b617f532dcc95a31419a95
[]
no_license
agnoix/MetaDate-Management-application
0d7720793680782949192402752119f95d2af682
030b7858ad3d3534d001f8329d694ec44905aec8
refs/heads/main
2023-06-25T13:44:24.861708
2021-07-28T03:09:45
2021-07-28T03:09:45
390,195,825
0
0
null
null
null
null
UTF-8
Java
false
false
258
java
package com.cmi.edc.metamanagement.service; public class EmailAlreadyUsedException extends RuntimeException { private static final long serialVersionUID = 1L; public EmailAlreadyUsedException() { super("Email is already in use!"); } }
[ "jhipster-bot@jhipster.tech" ]
jhipster-bot@jhipster.tech
735a6ca1581ce2eee864f82b0e20c63c97d05fde
5ca3901b424539c2cf0d3dda52d8d7ba2ed91773
/src_fernflower/y/f/i/a/aQ_1.java
5aa59c62e74c424724a766dbae5013a94db186bd
[]
no_license
fjh658/bindiff
c98c9c24b0d904be852182ecbf4f81926ce67fb4
2a31859b4638404cdc915d7ed6be19937d762743
refs/heads/master
2021-01-20T06:43:12.134977
2016-06-29T17:09:03
2016-06-29T17:09:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,391
java
package y.f.i.a; import y.f.i.a.aN; import y.f.i.a.aT; class aQ extends aT { private final y.d.y g; private final double h; private final y.d.t i; private final aN j; aQ(aN var1, y.d.m var2, y.d.m var3, y.c.d var4) { super(var4, var2.b()?var2:var3, var2.a()?var2:var3); this.j = var1; this.i = new y.d.t(this.b.c().a, this.a.c().b); this.h = var2.b()?Math.abs(this.i.a - var2.d().a):Math.abs(this.i.b - var2.d().b); this.g = this.g(); } private y.d.y g() { double var1 = this.h + 2.0D; return this.c == 3?new y.d.y(this.i.a - this.h - 1.0D, this.i.b - 1.0D, var1, var1):(this.c == 2?new y.d.y(this.i.a - 1.0D, this.i.b - 1.0D, var1, var1):(this.c == 0?new y.d.y(this.i.a - 1.0D, this.i.b - this.h - 1.0D, var1, var1):new y.d.y(this.i.a - this.h - 1.0D, this.i.b - this.h - 1.0D, var1, var1))); } public boolean a() { return true; } public double b() { return this.i.a(); } public double c() { return this.i.b(); } public y.d.y h() { return this.g; } public void a(double var1) { throw new IllegalStateException("Segment offset is fixed!"); } public double d() { return this.c != 3 && this.c != 1?this.b() + this.h:this.b() - this.h; } public double e() { return this.c != 0 && this.c != 1?this.c() + this.h:this.c() - this.h; } }
[ "manouchehri@riseup.net" ]
manouchehri@riseup.net
26b99189ba525ee8df57142800b16c907186ce2e
2b3ce1b66a94673c9b3a5cb6e816f660873856b0
/src/main/java/com/entor/config/ShiroConfiguration.java
0e6a72c49f7a29bc49fa343f24934d12d7adfe9b
[]
no_license
55fzz/graduation
ba2107fb1d62987d14731c3466323ce9ec6babad
3b9496ac998b16bda18ab64ea964f602620b2a6a
refs/heads/master
2022-10-08T08:58:18.944591
2019-10-25T02:12:56
2019-10-25T02:12:56
214,918,296
0
0
null
2022-09-01T23:14:10
2019-10-14T00:59:33
CSS
UTF-8
Java
false
false
5,595
java
package com.entor.config; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import javax.servlet.Filter; import org.apache.shiro.cache.ehcache.EhCacheManager; import org.apache.shiro.session.mgt.eis.JavaUuidSessionIdGenerator; import org.apache.shiro.session.mgt.eis.MemorySessionDAO; import org.apache.shiro.spring.LifecycleBeanPostProcessor; import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; import org.apache.shiro.spring.web.ShiroFilterFactoryBean; import org.apache.shiro.web.mgt.DefaultWebSecurityManager; import org.apache.shiro.web.servlet.SimpleCookie; import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import com.entor.realm.UserRealm; @Configuration public class ShiroConfiguration { /** * ShiroFilterFactoryBean 处理拦截资源文件问题。 * 注意:单独一个ShiroFilterFactoryBean配置是或报错的,以为在 * 初始化ShiroFilterFactoryBean的时候需要注入:SecurityManager * Filter Chain定义说明 1、一个URL可以配置多个Filter,使用逗号分隔 2、当设置多个过滤器时,全部验证通过,才视为通过 * 3、部分过滤器可指定参数,如perms,roles */ @Bean public ShiroFilterFactoryBean shirFilter(org.apache.shiro.mgt.SecurityManager securityManager) { ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean(); // 必须设置 SecurityManager shiroFilterFactoryBean.setSecurityManager(securityManager); // 拦截器. Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>(); //配置静态资源允许访问 // filterChainDefinitionMap.put("/js/**","anon"); // filterChainDefinitionMap.put("/css/**","anon"); // filterChainDefinitionMap.put("user/login","anon"); // filterChainDefinitionMap.put("/loginCheck/**","anon"); filterChainDefinitionMap.put("**","anon"); // <!-- authc:所有url都必须认证通过才可以访问; anon:所有url都都可以匿名访问--> // filterChainDefinitionMap.put("/**", "authc"); // 如果不设置默认会自动寻找Web工程根目录下的"/login.jsp"页面 shiroFilterFactoryBean.setLoginUrl("/user/login"); // 未授权界面; shiroFilterFactoryBean.setUnauthorizedUrl("/403"); Map<String, Filter> filters=new HashMap<String,Filter>(); shiroFilterFactoryBean.setFilters(filters); shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap); return shiroFilterFactoryBean; } @Bean public EhCacheManager getEhCacheManager() { EhCacheManager em = new EhCacheManager(); em.setCacheManagerConfigFile("classpath:ehcache-shiro.xml"); return em; } // 开启Controller中的shiro注解 @Bean public DefaultAdvisorAutoProxyCreator getDefaultAdvisorAutoProxyCreator() { DefaultAdvisorAutoProxyCreator daap = new DefaultAdvisorAutoProxyCreator(); daap.setProxyTargetClass(true); return daap; } /** * 配置org.apache.shiro.web.session.mgt.DefaultWebSessionManager * @return */ @Bean public DefaultWebSessionManager getDefaultWebSessionManager(){ DefaultWebSessionManager defaultWebSessionManager=new DefaultWebSessionManager(); defaultWebSessionManager.setSessionDAO(getMemorySessionDAO()); defaultWebSessionManager.setGlobalSessionTimeout(4200000); defaultWebSessionManager.setSessionValidationSchedulerEnabled(true); defaultWebSessionManager.setSessionIdCookieEnabled(true); defaultWebSessionManager.setSessionIdCookie(getSimpleCookie()); return defaultWebSessionManager; } /** * 配置org.apache.shiro.session.mgt.eis.MemorySessionDAO * @return */ @Bean public MemorySessionDAO getMemorySessionDAO(){ MemorySessionDAO memorySessionDAO=new MemorySessionDAO(); memorySessionDAO.setSessionIdGenerator(javaUuidSessionIdGenerator()); return memorySessionDAO; } @Bean public JavaUuidSessionIdGenerator javaUuidSessionIdGenerator(){ return new JavaUuidSessionIdGenerator(); } /** * session自定义cookie名 * @return */ @Bean public SimpleCookie getSimpleCookie(){ SimpleCookie simpleCookie=new SimpleCookie(); simpleCookie.setName("security.session.id"); simpleCookie.setPath("/"); return simpleCookie; } @Bean public LifecycleBeanPostProcessor getLifecycleBeanPostProcessor(){ return new LifecycleBeanPostProcessor(); } @Bean(name = "securityManager") public DefaultWebSecurityManager getDefaultWebSecurityManager(UserRealm userRealm) { DefaultWebSecurityManager dwsm = new DefaultWebSecurityManager(); dwsm.setRealm(userRealm); // <!-- 用户授权/认证信息Cache, 采用EhCache 缓存 --> dwsm.setCacheManager(getEhCacheManager()); dwsm.setSessionManager(getDefaultWebSessionManager()); return dwsm; } @Bean public UserRealm userRealm(EhCacheManager cacheManager) { UserRealm userRealm = new UserRealm(); userRealm.setCacheManager(cacheManager); return userRealm; } /** * 开启shrio注解支持 * @param userRealm * @return */ @Bean public AuthorizationAttributeSourceAdvisor getAuthorizationAttributeSourceAdvisor(UserRealm userRealm){ AuthorizationAttributeSourceAdvisor aasa=new AuthorizationAttributeSourceAdvisor(); aasa.setSecurityManager(getDefaultWebSecurityManager(userRealm)); return aasa; } }
[ "Administrator@80DR054LIU0TTAN" ]
Administrator@80DR054LIU0TTAN
ebbfedbeab1a2281ef798e9f273dbba9a3239e21
cd1e60af5201413ddbdaa56c58e1d0600bc4af35
/sso/src/main/java/com/elise/singlesignoncenter/service/GetBusinessIdService.java
bc9f46f99858f5d78fd1c81caadf442a41a7e12b
[]
no_license
franywhy/projects
6b3fe268709c7239536da802e57f9f1630688061
965b2b0938f8c3620299b52055035f522559fa5c
refs/heads/master
2020-04-18T01:14:13.551295
2019-01-23T02:49:00
2019-01-23T02:49:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
242
java
package com.elise.singlesignoncenter.service; /** * @author shihongjie */ public interface GetBusinessIdService { /** * 获取产品线ID * * @param token * @return */ String getBusinessId(String token); }
[ "longduyuan@hengqijy.com" ]
longduyuan@hengqijy.com
7c0acb6a4e0af2871dcee82202e3931d0d94374a
1385e2c2ea1f157cbbf2d9edde7a92df442e2092
/service/src/com/yf/system/base/fflight/Route.java
fe02a41fcd7fadb1cf50227882547fc00616db39
[]
no_license
marc45/kzpw
112b6dd7d5e9317fad343918c48767be32a3c9e3
19c11c2abe37125eb715e8b723df6e87fce7e10e
refs/heads/master
2021-01-22T18:01:45.787156
2015-12-07T08:43:53
2015-12-07T08:43:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,984
java
package com.yf.system.base.fflight; import java.sql.Timestamp; import java.util.List; import java.io.Serializable; public class Route implements Serializable{ //鑸彮绾胯矾搴忓佛 private int ID; //鏀跨瓥绫诲瀷镙囱瘑 鏆傛椂镞犵敤锛屽彧鏄笅璁㈠崟镞舵彃鍏ュ埌鏁版嵁搴扑腑 private String PolicyInfo; //镐婚噾棰? private double TotalFare; //镐荤◣璐? private double TotalTax; //鏀跨瓥绫诲瀷镙囱瘑 鏆傛椂镞犵敤锛屽彧鏄笅璁㈠崟镞舵彃鍏ュ埌鏁版嵁搴扑腑 private String PolicyMark; //鍑哄彂鍩庡竞 private String FromCity; //鍒拌揪鍩庡竞 private String DestCity; //鑸┖鍏徃浠g爜 private String AirCompany; //鑸彮绾胯矾 濡傦细BJS-HKG-SFO private String RouteStr; //是否转机 private int IsChangeFlight; //儿童票价 private double TotalChlidFare; private String DepdateTime;//出发时间 private String ArrdateTime;//到达时间 //鑸彮绾胯矾璇︽儏 private List<RouteDetailInfo> RouteDetailInfos; public String getDepdateTime() { return DepdateTime; } public void setDepdateTime(String depdateTime) { DepdateTime = depdateTime; } public String getArrdateTime() { return ArrdateTime; } public void setArrdateTime(String arrdateTime) { ArrdateTime = arrdateTime; } public int getID() { return ID; } public void setID(int id) { ID = id; } public String getPolicyInfo() { return PolicyInfo; } public void setPolicyInfo(String policyInfo) { PolicyInfo = policyInfo; } public double getTotalFare() { return TotalFare; } public void setTotalFare(double totalFare) { TotalFare = totalFare; } public double getTotalTax() { return TotalTax; } public void setTotalTax(double totalTax) { TotalTax = totalTax; } public String getPolicyMark() { return PolicyMark; } public void setPolicyMark(String policyMark) { PolicyMark = policyMark; } public String getFromCity() { return FromCity; } public void setFromCity(String fromCity) { FromCity = fromCity; } public String getDestCity() { return DestCity; } public void setDestCity(String destCity) { DestCity = destCity; } public String getAirCompany() { return AirCompany; } public void setAirCompany(String airCompany) { AirCompany = airCompany; } public String getRouteStr() { return RouteStr; } public void setRouteStr(String routeStr) { RouteStr = routeStr; } public List<RouteDetailInfo> getRouteDetailInfos() { return RouteDetailInfos; } public void setRouteDetailInfos(List<RouteDetailInfo> routeDetailInfos) { RouteDetailInfos = routeDetailInfos; } public int getIsChangeFlight() { return IsChangeFlight; } public void setIsChangeFlight(int isChangeFlight) { IsChangeFlight = isChangeFlight; } public double getTotalChlidFare() { return TotalChlidFare; } public void setTotalChlidFare(double totalChlidFare) { TotalChlidFare = totalChlidFare; } }
[ "dogdog7788@qq.com" ]
dogdog7788@qq.com
f3e8f8d7d4cb39555edfcd03ff9534fd3fbbc6c7
13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3
/crash-reproduction-ws/results/MOCKITO-10b-2-4-Single_Objective_GGA-WeightedSum/org/mockito/internal/util/MockCreationValidator_ESTest.java
6395567681ad4c1394e8809d86ad7547b2be4f24
[ "MIT", "CC-BY-4.0" ]
permissive
STAMP-project/Botsing-basic-block-coverage-application
6c1095c6be945adc0be2b63bbec44f0014972793
80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da
refs/heads/master
2022-07-28T23:05:55.253779
2022-04-20T13:54:11
2022-04-20T13:54:11
285,771,370
0
0
null
null
null
null
UTF-8
Java
false
false
574
java
/* * This file was automatically generated by EvoSuite * Tue Mar 31 11:49:37 UTC 2020 */ package org.mockito.internal.util; import org.junit.Test; import static org.junit.Assert.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class MockCreationValidator_ESTest extends MockCreationValidator_ESTest_scaffolding { @Test public void notGeneratedAnyTest() { // EvoSuite did not generate any tests } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
88e166e89e75a83f556ec8300cf7fb3e7c79d133
82e2fa3b1128edc8abd2bd84ecfc01c932831bc0
/jena-extras/jena-serviceenhancer/src/main/java/org/apache/jena/sparql/service/enhancer/algebra/TransformSE_JoinStrategy.java
af8d877e95b18b8a478b62eaf328839355a81e9a
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
apache/jena
b64f6013582f2b5aa38d1c9972d7b14e55686316
fb41e79d97f065b8df9ebbc6c69b3f983b6cde04
refs/heads/main
2023-08-14T15:16:21.086308
2023-08-03T08:34:08
2023-08-03T08:34:08
7,437,073
966
760
Apache-2.0
2023-09-02T09:04:08
2013-01-04T08:00:32
Java
UTF-8
Java
false
false
7,499
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.jena.sparql.service.enhancer.algebra; import java.util.HashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import org.apache.jena.graph.Node; import org.apache.jena.sparql.algebra.Op; import org.apache.jena.sparql.algebra.OpVars; import org.apache.jena.sparql.algebra.TransformCopy; import org.apache.jena.sparql.algebra.op.OpConditional; import org.apache.jena.sparql.algebra.op.OpDisjunction; import org.apache.jena.sparql.algebra.op.OpFilter; import org.apache.jena.sparql.algebra.op.OpJoin; import org.apache.jena.sparql.algebra.op.OpLeftJoin; import org.apache.jena.sparql.algebra.op.OpSequence; import org.apache.jena.sparql.algebra.op.OpService; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.engine.Rename; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.graph.NodeTransform; import org.apache.jena.sparql.graph.NodeTransformLib; import org.apache.jena.sparql.service.enhancer.impl.ServiceOpts; /** * Checks for the presence of <code>SERVICE &lt;loop:&gt; { }</code> * transforms those into linear joins using {@link OpSequence} / {@link OpDisjunction} * and adjust variable scopes. * * All variables mentioned on the rhs which have the same reverse-renaming as variables * visible on the lhs will be substituted with the lhs variant. */ public class TransformSE_JoinStrategy extends TransformCopy { public TransformSE_JoinStrategy() {} @Override public Op transform(OpJoin opJoin, Op left, Op right) { boolean canDoLinear = false; Op effectiveRight = right; if (right instanceof OpService) { OpService op = (OpService)right; ServiceOpts opts = ServiceOpts.getEffectiveService(op); canDoLinear = opts.containsKey(ServiceOpts.SO_LOOP); if (canDoLinear) { NodeTransform joinVarRename = renameForImplicitJoinVars(left); effectiveRight = NodeTransformLib.transform(joinVarRename, right); } } Op result = canDoLinear ? OpSequence.create(left, effectiveRight) : super.transform(opJoin, left, effectiveRight) ; return result; } @Override public Op transform(OpSequence opSequence, List<Op> elts) { // Accumulated visible vars Set<Var> visibleVarsLeft = new LinkedHashSet<>(); OpSequence result = OpSequence.create(); for (Op right : elts) { Op newOp = right; if (right instanceof OpService) { OpService op = (OpService)right; ServiceOpts opts = ServiceOpts.getEffectiveService(op); boolean isLoop = opts.containsKey(ServiceOpts.SO_LOOP); if (isLoop) { NodeTransform joinVarRename = renameForImplicitJoinVars(visibleVarsLeft); newOp = NodeTransformLib.transform(joinVarRename, right); } } // Add the now visible vars as new ones Set<Var> visibleVarsRight = OpVars.visibleVars(newOp); visibleVarsLeft.addAll(visibleVarsRight); result.add(newOp); } return result; } @Override public Op transform(OpDisjunction opSequence, List<Op> elts) { // Accumulated visible vars Set<Var> visibleVarsLeft = new LinkedHashSet<>(); OpDisjunction result = OpDisjunction.create(); for (Op right : elts) { Op newOp = right; if (right instanceof OpService) { OpService op = (OpService)right; ServiceOpts opts = ServiceOpts.getEffectiveService(op); boolean isLoop = opts.containsKey(ServiceOpts.SO_LOOP); if (isLoop) { NodeTransform joinVarRename = renameForImplicitJoinVars(visibleVarsLeft); newOp = NodeTransformLib.transform(joinVarRename, right); } } // Add the now visible vars as new ones Set<Var> visibleVarsRight = OpVars.visibleVars(newOp); visibleVarsLeft.addAll(visibleVarsRight); result.add(newOp); } return result; } @Override public Op transform(OpLeftJoin opLeftJoin, Op left, Op right) { boolean canDoLinear = false; Op effectiveRight = right; if (right instanceof OpService) { OpService op = (OpService)right; ServiceOpts opts = ServiceOpts.getEffectiveService(op); canDoLinear = opts.containsKey(ServiceOpts.SO_LOOP); if (canDoLinear) { NodeTransform joinVarRename = renameForImplicitJoinVars(left); effectiveRight = NodeTransformLib.transform(joinVarRename, right); ExprList joinExprs = opLeftJoin.getExprs(); if (joinExprs != null) { ExprList effectiveExprs = NodeTransformLib.transform(joinVarRename, joinExprs); effectiveRight = OpFilter.filterBy(effectiveExprs, effectiveRight); } } } Op result = canDoLinear ? new OpConditional(left, effectiveRight) : super.transform(opLeftJoin, left, effectiveRight) ; return result; } /** * Remove scoping of all mentioned rhs variables which implicitly join with those visible on the lhs: * * Join on all variables v that are visible in lhs where * there exists a mentioned variable v' in rhs where reverseRename(v) == reverseRename(v') */ public static NodeTransform renameForImplicitJoinVars(Op left) { Set<Var> visibleInLhs = OpVars.visibleVars(left); return renameForImplicitJoinVars(visibleInLhs); } public static NodeTransform renameForImplicitJoinVars(Set<Var> visibleInLhs) { // Is it possible to have multiple _visible_ variables that map to same variable when reverse-renamed?! // The code assumes no Map<Var, Var> lhsPlainToScoped = visibleInLhs.stream() .collect(Collectors.toMap( v -> (Var)Rename.reverseVarRename(v), v -> v)); Map<Node, Node> cache = new HashMap<>(); NodeTransform joinVarRename = n -> { Node plain = cache.computeIfAbsent(n, Rename::reverseVarRename); Var scopedLhs = lhsPlainToScoped.get(plain); Node r = scopedLhs == null ? n : scopedLhs; return r; }; return joinVarRename; } }
[ "RavenArkadon@googlemail.com" ]
RavenArkadon@googlemail.com
ab58c51cce32579b8d1728f6a43a4d0464f1b2c9
3802210088dac1806aa21e3af212b5a00b01141f
/src/test/java/edu/cmu/cs/vbc/prog/queval/indexes/rtrees/InsertHeuristics/RStartInsert.java
e35ebd9713bea36cff5db4b305dc6c9e3d15936f
[]
no_license
chupanw/vbc
5618f8fd9fcfc4f9dda06826f925cddfb2d3191c
1221ef110e2b46951ab01319e97fa5d7dd84a724
refs/heads/master
2020-12-25T01:44:30.531879
2020-11-20T02:31:17
2020-11-20T02:31:17
50,115,858
5
1
null
2016-04-05T01:06:21
2016-01-21T15:17:05
Java
UTF-8
Java
false
false
4,351
java
package edu.cmu.cs.vbc.prog.queval.indexes.rtrees.InsertHeuristics; import edu.cmu.cs.vbc.prog.queval.indexes.rtrees.MBR; import edu.cmu.cs.vbc.prog.queval.indexes.rtrees.Point; import java.util.Collections; import java.util.Comparator; import java.util.LinkedList; public class RStartInsert implements Heuristic { @Override public InsertHeuristic getInsertNode(MBR current, Point toInsert) { InsertHeuristic ret; // (1) if leaf, compute punishment for this if (current.isLeaf()){ ret = new InsertHeuristic(0, current); } // CS2: This is the main difference to R-Tree insert else if(current.children[0].isLeaf()) { LinkedList<MyContainer> punishements = new LinkedList<MyContainer>(); for(int mbr=0;mbr<current.size();mbr++){ long overlap = overlap(current, mbr, toInsert); long volume = current.children[mbr].deltaVolume(toInsert); punishements.add(new MyContainer(overlap, volume, current.children[mbr])); } //sort so that MBR with least overlap is first, resolve ties by min deltaVolume Collections.sort(punishements, new Comparator<MyContainer>() { @Override public int compare(MyContainer o1, MyContainer o2) { return o1.compareTo(o2); } }); ret = getInsertNode(punishements.getFirst().leafToInsert, toInsert); }else{ //for inner nodes do the same as for the R-Tree long[] punishmentsOfSubtrees = new long[current.size()]; for(int mbr=0;mbr<current.size();mbr++){ //TODO ak�rzen wenn null punishmentsOfSubtrees[mbr] = current.children[mbr].deltaVolume(toInsert); } // get the best MBR (subtree) to hand forward int minMBRIndex=0; for(int mbr=1;mbr<current.size();mbr++){ if (punishmentsOfSubtrees[mbr]<punishmentsOfSubtrees[minMBRIndex]) minMBRIndex=mbr; } //hand forward ret = getInsertNode(current.children[minMBRIndex], toInsert); } return ret; } public long overlap(MBR current, int mbrToExtend, Point toInsert){ long orgOverlapVolume = 0; long newOverlapVolume = 0; //determine new border if inserting into this leaf final int dimensions = current.tree.DIMENSIONS; int[] newMinBorder = new int[dimensions]; int[] newMaxBorder = new int[dimensions]; int[] thisMin = current.children[mbrToExtend].minBorder; int[] thisMax = current.children[mbrToExtend].maxBorder; int[] point = toInsert.coordinates; for(int dim=0;dim<dimensions;dim++){ newMinBorder[dim] = (thisMin[dim]<point[dim]) ? thisMin[dim] : point[dim]; newMaxBorder[dim] = (thisMax[dim]>point[dim]) ? thisMax[dim] : point[dim]; } for(int mbr=0;mbr<current.size();mbr++){ if(mbrToExtend==mbr) continue;//XXX so lala //orgOverlapVolume orgOverlapVolume += overlap(current.children[mbr], current.children[mbrToExtend].minBorder, current.children[mbrToExtend].maxBorder); //newOverlapVolume orgOverlapVolume += overlap(current.children[mbr], newMinBorder, newMaxBorder); } return newOverlapVolume-orgOverlapVolume; } public long overlap(MBR mbr, int[] minBorder, int[] maxBorder){ //try to prove intersection in one dimension them return 0L else compute intersection long overlap = 1; for(int dim=0;dim<mbr.tree.DIMENSIONS;dim++){ /* 6 Cases R(x1,x2), R(o1,2) * Cases | MIN | MAX | * x1x2o1o2 | o1 | x2 | MIN > MAX -> no intersect * x1o1x2o2 | o1 | x2 | * x1o1o2x1 | o1 | o2 | * o1x1o2x2 | x1 | o2 | * o1x1x2o2 | x1 | x2 | * o1o2x1x2 | x1 | o2 | MIN > MAX -> no intersect */ int intersectMin = Math.max(mbr.minBorder[dim], minBorder[dim]); int intersectMax = Math.min(mbr.maxBorder[dim], maxBorder[dim]); if(intersectMin>intersectMax){//no intersect see above return 0;//I like this line, no overlap at all }else overlap *= (intersectMax-intersectMin); } return overlap; } private final class MyContainer implements Comparable<MyContainer>{ public final long overlap; public final long deltaVolume; public final MBR leafToInsert; public MyContainer(long _overlap, long _deltaVolume, MBR _leaf){ this.overlap = _overlap; this.deltaVolume = _deltaVolume; this.leafToInsert = _leaf; } public final int compareTo(MyContainer compare){ return (int)( (this.overlap!=compare.overlap) ? this.overlap-compare.overlap : this.deltaVolume-compare.deltaVolume); } } }
[ "chupanw@cs.cmu.edu" ]
chupanw@cs.cmu.edu
ebcf24c4789637778b3bd661eb01604058db0978
319531f0ef01900b83d106d53cb4e9502e33f355
/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/Param.java
5134265edfedd633c8c72018c4d33aaa30947e2e
[ "Apache-2.0", "CDDL-1.0", "LicenseRef-scancode-oracle-openjdk-exception-2.0", "GPL-2.0-only" ]
permissive
wso2/wso2-openjpa
798822ee319590eed5a00ae21b65b6977faf162d
9c3801c861d1a0c9d93a9fa5cfa0cbe749114b92
refs/heads/master
2023-08-14T23:55:26.907881
2022-04-05T09:32:59
2022-04-05T09:32:59
97,706,188
35
16
Apache-2.0
2022-04-05T09:33:00
2017-07-19T10:56:02
Java
UTF-8
Java
false
false
1,765
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.openjpa.kernel.exps; import org.apache.openjpa.kernel.StoreContext; /** * Represents a parameter. * * @author Abe White */ class Param extends Val implements Parameter { private Object _key = null; private Class _type = null; private int _index = -1; /** * Constructor. Provide parameter name and type. */ public Param(Object key, Class type) { _key = key; _type = type; } public Object getParameterKey() { return _key; } public Class getType() { return _type; } public void setImplicitType(Class type) { _type = type; } public void setIndex(int index) { _index = index; } public Object getValue(Object[] params) { return params[_index]; } protected Object eval(Object candidate, Object orig, StoreContext ctx, Object[] params) { return getValue(params); } }
[ "nandika@wso2.com" ]
nandika@wso2.com
fcf4a0929e16707165e7c990bac918c76a0cacf1
1eb0be608a0f4a9fe04d4d463a80f21269c19b70
/src/Object_Orient_Design/Design_Pattern/Adaptor/AdapterComposite.java
0ae9d1662fc677b611bc8484345c5467e387dd6e
[]
no_license
yimin12/Google_Facebook
c8c8a4fe9030cf628cdebc069f7b467ed852788f
e59f5e81478a5aff476e306d97a10ce612ca30da
refs/heads/master
2023-04-14T04:57:58.026947
2021-05-04T05:21:12
2021-05-04T05:21:12
316,042,525
4
0
null
null
null
null
UTF-8
Java
false
false
488
java
package Object_Orient_Design.Design_Pattern.Adaptor; /* * @Author : Yimin Huang * @Contact : hymlaucs@gmail.com * @Date : 2020/11/26 13:10 * @Description : * Use composition relationship to implement the adaptor pattern */ public class AdapterComposite implements Target{ private Adaptee adaptee; @Override public void handleReq() { adaptee.request(); } public AdapterComposite(Adaptee adaptee) { this.adaptee = adaptee; } }
[ "hymlaucs@gmail.com" ]
hymlaucs@gmail.com
dcd6f1c8f4cdb4ec146ebf4d1b23e2b6d409b521
93823870c501f6b81bfbfe1df3aecb749329f041
/app/src/main/java/com/ispring/canvasdemo/rain/RainView.java
68c3a32b0b35a92deb4c1024aade4c3372519573
[]
no_license
sea2/myView
fdc8cd5a9ce01093573855cc493de0e58ae8280e
0f1796637a5072852e7488aca0f3186b172bb671
refs/heads/master
2018-12-03T15:00:38.007603
2018-11-27T02:16:50
2018-11-27T02:16:50
109,778,620
0
0
null
null
null
null
UTF-8
Java
false
false
3,969
java
package com.ispring.canvasdemo.rain; import android.content.Context; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Paint; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.View; import com.ispring.canvasdemo.R; import java.util.ArrayList; import java.util.List; import java.util.Random; /** * 下雨模仿 * * @author tx * @date 2018/8/23 */ public class RainView extends View { private Paint paint; //图片处理 private Matrix matrix; private Random random; //判断是否运行的,默认没有 private boolean isRun; //表情包集合 private List<ItemEmoje> bitmapList; //表情图片 private int imgResId = R.mipmap.dog; public RainView(Context context) { this(context, null); } public RainView(Context context, @Nullable AttributeSet attrs) { this(context, attrs, 0); } public RainView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } private void init() { paint = new Paint(); paint.setAntiAlias(true); paint.setFilterBitmap(true); paint.setDither(true); matrix = new Matrix(); random = new Random(); bitmapList = new ArrayList<>(); } public void setImgResId(int imgResId) { this.imgResId = imgResId; } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (isRun) { //用于判断表情下落结束,结束即不再进行重绘 boolean isInScreen = false; for (int i = 0; i < bitmapList.size(); i++) { matrix.reset(); //缩放 matrix.setScale(bitmapList.get(i).scale, bitmapList.get(i).scale); //下落过程坐标 bitmapList.get(i).x = bitmapList.get(i).x + bitmapList.get(i).offsetX; bitmapList.get(i).y = bitmapList.get(i).y + bitmapList.get(i).offsetY; if (bitmapList.get(i).y <= getHeight()) {//当表情仍在视图内,则继续重绘 isInScreen = true; } //位移 matrix.postTranslate(bitmapList.get(i).x, bitmapList.get(i).y); canvas.drawBitmap(bitmapList.get(i).bitmap, matrix, paint); } if (isInScreen) { postInvalidate(); } else { release(); } } } /** * 释放资源 */ private void release() { if (bitmapList != null && bitmapList.size() > 0) { for (ItemEmoje itemEmoje : bitmapList) { if (!itemEmoje.bitmap.isRecycled()) { itemEmoje.bitmap.recycle(); } } bitmapList.clear(); } } public void start(boolean isRun) { this.isRun = isRun; initData(); postInvalidate(); } private void initData() { release(); for (int i = 0; i < 20; i++) { ItemEmoje itemEmoje = new ItemEmoje(); itemEmoje.bitmap = BitmapFactory.decodeResource(getResources(), imgResId); //起始横坐标在[100,getWidth()-100) 之间 itemEmoje.x = random.nextInt(getWidth() - 200) + 100; //起始纵坐标在(-getHeight(),0] 之间,即一开始位于屏幕上方以外 itemEmoje.y = -random.nextInt(getHeight()); //横向偏移[-2,2) ,即左右摇摆区间 itemEmoje.offsetX = random.nextInt(4) - 2; //纵向固定下落12 itemEmoje.offsetY = 12; //缩放比例[0.8,1.2) 之间 itemEmoje.scale = (float) (random.nextInt(40) + 80) / 100f; bitmapList.add(itemEmoje); } } }
[ "497661292@qq.com" ]
497661292@qq.com
d8b9b22050f766d7e5182d5fda3b29591bc9a583
0e06e096a9f95ab094b8078ea2cd310759af008b
/classes58-dex2jar/okhttp3/internal/http/CallServerInterceptor.java
0ace158816012b358d2ab72dac1bfe6dcbb9e53e
[]
no_license
Manifold0/adcom_decompile
4bc2907a057c73703cf141dc0749ed4c014ebe55
fce3d59b59480abe91f90ba05b0df4eaadd849f7
refs/heads/master
2020-05-21T02:01:59.787840
2019-05-10T00:36:27
2019-05-10T00:36:27
185,856,424
1
2
null
2019-05-10T00:36:28
2019-05-09T19:04:28
Java
UTF-8
Java
false
false
3,076
java
// // Decompiled by Procyon v0.5.34 // package okhttp3.internal.http; import java.io.IOException; import okio.BufferedSink; import okhttp3.Request; import okhttp3.internal.connection.StreamAllocation; import java.net.ProtocolException; import okhttp3.internal.Util; import okio.Okio; import okhttp3.Response; import okhttp3.Interceptor; public final class CallServerInterceptor implements Interceptor { private final boolean forWebSocket; public CallServerInterceptor(final boolean forWebSocket) { this.forWebSocket = forWebSocket; } @Override public Response intercept(final Chain chain) throws IOException { final HttpCodec httpStream = ((RealInterceptorChain)chain).httpStream(); final StreamAllocation streamAllocation = ((RealInterceptorChain)chain).streamAllocation(); final Request request = chain.request(); final long currentTimeMillis = System.currentTimeMillis(); httpStream.writeRequestHeaders(request); final Response.Builder builder = null; Response.Builder responseHeaders = null; Response.Builder builder2 = builder; if (HttpMethod.permitsRequestBody(request.method())) { builder2 = builder; if (request.body() != null) { if ("100-continue".equalsIgnoreCase(request.header("Expect"))) { httpStream.flushRequest(); responseHeaders = httpStream.readResponseHeaders(true); } if ((builder2 = responseHeaders) == null) { final BufferedSink buffer = Okio.buffer(httpStream.createRequestBody(request, request.body().contentLength())); request.body().writeTo(buffer); buffer.close(); builder2 = responseHeaders; } } } httpStream.finishRequest(); Object responseHeaders2; if ((responseHeaders2 = builder2) == null) { responseHeaders2 = httpStream.readResponseHeaders(false); } final Response build = ((Response.Builder)responseHeaders2).request(request).handshake(streamAllocation.connection().handshake()).sentRequestAtMillis(currentTimeMillis).receivedResponseAtMillis(System.currentTimeMillis()).build(); final int code = build.code(); Response response; if (this.forWebSocket && code == 101) { response = build.newBuilder().body(Util.EMPTY_RESPONSE).build(); } else { response = build.newBuilder().body(httpStream.openResponseBody(build)).build(); } if ("close".equalsIgnoreCase(response.request().header("Connection")) || "close".equalsIgnoreCase(response.header("Connection"))) { streamAllocation.noNewStreams(); } if ((code == 204 || code == 205) && response.body().contentLength() > 0L) { throw new ProtocolException("HTTP " + code + " had non-zero Content-Length: " + response.body().contentLength()); } return response; } }
[ "querky1231@gmail.com" ]
querky1231@gmail.com
2f544396ed8de542bb0362b58db78caac5356943
ce893b3841d095d6470fd289243258851edecd97
/Tools/src/main/java/gen/db/Launch.java
c51ddb0711c46f28fb6507571405379f8b354c59
[]
no_license
babizhu/GameServer
157d6dbf73bdf03f3ebb47ebc0316d3dcca449e9
c5b824303be92ea7ab04f67a8cd0a349e9ce1553
refs/heads/master
2020-05-17T11:07:45.761664
2014-03-28T10:14:21
2014-03-28T10:14:21
14,416,279
0
1
null
null
null
null
UTF-8
Java
false
false
576
java
package gen.db; import gen.db.dto.Table; /** * Created with IntelliJ IDEA. * User: Administrator * Date: 13-11-22 * Time: 下午6:00 * 包的启动类,通过数据库文件生成相应的dto.java和provider */ public class Launch { public static void main(String[] args) { for (Table table : MetaData.INSTANCE.getTables()) { new GenJavaBeanDTO(table).gen(); //new GenJavaBean(table).gen(); new GenProvider(table).gen(); System.out.println("表[" + table.getName() + "] 处理完毕"); } } }
[ "liu_kun@msn.com" ]
liu_kun@msn.com
a55aaa39521785274e575c7debd58863ac9a1d2d
8e6dcaf667137b9ee73550f7856a3294cd342970
/org.abchip.mimo.database/src/org/abchip/mimo/database/CatalogGenerationStrategy.java
81a5e6af76b836159c857ab3e87278c0198cbd74
[]
no_license
abchip/mimo
98f3db3fad26d2dd8e0196d4a17fba8d7b8fbda0
b9713ecacac883261d5ff04ac0dd6c98fbbba49d
refs/heads/master
2022-12-18T10:19:11.707294
2021-03-18T20:35:21
2021-03-18T20:35:21
114,753,824
0
0
null
2022-12-14T00:59:04
2017-12-19T10:51:40
Grammatical Framework
UTF-8
Java
false
false
3,229
java
/** * Copyright (c) 2017, 2021 ABChip and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * */ package org.abchip.mimo.database; import org.abchip.mimo.entity.Entity; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Catalog Generation Strategy</b></em>'. * <!-- end-user-doc --> * * <p> * The following features are supported: * </p> * <ul> * <li>{@link org.abchip.mimo.database.CatalogGenerationStrategy#isCreateIndexOnView <em>Create Index On View</em>}</li> * <li>{@link org.abchip.mimo.database.CatalogGenerationStrategy#isCreateRelativeRecordNumber <em>Create Relative Record Number</em>}</li> * </ul> * * @see org.abchip.mimo.database.DatabasePackage#getCatalogGenerationStrategy() * @model * @generated */ public interface CatalogGenerationStrategy extends Entity { /** * Returns the value of the '<em><b>Create Index On View</b></em>' attribute. * The default value is <code>"false"</code>. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Create Index On View</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Create Index On View</em>' attribute. * @see #setCreateIndexOnView(boolean) * @see org.abchip.mimo.database.DatabasePackage#getCatalogGenerationStrategy_CreateIndexOnView() * @model default="false" required="true" * @generated */ boolean isCreateIndexOnView(); /** * Sets the value of the '{@link org.abchip.mimo.database.CatalogGenerationStrategy#isCreateIndexOnView <em>Create Index On View</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Create Index On View</em>' attribute. * @see #isCreateIndexOnView() * @generated */ void setCreateIndexOnView(boolean value); /** * Returns the value of the '<em><b>Create Relative Record Number</b></em>' attribute. * The default value is <code>"false"</code>. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Create Relative Record Number</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Create Relative Record Number</em>' attribute. * @see #setCreateRelativeRecordNumber(boolean) * @see org.abchip.mimo.database.DatabasePackage#getCatalogGenerationStrategy_CreateRelativeRecordNumber() * @model default="false" required="true" * @generated */ boolean isCreateRelativeRecordNumber(); /** * Sets the value of the '{@link org.abchip.mimo.database.CatalogGenerationStrategy#isCreateRelativeRecordNumber <em>Create Relative Record Number</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Create Relative Record Number</em>' attribute. * @see #isCreateRelativeRecordNumber() * @generated */ void setCreateRelativeRecordNumber(boolean value); } // CatalogGenerationStrategy
[ "dev@abchip.it" ]
dev@abchip.it
49ff1a8a4e341a3dbe5951ea1ae6e8503f34bd74
69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e
/methods/Method_1001871.java
6d8d6a34e230fc42227003731f4b622ed93168c9
[]
no_license
P79N6A/icse_20_user_study
5b9c42c6384502fdc9588430899f257761f1f506
8a3676bc96059ea2c4f6d209016f5088a5628f3c
refs/heads/master
2020-06-24T08:25:22.606717
2019-07-25T15:31:16
2019-07-25T15:31:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
228
java
public void fill(int windingRule){ if (hidden == false) { final Element elt=(Element)document.createElement("path"); elt.setAttribute("d",currentPath.toString()); getG().appendChild(elt); } currentPath=null; }
[ "sonnguyen@utdallas.edu" ]
sonnguyen@utdallas.edu
e40a2411670046248f8769868345752ec90e46c3
40d844c1c780cf3618979626282cf59be833907f
/src/testcases/CWE129_Improper_Validation_of_Array_Index/s05/CWE129_Improper_Validation_of_Array_Index__random_array_size_51b.java
e7e8322dcdb7ef84f88293703a29a9b61b08105e
[]
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
2,500
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE129_Improper_Validation_of_Array_Index__random_array_size_51b.java Label Definition File: CWE129_Improper_Validation_of_Array_Index.label.xml Template File: sources-sinks-51b.tmpl.java */ /* * @description * CWE: 129 Improper Validation of Array Index * BadSource: random Set data to a random value * GoodSource: A hardcoded non-zero, non-min, non-max, even number * Sinks: array_size * GoodSink: data is used to set the size of the array and it must be greater than 0 * BadSink : data is used to set the size of the array, but it could be set to 0 * Flow Variant: 51 Data flow: data passed as an argument from one function to another in different classes in the same package * * */ package testcases.CWE129_Improper_Validation_of_Array_Index.s05; import testcasesupport.*; import javax.servlet.http.*; public class CWE129_Improper_Validation_of_Array_Index__random_array_size_51b { public void badSink(int data ) throws Throwable { int array[] = null; /* POTENTIAL FLAW: Verify that data is non-negative, but still allow it to be 0 */ if (data >= 0) { array = new int[data]; } else { IO.writeLine("Array size is negative"); } /* do something with the array */ array[0] = 5; IO.writeLine(array[0]); } /* goodG2B() - use goodsource and badsink */ public void goodG2BSink(int data ) throws Throwable { int array[] = null; /* POTENTIAL FLAW: Verify that data is non-negative, but still allow it to be 0 */ if (data >= 0) { array = new int[data]; } else { IO.writeLine("Array size is negative"); } /* do something with the array */ array[0] = 5; IO.writeLine(array[0]); } /* goodB2G() - use badsource and goodsink */ public void goodB2GSink(int data ) throws Throwable { /* Need to ensure that the array is of size > 3 and < 101 due to the GoodSource and the large_fixed BadSource */ int array[] = null; /* FIX: Verify that data is non-negative AND greater than 0 */ if (data > 0) { array = new int[data]; } else { IO.writeLine("Array size is negative"); } /* do something with the array */ array[0] = 5; IO.writeLine(array[0]); } }
[ "you@example.com" ]
you@example.com
4eb41043beac01ba0739c4e5cb89562535c0c89a
0e49eee4f85024e0857b77bce1e78030beb47b1f
/src/main/java/com/tencentcloudapi/tcr/v20190924/models/DescribeApplicationTriggerLogPersonalResp.java
0940ceda9274aac2f1a9596bee35d4a3f6ce44f0
[ "Apache-2.0" ]
permissive
arbing/tencentcloud-sdk-java
7b880af16540fac10a785a1bef0d529eec89c525
c1bdd3f711c92f950ffe15e6506426a8e340a638
refs/heads/master
2021-03-31T15:58:36.276205
2020-03-18T00:28:16
2020-03-18T00:28:16
248,117,938
1
0
Apache-2.0
2020-03-18T02:15:34
2020-03-18T02:15:33
null
UTF-8
Java
false
false
2,490
java
/* * Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.tencentcloudapi.tcr.v20190924.models; import com.tencentcloudapi.common.AbstractModel; import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.Expose; import java.util.HashMap; public class DescribeApplicationTriggerLogPersonalResp extends AbstractModel{ /** * 返回总数 */ @SerializedName("TotalCount") @Expose private Long TotalCount; /** * 触发日志列表 注意:此字段可能返回 null,表示取不到有效值。 */ @SerializedName("LogInfo") @Expose private TriggerLogResp [] LogInfo; /** * Get 返回总数 * @return TotalCount 返回总数 */ public Long getTotalCount() { return this.TotalCount; } /** * Set 返回总数 * @param TotalCount 返回总数 */ public void setTotalCount(Long TotalCount) { this.TotalCount = TotalCount; } /** * Get 触发日志列表 注意:此字段可能返回 null,表示取不到有效值。 * @return LogInfo 触发日志列表 注意:此字段可能返回 null,表示取不到有效值。 */ public TriggerLogResp [] getLogInfo() { return this.LogInfo; } /** * Set 触发日志列表 注意:此字段可能返回 null,表示取不到有效值。 * @param LogInfo 触发日志列表 注意:此字段可能返回 null,表示取不到有效值。 */ public void setLogInfo(TriggerLogResp [] LogInfo) { this.LogInfo = LogInfo; } /** * Internal implementation, normal users should not use it. */ public void toMap(HashMap<String, String> map, String prefix) { this.setParamSimple(map, prefix + "TotalCount", this.TotalCount); this.setParamArrayObj(map, prefix + "LogInfo.", this.LogInfo); } }
[ "tencentcloudapi@tenent.com" ]
tencentcloudapi@tenent.com
a6aad732300fe38c07a0fdcdb1d0fb2a9e225e89
ca7da6499e839c5d12eb475abe019370d5dd557d
/spring-web/src/main/java/org/springframework/http/converter/protobuf/ExtensionRegistryInitializer.java
50f2002a35d969eb4e89b75247b3c2a3befcf52c
[ "Apache-2.0" ]
permissive
yangfancoming/spring-5.1.x
19d423f96627636a01222ba747f951a0de83c7cd
db4c2cbcaf8ba58f43463eff865d46bdbd742064
refs/heads/master
2021-12-28T16:21:26.101946
2021-12-22T08:55:13
2021-12-22T08:55:13
194,103,586
0
1
null
null
null
null
UTF-8
Java
false
false
964
java
package org.springframework.http.converter.protobuf; import com.google.protobuf.ExtensionRegistry; /** * Google Protocol Messages can contain message extensions that can be parsed if * the appropriate configuration has been registered in the {@code ExtensionRegistry}. * * This interface provides a facility to populate the {@code ExtensionRegistry}. * * @author Alex Antonov * @author Sebastien Deleuze * @since 4.1 * @see <a href="https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/ExtensionRegistry"> * com.google.protobuf.ExtensionRegistry</a> * @deprecated as of Spring Framework 5.1, use {@link ExtensionRegistry} based constructors instead */ @Deprecated public interface ExtensionRegistryInitializer { /** * Initializes the {@code ExtensionRegistry} with Protocol Message extensions. * @param registry the registry to populate */ void initializeExtensionRegistry(ExtensionRegistry registry); }
[ "34465021+jwfl724168@users.noreply.github.com" ]
34465021+jwfl724168@users.noreply.github.com
b9d5f88e8a27fdeec39ff16404c33321c9d323cd
4a94a5e6b3464b0522abcbdd6071fc5026d8891d
/aliyun-java-sdk-cr/src/main/java/com/aliyuncs/cr/model/v20181201/ListChartReleaseRequest.java
10db74a88b00eadeca0c357b6b98bd04c88cfdf9
[ "Apache-2.0" ]
permissive
ShanJiXin/aliyun-openapi-java-sdk
75128280237b995c5b6cc5e63bec53e902879470
e27bdd419f7771495c16b9107b1fff5e5272a8dc
refs/heads/master
2022-11-09T16:18:41.450862
2020-06-23T02:06:54
2020-06-23T02:06:54
274,295,253
0
0
NOASSERTION
2020-06-23T03:02:15
2020-06-23T03:02:15
null
UTF-8
Java
false
false
2,615
java
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.aliyuncs.cr.model.v20181201; import com.aliyuncs.RpcAcsRequest; import com.aliyuncs.http.MethodType; /** * @author auto create * @version */ public class ListChartReleaseRequest extends RpcAcsRequest<ListChartReleaseResponse> { private String instanceId; private String repoName; private String repoNamespaceName; private Integer pageNo; private Integer pageSize; private String chart; public ListChartReleaseRequest() { super("cr", "2018-12-01", "ListChartRelease", "acr"); setMethod(MethodType.POST); } public String getInstanceId() { return this.instanceId; } public void setInstanceId(String instanceId) { this.instanceId = instanceId; if(instanceId != null){ putQueryParameter("InstanceId", instanceId); } } public String getRepoName() { return this.repoName; } public void setRepoName(String repoName) { this.repoName = repoName; if(repoName != null){ putQueryParameter("RepoName", repoName); } } public String getRepoNamespaceName() { return this.repoNamespaceName; } public void setRepoNamespaceName(String repoNamespaceName) { this.repoNamespaceName = repoNamespaceName; if(repoNamespaceName != null){ putQueryParameter("RepoNamespaceName", repoNamespaceName); } } public Integer getPageNo() { return this.pageNo; } public void setPageNo(Integer pageNo) { this.pageNo = pageNo; if(pageNo != null){ putQueryParameter("PageNo", pageNo.toString()); } } public Integer getPageSize() { return this.pageSize; } public void setPageSize(Integer pageSize) { this.pageSize = pageSize; if(pageSize != null){ putQueryParameter("PageSize", pageSize.toString()); } } public String getChart() { return this.chart; } public void setChart(String chart) { this.chart = chart; if(chart != null){ putQueryParameter("Chart", chart); } } @Override public Class<ListChartReleaseResponse> getResponseClass() { return ListChartReleaseResponse.class; } }
[ "sdk-team@alibabacloud.com" ]
sdk-team@alibabacloud.com
c30835e61bb5c1c99eaef6ea66304a60200987ea
17cd91f8b312a304aaf371bdf809b989990e8c60
/src/Practice/Refactoring/CalculatorTest.java
114f4069e3e7ad75a910f8399423581515585fec
[]
no_license
JavaProjectAll/CleanCode
e814969f991dab6bdcad55c151a9fc6791032bb9
29334e13234b82c928a3ef20569af31ae69e6f8c
refs/heads/master
2020-03-31T20:16:35.653264
2018-10-11T07:01:25
2018-10-11T07:01:25
152,532,961
0
0
null
null
null
null
UTF-8
Java
false
false
1,840
java
package Practice.Refactoring; import org.junit.Test; import static junit.framework.TestCase.assertEquals; class CalculatorTest { @Test void testCalculateAdd() { int firstOperand = 1; int secondOperand = 1; char operator = '+'; int expected = 2; int result = Calculator.calculate(firstOperand, secondOperand, operator); assertEquals(expected, result); } @Test void testCalculateSub() { int firstOperand = 2; int secondOperand = 1; char operator = '-'; int expected = 1; int result = Calculator.calculate(firstOperand, secondOperand, operator); assertEquals(expected, result); } @Test void testCalculateMul() { int firstOperand = 2; int secondOperand = 2; char operator = '*'; int expected = 4; int result = Calculator.calculate(firstOperand, secondOperand, operator); assertEquals(expected, result); } @Test void testCalculateDiv() { int firstOperand = 6; int secondOperand = 3; char operator = '/'; int expected = 2; int result = Calculator.calculate(firstOperand, secondOperand, operator); assertEquals(expected, result); } @Test void testCalculateDivByZero() { int firstOperand = 2; int secondOperand = 0; char operator = '/'; //assertThrows(RuntimeException.class, //()-> {Calculator.calculate(firstOperand, secondOperand, operator);}); } @Test void testCalculateWrongOperator() { int firstOperand = 2; int secondOperand = 0; char operator = '='; //assertThrows(RuntimeException.class, //()-> {Calculator.calculate(firstOperand, secondOperand, operator);}); } }
[ "=" ]
=
f9fd4e517284fdb2bf4bbc6dfce1db5276453b11
fab99ca0914e62a334ab610265ef4adf9375233c
/src/main/java/com/liangxiaoqiao/leetcode/day/medium/CarPooling.java
02dfa1729b65178508bf54638e81dda6fa60fd18
[ "Apache-2.0" ]
permissive
liangxiaoqiao/LeetcodeDay
f6b9587e62ae10c36d71f15ce9d4769f1cb9caae
42d7a3fc86fd24c259c0bfc041a49bab3dcdd773
refs/heads/master
2022-06-22T02:25:42.262798
2020-04-05T10:58:28
2020-04-05T10:58:28
253,175,661
0
0
null
null
null
null
UTF-8
Java
false
false
3,043
java
package com.liangxiaoqiao.leetcode.day.medium; /* * English * id: 1094 * title: Car Pooling * href: https://leetcode.com/problems/car-pooling * desc: You are driving a vehicle that has capacity empty seats initially available for passengers. The vehicle only drives east (ie. it cannot turn around and drive west.) * Given a list of trips, trip[i] = [num_passengers, start_location, end_location] contains information about the i-th trip: the number of passengers that must be picked up, and the locations to pick them up and drop them off. The locations are given as the number of kilometers due east from your vehicle's initial location. * Return true if and only if it is possible to pick up and drop off all passengers for all the given trips. * Example 1: * Input: trips = [[2,1,5],[3,3,7]], capacity = 4 * Output: false * Example 2: * Input: trips = [[2,1,5],[3,3,7]], capacity = 5 * Output: true * Example 3: * Input: trips = [[2,1,5],[3,5,7]], capacity = 3 * Output: true * Example 4: * Input: trips = [[3,2,7],[3,7,9],[8,3,9]], capacity = 11 * Output: true * Constraints: * trips.length <= 1000 * trips[i].length == 3 * 1 <= trips[i][0] <= 100 * 0 <= trips[i][1] < trips[i][2] <= 1000 * 1 <= capacity <= 100000 * <p> * 中文 * 序号: 1094 * 标题: 拼车 * 链接: https://leetcode-cn.com/problems/car-pooling * 描述: 假设你是一位顺风车司机,车上最初有 capacity 个空座位可以用来载客。由于道路的限制,车 只能 向一个方向行驶(也就是说,不允许掉头或改变方向,你可以将其想象为一个向量)。 * 这儿有一份行程计划表 trips[][],其中 trips[i] = [num_passengers, start_location, end_location] 包含了你的第 i 次行程信息: * 必须接送的乘客数量; * 乘客的上车地点; * 以及乘客的下车地点。 * 这些给出的地点位置是从你的 初始 出发位置向前行驶到这些地点所需的距离(它们一定在你的行驶方向上)。 * 请你根据给出的行程计划表和车子的座位数,来判断你的车是否可以顺利完成接送所用乘客的任务(当且仅当你可以在所有给定的行程中接送所有乘客时,返回 true,否则请返回 false)。 * 示例 1: * 输入:trips = [[2,1,5],[3,3,7]], capacity = 4 * 输出:false * 示例 2: * 输入:trips = [[2,1,5],[3,3,7]], capacity = 5 * 输出:true * 示例 3: * 输入:trips = [[2,1,5],[3,5,7]], capacity = 3 * 输出:true * 示例 4: * 输入:trips = [[3,2,7],[3,7,9],[8,3,9]], capacity = 11 * 输出:true * 提示: * 你可以假设乘客会自觉遵守 “先下后上” 的良好素质 * trips.length <= 1000 * trips[i].length == 3 * 1 <= trips[i][0] <= 100 * 0 <= trips[i][1] < trips[i][2] <= 1000 * 1 <= capacity <= 100000 * <p> * acceptance: 56.7% * difficulty: Medium * private: False */ //TODO init public class CarPooling { public boolean carPooling(int[][] trips, int capacity) { return false; } }
[ "348722306@qq.com" ]
348722306@qq.com
89539399900a6bde41b6fcfd61d444000c7b1fd4
b530af769bb496cdbadb4d1c14b81d6c53e2e36f
/factory/src/test/java/io/github/factoryfx/factory/storage/migration/datamigration/PathBuilderTest.java
cba11d7e67e12595f404cfa706957345acdc27e1
[ "Apache-2.0" ]
permissive
factoryfx/factoryfx
ab366d3144a27fd07bbf4098b9dc82e3bab1181f
08bab85ecd5ab30b26fa57d852c7fac3fb5ce312
refs/heads/master
2023-07-09T05:20:02.320970
2023-07-04T15:11:52
2023-07-04T15:11:52
59,744,695
12
3
Apache-2.0
2023-03-02T15:11:26
2016-05-26T11:22:59
Java
UTF-8
Java
false
false
1,666
java
package io.github.factoryfx.factory.storage.migration.datamigration; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; class PathBuilderTest { @Test public void test_parse(){ AttributePathTarget<String> parsed = PathBuilder.of("referenceAttribute.stringAttribute"); AttributePathTarget<String> programmatic = new PathBuilder<String>().pathElement("referenceAttribute").attribute("stringAttribute"); assertTrue(parsed.match(programmatic)); } @Test public void test_parse_reflist(){ AttributePathTarget<String> parsed = PathBuilder.of("referenceListAttribute[1].stringAttribute"); AttributePathTarget<String> programmatic = new PathBuilder<String>().pathElement("referenceListAttribute",1).attribute("stringAttribute"); assertTrue(parsed.match(programmatic)); } @Test public void test_parse_reflist_multi_digit_index(){ AttributePathTarget<String> parsed = PathBuilder.of("referenceListAttribute[123].stringAttribute"); AttributePathTarget<String> programmatic = new PathBuilder<String>().pathElement("referenceListAttribute",123).attribute("stringAttribute"); assertTrue(parsed.match(programmatic)); } @Test public void test_mixed_path(){ AttributePathTarget<String> parsed = PathBuilder.of("referenceAttribute.referenceListAttribute[123].stringAttribute"); AttributePathTarget<String> programmatic = new PathBuilder<String>().pathElement("referenceAttribute").pathElement("referenceListAttribute",123).attribute("stringAttribute"); assertTrue(parsed.match(programmatic)); } }
[ "henning.brackmann@scoop-software.de" ]
henning.brackmann@scoop-software.de
40ec81c8e9fc255081fb925a14d19e5bd3f02fbe
95f8ceea99270b9eb6ff7c8877cf9d419f377e11
/shell/src/test/java/org/crsh/console/operations/InsertCommentTestCase.java
e644b3c5bfb11b30d78eef5ee86439b31fca6c99
[]
no_license
corda/crash
0d816474b91b4bc4e1c360842bbaa55161b23ea6
2b83315d106025a74513d390a1ee8180b7b1c41c
refs/heads/master
2023-05-11T08:10:13.114871
2023-04-24T09:36:32
2023-04-24T09:36:32
84,222,368
10
4
null
2023-04-24T08:37:17
2017-03-07T16:36:34
Java
UTF-8
Java
false
false
3,390
java
/* * Copyright (C) 2012 eXo Platform SAS. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.crsh.console.operations; import jline.console.Operation; import org.crsh.console.AbstractConsoleTestCase; import org.crsh.console.KeyStrokes; import test.shell.sync.SyncProcess; import org.crsh.shell.ShellProcessContext; import org.crsh.shell.ShellResponse; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.TimeUnit; /** * @author Julien Viet */ public class InsertCommentTestCase extends AbstractConsoleTestCase { public void testEmacs() throws Exception { final ArrayBlockingQueue<String> requests = new ArrayBlockingQueue<String>(1); shell.addProcess(new SyncProcess() { @Override public void run(String request, ShellProcessContext context) throws Exception { requests.add(request); context.end(ShellResponse.ok()); } }); console.init(); console.on(KeyStrokes.of("putrified whales")); console.on(Operation.INSERT_COMMENT); String request = requests.poll(5, TimeUnit.SECONDS); assertEquals("#putrified whales", request); } // Vi move // The # key causes a comment to get inserted. public void testInsertComment1() throws Exception { final ArrayBlockingQueue<String> requests = new ArrayBlockingQueue<String>(1); shell.addProcess(new SyncProcess() { @Override public void run(String request, ShellProcessContext context) throws Exception { requests.add(request); context.end(ShellResponse.ok()); } }); console.toInsert(); console.init(); console.on(KeyStrokes.of("putrified whales")); console.on(Operation.VI_MOVEMENT_MODE); console.on(Operation.VI_INSERT_COMMENT); String request = requests.poll(5, TimeUnit.SECONDS); assertEquals("#putrified whales", request); } public void testInsertComment2() throws Exception { final ArrayBlockingQueue<String> requests = new ArrayBlockingQueue<String>(1); shell.addProcess(new SyncProcess() { @Override public void run(String request, ShellProcessContext context) throws Exception { requests.add(request); context.end(ShellResponse.ok()); } }); console.toInsert(); console.init(); console.on(KeyStrokes.of("echo \"abc")); console.on(KeyStrokes.ENTER); console.on(KeyStrokes.of("def")); console.on(Operation.VI_MOVEMENT_MODE); console.on(Operation.VI_INSERT_COMMENT); console.on(KeyStrokes.QUOTE); console.on(KeyStrokes.ENTER); String request = requests.poll(5, TimeUnit.SECONDS); assertEquals("echo \"abc\n#def\n\"", request); } }
[ "julien@julienviet.com" ]
julien@julienviet.com
0dc6099440f91180106af6fbcda20ae1a20bc09c
ab6c3626364b835f23df13ec6f9de2b80d99a887
/sos-js7/sos-js7-converter/sos-js7-converter-js1/src/main/java/com/sos/js7/converter/js1/common/config/Config.java
d4037306e2ca6b4c6508f0c1c9e76e852cbd5bb3
[]
no_license
sos-berlin/sos-components
e0a2b05b2cadd97dceb20f0322d13a869ad7a644
865506c880f39af38c22491b68bda8385d74f08a
refs/heads/master
2023-08-30T01:40:05.968297
2023-08-29T16:06:32
2023-08-29T16:06:32
116,804,720
0
0
null
2023-02-07T11:48:42
2018-01-09T10:59:58
Java
UTF-8
Java
false
false
699
java
package com.sos.js7.converter.js1.common.config; public class Config { private String central_configuration_directory; private String configuration_add_event; private String configuration_delete_event; private String configuration_directory; private String configuration_modify_event; private String spooler_id; private String supervisor; private String port; private String tcp_port; private String udp_port; private String ip_address; private String time_zone; private String include_path; private String log_dir; private String mail_xslt_stylesheet; private String param; // TODO Child Elements such as base, params ... }
[ "robert.ehrlich@sos-berlin.com" ]
robert.ehrlich@sos-berlin.com
380b315ee4a561fe38a207df2f89d7f83d25f6b4
bdfd9182cb71fa6efe358a4a96ac366b32e05c98
/src/main/java/com/donaldy/tx/MyTransactional.java
bdd9d330a6296d787f6001939dc8beb8dcd1980d
[]
no_license
DonaldY/kafka-practice
68e45d0920dca6ce00919f92ad82a42e955bef71
b4033f80125f14fc90e80e365b7d19210422c658
refs/heads/master
2021-07-18T22:27:52.515523
2020-09-20T07:48:07
2020-09-20T07:48:07
222,277,025
0
0
null
2020-10-14T00:31:03
2019-11-17T16:24:31
Java
UTF-8
Java
false
false
4,191
java
package com.donaldy.tx; import org.apache.kafka.clients.consumer.*; import org.apache.kafka.clients.producer.KafkaProducer; import org.apache.kafka.clients.producer.ProducerConfig; import org.apache.kafka.clients.producer.ProducerRecord; import org.apache.kafka.common.TopicPartition; import org.apache.kafka.common.serialization.StringDeserializer; import org.apache.kafka.common.serialization.StringSerializer; import java.util.Collections; import java.util.HashMap; import java.util.Map; /** * @author donald * @date 2020/09/20 */ public class MyTransactional { public static KafkaProducer<String, String> getProducer() { Map<String, Object> configs = new HashMap<>(); configs.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "node1:9092"); configs.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class); configs.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class); // 设置client.id configs.put(ProducerConfig.CLIENT_ID_CONFIG, "tx_producer_01"); // 设置事务id configs.put(ProducerConfig.TRANSACTIONAL_ID_CONFIG, "tx_id_02"); // 需要所有的ISR副本确认 configs.put(ProducerConfig.ACKS_CONFIG, "all"); // 启用幂等性 configs.put(ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG, true); KafkaProducer<String, String> producer = new KafkaProducer<String, String>(configs); return producer; } public static KafkaConsumer<String, String> getConsumer(String consumerGroupId) { Map<String, Object> configs = new HashMap<>(); configs.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "node1:9092"); configs.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class); configs.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class); // 设置消费组ID configs.put(ConsumerConfig.GROUP_ID_CONFIG, "consumer_grp_02"); // 不启用消费者偏移量的自动确认,也不要手动确认 configs.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, false); configs.put(ConsumerConfig.CLIENT_ID_CONFIG, "consumer_client_02"); configs.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); // 只读取已提交的消息 // configs.put(ConsumerConfig.ISOLATION_LEVEL_CONFIG, "read_committed"); KafkaConsumer<String, String> consumer = new KafkaConsumer<String, String>(configs); return consumer; } public static void main(String[] args) { String consumerGroupId = "consumer_grp_id_101"; KafkaProducer<String, String> producer = getProducer(); KafkaConsumer<String, String> consumer = getConsumer(consumerGroupId); // 事务的初始化 producer.initTransactions(); //订阅主题 consumer.subscribe(Collections.singleton("tp_tx_01")); final ConsumerRecords<String, String> records = consumer.poll(1_000); // 开启事务 producer.beginTransaction(); try { Map<TopicPartition, OffsetAndMetadata> offsets = new HashMap<>(); for (ConsumerRecord<String, String> record : records) { System.out.println(record); producer.send(new ProducerRecord<String, String>("tp_tx_out_01", record.key(), record.value())); offsets.put( new TopicPartition(record.topic(), record.partition()), new OffsetAndMetadata(record.offset() + 1)); // 偏移量表示下一条要消费的消息 } // 将该消息的偏移量提交作为事务的一部分,随事务提交和回滚(不提交消费偏移量) producer.sendOffsetsToTransaction(offsets, consumerGroupId); // int i = 1 / 0; // 提交事务 producer.commitTransaction(); } catch (Exception e) { e.printStackTrace(); // 回滚事务 producer.abortTransaction(); } finally { // 关闭资源 producer.close(); consumer.close(); } } }
[ "448641125@qq.com" ]
448641125@qq.com
ce9e33e3603d35a4d31d2e209ac22b332e6c0725
6dfb29a0a0d678f8a26b309ca22e9f636203d056
/src/main/java/com/examw/test/service/records/impl/PaperRecordStatus.java
eaa87a1a8b6386e9badd92b674bf264d8a1913f5
[]
no_license
JokeLook/examw-test
85543fa14c747a0d73b43437c86424c6e8ea0595
8579b6330eec489c8f2bd06c8d55cd026d27a152
refs/heads/master
2020-12-27T10:06:06.441139
2015-03-26T04:10:23
2015-03-26T04:10:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
799
java
package com.examw.test.service.records.impl; /** * 试卷记录状态枚举 * @author fengwei. * @since 2014年11月4日 上午11:45:59. */ public enum PaperRecordStatus { /** * 未完成 */ UNDONE(0x00), /** * 已完成 */ DONE(0x01); private int value; //构造函数。 private PaperRecordStatus(int value){ this.value = value; } /** * 获取枚举值。 * @return 枚举值。 */ public Integer getValue(){ return this.value; } /** * 枚举转换。 * @param value * 枚举值。 * @return * 枚举对象。 */ public static PaperRecordStatus convert(Integer value){ PaperRecordStatus result = PaperRecordStatus.UNDONE; switch(value){ case 0x01: result = PaperRecordStatus.DONE; break; default:break; } return result; } }
[ "fw121fw4@163.com" ]
fw121fw4@163.com
85292f349e40a314be9d6bedaa39265fd5bbf24b
63489b9d7f48b5f95dd7823f1ee0e81beb88aba4
/s2_commonbox/src/main/java/com/h4x0r/datetime/DatePickerActivity.java
9b9633529521ac56b3a0b1f41d376d1ace9c85bb
[]
no_license
h4x0r139/MyApplication
7f7b7b65c160cad5af5baa5727163fae5d26a2bb
b71648d2963761efdfdf66de72075e590781c835
refs/heads/master
2020-05-21T14:55:31.488110
2019-05-28T11:29:45
2019-05-28T11:29:45
63,512,880
5
0
null
null
null
null
UTF-8
Java
false
false
1,750
java
package com.h4x0r.datetime; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.DatePicker; import com.h4x0r.R; public class DatePickerActivity extends AppCompatActivity { private Button showDatePickerButton = null; //该常量用于标识DatePickerDialog private static final int DATE_PICKER_ID = 1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_date_picker); showDatePickerButton = (Button) findViewById(R.id.showDatePickerButton); showDatePickerButton.setOnClickListener(new ButtonListener()); } private class ButtonListener implements OnClickListener { @Override public void onClick(View v) { //此方法用于显示DatePickerDialog showDialog(DATE_PICKER_ID); } } //监听器,用户监听用户点下DatePikerDialog的set按钮时,所设置的年月日 DatePickerDialog.OnDateSetListener onDateSetListener = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { System.out.println(year + "-" + monthOfYear + "-" + dayOfMonth); } }; @Override protected Dialog onCreateDialog(int id) { switch (id) { case DATE_PICKER_ID: return new DatePickerDialog(this, onDateSetListener, 2010, 11, 25); } return null; } }
[ "h4x0r_001@163.com" ]
h4x0r_001@163.com
bd03d126feedce676f109a79afcb588055f6928d
f87b023f7437d65ed29eae1f2b1a00ddfd820177
/bitcamp-java-basic/src/step20_Annotation/ex05/Exam02.java
1dd839420d0ab9a96e044203f829787a263a256c
[]
no_license
GreedHJC/BitCamp
c0d01fc0713744e01832fabf06d2663577fde6e5
028894ab5171ef1fd89de73c3654e11cbc927a25
refs/heads/master
2021-01-24T10:28:07.820330
2018-06-04T07:51:58
2018-06-04T07:51:58
123,054,159
0
0
null
null
null
null
UTF-8
Java
false
false
455
java
// 애노테이션 확인 package step20_Annotation.ex05; public class Exam02 { public static void main(String[] args) { // 클래스 정보 객체로부터 애노테이션 정보 추출 Class clazz = MyClass2.class; MyAnnotation2 obj = (MyAnnotation2)clazz.getAnnotation(MyAnnotation2.class); System.out.println(obj.v1()[0]); System.out.println(obj.v2()[0]); System.out.println(obj.v3()[0]); } }
[ "qweqwe472@naver.com" ]
qweqwe472@naver.com
706e0abd8da854da721d0408e8e1e3715f5249b8
dd80a584130ef1a0333429ba76c1cee0eb40df73
/external/dexmaker/src/dx/java/com/android/dx/dex/file/ClassDefsSection.java
1ca391f7f1b689b3d8ede704721e73db6ba740c1
[ "MIT", "Apache-2.0" ]
permissive
karunmatharu/Android-4.4-Pay-by-Data
466f4e169ede13c5835424c78e8c30ce58f885c1
fcb778e92d4aad525ef7a995660580f948d40bc9
refs/heads/master
2021-03-24T13:33:01.721868
2017-02-18T17:48:49
2017-02-18T17:48:49
81,847,777
0
2
MIT
2020-03-09T00:02:12
2017-02-13T16:47:00
null
UTF-8
Java
false
false
5,484
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.dex.file; import com.android.dx.rop.cst.Constant; import com.android.dx.rop.cst.CstType; import com.android.dx.rop.type.Type; import com.android.dx.rop.type.TypeList; import com.android.dx.util.AnnotatedOutput; import com.android.dx.util.Hex; import java.util.ArrayList; import java.util.Collection; import java.util.TreeMap; /** * Class definitions list section of a {@code .dex} file. */ public final class ClassDefsSection extends UniformItemSection { /** * {@code non-null;} map from type constants for classes to {@link * ClassDefItem} instances that define those classes */ private final TreeMap<Type, ClassDefItem> classDefs; /** {@code null-ok;} ordered list of classes; set in {@link #orderItems} */ private ArrayList<ClassDefItem> orderedDefs; /** * Constructs an instance. The file offset is initially unknown. * * @param file {@code non-null;} file that this instance is part of */ public ClassDefsSection(DexFile file) { super("class_defs", file, 4); classDefs = new TreeMap<Type, ClassDefItem>(); orderedDefs = null; } /** {@inheritDoc} */ @Override public Collection<? extends Item> items() { if (orderedDefs != null) { return orderedDefs; } return classDefs.values(); } /** {@inheritDoc} */ @Override public IndexedItem get(Constant cst) { if (cst == null) { throw new NullPointerException("cst == null"); } throwIfNotPrepared(); Type type = ((CstType) cst).getClassType(); IndexedItem result = classDefs.get(type); if (result == null) { throw new IllegalArgumentException("not found"); } return result; } /** * Writes the portion of the file header that refers to this instance. * * @param out {@code non-null;} where to write */ public void writeHeaderPart(AnnotatedOutput out) { throwIfNotPrepared(); int sz = classDefs.size(); int offset = (sz == 0) ? 0 : getFileOffset(); if (out.annotates()) { out.annotate(4, "class_defs_size: " + Hex.u4(sz)); out.annotate(4, "class_defs_off: " + Hex.u4(offset)); } out.writeInt(sz); out.writeInt(offset); } /** * Adds an element to this instance. It is illegal to attempt to add more * than one class with the same name. * * @param clazz {@code non-null;} the class def to add */ public void add(ClassDefItem clazz) { Type type; try { type = clazz.getThisClass().getClassType(); } catch (NullPointerException ex) { // Elucidate the exception. throw new NullPointerException("clazz == null"); } throwIfPrepared(); if (classDefs.get(type) != null) { throw new IllegalArgumentException("already added: " + type); } classDefs.put(type, clazz); } /** {@inheritDoc} */ @Override protected void orderItems() { int sz = classDefs.size(); int idx = 0; orderedDefs = new ArrayList<ClassDefItem>(sz); /* * Iterate over all the classes, recursively assigning an * index to each, implicitly skipping the ones that have * already been assigned by the time this (top-level) * iteration reaches them. */ for (Type type : classDefs.keySet()) { idx = orderItems0(type, idx, sz - idx); } } /** * Helper for {@link #orderItems}, which recursively assigns indices * to classes. * * @param type {@code null-ok;} type ref to assign, if any * @param idx {@code >= 0;} the next index to assign * @param maxDepth maximum recursion depth; if negative, this will * throw an exception indicating class definition circularity * @return {@code >= 0;} the next index to assign */ private int orderItems0(Type type, int idx, int maxDepth) { ClassDefItem c = classDefs.get(type); if ((c == null) || (c.hasIndex())) { return idx; } if (maxDepth < 0) { throw new RuntimeException("class circularity with " + type); } maxDepth--; CstType superclassCst = c.getSuperclass(); if (superclassCst != null) { Type superclass = superclassCst.getClassType(); idx = orderItems0(superclass, idx, maxDepth); } TypeList interfaces = c.getInterfaces(); int sz = interfaces.size(); for (int i = 0; i < sz; i++) { idx = orderItems0(interfaces.getType(i), idx, maxDepth); } c.setIndex(idx); orderedDefs.add(c); return idx + 1; } }
[ "karun.matharu@gmail.com" ]
karun.matharu@gmail.com
561972ace415fb41744ea0b00471cdbe42c6a5f1
380c6a65f6657d4976e0ceac89dd174accc56d15
/services/hrdb/src/com/auto_favcvqhnfr/hrdb/controller/ProcedureExecutionController.java
3ad645f44fa3fbf31d94133b010091ebf9a188d4
[]
no_license
wavemakerapps/Auto_FavCvQhNFR
6c10ace92e7157d40e6dbece09ab99320999e839
d536d4782f56c348f782b9e505bff60bfdff9ccb
refs/heads/master
2020-03-12T18:35:50.338295
2018-04-23T22:38:56
2018-04-23T22:38:56
130,764,338
0
0
null
null
null
null
UTF-8
Java
false
false
1,342
java
/*Copyright (c) 2015-2016 wavemaker.com All Rights Reserved. This software is the confidential and proprietary information of wavemaker.com You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the source code license agreement you entered into with wavemaker.com*/ package com.auto_favcvqhnfr.hrdb.controller; /*This is a Studio Managed File. DO NOT EDIT THIS FILE. Your changes may be reverted by Studio.*/ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.wavemaker.runtime.data.dao.procedure.WMProcedureExecutor; import com.wordnik.swagger.annotations.Api; import com.auto_favcvqhnfr.hrdb.service.HrdbProcedureExecutorService; @RestController(value = "Hrdb.ProcedureExecutionController") @RequestMapping("/hrdb/procedureExecutor") @Api(value = "ProcedureExecutionController", description = "controller class for procedure execution") public class ProcedureExecutionController { @Autowired private HrdbProcedureExecutorService procedureService; }
[ "automate1@wavemaker.com" ]
automate1@wavemaker.com
6189a22ba3d5ca47534cfa8155c31fb82acea4d1
eee156948fa723c3928536fd036df8c03d97c44c
/app/src/main/java/com/sheygam/java_17_10_01_18/MyThread.java
cf064075324fc8eb995f63103baebd52eee06532
[]
no_license
Java-17/10_01_18
fdc5056235e9b20af5751a35cbbd5e9b0d5c61de
2d902f1e9c34984e5b973d9c220462cc60999356
refs/heads/master
2021-05-12T16:16:55.750695
2018-01-10T20:27:08
2018-01-10T20:27:08
117,007,157
0
0
null
null
null
null
UTF-8
Java
false
false
533
java
package com.sheygam.java_17_10_01_18; import android.util.Log; /** * Created by gregorysheygam on 10/01/2018. */ public class MyThread extends Thread { @Override public void run() { for (int i = 0; i < 100; i++) { Log.d("MY_TAG", "run: " + i); if(isInterrupted()){ break; } try { sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); break; } } } }
[ "sheygam@gmail.com" ]
sheygam@gmail.com
761b35d289cd975f94b99ac882e3d6cc23ab01b6
d6a5608fb7fb49f5729a9ffe23a1773a9ab57bd8
/extra/teapot/src/main/java/br/cefetrj/sagitarii/teapot/Notifier.java
44e3edb76d3ac949f8f4949e87b80e736e194e47
[ "Apache-2.0" ]
permissive
icemagno/sagitarii
ce47ceae436268eea19a5f9f33873f0e7a668497
2047d2e6a38811d18ad7d166a768f7cf9c10841a
refs/heads/master
2021-01-18T23:53:58.100539
2017-01-06T12:55:47
2017-01-06T12:55:47
22,073,161
0
0
null
null
null
null
UTF-8
Java
false
false
1,266
java
package br.cefetrj.sagitarii.teapot; import java.net.URLEncoder; import br.cefetrj.sagitarii.teapot.comm.Communicator; public class Notifier { private static Notifier instance; private Communicator comm; private Configurator configurator; public static Notifier getInstance( Communicator comm, Configurator config ) { if ( instance == null ) { instance = new Notifier( comm, config ); } return instance; } public static Notifier getInstance() { return instance; } private Notifier( Communicator comm, Configurator config ) { this.comm = comm; this.configurator = config; } private Notifier() { } public synchronized void notifySagitarii( String message, Activation act ) { String owner = "STARTING"; String activitySerial = ""; if ( act != null ) { owner = act.getExecutor(); activitySerial = act.getActivitySerial(); } message = "[" + owner + "] " + message; try { String parameters = "activitySerial=" + activitySerial + "&macAddress=" + configurator.getSystemProperties().getMacAddress() + "&errorLog=" + URLEncoder.encode( message, "UTF-8"); comm.send("receiveNodeLog", parameters); } catch ( Exception e ) { e.printStackTrace(); } } }
[ "magno.mabreu@gmail.com" ]
magno.mabreu@gmail.com
53692327b726970c12abb7363fe9b79067e65457
357c87bc33a21320d90c0c9a55b95ea3b6278808
/src/main/java/com/bergerkiller/generated/net/minecraft/server/EntityMinecartRideableHandle.java
1020d214a1cd4d727981e4b30bd4b428cff079f2
[ "LicenseRef-scancode-other-permissive" ]
permissive
mg-1999/BKCommonLib
07431339f13f86f20d08b9172f7716abf9bb997c
020b857a930aa78424865d49ee7cd2041b29765b
refs/heads/master
2020-12-27T15:31:55.206456
2019-10-06T14:21:34
2019-10-06T14:21:34
29,029,011
5
8
null
2015-02-28T18:57:04
2015-01-09T18:17:09
Java
UTF-8
Java
false
false
1,536
java
package com.bergerkiller.generated.net.minecraft.server; import com.bergerkiller.mountiplex.reflection.util.StaticInitHelper; import com.bergerkiller.mountiplex.reflection.declarations.Template; /** * Instance wrapper handle for type <b>net.minecraft.server.EntityMinecartRideable</b>. * To access members without creating a handle type, use the static {@link #T} member. * New handles can be created from raw instances using {@link #createHandle(Object)}. */ public abstract class EntityMinecartRideableHandle extends EntityMinecartAbstractHandle { /** @See {@link EntityMinecartRideableClass} */ public static final EntityMinecartRideableClass T = new EntityMinecartRideableClass(); static final StaticInitHelper _init_helper = new StaticInitHelper(EntityMinecartRideableHandle.class, "net.minecraft.server.EntityMinecartRideable", com.bergerkiller.bukkit.common.Common.TEMPLATE_RESOLVER); /* ============================================================================== */ public static EntityMinecartRideableHandle createHandle(Object handleInstance) { return T.createHandle(handleInstance); } /* ============================================================================== */ /** * Stores class members for <b>net.minecraft.server.EntityMinecartRideable</b>. * Methods, fields, and constructors can be used without using Handle Objects. */ public static final class EntityMinecartRideableClass extends Template.Class<EntityMinecartRideableHandle> { } }
[ "irmo.vandenberge@ziggo.nl" ]
irmo.vandenberge@ziggo.nl
ff44a261706dc18e4272ac452bec0e6fc07fd525
a6174d827697b1d9af93a86527c09115f14b6861
/src/test/java/com/gpschool/ut/ArchTest.java
b5992aafca8884c583983077f96b21e12a55c99c
[]
no_license
khouma964/gestion-admin-ecole
c9cfd91dfea110de0c7a2b08ef2a7441b38b3d6d
eca03abb27fd71135a039bdb8fe021e12654d1db
refs/heads/main
2023-05-10T10:10:19.584672
2021-06-13T10:43:20
2021-06-13T10:43:20
376,513,872
0
0
null
null
null
null
UTF-8
Java
false
false
1,012
java
package com.gpschool.ut; import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses; import com.tngtech.archunit.core.domain.JavaClasses; import com.tngtech.archunit.core.importer.ClassFileImporter; import com.tngtech.archunit.core.importer.ImportOption; import org.junit.jupiter.api.Test; class ArchTest { @Test void servicesAndRepositoriesShouldNotDependOnWebLayer() { JavaClasses importedClasses = new ClassFileImporter() .withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS) .importPackages("com.gpschool.ut"); noClasses() .that() .resideInAnyPackage("com.gpschool.ut.service..") .or() .resideInAnyPackage("com.gpschool.ut.repository..") .should() .dependOnClassesThat() .resideInAnyPackage("..com.gpschool.ut.web..") .because("Services and repositories should not depend on web layer") .check(importedClasses); } }
[ "jhipster-bot@jhipster.tech" ]
jhipster-bot@jhipster.tech
4bef560d50371810cc905c448e7a5237614a7432
d115e838f2fc7a55ebcd3e7a280dbecb81a78197
/src/main/java/com/kasun/airline/logic/airline/AirlineTicketBuyingLogic.java
abef3420c30733d2d4f70b942a33c5f393dbb323
[]
no_license
kasunsk/springboot-hibernate-mysql-angulerjs-maven-gradle
5f0e696cfdd62bddb3594756bc23c11405de0096
6cdaea4ab7acda3a4dd3dd7d643d89e9a3f6a331
refs/heads/master
2021-06-12T10:54:26.399402
2017-03-15T15:18:14
2017-03-15T15:18:14
81,636,840
0
0
null
null
null
null
UTF-8
Java
false
false
6,445
java
package com.kasun.airline.logic.airline; import com.kasun.airline.common.dto.CurrencyExchangeRequest; import com.kasun.airline.common.dto.Price; import com.kasun.airline.common.dto.ServiceRequest; import com.kasun.airline.common.dto.UserTicketStatus; import com.kasun.airline.common.execption.ErrorCode; import com.kasun.airline.common.execption.ServiceRuntimeException; import com.kasun.airline.common.service.StatelessServiceLogic; import com.kasun.airline.dao.account.AccountDao; import com.kasun.airline.dao.airline.AirlineDao; import com.kasun.airline.dto.airline.TicketBuy; import com.kasun.airline.dto.airline.TicketBuyingRequest; import com.kasun.airline.logic.account.CurrencyExchangeLogic; import com.kasun.airline.model.account.BankAccount; import com.kasun.airline.model.account.Currency; import com.kasun.airline.model.airline.AirlineOfferModel; import com.kasun.airline.model.user.UserTicket; import com.kasun.airline.service.account.AccountService; import com.kasun.airline.util.ValidationUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.transaction.Transactional; import java.math.BigDecimal; /** * This class provide logic of buying airline tickets */ @Component public class AirlineTicketBuyingLogic extends StatelessServiceLogic<UserTicket, TicketBuy> { @Autowired private AccountDao accountDao; @Autowired private AccountService accountService; @Autowired private AirlineOfferLogicHelper helper; @Autowired private AirlineDao airlineDao; @Transactional @Override public UserTicket invoke(TicketBuy request) { validateTicketBuyingRequest(request); TicketBuyingRequest ticketBuyingRequest = request.getTicketBuyingRequest(); BankAccount applicantBankAccount = accountDao.loadAccountById(Long.parseLong(ticketBuyingRequest.getAccountId())); if (applicantBankAccount == null) { throw new ServiceRuntimeException(ErrorCode.ACCOUNT_NOT_EXIST, "Invalid bank account"); } Double availableAmount = applicantBankAccount.getAvailableAmount(); AirlineOfferModel airlineOffer = helper.loadOfferByRout(ticketBuyingRequest.getAirlineRout()); validateAirlineOfferInventoryAvailability(airlineOffer, ticketBuyingRequest); Price offerPrice = getConvertedOfferPrice(airlineOffer, applicantBankAccount.getCurrency()); Price price = calculatePaymentAmount(availableAmount, offerPrice, ticketBuyingRequest.getTicketAmount()); processPayment(price, applicantBankAccount); UserTicket userTicket = getUserTicket(request.getApplicantId(), airlineOffer, ticketBuyingRequest); accountDao.saveUserTicket(userTicket); updateInventory(airlineOffer, ticketBuyingRequest); return userTicket; } private void validateTicketBuyingRequest(TicketBuy request) { ValidationUtil.validate(request, "Request is null"); ValidationUtil.validate(request.getApplicantId(), "Applicant Id is null"); ValidationUtil.validate(request.getTicketBuyingRequest(), "Buying request is null"); ValidationUtil.validate(request.getTicketBuyingRequest().getAccountId(), "Account id is null"); ValidationUtil.validate(request.getTicketBuyingRequest().getAirlineRout(), "Route is null"); ValidationUtil.validate(request.getTicketBuyingRequest().getTicketAmount(), "Ticket amount is null"); } private void validateAirlineOfferInventoryAvailability(AirlineOfferModel airlineOffer, TicketBuyingRequest request) { Integer availableInventory = airlineOffer.getAvailbaleInventory(); if (availableInventory < request.getTicketAmount()) { throw new ServiceRuntimeException(ErrorCode.NO_ENOUGH_INV, "No enough inventory for Airline Offer "); } } private Price getConvertedOfferPrice(AirlineOfferModel airlineOffer, Currency accountCurrency) { Price price = new Price(); price.setPrice(airlineOffer.getPrice()); price.setCurrency(airlineOffer.getCurrency()); if (!airlineOffer.getCurrency().equals(accountCurrency)) { CurrencyExchangeRequest exchangeRequest = new CurrencyExchangeRequest(); exchangeRequest.setMonetaryAmount(price); exchangeRequest.setTargetCurrency(accountCurrency); price = accountService.exchangeCurrency(new ServiceRequest<>(exchangeRequest)).getPayload(); } return price; } private Price calculatePaymentAmount(Double availableAmount, Price price, Integer ticketAmount) { BigDecimal payableAmount = BigDecimal.valueOf(price.getPrice()).multiply(new BigDecimal(ticketAmount)); if (BigDecimal.valueOf(availableAmount).compareTo(payableAmount) == -1) { throw new ServiceRuntimeException(ErrorCode.NOT_ENOUGH_CREDIT, "Account Credits not enough to purchase"); } Price amount = new Price(); amount.setCurrency(price.getCurrency()); amount.setPrice(payableAmount.doubleValue()); return amount; } private void processPayment(Price price, BankAccount applicantBankAccount) { Double newAccountBalance = applicantBankAccount.getAvailableAmount() - price.getPrice(); applicantBankAccount.setAvailableAmount(newAccountBalance); accountDao.updateAccount(applicantBankAccount); } private UserTicket getUserTicket(String applicantId, AirlineOfferModel airlineOffer, TicketBuyingRequest request) { UserTicket userTicket = new UserTicket(); userTicket.setUserId(Long.parseLong(applicantId)); userTicket.setOfferId(airlineOffer.getOfferId()); userTicket.setStatus(UserTicketStatus.BOUGHT); userTicket.setDestination(airlineOffer.getDestination()); userTicket.setOrigin(airlineOffer.getOrigin()); userTicket.setPrice(airlineOffer.getPrice()); userTicket.setCurrency(airlineOffer.getCurrency()); userTicket.setTicketsAmount(request.getTicketAmount()); return userTicket; } private void updateInventory(AirlineOfferModel airlineOffer, TicketBuyingRequest request) { Integer newAvailableInventory = airlineOffer.getAvailbaleInventory() - request.getTicketAmount(); airlineOffer.setAvailbaleInventory(newAvailableInventory); airlineDao.updateAirlineOffer(airlineOffer); } }
[ "kasunsk@gmail.com" ]
kasunsk@gmail.com
e36f5b82f20f6c39a57cc7362b1cedbcb52046bc
b34ba074cfecb2e8d012627aef3fc0abaa7d7d15
/src/test/java/com/example/utils/FiboTest.java
c5fec52d17a865cced61c13427c6afd6fe9a8001
[]
no_license
serggithub/noob
7ca4e22b93d704ea14ac8bc0c61582811fb66c63
05e2de0556960f15a18c1301f89bbff778ddd70a
refs/heads/master
2021-01-22T22:04:10.818251
2017-05-20T21:08:56
2017-05-20T21:08:56
85,505,279
0
0
null
null
null
null
UTF-8
Java
false
false
806
java
package com.example.utils; import org.junit.Test; import static org.junit.Assert.*; /** * Created by ProVM on 19.05.2017. */ public class FiboTest { @Test public void fiboTest() { Fibo fibo = new Fibo(); //assertNotNull("app should have a greeting", classUnderTest.getGreeting()); //System.out.println(fibo.b); assertEquals(1, fibo.next()); assertEquals(1, fibo.next()); assertEquals(2, fibo.next()); assertEquals(3, fibo.next()); assertEquals(5, fibo.next()); assertEquals(5, fibo.getIndex()); Fibo2 fibo2 = new Fibo2(); for (int i = 1; i < 10; i++) { System.out.print(fibo2.next() + " "); } System.out.println(fibo2.e); System.out.println(Fibo2.g); } }
[ "you@example.com" ]
you@example.com
83c45df72c5fe21e90cd2ce9ca503123cfdf639c
3963949fc1358e175851b9a75b47e0bb510d37e5
/jme/src/com/jmex/model/collada/schema/depth_funcType2.java
6870f90b4fcad8489fda0aee63f03cf7f0633ef0
[ "MIT" ]
permissive
j0rg3n/wrathofthetaboos
246ef9c510ccfde79221ad8e31fce7e89207f495
d5c8d64c3c44e28ed6a658943a3a9d56a754c8af
refs/heads/master
2021-01-10T10:28:42.157519
2008-02-08T23:11:09
2008-02-08T23:11:09
45,484,382
0
0
null
null
null
null
UTF-8
Java
false
false
5,627
java
/** * depth_funcType2.java * * This file was generated by XMLSpy 2007sp2 Enterprise Edition. * * YOU SHOULD NOT MODIFY THIS FILE, BECAUSE IT WILL BE * OVERWRITTEN WHEN YOU RE-RUN CODE GENERATION. * * Refer to the XMLSpy Documentation for further details. * http://www.altova.com/xmlspy */ package com.jmex.model.collada.schema; import com.jmex.xml.types.SchemaNCName; public class depth_funcType2 extends com.jmex.xml.xml.Node { public depth_funcType2(depth_funcType2 node) { super(node); } public depth_funcType2(org.w3c.dom.Node node) { super(node); } public depth_funcType2(org.w3c.dom.Document doc) { super(doc); } public depth_funcType2(com.jmex.xml.xml.Document doc, String namespaceURI, String prefix, String name) { super(doc, namespaceURI, prefix, name); } public void adjustPrefix() { for ( org.w3c.dom.Node tmpNode = getDomFirstChild( Attribute, null, "value" ); tmpNode != null; tmpNode = getDomNextChild( Attribute, null, "value", tmpNode ) ) { internalAdjustPrefix(tmpNode, false); } for ( org.w3c.dom.Node tmpNode = getDomFirstChild( Attribute, null, "param" ); tmpNode != null; tmpNode = getDomNextChild( Attribute, null, "param", tmpNode ) ) { internalAdjustPrefix(tmpNode, false); } } public void setXsiType() { org.w3c.dom.Element el = (org.w3c.dom.Element) domNode; el.setAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "xsi:type", "depth_func"); } public static int getvalue2MinCount() { return 0; } public static int getvalue2MaxCount() { return 1; } public int getvalue2Count() { return getDomChildCount(Attribute, null, "value"); } public boolean hasvalue2() { return hasDomChild(Attribute, null, "value"); } public gl_func_type newvalue2() { return new gl_func_type(); } public gl_func_type getvalue2At(int index) throws Exception { return new gl_func_type(getDomNodeValue(getDomChildAt(Attribute, null, "value", index))); } public org.w3c.dom.Node getStartingvalue2Cursor() throws Exception { return getDomFirstChild(Attribute, null, "value" ); } public org.w3c.dom.Node getAdvancedvalue2Cursor( org.w3c.dom.Node curNode ) throws Exception { return getDomNextChild( Attribute, null, "value", curNode ); } public gl_func_type getvalue2ValueAtCursor( org.w3c.dom.Node curNode ) throws Exception { if( curNode == null ) throw new com.jmex.xml.xml.XmlException("Out of range"); else return new gl_func_type(getDomNodeValue(curNode)); } public gl_func_type getvalue2() throws Exception { return getvalue2At(0); } public void removevalue2At(int index) { removeDomChildAt(Attribute, null, "value", index); } public void removevalue2() { removevalue2At(0); } public org.w3c.dom.Node addvalue2(gl_func_type value) { if( value.isNull() ) return null; return appendDomChild(Attribute, null, "value", value.toString()); } public org.w3c.dom.Node addvalue2(String value) throws Exception { return addvalue2(new gl_func_type(value)); } public void insertvalue2At(gl_func_type value, int index) { insertDomChildAt(Attribute, null, "value", index, value.toString()); } public void insertvalue2At(String value, int index) throws Exception { insertvalue2At(new gl_func_type(value), index); } public void replacevalue2At(gl_func_type value, int index) { replaceDomChildAt(Attribute, null, "value", index, value.toString()); } public void replacevalue2At(String value, int index) throws Exception { replacevalue2At(new gl_func_type(value), index); } public static int getparamMinCount() { return 0; } public static int getparamMaxCount() { return 1; } public int getparamCount() { return getDomChildCount(Attribute, null, "param"); } public boolean hasparam() { return hasDomChild(Attribute, null, "param"); } public SchemaNCName newparam() { return new SchemaNCName(); } public SchemaNCName getparamAt(int index) throws Exception { return new SchemaNCName(getDomNodeValue(getDomChildAt(Attribute, null, "param", index))); } public org.w3c.dom.Node getStartingparamCursor() throws Exception { return getDomFirstChild(Attribute, null, "param" ); } public org.w3c.dom.Node getAdvancedparamCursor( org.w3c.dom.Node curNode ) throws Exception { return getDomNextChild( Attribute, null, "param", curNode ); } public SchemaNCName getparamValueAtCursor( org.w3c.dom.Node curNode ) throws Exception { if( curNode == null ) throw new com.jmex.xml.xml.XmlException("Out of range"); else return new SchemaNCName(getDomNodeValue(curNode)); } public SchemaNCName getparam() throws Exception { return getparamAt(0); } public void removeparamAt(int index) { removeDomChildAt(Attribute, null, "param", index); } public void removeparam() { removeparamAt(0); } public org.w3c.dom.Node addparam(SchemaNCName value) { if( value.isNull() ) return null; return appendDomChild(Attribute, null, "param", value.toString()); } public org.w3c.dom.Node addparam(String value) throws Exception { return addparam(new SchemaNCName(value)); } public void insertparamAt(SchemaNCName value, int index) { insertDomChildAt(Attribute, null, "param", index, value.toString()); } public void insertparamAt(String value, int index) throws Exception { insertparamAt(new SchemaNCName(value), index); } public void replaceparamAt(SchemaNCName value, int index) { replaceDomChildAt(Attribute, null, "param", index, value.toString()); } public void replaceparamAt(String value, int index) throws Exception { replaceparamAt(new SchemaNCName(value), index); } }
[ "greisen@b760afd0-1f45-0410-b975-7103d5bbc06f" ]
greisen@b760afd0-1f45-0410-b975-7103d5bbc06f
8c8c004f5f0bf49d9cbf4c90a6e7b5c3b95ad53a
6cbbdc9bfd93b4313bc0921fc7695c562454fc93
/Instantiable/Event/Client/ClientLogoutEvent.java
da5c52868cc8abc4670362fea7fae622e1c558b1
[]
no_license
Graagh/DragonAPI
3e3e5eb346c9afd5b2aa277f985727bf75096e2f
696f7ff7953578a0d517308327c9f61ea7c245bf
refs/heads/master
2021-01-01T17:25:02.117007
2017-07-18T01:33:00
2017-07-18T01:33:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
748
java
/******************************************************************************* * @author Reika Kalseki * * Copyright 2016 * * All rights reserved. * Distribution of the software in any form is only allowed with * explicit, prior permission from the owner. ******************************************************************************/ package Reika.DragonAPI.Instantiable.Event.Client; import net.minecraft.entity.player.EntityPlayer; import cpw.mods.fml.common.eventhandler.Event; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class ClientLogoutEvent extends Event { public final EntityPlayer player; public ClientLogoutEvent(EntityPlayer ep) { player = ep; } }
[ "reikasminecraft@gmail.com" ]
reikasminecraft@gmail.com
22e107679929026f1337b7748e2a1e4841731172
c65206d3b0505bde5ebdaea6617395657279d821
/src/test/java/com/cqs/demo/models/unit/strategy/service/StrategyServiceTest.java
3982ada4fba0ff7b4871ef15c8861d5b48f7a0de
[]
no_license
lixwcqs/spring_mybatis_demo
9d02d7b48fb4934148b53e02a8597f725ca45a74
f5a0b775406a2fd0202e80cf57f0c18642651f8b
refs/heads/master
2021-01-11T01:23:28.382772
2017-01-05T04:49:56
2017-01-05T04:49:56
70,663,297
0
0
null
null
null
null
UTF-8
Java
false
false
722
java
package com.cqs.demo.models.unit.strategy.service; import com.cqs.demo.base.BaseConfigurationTest; import com.cqs.demo.mock.StrategyMock; import org.junit.Test; import javax.annotation.Resource; /** * Created by cqs on 16-11-24. */ public class StrategyServiceTest extends BaseConfigurationTest { @Resource private StrategyService service; @Test public void insert() throws Exception { service.insert(StrategyMock.randStrategy()); } @Test public void selectById() throws Exception { service.selectById(1); } @Test public void batchInsert() throws Exception { } @Test public void findAll() throws Exception { service.findAll(); } }
[ "lixwcqs@163.com" ]
lixwcqs@163.com
f1b45986aa195eb157ced1683c5f461606c99273
3cd69da4d40f2d97130b5bf15045ba09c219f1fa
/sources/p019io/grpc/okhttp/OkHttpTlsUpgrader.java
b4b8f97f5d09b1c3305d665dafc4aa46156f5f10
[]
no_license
TheWizard91/Album_base_source_from_JADX
946ea3a407b4815ac855ce4313b97bd42e8cab41
e1d228fc2ee550ac19eeac700254af8b0f96080a
refs/heads/master
2023-01-09T08:37:22.062350
2020-11-11T09:52:40
2020-11-11T09:52:40
311,927,971
0
0
null
null
null
null
UTF-8
Java
false
false
2,163
java
package p019io.grpc.okhttp; import com.google.common.base.Preconditions; import java.io.IOException; import java.net.Socket; import java.util.Arrays; import java.util.Collections; import java.util.List; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; import p019io.grpc.okhttp.internal.ConnectionSpec; import p019io.grpc.okhttp.internal.OkHostnameVerifier; import p019io.grpc.okhttp.internal.Protocol; /* renamed from: io.grpc.okhttp.OkHttpTlsUpgrader */ final class OkHttpTlsUpgrader { static final List<Protocol> TLS_PROTOCOLS = Collections.unmodifiableList(Arrays.asList(new Protocol[]{Protocol.HTTP_2})); OkHttpTlsUpgrader() { } public static SSLSocket upgrade(SSLSocketFactory sslSocketFactory, HostnameVerifier hostnameVerifier, Socket socket, String host, int port, ConnectionSpec spec) throws IOException { Preconditions.checkNotNull(sslSocketFactory, "sslSocketFactory"); Preconditions.checkNotNull(socket, "socket"); Preconditions.checkNotNull(spec, "spec"); SSLSocket sslSocket = (SSLSocket) sslSocketFactory.createSocket(socket, host, port, true); spec.apply(sslSocket, false); String negotiatedProtocol = OkHttpProtocolNegotiator.get().negotiate(sslSocket, host, spec.supportsTlsExtensions() ? TLS_PROTOCOLS : null); List<Protocol> list = TLS_PROTOCOLS; Preconditions.checkState(list.contains(Protocol.get(negotiatedProtocol)), "Only " + list + " are supported, but negotiated protocol is %s", (Object) negotiatedProtocol); if (hostnameVerifier == null) { hostnameVerifier = OkHostnameVerifier.INSTANCE; } if (hostnameVerifier.verify(canonicalizeHost(host), sslSocket.getSession())) { return sslSocket; } throw new SSLPeerUnverifiedException("Cannot verify hostname: " + host); } static String canonicalizeHost(String host) { if (!host.startsWith("[") || !host.endsWith("]")) { return host; } return host.substring(1, host.length() - 1); } }
[ "agiapong@gmail.com" ]
agiapong@gmail.com
7d6c8f085ebfd7b2c2a003bf2784d96c00fab4bb
3dd35c0681b374ce31dbb255b87df077387405ff
/generated/com/guidewire/_generated/entity/GL7ExpSchedCondItemCondCostVersionListImpl.java
3e455d96613fbc620e68953c27b20886ec4ccf36
[]
no_license
walisashwini/SBTBackup
58b635a358e8992339db8f2cc06978326fed1b99
4d4de43576ec483bc031f3213389f02a92ad7528
refs/heads/master
2023-01-11T09:09:10.205139
2020-11-18T12:11:45
2020-11-18T12:11:45
311,884,817
0
0
null
null
null
null
UTF-8
Java
false
false
1,773
java
package com.guidewire._generated.entity; @javax.annotation.Generated(value = "com.guidewire.pl.metadata.codegen.Codegen", comments = "GL7ExpSchedCondItemCondCost.eti;GL7ExpSchedCondItemCondCost.eix;GL7ExpSchedCondItemCondCost.etx") @java.lang.SuppressWarnings(value = {"deprecation", "unchecked"}) public class GL7ExpSchedCondItemCondCostVersionListImpl extends com.guidewire.pl.system.entity.proxy.EffDatedVersionListImpl implements entity.windowed.GL7ExpSchedCondItemCondCostVersionList { public GL7ExpSchedCondItemCondCostVersionListImpl(entity.GL7ExpSchedCondItemCondCost base) { super(base); } public GL7ExpSchedCondItemCondCostVersionListImpl(gw.pl.persistence.core.Bundle bundle, gw.pl.persistence.core.effdate.EffDatedKey effDatedKey) { super(bundle, effDatedKey); } @java.lang.Override public entity.GL7ExpSchedCondItemCondCost AsOf(java.util.Date date) { return (entity.GL7ExpSchedCondItemCondCost)getVersionAsOf(date); } @java.lang.Override public java.util.List<? extends entity.GL7Transaction> TransactionsAsOf(java.util.Date date) { return (java.util.List)getArrayAsOf(entity.GL7ExpSchedCondItemCondCost.TRANSACTIONS_PROP.get(), date); } @java.lang.Override public void addToTransactions(entity.GL7Transaction bean) { addToArray(entity.GL7ExpSchedCondItemCondCost.TRANSACTIONS_PROP.get(), bean); } @java.lang.Override public java.util.List<? extends entity.GL7ExpSchedCondItemCondCost> getAllVersions() { return (java.util.List)getAllVersionsUntyped(); } @java.lang.Override public java.util.List<? extends entity.windowed.GL7TransactionVersionList> getTransactions() { return (java.util.List)getArray(entity.GL7ExpSchedCondItemCondCost.TRANSACTIONS_PROP.get()); } }
[ "ashwini@cruxxtechnologies.com" ]
ashwini@cruxxtechnologies.com