blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
59ffea982a2b47cbf361b63620700666179b250e
1,288,490,209,457
ac8e44a71a93d6338751a73bfcc5487de06240c1
/TestPros/demo/src/main/java/com/ldn/demo/domain/PropertiesPojo.java
9ac9c02c3a5dbc6fd8d1a1081fa1d490d647b7ed
[]
no_license
luning95/TestGitHub
https://github.com/luning95/TestGitHub
8d45668d779d5d0ed50530f531ecba79c9c3281c
e7f6f975e7fe0241da8a93bf6c093bb0fbb4caad
refs/heads/master
2020-04-08T11:07:43.706000
2018-11-27T07:34:59
2018-11-27T07:34:59
159,294,411
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ldn.demo.domain; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @Component public class PropertiesPojo { @Value("${com.ldn.title}") public String title; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } @Value("${com.ldn.description}") public String description; }
UTF-8
Java
443
java
PropertiesPojo.java
Java
[]
null
[]
package com.ldn.demo.domain; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @Component public class PropertiesPojo { @Value("${com.ldn.title}") public String title; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } @Value("${com.ldn.description}") public String description; }
443
0.683973
0.683973
21
20.095238
17.328493
58
false
false
0
0
0
0
0
0
0.333333
false
false
4
bd6b9374fb1378ba8e2b88515c25e1c4f5265b01
19,104,014,550,177
cde4358da2cbef4d8ca7caeb4b90939ca3f1f1ef
/java/timebase/server/src/main/java/deltix/qsrv/dtb/fs/alloc/ByteArrayHeap.java
0873101cf1ce7a14f324dbdd386e0b9715157c49
[ "Apache-2.0" ]
permissive
ptuyo/TimeBase
https://github.com/ptuyo/TimeBase
e17a33e0bfedcbbafd3618189e4de45416ec7259
812e178b814a604740da3c15cc64e42c57d69036
refs/heads/master
2022-12-18T19:41:46.084000
2020-09-29T11:03:50
2020-09-29T11:03:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package deltix.qsrv.dtb.fs.alloc; import deltix.qsrv.hf.blocks.ObjectPool; import deltix.util.collections.ByteArray; public class ByteArrayHeap { private final HeapManager heap; private final ObjectPool<ByteArray> pool = new ObjectPool<ByteArray>(1000, 10000) { @Override protected ByteArray newItem() { return new ByteArray(); } }; public ByteArrayHeap(HeapManager heap) { this.heap = heap; } public ByteArray create (int size) { ByteArray block = pool.borrow(); if (heap.allocate(size, block)) { return block; } else { block.setArray(new byte[size], 0, size); } return block; } public void free (ByteArray block) { heap.deallocate(block); pool.release(block); } public HeapManager getHeap() { return heap; } }
UTF-8
Java
961
java
ByteArrayHeap.java
Java
[]
null
[]
package deltix.qsrv.dtb.fs.alloc; import deltix.qsrv.hf.blocks.ObjectPool; import deltix.util.collections.ByteArray; public class ByteArrayHeap { private final HeapManager heap; private final ObjectPool<ByteArray> pool = new ObjectPool<ByteArray>(1000, 10000) { @Override protected ByteArray newItem() { return new ByteArray(); } }; public ByteArrayHeap(HeapManager heap) { this.heap = heap; } public ByteArray create (int size) { ByteArray block = pool.borrow(); if (heap.allocate(size, block)) { return block; } else { block.setArray(new byte[size], 0, size); } return block; } public void free (ByteArray block) { heap.deallocate(block); pool.release(block); } public HeapManager getHeap() { return heap; } }
961
0.559834
0.549428
42
21.880953
21.467808
89
false
false
0
0
0
0
0
0
0.428571
false
false
4
68c23d7e25906c45d0feb4a4ffc639012b302125
6,433,861,053,990
28d7c3b68a9780f8d0dce54e44afc152c4f29ba4
/moka-core/moka-core-tps/src/main/java/jmnet/moka/core/tps/mvc/search/vo/SearchKwdTotalLogVO.java
9976a7df520fc91ca7d02be9803da82e760878c5
[]
no_license
raika11/-
https://github.com/raika11/-
e937bc95e584b2c8f375e638b0b92ebcc7c8ee00
68981ddc6c90936bd5d30bdc8c854776023e2483
refs/heads/master
2023-04-23T11:42:54.105000
2021-05-06T06:52:21
2021-05-06T06:52:21
364,823,740
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package jmnet.moka.core.tps.mvc.search.vo; import java.util.Date; import jmnet.moka.core.tps.common.dto.DTODateTimeFormat; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import org.apache.ibatis.type.Alias; /** * <pre> * 키워드 통계 조회용 VO * Project : moka * Package : jmnet.moka.core.tps.mvc.search.vo * ClassName : SearchKwdLogVO * Created : 2021-01-22 ince * </pre> * * @author ince * @since 2021-01-22 13:19 */ @Alias("SearchKwdTotalLogVO") @AllArgsConstructor @NoArgsConstructor @Setter @Getter @Builder public class SearchKwdTotalLogVO { /** * 전체 검색 건수 */ @Builder.Default private Long totalCnt = 0l; /** * 모바일 건수 */ @Builder.Default private Long mobileCnt = 0l; /** * PC 건수 */ @Builder.Default private Long pcCnt = 0l; /** * 테블릿 건수 */ @Builder.Default private Long tabletCnt = 0l; /** * 최근 조회일 */ @DTODateTimeFormat private Date lastRegDt; }
UTF-8
Java
1,122
java
SearchKwdTotalLogVO.java
Java
[ { "context": " Created : 2021-01-22 ince\n * </pre>\n *\n * @author ince\n * @since 2021-01-22 13:19\n */\n\n@Alias(\"SearchKwd", "end": 478, "score": 0.9996341466903687, "start": 474, "tag": "USERNAME", "value": "ince" } ]
null
[]
package jmnet.moka.core.tps.mvc.search.vo; import java.util.Date; import jmnet.moka.core.tps.common.dto.DTODateTimeFormat; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import org.apache.ibatis.type.Alias; /** * <pre> * 키워드 통계 조회용 VO * Project : moka * Package : jmnet.moka.core.tps.mvc.search.vo * ClassName : SearchKwdLogVO * Created : 2021-01-22 ince * </pre> * * @author ince * @since 2021-01-22 13:19 */ @Alias("SearchKwdTotalLogVO") @AllArgsConstructor @NoArgsConstructor @Setter @Getter @Builder public class SearchKwdTotalLogVO { /** * 전체 검색 건수 */ @Builder.Default private Long totalCnt = 0l; /** * 모바일 건수 */ @Builder.Default private Long mobileCnt = 0l; /** * PC 건수 */ @Builder.Default private Long pcCnt = 0l; /** * 테블릿 건수 */ @Builder.Default private Long tabletCnt = 0l; /** * 최근 조회일 */ @DTODateTimeFormat private Date lastRegDt; }
1,122
0.64434
0.621698
62
16.096775
12.867451
56
false
false
0
0
0
0
0
0
0.225806
false
false
4
7bd94d6ec15033a645c88fd9d6678c8e1c492226
20,907,900,837,051
69b79fcd9ce0b968d9900647b33e4bf988bf7fa0
/interview/src/math/RangeAdditionII.java
4cc35485bf44008156ee59cfeb3a59748b895392
[]
no_license
ryjarvis/interview
https://github.com/ryjarvis/interview
77db65e6c26221db1dec1f9d9585003cd81494b8
75c95cbed7dd1e1a90ea104b26b124329d66f0b8
refs/heads/master
2021-05-16T12:33:02.203000
2018-10-12T18:13:54
2018-10-12T18:13:54
105,297,640
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package math; /** * @author: ryjarvis May 6, 2018 * */ // LeetCode #598 public class RangeAdditionII { public int maxCount(int m, int n, int[][] ops) { int i = m; int j = n; for (int[] ar : ops) { if (ar[0] < i) { i = ar[0]; } if (ar[1] < j) { j = ar[1]; } } return i * j; } public static void main(String[] args) { // TODO Auto-generated method stub } }
UTF-8
Java
427
java
RangeAdditionII.java
Java
[ { "context": "package math;\r\n\r\n/**\r\n * @author: ryjarvis May 6, 2018\r\n * \r\n */\r\n// LeetCode #598\r\npublic class R", "end": 48, "score": 0.9981129169464111, "start": 34, "tag": "NAME", "value": "ryjarvis May 6" } ]
null
[]
package math; /** * @author: <NAME>, 2018 * */ // LeetCode #598 public class RangeAdditionII { public int maxCount(int m, int n, int[][] ops) { int i = m; int j = n; for (int[] ar : ops) { if (ar[0] < i) { i = ar[0]; } if (ar[1] < j) { j = ar[1]; } } return i * j; } public static void main(String[] args) { // TODO Auto-generated method stub } }
419
0.484778
0.456674
28
13.25
13.484448
49
false
false
0
0
0
0
0
0
1.607143
false
false
4
b84b2f01a0f87d22e3cf444856021ed979a64f31
10,883,447,169,242
5bfa069cf394595d25ddb331b8cd701acf37eeb3
/app/src/main/java/fi/polar/polarflow/ui/myday/s.java
7e1fd284bae09d5eaeecd2d1f748dddca5cef335
[]
no_license
skorotkov/reversed
https://github.com/skorotkov/reversed
747d36a44314e2bf3ebee0607152a0873b191ca5
3f5222de57befe8a54fd1d07462492f3a605efdd
refs/heads/master
2020-03-27T23:45:35.198000
2018-09-04T14:11:47
2018-09-04T14:11:47
147,343,931
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package fi.polar.polarflow.ui.myday; import android.content.ComponentName; import android.content.ServiceConnection; import android.os.IBinder; import fi.polar.polarflow.service.activity.SleepTrackingService; import fi.polar.polarflow.service.activity.bm; class s implements ServiceConnection { // $FF: synthetic field final StopSleepActivity a; s(StopSleepActivity var1) { this.a = var1; } public void onServiceConnected(ComponentName var1, IBinder var2) { StopSleepActivity.a(this.a, ((bm)var2).a()); if (StopSleepActivity.j(this.a)) { StopSleepActivity.b(this.a, false); StopSleepActivity.c(this.a).a(StopSleepActivity.d(this.a), false, false); } } public void onServiceDisconnected(ComponentName var1) { StopSleepActivity.a(this.a, (SleepTrackingService)null); } }
UTF-8
Java
847
java
s.java
Java
[]
null
[]
package fi.polar.polarflow.ui.myday; import android.content.ComponentName; import android.content.ServiceConnection; import android.os.IBinder; import fi.polar.polarflow.service.activity.SleepTrackingService; import fi.polar.polarflow.service.activity.bm; class s implements ServiceConnection { // $FF: synthetic field final StopSleepActivity a; s(StopSleepActivity var1) { this.a = var1; } public void onServiceConnected(ComponentName var1, IBinder var2) { StopSleepActivity.a(this.a, ((bm)var2).a()); if (StopSleepActivity.j(this.a)) { StopSleepActivity.b(this.a, false); StopSleepActivity.c(this.a).a(StopSleepActivity.d(this.a), false, false); } } public void onServiceDisconnected(ComponentName var1) { StopSleepActivity.a(this.a, (SleepTrackingService)null); } }
847
0.72255
0.715466
29
28.206896
24.38821
82
false
false
0
0
0
0
0
0
0.62069
false
false
4
1b60936123668146124d69abd88d3f72ffe4e542
15,960,098,514,755
a247e5533ff8133f96842fdb4d369e55d35fdef6
/src/main/java/yuzunyannn/elementalsorcery/dungeon/DungeonFuncExecuteContextBuild.java
b8b9bec642bbd3e87abfd4167a2da481e9320dca
[]
no_license
Yuzunyannn/ElementalSorcery
https://github.com/Yuzunyannn/ElementalSorcery
76a4d37319e68fbca64a97cbe9673928008f1a85
1457d81ea41114363a894202ae75ae4ca51e1360
refs/heads/master
2023-08-31T13:21:52.185000
2023-08-19T12:09:52
2023-08-19T12:09:52
183,849,638
13
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package yuzunyannn.elementalsorcery.dungeon; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import yuzunyannn.elementalsorcery.api.gfunc.GameFunc; public class DungeonFuncExecuteContextBuild extends DungeonFuncExecuteContext { protected int index; protected GameFunc coreFunc; public DungeonFuncExecuteContextBuild(DungeonAreaRoom room, int index, World world, BlockPos at) { this.setRoom(room); this.setSrcObj(world, at); this.index = index; this.coreFunc = room.getFunc(index); } public void doExecute() { GameFunc nFunc = doExecute(coreFunc); if (index != room.funcGlobalIndex) nFunc = GameFunc.NOTHING; room.setFunc(index, nFunc); } }
UTF-8
Java
692
java
DungeonFuncExecuteContextBuild.java
Java
[]
null
[]
package yuzunyannn.elementalsorcery.dungeon; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import yuzunyannn.elementalsorcery.api.gfunc.GameFunc; public class DungeonFuncExecuteContextBuild extends DungeonFuncExecuteContext { protected int index; protected GameFunc coreFunc; public DungeonFuncExecuteContextBuild(DungeonAreaRoom room, int index, World world, BlockPos at) { this.setRoom(room); this.setSrcObj(world, at); this.index = index; this.coreFunc = room.getFunc(index); } public void doExecute() { GameFunc nFunc = doExecute(coreFunc); if (index != room.funcGlobalIndex) nFunc = GameFunc.NOTHING; room.setFunc(index, nFunc); } }
692
0.781792
0.781792
24
27.833334
26.039499
99
false
false
0
0
0
0
0
0
1.583333
false
false
4
ba3978646ca1c0e62bcc4607a88871c87baed629
8,091,718,455,618
14ec5d2660728e1d7182b10d1316209c181f54c1
/src/test/java/JeepTest.java
218eb4ce3e83d8ca65732e8571c45a9e800735ac
[]
no_license
floyd924/car_dealership_lab
https://github.com/floyd924/car_dealership_lab
36cb0099fd7058e21c6740f05b2494f32e84bd39
2477499c6ef88f459a746024d1fc56b9cba78b7b
refs/heads/master
2020-04-08T16:30:14.529000
2018-11-28T18:49:12
2018-11-28T18:49:12
159,520,994
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import Vehicles.Jeep; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertEquals; public class JeepTest { Jeep jeep; @Before public void setup(){ jeep = new Jeep("Ford", "Explorer", 7, 50000, 2300); } @Test public void hasMake(){ assertEquals("Ford", jeep.getMake()); } @Test public void hasModel(){ assertEquals("Explorer", jeep.getModel()); } @Test public void hasNumberOfSeats(){ assertEquals(7, jeep.getNumberOfSeats()); } @Test public void hasPrice(){ assertEquals(50000, jeep.getPrice()); } @Test public void hasDamage(){ assertEquals(2300, jeep.getDamage()); } @Test public void canTow(){ assertEquals("Now towing a horsebox", jeep.tow("horsebox")); } @Test public void canDrive(){ assertEquals("brrmm", jeep.drive()); } }
UTF-8
Java
938
java
JeepTest.java
Java
[]
null
[]
import Vehicles.Jeep; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertEquals; public class JeepTest { Jeep jeep; @Before public void setup(){ jeep = new Jeep("Ford", "Explorer", 7, 50000, 2300); } @Test public void hasMake(){ assertEquals("Ford", jeep.getMake()); } @Test public void hasModel(){ assertEquals("Explorer", jeep.getModel()); } @Test public void hasNumberOfSeats(){ assertEquals(7, jeep.getNumberOfSeats()); } @Test public void hasPrice(){ assertEquals(50000, jeep.getPrice()); } @Test public void hasDamage(){ assertEquals(2300, jeep.getDamage()); } @Test public void canTow(){ assertEquals("Now towing a horsebox", jeep.tow("horsebox")); } @Test public void canDrive(){ assertEquals("brrmm", jeep.drive()); } }
938
0.592751
0.571429
50
17.76
18.159912
68
false
false
0
0
0
0
0
0
0.48
false
false
4
0a31a207c79d617cb5f48ce57ee83be0d94618a9
10,746,008,207,906
82a562ebc50e5e459546aa7e26b1746747c11e1d
/src/com/jacada/adp/packageTracking/entities/PackageDetails.java
af372fc07538534bf2e5ec7c48e976635b1f1fc6
[]
no_license
aditoppol/adp
https://github.com/aditoppol/adp
0c32d04062f650042743a060964a3f5b1fdb8b37
f30ee2fcbb20bfb8038c3803cd5c267337d5a894
refs/heads/master
2018-01-08T11:49:52.197000
2015-05-28T18:20:25
2015-05-28T18:20:25
36,399,769
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jacada.adp.packageTracking.entities; import java.io.Serializable; public class PackageDetails implements Serializable { private static final long serialVersionUID = 1L; String barcode; String branchNumber; String clientUseCode; String clientUseSequence; String comments; String companyCode; String courier; String deliveryCenter; String deliveryDate; String deliveryDateTime; String methodCode; String methodCodeMatch; String office; String payrollScheduleNumber; String pkgCountTrip; String pkgCountUser; String productCode; String reportGroup; String scanDate; String serviceCenter; String co_name; String street_1; String street_2; String city; String state; String zip; public void setCo_name(String co_name) { this.co_name = co_name; } public void setStreet_1(String street_1) { this.street_1 = street_1; } public void setStreet_2(String street_2) { this.street_2 = street_2; } public void setCity(String city) { this.city = city; } public void setState(String state) { this.state = state; } public void setZip(String zip) { this.zip = zip; } public String getCo_name() { return co_name; } public String getStreet_1() { return street_1; } public String getStreet_2() { return street_2; } public String getCity() { return city; } public String getState() { return state; } public String getZip() { return zip; } public void setBarcode(String barcode) { this.barcode = barcode; } public void setBranchNumber(String branchNumber) { this.branchNumber = branchNumber; } public void setClientUseCode(String clientUseCode) { this.clientUseCode = clientUseCode; } public void setClientUseSequence(String clientUseSequence) { this.clientUseSequence = clientUseSequence; } public void setComments(String comments) { this.comments = comments; } public void setCompanyCode(String companyCode) { this.companyCode = companyCode; } public void setCourier(String courier) { this.courier = courier; } public void setDeliveryCenter(String deliveryCenter) { this.deliveryCenter = deliveryCenter; } public void setDeliveryDate(String deliveryDate) { this.deliveryDate = deliveryDate; } public void setDeliveryDateTime(String deliveryDateTime) { this.deliveryDateTime = deliveryDateTime; } public void setMethodCode(String methodCode) { this.methodCode = methodCode; } public void setMethodCodeMatch(String methodCodeMatch) { this.methodCodeMatch = methodCodeMatch; } public void setOffice(String office) { this.office = office; } public void setPayrollScheduleNumber(String payrollScheduleNumber) { this.payrollScheduleNumber = payrollScheduleNumber; } public void setPkgCountTrip(String pkgCountTrip) { this.pkgCountTrip = pkgCountTrip; } public void setPkgCountUser(String pkgCountUser) { this.pkgCountUser = pkgCountUser; } public void setProductCode(String productCode) { this.productCode = productCode; } public void setReportGroup(String reportGroup) { this.reportGroup = reportGroup; } public void setScanDate(String scanDate) { this.scanDate = scanDate; } public void setServiceCenter(String serviceCenter) { this.serviceCenter = serviceCenter; } public String getBarcode() { return barcode; } public String getBranchNumber() { return branchNumber; } public String getClientUseCode() { return clientUseCode; } public String getClientUseSequence() { return clientUseSequence; } public String getComments() { return comments; } public String getCompanyCode() { return companyCode; } public String getCourier() { return courier; } public String getDeliveryCenter() { return deliveryCenter; } public String getDeliveryDate() { return deliveryDate; } public String getDeliveryDateTime() { return deliveryDateTime; } public String getMethodCode() { return methodCode; } public String getMethodCodeMatch() { return methodCodeMatch; } public String getOffice() { return office; } public String getPayrollScheduleNumber() { return payrollScheduleNumber; } public String getPkgCountTrip() { return pkgCountTrip; } public String getPkgCountUser() { return pkgCountUser; } public String getProductCode() { return productCode; } public String getReportGroup() { return reportGroup; } public String getScanDate() { return scanDate; } public String getServiceCenter() { return serviceCenter; } }
UTF-8
Java
4,637
java
PackageDetails.java
Java
[]
null
[]
package com.jacada.adp.packageTracking.entities; import java.io.Serializable; public class PackageDetails implements Serializable { private static final long serialVersionUID = 1L; String barcode; String branchNumber; String clientUseCode; String clientUseSequence; String comments; String companyCode; String courier; String deliveryCenter; String deliveryDate; String deliveryDateTime; String methodCode; String methodCodeMatch; String office; String payrollScheduleNumber; String pkgCountTrip; String pkgCountUser; String productCode; String reportGroup; String scanDate; String serviceCenter; String co_name; String street_1; String street_2; String city; String state; String zip; public void setCo_name(String co_name) { this.co_name = co_name; } public void setStreet_1(String street_1) { this.street_1 = street_1; } public void setStreet_2(String street_2) { this.street_2 = street_2; } public void setCity(String city) { this.city = city; } public void setState(String state) { this.state = state; } public void setZip(String zip) { this.zip = zip; } public String getCo_name() { return co_name; } public String getStreet_1() { return street_1; } public String getStreet_2() { return street_2; } public String getCity() { return city; } public String getState() { return state; } public String getZip() { return zip; } public void setBarcode(String barcode) { this.barcode = barcode; } public void setBranchNumber(String branchNumber) { this.branchNumber = branchNumber; } public void setClientUseCode(String clientUseCode) { this.clientUseCode = clientUseCode; } public void setClientUseSequence(String clientUseSequence) { this.clientUseSequence = clientUseSequence; } public void setComments(String comments) { this.comments = comments; } public void setCompanyCode(String companyCode) { this.companyCode = companyCode; } public void setCourier(String courier) { this.courier = courier; } public void setDeliveryCenter(String deliveryCenter) { this.deliveryCenter = deliveryCenter; } public void setDeliveryDate(String deliveryDate) { this.deliveryDate = deliveryDate; } public void setDeliveryDateTime(String deliveryDateTime) { this.deliveryDateTime = deliveryDateTime; } public void setMethodCode(String methodCode) { this.methodCode = methodCode; } public void setMethodCodeMatch(String methodCodeMatch) { this.methodCodeMatch = methodCodeMatch; } public void setOffice(String office) { this.office = office; } public void setPayrollScheduleNumber(String payrollScheduleNumber) { this.payrollScheduleNumber = payrollScheduleNumber; } public void setPkgCountTrip(String pkgCountTrip) { this.pkgCountTrip = pkgCountTrip; } public void setPkgCountUser(String pkgCountUser) { this.pkgCountUser = pkgCountUser; } public void setProductCode(String productCode) { this.productCode = productCode; } public void setReportGroup(String reportGroup) { this.reportGroup = reportGroup; } public void setScanDate(String scanDate) { this.scanDate = scanDate; } public void setServiceCenter(String serviceCenter) { this.serviceCenter = serviceCenter; } public String getBarcode() { return barcode; } public String getBranchNumber() { return branchNumber; } public String getClientUseCode() { return clientUseCode; } public String getClientUseSequence() { return clientUseSequence; } public String getComments() { return comments; } public String getCompanyCode() { return companyCode; } public String getCourier() { return courier; } public String getDeliveryCenter() { return deliveryCenter; } public String getDeliveryDate() { return deliveryDate; } public String getDeliveryDateTime() { return deliveryDateTime; } public String getMethodCode() { return methodCode; } public String getMethodCodeMatch() { return methodCodeMatch; } public String getOffice() { return office; } public String getPayrollScheduleNumber() { return payrollScheduleNumber; } public String getPkgCountTrip() { return pkgCountTrip; } public String getPkgCountUser() { return pkgCountUser; } public String getProductCode() { return productCode; } public String getReportGroup() { return reportGroup; } public String getScanDate() { return scanDate; } public String getServiceCenter() { return serviceCenter; } }
4,637
0.717921
0.714686
193
22.025908
16.788052
69
false
false
0
0
0
0
0
0
1.658031
false
false
4
6474543dd7d979231b77006f96ebf7b0b1daf90f
25,374,666,819,501
4bccb70f8351c01a33feaccf6f5299a027a59847
/code/java/fast-hbase-rest/src/main/java/com/dirlt/java/FastHBaseRest/AsyncClient.java
e7b21e229bfaaff717bc02c7eb8bfa68e47006b3
[]
no_license
ichengzi/sperm
https://github.com/ichengzi/sperm
012a6581d1b1ee7f9089a41227005051b086fc48
f6f9d1aeca158ed42554295155fd218a926aaa37
refs/heads/master
2020-03-15T06:16:54.431000
2018-05-03T14:17:36
2018-05-03T14:17:36
132,003,931
0
0
null
true
2018-05-03T14:04:40
2018-05-03T14:04:40
2016-05-08T13:32:26
2013-08-13T16:18:52
18,752
0
0
0
null
false
null
package com.dirlt.java.FastHBaseRest; import com.dirlt.java.FastHbaseRest.MessageProtos1; import com.google.protobuf.ByteString; import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.Message; import com.stumbleupon.async.Callback; import com.stumbleupon.async.Deferred; import org.hbase.async.GetRequest; import org.hbase.async.KeyValue; import org.hbase.async.PutRequest; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.handler.codec.http.DefaultHttpResponse; import org.jboss.netty.handler.codec.http.HttpResponse; import org.jboss.netty.handler.codec.http.HttpResponseStatus; import org.jboss.netty.handler.codec.http.HttpVersion; import java.io.ByteArrayOutputStream; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; /** * Created with IntelliJ IDEA. * User: dirlt * Date: 12/8/12 * Time: 2:03 AM * To change this template use File | Settings | File Templates. */ public class AsyncClient implements Runnable { public static final String kSep = String.format("%c", 0x0); public static final long kDefaultTimeout = 100 * 1000; // 100s.(that's long enough). public static final byte[] kEmptyBytes = new byte[0]; public Configuration configuration; public AsyncClient(Configuration configuration) { this.configuration = configuration; } // state of each step. enum Status { kStat, kMultiRead, kMultiWrite, kHttpRequest, kReadRequest, kWriteRequest, kReadLocalCache, kReadHBaseService, kWriteHBaseService, kReadResponse, kWriteResponse, kHttpResponse, } // sub request status enum SubRequestStatus { kOK, kException, kTimeout, } public boolean subRequest = false; // whether is sub request. public Status code = Status.kStat; // default value. public SubRequestStatus subRequestStatus = SubRequestStatus.kOK; public Channel channel; // for multi interface. public AsyncClient parent; public AtomicInteger refCounter; public List<AsyncClient> clients; public ChannelBuffer buffer; public String path; public byte[] bs; public MessageProtos1.ReadRequest.Builder rdReqBuilder; public MessageProtos1.ReadRequest rdReq; public MessageProtos1.WriteRequest.Builder wrReqBuilder; public MessageProtos1.WriteRequest wrReq; public MessageProtos1.MultiReadRequest.Builder mRdReqBuilder; public MessageProtos1.MultiReadRequest multiReadRequest; public MessageProtos1.MultiWriteRequest.Builder mWrReqBuilder; public MessageProtos1.MultiWriteRequest multiWriteRequest; public MessageProtos1.ReadResponse.Builder rdRes; public MessageProtos1.WriteResponse.Builder wrRes; public MessageProtos1.MultiReadResponse.Builder mRdRes; public MessageProtos1.MultiWriteResponse.Builder mWrRes; public Message msg; public long requestTimestamp; public long requestTimeout; public long sessionStartTimestamp; public long sessionEndTimestamp; public long readStartTimestamp; public long readEndTimestamp; public long readHBaseServiceStartTimestamp; public long readHBaseServiceEndTimestamp; public long writeHBaseServiceStartTimestamp; public long writeHBaseServiceEndTimestamp; public String tableName; public String rowKey; public String columnFamily; public String prefix; // cache key prefix. public static String makeCacheKeyPrefix(String tableName, String rowKey, String cf) { return tableName + kSep + rowKey + kSep + cf; } public static String makeCacheKey(String prefix, String column) { return prefix + kSep + column; } private List<String> readCacheQualifiers; // qualifiers that to be queried from cache. private List<String> readHBaseQualifiers; // qualifiers that to be queried from hbase. // if == null, then read column family. public void init() { rdReq = null; wrReq = null; multiReadRequest = null; multiWriteRequest = null; subRequestStatus = SubRequestStatus.kOK; requestTimeout = kDefaultTimeout; } @Override public void run() { switch (code) { case kHttpRequest: handleHttpRequest(); break; case kMultiRead: multiRead(); break; case kMultiWrite: multiWrite(); break; case kReadRequest: readRequest(); break; case kWriteRequest: writeRequest(); break; case kReadLocalCache: readLocalCache(); break; case kReadHBaseService: readHBaseService(); break; case kWriteHBaseService: writeHBaseService(); break; case kReadResponse: readResponse(); break; case kWriteResponse: writeResponse(); break; case kHttpResponse: handleHttpResponse(); break; default: break; } } public void handleHttpRequest() { RestServer.logger.debug("http request"); int size = buffer.readableBytes(); StatStore.getInstance().addCounter("rpc.in.bytes", size); bs = new byte[size]; buffer.readBytes(bs); if (path.equals("/read")) { code = Status.kReadRequest; } else if (path.equals("/multi-read")) { code = Status.kMultiRead; } else if (path.equals("/write")) { code = Status.kWriteRequest; } else if (path.equals("/multi-write")) { code = Status.kMultiWrite; } else { // impossible. } // entry. if we want async mode, we put into cpu thread // otherwise we just run. if (configuration.isAsync()) { CpuWorkerPool.getInstance().submit(this); } else { run(); } } public void readRequest() { RestServer.logger.debug("read request"); if (!subRequest) { // parse request. rdReqBuilder = MessageProtos1.ReadRequest.newBuilder(); try { rdReqBuilder.mergeFrom(bs); } catch (InvalidProtocolBufferException e) { // just close channel. RestServer.logger.debug("parse message exception"); StatStore.getInstance().addCounter("rpc.in.count.invalid", 1); channel.close(); } rdReq = rdReqBuilder.build(); StatStore.getInstance().addCounter("rpc.read.count", 1); if (rdReq.hasTimeout()) { requestTimeout = rdReq.getTimeout(); } } // proxy. try { rdReq = RequestProxy.getInstance().handleReadRequest(rdReq); } catch (Exception e) { // just close channle. RestServer.logger.debug("request proxy exception"); StatStore.getInstance().addCounter("request.proxy.exception", 1); channel.close(); } readStartTimestamp = System.currentTimeMillis(); tableName = rdReq.getTableName(); rowKey = rdReq.getRowKey(); columnFamily = rdReq.getColumnFamily(); rdRes = MessageProtos1.ReadResponse.newBuilder(); prefix = makeCacheKeyPrefix(tableName, rowKey, columnFamily); if (rdReq.getQualifiersCount() == 0) { // read column family // then we can't do cache. code = Status.kReadHBaseService; } else { // raise local cache request. code = Status.kReadLocalCache; } run(); } public void multiRead() { RestServer.logger.debug("multi read request"); mRdReqBuilder = MessageProtos1.MultiReadRequest.newBuilder(); try { mRdReqBuilder.mergeFrom(bs); } catch (InvalidProtocolBufferException e) { // just close channel. RestServer.logger.debug("parse message exception"); StatStore.getInstance().addCounter("rpc.in.count.invalid", 1); channel.close(); } multiReadRequest = mRdReqBuilder.build(); if (multiReadRequest.getRequestsCount() == 0) { RestServer.logger.debug("multi read no sub request"); StatStore.getInstance().addCounter("rpc.multi-read.error.count", 1); channel.close(); return; } StatStore.getInstance().addCounter("rpc.multi-read.count", 1); if (refCounter == null) { refCounter = new AtomicInteger(multiReadRequest.getRequestsCount()); } else { refCounter.set(multiReadRequest.getRequestsCount()); } if (clients == null) { clients = new LinkedList<AsyncClient>(); } else { clients.clear(); } if (multiReadRequest.hasTimeout()) { requestTimeout = multiReadRequest.getTimeout(); } for (MessageProtos1.ReadRequest request : multiReadRequest.getRequestsList()) { AsyncClient client = new AsyncClient(configuration); client.init(); client.code = Status.kReadRequest; client.subRequest = true; client.rdReq = request; client.parent = this; // sub request inherits from parent request. client.requestTimeout = requestTimeout; client.requestTimestamp = requestTimestamp; clients.add(client); CpuWorkerPool.getInstance().submit(client); } } public void writeRequest() { RestServer.logger.debug("write request"); if (!subRequest) { wrReqBuilder = MessageProtos1.WriteRequest.newBuilder(); // parse request. try { wrReqBuilder.mergeFrom(bs); } catch (InvalidProtocolBufferException e) { // just close channel. RestServer.logger.debug("parse message exception"); StatStore.getInstance().addCounter("rpc.in.count.invalid", 1); channel.close(); } wrReq = wrReqBuilder.build(); StatStore.getInstance().addCounter("rpc.write.count", 1); if (wrReq.hasTimeout()) { requestTimeout = wrReq.getTimeout(); } } // proxy. try { wrReq = RequestProxy.getInstance().handleWriteRequest(wrReq); } catch (Exception e) { // just close channel. RestServer.logger.debug("request proxy exception"); StatStore.getInstance().addCounter("request.proxy.exception", 1); channel.close(); } tableName = wrReq.getTableName(); rowKey = wrReq.getRowKey(); columnFamily = wrReq.getColumnFamily(); // prepare the result. wrRes = MessageProtos1.WriteResponse.newBuilder(); code = Status.kWriteHBaseService; run(); } public void multiWrite() { RestServer.logger.debug("multi write request"); mWrReqBuilder = MessageProtos1.MultiWriteRequest.newBuilder(); try { mWrReqBuilder.mergeFrom(bs); } catch (InvalidProtocolBufferException e) { // just close channel. RestServer.logger.debug("parse message exception"); StatStore.getInstance().addCounter("rpc.in.count.invalid", 1); channel.close(); } multiWriteRequest = mWrReqBuilder.build(); if (multiWriteRequest.getRequestsCount() == 0) { RestServer.logger.debug("multi write no sub request"); StatStore.getInstance().addCounter("rpc.multi-write.error.count", 1); channel.close(); return; } StatStore.getInstance().addCounter("rpc.multi-write.count", 1); if (refCounter == null) { refCounter = new AtomicInteger(multiWriteRequest.getRequestsCount()); } else { refCounter.set(multiWriteRequest.getRequestsCount()); } if (clients == null) { clients = new LinkedList<AsyncClient>(); } else { clients.clear(); } if (multiWriteRequest.hasTimeout()) { requestTimeout = multiWriteRequest.getTimeout(); } for (MessageProtos1.WriteRequest request : multiWriteRequest.getRequestsList()) { AsyncClient client = new AsyncClient(configuration); client.init(); client.code = Status.kWriteRequest; client.subRequest = true; client.wrReq = request; client.parent = this; // sub request inherits from parent request. client.requestTimeout = requestTimeout; client.requestTimestamp = requestTimestamp; clients.add(client); CpuWorkerPool.getInstance().submit(client); } } public void readLocalCache() { RestServer.logger.debug("read local cache"); if (readCacheQualifiers == null) { readCacheQualifiers = new ArrayList<String>(); } else { readCacheQualifiers.clear(); } // check local cache mean while fill the cache request. int readCount = 0; int cacheCount = 0; for (String q : rdReq.getQualifiersList()) { String cacheKey = null; byte[] b = null; if (configuration.isCache()) { cacheKey = makeCacheKey(prefix, q); RestServer.logger.debug("search cache with key = " + cacheKey); b = LocalCache.getInstance().get(cacheKey); } readCount += 1; if (b != null) { RestServer.logger.debug("cache hit!"); cacheCount += 1; MessageProtos1.ReadResponse.KeyValue.Builder bd = MessageProtos1.ReadResponse.KeyValue.newBuilder(); bd.setQualifier(q); bd.setContent(ByteString.copyFrom(b)); rdRes.addKvs(bd); } else { RestServer.logger.debug("read hbase qualifier: " + q); readCacheQualifiers.add(q); } } StatStore.getInstance().addCounter("read.count", readCount); StatStore.getInstance().addCounter("read.count.local-cache", cacheCount); if (!readCacheQualifiers.isEmpty()) { code = Status.kReadHBaseService; // read cache service. readHBaseQualifiers = readCacheQualifiers; } else { code = Status.kReadResponse; // return directly. } run(); } public void readHBaseService() { RestServer.logger.debug("read hbase service"); final AsyncClient client = this; client.code = Status.kReadResponse; // already timeout, don't request hbase. if ((System.currentTimeMillis() - requestTimestamp) > requestTimeout) { RestServer.logger.debug("detect timeout before read request hbase"); StatStore.getInstance().addCounter("read.count.timeout.before-request-hbase", 1); client.subRequestStatus = SubRequestStatus.kTimeout; // run in the same thread. client.run(); return; } RestServer.logger.debug("tableName = " + tableName + ", rowKey = " + rowKey + ", columnFamily = " + columnFamily); GetRequest getRequest = new GetRequest(tableName, rowKey); getRequest.family(columnFamily); if (rdReq.getQualifiersCount() != 0) { // otherwise we read all qualifiers from column family. // a little bit tedious. byte[][] qualifiers = new byte[readHBaseQualifiers.size()][]; int idx = 0; for (String q : readHBaseQualifiers) { qualifiers[idx] = q.getBytes(); idx += 1; } getRequest.qualifiers(qualifiers); StatStore.getInstance().addCounter("read.count.hbase.column", qualifiers.length); } else { StatStore.getInstance().addCounter("read.count.hbase.column-family", 1); } client.readHBaseServiceStartTimestamp = System.currentTimeMillis(); Deferred<ArrayList<KeyValue>> deferred = HBaseService.getInstance().get(getRequest); // if failed, we don't return. deferred.addCallback(new Callback<Object, ArrayList<KeyValue>>() { @Override public Object call(ArrayList<KeyValue> keyValues) throws Exception { // we don't return because we put into CpuWorkerPool. client.readHBaseServiceEndTimestamp = System.currentTimeMillis(); if (client.rdReq.getQualifiersCount() != 0) { // reorder qualifier according request qualifier order. // then builder and the cache. Map<String, KeyValue> mapping = new HashMap<String, KeyValue>(); for (KeyValue kv : keyValues) { mapping.put(new String(kv.qualifier()), kv); } int missingCount = 0; for (String k : rdReq.getQualifiersList()) { KeyValue kv = mapping.get(k); MessageProtos1.ReadResponse.KeyValue.Builder sub = MessageProtos1.ReadResponse.KeyValue.newBuilder(); sub.setQualifier(k); byte[] v = kEmptyBytes; if (kv == null) { sub.setContent(ByteString.EMPTY); missingCount++; } else { v = kv.value(); sub.setContent(ByteString.copyFrom(kv.value())); } rdRes.addKvs(sub.build()); // fill cache. if (client.configuration.isCache()) { String cacheKey = makeCacheKey(prefix, k); RestServer.logger.debug("fill cache with key = " + cacheKey); LocalCache.getInstance().set(cacheKey, v); } } StatStore.getInstance().addCounter("read.count.field-not-exist", missingCount); StatStore.getInstance().addCounter("read.duration.hbase.column", client.readHBaseServiceEndTimestamp - client.readHBaseServiceStartTimestamp); } else { // just fill the builder. don't save them to cache. for (KeyValue kv : keyValues) { String k = new String(kv.qualifier()); byte[] value = kv.value(); MessageProtos1.ReadResponse.KeyValue.Builder bd = MessageProtos1.ReadResponse.KeyValue.newBuilder(); bd.setQualifier(k); bd.setContent(ByteString.copyFrom(value)); client.rdRes.addKvs(bd); } StatStore.getInstance().addCounter("read.duration.hbase.column-family", client.readHBaseServiceEndTimestamp - client.readHBaseServiceStartTimestamp); } // already timeout if ((System.currentTimeMillis() - client.requestTimestamp) > client.requestTimeout) { RestServer.logger.debug("detect timeout after read request hbase"); StatStore.getInstance().addCounter("read.count.timeout.after-request-hbase", 1); client.subRequestStatus = SubRequestStatus.kTimeout; } // put back to CPU worker pool. CpuWorkerPool.getInstance().submit(client); return null; } }); deferred.addErrback(new Callback<Object, Exception>() { @Override public Object call(Exception o) throws Exception { o.printStackTrace(); StatStore.getInstance().addCounter("read.count.error", 1); client.subRequestStatus = SubRequestStatus.kException; CpuWorkerPool.getInstance().submit(client); return null; } }); } public void writeHBaseService() { RestServer.logger.debug("write hbase service"); final AsyncClient client = this; client.code = Status.kWriteResponse; // already timeout, don't request hbase. if ((System.currentTimeMillis() - requestTimestamp) > requestTimeout) { RestServer.logger.debug("detect timeout before write request hbase"); StatStore.getInstance().addCounter("write.count.timeout.before-request-hbase", 1); client.subRequestStatus = SubRequestStatus.kTimeout; // run in the same thread. client.run(); return; } RestServer.logger.debug("tableName = " + tableName + ", rowKey = " + rowKey + ", columnFamily = " + columnFamily); byte[][] qualifiers = new byte[wrReq.getKvsCount()][]; byte[][] values = new byte[wrReq.getKvsCount()][]; for (int i = 0; i < wrReq.getKvsCount(); i++) { qualifiers[i] = wrReq.getKvs(i).getQualifier().getBytes(); values[i] = wrReq.getKvs(i).getContent().toByteArray(); } StatStore.getInstance().addCounter("write.count", wrReq.getKvsCount()); PutRequest putRequest = new PutRequest(tableName.getBytes(), rowKey.getBytes(), columnFamily.getBytes(), qualifiers, values); client.writeHBaseServiceStartTimestamp = System.currentTimeMillis(); Deferred<Object> deferred = HBaseService.getInstance().put(putRequest); // if failed, we don't return. deferred.addCallback(new Callback<Object, Object>() { @Override public Object call(Object obj) throws Exception { // already timeout if ((System.currentTimeMillis() - client.requestTimestamp) > client.requestTimeout) { RestServer.logger.debug("detect timeout after write request hbase"); StatStore.getInstance().addCounter("write.count.timeout.after-request-hbase", 1); client.subRequestStatus = SubRequestStatus.kTimeout; } // we don't return because we put into CpuWorkerPool. CpuWorkerPool.getInstance().submit(client); return null; } }); deferred.addErrback(new Callback<Object, Exception>() { @Override public Object call(Exception o) throws Exception { // we don't care. o.printStackTrace(); StatStore.getInstance().addCounter("write.count.error", 1); client.subRequestStatus = SubRequestStatus.kException; CpuWorkerPool.getInstance().submit(client); return null; } }); } public void readResponse() { if (subRequestStatus == SubRequestStatus.kOK) { readEndTimestamp = System.currentTimeMillis(); StatStore.getInstance().addCounter("read.duration", readEndTimestamp - readStartTimestamp); } if (!subRequest) { if (subRequestStatus != SubRequestStatus.kOK) { channel.close(); return; } msg = rdRes.build(); code = Status.kHttpResponse; run(); } else { int count = parent.refCounter.decrementAndGet(); if (count == 0) { parent.mRdRes = MessageProtos1.MultiReadResponse.newBuilder(); for (AsyncClient client : parent.clients) { // if any one fails, then it fails. if (client.subRequestStatus != SubRequestStatus.kOK) { RestServer.logger.debug("read client status = " + client.subRequestStatus); parent.channel.close(); return; } parent.mRdRes.addResponses(client.rdRes); } parent.msg = parent.mRdRes.build(); parent.code = Status.kHttpResponse; CpuWorkerPool.getInstance().submit(parent); } } } public void writeResponse() { if (subRequestStatus == SubRequestStatus.kOK) { writeHBaseServiceEndTimestamp = System.currentTimeMillis(); StatStore.getInstance().addCounter("write.duration", writeHBaseServiceEndTimestamp - writeHBaseServiceStartTimestamp); } if (!subRequest) { if (subRequestStatus != SubRequestStatus.kOK) { channel.close(); return; } msg = wrRes.build(); code = Status.kHttpResponse; run(); } else { int count = parent.refCounter.decrementAndGet(); if (count == 0) { parent.mWrRes = MessageProtos1.MultiWriteResponse.newBuilder(); for (AsyncClient client : parent.clients) { if (client.subRequestStatus != SubRequestStatus.kOK) { RestServer.logger.debug("write client status = " + client.subRequestStatus); parent.channel.close(); return; } parent.mWrRes.addResponses(client.wrRes); } parent.msg = parent.mWrRes.build(); parent.code = Status.kHttpResponse; CpuWorkerPool.getInstance().submit(parent); } } } public void handleHttpResponse() { RestServer.logger.debug("http response"); HttpResponse response = new DefaultHttpResponse( HttpVersion.HTTP_1_1, HttpResponseStatus.OK); int size = msg.getSerializedSize(); response.setHeader("Content-Length", size); ByteArrayOutputStream os = new ByteArrayOutputStream(size); try { msg.writeTo(os); ChannelBuffer buffer = ChannelBuffers.copiedBuffer(os.toByteArray()); response.setContent(buffer); channel.write(response); // write over. StatStore.getInstance().addCounter("rpc.out.bytes", size); } catch (Exception e) { // just ignore it. } } }
UTF-8
Java
27,035
java
AsyncClient.java
Java
[ { "context": "eger;\n\n/**\n * Created with IntelliJ IDEA.\n * User: dirlt\n * Date: 12/8/12\n * Time: 2:03 AM\n * To change th", "end": 932, "score": 0.9996588230133057, "start": 927, "tag": "USERNAME", "value": "dirlt" } ]
null
[]
package com.dirlt.java.FastHBaseRest; import com.dirlt.java.FastHbaseRest.MessageProtos1; import com.google.protobuf.ByteString; import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.Message; import com.stumbleupon.async.Callback; import com.stumbleupon.async.Deferred; import org.hbase.async.GetRequest; import org.hbase.async.KeyValue; import org.hbase.async.PutRequest; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.handler.codec.http.DefaultHttpResponse; import org.jboss.netty.handler.codec.http.HttpResponse; import org.jboss.netty.handler.codec.http.HttpResponseStatus; import org.jboss.netty.handler.codec.http.HttpVersion; import java.io.ByteArrayOutputStream; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; /** * Created with IntelliJ IDEA. * User: dirlt * Date: 12/8/12 * Time: 2:03 AM * To change this template use File | Settings | File Templates. */ public class AsyncClient implements Runnable { public static final String kSep = String.format("%c", 0x0); public static final long kDefaultTimeout = 100 * 1000; // 100s.(that's long enough). public static final byte[] kEmptyBytes = new byte[0]; public Configuration configuration; public AsyncClient(Configuration configuration) { this.configuration = configuration; } // state of each step. enum Status { kStat, kMultiRead, kMultiWrite, kHttpRequest, kReadRequest, kWriteRequest, kReadLocalCache, kReadHBaseService, kWriteHBaseService, kReadResponse, kWriteResponse, kHttpResponse, } // sub request status enum SubRequestStatus { kOK, kException, kTimeout, } public boolean subRequest = false; // whether is sub request. public Status code = Status.kStat; // default value. public SubRequestStatus subRequestStatus = SubRequestStatus.kOK; public Channel channel; // for multi interface. public AsyncClient parent; public AtomicInteger refCounter; public List<AsyncClient> clients; public ChannelBuffer buffer; public String path; public byte[] bs; public MessageProtos1.ReadRequest.Builder rdReqBuilder; public MessageProtos1.ReadRequest rdReq; public MessageProtos1.WriteRequest.Builder wrReqBuilder; public MessageProtos1.WriteRequest wrReq; public MessageProtos1.MultiReadRequest.Builder mRdReqBuilder; public MessageProtos1.MultiReadRequest multiReadRequest; public MessageProtos1.MultiWriteRequest.Builder mWrReqBuilder; public MessageProtos1.MultiWriteRequest multiWriteRequest; public MessageProtos1.ReadResponse.Builder rdRes; public MessageProtos1.WriteResponse.Builder wrRes; public MessageProtos1.MultiReadResponse.Builder mRdRes; public MessageProtos1.MultiWriteResponse.Builder mWrRes; public Message msg; public long requestTimestamp; public long requestTimeout; public long sessionStartTimestamp; public long sessionEndTimestamp; public long readStartTimestamp; public long readEndTimestamp; public long readHBaseServiceStartTimestamp; public long readHBaseServiceEndTimestamp; public long writeHBaseServiceStartTimestamp; public long writeHBaseServiceEndTimestamp; public String tableName; public String rowKey; public String columnFamily; public String prefix; // cache key prefix. public static String makeCacheKeyPrefix(String tableName, String rowKey, String cf) { return tableName + kSep + rowKey + kSep + cf; } public static String makeCacheKey(String prefix, String column) { return prefix + kSep + column; } private List<String> readCacheQualifiers; // qualifiers that to be queried from cache. private List<String> readHBaseQualifiers; // qualifiers that to be queried from hbase. // if == null, then read column family. public void init() { rdReq = null; wrReq = null; multiReadRequest = null; multiWriteRequest = null; subRequestStatus = SubRequestStatus.kOK; requestTimeout = kDefaultTimeout; } @Override public void run() { switch (code) { case kHttpRequest: handleHttpRequest(); break; case kMultiRead: multiRead(); break; case kMultiWrite: multiWrite(); break; case kReadRequest: readRequest(); break; case kWriteRequest: writeRequest(); break; case kReadLocalCache: readLocalCache(); break; case kReadHBaseService: readHBaseService(); break; case kWriteHBaseService: writeHBaseService(); break; case kReadResponse: readResponse(); break; case kWriteResponse: writeResponse(); break; case kHttpResponse: handleHttpResponse(); break; default: break; } } public void handleHttpRequest() { RestServer.logger.debug("http request"); int size = buffer.readableBytes(); StatStore.getInstance().addCounter("rpc.in.bytes", size); bs = new byte[size]; buffer.readBytes(bs); if (path.equals("/read")) { code = Status.kReadRequest; } else if (path.equals("/multi-read")) { code = Status.kMultiRead; } else if (path.equals("/write")) { code = Status.kWriteRequest; } else if (path.equals("/multi-write")) { code = Status.kMultiWrite; } else { // impossible. } // entry. if we want async mode, we put into cpu thread // otherwise we just run. if (configuration.isAsync()) { CpuWorkerPool.getInstance().submit(this); } else { run(); } } public void readRequest() { RestServer.logger.debug("read request"); if (!subRequest) { // parse request. rdReqBuilder = MessageProtos1.ReadRequest.newBuilder(); try { rdReqBuilder.mergeFrom(bs); } catch (InvalidProtocolBufferException e) { // just close channel. RestServer.logger.debug("parse message exception"); StatStore.getInstance().addCounter("rpc.in.count.invalid", 1); channel.close(); } rdReq = rdReqBuilder.build(); StatStore.getInstance().addCounter("rpc.read.count", 1); if (rdReq.hasTimeout()) { requestTimeout = rdReq.getTimeout(); } } // proxy. try { rdReq = RequestProxy.getInstance().handleReadRequest(rdReq); } catch (Exception e) { // just close channle. RestServer.logger.debug("request proxy exception"); StatStore.getInstance().addCounter("request.proxy.exception", 1); channel.close(); } readStartTimestamp = System.currentTimeMillis(); tableName = rdReq.getTableName(); rowKey = rdReq.getRowKey(); columnFamily = rdReq.getColumnFamily(); rdRes = MessageProtos1.ReadResponse.newBuilder(); prefix = makeCacheKeyPrefix(tableName, rowKey, columnFamily); if (rdReq.getQualifiersCount() == 0) { // read column family // then we can't do cache. code = Status.kReadHBaseService; } else { // raise local cache request. code = Status.kReadLocalCache; } run(); } public void multiRead() { RestServer.logger.debug("multi read request"); mRdReqBuilder = MessageProtos1.MultiReadRequest.newBuilder(); try { mRdReqBuilder.mergeFrom(bs); } catch (InvalidProtocolBufferException e) { // just close channel. RestServer.logger.debug("parse message exception"); StatStore.getInstance().addCounter("rpc.in.count.invalid", 1); channel.close(); } multiReadRequest = mRdReqBuilder.build(); if (multiReadRequest.getRequestsCount() == 0) { RestServer.logger.debug("multi read no sub request"); StatStore.getInstance().addCounter("rpc.multi-read.error.count", 1); channel.close(); return; } StatStore.getInstance().addCounter("rpc.multi-read.count", 1); if (refCounter == null) { refCounter = new AtomicInteger(multiReadRequest.getRequestsCount()); } else { refCounter.set(multiReadRequest.getRequestsCount()); } if (clients == null) { clients = new LinkedList<AsyncClient>(); } else { clients.clear(); } if (multiReadRequest.hasTimeout()) { requestTimeout = multiReadRequest.getTimeout(); } for (MessageProtos1.ReadRequest request : multiReadRequest.getRequestsList()) { AsyncClient client = new AsyncClient(configuration); client.init(); client.code = Status.kReadRequest; client.subRequest = true; client.rdReq = request; client.parent = this; // sub request inherits from parent request. client.requestTimeout = requestTimeout; client.requestTimestamp = requestTimestamp; clients.add(client); CpuWorkerPool.getInstance().submit(client); } } public void writeRequest() { RestServer.logger.debug("write request"); if (!subRequest) { wrReqBuilder = MessageProtos1.WriteRequest.newBuilder(); // parse request. try { wrReqBuilder.mergeFrom(bs); } catch (InvalidProtocolBufferException e) { // just close channel. RestServer.logger.debug("parse message exception"); StatStore.getInstance().addCounter("rpc.in.count.invalid", 1); channel.close(); } wrReq = wrReqBuilder.build(); StatStore.getInstance().addCounter("rpc.write.count", 1); if (wrReq.hasTimeout()) { requestTimeout = wrReq.getTimeout(); } } // proxy. try { wrReq = RequestProxy.getInstance().handleWriteRequest(wrReq); } catch (Exception e) { // just close channel. RestServer.logger.debug("request proxy exception"); StatStore.getInstance().addCounter("request.proxy.exception", 1); channel.close(); } tableName = wrReq.getTableName(); rowKey = wrReq.getRowKey(); columnFamily = wrReq.getColumnFamily(); // prepare the result. wrRes = MessageProtos1.WriteResponse.newBuilder(); code = Status.kWriteHBaseService; run(); } public void multiWrite() { RestServer.logger.debug("multi write request"); mWrReqBuilder = MessageProtos1.MultiWriteRequest.newBuilder(); try { mWrReqBuilder.mergeFrom(bs); } catch (InvalidProtocolBufferException e) { // just close channel. RestServer.logger.debug("parse message exception"); StatStore.getInstance().addCounter("rpc.in.count.invalid", 1); channel.close(); } multiWriteRequest = mWrReqBuilder.build(); if (multiWriteRequest.getRequestsCount() == 0) { RestServer.logger.debug("multi write no sub request"); StatStore.getInstance().addCounter("rpc.multi-write.error.count", 1); channel.close(); return; } StatStore.getInstance().addCounter("rpc.multi-write.count", 1); if (refCounter == null) { refCounter = new AtomicInteger(multiWriteRequest.getRequestsCount()); } else { refCounter.set(multiWriteRequest.getRequestsCount()); } if (clients == null) { clients = new LinkedList<AsyncClient>(); } else { clients.clear(); } if (multiWriteRequest.hasTimeout()) { requestTimeout = multiWriteRequest.getTimeout(); } for (MessageProtos1.WriteRequest request : multiWriteRequest.getRequestsList()) { AsyncClient client = new AsyncClient(configuration); client.init(); client.code = Status.kWriteRequest; client.subRequest = true; client.wrReq = request; client.parent = this; // sub request inherits from parent request. client.requestTimeout = requestTimeout; client.requestTimestamp = requestTimestamp; clients.add(client); CpuWorkerPool.getInstance().submit(client); } } public void readLocalCache() { RestServer.logger.debug("read local cache"); if (readCacheQualifiers == null) { readCacheQualifiers = new ArrayList<String>(); } else { readCacheQualifiers.clear(); } // check local cache mean while fill the cache request. int readCount = 0; int cacheCount = 0; for (String q : rdReq.getQualifiersList()) { String cacheKey = null; byte[] b = null; if (configuration.isCache()) { cacheKey = makeCacheKey(prefix, q); RestServer.logger.debug("search cache with key = " + cacheKey); b = LocalCache.getInstance().get(cacheKey); } readCount += 1; if (b != null) { RestServer.logger.debug("cache hit!"); cacheCount += 1; MessageProtos1.ReadResponse.KeyValue.Builder bd = MessageProtos1.ReadResponse.KeyValue.newBuilder(); bd.setQualifier(q); bd.setContent(ByteString.copyFrom(b)); rdRes.addKvs(bd); } else { RestServer.logger.debug("read hbase qualifier: " + q); readCacheQualifiers.add(q); } } StatStore.getInstance().addCounter("read.count", readCount); StatStore.getInstance().addCounter("read.count.local-cache", cacheCount); if (!readCacheQualifiers.isEmpty()) { code = Status.kReadHBaseService; // read cache service. readHBaseQualifiers = readCacheQualifiers; } else { code = Status.kReadResponse; // return directly. } run(); } public void readHBaseService() { RestServer.logger.debug("read hbase service"); final AsyncClient client = this; client.code = Status.kReadResponse; // already timeout, don't request hbase. if ((System.currentTimeMillis() - requestTimestamp) > requestTimeout) { RestServer.logger.debug("detect timeout before read request hbase"); StatStore.getInstance().addCounter("read.count.timeout.before-request-hbase", 1); client.subRequestStatus = SubRequestStatus.kTimeout; // run in the same thread. client.run(); return; } RestServer.logger.debug("tableName = " + tableName + ", rowKey = " + rowKey + ", columnFamily = " + columnFamily); GetRequest getRequest = new GetRequest(tableName, rowKey); getRequest.family(columnFamily); if (rdReq.getQualifiersCount() != 0) { // otherwise we read all qualifiers from column family. // a little bit tedious. byte[][] qualifiers = new byte[readHBaseQualifiers.size()][]; int idx = 0; for (String q : readHBaseQualifiers) { qualifiers[idx] = q.getBytes(); idx += 1; } getRequest.qualifiers(qualifiers); StatStore.getInstance().addCounter("read.count.hbase.column", qualifiers.length); } else { StatStore.getInstance().addCounter("read.count.hbase.column-family", 1); } client.readHBaseServiceStartTimestamp = System.currentTimeMillis(); Deferred<ArrayList<KeyValue>> deferred = HBaseService.getInstance().get(getRequest); // if failed, we don't return. deferred.addCallback(new Callback<Object, ArrayList<KeyValue>>() { @Override public Object call(ArrayList<KeyValue> keyValues) throws Exception { // we don't return because we put into CpuWorkerPool. client.readHBaseServiceEndTimestamp = System.currentTimeMillis(); if (client.rdReq.getQualifiersCount() != 0) { // reorder qualifier according request qualifier order. // then builder and the cache. Map<String, KeyValue> mapping = new HashMap<String, KeyValue>(); for (KeyValue kv : keyValues) { mapping.put(new String(kv.qualifier()), kv); } int missingCount = 0; for (String k : rdReq.getQualifiersList()) { KeyValue kv = mapping.get(k); MessageProtos1.ReadResponse.KeyValue.Builder sub = MessageProtos1.ReadResponse.KeyValue.newBuilder(); sub.setQualifier(k); byte[] v = kEmptyBytes; if (kv == null) { sub.setContent(ByteString.EMPTY); missingCount++; } else { v = kv.value(); sub.setContent(ByteString.copyFrom(kv.value())); } rdRes.addKvs(sub.build()); // fill cache. if (client.configuration.isCache()) { String cacheKey = makeCacheKey(prefix, k); RestServer.logger.debug("fill cache with key = " + cacheKey); LocalCache.getInstance().set(cacheKey, v); } } StatStore.getInstance().addCounter("read.count.field-not-exist", missingCount); StatStore.getInstance().addCounter("read.duration.hbase.column", client.readHBaseServiceEndTimestamp - client.readHBaseServiceStartTimestamp); } else { // just fill the builder. don't save them to cache. for (KeyValue kv : keyValues) { String k = new String(kv.qualifier()); byte[] value = kv.value(); MessageProtos1.ReadResponse.KeyValue.Builder bd = MessageProtos1.ReadResponse.KeyValue.newBuilder(); bd.setQualifier(k); bd.setContent(ByteString.copyFrom(value)); client.rdRes.addKvs(bd); } StatStore.getInstance().addCounter("read.duration.hbase.column-family", client.readHBaseServiceEndTimestamp - client.readHBaseServiceStartTimestamp); } // already timeout if ((System.currentTimeMillis() - client.requestTimestamp) > client.requestTimeout) { RestServer.logger.debug("detect timeout after read request hbase"); StatStore.getInstance().addCounter("read.count.timeout.after-request-hbase", 1); client.subRequestStatus = SubRequestStatus.kTimeout; } // put back to CPU worker pool. CpuWorkerPool.getInstance().submit(client); return null; } }); deferred.addErrback(new Callback<Object, Exception>() { @Override public Object call(Exception o) throws Exception { o.printStackTrace(); StatStore.getInstance().addCounter("read.count.error", 1); client.subRequestStatus = SubRequestStatus.kException; CpuWorkerPool.getInstance().submit(client); return null; } }); } public void writeHBaseService() { RestServer.logger.debug("write hbase service"); final AsyncClient client = this; client.code = Status.kWriteResponse; // already timeout, don't request hbase. if ((System.currentTimeMillis() - requestTimestamp) > requestTimeout) { RestServer.logger.debug("detect timeout before write request hbase"); StatStore.getInstance().addCounter("write.count.timeout.before-request-hbase", 1); client.subRequestStatus = SubRequestStatus.kTimeout; // run in the same thread. client.run(); return; } RestServer.logger.debug("tableName = " + tableName + ", rowKey = " + rowKey + ", columnFamily = " + columnFamily); byte[][] qualifiers = new byte[wrReq.getKvsCount()][]; byte[][] values = new byte[wrReq.getKvsCount()][]; for (int i = 0; i < wrReq.getKvsCount(); i++) { qualifiers[i] = wrReq.getKvs(i).getQualifier().getBytes(); values[i] = wrReq.getKvs(i).getContent().toByteArray(); } StatStore.getInstance().addCounter("write.count", wrReq.getKvsCount()); PutRequest putRequest = new PutRequest(tableName.getBytes(), rowKey.getBytes(), columnFamily.getBytes(), qualifiers, values); client.writeHBaseServiceStartTimestamp = System.currentTimeMillis(); Deferred<Object> deferred = HBaseService.getInstance().put(putRequest); // if failed, we don't return. deferred.addCallback(new Callback<Object, Object>() { @Override public Object call(Object obj) throws Exception { // already timeout if ((System.currentTimeMillis() - client.requestTimestamp) > client.requestTimeout) { RestServer.logger.debug("detect timeout after write request hbase"); StatStore.getInstance().addCounter("write.count.timeout.after-request-hbase", 1); client.subRequestStatus = SubRequestStatus.kTimeout; } // we don't return because we put into CpuWorkerPool. CpuWorkerPool.getInstance().submit(client); return null; } }); deferred.addErrback(new Callback<Object, Exception>() { @Override public Object call(Exception o) throws Exception { // we don't care. o.printStackTrace(); StatStore.getInstance().addCounter("write.count.error", 1); client.subRequestStatus = SubRequestStatus.kException; CpuWorkerPool.getInstance().submit(client); return null; } }); } public void readResponse() { if (subRequestStatus == SubRequestStatus.kOK) { readEndTimestamp = System.currentTimeMillis(); StatStore.getInstance().addCounter("read.duration", readEndTimestamp - readStartTimestamp); } if (!subRequest) { if (subRequestStatus != SubRequestStatus.kOK) { channel.close(); return; } msg = rdRes.build(); code = Status.kHttpResponse; run(); } else { int count = parent.refCounter.decrementAndGet(); if (count == 0) { parent.mRdRes = MessageProtos1.MultiReadResponse.newBuilder(); for (AsyncClient client : parent.clients) { // if any one fails, then it fails. if (client.subRequestStatus != SubRequestStatus.kOK) { RestServer.logger.debug("read client status = " + client.subRequestStatus); parent.channel.close(); return; } parent.mRdRes.addResponses(client.rdRes); } parent.msg = parent.mRdRes.build(); parent.code = Status.kHttpResponse; CpuWorkerPool.getInstance().submit(parent); } } } public void writeResponse() { if (subRequestStatus == SubRequestStatus.kOK) { writeHBaseServiceEndTimestamp = System.currentTimeMillis(); StatStore.getInstance().addCounter("write.duration", writeHBaseServiceEndTimestamp - writeHBaseServiceStartTimestamp); } if (!subRequest) { if (subRequestStatus != SubRequestStatus.kOK) { channel.close(); return; } msg = wrRes.build(); code = Status.kHttpResponse; run(); } else { int count = parent.refCounter.decrementAndGet(); if (count == 0) { parent.mWrRes = MessageProtos1.MultiWriteResponse.newBuilder(); for (AsyncClient client : parent.clients) { if (client.subRequestStatus != SubRequestStatus.kOK) { RestServer.logger.debug("write client status = " + client.subRequestStatus); parent.channel.close(); return; } parent.mWrRes.addResponses(client.wrRes); } parent.msg = parent.mWrRes.build(); parent.code = Status.kHttpResponse; CpuWorkerPool.getInstance().submit(parent); } } } public void handleHttpResponse() { RestServer.logger.debug("http response"); HttpResponse response = new DefaultHttpResponse( HttpVersion.HTTP_1_1, HttpResponseStatus.OK); int size = msg.getSerializedSize(); response.setHeader("Content-Length", size); ByteArrayOutputStream os = new ByteArrayOutputStream(size); try { msg.writeTo(os); ChannelBuffer buffer = ChannelBuffers.copiedBuffer(os.toByteArray()); response.setContent(buffer); channel.write(response); // write over. StatStore.getInstance().addCounter("rpc.out.bytes", size); } catch (Exception e) { // just ignore it. } } }
27,035
0.577104
0.573923
684
38.524853
25.930479
133
false
false
0
0
0
0
0
0
0.638889
false
false
4
a8eec264d88f8e6a4fef19b8c42f3af5b051a666
22,926,535,466,638
908e86150ce24b4bea21192bbc4823240f898db0
/myhome/myhome-thymeleaf/src/main/java/org/tondo/myhome/thyme/MyHomeThymeleafApplication.java
018a84266ed73aa65e6ad80c2f062a828c149011
[]
no_license
TondoDev/myhome
https://github.com/TondoDev/myhome
26e17188bd8ccfb94c06d07c8e6510d05faf5d8f
cee29ce23b12e8e7128cb5299b6f6a56fa84d0b0
refs/heads/master
2021-01-17T16:40:01.338000
2020-11-14T12:13:15
2020-11-14T13:20:26
68,959,098
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.tondo.myhome.thyme; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.format.FormatterRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.tondo.myhome.thyme.converter.DoubleConverter; import org.tondo.myhome.thyme.converter.LocalDateConverter; @SpringBootApplication(scanBasePackages="org.tondo.myhome") public class MyHomeThymeleafApplication extends WebMvcConfigurerAdapter { @Override public void addFormatters(FormatterRegistry registry) { super.addFormatters(registry); registry.addConverter(new LocalDateConverter("d.M.yyyy")); registry.addConverter(new DoubleConverter()); } public static void main(String[] args) { SpringApplication.run(MyHomeThymeleafApplication.class, args); } }
UTF-8
Java
871
java
MyHomeThymeleafApplication.java
Java
[]
null
[]
package org.tondo.myhome.thyme; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.format.FormatterRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.tondo.myhome.thyme.converter.DoubleConverter; import org.tondo.myhome.thyme.converter.LocalDateConverter; @SpringBootApplication(scanBasePackages="org.tondo.myhome") public class MyHomeThymeleafApplication extends WebMvcConfigurerAdapter { @Override public void addFormatters(FormatterRegistry registry) { super.addFormatters(registry); registry.addConverter(new LocalDateConverter("d.M.yyyy")); registry.addConverter(new DoubleConverter()); } public static void main(String[] args) { SpringApplication.run(MyHomeThymeleafApplication.class, args); } }
871
0.831228
0.831228
24
35.291668
27.947092
81
false
false
0
0
0
0
0
0
1.166667
false
false
4
42d6cb9fa33794a8a508bce24ccfe8bbf0b3fa41
15,298,673,547,400
d36f8845d7c494c9d264ea4e2c357bc3a59b2d30
/searchAdmin-biz-common/src/main/java/com/xiu/searchadmin/biz/common/utils/Constants.java
137854f4bbc49267b79aa9bab7f84f616be4c24d
[]
no_license
lylrian/searchAdmin2.0
https://github.com/lylrian/searchAdmin2.0
b5788d3087d7a9fb2bb80bab388a34f79ce346e2
9627cb8109aa570f4eca5cbabe396520aca571ac
refs/heads/master
2019-06-24T16:18:21.834000
2016-08-19T01:17:27
2016-08-19T01:17:27
66,042,044
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.xiu.searchadmin.biz.common.utils; /** * * com.xiu.searchadmin.biz.common.utils.Constants.java * @Description: TODO 常量类 【目前只有运营分类改造使用】 * @author lvshuding * @date 2013-4-23 上午10:20:38 * @version V1.0 */ public class Constants { private Constants(){} // 索引表中存储字符串的分隔符 public static final String SPLIT_STR_TWO = "|"; public static final String SPLIT_STR_THIRD = ":"; // xiu 索引mktType字段值,0:官网,1:ebay public static final int XIUINDEX_MKTTYPE_XIU = 0; public static final int XIUINDEX_MKTTYPE_EBAY = 1; // ebay标识 public static final String PROVIDER_CODE_EBAY = "1528"; /** * 是否启用运营分类改造 */ public static final String CATALOG_ENABLED="search.catalog.remold.enable"; /** memcached key 商品最终价格 */ public static final String MEMCACHE_PRE_GOODS_FINALPRICE = "search"; /** memcached key前缀 品牌下推荐商品 */ public static final String MEMCACHE_PRE_BRAND_REC_GOODS = "BRAND_REC_GOODS_"; /** memcached key前缀 品牌下推荐分类 */ public static final String MEMCACHE_PRE_BRAND_REC_CAT = "BRAND_REC_CAT_"; /** memcached key前缀 运营分类下推荐商品 */ public static final String MEMCACHE_PRE_CAT_REC_GOODS = "CAT_REC_GOODS_"; /** memcached key前缀 运营分类下推荐品牌 */ public static final String MEMCACHE_PRE_CAT_REC_BRAND = "CAT_REC_BRAND_"; /** * 缓存操作相关的日志头 */ public static final String MCACHE_LOG_HEADER="【缓存操作】"; /** * 推荐操作对应RMI的日志头 */ public static String RMI_LOG_HEAD = "【推荐RMI】"; /** * xiu Seo系统中品类的级别 */ public static final int SEO_CAT_LAVEL_1=1; public static final int SEO_CAT_LAVEL_2=2; public static final int SEO_CAT_LAVEL_3=3; /** * SEO品类缓存更新接口 */ public static final String SEO_CATALOG_CACHE_URL="http://szt.xiu.com:7080/catalog/refresh"; public static final String SEO_CATALOG_CACHE_PARAM="un=seo_admin&pw=seo_admin_password"; public static final String SEO_CATALOG_CACHE_SUCCESS="TRUE"; }
UTF-8
Java
2,186
java
Constants.java
Java
[ { "context": " @Description: TODO 常量类 【目前只有运营分类改造使用】\n\n * @author lvshuding \n\n * @date 2013-4-23 上午10:20:38\n\n * @version V1", "end": 174, "score": 0.9996781349182129, "start": 165, "tag": "USERNAME", "value": "lvshuding" } ]
null
[]
package com.xiu.searchadmin.biz.common.utils; /** * * com.xiu.searchadmin.biz.common.utils.Constants.java * @Description: TODO 常量类 【目前只有运营分类改造使用】 * @author lvshuding * @date 2013-4-23 上午10:20:38 * @version V1.0 */ public class Constants { private Constants(){} // 索引表中存储字符串的分隔符 public static final String SPLIT_STR_TWO = "|"; public static final String SPLIT_STR_THIRD = ":"; // xiu 索引mktType字段值,0:官网,1:ebay public static final int XIUINDEX_MKTTYPE_XIU = 0; public static final int XIUINDEX_MKTTYPE_EBAY = 1; // ebay标识 public static final String PROVIDER_CODE_EBAY = "1528"; /** * 是否启用运营分类改造 */ public static final String CATALOG_ENABLED="search.catalog.remold.enable"; /** memcached key 商品最终价格 */ public static final String MEMCACHE_PRE_GOODS_FINALPRICE = "search"; /** memcached key前缀 品牌下推荐商品 */ public static final String MEMCACHE_PRE_BRAND_REC_GOODS = "BRAND_REC_GOODS_"; /** memcached key前缀 品牌下推荐分类 */ public static final String MEMCACHE_PRE_BRAND_REC_CAT = "BRAND_REC_CAT_"; /** memcached key前缀 运营分类下推荐商品 */ public static final String MEMCACHE_PRE_CAT_REC_GOODS = "CAT_REC_GOODS_"; /** memcached key前缀 运营分类下推荐品牌 */ public static final String MEMCACHE_PRE_CAT_REC_BRAND = "CAT_REC_BRAND_"; /** * 缓存操作相关的日志头 */ public static final String MCACHE_LOG_HEADER="【缓存操作】"; /** * 推荐操作对应RMI的日志头 */ public static String RMI_LOG_HEAD = "【推荐RMI】"; /** * xiu Seo系统中品类的级别 */ public static final int SEO_CAT_LAVEL_1=1; public static final int SEO_CAT_LAVEL_2=2; public static final int SEO_CAT_LAVEL_3=3; /** * SEO品类缓存更新接口 */ public static final String SEO_CATALOG_CACHE_URL="http://szt.xiu.com:7080/catalog/refresh"; public static final String SEO_CATALOG_CACHE_PARAM="un=seo_admin&pw=seo_admin_password"; public static final String SEO_CATALOG_CACHE_SUCCESS="TRUE"; }
2,186
0.687632
0.67019
79
22.949368
26.081614
92
false
false
0
0
0
0
0
0
0.949367
false
false
4
224226d849dae280a674ac5910e4245cf8773c7f
28,183,575,434,751
304b00f9ac1fca6603e734c43f7d5b9aa07b4529
/app/src/main/java/com/example/kleptomaniac/vitccuniversaldatabase/ProfileRequestsTab.java
2bf456ab8b3e2e19962cdded202eb7a7352d778f
[]
no_license
judeosbert/VitccUniversalDatabase
https://github.com/judeosbert/VitccUniversalDatabase
ca09b79fa4c1adc60c2e5572c348b18f851289ca
c5952008db6e252087bf23428260104725ef2e36
refs/heads/master
2021-03-19T11:51:39.864000
2018-01-06T12:15:04
2018-01-06T12:15:04
94,998,975
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.kleptomaniac.vitccuniversaldatabase; import android.os.Bundle; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import java.util.List; import jp.wasabeef.recyclerview.animators.SlideInUpAnimator; /** * Created by kleptomaniac on 25/6/17. */ public class ProfileRequestsTab extends Fragment { private List<ContentRequest> requestList = new ArrayList<>(); public RecyclerView recyclerView; public ProfileRequestsAdapter profileRequestsAdapter; public View view; @Override public View onCreateView(LayoutInflater layoutInflater, ViewGroup container,Bundle savedInstance) { View view = layoutInflater.inflate(R.layout.profile_requests_tab,container,false); this.view = view; start(view); return view; } private void start(View view) { recyclerView = (RecyclerView) view.findViewById(R.id.userRequestsRecyclerView); profileRequestsAdapter = new ProfileRequestsAdapter(requestList); RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(view.getContext()); recyclerView.setLayoutManager(layoutManager); recyclerView.setItemAnimator(new SlideInUpAnimator()); recyclerView.setAdapter(profileRequestsAdapter); recyclerView.addItemDecoration(new DividerItemDecoration(view.getContext(),LinearLayoutManager.VERTICAL)); populateData(); } private void populateData() { FirebaseAuth auth = FirebaseAuth.getInstance(); FirebaseUser user = auth.getCurrentUser(); final FirebaseDatabase database = FirebaseDatabase.getInstance(); String userKey = user.getEmail().replace(".",","); DatabaseReference ref = database.getReference("users"); ref.child(userKey).child("listening").addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if(dataSnapshot.getChildrenCount() == 0) { Snackbar.make(view,"Your have not made any request",Snackbar.LENGTH_LONG).show(); return; } for(DataSnapshot d:dataSnapshot.getChildren()) { String contentKey = d.getKey(); String contentType = classify(contentKey); if(contentType == null) { return; } DatabaseReference dbReference = database.getReference("requests"); dbReference.child(contentType).child(contentKey).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { String lang=null,key=null,minQuality=null,itemName=null,requestTime=null,type=null,requestingUser=null,requestingUserEmail=null,requestingUserPic=null,year = null; List<String> peers = new ArrayList<String>(); for(DataSnapshot snap:dataSnapshot.getChildren()) { Log.e("VITCC","Nested rewquest puller"+snap); // ContentRequest request = snap.getValue(ContentRequest.class); // requestList.add(request); switch (snap.getKey()) { case "fileLanguage": lang = (String) snap.getValue(); break; case "key": key = (String) snap.getValue(); break; case "minQuality": minQuality = (String) snap.getValue(); break; case "movieName": itemName = (String) snap.getValue(); break; case "requestTime": requestTime = (String) snap.getValue(); break; case "requestType": type = (String) snap.getValue(); break; case "requestingUser": requestingUser = (String) snap.getValue(); break; case "requestingUserEmail": requestingUserEmail = (String) snap.getValue(); break; case "requestingUserPic": requestingUserPic = (String) snap.getValue(); break; case "year": year = (String) snap.getValue(); break; case "peers": peers = (List<String>) snap.getValue(); Log.e("VITCC","Peer Size"+peers.size()); break; } } ContentRequest request = new ContentRequest(key,type,requestingUserEmail,requestingUser,requestingUserPic,itemName,year,minQuality,lang); request.addPeers(peers); requestList.add(0,request); Log.e("VITCC","Data preparation List size"+requestList.size()); Log.e("VITCC","Notifier from profile"); profileRequestsAdapter.notifyItemInserted(0); // profileRequestsAdapter.notifyDataSetChanged(); } @Override public void onCancelled(DatabaseError databaseError) { } }); } } @Override public void onCancelled(DatabaseError databaseError) { } }); } private String classify(String contentKey) { String[] categories = new String[]{"music","movie","series","game","document","other"}; for(String cat:categories) { if(contentKey.contains(cat)) return cat; } return null; } }
UTF-8
Java
7,559
java
ProfileRequestsTab.java
Java
[ { "context": "package com.example.kleptomaniac.vitccuniversaldatabase;\n\nimport android.os.Bundle", "end": 32, "score": 0.9956091046333313, "start": 20, "tag": "USERNAME", "value": "kleptomaniac" }, { "context": "ew.animators.SlideInUpAnimator;\n\n/**\n * Created by kleptomaniac on 25/6/17.\n */\n\npublic class ProfileRequestsTab ", "end": 950, "score": 0.9994826912879944, "start": 938, "tag": "USERNAME", "value": "kleptomaniac" } ]
null
[]
package com.example.kleptomaniac.vitccuniversaldatabase; import android.os.Bundle; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import java.util.List; import jp.wasabeef.recyclerview.animators.SlideInUpAnimator; /** * Created by kleptomaniac on 25/6/17. */ public class ProfileRequestsTab extends Fragment { private List<ContentRequest> requestList = new ArrayList<>(); public RecyclerView recyclerView; public ProfileRequestsAdapter profileRequestsAdapter; public View view; @Override public View onCreateView(LayoutInflater layoutInflater, ViewGroup container,Bundle savedInstance) { View view = layoutInflater.inflate(R.layout.profile_requests_tab,container,false); this.view = view; start(view); return view; } private void start(View view) { recyclerView = (RecyclerView) view.findViewById(R.id.userRequestsRecyclerView); profileRequestsAdapter = new ProfileRequestsAdapter(requestList); RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(view.getContext()); recyclerView.setLayoutManager(layoutManager); recyclerView.setItemAnimator(new SlideInUpAnimator()); recyclerView.setAdapter(profileRequestsAdapter); recyclerView.addItemDecoration(new DividerItemDecoration(view.getContext(),LinearLayoutManager.VERTICAL)); populateData(); } private void populateData() { FirebaseAuth auth = FirebaseAuth.getInstance(); FirebaseUser user = auth.getCurrentUser(); final FirebaseDatabase database = FirebaseDatabase.getInstance(); String userKey = user.getEmail().replace(".",","); DatabaseReference ref = database.getReference("users"); ref.child(userKey).child("listening").addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if(dataSnapshot.getChildrenCount() == 0) { Snackbar.make(view,"Your have not made any request",Snackbar.LENGTH_LONG).show(); return; } for(DataSnapshot d:dataSnapshot.getChildren()) { String contentKey = d.getKey(); String contentType = classify(contentKey); if(contentType == null) { return; } DatabaseReference dbReference = database.getReference("requests"); dbReference.child(contentType).child(contentKey).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { String lang=null,key=null,minQuality=null,itemName=null,requestTime=null,type=null,requestingUser=null,requestingUserEmail=null,requestingUserPic=null,year = null; List<String> peers = new ArrayList<String>(); for(DataSnapshot snap:dataSnapshot.getChildren()) { Log.e("VITCC","Nested rewquest puller"+snap); // ContentRequest request = snap.getValue(ContentRequest.class); // requestList.add(request); switch (snap.getKey()) { case "fileLanguage": lang = (String) snap.getValue(); break; case "key": key = (String) snap.getValue(); break; case "minQuality": minQuality = (String) snap.getValue(); break; case "movieName": itemName = (String) snap.getValue(); break; case "requestTime": requestTime = (String) snap.getValue(); break; case "requestType": type = (String) snap.getValue(); break; case "requestingUser": requestingUser = (String) snap.getValue(); break; case "requestingUserEmail": requestingUserEmail = (String) snap.getValue(); break; case "requestingUserPic": requestingUserPic = (String) snap.getValue(); break; case "year": year = (String) snap.getValue(); break; case "peers": peers = (List<String>) snap.getValue(); Log.e("VITCC","Peer Size"+peers.size()); break; } } ContentRequest request = new ContentRequest(key,type,requestingUserEmail,requestingUser,requestingUserPic,itemName,year,minQuality,lang); request.addPeers(peers); requestList.add(0,request); Log.e("VITCC","Data preparation List size"+requestList.size()); Log.e("VITCC","Notifier from profile"); profileRequestsAdapter.notifyItemInserted(0); // profileRequestsAdapter.notifyDataSetChanged(); } @Override public void onCancelled(DatabaseError databaseError) { } }); } } @Override public void onCancelled(DatabaseError databaseError) { } }); } private String classify(String contentKey) { String[] categories = new String[]{"music","movie","series","game","document","other"}; for(String cat:categories) { if(contentKey.contains(cat)) return cat; } return null; } }
7,559
0.516735
0.515148
182
40.532967
33.359787
191
false
false
0
0
0
0
0
0
0.681319
false
false
4
e294b2830e6be6e475556275d250429cf500814d
26,310,969,697,330
665e1ada2ecf38714b9a450c52b83ed6a844bebc
/sourceCode/testMaven/src/main/java/com/ma/test/testString.java
7fa627657414309f19b35cad3dbeeb5d859da9ad
[ "Apache-2.0" ]
permissive
mayonghui2112/helloWorld
https://github.com/mayonghui2112/helloWorld
1242ddb0d779c14db7f048d371307f36c918c74a
7ca224cc62fc589c3c6d0e96343fa3de18dc63a7
refs/heads/master
2021-05-08T01:59:01.424000
2021-01-14T03:01:13
2021-01-14T03:01:13
107,942,967
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ma.test; public class testString { public static void main(String[] args) { test1(); test2(); test3(); test4(); test5(); test6(); test7(); } //true public static void test1() { String a = "a1"; String b = "a"+ 1; System.out.println(a==b); } //false public static void test2() { String a = "ab"; String bb = "b"; String b = "a"+ bb; //?????????????????? System.out.println(a==b); } //true public static void test3() { String a = "ab"; final String bb = "b"; String b = "a"+ bb; //bb??final???????????????????????b System.out.println(a==b); } //false public static void test4() { String a = "ab"; final String bb = getBB(); String b = "a"+ bb;//bb?????????????????????????final????????????????????????????????bb??? System.out.println(a==b); } private static String getBB() { return "b"; } //false true private static String a = "ab"; public static void test5() { String s1 = "a"; String s2 = "b"; String s = s1 + s2;//+???�? System.out.println(s == a); System.out.println(s.intern() == a);//intern????? } //false false true private static String a1 = new String("ab"); public static void test6() { String s1 = "a"; String s2 = "b"; String s = s1 + s2; System.out.println(s == a1); System.out.println(s.intern() == a1); System.out.println(s.intern() == a1.intern()); } public static void test7() { String s0= "kvill"; String s1=new String("kvill"); String s2=new String("kvill"); System.out.println( s0==s1 ); System.out.println( "**********" ); s1.intern(); s2=s2.intern(); //?????????"kvill"?????????s2 System.out.println( s0==s1); System.out.println( s0==s1.intern() ); System.out.println( s0==s2 ); } }
UTF-8
Java
1,752
java
testString.java
Java
[]
null
[]
package com.ma.test; public class testString { public static void main(String[] args) { test1(); test2(); test3(); test4(); test5(); test6(); test7(); } //true public static void test1() { String a = "a1"; String b = "a"+ 1; System.out.println(a==b); } //false public static void test2() { String a = "ab"; String bb = "b"; String b = "a"+ bb; //?????????????????? System.out.println(a==b); } //true public static void test3() { String a = "ab"; final String bb = "b"; String b = "a"+ bb; //bb??final???????????????????????b System.out.println(a==b); } //false public static void test4() { String a = "ab"; final String bb = getBB(); String b = "a"+ bb;//bb?????????????????????????final????????????????????????????????bb??? System.out.println(a==b); } private static String getBB() { return "b"; } //false true private static String a = "ab"; public static void test5() { String s1 = "a"; String s2 = "b"; String s = s1 + s2;//+???�? System.out.println(s == a); System.out.println(s.intern() == a);//intern????? } //false false true private static String a1 = new String("ab"); public static void test6() { String s1 = "a"; String s2 = "b"; String s = s1 + s2; System.out.println(s == a1); System.out.println(s.intern() == a1); System.out.println(s.intern() == a1.intern()); } public static void test7() { String s0= "kvill"; String s1=new String("kvill"); String s2=new String("kvill"); System.out.println( s0==s1 ); System.out.println( "**********" ); s1.intern(); s2=s2.intern(); //?????????"kvill"?????????s2 System.out.println( s0==s1); System.out.println( s0==s1.intern() ); System.out.println( s0==s2 ); } }
1,752
0.54
0.515429
79
21.151899
16.248146
92
false
false
0
0
0
0
0
0
2.075949
false
false
4
5a1a5a9cefe1a9c42b93cedcc3b6de12bbbc9008
21,852,793,645,925
692f0c7697765c0fab25d7fe9ae793c38869ec76
/src/cn/huang/serializable/TestObjSerializeAndDeserialize.java
eca2ba676cc545b1e17fbddb8147d06935d6d888
[]
no_license
ThinkHuang/testdemo
https://github.com/ThinkHuang/testdemo
5e226e2b4ce637b0002dc3f3db6085ef598d9ea5
7c5d3c7ca77124dbefdf9448a1bd42d1558e260f
refs/heads/master
2021-07-21T05:50:20.743000
2021-04-22T07:50:39
2021-04-22T07:50:39
83,626,996
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package serializable; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; public class TestObjSerializeAndDeserialize { /** * @param args * @throws IOException * @throws FileNotFoundException * @throws ClassNotFoundException */ public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException { // TODO Auto-generated method stub /* * 序列化的步骤是这样的: * 1、建立一个对象输出流(为什么是输出流呢?因为是将对象从内存中写到硬盘上),并指定要序列化的对象的具体位置,这里利用FileInputStream关联一个文件,f:\\Person.txt * 2、利用对象输出流的writeObject方法,将person对象写到文件中。 * 3、关闭流对象。 */ SerializePerson(); /* * 反序列化的步骤: * 1、建立一个对象输入流(从硬盘将对象读到内存中),并指定要从哪个文件中拿对象,这里也是用FileInputStream关联一个文件。 * 2、利用对象流的readObject方法得到对象,并返回该对象的实例。 * 3、使用该对象。 */ Person person = DeserializePerson(); System.out.println("name="+person.getName() + "age=" + person.getAge() + "sex=" + person.getSex()); } private static Person DeserializePerson() throws FileNotFoundException, IOException, ClassNotFoundException { // TODO Auto-generated method stub ObjectInputStream ois = new ObjectInputStream(new FileInputStream("f:\\Person.txt")); Person p = (Person) ois.readObject(); System.out.println("Person对象反序列化成功!"); return p; } private static void SerializePerson() throws FileNotFoundException, IOException { // TODO Auto-generated method stub Person p = new Person(); p.setAge(19); p.setName("张三"); p.setSex("男"); ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("f:\\Person.txt")); oos.writeObject(p); System.out.println("Person对象序列化成功!"); oos.close(); } }
UTF-8
Java
2,182
java
TestObjSerializeAndDeserialize.java
Java
[ { "context": "on p = new Person();\n\t\tp.setAge(19);\n\t\tp.setName(\"张三\");\n\t\tp.setSex(\"男\");\n\t\t\n\t\tObjectOutputStream oos =", "end": 1558, "score": 0.9994492530822754, "start": 1556, "tag": "NAME", "value": "张三" } ]
null
[]
package serializable; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; public class TestObjSerializeAndDeserialize { /** * @param args * @throws IOException * @throws FileNotFoundException * @throws ClassNotFoundException */ public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException { // TODO Auto-generated method stub /* * 序列化的步骤是这样的: * 1、建立一个对象输出流(为什么是输出流呢?因为是将对象从内存中写到硬盘上),并指定要序列化的对象的具体位置,这里利用FileInputStream关联一个文件,f:\\Person.txt * 2、利用对象输出流的writeObject方法,将person对象写到文件中。 * 3、关闭流对象。 */ SerializePerson(); /* * 反序列化的步骤: * 1、建立一个对象输入流(从硬盘将对象读到内存中),并指定要从哪个文件中拿对象,这里也是用FileInputStream关联一个文件。 * 2、利用对象流的readObject方法得到对象,并返回该对象的实例。 * 3、使用该对象。 */ Person person = DeserializePerson(); System.out.println("name="+person.getName() + "age=" + person.getAge() + "sex=" + person.getSex()); } private static Person DeserializePerson() throws FileNotFoundException, IOException, ClassNotFoundException { // TODO Auto-generated method stub ObjectInputStream ois = new ObjectInputStream(new FileInputStream("f:\\Person.txt")); Person p = (Person) ois.readObject(); System.out.println("Person对象反序列化成功!"); return p; } private static void SerializePerson() throws FileNotFoundException, IOException { // TODO Auto-generated method stub Person p = new Person(); p.setAge(19); p.setName("张三"); p.setSex("男"); ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("f:\\Person.txt")); oos.writeObject(p); System.out.println("Person对象序列化成功!"); oos.close(); } }
2,182
0.735763
0.731207
59
28.762712
29.470087
110
false
false
0
0
0
0
0
0
1.745763
false
false
4
169048e38f18791dc4dba2302c2733cbbd4ac21e
25,099,788,911,302
6e74bcf23696505033d9a02af53ebe898fef4e6f
/src/by/it/desykevich/jd03_02/Runner.java
a45918f803ca59932b6842b5f2277d2cf5b074f0
[]
no_license
li8rium/JD2018-03-22
https://github.com/li8rium/JD2018-03-22
9bbd4d5b54ed449cd08d5a075294696546c9da57
b3004672b3f5dec03806ced62ea6f727fe74bcfd
refs/heads/master
2021-09-24T11:03:46.277000
2018-10-08T23:50:33
2018-10-08T23:50:33
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package by.it.desykevich.jd03_02; import by.it.desykevich.jd03_02.beans.Ad; import by.it.desykevich.jd03_02.beans.Role; import by.it.desykevich.jd03_02.beans.User; import java.sql.SQLException; public class Runner { public static void main(String[] args) throws SQLException { //проверим CRUD для бина User User user = new User(-1, "testUser", "testUserEmail","testUserPass","testUserNickName","testUserPhone", 2); UserCRUD.create(user); user.setLogin("testUserForDelete"); UserCRUD.update(user); UserCRUD.delete(user); System.out.println(user); user = UserCRUD.read(1); System.out.println(user+"\n"); //проверим CRUD для бина Ad Ad ad = new Ad( -1, "Phone", "Samsung galaxy s5", 100, 2, 2 ); AdCRUD.create(ad); ad.setDescription("testAdForDelete"); AdCRUD.update(ad); AdCRUD.delete(ad); System.out.println(ad); ad = AdCRUD.read(1); System.out.println(ad+"\n"); //проверим CRUD для бина Role Role role=new Role(-1,"testRole"); RoleCRUD.create(role); role.setRole("testRoleForDelete"); RoleCRUD.update(role); RoleCRUD.delete(role); System.out.println(role); role = RoleCRUD.read(1); System.out.println(role+"\n"); } }
UTF-8
Java
1,502
java
Runner.java
Java
[ { "context": "D для бина User\n User user = new User(-1, \"testUser\", \"testUserEmail\",\"testUserPass\",\"testUserNickNam", "end": 368, "score": 0.9991559386253357, "start": 360, "tag": "USERNAME", "value": "testUser" }, { "context": " UserCRUD.create(user);\n user.setLogin(\"testUserForDelete\");\n UserCRUD.update(user);\n UserCRU", "end": 513, "score": 0.9979754686355591, "start": 496, "tag": "USERNAME", "value": "testUserForDelete" } ]
null
[]
package by.it.desykevich.jd03_02; import by.it.desykevich.jd03_02.beans.Ad; import by.it.desykevich.jd03_02.beans.Role; import by.it.desykevich.jd03_02.beans.User; import java.sql.SQLException; public class Runner { public static void main(String[] args) throws SQLException { //проверим CRUD для бина User User user = new User(-1, "testUser", "testUserEmail","testUserPass","testUserNickName","testUserPhone", 2); UserCRUD.create(user); user.setLogin("testUserForDelete"); UserCRUD.update(user); UserCRUD.delete(user); System.out.println(user); user = UserCRUD.read(1); System.out.println(user+"\n"); //проверим CRUD для бина Ad Ad ad = new Ad( -1, "Phone", "Samsung galaxy s5", 100, 2, 2 ); AdCRUD.create(ad); ad.setDescription("testAdForDelete"); AdCRUD.update(ad); AdCRUD.delete(ad); System.out.println(ad); ad = AdCRUD.read(1); System.out.println(ad+"\n"); //проверим CRUD для бина Role Role role=new Role(-1,"testRole"); RoleCRUD.create(role); role.setRole("testRoleForDelete"); RoleCRUD.update(role); RoleCRUD.delete(role); System.out.println(role); role = RoleCRUD.read(1); System.out.println(role+"\n"); } }
1,502
0.568977
0.549073
55
25.49091
20.082441
115
false
false
0
0
0
0
0
0
0.745455
false
false
4
3b8b5f72d140d48adc2c2f9947ed381282cbaca8
20,298,015,507,831
63e1d4e0e98fef09c06a10a6410cd0b03ecd45bf
/src/inou/math/PrimitiveFunction.java
0eb99d93f53e08bee2aa13081cc0f78de35e0b45
[]
no_license
PlumpMath/java-inou
https://github.com/PlumpMath/java-inou
fcf05586ec4f1db2abf1bed54cfb7571d6fb0fd8
fdc8a3a9dc0782a70f388ba381ebeb40f0b3e87e
refs/heads/master
2021-01-18T20:17:00.357000
2011-12-12T16:23:17
2011-12-12T16:23:17
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * INOU, Integrated Numerical Operation Utility * Copyright (C) 2005 SAKURAI, Masashi (m.sakurai@kiwanami.net) */ package inou.math; import inou.util.TreeStructure; /** Primitive function, which has a derived and integrated function. */ public class PrimitiveFunction extends Functional { private String name; private ScalarFunction derivedFunction, integratedFunction; /** * Create an instance with a derivedFunction and integratedFunction that * calculated numerically and defined within whole range. * * @param name * function name * @param function * function object */ public PrimitiveFunction(String name, AFunction function) { this(name, function, null, null, null); } public PrimitiveFunction(String name, AFunction function, ScalarFunction derivedFunction, ScalarFunction integratedFunction, RealRange range) { super(function, FunctionUtil.variable()); setName(name); setDerivedFunction(derivedFunction); setIntegratedFunction(integratedFunction); setDefinedRange(range); } /** set function name */ public void setName(String n) { name = n; } /** get function name */ public String getName() { return name; } /** * Get the value of integratedFunction. (AIntegratableFunction stuff) * * @return Value of integratedFunction. */ public ScalarFunction getIntegratedFunction() { if (integratedFunction == null) throw new ArithmeticException("Cannot integrate " + getName()); return integratedFunction; } /** redirect getIntegratedFunction() */ public ScalarFunction getIntegratedFunction(int c) { if (c == 0) return getIntegratedFunction(); throw new InternalError("Forbidden method."); } /** * Set the value of integratedFunction. * * @param v * Value to assign to integratedFunction. */ public void setIntegratedFunction(ScalarFunction v) { this.integratedFunction = v; } /** * Get the value of derivedFunction. (ADifferentiatableFunction stuff) * * @return Value of derivedFunction. */ public ScalarFunction getDerivedFunction() { if (derivedFunction == null) throw new ArithmeticException("Cannot derive " + getName()); return derivedFunction; } /** redirect getDerivedFunction() */ public ScalarFunction getDerivedFunction(int c) { if (c == 0) return getDerivedFunction(); throw new InternalError("Forbidden method."); } public String toString() { return name; } /** * Set the value of derivedFunction. * * @param v * Value to assign to derivedFunction. */ public void setDerivedFunction(ScalarFunction v) { this.derivedFunction = v; } public String getTreeNodeExpression() { return name + "(x)"; } public TreeStructure[] getTreeNodes() { return null; } }
UTF-8
Java
3,155
java
PrimitiveFunction.java
Java
[ { "context": " Numerical Operation Utility\n * Copyright (C) 2005 SAKURAI, Masashi (m.sakurai@kiwanami.net)\n */\n\npackage ino", "end": 80, "score": 0.910025954246521, "start": 73, "tag": "NAME", "value": "SAKURAI" }, { "context": "l Operation Utility\n * Copyright (C) 2005 SAKURAI, Masashi (m.sakurai@kiwanami.net)\n */\n\npackage inou.math;\n", "end": 89, "score": 0.9938317537307739, "start": 82, "tag": "NAME", "value": "Masashi" }, { "context": "n Utility\n * Copyright (C) 2005 SAKURAI, Masashi (m.sakurai@kiwanami.net)\n */\n\npackage inou.math;\n\nimport inou.util.TreeSt", "end": 113, "score": 0.9999322295188904, "start": 91, "tag": "EMAIL", "value": "m.sakurai@kiwanami.net" } ]
null
[]
/* * INOU, Integrated Numerical Operation Utility * Copyright (C) 2005 SAKURAI, Masashi (<EMAIL>) */ package inou.math; import inou.util.TreeStructure; /** Primitive function, which has a derived and integrated function. */ public class PrimitiveFunction extends Functional { private String name; private ScalarFunction derivedFunction, integratedFunction; /** * Create an instance with a derivedFunction and integratedFunction that * calculated numerically and defined within whole range. * * @param name * function name * @param function * function object */ public PrimitiveFunction(String name, AFunction function) { this(name, function, null, null, null); } public PrimitiveFunction(String name, AFunction function, ScalarFunction derivedFunction, ScalarFunction integratedFunction, RealRange range) { super(function, FunctionUtil.variable()); setName(name); setDerivedFunction(derivedFunction); setIntegratedFunction(integratedFunction); setDefinedRange(range); } /** set function name */ public void setName(String n) { name = n; } /** get function name */ public String getName() { return name; } /** * Get the value of integratedFunction. (AIntegratableFunction stuff) * * @return Value of integratedFunction. */ public ScalarFunction getIntegratedFunction() { if (integratedFunction == null) throw new ArithmeticException("Cannot integrate " + getName()); return integratedFunction; } /** redirect getIntegratedFunction() */ public ScalarFunction getIntegratedFunction(int c) { if (c == 0) return getIntegratedFunction(); throw new InternalError("Forbidden method."); } /** * Set the value of integratedFunction. * * @param v * Value to assign to integratedFunction. */ public void setIntegratedFunction(ScalarFunction v) { this.integratedFunction = v; } /** * Get the value of derivedFunction. (ADifferentiatableFunction stuff) * * @return Value of derivedFunction. */ public ScalarFunction getDerivedFunction() { if (derivedFunction == null) throw new ArithmeticException("Cannot derive " + getName()); return derivedFunction; } /** redirect getDerivedFunction() */ public ScalarFunction getDerivedFunction(int c) { if (c == 0) return getDerivedFunction(); throw new InternalError("Forbidden method."); } public String toString() { return name; } /** * Set the value of derivedFunction. * * @param v * Value to assign to derivedFunction. */ public void setDerivedFunction(ScalarFunction v) { this.derivedFunction = v; } public String getTreeNodeExpression() { return name + "(x)"; } public TreeStructure[] getTreeNodes() { return null; } }
3,140
0.625357
0.623455
118
25.745762
23.108509
78
false
false
0
0
0
0
0
0
0.330508
false
false
4
fa3f27d2c276a75a323127dd51b3590c0f5c0435
30,236,569,833,683
9351d44e276584ce6b0d71da13b14b0613ca0647
/Arkanoid/src/View/CircleView.java
bc86a7fee5e18e9775a92593b7ff3992714c404d
[]
no_license
GabelliniRiccardo/Arkanoid
https://github.com/GabelliniRiccardo/Arkanoid
d2f340492f2678cdb1068f55c257d239a29f2030
0a4f0d87cda7f973468e351cf2f540164d533ed2
refs/heads/master
2021-08-17T07:30:12.036000
2017-11-20T22:58:58
2017-11-20T22:58:58
111,461,495
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package View; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Ellipse2D; public class CircleView extends AbstractDrawingView{ private Ellipse2D.Double circle; private Color color; public CircleView(double x, double y, int width, int height){ circle=new Ellipse2D.Double(x,y,width,height); } @Override public void draw(Graphics g) { Graphics2D g2d = (Graphics2D)g; g2d.setColor(color); g2d.fill(circle); g2d.draw(circle); } @Override public void setColor(Color color) { this.color=color; } @Override public Color getColor() { return color; } @Override public void setX(double X) { circle.setFrame(X,circle.getY(),circle.getWidth(),circle.getHeight()); } @Override public void setY(double Y) { circle.setFrame(circle.getX(),Y,circle.getWidth(),circle.getHeight()); } @Override public void setDrawingWidth(int width) { circle.setFrame(circle.getX(),circle.getY(),width,circle.getHeight()); } /*@Override public void setDrawingHeight(int height) { circle.setFrame(circle.getX(),circle.getY(),circle.getWidth(),height); SERVE? }*/ @Override public double getY() { return circle.getY(); } @Override public double getX() { return circle.getX(); } }
UTF-8
Java
1,507
java
CircleView.java
Java
[]
null
[]
package View; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Ellipse2D; public class CircleView extends AbstractDrawingView{ private Ellipse2D.Double circle; private Color color; public CircleView(double x, double y, int width, int height){ circle=new Ellipse2D.Double(x,y,width,height); } @Override public void draw(Graphics g) { Graphics2D g2d = (Graphics2D)g; g2d.setColor(color); g2d.fill(circle); g2d.draw(circle); } @Override public void setColor(Color color) { this.color=color; } @Override public Color getColor() { return color; } @Override public void setX(double X) { circle.setFrame(X,circle.getY(),circle.getWidth(),circle.getHeight()); } @Override public void setY(double Y) { circle.setFrame(circle.getX(),Y,circle.getWidth(),circle.getHeight()); } @Override public void setDrawingWidth(int width) { circle.setFrame(circle.getX(),circle.getY(),width,circle.getHeight()); } /*@Override public void setDrawingHeight(int height) { circle.setFrame(circle.getX(),circle.getY(),circle.getWidth(),height); SERVE? }*/ @Override public double getY() { return circle.getY(); } @Override public double getX() { return circle.getX(); } }
1,507
0.599204
0.592568
64
21.546875
21.323351
85
false
false
0
0
0
0
0
0
0.625
false
false
4
ead26b0de5daaeb087a4e16f5fe490d89ae4a5c9
24,807,731,157,239
61ac2b61e36d01a42a1aa51800698cb2a9d6703f
/net/minecraft/server/EntityDamageSource.java
9f84148ab73790ec90f15c7bef03ba00cc617f1d
[]
no_license
MadMockers/mc-devs
https://github.com/MadMockers/mc-devs
8ffe3370b28129f0cf11dc58c2440f2aa9909a92
b476c1dd5d748cddf85c6ce3a4600bc3d4c95940
refs/heads/master
2020-12-24T15:22:09.503000
2012-08-15T11:00:09
2012-08-15T11:00:09
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.minecraft.server; public class EntityDamageSource extends DamageSource { protected Entity o; public EntityDamageSource(String paramString, Entity paramEntity) { super(paramString); this.o = paramEntity; } public Entity getEntity() { return this.o; } public String getLocalizedDeathMessage(EntityHuman paramEntityHuman) { return LocaleI18n.get("death." + this.translationIndex, new Object[] { paramEntityHuman.name, this.o.getLocalizedName() }); } public boolean n() { return (this.o != null) && ((this.o instanceof EntityLiving)) && (!(this.o instanceof EntityHuman)); } } /* * Qualified Name: net.minecraft.server.EntityDamageSource * JD-Core Version: 0.6.0 */
UTF-8
Java
709
java
EntityDamageSource.java
Java
[]
null
[]
package net.minecraft.server; public class EntityDamageSource extends DamageSource { protected Entity o; public EntityDamageSource(String paramString, Entity paramEntity) { super(paramString); this.o = paramEntity; } public Entity getEntity() { return this.o; } public String getLocalizedDeathMessage(EntityHuman paramEntityHuman) { return LocaleI18n.get("death." + this.translationIndex, new Object[] { paramEntityHuman.name, this.o.getLocalizedName() }); } public boolean n() { return (this.o != null) && ((this.o instanceof EntityLiving)) && (!(this.o instanceof EntityHuman)); } } /* * Qualified Name: net.minecraft.server.EntityDamageSource * JD-Core Version: 0.6.0 */
709
0.726375
0.719323
32
21.1875
31.283421
125
false
false
0
0
0
0
0
0
1.15625
false
false
4
a7f97f5ed09a610ed48dc2f38fe20d0d8eaf857a
14,508,399,582,716
6393191c8678bbfd5fb1208eda69d10b1eb4dce7
/decisionengine-5-16-2016/decisionengine-core/src/main/java/com/mesh/textanalytics/spellchecker/SpellCheckerFactory.java
32329c552bc5d72d86b9226f06e88bb04d4b009a
[]
no_license
atishaykumar/myJunkYard
https://github.com/atishaykumar/myJunkYard
49760ea85b8ddc272aef8514cdad66cecc6060b8
698bff69383c4d98781872dff4551b48d6827c2c
refs/heads/master
2016-09-13T21:54:35.250000
2016-05-17T00:15:10
2016-05-17T00:15:10
58,926,399
0
0
null
false
2020-07-01T20:54:29
2016-05-16T11:08:49
2016-05-17T01:11:14
2020-07-01T20:54:28
211,424
0
0
8
Java
false
false
package com.mesh.textanalytics.spellchecker; public class SpellCheckerFactory { public enum SpellCheckerType { JAZZY } public static SpellChecker get(SpellCheckerType type) { switch (type) { case JAZZY: return new JazzySpellChecker(); } return null; } }
UTF-8
Java
275
java
SpellCheckerFactory.java
Java
[]
null
[]
package com.mesh.textanalytics.spellchecker; public class SpellCheckerFactory { public enum SpellCheckerType { JAZZY } public static SpellChecker get(SpellCheckerType type) { switch (type) { case JAZZY: return new JazzySpellChecker(); } return null; } }
275
0.734545
0.734545
18
14.277778
17.207253
56
false
false
0
0
0
0
0
0
1.055556
false
false
4
2ed89ac8ade7632a0d773fdd3c8309d3c901c7a5
29,927,332,124,978
b15f932ce9af385a46a120e22164e537dba6f1fc
/01-Secuencia/SecuenciaNaranjas/src/org/japo/java/basics/samples/SecuenciaNaranjas.java
9d8c2be9d03b2fa20b87c87d4b2b1deed236b244
[]
no_license
joanpaon/joanpaon-0485-t3
https://github.com/joanpaon/joanpaon-0485-t3
0d288b3c9645aac42df63d631d04fab4fe21e935
fb851071037a5aa0ae63f8a6c41f972bc05630c6
refs/heads/master
2016-09-05T14:50:22.605000
2015-03-30T20:13:26
2015-03-30T20:13:26
32,139,703
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.japo.java.basics.samples; public class SecuenciaNaranjas { public static void main(String[] args) { // Datos del supuesto String variedadNaranjas = "Clementinas"; int capacidadBolsaKg = 3; // Expresada en kilos int capacidadBolsaUd = 23; // Expresada en naranjas double cantidadPagada = 5.0; // Expresada en Euros double cantidadRetorno = 2.75; // Expresada en Euros // Mensajes del supuesto System.out.printf("Variedad de las naranjas ....: %s\n", variedadNaranjas); System.out.printf("Kilos en la bolsa ...........: %d\n", capacidadBolsaKg); System.out.printf("Naranjas en la bolsa ........: %d\n", capacidadBolsaUd); System.out.printf("Dinero entregado ............: %.2f €\n", cantidadPagada); System.out.printf("Dinero devuelto .............: %.2f €\n", cantidadRetorno); // Cálculos double precioCompra = cantidadPagada - cantidadRetorno; // Mensajes del supuesto System.out.printf("Precio de la compra .........: %.2f €\n", precioCompra); System.out.printf("Precio del kilo .............: %.2f €\n", precioCompra / capacidadBolsaKg); System.out.printf("Naranjas por kilo ...........: %.2f €\n", (double) capacidadBolsaUd / capacidadBolsaKg); System.out.printf("Precio por naranja ..........: %.2f €\n", precioCompra / capacidadBolsaUd); } }
UTF-8
Java
1,635
java
SecuenciaNaranjas.java
Java
[]
null
[]
package org.japo.java.basics.samples; public class SecuenciaNaranjas { public static void main(String[] args) { // Datos del supuesto String variedadNaranjas = "Clementinas"; int capacidadBolsaKg = 3; // Expresada en kilos int capacidadBolsaUd = 23; // Expresada en naranjas double cantidadPagada = 5.0; // Expresada en Euros double cantidadRetorno = 2.75; // Expresada en Euros // Mensajes del supuesto System.out.printf("Variedad de las naranjas ....: %s\n", variedadNaranjas); System.out.printf("Kilos en la bolsa ...........: %d\n", capacidadBolsaKg); System.out.printf("Naranjas en la bolsa ........: %d\n", capacidadBolsaUd); System.out.printf("Dinero entregado ............: %.2f €\n", cantidadPagada); System.out.printf("Dinero devuelto .............: %.2f €\n", cantidadRetorno); // Cálculos double precioCompra = cantidadPagada - cantidadRetorno; // Mensajes del supuesto System.out.printf("Precio de la compra .........: %.2f €\n", precioCompra); System.out.printf("Precio del kilo .............: %.2f €\n", precioCompra / capacidadBolsaKg); System.out.printf("Naranjas por kilo ...........: %.2f €\n", (double) capacidadBolsaUd / capacidadBolsaKg); System.out.printf("Precio por naranja ..........: %.2f €\n", precioCompra / capacidadBolsaUd); } }
1,635
0.535142
0.52651
38
40.684212
23.729956
68
false
false
0
0
0
0
0
0
0.657895
false
false
4
5b0e254b6cd2465e97abfd701154919a81b6f790
13,374,528,197,462
029db1884f42eb45ed07ce6b7efd0ed7d36ad230
/lesson03/src/test/java/ru/otus/chepiov/l3/CyclicQueueTest.java
bbd0d8efafb3daf4818c9ab77eea24f81c2e99bd
[ "MIT" ]
permissive
chepiov/otus-java-2017-04-kiekbaev
https://github.com/chepiov/otus-java-2017-04-kiekbaev
abf66af6cb1a3537c39687f28cba251ace71c1e7
0a98e9a0ba79edb574a95f36778153fc22b959ca
refs/heads/master
2021-01-18T19:43:34.240000
2017-08-31T19:10:21
2017-08-31T19:10:21
86,907,688
0
0
null
false
2017-06-07T17:17:29
2017-04-01T11:01:26
2017-04-07T17:07:21
2017-06-07T17:17:28
47
0
0
0
Java
null
null
package ru.otus.chepiov.l3; import org.junit.Assert; import org.junit.Test; import java.util.*; import java.util.stream.IntStream; import static java.util.stream.Collectors.toList; /** * Test case for ArrayList. * * @author <a href="mailto:a.kiekbaev@chepiov.org">Anvar Kiekbaev</a> */ public class CyclicQueueTest { @Test public void homeWorkTest() { Queue<Integer> queue = new CyclicQueue<>(); Assert.assertTrue(Collections.addAll(queue, 1, 2, 3)); Assert.assertTrue(queue.size() == 3); Assert.assertTrue(Collections.addAll(queue, 1, 3, 4)); Assert.assertTrue(Collections.frequency(queue, 1) == 2); Assert.assertTrue(Collections.frequency(queue, 2) == 1); Assert.assertTrue(Collections.frequency(queue, 3) == 2); Assert.assertTrue(Collections.frequency(queue, 4) == 1); } @Test(expected = NoSuchElementException.class) public void addRemoveContainsElements() { final Queue<Integer> queue = new CyclicQueue<>(); Assert.assertTrue(queue.size() == 0); Assert.assertTrue(queue.add(1)); Assert.assertTrue(queue.size() == 1); Assert.assertTrue(queue.remove() == 1); Assert.assertTrue(queue.size() == 0); IntStream.iterate(0, i -> i + 1).limit(20).forEach(queue::add); Assert.assertTrue(queue.size() == 20); Assert.assertTrue(queue.remove(10)); Assert.assertFalse(queue.remove(100)); Assert.assertTrue(queue.size() == 19); Assert.assertFalse(queue.contains(10)); Assert.assertTrue(queue.contains(19)); Assert.assertTrue(queue.containsAll(IntStream.iterate(0, i -> i + 1).limit(9).boxed().collect(toList()))); Assert.assertTrue(queue.remove() == 0); Assert.assertTrue(queue.size() == 18); IntStream.iterate(0, i -> i + 1).limit(18).forEach(ignore -> queue.remove()); Assert.assertTrue(queue.size() == 0); Assert.assertTrue(queue.add(0)); Assert.assertTrue(queue.size() == 1); Assert.assertTrue(queue.addAll(IntStream.iterate(0, i -> i + 1).limit(10).boxed().collect(toList()))); Assert.assertTrue(queue.size() == 11); Assert.assertTrue(queue.addAll(IntStream.iterate(0, i -> i + 1).limit(3).boxed().collect(toList()))); Assert.assertTrue(queue.size() == 14); Assert.assertTrue(queue.removeAll(IntStream.iterate(0, i -> i + 1).limit(10).boxed().collect(toList()))); Assert.assertTrue(queue.size() == 4); Assert.assertTrue(queue.removeAll(IntStream.iterate(0, i -> i + 1).limit(3).boxed().collect(toList()))); Assert.assertTrue(queue.size() == 1); Assert.assertTrue(queue.remove(0)); Assert.assertTrue(queue.size() == 0); queue.remove(); } @Test(expected = NoSuchElementException.class) public void pollPeekOfferElements() { Queue<Integer> queue = new CyclicQueue<>(); IntStream.iterate(0, i -> i + 1).limit(100).forEach(queue::offer); Assert.assertTrue(queue.size() == 100); IntStream.iterate(0, i -> i + 1).limit(100).forEach(i -> { Assert.assertTrue(queue.peek() == i); Assert.assertTrue(queue.size() == 100 - i); Assert.assertTrue(queue.poll() == i); Assert.assertTrue(queue.size() == 100 - i - 1); }); Assert.assertTrue(queue.size() == 0); Assert.assertTrue(queue.peek() == null); Assert.assertTrue(queue.poll() == null); queue.element(); } @Test public void retainAll() { Queue<Integer> queue = new CyclicQueue<>(); Collections.addAll(queue, 1, 2, 3); Collection<Integer> collection = new HashSet<Integer>(){{ add(1); add(2); add(4); }}; queue.retainAll(collection); Assert.assertTrue(queue.size() == 2); } @Test public void iterator() { List<Integer> sample = Arrays.asList(1, 2, 3); Queue<Integer> queue = new CyclicQueue<>(); //noinspection UseBulkOperation sample.forEach(queue::add); List<Integer> list = new ArrayList<>(); Iterator<Integer> iter = queue.iterator(); //noinspection WhileLoopReplaceableByForEach while (iter.hasNext()) { //noinspection UseBulkOperation list.add(iter.next()); } Assert.assertEquals(list, sample); Assert.assertEquals(queue.stream().map(Object::toString).collect(toList()), Arrays.asList("1", "2", "3")); } @Test(expected = NullPointerException.class) public void addNull() { @SuppressWarnings("MismatchedQueryAndUpdateOfCollection") Queue<Integer> queue = new CyclicQueue<>(); queue.add(null); } @Test public void toArray() { Queue<Integer> queue = new CyclicQueue<>(); //noinspection UseBulkOperation IntStream.iterate(1, i -> i + 1).limit(3).forEach(queue::add); Assert.assertArrayEquals(queue.toArray(), new Object[]{1, 2, 3}); final Integer[] first = new Integer[3]; Assert.assertArrayEquals(queue.toArray(first), new Integer[]{1, 2, 3}); Assert.assertTrue(first == queue.toArray(first)); final Integer[] second = new Integer[4]; Assert.assertArrayEquals(queue.toArray(second), new Integer[]{1, 2, 3, null}); Assert.assertTrue(second == queue.toArray(second)); } }
UTF-8
Java
5,442
java
CyclicQueueTest.java
Java
[ { "context": "case for ArrayList.\n *\n * @author <a href=\"mailto:a.kiekbaev@chepiov.org\">Anvar Kiekbaev</a>\n */\npublic class CyclicQueueT", "end": 269, "score": 0.9999168515205383, "start": 247, "tag": "EMAIL", "value": "a.kiekbaev@chepiov.org" }, { "context": "* @author <a href=\"mailto:a.kiekbaev@chepiov.org\">Anvar Kiekbaev</a>\n */\npublic class CyclicQueueTest {\n\n @Test", "end": 285, "score": 0.999882698059082, "start": 271, "tag": "NAME", "value": "Anvar Kiekbaev" } ]
null
[]
package ru.otus.chepiov.l3; import org.junit.Assert; import org.junit.Test; import java.util.*; import java.util.stream.IntStream; import static java.util.stream.Collectors.toList; /** * Test case for ArrayList. * * @author <a href="mailto:<EMAIL>"><NAME></a> */ public class CyclicQueueTest { @Test public void homeWorkTest() { Queue<Integer> queue = new CyclicQueue<>(); Assert.assertTrue(Collections.addAll(queue, 1, 2, 3)); Assert.assertTrue(queue.size() == 3); Assert.assertTrue(Collections.addAll(queue, 1, 3, 4)); Assert.assertTrue(Collections.frequency(queue, 1) == 2); Assert.assertTrue(Collections.frequency(queue, 2) == 1); Assert.assertTrue(Collections.frequency(queue, 3) == 2); Assert.assertTrue(Collections.frequency(queue, 4) == 1); } @Test(expected = NoSuchElementException.class) public void addRemoveContainsElements() { final Queue<Integer> queue = new CyclicQueue<>(); Assert.assertTrue(queue.size() == 0); Assert.assertTrue(queue.add(1)); Assert.assertTrue(queue.size() == 1); Assert.assertTrue(queue.remove() == 1); Assert.assertTrue(queue.size() == 0); IntStream.iterate(0, i -> i + 1).limit(20).forEach(queue::add); Assert.assertTrue(queue.size() == 20); Assert.assertTrue(queue.remove(10)); Assert.assertFalse(queue.remove(100)); Assert.assertTrue(queue.size() == 19); Assert.assertFalse(queue.contains(10)); Assert.assertTrue(queue.contains(19)); Assert.assertTrue(queue.containsAll(IntStream.iterate(0, i -> i + 1).limit(9).boxed().collect(toList()))); Assert.assertTrue(queue.remove() == 0); Assert.assertTrue(queue.size() == 18); IntStream.iterate(0, i -> i + 1).limit(18).forEach(ignore -> queue.remove()); Assert.assertTrue(queue.size() == 0); Assert.assertTrue(queue.add(0)); Assert.assertTrue(queue.size() == 1); Assert.assertTrue(queue.addAll(IntStream.iterate(0, i -> i + 1).limit(10).boxed().collect(toList()))); Assert.assertTrue(queue.size() == 11); Assert.assertTrue(queue.addAll(IntStream.iterate(0, i -> i + 1).limit(3).boxed().collect(toList()))); Assert.assertTrue(queue.size() == 14); Assert.assertTrue(queue.removeAll(IntStream.iterate(0, i -> i + 1).limit(10).boxed().collect(toList()))); Assert.assertTrue(queue.size() == 4); Assert.assertTrue(queue.removeAll(IntStream.iterate(0, i -> i + 1).limit(3).boxed().collect(toList()))); Assert.assertTrue(queue.size() == 1); Assert.assertTrue(queue.remove(0)); Assert.assertTrue(queue.size() == 0); queue.remove(); } @Test(expected = NoSuchElementException.class) public void pollPeekOfferElements() { Queue<Integer> queue = new CyclicQueue<>(); IntStream.iterate(0, i -> i + 1).limit(100).forEach(queue::offer); Assert.assertTrue(queue.size() == 100); IntStream.iterate(0, i -> i + 1).limit(100).forEach(i -> { Assert.assertTrue(queue.peek() == i); Assert.assertTrue(queue.size() == 100 - i); Assert.assertTrue(queue.poll() == i); Assert.assertTrue(queue.size() == 100 - i - 1); }); Assert.assertTrue(queue.size() == 0); Assert.assertTrue(queue.peek() == null); Assert.assertTrue(queue.poll() == null); queue.element(); } @Test public void retainAll() { Queue<Integer> queue = new CyclicQueue<>(); Collections.addAll(queue, 1, 2, 3); Collection<Integer> collection = new HashSet<Integer>(){{ add(1); add(2); add(4); }}; queue.retainAll(collection); Assert.assertTrue(queue.size() == 2); } @Test public void iterator() { List<Integer> sample = Arrays.asList(1, 2, 3); Queue<Integer> queue = new CyclicQueue<>(); //noinspection UseBulkOperation sample.forEach(queue::add); List<Integer> list = new ArrayList<>(); Iterator<Integer> iter = queue.iterator(); //noinspection WhileLoopReplaceableByForEach while (iter.hasNext()) { //noinspection UseBulkOperation list.add(iter.next()); } Assert.assertEquals(list, sample); Assert.assertEquals(queue.stream().map(Object::toString).collect(toList()), Arrays.asList("1", "2", "3")); } @Test(expected = NullPointerException.class) public void addNull() { @SuppressWarnings("MismatchedQueryAndUpdateOfCollection") Queue<Integer> queue = new CyclicQueue<>(); queue.add(null); } @Test public void toArray() { Queue<Integer> queue = new CyclicQueue<>(); //noinspection UseBulkOperation IntStream.iterate(1, i -> i + 1).limit(3).forEach(queue::add); Assert.assertArrayEquals(queue.toArray(), new Object[]{1, 2, 3}); final Integer[] first = new Integer[3]; Assert.assertArrayEquals(queue.toArray(first), new Integer[]{1, 2, 3}); Assert.assertTrue(first == queue.toArray(first)); final Integer[] second = new Integer[4]; Assert.assertArrayEquals(queue.toArray(second), new Integer[]{1, 2, 3, null}); Assert.assertTrue(second == queue.toArray(second)); } }
5,419
0.61007
0.587835
138
38.434784
27.362822
114
false
false
0
0
0
0
0
0
0.891304
false
false
4
34681f24898ff9a81c087a18977c5a48635110cd
5,506,148,083,526
572fd1f8f3f4b462f0a91049dec4eb49adf60213
/src/main/java/hello/OrderService.java
1d909f4a190ae041c8d41933d3650495a609c548
[]
no_license
rjgallac/springbootwebsocket
https://github.com/rjgallac/springbootwebsocket
c65d0716da9f65fc8fb6e00bdd63d3296cf4dcac
74c34988cd00dcdf851d9dbc312bd8a1d3d5b4bd
refs/heads/master
2018-01-10T19:42:44.080000
2016-04-11T20:08:09
2016-04-11T20:08:09
55,641,640
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package hello; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; @Service public class OrderService { HashMap<Long, Order> orders; @Autowired private SimpMessagingTemplate template; public OrderService() { orders = new HashMap<>(); Product product= new Product(1, "wodget 1", new BigDecimal("10.00"), 10); List<Product> products = new ArrayList<>(); products.add(product); products.add(product); Order order= new Order("John", new Date(), products); Order order2= new Order("John2", new Date(), products); orders.put(1L, order); orders.put(2L, order2); } public void addOrder(Order order){ this.template.convertAndSend("/topic/orders", order); orders.put((long) orders.size()+1, order); } public List<Order> getOrders(){ return new ArrayList<Order>(orders.values()); } }
UTF-8
Java
1,169
java
OrderService.java
Java
[ { "context": "cts.add(product);\n Order order= new Order(\"John\", new Date(), products);\n Order order2= ne", "end": 748, "score": 0.9991456270217896, "start": 744, "tag": "NAME", "value": "John" }, { "context": "te(), products);\n Order order2= new Order(\"John2\", new Date(), products);\n orders.put(1L, o", "end": 812, "score": 0.9799337983131409, "start": 807, "tag": "NAME", "value": "John2" } ]
null
[]
package hello; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; @Service public class OrderService { HashMap<Long, Order> orders; @Autowired private SimpMessagingTemplate template; public OrderService() { orders = new HashMap<>(); Product product= new Product(1, "wodget 1", new BigDecimal("10.00"), 10); List<Product> products = new ArrayList<>(); products.add(product); products.add(product); Order order= new Order("John", new Date(), products); Order order2= new Order("John2", new Date(), products); orders.put(1L, order); orders.put(2L, order2); } public void addOrder(Order order){ this.template.convertAndSend("/topic/orders", order); orders.put((long) orders.size()+1, order); } public List<Order> getOrders(){ return new ArrayList<Order>(orders.values()); } }
1,169
0.67237
0.660393
44
25.545454
22.670019
81
false
false
0
0
0
0
0
0
0.795455
false
false
4
a035c6cb29c50ebda25bf0bf0755c6c3a84ed6b6
15,693,810,504,038
b89e6d425590ffc5765fc9f4aa61101a0f7d8911
/annotation/src/main/java/com/duanya/spring/framework/annotation/DyAutowired.java
c8ebd5970ea87e5135aeb6f6711a5f3115604c20
[]
no_license
sleeper99/DySpring
https://github.com/sleeper99/DySpring
647b779df82b814cebb5f1a5be73106cabfa8cfc
b44948ddb1eed4189226df84cff6ce91ddd826c0
refs/heads/master
2020-09-15T23:28:18.297000
2019-11-14T05:06:16
2019-11-14T05:06:16
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.duanya.spring.framework.annotation; import java.lang.annotation.*; /** * @author zheng.liming * @date 2019/8/5 * @description 依赖注入 */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD}) public @interface DyAutowired { /** * bean的名字 * @return */ String value() default ""; }
UTF-8
Java
354
java
DyAutowired.java
Java
[ { "context": "n;\n\nimport java.lang.annotation.*;\n\n/**\n * @author zheng.liming\n * @date 2019/8/5\n * @description 依赖注入\n */\n@Docum", "end": 108, "score": 0.9987097978591919, "start": 96, "tag": "NAME", "value": "zheng.liming" } ]
null
[]
package com.duanya.spring.framework.annotation; import java.lang.annotation.*; /** * @author zheng.liming * @date 2019/8/5 * @description 依赖注入 */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD}) public @interface DyAutowired { /** * bean的名字 * @return */ String value() default ""; }
354
0.667647
0.65
19
16.894737
13.384574
47
false
false
0
0
0
0
0
0
0.157895
false
false
4
b17cf5dac54a68ef75232529bd95f02a05ff3104
20,263,655,766,456
3a29d7b85b6fa44cafe9a99f4d4f8d439a9f956c
/x_teamwork_assemble_control/src/main/webapp/describe/sources/com/x/teamwork/assemble/control/jaxrs/statistics/StatisticQueryException.java
f4adf482d62e84bf138289829483932b9649eed5
[]
no_license
wadelu/o2oa-teamwork
https://github.com/wadelu/o2oa-teamwork
9476644c0642b124e5d112f03375ff6bdede2248
d54e4765225bd3c0d9fe970deec3acaafac5cb7e
refs/heads/master
2023-07-01T03:32:45.533000
2021-08-02T09:04:44
2021-08-02T09:04:44
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.x.teamwork.assemble.control.jaxrs.statistics; import com.x.base.core.project.exception.PromptException; class StatisticQueryException extends PromptException { private static final long serialVersionUID = 1859164370743532895L; StatisticQueryException( Throwable e ) { super("统计查询工作任务信息时发生异常。" , e ); } StatisticQueryException( Throwable e, String message ) { super("统计查询工作任务信息时发生异常。Message:" + message, e ); } }
UTF-8
Java
503
java
StatisticQueryException.java
Java
[]
null
[]
package com.x.teamwork.assemble.control.jaxrs.statistics; import com.x.base.core.project.exception.PromptException; class StatisticQueryException extends PromptException { private static final long serialVersionUID = 1859164370743532895L; StatisticQueryException( Throwable e ) { super("统计查询工作任务信息时发生异常。" , e ); } StatisticQueryException( Throwable e, String message ) { super("统计查询工作任务信息时发生异常。Message:" + message, e ); } }
503
0.776765
0.733485
16
26.4375
26.643406
67
false
false
0
0
0
0
0
0
1.125
false
false
4
781701f13053e4667f4e5e42c391620ed221b689
6,339,371,777,976
39da7b6a99bba78f2619b6e920006c613ccbfba6
/fr/n7/stl/block/ast/impl/ClassTypeImpl.java
62b269cb35064743cd77a4563e410a0ce6c84c15
[]
no_license
thibmeu/enseeiht-java-compiler
https://github.com/thibmeu/enseeiht-java-compiler
5f3f86bb3af6f87af9a4c0fc1c21bd110224a6df
3fe76b277152306fffbcc04ad3ed7d0d78ccaeec
refs/heads/master
2021-03-27T14:33:49.681000
2017-06-02T18:44:36
2017-06-02T18:44:36
88,636,439
0
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package fr.n7.stl.block.ast.impl; import fr.n7.stl.block.ast.*; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; import java.util.function.Function; /** * Created by thibault on 05/05/17. */ public class ClassTypeImpl implements ClassType { private ClassDeclaration declaration; public ClassTypeImpl(ClassDeclaration _declaration) { this.declaration = _declaration; } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return this.declaration.getName(); } /** * Check if two types are equals. * This must be an equivalence relation. * * @param _other The other type (with respect to self). * @return True if the type is equals with the type _other, False otherwise. */ @Override public boolean equalsTo(Type _other) { return _other instanceof ClassType && ((ClassType) _other).getDeclaration().equals(this.declaration); } /** * Check if two types are compatibles. A subtype is compatibleWith a supertype, * but a supertype is not compatible with a subtype. * This must be a partial order relation. * Check that the self type is compatible with the _other type, i.e. all values of self can be * used as a value of _other. * * @param _other The other type * @return True if the types are compatibles, False otherwise. */ @Override public boolean compatibleWith(Type _other) { return this.equalsTo(_other); } /** * Builds a new type that results from the merging of self and _other according to the compatibleWith relation. * Compute the least common type (least upper bound) of two types according to the compatibleWith relation. * TA.merge(TB).compatibleWith(TA) and TA.merge(TB).compatibleWith(TB). * * @param _other The other type. * @return A type that is the least upper bound of self and _other according to compatibleWith. */ @Override public Type merge(Type _other) { return null; } /** * Compute the size in TAM words needed to store a value of the _self type. * * @return Number of TAM words needed to store a value of the _self type. */ @Override public int length() { return 1; } @Override public ClassElement getElement(String _name) { for (ClassElement _element : this.declaration.getElements()) { String _elementName = _element.getName(); if (_element.getDeclaration() instanceof FunctionDeclaration) { _elementName = ((FunctionDeclaration) _element.getDeclaration()).getSignature().getName(); } if (_elementName.equals(_name)) { return _element; } } return null; } @Override public ClassElement getElement(String _name, List<Type> _parameters) { List<ClassElement> _wellNamedElements = new LinkedList<>(); Type _returnedType; for (ClassElement _element : this.declaration.getElements()) { String _elementName = _element.getName(); if (_element.getDeclaration() instanceof FunctionDeclaration) { _elementName = ((FunctionDeclaration) _element.getDeclaration()).getSignature().getName(); if (_elementName.equals(_name)) { _wellNamedElements.add(_element); } } } if (_wellNamedElements.size() <= 0) { return null; } _returnedType = _wellNamedElements.get(0).getValueType(); List<ClassElement> _compatibleElements = new LinkedList<>(); for (ClassElement _element : _wellNamedElements) { List<ParameterDeclaration> _signatureParams = new LinkedList<>(((FunctionDeclaration)_element.getDeclaration()).getSignature().getParameters()); if (_signatureParams.size() != _parameters.size()) { continue; } List<Type> _signatureParamTypes = new LinkedList<>(); for (ParameterDeclaration _param : _signatureParams) { _signatureParamTypes.add(_param.getType()); } Boolean _compatible; if (_signatureParamTypes.equals(_parameters)) { return (ClassElement) _element; } else { int _indParam = 0; _compatible = true; for (_indParam = 0; _indParam < _parameters.size(); _indParam++) { // TODO : change following quick fix if (_signatureParamTypes.get(_indParam) instanceof GenericParameterType) { continue; } _compatible &= _parameters.get(_indParam).compatibleWith(_signatureParamTypes.get(_indParam)); } if (_compatible) { _compatibleElements.add(_element); } } } if (_compatibleElements.size() > 0) { return (ClassElement) _compatibleElements.get(0); } return null; } @Override public List<FunctionDeclaration> getConstructors() { List<FunctionDeclaration> _constructors = new LinkedList<>(); for (ClassElement _element : this.declaration.getElements()) { if (_element.getDeclaration() instanceof FunctionDeclaration) { if (_element.getDeclaration().getValueType() instanceof ConstructorType) { _constructors.add((FunctionDeclaration) _element.getDeclaration()); } } } return _constructors; } @Override public FunctionDeclaration getConstructor(List<Type> _parameters) { List<FunctionDeclaration> _constructors = new LinkedList<>(); for (ClassElement _element : this.declaration.getElements()) { if (_element.getDeclaration() instanceof FunctionDeclaration) { if ((_element.getDeclaration()).getValueType() instanceof ConstructorType) { _constructors.add((FunctionDeclaration) _element.getDeclaration()); } } } int _indParam; Type _t; FunctionType _wConst = new FunctionTypeImpl(new ConstructorTypeImpl(this.declaration), _parameters); for (FunctionDeclaration _currentConst : _constructors) { if (_currentConst.getType().equalsTo(_wConst)) { return _currentConst; } } return null; } @Override public List<VariableDeclaration> getAttributes() { List<VariableDeclaration> _attributes = new LinkedList<>(); for (ClassElement _element : this.declaration.getElements()) { if (_element.getDeclaration() instanceof VariableDeclaration) { _attributes.add((VariableDeclaration) _element.getDeclaration()); } } return _attributes; } @Override public ClassDeclaration getDeclaration() { return this.declaration; } }
UTF-8
Java
7,211
java
ClassTypeImpl.java
Java
[ { "context": "rt java.util.function.Function;\n\n/**\n * Created by thibault on 05/05/17.\n */\npublic class ClassTypeImpl imple", "end": 240, "score": 0.9994628429412842, "start": 232, "tag": "USERNAME", "value": "thibault" } ]
null
[]
package fr.n7.stl.block.ast.impl; import fr.n7.stl.block.ast.*; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; import java.util.function.Function; /** * Created by thibault on 05/05/17. */ public class ClassTypeImpl implements ClassType { private ClassDeclaration declaration; public ClassTypeImpl(ClassDeclaration _declaration) { this.declaration = _declaration; } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return this.declaration.getName(); } /** * Check if two types are equals. * This must be an equivalence relation. * * @param _other The other type (with respect to self). * @return True if the type is equals with the type _other, False otherwise. */ @Override public boolean equalsTo(Type _other) { return _other instanceof ClassType && ((ClassType) _other).getDeclaration().equals(this.declaration); } /** * Check if two types are compatibles. A subtype is compatibleWith a supertype, * but a supertype is not compatible with a subtype. * This must be a partial order relation. * Check that the self type is compatible with the _other type, i.e. all values of self can be * used as a value of _other. * * @param _other The other type * @return True if the types are compatibles, False otherwise. */ @Override public boolean compatibleWith(Type _other) { return this.equalsTo(_other); } /** * Builds a new type that results from the merging of self and _other according to the compatibleWith relation. * Compute the least common type (least upper bound) of two types according to the compatibleWith relation. * TA.merge(TB).compatibleWith(TA) and TA.merge(TB).compatibleWith(TB). * * @param _other The other type. * @return A type that is the least upper bound of self and _other according to compatibleWith. */ @Override public Type merge(Type _other) { return null; } /** * Compute the size in TAM words needed to store a value of the _self type. * * @return Number of TAM words needed to store a value of the _self type. */ @Override public int length() { return 1; } @Override public ClassElement getElement(String _name) { for (ClassElement _element : this.declaration.getElements()) { String _elementName = _element.getName(); if (_element.getDeclaration() instanceof FunctionDeclaration) { _elementName = ((FunctionDeclaration) _element.getDeclaration()).getSignature().getName(); } if (_elementName.equals(_name)) { return _element; } } return null; } @Override public ClassElement getElement(String _name, List<Type> _parameters) { List<ClassElement> _wellNamedElements = new LinkedList<>(); Type _returnedType; for (ClassElement _element : this.declaration.getElements()) { String _elementName = _element.getName(); if (_element.getDeclaration() instanceof FunctionDeclaration) { _elementName = ((FunctionDeclaration) _element.getDeclaration()).getSignature().getName(); if (_elementName.equals(_name)) { _wellNamedElements.add(_element); } } } if (_wellNamedElements.size() <= 0) { return null; } _returnedType = _wellNamedElements.get(0).getValueType(); List<ClassElement> _compatibleElements = new LinkedList<>(); for (ClassElement _element : _wellNamedElements) { List<ParameterDeclaration> _signatureParams = new LinkedList<>(((FunctionDeclaration)_element.getDeclaration()).getSignature().getParameters()); if (_signatureParams.size() != _parameters.size()) { continue; } List<Type> _signatureParamTypes = new LinkedList<>(); for (ParameterDeclaration _param : _signatureParams) { _signatureParamTypes.add(_param.getType()); } Boolean _compatible; if (_signatureParamTypes.equals(_parameters)) { return (ClassElement) _element; } else { int _indParam = 0; _compatible = true; for (_indParam = 0; _indParam < _parameters.size(); _indParam++) { // TODO : change following quick fix if (_signatureParamTypes.get(_indParam) instanceof GenericParameterType) { continue; } _compatible &= _parameters.get(_indParam).compatibleWith(_signatureParamTypes.get(_indParam)); } if (_compatible) { _compatibleElements.add(_element); } } } if (_compatibleElements.size() > 0) { return (ClassElement) _compatibleElements.get(0); } return null; } @Override public List<FunctionDeclaration> getConstructors() { List<FunctionDeclaration> _constructors = new LinkedList<>(); for (ClassElement _element : this.declaration.getElements()) { if (_element.getDeclaration() instanceof FunctionDeclaration) { if (_element.getDeclaration().getValueType() instanceof ConstructorType) { _constructors.add((FunctionDeclaration) _element.getDeclaration()); } } } return _constructors; } @Override public FunctionDeclaration getConstructor(List<Type> _parameters) { List<FunctionDeclaration> _constructors = new LinkedList<>(); for (ClassElement _element : this.declaration.getElements()) { if (_element.getDeclaration() instanceof FunctionDeclaration) { if ((_element.getDeclaration()).getValueType() instanceof ConstructorType) { _constructors.add((FunctionDeclaration) _element.getDeclaration()); } } } int _indParam; Type _t; FunctionType _wConst = new FunctionTypeImpl(new ConstructorTypeImpl(this.declaration), _parameters); for (FunctionDeclaration _currentConst : _constructors) { if (_currentConst.getType().equalsTo(_wConst)) { return _currentConst; } } return null; } @Override public List<VariableDeclaration> getAttributes() { List<VariableDeclaration> _attributes = new LinkedList<>(); for (ClassElement _element : this.declaration.getElements()) { if (_element.getDeclaration() instanceof VariableDeclaration) { _attributes.add((VariableDeclaration) _element.getDeclaration()); } } return _attributes; } @Override public ClassDeclaration getDeclaration() { return this.declaration; } }
7,211
0.598669
0.596589
209
33.502392
31.438574
156
false
false
0
0
0
0
0
0
0.301435
false
false
4
bc9f6232b252611a9ce8a52e2b4d7f8e6e096494
12,970,801,284,516
8e59135b7f320a76673e6031d02e6dec9e184483
/app/src/main/java/com/example/bhavikvashi/collegedocs/Utils.java
f90da54ceddefda4a078d33784884f31dc8ba859
[]
no_license
bhavikvashi1804/CollegeDocs
https://github.com/bhavikvashi1804/CollegeDocs
dc25d6197e579f665f795997816d3be8c7e9872b
b7d2f4290c589b5f2f79476c5843c15060aff078
refs/heads/master
2020-04-08T18:41:02.997000
2018-12-01T06:23:25
2018-12-01T06:23:25
159,619,809
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.bhavikvashi.collegedocs; import android.text.TextUtils; import android.util.Log; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; public final class Utils { public static final String LOG_TAG = Utils.class.getSimpleName(); public static List<Files> fetchEarthquakeData(String requestUrl) { URL url = createUrl(requestUrl); String jsonResponse = null; try { jsonResponse = makeHttpRequest(url); } catch (IOException e) { Log.e(LOG_TAG, "Error closing input stream", e); } List<Files> ob1 = extractFeatureFromJson(jsonResponse); return ob1; } private static URL createUrl(String stringUrl) { URL url = null; try { url = new URL(stringUrl); } catch (MalformedURLException e) { Log.e(LOG_TAG, "Error with creating URL ", e); } return url; } private static String makeHttpRequest(URL url) throws IOException { String jsonResponse = ""; // If the URL is null, then return early. if (url == null) { return jsonResponse; } HttpURLConnection urlConnection = null; InputStream inputStream = null; try { urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setReadTimeout(10000 /* milliseconds */); urlConnection.setConnectTimeout(15000 /* milliseconds */); urlConnection.setRequestMethod("GET"); urlConnection.connect(); if (urlConnection.getResponseCode() == 200) { inputStream = urlConnection.getInputStream(); jsonResponse = readFromStream(inputStream); } else { Log.e(LOG_TAG, "Error response code: " + urlConnection.getResponseCode()); } } catch (IOException e) { Log.e(LOG_TAG, "Problem retrieving the earthquake JSON results.", e); } finally { if (urlConnection != null) { urlConnection.disconnect(); } if (inputStream != null) { inputStream.close(); } } return jsonResponse; } /** * Convert the {@link InputStream} into a String which contains the * whole JSON response from the server. */ private static String readFromStream(InputStream inputStream) throws IOException { StringBuilder output = new StringBuilder(); if (inputStream != null) { InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.forName("UTF-8")); BufferedReader reader = new BufferedReader(inputStreamReader); String line = reader.readLine(); while (line != null) { output.append(line); line = reader.readLine(); } } return output.toString(); } private static List<Files> extractFeatureFromJson(String earthquakeJSON) { if (TextUtils.isEmpty(earthquakeJSON)) { return null; } List<Files> earthquakes = new ArrayList<>(); try { JSONObject baseJsonResponse = new JSONObject(earthquakeJSON); JSONArray earthquakeArray = baseJsonResponse.getJSONArray("records"); // For each earthquake in the earthquakeArray, create an {@link Earthquake} object for (int i = 0; i < earthquakeArray.length(); i++) { JSONObject currentFile = earthquakeArray.getJSONObject(i); String magnitude = currentFile.getString("Document"); String location = currentFile.getString("Link"); String subject=currentFile.getString("Subject"); Files f1 = new Files(subject,magnitude, location); // Add the new {@link Earthquake} to the list of earthquakes. earthquakes.add(f1); } } catch (JSONException e) { // If an error is thrown when executing any of the above statements in the "try" block, // catch the exception here, so the app doesn't crash. Print a log message // with the message from the exception. Log.e("QueryUtils", "Problem parsing the earthquake JSON results", e); } // Return the list of earthquakes return earthquakes; } }
UTF-8
Java
4,769
java
Utils.java
Java
[ { "context": "package com.example.bhavikvashi.collegedocs;\n\n\nimport android.text.TextUtils;\nimp", "end": 31, "score": 0.9523513913154602, "start": 20, "tag": "USERNAME", "value": "bhavikvashi" } ]
null
[]
package com.example.bhavikvashi.collegedocs; import android.text.TextUtils; import android.util.Log; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; public final class Utils { public static final String LOG_TAG = Utils.class.getSimpleName(); public static List<Files> fetchEarthquakeData(String requestUrl) { URL url = createUrl(requestUrl); String jsonResponse = null; try { jsonResponse = makeHttpRequest(url); } catch (IOException e) { Log.e(LOG_TAG, "Error closing input stream", e); } List<Files> ob1 = extractFeatureFromJson(jsonResponse); return ob1; } private static URL createUrl(String stringUrl) { URL url = null; try { url = new URL(stringUrl); } catch (MalformedURLException e) { Log.e(LOG_TAG, "Error with creating URL ", e); } return url; } private static String makeHttpRequest(URL url) throws IOException { String jsonResponse = ""; // If the URL is null, then return early. if (url == null) { return jsonResponse; } HttpURLConnection urlConnection = null; InputStream inputStream = null; try { urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setReadTimeout(10000 /* milliseconds */); urlConnection.setConnectTimeout(15000 /* milliseconds */); urlConnection.setRequestMethod("GET"); urlConnection.connect(); if (urlConnection.getResponseCode() == 200) { inputStream = urlConnection.getInputStream(); jsonResponse = readFromStream(inputStream); } else { Log.e(LOG_TAG, "Error response code: " + urlConnection.getResponseCode()); } } catch (IOException e) { Log.e(LOG_TAG, "Problem retrieving the earthquake JSON results.", e); } finally { if (urlConnection != null) { urlConnection.disconnect(); } if (inputStream != null) { inputStream.close(); } } return jsonResponse; } /** * Convert the {@link InputStream} into a String which contains the * whole JSON response from the server. */ private static String readFromStream(InputStream inputStream) throws IOException { StringBuilder output = new StringBuilder(); if (inputStream != null) { InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.forName("UTF-8")); BufferedReader reader = new BufferedReader(inputStreamReader); String line = reader.readLine(); while (line != null) { output.append(line); line = reader.readLine(); } } return output.toString(); } private static List<Files> extractFeatureFromJson(String earthquakeJSON) { if (TextUtils.isEmpty(earthquakeJSON)) { return null; } List<Files> earthquakes = new ArrayList<>(); try { JSONObject baseJsonResponse = new JSONObject(earthquakeJSON); JSONArray earthquakeArray = baseJsonResponse.getJSONArray("records"); // For each earthquake in the earthquakeArray, create an {@link Earthquake} object for (int i = 0; i < earthquakeArray.length(); i++) { JSONObject currentFile = earthquakeArray.getJSONObject(i); String magnitude = currentFile.getString("Document"); String location = currentFile.getString("Link"); String subject=currentFile.getString("Subject"); Files f1 = new Files(subject,magnitude, location); // Add the new {@link Earthquake} to the list of earthquakes. earthquakes.add(f1); } } catch (JSONException e) { // If an error is thrown when executing any of the above statements in the "try" block, // catch the exception here, so the app doesn't crash. Print a log message // with the message from the exception. Log.e("QueryUtils", "Problem parsing the earthquake JSON results", e); } // Return the list of earthquakes return earthquakes; } }
4,769
0.607884
0.6039
144
32.097221
27.439156
111
false
false
0
0
0
0
0
0
0.555556
false
false
4
b509f4fa4c25eb5e3dfadf1c2252bffbb0c9ef58
2,095,944,110,074
9d2a422c70f8bd5853bce25e1184e1ee95bba8f0
/src/com/kitri/board/guestbook/action/DeleteAction.java
ce84ccd1f958c11c81c7d8e287015008bc9ae3eb
[]
no_license
musiczoa/culturecenter
https://github.com/musiczoa/culturecenter
2f9a9d1d32cb377ed96014864cf7798bb3d55dac
535dd0ebab203d9c8c5160bbea655000be92a9ee
refs/heads/master
2021-01-20T12:01:06.158000
2014-05-16T09:05:45
2014-05-16T09:05:45
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kitri.board.guestbook.action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.kitri.action.Action; import com.kitri.board.model.GuestBookDto; import com.kitri.board.service.GuestBookServiceImpl; import com.kitri.util.StringCheck; public class DeleteAction implements Action { @Override public String action(HttpServletRequest request, HttpServletResponse response) { GuestBookDto guestbookDto= new GuestBookDto(); guestbookDto.setBcode(StringCheck.nullToZero(request.getParameter("bcode"))); guestbookDto.setSeq(StringCheck.nullToZero(request.getParameter("seq"))); int cnt=GuestBookServiceImpl.getInstance().deleteNotice(guestbookDto); return cnt == 0? "/community/guestbook/guestdeleteFail.jsp?" : "/community/guestbook/guestdeleteOk.jsp?"; } }
UTF-8
Java
903
java
DeleteAction.java
Java
[]
null
[]
package com.kitri.board.guestbook.action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.kitri.action.Action; import com.kitri.board.model.GuestBookDto; import com.kitri.board.service.GuestBookServiceImpl; import com.kitri.util.StringCheck; public class DeleteAction implements Action { @Override public String action(HttpServletRequest request, HttpServletResponse response) { GuestBookDto guestbookDto= new GuestBookDto(); guestbookDto.setBcode(StringCheck.nullToZero(request.getParameter("bcode"))); guestbookDto.setSeq(StringCheck.nullToZero(request.getParameter("seq"))); int cnt=GuestBookServiceImpl.getInstance().deleteNotice(guestbookDto); return cnt == 0? "/community/guestbook/guestdeleteFail.jsp?" : "/community/guestbook/guestdeleteOk.jsp?"; } }
903
0.748616
0.747508
24
35.708332
30.410358
111
false
false
0
0
0
0
0
0
0.541667
false
false
4
35937834086c381df7d306ddcf7821be292c5feb
5,823,975,720,512
d9b14f351f668b004c4cb05a10d09e7e85243317
/src/BaekJoon/_Before_Tagging/P1325_6.java
b1bb49ac13188429f5e422802a91fb733aeff2ac
[]
no_license
nn98/Algorithm
https://github.com/nn98/Algorithm
262cbe20c71ff9b5de292c244b95a2a0c25e5bd7
55b6db19cb9f2aa5c5056f5cabd2b22715b682fd
refs/heads/main
2023-08-17T04:39:41.236000
2023-08-16T13:04:34
2023-08-16T13:04:34
178,701,901
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package BaekJoon._Before_Tagging; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.StringTokenizer; public class P1325_6 { static int n,D[],p=0; static boolean N[][],H[]; static void o(int i) { int u=1; for(int j=0;j<n;j++) { if(N[i][j]) { if(D[j]==0)o(j); u+=D[j]; } } D[i]=u; } public static void main(String[] args) throws IOException { BufferedReader r=new BufferedReader(new InputStreamReader(System.in)); BufferedWriter w=new BufferedWriter(new OutputStreamWriter(System.out)); StringTokenizer t=new StringTokenizer(r.readLine()); n=Integer.parseInt(t.nextToken()); D=new int[n]; N=new boolean[n][n]; for(int m=Integer.parseInt(t.nextToken());m>0;m--) { t=new StringTokenizer(r.readLine()); int k=Integer.parseInt(t.nextToken())-1; N[Integer.parseInt(t.nextToken())-1][k]=true; } for(int i=0;i<n;i++) { if(D[i]==0)o(i); p=p>D[i]?p:D[i]; } for(int i=0;i<n;i++) if(D[i]==p) w.write(i+1+" "); w.flush(); } }
UTF-8
Java
1,112
java
P1325_6.java
Java
[]
null
[]
package BaekJoon._Before_Tagging; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.StringTokenizer; public class P1325_6 { static int n,D[],p=0; static boolean N[][],H[]; static void o(int i) { int u=1; for(int j=0;j<n;j++) { if(N[i][j]) { if(D[j]==0)o(j); u+=D[j]; } } D[i]=u; } public static void main(String[] args) throws IOException { BufferedReader r=new BufferedReader(new InputStreamReader(System.in)); BufferedWriter w=new BufferedWriter(new OutputStreamWriter(System.out)); StringTokenizer t=new StringTokenizer(r.readLine()); n=Integer.parseInt(t.nextToken()); D=new int[n]; N=new boolean[n][n]; for(int m=Integer.parseInt(t.nextToken());m>0;m--) { t=new StringTokenizer(r.readLine()); int k=Integer.parseInt(t.nextToken())-1; N[Integer.parseInt(t.nextToken())-1][k]=true; } for(int i=0;i<n;i++) { if(D[i]==0)o(i); p=p>D[i]?p:D[i]; } for(int i=0;i<n;i++) if(D[i]==p) w.write(i+1+" "); w.flush(); } }
1,112
0.651079
0.636691
43
24.88372
18.326761
74
false
false
0
0
0
0
0
0
2.581395
false
false
4
5368d8612e0231ccd90a3ecabda3323d53f18ee2
5,823,975,721,030
e72ff22d8ab728b2780c19cbfa24ea7edb1d6464
/src/main/java/com/calculator/app/Calculator.java
54945c8b5012781cc272ad0696d317850e5a265a
[]
no_license
mayurjain02/CalculatorDevOps
https://github.com/mayurjain02/CalculatorDevOps
5b57c66da6a1e80a1263593a5f18dfd9db25c6b1
ab3c785cf6324e37e5b4be9938c72cf53ed26d9f
refs/heads/master
2022-12-30T17:44:35.128000
2020-05-08T08:41:43
2020-05-08T08:41:43
256,180,748
0
0
null
false
2020-10-13T21:14:23
2020-04-16T10:21:08
2020-05-08T08:41:46
2020-10-13T21:14:22
10
0
0
1
Java
false
false
package com.calculator.app; import java.util.*; public class Calculator { private void addition(){ double num1,num2; Scanner reader = new Scanner(System.in); System.out.println("Addition"); System.out.println("Enter two numbers"); System.out.print("Enter number 1: "); num1 = reader.nextDouble(); System.out.print("Enter number 2: "); num2 = reader.nextDouble(); System.out.println(num1+num2); } private void subtraction(){ double num1,num2; Scanner reader = new Scanner(System.in); System.out.println("Subtraction"); System.out.println("Enter two numbers"); System.out.print("Enter number 1: "); num1 = reader.nextDouble(); System.out.print("Enter number 2: "); num2 = reader.nextDouble(); System.out.println(num1-num2); } private void multiplication(){ double num1,num2; Scanner reader = new Scanner(System.in); System.out.println("Multiplication"); System.out.println("Enter two numbers"); System.out.print("Enter number 1: "); num1 = reader.nextDouble(); System.out.print("Enter number 2: "); num2 = reader.nextDouble(); System.out.println(num1*num2); } private void division(){ double num1,num2; Scanner reader = new Scanner(System.in); System.out.println("Division"); System.out.println("Enter two numbers"); System.out.print("Enter number 1: "); num1 = reader.nextDouble(); System.out.print("Enter number 2: "); num2 = reader.nextDouble(); if(num2==0) System.out.println("Second Number cannot be zero... INVALID NUMBER"); else System.out.println(num1/num2); } public static void main(String args[]) { int flag=0,ch; Scanner reader = new Scanner(System.in); Calculator cal = new Calculator(); System.out.println("Calculator System"); do { System.out.println("Option Menu"); System.out.println(""); System.out.println("1) Addition"); System.out.println("2) Subtraction"); System.out.println("3) Multiplication"); System.out.println("4) Division"); System.out.println("5) Exit"); System.out.print("Enter your choice: "); ch = reader.nextInt(); if(ch==5) { flag = 1; } else { switch(ch) { case 1: cal.addition(); break; case 2: cal.subtraction(); break; case 3: cal.multiplication(); break; case 4: cal.division(); break; default: System.out.println("Exiting program due to invalid input"); flag=1; } } System.out.println(""); }while(flag==0); } }
UTF-8
Java
3,252
java
Calculator.java
Java
[]
null
[]
package com.calculator.app; import java.util.*; public class Calculator { private void addition(){ double num1,num2; Scanner reader = new Scanner(System.in); System.out.println("Addition"); System.out.println("Enter two numbers"); System.out.print("Enter number 1: "); num1 = reader.nextDouble(); System.out.print("Enter number 2: "); num2 = reader.nextDouble(); System.out.println(num1+num2); } private void subtraction(){ double num1,num2; Scanner reader = new Scanner(System.in); System.out.println("Subtraction"); System.out.println("Enter two numbers"); System.out.print("Enter number 1: "); num1 = reader.nextDouble(); System.out.print("Enter number 2: "); num2 = reader.nextDouble(); System.out.println(num1-num2); } private void multiplication(){ double num1,num2; Scanner reader = new Scanner(System.in); System.out.println("Multiplication"); System.out.println("Enter two numbers"); System.out.print("Enter number 1: "); num1 = reader.nextDouble(); System.out.print("Enter number 2: "); num2 = reader.nextDouble(); System.out.println(num1*num2); } private void division(){ double num1,num2; Scanner reader = new Scanner(System.in); System.out.println("Division"); System.out.println("Enter two numbers"); System.out.print("Enter number 1: "); num1 = reader.nextDouble(); System.out.print("Enter number 2: "); num2 = reader.nextDouble(); if(num2==0) System.out.println("Second Number cannot be zero... INVALID NUMBER"); else System.out.println(num1/num2); } public static void main(String args[]) { int flag=0,ch; Scanner reader = new Scanner(System.in); Calculator cal = new Calculator(); System.out.println("Calculator System"); do { System.out.println("Option Menu"); System.out.println(""); System.out.println("1) Addition"); System.out.println("2) Subtraction"); System.out.println("3) Multiplication"); System.out.println("4) Division"); System.out.println("5) Exit"); System.out.print("Enter your choice: "); ch = reader.nextInt(); if(ch==5) { flag = 1; } else { switch(ch) { case 1: cal.addition(); break; case 2: cal.subtraction(); break; case 3: cal.multiplication(); break; case 4: cal.division(); break; default: System.out.println("Exiting program due to invalid input"); flag=1; } } System.out.println(""); }while(flag==0); } }
3,252
0.500308
0.485547
105
29.980953
18.80374
84
false
false
0
0
0
0
0
0
1
false
false
4
c15054e54645af84686a9110c1aff3f4904b9f0d
18,794,776,952,632
220db0e6f66b9760980fa610e0efe64b478355cb
/archunit/src/test/java/com/tngtech/archunit/lang/extension/ArchUnitExtensionLoaderTest.java
5910cfe735f5eb48be9a53b6de559c7fc197db80
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
wolfs/ArchUnit
https://github.com/wolfs/ArchUnit
fa832ff6ae7b68748aa1ec724911a975273cc404
9316d617d0f31f9cf3c710a32e44f7cb81cd3b43
refs/heads/master
2023-03-10T23:41:40.282000
2021-11-08T06:25:58
2021-11-08T06:25:58
94,650,201
1
0
Apache-2.0
true
2023-03-02T16:01:36
2017-06-17T21:31:36
2022-03-22T05:50:55
2023-03-02T16:01:31
10,545
1
0
13
Java
false
false
package com.tngtech.archunit.lang.extension; import java.io.IOException; import java.util.Comparator; import java.util.regex.Pattern; import com.tngtech.archunit.lang.extension.examples.DummyTestExtension; import com.tngtech.archunit.lang.extension.examples.TestExtension; import com.tngtech.archunit.lang.extension.examples.TestExtensionWithIllegalIdentifier; import com.tngtech.archunit.lang.extension.examples.TestExtensionWithNullIdentifier; import com.tngtech.archunit.lang.extension.examples.TestExtensionWithSameIdentifier; import com.tngtech.archunit.lang.extension.examples.YetAnotherDummyTestExtension; import com.tngtech.archunit.testutil.LogTestRule; import org.apache.logging.log4j.Level; import org.hamcrest.Description; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeMatcher; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import static com.google.common.collect.Iterables.getOnlyElement; import static java.util.regex.Pattern.quote; import static org.assertj.core.api.Assertions.assertThat; public class ArchUnitExtensionLoaderTest { @Rule public final TestServicesFile testServicesFile = new TestServicesFile(); @Rule public final ExpectedException thrown = ExpectedException.none(); @Rule public final LogTestRule logTestRule = new LogTestRule(); private ArchUnitExtensionLoader extensionLoader = new ArchUnitExtensionLoader(); @Test public void loads_a_single_extension() throws IOException { testServicesFile.addService(TestExtension.class); Iterable<ArchUnitExtension> extensions = extensionLoader.getAll(); assertThat(getOnlyElement(extensions)).isInstanceOf(TestExtension.class); } @Test public void caches_loaded_extensions() { testServicesFile.addService(TestExtension.class); Iterable<ArchUnitExtension> first = extensionLoader.getAll(); Iterable<ArchUnitExtension> second = extensionLoader.getAll(); assertThat(first).usingElementComparator(sameInstance()).hasSameElementsAs(second); } @Test public void loads_multiple_extensions() throws IOException { testServicesFile.addService(TestExtension.class); testServicesFile.addService(DummyTestExtension.class); testServicesFile.addService(YetAnotherDummyTestExtension.class); Iterable<ArchUnitExtension> extensions = extensionLoader.getAll(); assertThat(extensions) .hasSize(3) .hasAtLeastOneElementOfType(TestExtension.class) .hasAtLeastOneElementOfType(DummyTestExtension.class) .hasAtLeastOneElementOfType(YetAnotherDummyTestExtension.class); } @Test public void rejects_null_extension_identifier() { testServicesFile.addService(TestExtensionWithNullIdentifier.class); thrown.expect(ExtensionLoadingException.class); thrown.expectMessage("identifier"); thrown.expectMessage("null"); thrown.expectMessage(containingWord(TestExtensionWithNullIdentifier.class.getName())); extensionLoader.getAll(); } @Test public void rejects_illegal_characters_in_extension_identifier() { testServicesFile.addService(TestExtensionWithIllegalIdentifier.class); thrown.expect(ExtensionLoadingException.class); thrown.expectMessage("identifier"); thrown.expectMessage("'.'"); thrown.expectMessage(containingWord(TestExtensionWithIllegalIdentifier.class.getName())); extensionLoader.getAll(); } @Test public void rejects_non_unique_extension_identifier() { testServicesFile.addService(TestExtension.class); testServicesFile.addService(TestExtensionWithSameIdentifier.class); thrown.expect(ExtensionLoadingException.class); thrown.expectMessage("must be unique"); thrown.expectMessage(TestExtension.UNIQUE_IDENTIFIER); thrown.expectMessage(containingWord(TestExtension.class.getName())); thrown.expectMessage(containingWord(TestExtensionWithSameIdentifier.class.getName())); extensionLoader.getAll(); } @Test public void logs_discovered_extensions() { testServicesFile.addService(TestExtension.class); testServicesFile.addService(DummyTestExtension.class); logTestRule.watch(ArchUnitExtensionLoader.class, Level.INFO); extensionLoader.getAll(); logTestRule.assertLogMessage(Level.INFO, expectedExtensionLoadedMessage(TestExtension.UNIQUE_IDENTIFIER)); logTestRule.assertLogMessage(Level.INFO, expectedExtensionLoadedMessage(DummyTestExtension.UNIQUE_IDENTIFIER)); } private String expectedExtensionLoadedMessage(String identifier) { return "Loaded " + ArchUnitExtension.class.getSimpleName() + " with id '" + identifier + "'"; } private Matcher<String> containingWord(final String word) { final Pattern wordPattern = Pattern.compile(" " + quote(word) + "[: ]"); return new TypeSafeMatcher<String>() { @Override protected boolean matchesSafely(String item) { return wordPattern.matcher(item).find(); } @Override public void describeTo(Description description) { description.appendText(String.format("containing word '%s'", word)); } }; } private static Comparator<Object> sameInstance() { return new Comparator<Object>() { @Override public int compare(Object o1, Object o2) { return o1 == o2 ? 0 : -1; } }; } }
UTF-8
Java
5,650
java
ArchUnitExtensionLoaderTest.java
Java
[]
null
[]
package com.tngtech.archunit.lang.extension; import java.io.IOException; import java.util.Comparator; import java.util.regex.Pattern; import com.tngtech.archunit.lang.extension.examples.DummyTestExtension; import com.tngtech.archunit.lang.extension.examples.TestExtension; import com.tngtech.archunit.lang.extension.examples.TestExtensionWithIllegalIdentifier; import com.tngtech.archunit.lang.extension.examples.TestExtensionWithNullIdentifier; import com.tngtech.archunit.lang.extension.examples.TestExtensionWithSameIdentifier; import com.tngtech.archunit.lang.extension.examples.YetAnotherDummyTestExtension; import com.tngtech.archunit.testutil.LogTestRule; import org.apache.logging.log4j.Level; import org.hamcrest.Description; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeMatcher; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import static com.google.common.collect.Iterables.getOnlyElement; import static java.util.regex.Pattern.quote; import static org.assertj.core.api.Assertions.assertThat; public class ArchUnitExtensionLoaderTest { @Rule public final TestServicesFile testServicesFile = new TestServicesFile(); @Rule public final ExpectedException thrown = ExpectedException.none(); @Rule public final LogTestRule logTestRule = new LogTestRule(); private ArchUnitExtensionLoader extensionLoader = new ArchUnitExtensionLoader(); @Test public void loads_a_single_extension() throws IOException { testServicesFile.addService(TestExtension.class); Iterable<ArchUnitExtension> extensions = extensionLoader.getAll(); assertThat(getOnlyElement(extensions)).isInstanceOf(TestExtension.class); } @Test public void caches_loaded_extensions() { testServicesFile.addService(TestExtension.class); Iterable<ArchUnitExtension> first = extensionLoader.getAll(); Iterable<ArchUnitExtension> second = extensionLoader.getAll(); assertThat(first).usingElementComparator(sameInstance()).hasSameElementsAs(second); } @Test public void loads_multiple_extensions() throws IOException { testServicesFile.addService(TestExtension.class); testServicesFile.addService(DummyTestExtension.class); testServicesFile.addService(YetAnotherDummyTestExtension.class); Iterable<ArchUnitExtension> extensions = extensionLoader.getAll(); assertThat(extensions) .hasSize(3) .hasAtLeastOneElementOfType(TestExtension.class) .hasAtLeastOneElementOfType(DummyTestExtension.class) .hasAtLeastOneElementOfType(YetAnotherDummyTestExtension.class); } @Test public void rejects_null_extension_identifier() { testServicesFile.addService(TestExtensionWithNullIdentifier.class); thrown.expect(ExtensionLoadingException.class); thrown.expectMessage("identifier"); thrown.expectMessage("null"); thrown.expectMessage(containingWord(TestExtensionWithNullIdentifier.class.getName())); extensionLoader.getAll(); } @Test public void rejects_illegal_characters_in_extension_identifier() { testServicesFile.addService(TestExtensionWithIllegalIdentifier.class); thrown.expect(ExtensionLoadingException.class); thrown.expectMessage("identifier"); thrown.expectMessage("'.'"); thrown.expectMessage(containingWord(TestExtensionWithIllegalIdentifier.class.getName())); extensionLoader.getAll(); } @Test public void rejects_non_unique_extension_identifier() { testServicesFile.addService(TestExtension.class); testServicesFile.addService(TestExtensionWithSameIdentifier.class); thrown.expect(ExtensionLoadingException.class); thrown.expectMessage("must be unique"); thrown.expectMessage(TestExtension.UNIQUE_IDENTIFIER); thrown.expectMessage(containingWord(TestExtension.class.getName())); thrown.expectMessage(containingWord(TestExtensionWithSameIdentifier.class.getName())); extensionLoader.getAll(); } @Test public void logs_discovered_extensions() { testServicesFile.addService(TestExtension.class); testServicesFile.addService(DummyTestExtension.class); logTestRule.watch(ArchUnitExtensionLoader.class, Level.INFO); extensionLoader.getAll(); logTestRule.assertLogMessage(Level.INFO, expectedExtensionLoadedMessage(TestExtension.UNIQUE_IDENTIFIER)); logTestRule.assertLogMessage(Level.INFO, expectedExtensionLoadedMessage(DummyTestExtension.UNIQUE_IDENTIFIER)); } private String expectedExtensionLoadedMessage(String identifier) { return "Loaded " + ArchUnitExtension.class.getSimpleName() + " with id '" + identifier + "'"; } private Matcher<String> containingWord(final String word) { final Pattern wordPattern = Pattern.compile(" " + quote(word) + "[: ]"); return new TypeSafeMatcher<String>() { @Override protected boolean matchesSafely(String item) { return wordPattern.matcher(item).find(); } @Override public void describeTo(Description description) { description.appendText(String.format("containing word '%s'", word)); } }; } private static Comparator<Object> sameInstance() { return new Comparator<Object>() { @Override public int compare(Object o1, Object o2) { return o1 == o2 ? 0 : -1; } }; } }
5,650
0.724956
0.72354
145
37.972412
31.614912
119
false
false
0
0
0
0
0
0
0.517241
false
false
4
05c6d97e499fd78487c376512c06f60fe8ace7f3
10,496,900,113,029
17864ed8a05fac961cbf909af0404c2f604339a1
/src/序列化/Test2.java
422c6bfef55b53f8281f5945b92345b242f76ec0
[ "MIT" ]
permissive
coderlongren/Leetcode
https://github.com/coderlongren/Leetcode
bc35d61edf9f782aeca16af3332031f2c9db19e2
c1e45fcb42b6d605c11210599b64d58c39eeb51a
refs/heads/master
2018-10-12T00:37:30.213000
2018-09-08T15:18:49
2018-09-08T15:18:49
107,770,195
2
0
null
false
2017-12-12T04:30:06
2017-10-21T10:10:46
2017-12-10T14:24:22
2017-12-12T04:30:05
526
0
0
0
Java
false
null
package 序列化; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import java.util.Date; /** * @author 作者 : coderlong * @version 创建时间:2018年1月1日 下午4:17:57 * 类说明: */ public class Test2 { public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException { // TODO Auto-generated method stub ObjectInputStream in = new ObjectInputStream(new FileInputStream("E:\\Ehcache\\object.obj")); String string = (String)in.readObject(); System.out.println(string); Date date = (Date)in.readObject(); System.out.println(date.toString()); } }
GB18030
Java
729
java
Test2.java
Java
[ { "context": "Stream;\nimport java.util.Date;\n\n/**\n* @author 作者 : coderlong\n* @version 创建时间:2018年1月1日 下午4:17:57\n* 类说明: \n*/\npu", "end": 226, "score": 0.9997022151947021, "start": 217, "tag": "USERNAME", "value": "coderlong" } ]
null
[]
package 序列化; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import java.util.Date; /** * @author 作者 : coderlong * @version 创建时间:2018年1月1日 下午4:17:57 * 类说明: */ public class Test2 { public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException { // TODO Auto-generated method stub ObjectInputStream in = new ObjectInputStream(new FileInputStream("E:\\Ehcache\\object.obj")); String string = (String)in.readObject(); System.out.println(string); Date date = (Date)in.readObject(); System.out.println(date.toString()); } }
729
0.751804
0.734488
26
25.653847
26.288258
107
false
false
0
0
0
0
0
0
1.076923
false
false
4
51de36c519e8b6d34d6f966cc60ee938ebd9548e
3,770,981,353,325
6c0a49f0c2a302336708d8d45a8bd42ef5aa0bd7
/app/src/main/java/dk/kultur/historiejagtenfyn/data/sql/Columns/JoinColumns.java
aea51f4c36dd4de8bc565aee44010b95e938736b
[]
no_license
mskyblue/Android-app_StoryHuntFyn
https://github.com/mskyblue/Android-app_StoryHuntFyn
276bb99b274f8923ffd02b14607c04d675e732af
a4d0d220e2d54a9b5a9b3f1e58bf02273b9b5cb1
refs/heads/master
2021-01-01T17:03:10.060000
2017-07-10T12:40:58
2017-07-10T12:40:58
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dk.kultur.historiejagtenfyn.data.sql.Columns; /** * Created by JustinasK on 2/24/2015. */ public interface JoinColumns { public static final String COLUMN_OWNER = "owning_id"; public static final String COLUMN_RELATED = "related_id"; }
UTF-8
Java
255
java
JoinColumns.java
Java
[ { "context": "oriejagtenfyn.data.sql.Columns;\n\n/**\n * Created by JustinasK on 2/24/2015.\n */\npublic interface JoinColum", "end": 77, "score": 0.553399384021759, "start": 73, "tag": "NAME", "value": "Just" }, { "context": "agtenfyn.data.sql.Columns;\n\n/**\n * Created by JustinasK on 2/24/2015.\n */\npublic interface JoinColumns {\n", "end": 82, "score": 0.9443612098693848, "start": 77, "tag": "USERNAME", "value": "inasK" } ]
null
[]
package dk.kultur.historiejagtenfyn.data.sql.Columns; /** * Created by JustinasK on 2/24/2015. */ public interface JoinColumns { public static final String COLUMN_OWNER = "owning_id"; public static final String COLUMN_RELATED = "related_id"; }
255
0.729412
0.701961
9
27.333334
24.626093
61
false
false
0
0
0
0
0
0
0.333333
false
false
4
442c042d7b5246a0dc957c5b8a0e51e05153b4cf
19,404,662,278,526
a192e6cff31fe3ba73ed8a31fb9c7a4c83eb850f
/java/src/shared/communication/GameModelParam.java
f79f5c3e8790bdd5b5a42e43a084408ce6a7503a
[]
no_license
abe-austin/Catan
https://github.com/abe-austin/Catan
3bc2406b6c7221960b435bbd45e07ba59759ebfb
2c315c6e104e3b3c6ae5a4786a578854d60abc3d
refs/heads/master
2021-03-12T22:45:30.784000
2014-08-11T04:46:40
2014-08-11T04:46:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package shared.communication; import game.GameModel; public class GameModelParam { GameModel gameModel; public GameModelParam() { this.gameModel = new GameModel(); } public GameModelParam(GameModel gameModel) { super(); this.gameModel = gameModel; } public GameModel getGameModel() { return gameModel; } public void setGameModel(GameModel gameModel) { this.gameModel = gameModel; } }
UTF-8
Java
414
java
GameModelParam.java
Java
[]
null
[]
package shared.communication; import game.GameModel; public class GameModelParam { GameModel gameModel; public GameModelParam() { this.gameModel = new GameModel(); } public GameModelParam(GameModel gameModel) { super(); this.gameModel = gameModel; } public GameModel getGameModel() { return gameModel; } public void setGameModel(GameModel gameModel) { this.gameModel = gameModel; } }
414
0.729469
0.729469
26
14.923077
15.647371
48
false
false
0
0
0
0
0
0
1.153846
false
false
4
79f23e98f3af7cb1cf69b93454a8539a6d5485ac
2,327,872,277,208
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_5648941810974720_0/java/sunnyn/CodeJam2016R1BP1.java
43732f0c3f95a55f7c8fe13996c4b664ffd89be7
[]
no_license
alexandraback/datacollection
https://github.com/alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417000
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class CodeJam2016R1BP1 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int T = Integer.parseInt(br.readLine()); for(int caseid=1; caseid<=T; caseid++) { String s = br.readLine(); int count[] = new int[255]; for(int i = 0; i < s.length(); i++) { count[s.charAt(i)]++; } int digits[] = new int[10]; int numzero = count['Z']; digits[0] = numzero; count['Z'] -= numzero; count['E'] -= numzero; count['R'] -= numzero; count['O'] -= numzero; int numtwo = count['W']; digits[2] = numtwo; count['T'] -= numtwo; count['W'] -= numtwo; count['O'] -= numtwo; int numsix = count['X']; digits[6] = numsix; count['S'] -= numsix; count['I'] -= numsix; count['X'] -= numsix; int numeight = count['G']; digits[8] = numeight; count['E'] -= numeight; count['I'] -= numeight; count['G'] -= numeight; count['H'] -= numeight; count['T'] -= numeight; int numfour = count['U']; digits[4] = numfour; count['F'] -= numfour; count['O'] -= numfour; count['U'] -= numfour; count['R'] -= numfour; int nt = count['H']; digits[3] = nt; count['T'] -= nt; count['H'] -= nt; count['R'] -= nt; count['E'] -= nt; count['E'] -= nt; int f = count['F']; digits[5] = f; count['F'] -= f; count['I'] -= f; count['V'] -= f; count['E'] -= f; f = count['S']; digits[7] = f; count['S'] -= f; count['E'] -= f; count['V'] -= f; count['E'] -= f; count['N'] -= f; f = count['O']; digits[1] = f; count['O'] -= f; count['N'] -= f; count['E'] -= f; f = count['I']; digits[9] = f; count['N'] -= f; count['I'] -= f; count['N'] -= f; count['E'] -= f; System.out.print("Case #"+caseid + ": "); for(int i = 0; i < 10; i++) { for(int j = 0; j < digits[i]; j++) { System.out.print(i); } } System.out.println(); } } }
UTF-8
Java
2,257
java
CodeJam2016R1BP1.java
Java
[]
null
[]
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class CodeJam2016R1BP1 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int T = Integer.parseInt(br.readLine()); for(int caseid=1; caseid<=T; caseid++) { String s = br.readLine(); int count[] = new int[255]; for(int i = 0; i < s.length(); i++) { count[s.charAt(i)]++; } int digits[] = new int[10]; int numzero = count['Z']; digits[0] = numzero; count['Z'] -= numzero; count['E'] -= numzero; count['R'] -= numzero; count['O'] -= numzero; int numtwo = count['W']; digits[2] = numtwo; count['T'] -= numtwo; count['W'] -= numtwo; count['O'] -= numtwo; int numsix = count['X']; digits[6] = numsix; count['S'] -= numsix; count['I'] -= numsix; count['X'] -= numsix; int numeight = count['G']; digits[8] = numeight; count['E'] -= numeight; count['I'] -= numeight; count['G'] -= numeight; count['H'] -= numeight; count['T'] -= numeight; int numfour = count['U']; digits[4] = numfour; count['F'] -= numfour; count['O'] -= numfour; count['U'] -= numfour; count['R'] -= numfour; int nt = count['H']; digits[3] = nt; count['T'] -= nt; count['H'] -= nt; count['R'] -= nt; count['E'] -= nt; count['E'] -= nt; int f = count['F']; digits[5] = f; count['F'] -= f; count['I'] -= f; count['V'] -= f; count['E'] -= f; f = count['S']; digits[7] = f; count['S'] -= f; count['E'] -= f; count['V'] -= f; count['E'] -= f; count['N'] -= f; f = count['O']; digits[1] = f; count['O'] -= f; count['N'] -= f; count['E'] -= f; f = count['I']; digits[9] = f; count['N'] -= f; count['I'] -= f; count['N'] -= f; count['E'] -= f; System.out.print("Case #"+caseid + ": "); for(int i = 0; i < 10; i++) { for(int j = 0; j < digits[i]; j++) { System.out.print(i); } } System.out.println(); } } }
2,257
0.483385
0.471422
100
20.57
12.381643
75
false
false
0
0
0
0
0
0
3.47
false
false
4
9415b7c75f1fcfa9f52038db9b14f72c70ab156d
1,623,497,708,966
2ec4f38391b0556f6955f92c58a30c3179227595
/Linked List/src/linked_list/SearchNode.java
3e6279d176cc03fdadfafbd9e0a9d11880612e95
[]
no_license
rosenfeltc/Linked-List
https://github.com/rosenfeltc/Linked-List
7b15187059b1efe951088cfddd8741da8948b018
4b810634236b806c316561f352fa55b5bfedb16d
refs/heads/master
2021-01-01T18:57:09.724000
2017-08-02T13:25:01
2017-08-02T13:25:01
98,467,895
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* This is the SearchNode class for the Bonus part of the homework. Very similar in structure to the regular homework except for the addition of * 4 different Node pointers that help improve the speed/efficiency of the search process. * Coded by Christopher Rosenfelt for CSI 213 */ package linked_list; import java.io.File; import java.io.IOException; import java.util.Scanner; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.filechooser.FileNameExtensionFilter; public class SearchNode { // Global variables public static SearchNode list = new SearchNode(); public static String[] options = {"Scroll Pane", "Search", "Exit"}; // Main method to allow the user to open the file public static void main(String[] args) { JOptionPane.showMessageDialog(null, "Please select the studentinfo.csv file from the correct directory"); JFileChooser fileChooser = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter("Comma Separated Value", "csv"); fileChooser.setFileFilter(filter); fileChooser.showOpenDialog(fileChooser); File toOpen = fileChooser.getSelectedFile(); String[] data = new String[3]; try { Scanner fileScanner = new Scanner(toOpen); while(fileScanner.hasNextLine()) { data = fileScanner.nextLine().split(","); list.add(data[0], data[1], Integer.parseInt(data[2])); } fileScanner.close(); } catch(IOException e) { e.printStackTrace(); } mainMenu(); }// End of Main public static void mainMenu() { // Display the three different options to the user and execute the selection int selection = JOptionPane.showOptionDialog(null, "Please select an option", "Linked List", 0, 2, null, options, 0); // Display list in a ScrollPane window if(selection == 0) { SearchNodeWindow newWindow = new SearchNodeWindow(list.display()); } // Allow the user to search by last name else if(selection == 1) { // Obtain the last name of the student we want to search for JOptionPane.showMessageDialog(null, "Let's search for a student by last name!"); String name = JOptionPane.showInputDialog("Please provide the student's last name: "); // Use the search method from LinkedList class to search for the student, the method is not case sensitive if(list.search(name)) { JOptionPane.showMessageDialog(null, "The student by the last name " + name + " was found in the list!"); } else { JOptionPane.showMessageDialog(null, "The student by the last name " + name + " was not found in the list!"); } mainMenu(); } // Exit else { System.exit(0); } }// End of mainMenu method // SearchNode fields // The four different Node references and an int variable to keep track of the size of the Linked-List private Node first, second, third, last; private int size; // Constructor public SearchNode() { this.first = null; this.second = null; this.third = null; this.last = null; this.size = 0; } // Getter private int getSize() { return this.size; } // Setter private void setSize(int size) { this.size = size; } // Is the list empty? private boolean isEmpty() { return getSize() == 0; } // Getter private Node getFirst() { return this.first; } // Setter private void setFirst(Node first) { this.first = first; } // Getter private Node getSecond() { return this.second; } // Setter private void setSecond(Node second) { this.second = second; } // Getter private Node getThird() { return this.third; } // Setter private void setThird(Node third) { this.third = third; } // Getter private Node getLast() { return this.last; } // Setter private void setLast(Node last) { this.last = last; } // Add method that takes as input the string name, string major and int id, creates a new Student Node with it // and adds it to the list in alphabetical order, uses the faster search method when the size of the list is 4 or more public void add(String name, String major, int id) { Node newNode = new Node(name, major, id); // List is empty so add the new Student Node if(isEmpty()) { setFirst(newNode); setSize(getSize() + 1); // Keep track of the size of the list } // Size of the linked list is less than 4 so use the regular linear search else if(getSize() < 4) { Node traverse = search(newNode); setSize(getSize() + 1); // Special case scenario when the list contains one Student Node if(traverse == getFirst() && traverse.getNext() == null) { // We have to check to see if the new student Node should go before or after the only node in the list // New Node goes after the first Node if(name.compareToIgnoreCase(traverse.getName()) > 0) { newNode.setPrevious(traverse); traverse.setNext(newNode); } // New Node goes at the beginning of the list else { setFirst(newNode); newNode.setNext(traverse); traverse.setPrevious(newNode); } } // Special case of insertion at the beginning of the list else if(traverse == getFirst()) { newNode.setNext(first); first.setPrevious(newNode); setFirst(newNode); } // Special case insertion potentially at the end of the list else if(traverse.getNext() == null) { // Insertion at end of the list if(newNode.getName().compareToIgnoreCase(traverse.getName()) >= 0) { newNode.setPrevious(traverse); traverse.setNext(newNode); } // Insertion before the last node in the list else { newNode.setPrevious(traverse.getPrevious()); newNode.setNext(traverse); traverse.getPrevious().setNext(newNode); traverse.setPrevious(newNode); } } // Insertion anywhere else in the list else { newNode.setNext(traverse); newNode.setPrevious(traverse.getPrevious()); traverse.getPrevious().setNext(newNode); traverse.setPrevious(newNode); } // Special case in which we have exactly 4 Nodes and can have each reference point to each respective Node if(getSize() == 4) { setSecond(first.getNext()); setThird(second.getNext()); setLast(third.getNext()); } } // Size is greater than 4 with the current addition else { Node traverse = search(newNode); setSize(getSize() + 1); // Special case insertion at the beginning of the list if(traverse == getFirst()) { newNode.setNext(first); first.setPrevious(newNode); setFirst(newNode); // make sure to update the first Node reference accordingly } // Special case insertion potentially at end of the list else if(traverse.getNext() == null) { // Insertion at the end of the list if(newNode.getName().compareToIgnoreCase(traverse.getName()) >= 0) { newNode.setPrevious(traverse); traverse.setNext(newNode); setLast(newNode); // make sure to update the last Node reference accordingly } // Insertion right before the last node in the list else { newNode.setPrevious(traverse.getPrevious()); newNode.setNext(traverse); traverse.getPrevious().setNext(newNode); traverse.setPrevious(newNode); } } // Insertion anywhere else in the list else { newNode.setNext(traverse); newNode.setPrevious(traverse.getPrevious()); traverse.getPrevious().setNext(newNode); traverse.setPrevious(newNode); } // Updating the reference variables depending on where the new node was inserted so // as to have an approximately equal spacing between the reference Nodes keeping in mind // that the first and last nodes are previously updated if necessary //Insertion happened between the first and second reference nodes if(traverse.getName().compareToIgnoreCase(second.getName()) < 0) { setSecond(second.getPrevious()); setThird(third.getPrevious()); } // Insertion happened between the second and third reference nodes else if(traverse.getName().compareToIgnoreCase(third.getName()) < 0) { setSecond(second.getNext()); } // Insertion happened between the third and last reference nodes else if(traverse.getName().compareToIgnoreCase(last.getName()) < 0) { setThird(third.getNext()); } } } // Search method that uses 4 reference variables once the size of the list is 4 or more, this search method is used in conjunction // with the add method to specifically add new Student Nodes in alphabetical order public Node search(Node newNode) { Node traverse; // If the size of the list is less than 4 then just find the position with regular linear search from the beginning of the list if(getSize() < 4) { traverse = getFirst(); while(traverse.getNext() != null && newNode.getName().compareToIgnoreCase(traverse.getName()) >= 0) { traverse = traverse.getNext(); } return traverse; } // Size of the list is 4 or greater so incorporate all 4 reference nodes in order to speed up the search else { // Student node should be inserted between first and second reference nodes (inclusive) if(newNode.getName().compareToIgnoreCase(second.getName()) <= 0) { // Checking to see if it's faster to start at the first node going left to right if((Math.abs(newNode.getName().compareToIgnoreCase(first.getName()))) <= (Math.abs(newNode.getName().compareToIgnoreCase(second.getName())))) { traverse = getFirst(); while(traverse.getNext() != null && newNode.getName().compareToIgnoreCase(traverse.getName()) >= 0) { traverse = traverse.getNext(); } } // Faster to start at the second node going right to left else { traverse = getSecond(); while(traverse.getPrevious() != null && newNode.getName().compareToIgnoreCase(traverse.getPrevious().getName()) < 0) { traverse = traverse.getPrevious(); } } return traverse; } // Student node should be inserted between second and third reference nodes (inclusive) else if(newNode.getName().compareToIgnoreCase(third.getName()) <= 0) { // Check to see if faster to start at second Node going left to right if((Math.abs(newNode.getName().compareToIgnoreCase(second.getName()))) <= (Math.abs(newNode.getName().compareToIgnoreCase(third.getName())))) { traverse = getSecond(); while(traverse.getNext() != null && newNode.getName().compareToIgnoreCase(traverse.getName()) >= 0) { traverse = traverse.getNext(); } } // faster to start at third node going right to left else { traverse = getThird(); while(traverse.getPrevious() != null && newNode.getName().compareToIgnoreCase(traverse.getPrevious().getName()) < 0) { traverse = traverse.getPrevious(); } } return traverse; } // Student node should be inserted between third and last reference nodes (inclusive) else if(newNode.getName().compareToIgnoreCase(last.getName()) <= 0) { // Faster to start at third refernce node going left to right if((Math.abs(newNode.getName().compareToIgnoreCase(third.getName()))) <= (Math.abs(newNode.getName().compareToIgnoreCase(last.getName())))) { traverse = getThird(); while(traverse.getNext() != null && newNode.getName().compareToIgnoreCase(traverse.getName()) >= 0) { traverse = traverse.getNext(); } } // Faster to start at last reference node going right to left else { traverse = getLast(); while(traverse.getPrevious() != null && newNode.getName().compareToIgnoreCase(traverse.getPrevious().getName()) < 0) { traverse = traverse.getPrevious(); } } // Return the Node reference to which the new Node should be inserted right before of return traverse; } else { return getLast(); } } } // Search method that is very similar to the prior search method except that it takes in a String name // that is used to search the Linked List and returns a boolean as a way to let the user know if the // Node with the passed in name was found or not found in the list public boolean search(String name) { Node traverse; // Size is less than 4 so just use the regular way of traversing through the list if(getSize() < 4) { traverse = getFirst(); while(traverse != null && name.compareToIgnoreCase(traverse.getName()) >= 0) { if(name.equalsIgnoreCase(traverse.getName())) { return true; } traverse = traverse.getNext(); } return false; } // Size of the list is bigger than 4 so check through the 4 reference nodes to find // the most efficient way to search for the name in the list else { // Name would lexicographically be located between the first and second reference nodes (inclusive) if(name.compareToIgnoreCase(second.getName()) <= 0) { // Faster to start at the first node and search left to right if((Math.abs(name.compareToIgnoreCase(first.getName()))) <= (Math.abs(name.compareToIgnoreCase(second.getName())))) { traverse = getFirst(); while(traverse != null && name.compareToIgnoreCase(traverse.getName()) >= 0) { // name found in the list return true if(name.equalsIgnoreCase(traverse.getName())) { return true; } traverse = traverse.getNext(); } } // Faster to start at the second node and search right to left else { traverse = getSecond(); while(traverse != null && name.compareToIgnoreCase(traverse.getName()) <= 0) { // Name found in the list return true if(name.equalsIgnoreCase(traverse.getName())) { return true; } traverse = traverse.getPrevious(); } } // Name not found return false return false; } // Name would lexicographically be located between the second and third reference nodes (inclusive) else if(name.compareToIgnoreCase(third.getName()) <= 0) { // Faster to start at the second node and search left to right if((Math.abs(name.compareToIgnoreCase(second.getName()))) <= (Math.abs(name.compareToIgnoreCase(third.getName())))) { traverse = getSecond(); while(traverse != null && name.compareToIgnoreCase(traverse.getName()) >= 0) { // Name found in the list return true if(name.equalsIgnoreCase(traverse.getName())) { return true; } traverse = traverse.getNext(); } } // Faster to start at the third node and search right to left else { traverse = getThird(); while(traverse != null && name.compareToIgnoreCase(traverse.getName()) <= 0) { // Name found in the list return true if(name.equalsIgnoreCase(traverse.getName())) { return true; } traverse = traverse.getPrevious(); } } // Name not found return false return false; } else { // Name would lexicographically be located between the third and last reference nodes (inclusive) if((Math.abs(name.compareToIgnoreCase(third.getName()))) <= (Math.abs(name.compareToIgnoreCase(last.getName())))) { traverse = getThird(); while(traverse != null && name.compareToIgnoreCase(traverse.getName()) >= 0) { // Name found in the list return true if(name.equalsIgnoreCase(traverse.getName())) { return true; } traverse = traverse.getNext(); } } else { traverse = getLast(); while(traverse != null && name.compareToIgnoreCase(traverse.getName()) <= 0) { // Name found in the list return true if(name.equalsIgnoreCase(traverse.getName())) { return true; } traverse = traverse.getPrevious(); } } // Name not found in the list return false return false; } } } // Method that traverse through the entire list, adding a newline string out of each Node's fields to ultimately return // a String that could be then used to display the entire list public String display() { Node traverse = getFirst(); String content = new String(); while(traverse != null) { content += traverse.getName() + " " + traverse.getMajor() + " " + traverse.getID() + "\n"; traverse = traverse.getNext(); } return content; } // Private node class private class Node { // Node variables, doubly linked list so both a next and previous Node reference private String name, major; private int id; Node next, previous; // Constructor private Node(String name, String major, int id) { this.name = name; this.major = major; this.id = id; this.next = null; this.previous = null; } // Getter private String getName() { return this.name; } // Getter private String getMajor() { return this.major; } // Getter private int getID() { return this.id; } // Setter private void setNext(Node next) { this.next = next; } // Getter private Node getNext() { return this.next; } // Setter private void setPrevious(Node previous) { this.previous = previous; } // Getter private Node getPrevious() { return this.previous; } } }
UTF-8
Java
18,000
java
SearchNode.java
Java
[ { "context": "eed/efficiency of the search process.\r\n * Coded by Christopher Rosenfelt for CSI 213\r\n */\r\npackage linked_list;\r\n\r\nimport ", "end": 271, "score": 0.9998946785926819, "start": 250, "tag": "NAME", "value": "Christopher Rosenfelt" } ]
null
[]
/* This is the SearchNode class for the Bonus part of the homework. Very similar in structure to the regular homework except for the addition of * 4 different Node pointers that help improve the speed/efficiency of the search process. * Coded by <NAME> for CSI 213 */ package linked_list; import java.io.File; import java.io.IOException; import java.util.Scanner; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.filechooser.FileNameExtensionFilter; public class SearchNode { // Global variables public static SearchNode list = new SearchNode(); public static String[] options = {"Scroll Pane", "Search", "Exit"}; // Main method to allow the user to open the file public static void main(String[] args) { JOptionPane.showMessageDialog(null, "Please select the studentinfo.csv file from the correct directory"); JFileChooser fileChooser = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter("Comma Separated Value", "csv"); fileChooser.setFileFilter(filter); fileChooser.showOpenDialog(fileChooser); File toOpen = fileChooser.getSelectedFile(); String[] data = new String[3]; try { Scanner fileScanner = new Scanner(toOpen); while(fileScanner.hasNextLine()) { data = fileScanner.nextLine().split(","); list.add(data[0], data[1], Integer.parseInt(data[2])); } fileScanner.close(); } catch(IOException e) { e.printStackTrace(); } mainMenu(); }// End of Main public static void mainMenu() { // Display the three different options to the user and execute the selection int selection = JOptionPane.showOptionDialog(null, "Please select an option", "Linked List", 0, 2, null, options, 0); // Display list in a ScrollPane window if(selection == 0) { SearchNodeWindow newWindow = new SearchNodeWindow(list.display()); } // Allow the user to search by last name else if(selection == 1) { // Obtain the last name of the student we want to search for JOptionPane.showMessageDialog(null, "Let's search for a student by last name!"); String name = JOptionPane.showInputDialog("Please provide the student's last name: "); // Use the search method from LinkedList class to search for the student, the method is not case sensitive if(list.search(name)) { JOptionPane.showMessageDialog(null, "The student by the last name " + name + " was found in the list!"); } else { JOptionPane.showMessageDialog(null, "The student by the last name " + name + " was not found in the list!"); } mainMenu(); } // Exit else { System.exit(0); } }// End of mainMenu method // SearchNode fields // The four different Node references and an int variable to keep track of the size of the Linked-List private Node first, second, third, last; private int size; // Constructor public SearchNode() { this.first = null; this.second = null; this.third = null; this.last = null; this.size = 0; } // Getter private int getSize() { return this.size; } // Setter private void setSize(int size) { this.size = size; } // Is the list empty? private boolean isEmpty() { return getSize() == 0; } // Getter private Node getFirst() { return this.first; } // Setter private void setFirst(Node first) { this.first = first; } // Getter private Node getSecond() { return this.second; } // Setter private void setSecond(Node second) { this.second = second; } // Getter private Node getThird() { return this.third; } // Setter private void setThird(Node third) { this.third = third; } // Getter private Node getLast() { return this.last; } // Setter private void setLast(Node last) { this.last = last; } // Add method that takes as input the string name, string major and int id, creates a new Student Node with it // and adds it to the list in alphabetical order, uses the faster search method when the size of the list is 4 or more public void add(String name, String major, int id) { Node newNode = new Node(name, major, id); // List is empty so add the new Student Node if(isEmpty()) { setFirst(newNode); setSize(getSize() + 1); // Keep track of the size of the list } // Size of the linked list is less than 4 so use the regular linear search else if(getSize() < 4) { Node traverse = search(newNode); setSize(getSize() + 1); // Special case scenario when the list contains one Student Node if(traverse == getFirst() && traverse.getNext() == null) { // We have to check to see if the new student Node should go before or after the only node in the list // New Node goes after the first Node if(name.compareToIgnoreCase(traverse.getName()) > 0) { newNode.setPrevious(traverse); traverse.setNext(newNode); } // New Node goes at the beginning of the list else { setFirst(newNode); newNode.setNext(traverse); traverse.setPrevious(newNode); } } // Special case of insertion at the beginning of the list else if(traverse == getFirst()) { newNode.setNext(first); first.setPrevious(newNode); setFirst(newNode); } // Special case insertion potentially at the end of the list else if(traverse.getNext() == null) { // Insertion at end of the list if(newNode.getName().compareToIgnoreCase(traverse.getName()) >= 0) { newNode.setPrevious(traverse); traverse.setNext(newNode); } // Insertion before the last node in the list else { newNode.setPrevious(traverse.getPrevious()); newNode.setNext(traverse); traverse.getPrevious().setNext(newNode); traverse.setPrevious(newNode); } } // Insertion anywhere else in the list else { newNode.setNext(traverse); newNode.setPrevious(traverse.getPrevious()); traverse.getPrevious().setNext(newNode); traverse.setPrevious(newNode); } // Special case in which we have exactly 4 Nodes and can have each reference point to each respective Node if(getSize() == 4) { setSecond(first.getNext()); setThird(second.getNext()); setLast(third.getNext()); } } // Size is greater than 4 with the current addition else { Node traverse = search(newNode); setSize(getSize() + 1); // Special case insertion at the beginning of the list if(traverse == getFirst()) { newNode.setNext(first); first.setPrevious(newNode); setFirst(newNode); // make sure to update the first Node reference accordingly } // Special case insertion potentially at end of the list else if(traverse.getNext() == null) { // Insertion at the end of the list if(newNode.getName().compareToIgnoreCase(traverse.getName()) >= 0) { newNode.setPrevious(traverse); traverse.setNext(newNode); setLast(newNode); // make sure to update the last Node reference accordingly } // Insertion right before the last node in the list else { newNode.setPrevious(traverse.getPrevious()); newNode.setNext(traverse); traverse.getPrevious().setNext(newNode); traverse.setPrevious(newNode); } } // Insertion anywhere else in the list else { newNode.setNext(traverse); newNode.setPrevious(traverse.getPrevious()); traverse.getPrevious().setNext(newNode); traverse.setPrevious(newNode); } // Updating the reference variables depending on where the new node was inserted so // as to have an approximately equal spacing between the reference Nodes keeping in mind // that the first and last nodes are previously updated if necessary //Insertion happened between the first and second reference nodes if(traverse.getName().compareToIgnoreCase(second.getName()) < 0) { setSecond(second.getPrevious()); setThird(third.getPrevious()); } // Insertion happened between the second and third reference nodes else if(traverse.getName().compareToIgnoreCase(third.getName()) < 0) { setSecond(second.getNext()); } // Insertion happened between the third and last reference nodes else if(traverse.getName().compareToIgnoreCase(last.getName()) < 0) { setThird(third.getNext()); } } } // Search method that uses 4 reference variables once the size of the list is 4 or more, this search method is used in conjunction // with the add method to specifically add new Student Nodes in alphabetical order public Node search(Node newNode) { Node traverse; // If the size of the list is less than 4 then just find the position with regular linear search from the beginning of the list if(getSize() < 4) { traverse = getFirst(); while(traverse.getNext() != null && newNode.getName().compareToIgnoreCase(traverse.getName()) >= 0) { traverse = traverse.getNext(); } return traverse; } // Size of the list is 4 or greater so incorporate all 4 reference nodes in order to speed up the search else { // Student node should be inserted between first and second reference nodes (inclusive) if(newNode.getName().compareToIgnoreCase(second.getName()) <= 0) { // Checking to see if it's faster to start at the first node going left to right if((Math.abs(newNode.getName().compareToIgnoreCase(first.getName()))) <= (Math.abs(newNode.getName().compareToIgnoreCase(second.getName())))) { traverse = getFirst(); while(traverse.getNext() != null && newNode.getName().compareToIgnoreCase(traverse.getName()) >= 0) { traverse = traverse.getNext(); } } // Faster to start at the second node going right to left else { traverse = getSecond(); while(traverse.getPrevious() != null && newNode.getName().compareToIgnoreCase(traverse.getPrevious().getName()) < 0) { traverse = traverse.getPrevious(); } } return traverse; } // Student node should be inserted between second and third reference nodes (inclusive) else if(newNode.getName().compareToIgnoreCase(third.getName()) <= 0) { // Check to see if faster to start at second Node going left to right if((Math.abs(newNode.getName().compareToIgnoreCase(second.getName()))) <= (Math.abs(newNode.getName().compareToIgnoreCase(third.getName())))) { traverse = getSecond(); while(traverse.getNext() != null && newNode.getName().compareToIgnoreCase(traverse.getName()) >= 0) { traverse = traverse.getNext(); } } // faster to start at third node going right to left else { traverse = getThird(); while(traverse.getPrevious() != null && newNode.getName().compareToIgnoreCase(traverse.getPrevious().getName()) < 0) { traverse = traverse.getPrevious(); } } return traverse; } // Student node should be inserted between third and last reference nodes (inclusive) else if(newNode.getName().compareToIgnoreCase(last.getName()) <= 0) { // Faster to start at third refernce node going left to right if((Math.abs(newNode.getName().compareToIgnoreCase(third.getName()))) <= (Math.abs(newNode.getName().compareToIgnoreCase(last.getName())))) { traverse = getThird(); while(traverse.getNext() != null && newNode.getName().compareToIgnoreCase(traverse.getName()) >= 0) { traverse = traverse.getNext(); } } // Faster to start at last reference node going right to left else { traverse = getLast(); while(traverse.getPrevious() != null && newNode.getName().compareToIgnoreCase(traverse.getPrevious().getName()) < 0) { traverse = traverse.getPrevious(); } } // Return the Node reference to which the new Node should be inserted right before of return traverse; } else { return getLast(); } } } // Search method that is very similar to the prior search method except that it takes in a String name // that is used to search the Linked List and returns a boolean as a way to let the user know if the // Node with the passed in name was found or not found in the list public boolean search(String name) { Node traverse; // Size is less than 4 so just use the regular way of traversing through the list if(getSize() < 4) { traverse = getFirst(); while(traverse != null && name.compareToIgnoreCase(traverse.getName()) >= 0) { if(name.equalsIgnoreCase(traverse.getName())) { return true; } traverse = traverse.getNext(); } return false; } // Size of the list is bigger than 4 so check through the 4 reference nodes to find // the most efficient way to search for the name in the list else { // Name would lexicographically be located between the first and second reference nodes (inclusive) if(name.compareToIgnoreCase(second.getName()) <= 0) { // Faster to start at the first node and search left to right if((Math.abs(name.compareToIgnoreCase(first.getName()))) <= (Math.abs(name.compareToIgnoreCase(second.getName())))) { traverse = getFirst(); while(traverse != null && name.compareToIgnoreCase(traverse.getName()) >= 0) { // name found in the list return true if(name.equalsIgnoreCase(traverse.getName())) { return true; } traverse = traverse.getNext(); } } // Faster to start at the second node and search right to left else { traverse = getSecond(); while(traverse != null && name.compareToIgnoreCase(traverse.getName()) <= 0) { // Name found in the list return true if(name.equalsIgnoreCase(traverse.getName())) { return true; } traverse = traverse.getPrevious(); } } // Name not found return false return false; } // Name would lexicographically be located between the second and third reference nodes (inclusive) else if(name.compareToIgnoreCase(third.getName()) <= 0) { // Faster to start at the second node and search left to right if((Math.abs(name.compareToIgnoreCase(second.getName()))) <= (Math.abs(name.compareToIgnoreCase(third.getName())))) { traverse = getSecond(); while(traverse != null && name.compareToIgnoreCase(traverse.getName()) >= 0) { // Name found in the list return true if(name.equalsIgnoreCase(traverse.getName())) { return true; } traverse = traverse.getNext(); } } // Faster to start at the third node and search right to left else { traverse = getThird(); while(traverse != null && name.compareToIgnoreCase(traverse.getName()) <= 0) { // Name found in the list return true if(name.equalsIgnoreCase(traverse.getName())) { return true; } traverse = traverse.getPrevious(); } } // Name not found return false return false; } else { // Name would lexicographically be located between the third and last reference nodes (inclusive) if((Math.abs(name.compareToIgnoreCase(third.getName()))) <= (Math.abs(name.compareToIgnoreCase(last.getName())))) { traverse = getThird(); while(traverse != null && name.compareToIgnoreCase(traverse.getName()) >= 0) { // Name found in the list return true if(name.equalsIgnoreCase(traverse.getName())) { return true; } traverse = traverse.getNext(); } } else { traverse = getLast(); while(traverse != null && name.compareToIgnoreCase(traverse.getName()) <= 0) { // Name found in the list return true if(name.equalsIgnoreCase(traverse.getName())) { return true; } traverse = traverse.getPrevious(); } } // Name not found in the list return false return false; } } } // Method that traverse through the entire list, adding a newline string out of each Node's fields to ultimately return // a String that could be then used to display the entire list public String display() { Node traverse = getFirst(); String content = new String(); while(traverse != null) { content += traverse.getName() + " " + traverse.getMajor() + " " + traverse.getID() + "\n"; traverse = traverse.getNext(); } return content; } // Private node class private class Node { // Node variables, doubly linked list so both a next and previous Node reference private String name, major; private int id; Node next, previous; // Constructor private Node(String name, String major, int id) { this.name = name; this.major = major; this.id = id; this.next = null; this.previous = null; } // Getter private String getName() { return this.name; } // Getter private String getMajor() { return this.major; } // Getter private int getID() { return this.id; } // Setter private void setNext(Node next) { this.next = next; } // Getter private Node getNext() { return this.next; } // Setter private void setPrevious(Node previous) { this.previous = previous; } // Getter private Node getPrevious() { return this.previous; } } }
17,985
0.635444
0.632111
631
26.52615
29.974403
144
false
false
0
0
0
0
0
0
3.33439
false
false
4
28159c8f7339c6e16dd17236b2f82ee900f149bc
21,028,159,895,312
ea9f0ca126d575adca0833a0253e02bf52674cfe
/src/Backtracking/MobilephoneCombinationNumber.java
6fe8c0b61cf5ef47b9942bc28f92c43f0dd8ff34
[ "MIT" ]
permissive
satyam289/Data-structure-and-Algorithm
https://github.com/satyam289/Data-structure-and-Algorithm
f4e62696074677e3046c31abc53b2e08f049db18
2056eb5f7c82db50a910658f641f15547acf2313
refs/heads/master
2022-05-17T17:29:06.086000
2022-05-03T19:56:48
2022-05-03T19:56:48
143,539,978
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Backtracking; import java.util.ArrayList; import java.util.HashMap; // https://www.geeksforgeeks.org/mobile-numeric-keypad-problem/ public class MobilephoneCombinationNumber { public static void main(String[] args) { System.out.println(no_ways_validNumber(2)); System.out.println(combinationDp(2)); } public static int no_ways_validNumber(int numberOfTimes) { if (numberOfTimes <= 0) return 0; if (numberOfTimes == 1) return 10; int[][] keypad = { { '1', '2', '3' }, { '4', '5', '6' }, { '7', '8', '9' }, { '*', '0', '#' } }; int total = 0; for (int i = 0; i < 4; i++) { // keypad row for (int j = 0; j < 3; j++) { // keypad column if (keypad[i][j] != '*' && keypad[i][j] != '#') { // skipping total += countValidNumberUtil(numberOfTimes, i, j, keypad); } } } return total; } private static int countValidNumberUtil(int numberOfTimes, int i, int j, int[][] keypad) { int[] rowkey = { 0, 1, 0, -1, 0 }; int[] colkey = { 0, 0, 1, 0, -1 }; int row, col, total = 0; if (keypad == null || numberOfTimes <= 0) return 0; if (numberOfTimes == 1) // base condition @here 1 return 1; for (int k = 0; k < 5; k++) { // allowed movement : left, right, top bottom row = i + rowkey[k]; col = j + colkey[k]; if (row >= 0 && row < 4 && col >= 0 && col < 3 && keypad[row][col] != '*' && keypad[row][col] != '#') // checking boundary option total += countValidNumberUtil(numberOfTimes - 1, row, col, keypad); } return total; } // Dynamic Programming public static int combinationDp(int numberOfTimes) { char[][] keypad = {{'1', '2', '3'}, {'4', '5', '6'}, {'7', '8', '9'}, {'*', '0', '#'}}; if (numberOfTimes == 0) return 0; if (numberOfTimes == 1) return 10; int[] row = {1, 0, -1, 0, 0}; int[] col = {0, 1, 0, -1, 0}; int[][] cost = new int[10][numberOfTimes + 1]; // keypad number + no of times pressing key for (int i = 0; i < 10; i++) { cost[i][0] = 0; // when no key is pressed cost[i][1] = 1; // when one key is pressed } for (int k = 2; k <= numberOfTimes; k++) { for (int i = 0; i < 4; i++) { for (int j = 0; j < 3; j++) { if (keypad[i][j] != '*' && keypad[i][j] != '#') { cost[keypad[i][j] - '0'][k] = 0; for (int move = 0; move < 5; move++) { int new_row = row[move] + i; int new_col = col[move] + j; if (new_row >= 0 && new_row < 4 && new_col >= 0 && new_col < 3 && keypad[new_row][new_col] != '*' && keypad[new_row][new_col] != '#') { cost[keypad[i][j] - '0'][k] += cost[keypad[new_row][new_col] - '0'][k - 1]; } } } } } } int total = 0; for (int i = 0; i < 10; i++) { // column sum total += cost[i][numberOfTimes]; } return total; } /* * Given a digit string, return all possible letter combination that the number(keypad) * https://www.interviewbit.com/problems/letter-phone/ * https://www.geeksforgeeks.org/iterative-letter-combinations-of-a-phone-number/ */ String[] KeyPad = new String[] { "0", "1", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz" }; public ArrayList<String> letterCombinations1(String input) { ArrayList<String> result = new ArrayList<String>(); addPosssibleCombination(input, result, "", 0); return result; } private void addPosssibleCombination(String input, ArrayList<String> result, String str, int index) { if (index >= input.length()) { result.add(str); return; } int num = input.charAt(index) - '0'; String keypadStr = KeyPad[num]; for (int j = 0; j < keypadStr.length(); j++) { String newStr = str + keypadStr.charAt(j); addPosssibleCombination(input, result, newStr, index + 1); } } // Similar Apporach using map public ArrayList<String> letterCombinations2(String a) { HashMap<String, String> map = new HashMap<String, String>(); map.put("4", "ghi"); map.put("5", "jkl"); map.put("6", "mno"); map.put("7", "pqrs"); map.put("8", "tuv"); map.put("2", "abc"); map.put("3", "def"); map.put("9", "wxyz"); map.put("0", "0"); map.put("1", "1"); ArrayList<String> result = new ArrayList<String>(); if (a == null || a.length() == 0) { return result; } ArrayList<Character> temp = new ArrayList<Character>(); addpossibleCombination(a, temp, result, map); return result; } private void addpossibleCombination(String a, ArrayList<Character> temp, ArrayList<String> res, HashMap<String, String> map) { if (a.length() == 0) { char[] arr = new char[temp.size()]; for (int i = 0; i < temp.size(); i++) { arr[i] = temp.get(i); } res.add(String.valueOf(arr)); return; } String num = a.substring(0, 1); String let = map.get(num); for (int i = 0; i < let.length(); i++) { temp.add(let.charAt(i)); addpossibleCombination(a.substring(1), temp, res, map); temp.remove(temp.size() - 1); //back tracking } } }
UTF-8
Java
6,045
java
MobilephoneCombinationNumber.java
Java
[ { "context": "int j, int[][] keypad) {\n int[] rowkey = { 0, 1, 0, -1, 0 };\n int[] colkey = { 0, 0, 1, 0, -1 };\n ", "end": 1199, "score": 0.975184440612793, "start": 1185, "tag": "KEY", "value": "0, 1, 0, -1, 0" }, { "context": "ey = { 0, 1, 0, -1, 0 };\n int[] colkey = { 0, 0, 1, 0, -1 };\n int row, col, total = 0;\n if (k", "end": 1242, "score": 0.9822894334793091, "start": 1228, "tag": "KEY", "value": "0, 0, 1, 0, -1" }, { "context": "tring[] { \"0\", \"1\", \"abc\", \"def\", \"ghi\", \"jkl\", \"mno\", \"pqrs\", \"tuv\", \"wxyz\" };\n\n public ArrayList<", "end": 3886, "score": 0.5981236696243286, "start": 3884, "tag": "KEY", "value": "no" }, { "context": "{ \"0\", \"1\", \"abc\", \"def\", \"ghi\", \"jkl\", \"mno\", \"pqrs\", \"tuv\", \"wxyz\" };\n\n public ArrayList<String> ", "end": 3894, "score": 0.5755072236061096, "start": 3892, "tag": "KEY", "value": "rs" } ]
null
[]
package Backtracking; import java.util.ArrayList; import java.util.HashMap; // https://www.geeksforgeeks.org/mobile-numeric-keypad-problem/ public class MobilephoneCombinationNumber { public static void main(String[] args) { System.out.println(no_ways_validNumber(2)); System.out.println(combinationDp(2)); } public static int no_ways_validNumber(int numberOfTimes) { if (numberOfTimes <= 0) return 0; if (numberOfTimes == 1) return 10; int[][] keypad = { { '1', '2', '3' }, { '4', '5', '6' }, { '7', '8', '9' }, { '*', '0', '#' } }; int total = 0; for (int i = 0; i < 4; i++) { // keypad row for (int j = 0; j < 3; j++) { // keypad column if (keypad[i][j] != '*' && keypad[i][j] != '#') { // skipping total += countValidNumberUtil(numberOfTimes, i, j, keypad); } } } return total; } private static int countValidNumberUtil(int numberOfTimes, int i, int j, int[][] keypad) { int[] rowkey = { 0, 1, 0, -1, 0 }; int[] colkey = { 0, 0, 1, 0, -1 }; int row, col, total = 0; if (keypad == null || numberOfTimes <= 0) return 0; if (numberOfTimes == 1) // base condition @here 1 return 1; for (int k = 0; k < 5; k++) { // allowed movement : left, right, top bottom row = i + rowkey[k]; col = j + colkey[k]; if (row >= 0 && row < 4 && col >= 0 && col < 3 && keypad[row][col] != '*' && keypad[row][col] != '#') // checking boundary option total += countValidNumberUtil(numberOfTimes - 1, row, col, keypad); } return total; } // Dynamic Programming public static int combinationDp(int numberOfTimes) { char[][] keypad = {{'1', '2', '3'}, {'4', '5', '6'}, {'7', '8', '9'}, {'*', '0', '#'}}; if (numberOfTimes == 0) return 0; if (numberOfTimes == 1) return 10; int[] row = {1, 0, -1, 0, 0}; int[] col = {0, 1, 0, -1, 0}; int[][] cost = new int[10][numberOfTimes + 1]; // keypad number + no of times pressing key for (int i = 0; i < 10; i++) { cost[i][0] = 0; // when no key is pressed cost[i][1] = 1; // when one key is pressed } for (int k = 2; k <= numberOfTimes; k++) { for (int i = 0; i < 4; i++) { for (int j = 0; j < 3; j++) { if (keypad[i][j] != '*' && keypad[i][j] != '#') { cost[keypad[i][j] - '0'][k] = 0; for (int move = 0; move < 5; move++) { int new_row = row[move] + i; int new_col = col[move] + j; if (new_row >= 0 && new_row < 4 && new_col >= 0 && new_col < 3 && keypad[new_row][new_col] != '*' && keypad[new_row][new_col] != '#') { cost[keypad[i][j] - '0'][k] += cost[keypad[new_row][new_col] - '0'][k - 1]; } } } } } } int total = 0; for (int i = 0; i < 10; i++) { // column sum total += cost[i][numberOfTimes]; } return total; } /* * Given a digit string, return all possible letter combination that the number(keypad) * https://www.interviewbit.com/problems/letter-phone/ * https://www.geeksforgeeks.org/iterative-letter-combinations-of-a-phone-number/ */ String[] KeyPad = new String[] { "0", "1", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz" }; public ArrayList<String> letterCombinations1(String input) { ArrayList<String> result = new ArrayList<String>(); addPosssibleCombination(input, result, "", 0); return result; } private void addPosssibleCombination(String input, ArrayList<String> result, String str, int index) { if (index >= input.length()) { result.add(str); return; } int num = input.charAt(index) - '0'; String keypadStr = KeyPad[num]; for (int j = 0; j < keypadStr.length(); j++) { String newStr = str + keypadStr.charAt(j); addPosssibleCombination(input, result, newStr, index + 1); } } // Similar Apporach using map public ArrayList<String> letterCombinations2(String a) { HashMap<String, String> map = new HashMap<String, String>(); map.put("4", "ghi"); map.put("5", "jkl"); map.put("6", "mno"); map.put("7", "pqrs"); map.put("8", "tuv"); map.put("2", "abc"); map.put("3", "def"); map.put("9", "wxyz"); map.put("0", "0"); map.put("1", "1"); ArrayList<String> result = new ArrayList<String>(); if (a == null || a.length() == 0) { return result; } ArrayList<Character> temp = new ArrayList<Character>(); addpossibleCombination(a, temp, result, map); return result; } private void addpossibleCombination(String a, ArrayList<Character> temp, ArrayList<String> res, HashMap<String, String> map) { if (a.length() == 0) { char[] arr = new char[temp.size()]; for (int i = 0; i < temp.size(); i++) { arr[i] = temp.get(i); } res.add(String.valueOf(arr)); return; } String num = a.substring(0, 1); String let = map.get(num); for (int i = 0; i < let.length(); i++) { temp.add(let.charAt(i)); addpossibleCombination(a.substring(1), temp, res, map); temp.remove(temp.size() - 1); //back tracking } } }
6,045
0.461538
0.440364
164
35.859756
29.15097
163
false
false
0
0
0
0
0
0
1.164634
false
false
4
bee39266ca3a086d7d712329a20839a539397a38
7,017,976,615,158
ab63bfb71ef607c59662f5a5cb14a794186f082f
/jo.chview.rcp/src/jo/d2k/admin/rcp/viz/chview/DlgGoto.java
cd50a655a602489bf581b7bdfd661eaa99cf6ddb
[]
no_license
Surtac/ChView
https://github.com/Surtac/ChView
cef5af20acd4f66b93b3c893d5e12c00355f9847
e927267be2b95b6250419c0b88464ba396d8f71f
refs/heads/master
2021-05-29T23:59:43.430000
2015-07-10T21:12:42
2015-07-10T21:12:42
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package jo.d2k.admin.rcp.viz.chview; import jo.util.geom3d.Point3D; import jo.util.ui.dlg.GenericDialog; import jo.util.ui.utils.GridUtils; import jo.util.utils.FormatUtils; import jo.util.utils.obj.DoubleUtils; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; public class DlgGoto extends GenericDialog { private Point3D mCenter; private double mRadius; private Text mX; private Text mY; private Text mZ; private Text mCtrlRadius; public DlgGoto(Shell parentShell) { super(parentShell); } protected Control createDialogArea(Composite parent) { getShell().setText("Change Viewpoint"); Composite client = new Composite(parent, SWT.NULL); GridUtils.setLayoutData(client, "fill=hv"); client.setLayout(new GridLayout(2, false)); GridUtils.makeLabel(client, "Enter the new location to center the view on:", "2x1"); GridUtils.makeLabel(client, "X", ""); mX = GridUtils.makeText(client, FormatUtils.formatDouble(mCenter.x, 2), "fill=h"); GridUtils.makeLabel(client, "Y", ""); mY = GridUtils.makeText(client, FormatUtils.formatDouble(mCenter.y, 2), "fill=h"); GridUtils.makeLabel(client, "Z", ""); mZ = GridUtils.makeText(client, FormatUtils.formatDouble(mCenter.z, 2), "fill=h"); GridUtils.makeLabel(client, "Radius", ""); mCtrlRadius = GridUtils.makeText(client, FormatUtils.formatDouble(mRadius, 2), "fill=h"); return mX; } @Override protected void okPressed() { mCenter.x = DoubleUtils.parseDouble(mX.getText()); mCenter.y = DoubleUtils.parseDouble(mY.getText()); mCenter.z = DoubleUtils.parseDouble(mZ.getText()); mRadius = DoubleUtils.parseDouble(mCtrlRadius.getText()); super.okPressed(); } public Point3D getCenter() { return mCenter; } public void setCenter(Point3D center) { mCenter = center; } public double getRadius() { return mRadius; } public void setRadius(double radius) { mRadius = radius; } }
UTF-8
Java
2,424
java
DlgGoto.java
Java
[]
null
[]
package jo.d2k.admin.rcp.viz.chview; import jo.util.geom3d.Point3D; import jo.util.ui.dlg.GenericDialog; import jo.util.ui.utils.GridUtils; import jo.util.utils.FormatUtils; import jo.util.utils.obj.DoubleUtils; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; public class DlgGoto extends GenericDialog { private Point3D mCenter; private double mRadius; private Text mX; private Text mY; private Text mZ; private Text mCtrlRadius; public DlgGoto(Shell parentShell) { super(parentShell); } protected Control createDialogArea(Composite parent) { getShell().setText("Change Viewpoint"); Composite client = new Composite(parent, SWT.NULL); GridUtils.setLayoutData(client, "fill=hv"); client.setLayout(new GridLayout(2, false)); GridUtils.makeLabel(client, "Enter the new location to center the view on:", "2x1"); GridUtils.makeLabel(client, "X", ""); mX = GridUtils.makeText(client, FormatUtils.formatDouble(mCenter.x, 2), "fill=h"); GridUtils.makeLabel(client, "Y", ""); mY = GridUtils.makeText(client, FormatUtils.formatDouble(mCenter.y, 2), "fill=h"); GridUtils.makeLabel(client, "Z", ""); mZ = GridUtils.makeText(client, FormatUtils.formatDouble(mCenter.z, 2), "fill=h"); GridUtils.makeLabel(client, "Radius", ""); mCtrlRadius = GridUtils.makeText(client, FormatUtils.formatDouble(mRadius, 2), "fill=h"); return mX; } @Override protected void okPressed() { mCenter.x = DoubleUtils.parseDouble(mX.getText()); mCenter.y = DoubleUtils.parseDouble(mY.getText()); mCenter.z = DoubleUtils.parseDouble(mZ.getText()); mRadius = DoubleUtils.parseDouble(mCtrlRadius.getText()); super.okPressed(); } public Point3D getCenter() { return mCenter; } public void setCenter(Point3D center) { mCenter = center; } public double getRadius() { return mRadius; } public void setRadius(double radius) { mRadius = radius; } }
2,424
0.629125
0.623762
80
28.299999
24.593903
97
false
false
0
0
0
0
0
0
0.8375
false
false
4
4d83ebcd3aca7cdf905f4e278c43784b13a3b8f1
15,006,615,789,994
d96b7220ab06b1b765fede635a5a9a1197512a74
/decorators/src/main/java/com/mounacheikhna/decorators/OnLongClickDecorator.java
034883e86661b532a13bf22ca73d9c55dbbf0510
[ "MIT", "Apache-2.0" ]
permissive
ajunlonglive/Decor
https://github.com/ajunlonglive/Decor
4e0a29d7aba2fb4464274e37a5f1f2bbca56117e
76873832c70af003e82d8d29af94b08b9386b8d1
refs/heads/master
2023-06-27T05:36:49.405000
2019-08-14T00:28:41
2019-08-14T00:28:41
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mounacheikhna.decorators; import android.app.Activity; import android.content.res.TypedArray; import android.view.View; import android.view.View.OnLongClickListener; /** * Created by cheikhna on 02/04/2015. */ public class OnLongClickDecorator extends OnActionBaseDecorator { public OnLongClickDecorator(Activity activity) { super(activity); } @Override protected int[] styleable() { return R.styleable.OnLongClickDecorator; } @Override protected void apply(View view, final TypedArray typedArray) { view.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { onAction(typedArray.getString(R.styleable.OnLongClickDecorator_decorOnLongClick)); return true; } }); } }
UTF-8
Java
861
java
OnLongClickDecorator.java
Java
[ { "context": ".view.View.OnLongClickListener;\n\n/**\n * Created by cheikhna on 02/04/2015.\n */\npublic class OnLongClickDecora", "end": 206, "score": 0.9993124008178711, "start": 198, "tag": "USERNAME", "value": "cheikhna" } ]
null
[]
package com.mounacheikhna.decorators; import android.app.Activity; import android.content.res.TypedArray; import android.view.View; import android.view.View.OnLongClickListener; /** * Created by cheikhna on 02/04/2015. */ public class OnLongClickDecorator extends OnActionBaseDecorator { public OnLongClickDecorator(Activity activity) { super(activity); } @Override protected int[] styleable() { return R.styleable.OnLongClickDecorator; } @Override protected void apply(View view, final TypedArray typedArray) { view.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { onAction(typedArray.getString(R.styleable.OnLongClickDecorator_decorOnLongClick)); return true; } }); } }
861
0.678281
0.66899
33
25.09091
24.568228
98
false
false
0
0
0
0
0
0
0.333333
false
false
4
82cdf5818e4f7d13d38bd394e2408b8cc46a6b63
18,511,309,106,671
0d7458a8d65d6d396261f25a1b99bb2c9d1252f3
/src/Accounts.java
f203bf90cef27adeef5b7cb4f6d5cdb7ce119fad
[]
no_license
advocat3/SE157BHibernate
https://github.com/advocat3/SE157BHibernate
186958ad3fd9275185c56ba97def5f1a0f9af649
7b7406fa15e7a4c46682a60d0b7e3863a452b3e5
refs/heads/master
2016-03-29T18:34:46.096000
2013-03-02T07:21:27
2013-03-02T07:21:27
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.ArrayList; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Accounts { //@XmlElementWrapper(name="accounts") @XmlElement(name="account") private ArrayList<account>account; public Accounts(){ } public void setAccounts(ArrayList<account>account){ this.account = account; } public ArrayList<account> getAccounts(){ return this.account; } }
UTF-8
Java
508
java
Accounts.java
Java
[]
null
[]
import java.util.ArrayList; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Accounts { //@XmlElementWrapper(name="accounts") @XmlElement(name="account") private ArrayList<account>account; public Accounts(){ } public void setAccounts(ArrayList<account>account){ this.account = account; } public ArrayList<account> getAccounts(){ return this.account; } }
508
0.761811
0.761811
27
17.814816
18.342497
52
false
false
0
0
0
0
0
0
0.962963
false
false
4
fb1a97faa4fef798b8b8a74089358d389aade859
32,925,219,326,025
d76909f6bbad53c6d804ec348e4c22e57cffbe63
/src/dynamic/DungeonGame_174/Solution.java
7dc679cbaa011391c3088c23a9f1d9bdff9ffc23
[]
no_license
k1ema/LeetCodeProblems
https://github.com/k1ema/LeetCodeProblems
60b6e5c4f107c5d68286f42e4ade3629d8919c50
cc077faad3ce3e1f8b7a57bb6df52f0d44ba8eb9
refs/heads/master
2022-11-09T01:50:35.269000
2022-10-22T10:58:04
2022-10-22T10:58:04
186,883,840
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dynamic.DungeonGame_174; import java.util.Arrays; /** * 174. Dungeon Game * https://leetcode.com/problems/dungeon-game/ * * The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. * The dungeon consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initially * positioned in the top-left room and must fight his way through the dungeon to rescue the princess. * * The knight has an initial health point represented by a positive integer. If at any point his health * point drops to 0 or below, he dies immediately. * * Some of the rooms are guarded by demons, so the knight loses health (negative integers) upon entering * these rooms; other rooms are either empty (0's) or contain magic orbs that increase the knight's health * (positive integers). * * In order to reach the princess as quickly as possible, the knight decides to move only rightward or * downward in each step. * * Write a function to determine the knight's minimum initial health so that he is able to rescue the princess. * * For example, given the dungeon below, the initial health of the knight must be at least 7 if he follows * the optimal path RIGHT-> RIGHT -> DOWN -> DOWN. * * -2(K) -3 3 * -5 -10 1 * 10 30 -5(P) * * * Note: * The knight's health has no upper bound. * Any room can contain threats or power-ups, even the first room the knight enters and the bottom-right * room where the princess is imprisoned. */ public class Solution { // tc O(m*n), sc O(m*n) // https://leetcode.com/problems/dungeon-game/discuss/52805/Best-solution-I-have-found-with-explanations public int calculateMinimumHP(int[][] dungeon) { int m = dungeon.length, n = dungeon[0].length; int[][] dp = new int[m + 1][n + 1]; for (int[] arr : dp) Arrays.fill(arr, Integer.MAX_VALUE); dp[m][n - 1] = 1; dp[m - 1][n] = 1; for (int i = m - 1; i >= 0; i--) { for (int j = n - 1; j >= 0; j--) { dp[i][j] = Math.max(1, Math.min(dp[i][j + 1], dp[i + 1][j]) - dungeon[i][j]); } } return dp[0][0]; } // bt, sc O(2^(mn)), TLE public int calculateMinimumHP1(int[][] dungeon) { int m = dungeon.length, n = dungeon[0].length; return bt(dungeon, m - 1, n - 1, 1); } private int bt(int[][] nums, int i, int j, int cur) { if (i < 0 || j < 0) return Integer.MAX_VALUE; cur = Math.max(1, cur - nums[i][j]); if (i == 0 && j == 0) return cur; int v1 = bt(nums, i - 1, j, cur); int v2 = bt(nums, i, j - 1, cur); return Math.max(1, Math.min(v1, v2)); } }
UTF-8
Java
2,725
java
Solution.java
Java
[]
null
[]
package dynamic.DungeonGame_174; import java.util.Arrays; /** * 174. Dungeon Game * https://leetcode.com/problems/dungeon-game/ * * The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. * The dungeon consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initially * positioned in the top-left room and must fight his way through the dungeon to rescue the princess. * * The knight has an initial health point represented by a positive integer. If at any point his health * point drops to 0 or below, he dies immediately. * * Some of the rooms are guarded by demons, so the knight loses health (negative integers) upon entering * these rooms; other rooms are either empty (0's) or contain magic orbs that increase the knight's health * (positive integers). * * In order to reach the princess as quickly as possible, the knight decides to move only rightward or * downward in each step. * * Write a function to determine the knight's minimum initial health so that he is able to rescue the princess. * * For example, given the dungeon below, the initial health of the knight must be at least 7 if he follows * the optimal path RIGHT-> RIGHT -> DOWN -> DOWN. * * -2(K) -3 3 * -5 -10 1 * 10 30 -5(P) * * * Note: * The knight's health has no upper bound. * Any room can contain threats or power-ups, even the first room the knight enters and the bottom-right * room where the princess is imprisoned. */ public class Solution { // tc O(m*n), sc O(m*n) // https://leetcode.com/problems/dungeon-game/discuss/52805/Best-solution-I-have-found-with-explanations public int calculateMinimumHP(int[][] dungeon) { int m = dungeon.length, n = dungeon[0].length; int[][] dp = new int[m + 1][n + 1]; for (int[] arr : dp) Arrays.fill(arr, Integer.MAX_VALUE); dp[m][n - 1] = 1; dp[m - 1][n] = 1; for (int i = m - 1; i >= 0; i--) { for (int j = n - 1; j >= 0; j--) { dp[i][j] = Math.max(1, Math.min(dp[i][j + 1], dp[i + 1][j]) - dungeon[i][j]); } } return dp[0][0]; } // bt, sc O(2^(mn)), TLE public int calculateMinimumHP1(int[][] dungeon) { int m = dungeon.length, n = dungeon[0].length; return bt(dungeon, m - 1, n - 1, 1); } private int bt(int[][] nums, int i, int j, int cur) { if (i < 0 || j < 0) return Integer.MAX_VALUE; cur = Math.max(1, cur - nums[i][j]); if (i == 0 && j == 0) return cur; int v1 = bt(nums, i - 1, j, cur); int v2 = bt(nums, i, j - 1, cur); return Math.max(1, Math.min(v1, v2)); } }
2,725
0.612477
0.590092
71
37.380283
34.945175
111
false
false
0
0
0
0
0
0
0.774648
false
false
4
663450e54402b66674dc9e6ebbde880f4f433dc5
17,068,200,047,026
6023436a8b8261b90118ce3e87f8eccd466913ed
/DrVocaTouchBasic1/src/net/bravecompany/drvocatouchbasic1/SplashActivity.java
7be86c6b4bfb790a8e2537bd44e0afdc57b57db4
[]
no_license
nukeguys/DrVocaTouch
https://github.com/nukeguys/DrVocaTouch
eda436e59a97a86991f25c151ec95454e4edc826
a7682e2b7aa980240bc6105a89938501cb82ae93
refs/heads/master
2020-05-16T22:02:50.035000
2014-04-29T01:58:28
2014-04-29T01:58:28
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.bravecompany.drvocatouchbasic1; import net.bravecompany.drvocatouchbasic1.util.DrVocaDbManager; import net.bravecompany.drvocatouchbasic1.util.DrVocaUserManager; import net.bravecompany.drvocatouchbasic1.util.DrVocaUserManager.OnCompleteSyncUserListener; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.ProgressBar; import android.widget.TextView; public class SplashActivity extends ActionBarActivity implements OnCompleteSyncUserListener { private TextView progressMessage; private ProgressBar progressBar; private CopayDbAsyncTask loadAsyncTask; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_splash); progressMessage = (TextView) findViewById(R.id.tv_message); progressBar = (ProgressBar) findViewById(R.id.pb_progress); progressBar.setVisibility(View.INVISIBLE); progressMessage.setVisibility(View.INVISIBLE); loadAsyncTask = new CopayDbAsyncTask(); loadAsyncTask.execute(); } @Override protected void onDestroy() { if (loadAsyncTask != null) { loadAsyncTask.cancel(true); loadAsyncTask = null; } super.onDestroy(); } class CopayDbAsyncTask extends AsyncTask<Void, Void, Void> { @Override protected void onPreExecute() { super.onPreExecute(); startProgress(R.string.progress_init); } @Override protected Void doInBackground(Void... params) { DrVocaDbManager.copyDB(SplashActivity.this); return null; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); stopProgress(); syncUser(); } } private void syncUser() { if (DrVocaUserManager.from().isLogin()) { startProgress(R.string.progress_init); DrVocaUserManager.from().syncUserFromServer(this); } else nextActivity(); } @Override public void onCompleteSyncUser() { stopProgress(); nextActivity(); } private void nextActivity() { stopProgress(); Intent intent = null; if (DrVocaUserManager.from().isLogin()) intent = new Intent(this, LectureGridActivity.class); else intent = new Intent(this, IntroduceActivity.class); startActivity(intent); finish(); } private void startProgress(int resId) { progressBar.setVisibility(View.VISIBLE); progressMessage.setVisibility(View.VISIBLE); setProgressMessage(resId); } private void stopProgress() { progressBar.setVisibility(View.GONE); progressMessage.setVisibility(View.INVISIBLE); } public void setProgressMessage(int resId) { progressMessage.setText(resId); } }
UTF-8
Java
2,926
java
SplashActivity.java
Java
[]
null
[]
package net.bravecompany.drvocatouchbasic1; import net.bravecompany.drvocatouchbasic1.util.DrVocaDbManager; import net.bravecompany.drvocatouchbasic1.util.DrVocaUserManager; import net.bravecompany.drvocatouchbasic1.util.DrVocaUserManager.OnCompleteSyncUserListener; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.ProgressBar; import android.widget.TextView; public class SplashActivity extends ActionBarActivity implements OnCompleteSyncUserListener { private TextView progressMessage; private ProgressBar progressBar; private CopayDbAsyncTask loadAsyncTask; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_splash); progressMessage = (TextView) findViewById(R.id.tv_message); progressBar = (ProgressBar) findViewById(R.id.pb_progress); progressBar.setVisibility(View.INVISIBLE); progressMessage.setVisibility(View.INVISIBLE); loadAsyncTask = new CopayDbAsyncTask(); loadAsyncTask.execute(); } @Override protected void onDestroy() { if (loadAsyncTask != null) { loadAsyncTask.cancel(true); loadAsyncTask = null; } super.onDestroy(); } class CopayDbAsyncTask extends AsyncTask<Void, Void, Void> { @Override protected void onPreExecute() { super.onPreExecute(); startProgress(R.string.progress_init); } @Override protected Void doInBackground(Void... params) { DrVocaDbManager.copyDB(SplashActivity.this); return null; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); stopProgress(); syncUser(); } } private void syncUser() { if (DrVocaUserManager.from().isLogin()) { startProgress(R.string.progress_init); DrVocaUserManager.from().syncUserFromServer(this); } else nextActivity(); } @Override public void onCompleteSyncUser() { stopProgress(); nextActivity(); } private void nextActivity() { stopProgress(); Intent intent = null; if (DrVocaUserManager.from().isLogin()) intent = new Intent(this, LectureGridActivity.class); else intent = new Intent(this, IntroduceActivity.class); startActivity(intent); finish(); } private void startProgress(int resId) { progressBar.setVisibility(View.VISIBLE); progressMessage.setVisibility(View.VISIBLE); setProgressMessage(resId); } private void stopProgress() { progressBar.setVisibility(View.GONE); progressMessage.setVisibility(View.INVISIBLE); } public void setProgressMessage(int resId) { progressMessage.setText(resId); } }
2,926
0.76555
0.763841
124
22.596775
22.471458
111
false
false
0
0
0
0
0
0
1.83871
false
false
4
c700ffdab80d97174e8ebae3ac33523825a75c2c
31,018,253,881,081
12164ec38fe40e23562de1046e04e2ea588b9a93
/workout-exporter-selenium/src/com/mad/endomondo/gpxexporter/command/ExportDayCommand.java
8ac13ac92eda4c1b41aca8b48cfaec4e860a5af1
[]
no_license
visalti/endomondo
https://github.com/visalti/endomondo
a6db3bc30f5a105e0a27cf284e674a36802bee35
38738f47322f9d08ea018e74c54d910554d34224
refs/heads/master
2020-12-11T08:08:21.656000
2015-03-11T20:17:48
2015-03-11T20:17:48
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mad.endomondo.gpxexporter.command; import java.util.List; import org.joda.time.LocalDate; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import com.mad.commons.RetryExcutor; import com.mad.commons.RetryableCommand; import com.mad.endomondo.gpxexporter.FindElementModule; import com.mad.endomondo.gpxexporter.exception.ExporterException; public class ExportDayCommand implements RetryableCommand<LocalDate, String> { private WebDriver driver; private FindElementModule findElementModule; public ExportDayCommand(WebDriver driver, FindElementModule findElementModule) { super(); this.driver = driver; this.findElementModule = findElementModule; } @Override public String execute(LocalDate d) { String iconsXPath = "//td[contains(concat(' ',normalize-space(@class),' '),' in-month')]//span[contains(concat(' ',normalize-space(@class),' '),' cday')][text()=\"" + d.getDayOfMonth() + "\"]/..//a"; List<WebElement> icons = driver.findElements(By.xpath(iconsXPath)); int iconsCount = icons.size(); icons = null; // can't iterate over that - // org.openqa.selenium.StaleElementReferenceException: // Element is no longer attached to the DOM for (int i = 0; i < iconsCount; i++) { String iconXpath = "(" + iconsXPath + ")[" + (i + 1) + "]"; WebElement icon = driver.findElement(By.xpath(iconXpath)); System.out.println(icon.getAttribute("id")); System.out.println("Clicking icon"); icon.click(); // Hover WebElement more = driver .findElement(By .xpath("//li[contains(concat(' ',normalize-space(@class),' '),' dropdown')]")); new Actions(driver).moveToElement(more).build().perform(); WebDriverWait wait = new WebDriverWait(driver, 30); WebElement element = wait .until(ExpectedConditions.visibilityOfElementLocated(By .xpath("//a[contains(concat(' ',normalize-space(@class),' '),' export')]"))); System.out.println("Clicking export button"); element.click(); // Wait for javascript to render the popup findElementModule.fluentWait(By.xpath("//div[@id='exporter']")); String tcxGpx = "id('lightboxContainer')//td//a"; List<WebElement> exportLinks = driver .findElements(By.xpath(tcxGpx)); System.out.println("Export tcx"); exportLinks.get(0).click(); System.out.println("Export gpx"); exportLinks.get(1).click(); RetryableCommand<Object, Object> closeExportPopupCommand = new CloseExportPopupCommand( driver); RetryExcutor<Object, Object> executor = new RetryExcutor<>(); try { executor.executeWithRetries(10, closeExportPopupCommand, null); } catch (Exception e) { throw new ExporterException( "Error closing export popup. Too many retries. Date=" + d, e); } } if (iconsCount == 0) { System.out.println("No workouts."); } return null; } }
UTF-8
Java
3,070
java
ExportDayCommand.java
Java
[]
null
[]
package com.mad.endomondo.gpxexporter.command; import java.util.List; import org.joda.time.LocalDate; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import com.mad.commons.RetryExcutor; import com.mad.commons.RetryableCommand; import com.mad.endomondo.gpxexporter.FindElementModule; import com.mad.endomondo.gpxexporter.exception.ExporterException; public class ExportDayCommand implements RetryableCommand<LocalDate, String> { private WebDriver driver; private FindElementModule findElementModule; public ExportDayCommand(WebDriver driver, FindElementModule findElementModule) { super(); this.driver = driver; this.findElementModule = findElementModule; } @Override public String execute(LocalDate d) { String iconsXPath = "//td[contains(concat(' ',normalize-space(@class),' '),' in-month')]//span[contains(concat(' ',normalize-space(@class),' '),' cday')][text()=\"" + d.getDayOfMonth() + "\"]/..//a"; List<WebElement> icons = driver.findElements(By.xpath(iconsXPath)); int iconsCount = icons.size(); icons = null; // can't iterate over that - // org.openqa.selenium.StaleElementReferenceException: // Element is no longer attached to the DOM for (int i = 0; i < iconsCount; i++) { String iconXpath = "(" + iconsXPath + ")[" + (i + 1) + "]"; WebElement icon = driver.findElement(By.xpath(iconXpath)); System.out.println(icon.getAttribute("id")); System.out.println("Clicking icon"); icon.click(); // Hover WebElement more = driver .findElement(By .xpath("//li[contains(concat(' ',normalize-space(@class),' '),' dropdown')]")); new Actions(driver).moveToElement(more).build().perform(); WebDriverWait wait = new WebDriverWait(driver, 30); WebElement element = wait .until(ExpectedConditions.visibilityOfElementLocated(By .xpath("//a[contains(concat(' ',normalize-space(@class),' '),' export')]"))); System.out.println("Clicking export button"); element.click(); // Wait for javascript to render the popup findElementModule.fluentWait(By.xpath("//div[@id='exporter']")); String tcxGpx = "id('lightboxContainer')//td//a"; List<WebElement> exportLinks = driver .findElements(By.xpath(tcxGpx)); System.out.println("Export tcx"); exportLinks.get(0).click(); System.out.println("Export gpx"); exportLinks.get(1).click(); RetryableCommand<Object, Object> closeExportPopupCommand = new CloseExportPopupCommand( driver); RetryExcutor<Object, Object> executor = new RetryExcutor<>(); try { executor.executeWithRetries(10, closeExportPopupCommand, null); } catch (Exception e) { throw new ExporterException( "Error closing export popup. Too many retries. Date=" + d, e); } } if (iconsCount == 0) { System.out.println("No workouts."); } return null; } }
3,070
0.705537
0.702606
96
30.979166
28.201647
166
false
false
0
0
0
0
0
0
2.625
false
false
4
0ca612891e9ec9a91ce3ee6728936fb05fce179c
1,537,598,313,090
cfcef33a29d8f4b2969dc317dc52db5e762f792e
/src/main/java/algorithm/Interview/practice04/P_4_17_NQueens.java
b320ee83fe862de43f2dbaa95396147b78a2d6eb
[]
no_license
wangyonghui888/Java
https://github.com/wangyonghui888/Java
d23d0ec56c6936ee510574112c4c365203924382
96b9999f6b1def84d698a990abe6a818258b6869
refs/heads/master
2023-04-15T08:18:10.372000
2021-04-25T17:14:51
2021-04-25T17:14:51
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package algorithm.Interview.practice04; /** * @author mood321 * @date 2020/8/5 0:46 * @email 371428187@qq.com */ public class P_4_17_NQueens { //Solution: 定义一个全局变量sum作为最后的返回值 //定义一个int[] cols数组用来记录已经访问过列 //然后逐列进行查找,递归和backtrack。 public static int sum; public int nQueens(int n) { sum=0; int[] cols=new int[n]; //cols用来定义已访问过的列 helper(cols,n,0); return sum; } private void helper(int[] cols, int n, int row){ if(row==n){ sum++; return; } for(int i=0;i<n;i++){ if(isValid(cols,row,i)) { //如果合法,那么继续做下一行 cols[row]=i; helper(cols,n,row+1); } } } private boolean isValid(int[] cols, int row, int col) { //定义 isValid 来check是否合法 for(int i=0;i<row;i++){ if(cols[i]==col){ return false; } if((row-i)==Math.abs(col-cols[i])){ return false; } } return true; } }
UTF-8
Java
1,252
java
P_4_17_NQueens.java
Java
[ { "context": "ge algorithm.Interview.practice04;\n\n/**\n * @author mood321\n * @date 2020/8/5 0:46\n * @email 371428187@qq.com", "end": 63, "score": 0.999480128288269, "start": 56, "tag": "USERNAME", "value": "mood321" }, { "context": " @author mood321\n * @date 2020/8/5 0:46\n * @email 371428187@qq.com\n */\npublic class P_4_17_NQueens {\n //Solution:", "end": 113, "score": 0.999785840511322, "start": 97, "tag": "EMAIL", "value": "371428187@qq.com" } ]
null
[]
package algorithm.Interview.practice04; /** * @author mood321 * @date 2020/8/5 0:46 * @email <EMAIL> */ public class P_4_17_NQueens { //Solution: 定义一个全局变量sum作为最后的返回值 //定义一个int[] cols数组用来记录已经访问过列 //然后逐列进行查找,递归和backtrack。 public static int sum; public int nQueens(int n) { sum=0; int[] cols=new int[n]; //cols用来定义已访问过的列 helper(cols,n,0); return sum; } private void helper(int[] cols, int n, int row){ if(row==n){ sum++; return; } for(int i=0;i<n;i++){ if(isValid(cols,row,i)) { //如果合法,那么继续做下一行 cols[row]=i; helper(cols,n,row+1); } } } private boolean isValid(int[] cols, int row, int col) { //定义 isValid 来check是否合法 for(int i=0;i<row;i++){ if(cols[i]==col){ return false; } if((row-i)==Math.abs(col-cols[i])){ return false; } } return true; } }
1,243
0.462795
0.434664
54
19.425926
14.2953
57
false
false
0
0
0
0
0
0
0.5
false
false
4
0afb5072f6126a6acdbf36e6d1217dac8b057155
16,990,890,675,998
2c12f24988ef9526dde02b0312883270f207b860
/Back-end/FirstSpringProject(Hibernate - Criteria API)/src/com/ibm/controllers/MessageController.java
6f569c5487056e80876a1ef0a07fea9010efbb4f
[]
no_license
bborisov/chat-app
https://github.com/bborisov/chat-app
25c81a474df79d6976ef2eefb23712d6f3f4e83f
c2e7496c551e6acbe39b3f31c117aacbbeb67121
refs/heads/master
2021-09-17T11:20:21.839000
2018-07-01T13:44:32
2018-07-01T13:44:32
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ibm.controllers; import java.io.IOException; import java.security.Principal; import java.util.List; import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.messaging.handler.annotation.MessageMapping; import org.springframework.messaging.simp.SimpMessageSendingOperations; import org.springframework.web.bind.annotation.RestController; import com.ibm.other.Message; import com.ibm.other.MessageCreateDto; import com.ibm.other.MessageEditDto; import com.ibm.services.MessageService; @RestController public class MessageController { @Autowired private MessageService messageService; @Autowired private SimpMessageSendingOperations messagingTemplate; @MessageMapping(value = "/sendMessage") public void sendMessage(MessageCreateDto messageCreateDto, Principal principal) throws IOException { boolean flag = false; Message message = null; try { message = messageService.sendMessage(messageCreateDto); flag = true; } finally { messagingTemplate.convertAndSendToUser(principal.getName(), "/queue/chats/" + message.getChatId() + "/messages/sendMessage", flag); messagingTemplate.convertAndSend("/topic/chats/" + message.getChatId() + "/messages/newMessageInChat", message); } } @MessageMapping(value = "/editMessage") public void editMessage(MessageEditDto messageEditDto, Principal principal) throws IOException { boolean flag = false; Message message = null; try { message = messageService.editMessage(messageEditDto); flag = true; } finally { messagingTemplate.convertAndSendToUser(principal.getName(), "/queue/chats/" + message.getChatId() + "/messages/" + message.getId() + "/editMessage", flag); messagingTemplate.convertAndSend("/topic/chats/" + message.getChatId() + "/messages/editedMessageInChat", message); } } @MessageMapping(value = "/getAllMessagesFromChat") public void getAllMessagesFromChat(int chatId, Principal principal) throws IOException { List<Message> messages = messageService.getAllMessagesFromChat(chatId); Map<Integer, Message> prettyMessages = messages.parallelStream().collect(Collectors.toMap(Message::getId, Function.identity())); messagingTemplate.convertAndSendToUser(principal.getName(), "/queue/getAllMessagesFromChat", prettyMessages); } // @RequestMapping(value = "/sendMessage", method = RequestMethod.POST) // public void sendMessage(int senderId, int chatId, String content) throws IOException { // messageService.sendMessage(senderId, chatId, content); // } // // @RequestMapping(value = "/editMessage", method = RequestMethod.PATCH) // public void editMessage(int messageId, String content) throws IOException { // messageService.editMessage(messageId, content); // } // // @RequestMapping(value = "/getAllMessagesFromChat", method = RequestMethod.GET) // public List<Message> getAllMessagesFromChat(@RequestParam(value = "chatId") int chatId) throws IOException { // return messageService.getAllMessagesFromChat(chatId); // } }
UTF-8
Java
3,091
java
MessageController.java
Java
[]
null
[]
package com.ibm.controllers; import java.io.IOException; import java.security.Principal; import java.util.List; import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.messaging.handler.annotation.MessageMapping; import org.springframework.messaging.simp.SimpMessageSendingOperations; import org.springframework.web.bind.annotation.RestController; import com.ibm.other.Message; import com.ibm.other.MessageCreateDto; import com.ibm.other.MessageEditDto; import com.ibm.services.MessageService; @RestController public class MessageController { @Autowired private MessageService messageService; @Autowired private SimpMessageSendingOperations messagingTemplate; @MessageMapping(value = "/sendMessage") public void sendMessage(MessageCreateDto messageCreateDto, Principal principal) throws IOException { boolean flag = false; Message message = null; try { message = messageService.sendMessage(messageCreateDto); flag = true; } finally { messagingTemplate.convertAndSendToUser(principal.getName(), "/queue/chats/" + message.getChatId() + "/messages/sendMessage", flag); messagingTemplate.convertAndSend("/topic/chats/" + message.getChatId() + "/messages/newMessageInChat", message); } } @MessageMapping(value = "/editMessage") public void editMessage(MessageEditDto messageEditDto, Principal principal) throws IOException { boolean flag = false; Message message = null; try { message = messageService.editMessage(messageEditDto); flag = true; } finally { messagingTemplate.convertAndSendToUser(principal.getName(), "/queue/chats/" + message.getChatId() + "/messages/" + message.getId() + "/editMessage", flag); messagingTemplate.convertAndSend("/topic/chats/" + message.getChatId() + "/messages/editedMessageInChat", message); } } @MessageMapping(value = "/getAllMessagesFromChat") public void getAllMessagesFromChat(int chatId, Principal principal) throws IOException { List<Message> messages = messageService.getAllMessagesFromChat(chatId); Map<Integer, Message> prettyMessages = messages.parallelStream().collect(Collectors.toMap(Message::getId, Function.identity())); messagingTemplate.convertAndSendToUser(principal.getName(), "/queue/getAllMessagesFromChat", prettyMessages); } // @RequestMapping(value = "/sendMessage", method = RequestMethod.POST) // public void sendMessage(int senderId, int chatId, String content) throws IOException { // messageService.sendMessage(senderId, chatId, content); // } // // @RequestMapping(value = "/editMessage", method = RequestMethod.PATCH) // public void editMessage(int messageId, String content) throws IOException { // messageService.editMessage(messageId, content); // } // // @RequestMapping(value = "/getAllMessagesFromChat", method = RequestMethod.GET) // public List<Message> getAllMessagesFromChat(@RequestParam(value = "chatId") int chatId) throws IOException { // return messageService.getAllMessagesFromChat(chatId); // } }
3,091
0.777742
0.777742
77
39.142857
38.97509
158
false
false
0
0
0
0
0
0
1.87013
false
false
4
8dc06d13b594a222c271779c1005cdd45c99619c
27,754,078,688,018
64c1ecd7593007bf97e7f7f4048d74d571771601
/server/src/main/java/services/PollService.java
dcbf6fa3f94b845349b3a28dfb98a12f155a99a8
[]
no_license
amandaf360/TicketToRide
https://github.com/amandaf360/TicketToRide
a53d0182c6993fc901ac842fb57757fd83c8d7db
f3300d10ecd778051c449126ba60b9c94f9c6fdf
refs/heads/master
2023-05-01T00:37:06.539000
2019-04-17T21:32:02
2019-04-17T21:32:02
168,186,362
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package services; import java.util.ArrayList; import responses.PollResponse; import server.ClientCommandManager; import servermodel.Game; import servermodel.ModelRoot; public class PollService { public PollResponse poll(String username, boolean firstPoll) { PollResponse response = new PollResponse(); if(!firstPoll) { ClientCommandManager manager = ClientCommandManager.getCommandManager(); response = manager.poll(username); response.setUsername(username); return response; } else { ModelRoot model = ModelRoot.getModel(); response.setGamesCreated(model.getGameList()); if(response.getGamesCreated() == null) { response.setGamesCreated(new ArrayList<Game>()); } ClientCommandManager.getCommandManager().pollClear(username); return response; } } }
UTF-8
Java
968
java
PollService.java
Java
[]
null
[]
package services; import java.util.ArrayList; import responses.PollResponse; import server.ClientCommandManager; import servermodel.Game; import servermodel.ModelRoot; public class PollService { public PollResponse poll(String username, boolean firstPoll) { PollResponse response = new PollResponse(); if(!firstPoll) { ClientCommandManager manager = ClientCommandManager.getCommandManager(); response = manager.poll(username); response.setUsername(username); return response; } else { ModelRoot model = ModelRoot.getModel(); response.setGamesCreated(model.getGameList()); if(response.getGamesCreated() == null) { response.setGamesCreated(new ArrayList<Game>()); } ClientCommandManager.getCommandManager().pollClear(username); return response; } } }
968
0.626033
0.626033
34
27.470589
23.006693
84
false
false
0
0
0
0
0
0
0.5
false
false
4
62d2c99915522c1898da2421142f51e71eeb45f9
29,832,842,894,323
2253ede6204abde4185086df1e59eab678c09106
/base/graph-serializers/src/main/java/com/nc/gs/serializers/java/util/DateSerializer.java
15aa621119946b660085c6eea35f191664b67940
[]
no_license
diretrixbr/nc
https://github.com/diretrixbr/nc
54faf60c98405c78365fc18c4ed4f8e469524fd5
5f4ca70a9ce8c1d173969c5ea5e84963e3f9456f
refs/heads/master
2016-09-13T16:34:23.086000
2016-05-18T19:32:33
2016-05-18T19:32:33
59,144,606
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nc.gs.serializers.java.util; import java.nio.ByteBuffer; import java.util.Date; import com.nc.gs.core.Context; import com.nc.gs.core.GraphSerializer; public final class DateSerializer extends GraphSerializer { public DateSerializer() { } @Override public Object instantiate(ByteBuffer src) { return new Date(src.getLong()); } @Override public void writeData(Context c, ByteBuffer dst, Object o) { dst.putLong(((Date) o).getTime()); } }
UTF-8
Java
467
java
DateSerializer.java
Java
[]
null
[]
package com.nc.gs.serializers.java.util; import java.nio.ByteBuffer; import java.util.Date; import com.nc.gs.core.Context; import com.nc.gs.core.GraphSerializer; public final class DateSerializer extends GraphSerializer { public DateSerializer() { } @Override public Object instantiate(ByteBuffer src) { return new Date(src.getLong()); } @Override public void writeData(Context c, ByteBuffer dst, Object o) { dst.putLong(((Date) o).getTime()); } }
467
0.740899
0.740899
24
18.458334
19.782103
61
false
false
0
0
0
0
0
0
0.875
false
false
4
9074350a1dba584cedbfa7239e8ed7d9c32084c0
12,369,505,838,277
9da572f293e93043ab2dbc555929475ad349d6e8
/src/main/java/juja/microservices/gamification/exceptions/UserMicroserviceExchangeException.java
01b097a47f95f02fdb92fea56025e3461e676cf1
[]
no_license
Moses-odessa/gamification
https://github.com/Moses-odessa/gamification
74fceb3d524bfc95f4947a4c188370b09b955f78
96a6093f8966792c1470dad441844d9be7963e9b
refs/heads/master
2021-07-16T12:25:01.447000
2017-10-13T13:37:59
2017-10-13T13:37:59
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package juja.microservices.gamification.exceptions; public class UserMicroserviceExchangeException extends GamificationException { public UserMicroserviceExchangeException(String message) { super(message); } }
UTF-8
Java
227
java
UserMicroserviceExchangeException.java
Java
[]
null
[]
package juja.microservices.gamification.exceptions; public class UserMicroserviceExchangeException extends GamificationException { public UserMicroserviceExchangeException(String message) { super(message); } }
227
0.801762
0.801762
7
31.428572
29.688175
78
false
false
0
0
0
0
0
0
0.285714
false
false
4
cc18fd01200b4e96fd25bebc6c8bad1532f07fc9
32,993,938,795,922
47b2d55e5517f7201ca8f1fd9bca1ba91193ec00
/app/src/main/java/com/example/mariu/myapplication/DishList.java
3e9c29ce19c82744761c4fd7608b26f3dce207a4
[]
no_license
mtricolici98/PandaSushi
https://github.com/mtricolici98/PandaSushi
1eb90a80473517b4576166e7f294201e5d356903
7cc468e5fc1298105680e7d9eea34eabfd720f3c
refs/heads/master
2021-09-13T05:31:05.952000
2018-04-25T12:47:24
2018-04-25T12:47:24
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.mariu.myapplication; import android.graphics.drawable.Drawable; import android.nfc.Tag; import android.support.annotation.NonNull; import android.util.Log; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.ChildEventListener; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Observable; /** * Created by mariu on 11/14/2017. */ public class DishList { private FirebaseDatabase database; private FirebaseAuth mAuth; private static DishList instance; private ArrayList<Dish> dishes; private ArrayList<CartItem> cart; private DishList(){ dishes = new ArrayList<Dish>(); cart = new ArrayList<CartItem>(); } public static DishList getInstance(){ if(instance == null){ instance = new DishList(); } return instance; } public void addToList(Dish dish){ Log.d("BUGGG","addtolistbug"); dishes.add(dish); } public void loadItems(String name, int price, String cat, String descrption) { database = FirebaseDatabase.getInstance(); DatabaseReference myRef = database.getReference("dishlist"); myRef.push().setValue(new Dish(name, cat, price, descrption)); } public boolean reloadItems() { dishes.clear(); database = FirebaseDatabase.getInstance(); DatabaseReference myRef = database.getReference("dishlist"); Log.d("OBJECTNAME", "TRYING"); myRef.addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String s) { Dish o = dataSnapshot.getValue(Dish.class); dishes.add(o); Log.d("objinfo",o.getresName()+" "+o.getCategory()+" "+o.getPrice()+" " +o.getDescription()); } @Override public void onChildChanged(DataSnapshot dataSnapshot, String s) { } @Override public void onChildRemoved(DataSnapshot dataSnapshot) { } @Override public void onChildMoved(DataSnapshot dataSnapshot, String s) { } @Override public void onCancelled(DatabaseError databaseError) { } } ); return true; } public ArrayList<Dish> getList(){ Log.d("BUGGGG","getlistbug"); return dishes; } public ArrayList<Dish> getList(String cat){ ArrayList<Dish> temp = new ArrayList<Dish>(); if(cat.equals("all")){ return dishes; } else { for(int i=0;i<dishes.size();i++){ if(dishes.get(i).getCategory().equals(cat)){ temp.add(dishes.get(i)); }} } return temp; } public static int getId(String resourceName, Class<?> c) { try { Field idField = c.getDeclaredField(resourceName); return idField.getInt(idField); } catch (Exception e) { throw new RuntimeException("No resource ID found for: " + resourceName + " / " + c, e); } } public void addToCart(Dish obj){ cart.add(new CartItem(obj,1)); } public Dish getDish(String refname){ for(int i=0;i<dishes.size();i++){ if(dishes.get(i).getresName().equals(refname)){ return dishes.get(i); } } return null; } public ArrayList<CartItem> getCart(){ return cart; } public void deleteFromCart(CartItem obj){ cart.remove(obj); } public void saveCart(){ } public void placeOrder(String name, String adress, String phone,String type){ database = FirebaseDatabase.getInstance(); DatabaseReference myRef = database.getReference("orders"); myRef.push().setValue(new Order(cart, name,adress,phone,type)); } public void emptyCart(){ cart.clear(); } }
UTF-8
Java
5,221
java
DishList.java
Java
[ { "context": "t;\nimport java.util.Observable;\n\n/**\n * Created by mariu on 11/14/2017.\n */\n\npublic class DishList {\n p", "end": 877, "score": 0.9935935139656067, "start": 872, "tag": "USERNAME", "value": "mariu" } ]
null
[]
package com.example.mariu.myapplication; import android.graphics.drawable.Drawable; import android.nfc.Tag; import android.support.annotation.NonNull; import android.util.Log; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.ChildEventListener; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Observable; /** * Created by mariu on 11/14/2017. */ public class DishList { private FirebaseDatabase database; private FirebaseAuth mAuth; private static DishList instance; private ArrayList<Dish> dishes; private ArrayList<CartItem> cart; private DishList(){ dishes = new ArrayList<Dish>(); cart = new ArrayList<CartItem>(); } public static DishList getInstance(){ if(instance == null){ instance = new DishList(); } return instance; } public void addToList(Dish dish){ Log.d("BUGGG","addtolistbug"); dishes.add(dish); } public void loadItems(String name, int price, String cat, String descrption) { database = FirebaseDatabase.getInstance(); DatabaseReference myRef = database.getReference("dishlist"); myRef.push().setValue(new Dish(name, cat, price, descrption)); } public boolean reloadItems() { dishes.clear(); database = FirebaseDatabase.getInstance(); DatabaseReference myRef = database.getReference("dishlist"); Log.d("OBJECTNAME", "TRYING"); myRef.addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String s) { Dish o = dataSnapshot.getValue(Dish.class); dishes.add(o); Log.d("objinfo",o.getresName()+" "+o.getCategory()+" "+o.getPrice()+" " +o.getDescription()); } @Override public void onChildChanged(DataSnapshot dataSnapshot, String s) { } @Override public void onChildRemoved(DataSnapshot dataSnapshot) { } @Override public void onChildMoved(DataSnapshot dataSnapshot, String s) { } @Override public void onCancelled(DatabaseError databaseError) { } } ); return true; } public ArrayList<Dish> getList(){ Log.d("BUGGGG","getlistbug"); return dishes; } public ArrayList<Dish> getList(String cat){ ArrayList<Dish> temp = new ArrayList<Dish>(); if(cat.equals("all")){ return dishes; } else { for(int i=0;i<dishes.size();i++){ if(dishes.get(i).getCategory().equals(cat)){ temp.add(dishes.get(i)); }} } return temp; } public static int getId(String resourceName, Class<?> c) { try { Field idField = c.getDeclaredField(resourceName); return idField.getInt(idField); } catch (Exception e) { throw new RuntimeException("No resource ID found for: " + resourceName + " / " + c, e); } } public void addToCart(Dish obj){ cart.add(new CartItem(obj,1)); } public Dish getDish(String refname){ for(int i=0;i<dishes.size();i++){ if(dishes.get(i).getresName().equals(refname)){ return dishes.get(i); } } return null; } public ArrayList<CartItem> getCart(){ return cart; } public void deleteFromCart(CartItem obj){ cart.remove(obj); } public void saveCart(){ } public void placeOrder(String name, String adress, String phone,String type){ database = FirebaseDatabase.getInstance(); DatabaseReference myRef = database.getReference("orders"); myRef.push().setValue(new Order(cart, name,adress,phone,type)); } public void emptyCart(){ cart.clear(); } }
5,221
0.536296
0.534189
165
30.642424
26.750237
137
false
false
0
0
0
0
0
0
0.533333
false
false
4
bec6c1851aaef903c606745aecdb8a232ad7c619
24,876,450,636,816
7f4c91c61c53f33b715c95670aba48c925d91944
/src/java/networks/InstanceVirtualInterface.java
f1611e78acc2c4bc1fee58af2ba94b68f1be93d5
[]
no_license
YassineFadhlaoui/Nokia-eNodeB
https://github.com/YassineFadhlaoui/Nokia-eNodeB
80b433313ae9cd02d486bee51efacc4008da9b8c
81e0126933338ded91706531a1ef35a02ed039cc
refs/heads/master
2020-04-08T07:51:01.483000
2018-11-26T12:56:07
2018-11-26T12:56:07
159,154,221
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package networks; /** * * @author occ */ public class InstanceVirtualInterface { private String IpAddress; private String macAddress; public InstanceVirtualInterface() { } public InstanceVirtualInterface(String IpAddress, String macAddress) { this.IpAddress = IpAddress; this.macAddress = macAddress; } public String getIpAddress() { return IpAddress; } public String getMacAddress() { return macAddress; } public void setIpAddress(String IpAddress) { this.IpAddress = IpAddress; } public void setMacAddress(String macAddress) { this.macAddress = macAddress; } @Override public String toString() { return "InstanceVirtualInterface{" + "IpAddress=" + IpAddress + ", macAddress=" + macAddress + '}'; } }
UTF-8
Java
1,025
java
InstanceVirtualInterface.java
Java
[ { "context": "e editor.\n */\npackage networks;\n\n/**\n *\n * @author occ\n */\npublic class InstanceVirtualInterface {\n pr", "end": 225, "score": 0.9993296265602112, "start": 222, "tag": "USERNAME", "value": "occ" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package networks; /** * * @author occ */ public class InstanceVirtualInterface { private String IpAddress; private String macAddress; public InstanceVirtualInterface() { } public InstanceVirtualInterface(String IpAddress, String macAddress) { this.IpAddress = IpAddress; this.macAddress = macAddress; } public String getIpAddress() { return IpAddress; } public String getMacAddress() { return macAddress; } public void setIpAddress(String IpAddress) { this.IpAddress = IpAddress; } public void setMacAddress(String macAddress) { this.macAddress = macAddress; } @Override public String toString() { return "InstanceVirtualInterface{" + "IpAddress=" + IpAddress + ", macAddress=" + macAddress + '}'; } }
1,025
0.659512
0.659512
45
21.777779
24.38842
107
false
false
0
0
0
0
0
0
0.333333
false
false
4
e5caea66fe14e391b726ceb65fe3de0e0e8b3514
15,891,378,997,874
e68475c404faf20dd6f87916cae70f8547c8f264
/app/src/main/java/com/app/mylibertadriver/model/orders/TaskResponse.java
8b226c8abd0a60419a978200e0eab191e068c8c5
[]
no_license
androiddeveloperve1/Haute_Driver
https://github.com/androiddeveloperve1/Haute_Driver
b48539966120d5155a21c13fd475ec8728ad9a9d
4cbe36b3c990ff08466c10dd2a55b7db27416c80
refs/heads/master
2021-06-26T09:38:14.372000
2020-08-24T03:57:45
2020-08-24T03:57:45
191,577,457
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.app.mylibertadriver.model.orders; import androidx.databinding.BaseObservable; import androidx.databinding.Bindable; import com.app.mylibertadriver.BR; import com.app.mylibertadriver.model.TaskOrderInfo; import com.google.gson.annotations.SerializedName; import java.util.ArrayList; /** * Create By Rahul Mangal * Project SignupLibrary Screen */ public class TaskResponse extends BaseObservable { private String _id; private String status; private String response; private String order_id; private String order_no; private String driver_id; private String createdAt; private String updatedAt; private String otp; private TaskOrderInfo orderInfo; @Bindable public String getOrder_no() { return order_no; } public void setOrder_no(String order_no) { this.order_no = order_no; this.notifyPropertyChanged(BR.order_no); } @Bindable public String getUpdatedAt() { return updatedAt; } public void setUpdatedAt(String updatedAt) { this.updatedAt = updatedAt; this.notifyPropertyChanged(androidx.databinding.library.baseAdapters.BR.updatedAt); } @Bindable public String get_id() { return _id; } public void set_id(String _id) { this._id = _id; this.notifyPropertyChanged(androidx.databinding.library.baseAdapters.BR._id); } @Bindable public TaskOrderInfo getOrderInfo() { return orderInfo; } public void setOrderInfo(TaskOrderInfo orderInfo) { this.orderInfo = orderInfo; this.notifyPropertyChanged(BR.orderInfo); } @Bindable public String getStatus() { return status; } public void setStatus(String status) { this.status = status; this.notifyPropertyChanged(com.app.mylibertadriver.BR.status); } @Bindable public String getResponse() { return response; } public void setResponse(String response) { this.response = response; this.notifyPropertyChanged(com.app.mylibertadriver.BR.response); } @Bindable public String getCreatedAt() { return createdAt; } public void setCreatedAt(String createdAt) { this.createdAt = createdAt; this.notifyPropertyChanged(com.app.mylibertadriver.BR.createdAt); } @Bindable public String getOrder_id() { return order_id; } public void setOrder_id(String order_id) { this.order_id = order_id; this.notifyPropertyChanged(com.app.mylibertadriver.BR.order_id); } @Bindable public String getDriver_id() { return driver_id; } public void setDriver_id(String driver_id) { this.driver_id = driver_id; this.notifyPropertyChanged(com.app.mylibertadriver.BR.driver_id); } @Bindable public String getOtp() { return otp; } public void setOtp(String otp) { this.otp = otp; this.notifyPropertyChanged(com.app.mylibertadriver.BR.otp); } }
UTF-8
Java
3,062
java
TaskResponse.java
Java
[ { "context": "me;\n\nimport java.util.ArrayList;\n\n/**\n * Create By Rahul Mangal\n * Project SignupLibrary Screen\n */\n\npublic class", "end": 327, "score": 0.999840497970581, "start": 315, "tag": "NAME", "value": "Rahul Mangal" } ]
null
[]
package com.app.mylibertadriver.model.orders; import androidx.databinding.BaseObservable; import androidx.databinding.Bindable; import com.app.mylibertadriver.BR; import com.app.mylibertadriver.model.TaskOrderInfo; import com.google.gson.annotations.SerializedName; import java.util.ArrayList; /** * Create By <NAME> * Project SignupLibrary Screen */ public class TaskResponse extends BaseObservable { private String _id; private String status; private String response; private String order_id; private String order_no; private String driver_id; private String createdAt; private String updatedAt; private String otp; private TaskOrderInfo orderInfo; @Bindable public String getOrder_no() { return order_no; } public void setOrder_no(String order_no) { this.order_no = order_no; this.notifyPropertyChanged(BR.order_no); } @Bindable public String getUpdatedAt() { return updatedAt; } public void setUpdatedAt(String updatedAt) { this.updatedAt = updatedAt; this.notifyPropertyChanged(androidx.databinding.library.baseAdapters.BR.updatedAt); } @Bindable public String get_id() { return _id; } public void set_id(String _id) { this._id = _id; this.notifyPropertyChanged(androidx.databinding.library.baseAdapters.BR._id); } @Bindable public TaskOrderInfo getOrderInfo() { return orderInfo; } public void setOrderInfo(TaskOrderInfo orderInfo) { this.orderInfo = orderInfo; this.notifyPropertyChanged(BR.orderInfo); } @Bindable public String getStatus() { return status; } public void setStatus(String status) { this.status = status; this.notifyPropertyChanged(com.app.mylibertadriver.BR.status); } @Bindable public String getResponse() { return response; } public void setResponse(String response) { this.response = response; this.notifyPropertyChanged(com.app.mylibertadriver.BR.response); } @Bindable public String getCreatedAt() { return createdAt; } public void setCreatedAt(String createdAt) { this.createdAt = createdAt; this.notifyPropertyChanged(com.app.mylibertadriver.BR.createdAt); } @Bindable public String getOrder_id() { return order_id; } public void setOrder_id(String order_id) { this.order_id = order_id; this.notifyPropertyChanged(com.app.mylibertadriver.BR.order_id); } @Bindable public String getDriver_id() { return driver_id; } public void setDriver_id(String driver_id) { this.driver_id = driver_id; this.notifyPropertyChanged(com.app.mylibertadriver.BR.driver_id); } @Bindable public String getOtp() { return otp; } public void setOtp(String otp) { this.otp = otp; this.notifyPropertyChanged(com.app.mylibertadriver.BR.otp); } }
3,056
0.662312
0.662312
131
22.374046
21.127506
91
false
false
0
0
0
0
0
0
0.358779
false
false
4
d8b4cf092b507a195cfef1c1c75e4046c997350e
2,834,678,446,880
24d8cf871b092b2d60fc85d5320e1bc761a7cbe2
/iText/rev2818-3306/right-branch-3306/core/com/lowagie/text/pdf/PdfTextArray.java
93a286cb26095823e55ddb14edf45af70f8cf702
[]
no_license
joliebig/featurehouse_fstmerge_examples
https://github.com/joliebig/featurehouse_fstmerge_examples
af1b963537839d13e834f829cf51f8ad5e6ffe76
1a99c1788f0eb9f1e5d8c2ced3892d00cd9449ad
refs/heads/master
2016-09-05T10:24:50.974000
2013-03-28T16:28:47
2013-03-28T16:28:47
9,080,611
3
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lowagie.text.pdf; import java.util.ArrayList; public class PdfTextArray{ ArrayList<Object> arrayList = new ArrayList<Object>(); public PdfTextArray(String str) { arrayList.add(str); } public PdfTextArray() { } public void add(PdfNumber number) { arrayList.add(new Float(number.doubleValue())); } public void add(float number) { arrayList.add(new Float(number)); } public void add(String str) { arrayList.add(str); } ArrayList<Object> getArrayList() { return arrayList; } }
UTF-8
Java
640
java
PdfTextArray.java
Java
[]
null
[]
package com.lowagie.text.pdf; import java.util.ArrayList; public class PdfTextArray{ ArrayList<Object> arrayList = new ArrayList<Object>(); public PdfTextArray(String str) { arrayList.add(str); } public PdfTextArray() { } public void add(PdfNumber number) { arrayList.add(new Float(number.doubleValue())); } public void add(float number) { arrayList.add(new Float(number)); } public void add(String str) { arrayList.add(str); } ArrayList<Object> getArrayList() { return arrayList; } }
640
0.571875
0.571875
39
15.384615
16.407652
58
false
false
0
0
0
0
0
0
0.205128
false
false
4
86bbb1fbe479f41208e51725cd7a8b75d1692905
2,834,678,445,407
60909c169ef268dc5c2030dba244ebb4be3eea1c
/src/main/java/com/way/waybillsystem/wechat/entity/Image.java
9262db6b0a3073d6123b00a2d7056b93e40edcbf
[]
no_license
wayleung/WaybillSystem
https://github.com/wayleung/WaybillSystem
f4990178487f3988587cc77c7d431c43b12aa277
2f3c5bf9468a012afa46016c6d7a363aa599fc66
refs/heads/master
2021-09-15T20:27:54.037000
2018-06-10T14:07:44
2018-06-10T14:07:44
122,506,553
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.way.waybillsystem.wechat.entity; public class Image { private String MediaId; }
UTF-8
Java
100
java
Image.java
Java
[]
null
[]
package com.way.waybillsystem.wechat.entity; public class Image { private String MediaId; }
100
0.74
0.74
5
18
16.382917
44
false
false
0
0
0
0
0
0
0.6
false
false
4
1979f69dfc630d53f9849a744464e6aecbb140c8
19,567,871,059,248
dc25b23f8132469fd95cee14189672cebc06aa56
/vendor/mediatek/proprietary/packages/apps/RCSe/RcsStack/src/com/orangelabs/rcs/provider/eab/RichAddressBookData.java
705a27ff5ab5e212ce71a0ee7c440e9cf40e9c9e
[ "Apache-2.0", "LicenseRef-scancode-public-domain" ]
permissive
nofearnohappy/alps_mm
https://github.com/nofearnohappy/alps_mm
b407d3ab2ea9fa0a36d09333a2af480b42cfe65c
9907611f8c2298fe4a45767df91276ec3118dd27
refs/heads/master
2020-04-23T08:46:58.421000
2019-03-28T21:19:33
2019-03-28T21:19:33
171,048,255
1
5
null
false
2020-03-08T03:49:37
2019-02-16T20:25:00
2019-03-28T21:19:47
2019-03-28T21:19:45
1,403,685
0
3
1
Java
false
false
/******************************************************************************* * Software Name : RCS IMS Stack * * Copyright (C) 2010 France Telecom S.A. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ package com.orangelabs.rcs.provider.eab; import org.gsma.joyn.capability.CapabilitiesLog; import android.net.Uri; /** * Rich address book data constants * * @author Jean-Marc AUFFRET */ public class RichAddressBookData { /** * Database URI */ static final Uri CONTENT_URI = Uri.parse("content://com.orangelabs.rcs.eab/eab"); /** * Column name */ static final String KEY_ID = "_id"; /** * Column name */ static final String KEY_CONTACT_NUMBER = CapabilitiesLog.CONTACT_NUMBER; /** * Column name */ static final String KEY_PRESENCE_SHARING_STATUS = "presence_sharing_status"; /** * Column name */ static final String KEY_TIMESTAMP = "timestamp"; /** * Column name */ static final String KEY_RCS_STATUS = "rcs_status"; /** * Column name */ static final String KEY_REGISTRATION_STATE = "registration_state"; /** * Column name */ static final String KEY_RCS_STATUS_TIMESTAMP = "rcs_status_timestamp"; /** * Column name */ static final String KEY_PRESENCE_FREE_TEXT = "presence_free_text"; /** * Column name */ static final String KEY_PRESENCE_WEBLINK_NAME = "presence_weblink_name"; /** * Column name */ static final String KEY_PRESENCE_WEBLINK_URL = "presence_weblink_url"; /** * Column name */ static final String KEY_PRESENCE_PHOTO_EXIST_FLAG = "presence_photo_exist_flag"; /** * Column name */ static final String KEY_PRESENCE_PHOTO_ETAG = "presence_photo_etag"; /** * Column name */ static final String KEY_PRESENCE_PHOTO_DATA = "presence_photo_data"; /** * Column name */ static final String KEY_PRESENCE_GEOLOC_EXIST_FLAG = "presence_geoloc_exist_flag"; /** * Column name */ static final String KEY_PRESENCE_GEOLOC_LATITUDE = "presence_geoloc_latitude"; /** * Column name */ static final String KEY_PRESENCE_GEOLOC_LONGITUDE = "presence_geoloc_longitude"; /** * Column name */ static final String KEY_PRESENCE_GEOLOC_ALTITUDE = "presence_geoloc_altitude"; /** * Column name */ static final String KEY_PRESENCE_TIMESTAMP = "presence_timestamp"; /** * Column name */ static final String KEY_CAPABILITY_TIMESTAMP = "capability_timestamp"; /** * Column name */ static final String KEY_CAPABILITY_CS_VIDEO = "capability_cs_video"; /** * Column name */ static final String KEY_CAPABILITY_IMAGE_SHARING = CapabilitiesLog.CAPABILITY_IMAGE_SHARE; /** * Column name */ static final String KEY_CAPABILITY_VIDEO_SHARING = CapabilitiesLog.CAPABILITY_VIDEO_SHARE; /** * Column name */ static final String KEY_CAPABILITY_IM_SESSION = CapabilitiesLog.CAPABILITY_IM_SESSION; /** * Column name */ static final String KEY_CAPABILITY_FILE_TRANSFER = CapabilitiesLog.CAPABILITY_FILE_TRANSFER; /** * Column name */ static final String KEY_CAPABILITY_PRESENCE_DISCOVERY = "capability_presence_discovery"; /** * Column name */ static final String KEY_CAPABILITY_SOCIAL_PRESENCE = "capability_social_presence"; /** * Column name */ static final String KEY_CAPABILITY_GEOLOCATION_PUSH = CapabilitiesLog.CAPABILITY_GEOLOC_PUSH; /** * Column name */ static final String KEY_CAPABILITY_FILE_TRANSFER_HTTP = "capability_file_transfer_http"; /** * Column name */ static final String KEY_CAPABILITY_FILE_TRANSFER_THUMBNAIL = "capability_file_transfer_thumbnail"; /** * Column name */ static final String KEY_CAPABILITY_EXTENSIONS = CapabilitiesLog.CAPABILITY_EXTENSIONS; /** * Column name */ static final String KEY_CAPABILITY_COMMON_EXTENSION = "capability_common_extension"; /** * Column name */ static final String KEY_CAPABILITY_IP_VOICE_CALL = CapabilitiesLog.CAPABILITY_IP_VOICE_CALL; /** * Column name */ static final String KEY_CAPABILITY_IP_VIDEO_CALL = CapabilitiesLog.CAPABILITY_IP_VIDEO_CALL; /** * Column name */ static final String KEY_CAPABILITY_GROUP_CHAT_SF = "capability_group_chat_sf"; /** * Column name */ static final String KEY_CAPABILITY_FILE_TRANSFER_SF = "capability_file_transfer_sf"; /** * Column name */ static final String KEY_CAPABILITY_IM_BLOCKED_TIMESTAMP = "im_blocked_timestamp"; /** * Column name */ static final String KEY_IM_BLOCKED = "im_blocked"; /** * TRUE value */ public static final String TRUE_VALUE = Boolean.toString(true); /** * FALSE value */ public static final String FALSE_VALUE = Boolean.toString(false); /** * Burn after reading */ public static final String KEY_CAPABILITY_BURN_AFTER_READING = CapabilitiesLog.CAPABILITY_BURN_AFTER_READING; }
UTF-8
Java
5,566
java
RichAddressBookData.java
Java
[ { "context": " * Rich address book data constants\n * \n * @author Jean-Marc AUFFRET\n */\npublic class RichAddressBookData {\n\t/**\n\t * D", "end": 989, "score": 0.999856173992157, "start": 972, "tag": "NAME", "value": "Jean-Marc AUFFRET" } ]
null
[]
/******************************************************************************* * Software Name : RCS IMS Stack * * Copyright (C) 2010 France Telecom S.A. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ package com.orangelabs.rcs.provider.eab; import org.gsma.joyn.capability.CapabilitiesLog; import android.net.Uri; /** * Rich address book data constants * * @author <NAME> */ public class RichAddressBookData { /** * Database URI */ static final Uri CONTENT_URI = Uri.parse("content://com.orangelabs.rcs.eab/eab"); /** * Column name */ static final String KEY_ID = "_id"; /** * Column name */ static final String KEY_CONTACT_NUMBER = CapabilitiesLog.CONTACT_NUMBER; /** * Column name */ static final String KEY_PRESENCE_SHARING_STATUS = "presence_sharing_status"; /** * Column name */ static final String KEY_TIMESTAMP = "timestamp"; /** * Column name */ static final String KEY_RCS_STATUS = "rcs_status"; /** * Column name */ static final String KEY_REGISTRATION_STATE = "registration_state"; /** * Column name */ static final String KEY_RCS_STATUS_TIMESTAMP = "rcs_status_timestamp"; /** * Column name */ static final String KEY_PRESENCE_FREE_TEXT = "presence_free_text"; /** * Column name */ static final String KEY_PRESENCE_WEBLINK_NAME = "presence_weblink_name"; /** * Column name */ static final String KEY_PRESENCE_WEBLINK_URL = "presence_weblink_url"; /** * Column name */ static final String KEY_PRESENCE_PHOTO_EXIST_FLAG = "presence_photo_exist_flag"; /** * Column name */ static final String KEY_PRESENCE_PHOTO_ETAG = "presence_photo_etag"; /** * Column name */ static final String KEY_PRESENCE_PHOTO_DATA = "presence_photo_data"; /** * Column name */ static final String KEY_PRESENCE_GEOLOC_EXIST_FLAG = "presence_geoloc_exist_flag"; /** * Column name */ static final String KEY_PRESENCE_GEOLOC_LATITUDE = "presence_geoloc_latitude"; /** * Column name */ static final String KEY_PRESENCE_GEOLOC_LONGITUDE = "presence_geoloc_longitude"; /** * Column name */ static final String KEY_PRESENCE_GEOLOC_ALTITUDE = "presence_geoloc_altitude"; /** * Column name */ static final String KEY_PRESENCE_TIMESTAMP = "presence_timestamp"; /** * Column name */ static final String KEY_CAPABILITY_TIMESTAMP = "capability_timestamp"; /** * Column name */ static final String KEY_CAPABILITY_CS_VIDEO = "capability_cs_video"; /** * Column name */ static final String KEY_CAPABILITY_IMAGE_SHARING = CapabilitiesLog.CAPABILITY_IMAGE_SHARE; /** * Column name */ static final String KEY_CAPABILITY_VIDEO_SHARING = CapabilitiesLog.CAPABILITY_VIDEO_SHARE; /** * Column name */ static final String KEY_CAPABILITY_IM_SESSION = CapabilitiesLog.CAPABILITY_IM_SESSION; /** * Column name */ static final String KEY_CAPABILITY_FILE_TRANSFER = CapabilitiesLog.CAPABILITY_FILE_TRANSFER; /** * Column name */ static final String KEY_CAPABILITY_PRESENCE_DISCOVERY = "capability_presence_discovery"; /** * Column name */ static final String KEY_CAPABILITY_SOCIAL_PRESENCE = "capability_social_presence"; /** * Column name */ static final String KEY_CAPABILITY_GEOLOCATION_PUSH = CapabilitiesLog.CAPABILITY_GEOLOC_PUSH; /** * Column name */ static final String KEY_CAPABILITY_FILE_TRANSFER_HTTP = "capability_file_transfer_http"; /** * Column name */ static final String KEY_CAPABILITY_FILE_TRANSFER_THUMBNAIL = "capability_file_transfer_thumbnail"; /** * Column name */ static final String KEY_CAPABILITY_EXTENSIONS = CapabilitiesLog.CAPABILITY_EXTENSIONS; /** * Column name */ static final String KEY_CAPABILITY_COMMON_EXTENSION = "capability_common_extension"; /** * Column name */ static final String KEY_CAPABILITY_IP_VOICE_CALL = CapabilitiesLog.CAPABILITY_IP_VOICE_CALL; /** * Column name */ static final String KEY_CAPABILITY_IP_VIDEO_CALL = CapabilitiesLog.CAPABILITY_IP_VIDEO_CALL; /** * Column name */ static final String KEY_CAPABILITY_GROUP_CHAT_SF = "capability_group_chat_sf"; /** * Column name */ static final String KEY_CAPABILITY_FILE_TRANSFER_SF = "capability_file_transfer_sf"; /** * Column name */ static final String KEY_CAPABILITY_IM_BLOCKED_TIMESTAMP = "im_blocked_timestamp"; /** * Column name */ static final String KEY_IM_BLOCKED = "im_blocked"; /** * TRUE value */ public static final String TRUE_VALUE = Boolean.toString(true); /** * FALSE value */ public static final String FALSE_VALUE = Boolean.toString(false); /** * Burn after reading */ public static final String KEY_CAPABILITY_BURN_AFTER_READING = CapabilitiesLog.CAPABILITY_BURN_AFTER_READING; }
5,555
0.651815
0.650377
236
22.584745
29.966599
113
true
false
0
0
0
0
0
0
0.762712
false
false
4
af6d2af618d80e9bf375f1384abcbb41fb8a05a5
3,676,492,075,032
e9a7b7c70a5592bb78efda2ebc9e856180119e75
/app_androidx/base/src/main/java/met/hx/com/base/base/activity/PBaseBottomTabActivity.java
7434be35fb759f29b9bc5df94110f3246e563ab7
[]
no_license
xiao349305433/LSY
https://github.com/xiao349305433/LSY
f34b216e85b8c09d964136d75a28fb58e80801f8
56cf6a85456c81e144536f8982210970373c3897
refs/heads/master
2023-02-09T01:49:08.071000
2020-12-29T16:05:49
2020-12-29T16:05:49
325,332,864
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package met.hx.com.base.base.activity; import android.view.MenuItem; import android.view.View; import android.widget.RelativeLayout; import androidx.annotation.CallSuper; import androidx.annotation.MenuRes; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.viewpager.widget.ViewPager; import com.google.android.material.bottomnavigation.BottomNavigationView; import java.util.ArrayList; import java.util.List; import met.hx.com.base.R; import met.hx.com.base.base.BaseAttribute; import met.hx.com.base.base.BasePresenter; import met.hx.com.librarybase.some_utils.XHStringUtil; import met.hx.com.librarybase.some_utils.util.AbFragmentPagerAdapter; import met.hx.com.librarybase.some_utils.util.AbViewPager; import met.hx.com.librarybase.views.BottomNavigationViewEx; /** * Created by huxu on 2017/11/10. */ public abstract class PBaseBottomTabActivity<T extends BasePresenter> extends BaseYesPresenterActivity implements BottomNavigationView.OnNavigationItemSelectedListener, ViewPager.OnPageChangeListener { protected AbFragmentPagerAdapter mFragmentPagerAdapter; /** * 内容的View. */ protected AbViewPager mBaseBottomTabViewpager; protected BottomNavigationViewEx mBaseBottomTabNavigation; protected RelativeLayout mBaseBottomTabRelativeContent; protected ArrayList<Fragment> arrayListFragment; protected T mBottomTabPresenter; protected List<Integer> listMenuTrue = new ArrayList<>(); protected List<Integer> listMenu = new ArrayList<>(); @Override protected void initLifeCycle() { super.initLifeCycle(); mBottomTabPresenter = (T) initPresenter(); registerLifeCycle(mBottomTabPresenter); } @CallSuper @Override protected void onInitAttribute(BaseAttribute ba) { ba.mActivityLayoutId = R.layout.base_activity_bottomtab; ba.mStatusBarActivityEnabled=false; onChildInitAttribute(ba); } @CallSuper @Override protected void initView() { ArrayList<Fragment> arr=addFragment(); if (arr != null) { if (arr.size() > 0) { mBaseBottomTabRelativeContent = (RelativeLayout) findViewById(R.id.base_bottomTab_relative_content); mBaseBottomTabViewpager = (AbViewPager) findViewById(R.id.base_bottomTab_viewpager); mBaseBottomTabViewpager.setEnabledScrollAnim(onEnabledScrollAnim()); setCanScroll(canScroll()); mBaseBottomTabNavigation = (BottomNavigationViewEx) findViewById(R.id.base_bottomTab_navigation); initStyle(mBaseBottomTabNavigation, mBaseBottomTabRelativeContent); if (getCenterLayout() != 0) { getLayoutInflater().inflate(getCenterLayout(), mBaseBottomTabRelativeContent); } if (showCenter()) { mBaseBottomTabRelativeContent.setVisibility(View.VISIBLE); } else { mBaseBottomTabRelativeContent.setVisibility(View.GONE); } mBaseBottomTabRelativeContent.setOnClickListener(v -> onCenterClick(v)); mBaseBottomTabNavigation.setOnNavigationItemSelectedListener(this); FragmentManager mFragmentManager = this.getSupportFragmentManager(); arrayListFragment = new ArrayList<>(); mFragmentPagerAdapter = new AbFragmentPagerAdapter(mFragmentManager, arrayListFragment); mBaseBottomTabViewpager.setAdapter(mFragmentPagerAdapter); mBaseBottomTabViewpager.addOnPageChangeListener(this); setMenuAndList(addTabMenuId(), addFragment()); } } } /** * 动态设置menu,menu的长度要小于等于list的长度 * * @param menuId * @param arrayList */ @CallSuper protected void setMenuAndList(int menuId, ArrayList<Fragment> arrayList) { if (menuId != 0 && arrayList != null && arrayList.size() > 0) { listMenu.clear(); listMenuTrue.clear(); mBaseBottomTabNavigation.getMenu().clear(); mBaseBottomTabNavigation.inflateMenu(menuId); setCache(arrayList.size()); mBaseBottomTabNavigation.enableAnimation(false); mBaseBottomTabNavigation.enableShiftingMode(false); mBaseBottomTabNavigation.enableItemShiftingMode(false); arrayListFragment.clear(); arrayListFragment.addAll(arrayList); mFragmentPagerAdapter.notifyDataSetChanged(); for (int i = 0; i < mBaseBottomTabNavigation.getMenu().size(); i++) { if (!XHStringUtil.isEmpty(mBaseBottomTabNavigation.getMenu().getItem(i).getTitle().toString(), false)) { listMenuTrue.add(mBaseBottomTabNavigation.getMenu().getItem(i).getItemId()); } } for (int i = 0; i < mBaseBottomTabNavigation.getMenu().size(); i++) { listMenu.add(mBaseBottomTabNavigation.getMenu().getItem(i).getItemId()); } } } /** * 动态设置缓存数量 * * @param cache */ @CallSuper protected void setCache(int cache) { mBaseBottomTabViewpager.setOffscreenPageLimit(cache); } @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { int i = item.getItemId(); int indexTrue = listMenuTrue.indexOf(i); int index = listMenu.indexOf(i); if (index != -1) { mBaseBottomTabViewpager.setCurrentItem(indexTrue); } onBottomTabClick(index); mBaseBottomTabNavigation.getMenu().getItem(index).setChecked(true); return false; } @Override public void onPageSelected(int position) { if (position < listMenuTrue.size()) { onTruePageSelected(position); mBaseBottomTabNavigation.getMenu().findItem(listMenuTrue.get(position)).setChecked(true); } } /** * 底部点击事件(如果没fragment,它也会生效) * @param position */ protected void onBottomTabClick(int position) { } /** * 是否开启viewpager切换动画 * @return */ protected boolean onEnabledScrollAnim(){ return true; } /** * fragment切换事件(根据真正的fragment数量切换,比如添加了5个fragment,但是tab只添加了3个,那后面2个不会生效) * @param position */ protected void onTruePageSelected(int position) { } @CallSuper @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @CallSuper @Override public void onPageScrollStateChanged(int state) { } /** * 写activty的title样式,不可写layout * * @param ba */ protected abstract void onChildInitAttribute(BaseAttribute ba); /** * 获取fragment集合 * * @return */ protected abstract ArrayList<Fragment> addFragment(); /** * 动态设置是否可以滚动 * * @param canScroll */ protected void setCanScroll(boolean canScroll) { mBaseBottomTabViewpager.setPagingEnabled(canScroll); } /** * 设置样式 * * @param mBaseBottomTabNavigation * @param mBaseBottomTabRelativeContent */ protected void initStyle(BottomNavigationViewEx mBaseBottomTabNavigation, RelativeLayout mBaseBottomTabRelativeContent) { } ; /** * 设置菜单资源 * * @return */ protected abstract @MenuRes int addTabMenuId(); /** * 是否可以滑动 * * @return */ protected boolean canScroll() { return false; } ; /** * 是否显示中间图标 * * @return */ protected boolean showCenter() { return false; } ; /** * 中间布局 * * @return */ protected int getCenterLayout() { return 0; } ; /** * 中间按钮的点击 * * @param v */ protected void onCenterClick(View v) { } ; }
UTF-8
Java
8,297
java
PBaseBottomTabActivity.java
Java
[ { "context": "e.views.BottomNavigationViewEx;\n\n/**\n * Created by huxu on 2017/11/10.\n */\npublic abstract class PBaseBot", "end": 881, "score": 0.9993448853492737, "start": 877, "tag": "USERNAME", "value": "huxu" } ]
null
[]
package met.hx.com.base.base.activity; import android.view.MenuItem; import android.view.View; import android.widget.RelativeLayout; import androidx.annotation.CallSuper; import androidx.annotation.MenuRes; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.viewpager.widget.ViewPager; import com.google.android.material.bottomnavigation.BottomNavigationView; import java.util.ArrayList; import java.util.List; import met.hx.com.base.R; import met.hx.com.base.base.BaseAttribute; import met.hx.com.base.base.BasePresenter; import met.hx.com.librarybase.some_utils.XHStringUtil; import met.hx.com.librarybase.some_utils.util.AbFragmentPagerAdapter; import met.hx.com.librarybase.some_utils.util.AbViewPager; import met.hx.com.librarybase.views.BottomNavigationViewEx; /** * Created by huxu on 2017/11/10. */ public abstract class PBaseBottomTabActivity<T extends BasePresenter> extends BaseYesPresenterActivity implements BottomNavigationView.OnNavigationItemSelectedListener, ViewPager.OnPageChangeListener { protected AbFragmentPagerAdapter mFragmentPagerAdapter; /** * 内容的View. */ protected AbViewPager mBaseBottomTabViewpager; protected BottomNavigationViewEx mBaseBottomTabNavigation; protected RelativeLayout mBaseBottomTabRelativeContent; protected ArrayList<Fragment> arrayListFragment; protected T mBottomTabPresenter; protected List<Integer> listMenuTrue = new ArrayList<>(); protected List<Integer> listMenu = new ArrayList<>(); @Override protected void initLifeCycle() { super.initLifeCycle(); mBottomTabPresenter = (T) initPresenter(); registerLifeCycle(mBottomTabPresenter); } @CallSuper @Override protected void onInitAttribute(BaseAttribute ba) { ba.mActivityLayoutId = R.layout.base_activity_bottomtab; ba.mStatusBarActivityEnabled=false; onChildInitAttribute(ba); } @CallSuper @Override protected void initView() { ArrayList<Fragment> arr=addFragment(); if (arr != null) { if (arr.size() > 0) { mBaseBottomTabRelativeContent = (RelativeLayout) findViewById(R.id.base_bottomTab_relative_content); mBaseBottomTabViewpager = (AbViewPager) findViewById(R.id.base_bottomTab_viewpager); mBaseBottomTabViewpager.setEnabledScrollAnim(onEnabledScrollAnim()); setCanScroll(canScroll()); mBaseBottomTabNavigation = (BottomNavigationViewEx) findViewById(R.id.base_bottomTab_navigation); initStyle(mBaseBottomTabNavigation, mBaseBottomTabRelativeContent); if (getCenterLayout() != 0) { getLayoutInflater().inflate(getCenterLayout(), mBaseBottomTabRelativeContent); } if (showCenter()) { mBaseBottomTabRelativeContent.setVisibility(View.VISIBLE); } else { mBaseBottomTabRelativeContent.setVisibility(View.GONE); } mBaseBottomTabRelativeContent.setOnClickListener(v -> onCenterClick(v)); mBaseBottomTabNavigation.setOnNavigationItemSelectedListener(this); FragmentManager mFragmentManager = this.getSupportFragmentManager(); arrayListFragment = new ArrayList<>(); mFragmentPagerAdapter = new AbFragmentPagerAdapter(mFragmentManager, arrayListFragment); mBaseBottomTabViewpager.setAdapter(mFragmentPagerAdapter); mBaseBottomTabViewpager.addOnPageChangeListener(this); setMenuAndList(addTabMenuId(), addFragment()); } } } /** * 动态设置menu,menu的长度要小于等于list的长度 * * @param menuId * @param arrayList */ @CallSuper protected void setMenuAndList(int menuId, ArrayList<Fragment> arrayList) { if (menuId != 0 && arrayList != null && arrayList.size() > 0) { listMenu.clear(); listMenuTrue.clear(); mBaseBottomTabNavigation.getMenu().clear(); mBaseBottomTabNavigation.inflateMenu(menuId); setCache(arrayList.size()); mBaseBottomTabNavigation.enableAnimation(false); mBaseBottomTabNavigation.enableShiftingMode(false); mBaseBottomTabNavigation.enableItemShiftingMode(false); arrayListFragment.clear(); arrayListFragment.addAll(arrayList); mFragmentPagerAdapter.notifyDataSetChanged(); for (int i = 0; i < mBaseBottomTabNavigation.getMenu().size(); i++) { if (!XHStringUtil.isEmpty(mBaseBottomTabNavigation.getMenu().getItem(i).getTitle().toString(), false)) { listMenuTrue.add(mBaseBottomTabNavigation.getMenu().getItem(i).getItemId()); } } for (int i = 0; i < mBaseBottomTabNavigation.getMenu().size(); i++) { listMenu.add(mBaseBottomTabNavigation.getMenu().getItem(i).getItemId()); } } } /** * 动态设置缓存数量 * * @param cache */ @CallSuper protected void setCache(int cache) { mBaseBottomTabViewpager.setOffscreenPageLimit(cache); } @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { int i = item.getItemId(); int indexTrue = listMenuTrue.indexOf(i); int index = listMenu.indexOf(i); if (index != -1) { mBaseBottomTabViewpager.setCurrentItem(indexTrue); } onBottomTabClick(index); mBaseBottomTabNavigation.getMenu().getItem(index).setChecked(true); return false; } @Override public void onPageSelected(int position) { if (position < listMenuTrue.size()) { onTruePageSelected(position); mBaseBottomTabNavigation.getMenu().findItem(listMenuTrue.get(position)).setChecked(true); } } /** * 底部点击事件(如果没fragment,它也会生效) * @param position */ protected void onBottomTabClick(int position) { } /** * 是否开启viewpager切换动画 * @return */ protected boolean onEnabledScrollAnim(){ return true; } /** * fragment切换事件(根据真正的fragment数量切换,比如添加了5个fragment,但是tab只添加了3个,那后面2个不会生效) * @param position */ protected void onTruePageSelected(int position) { } @CallSuper @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @CallSuper @Override public void onPageScrollStateChanged(int state) { } /** * 写activty的title样式,不可写layout * * @param ba */ protected abstract void onChildInitAttribute(BaseAttribute ba); /** * 获取fragment集合 * * @return */ protected abstract ArrayList<Fragment> addFragment(); /** * 动态设置是否可以滚动 * * @param canScroll */ protected void setCanScroll(boolean canScroll) { mBaseBottomTabViewpager.setPagingEnabled(canScroll); } /** * 设置样式 * * @param mBaseBottomTabNavigation * @param mBaseBottomTabRelativeContent */ protected void initStyle(BottomNavigationViewEx mBaseBottomTabNavigation, RelativeLayout mBaseBottomTabRelativeContent) { } ; /** * 设置菜单资源 * * @return */ protected abstract @MenuRes int addTabMenuId(); /** * 是否可以滑动 * * @return */ protected boolean canScroll() { return false; } ; /** * 是否显示中间图标 * * @return */ protected boolean showCenter() { return false; } ; /** * 中间布局 * * @return */ protected int getCenterLayout() { return 0; } ; /** * 中间按钮的点击 * * @param v */ protected void onCenterClick(View v) { } ; }
8,297
0.644169
0.641795
279
27.67742
28.77368
125
false
false
0
0
0
0
0
0
0.365591
false
false
4
0b80601c3fe7a42a419f089e91daa2ce37f41d03
19,816,979,161,306
b3a019597dc42ca017543722d6dfff73654bdc5e
/dropwizard-util/src/main/java/io/dropwizard/util/Resources.java
2b4d32a2548582bc3e6c731ade8f4060d4732798
[ "LicenseRef-scancode-free-unknown", "Apache-2.0" ]
permissive
dropwizard/dropwizard
https://github.com/dropwizard/dropwizard
d3c2c466b69f36d2e91bf31379817d3af5802ba3
d15bee4c20844c36e2949e2a6a8b4bc3e2cd7a01
refs/heads/release/4.0.x
2023-09-04T07:15:00.293000
2023-08-31T00:36:07
2023-09-01T01:47:53
1,272,129
6,863
3,748
Apache-2.0
false
2023-09-14T16:43:47
2011-01-19T19:52:29
2023-09-13T05:38:13
2023-09-14T16:43:45
109,618
8,424
3,465
33
Java
false
false
package io.dropwizard.util; import java.net.URL; /** * Provides helper methods to work with resources. * * @since 2.0 */ public final class Resources { private Resources() { } /** * Returns a {@code URL} pointing to {@code resourceName} if the resource is found using the * {@linkplain Thread#getContextClassLoader() context class loader}. In simple environments, the * context class loader will find resources from the class path. In environments where different * threads can have different class loaders, for example app servers, the context class loader * will typically have been set to an appropriate loader for the current thread. * * <p>In the unusual case where the context class loader is null, the class loader that loaded * this class ({@code Resources}) will be used instead. * * @param resourceName the name of the resource * @return the {@link URL} of the resource * @throws IllegalArgumentException if the resource is not found */ public static URL getResource(String resourceName) { final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); final ClassLoader loader = contextClassLoader == null ? Resources.class.getClassLoader() : contextClassLoader; final URL url = loader.getResource(resourceName); if (url == null) { throw new IllegalArgumentException("resource " + resourceName + " not found."); } return url; } }
UTF-8
Java
1,517
java
Resources.java
Java
[]
null
[]
package io.dropwizard.util; import java.net.URL; /** * Provides helper methods to work with resources. * * @since 2.0 */ public final class Resources { private Resources() { } /** * Returns a {@code URL} pointing to {@code resourceName} if the resource is found using the * {@linkplain Thread#getContextClassLoader() context class loader}. In simple environments, the * context class loader will find resources from the class path. In environments where different * threads can have different class loaders, for example app servers, the context class loader * will typically have been set to an appropriate loader for the current thread. * * <p>In the unusual case where the context class loader is null, the class loader that loaded * this class ({@code Resources}) will be used instead. * * @param resourceName the name of the resource * @return the {@link URL} of the resource * @throws IllegalArgumentException if the resource is not found */ public static URL getResource(String resourceName) { final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); final ClassLoader loader = contextClassLoader == null ? Resources.class.getClassLoader() : contextClassLoader; final URL url = loader.getResource(resourceName); if (url == null) { throw new IllegalArgumentException("resource " + resourceName + " not found."); } return url; } }
1,517
0.691496
0.690178
37
40
37.923107
118
false
false
0
0
0
0
0
0
0.297297
false
false
4
6858b566571f7ae0f0fd6e6a319b80b6813646a8
10,402,410,817,581
ebeda142141046692a6084a205cc647e1d2bf17d
/public_lesson-master/study-annotation/src/main/java/com/study/annotation/aspect/SetFieldValueAspect.java
f5fbed792059822eb23d80114aefca531312925d
[]
no_license
yinzhidong/NeteaseCourse-JAVA-Senior-Development-Enginee
https://github.com/yinzhidong/NeteaseCourse-JAVA-Senior-Development-Enginee
702f1ffa919bcc2a9deab2f2cb0d99f1e2bc0344
65dd897b0ff97708158488d736c3f1177285e94f
refs/heads/master
2020-12-27T03:52:05.831000
2019-09-01T09:29:28
2019-09-01T09:29:28
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.study.annotation.aspect; import java.util.Arrays; import java.util.Collection; import java.util.Map; import com.study.annotation.util.BeanUtil; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * 基于注解@Aspect的AOP实现 * * @author allen */ @Component @Aspect public class SetFieldValueAspect { @Autowired private BeanUtil beanUtil; /** * 环绕通知:目标方法执行前后分别执行一些代码,发生异常的时候执行另外一些代码 * * @param pjp * @return * @throws Throwable */ @Around("@annotation(com.study.annotation.annotation.NeedSetFieldValue)") public Object doSetFieldValue(ProceedingJoinPoint pjp) throws Throwable { String methodName = pjp.getSignature().getName(); System.out.println("【环绕通知中的--->前置通知】:the method 【" + methodName + "】 begins with " + Arrays.asList(pjp.getArgs())); //执行目标方法 Object ret = pjp.proceed(); System.out.println("【环绕通知中的--->后置通知】:-----------------end.----------------------"); // 设置属性值 if (ret instanceof Collection) { this.beanUtil.setFieldValueForCollection((Collection) ret); } else if (ret instanceof Map){ // 不是集合,也需要设置属性值,,beanUtil中还提供一个设置单个对象属性值的方法 } else if (ret instanceof String) { } return ret; } }
UTF-8
Java
1,596
java
SetFieldValueAspect.java
Java
[ { "context": "omponent;\n\n/**\n * 基于注解@Aspect的AOP实现\n * \n * @author allen\n */\n@Component\n@Aspect\npublic class SetFieldValue", "end": 447, "score": 0.9986606240272522, "start": 442, "tag": "USERNAME", "value": "allen" } ]
null
[]
package com.study.annotation.aspect; import java.util.Arrays; import java.util.Collection; import java.util.Map; import com.study.annotation.util.BeanUtil; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * 基于注解@Aspect的AOP实现 * * @author allen */ @Component @Aspect public class SetFieldValueAspect { @Autowired private BeanUtil beanUtil; /** * 环绕通知:目标方法执行前后分别执行一些代码,发生异常的时候执行另外一些代码 * * @param pjp * @return * @throws Throwable */ @Around("@annotation(com.study.annotation.annotation.NeedSetFieldValue)") public Object doSetFieldValue(ProceedingJoinPoint pjp) throws Throwable { String methodName = pjp.getSignature().getName(); System.out.println("【环绕通知中的--->前置通知】:the method 【" + methodName + "】 begins with " + Arrays.asList(pjp.getArgs())); //执行目标方法 Object ret = pjp.proceed(); System.out.println("【环绕通知中的--->后置通知】:-----------------end.----------------------"); // 设置属性值 if (ret instanceof Collection) { this.beanUtil.setFieldValueForCollection((Collection) ret); } else if (ret instanceof Map){ // 不是集合,也需要设置属性值,,beanUtil中还提供一个设置单个对象属性值的方法 } else if (ret instanceof String) { } return ret; } }
1,596
0.714076
0.714076
54
24.25926
25.599613
117
false
false
0
0
0
0
0
0
1.166667
false
false
4
291cc02f88841a0a99ea3d3f899117381fa1bfb0
7,224,134,996,194
02519c1cb294264208e8481cbbef46246ee454d7
/assignment4/acertainbookstore/src/com/acertainbookstore/business/CertainBookStoreReplicator.java
eca6eb9a4b4a03eeb78c714abe979135d91aa41d
[ "MIT" ]
permissive
nicolaemariuta/PCSD
https://github.com/nicolaemariuta/PCSD
a45a25ebd6e752534d195b32ce792dddcba2a3c9
a50206f39d943e13514c48d27f66b31763faaf2e
refs/heads/master
2016-09-13T02:10:44.278000
2016-04-11T11:44:13
2016-04-11T11:44:13
55,967,707
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.acertainbookstore.business; import java.util.List; import java.util.Set; import java.util.concurrent.Future; import com.acertainbookstore.interfaces.Replicator; /** * CertainBookStoreReplicator is used to replicate updates to slaves * concurrently. */ public class CertainBookStoreReplicator implements Replicator { public CertainBookStoreReplicator(int maxReplicatorThreads) { // TODO:Implement this constructor } public List<Future<ReplicationResult>> replicate(Set<String> slaveServers, ReplicationRequest request) { // TODO: Implement this method return null; } }
UTF-8
Java
602
java
CertainBookStoreReplicator.java
Java
[]
null
[]
package com.acertainbookstore.business; import java.util.List; import java.util.Set; import java.util.concurrent.Future; import com.acertainbookstore.interfaces.Replicator; /** * CertainBookStoreReplicator is used to replicate updates to slaves * concurrently. */ public class CertainBookStoreReplicator implements Replicator { public CertainBookStoreReplicator(int maxReplicatorThreads) { // TODO:Implement this constructor } public List<Future<ReplicationResult>> replicate(Set<String> slaveServers, ReplicationRequest request) { // TODO: Implement this method return null; } }
602
0.792359
0.792359
25
23.08
24.363777
75
false
false
0
0
0
0
0
0
0.8
false
false
4
984d9f8e9896d5707850f371da4ba9a66674441e
21,698,174,836,234
007a9b1f4fae197a73cdce345fce81166a0c394f
/src/main/java/com/roundaboutam/trader/ramfix/OrderStatus.java
ff5e272b0e2626f715714c15cfe649cc9a4339e5
[]
no_license
ryanoley/trader-engine
https://github.com/ryanoley/trader-engine
be6d30f121ce979197234b104db02d22a26681b7
9d5adfef48e0e5e834db01a8216cc4285053cd2a
refs/heads/master
2022-05-05T13:24:36.533000
2018-10-17T18:38:10
2018-10-17T18:38:10
154,715,497
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.roundaboutam.trader.ramfix; import java.util.HashMap; import java.util.Map; public class OrderStatus { static private final Map<String, OrderStatus> known = new HashMap<>(); // Trader Engine Types static public final OrderStatus NEW = new OrderStatus("New"); static public final OrderStatus PARTIAL_FILL = new OrderStatus("PartialFill"); static public final OrderStatus FILL = new OrderStatus("Filled"); static public final OrderStatus DONE_FOR_DAY = new OrderStatus("DoneForDay"); static public final OrderStatus CANCELED = new OrderStatus("Canceled"); static public final OrderStatus REPLACE = new OrderStatus("Replaced"); static public final OrderStatus STOPPED = new OrderStatus("Stopped"); static public final OrderStatus SUSPENDED = new OrderStatus("Suspended"); static public final OrderStatus REJECTED = new OrderStatus("Rejected"); static public final OrderStatus PENDING_CANCEL = new OrderStatus("PendingCancel"); static public final OrderStatus PENDING_REPLACE = new OrderStatus("PendingReplace"); static public final OrderStatus PENDING_NEW = new OrderStatus("PendingNew"); static private final OrderStatus[] array = { NEW, PARTIAL_FILL, FILL, DONE_FOR_DAY, CANCELED, REPLACE, STOPPED, SUSPENDED, REJECTED, PENDING_CANCEL, PENDING_REPLACE, PENDING_NEW}; private final String name; private OrderStatus(String name) { this.name = name; synchronized (OrderStatus.class) { known.put(name, this); } } public String getName() { return name; } public String toString() { return name; } static public Object[] toArray() { return array; } public static OrderStatus parse(String type) throws IllegalArgumentException { OrderStatus result = known.get(type); if (result == null) { throw new IllegalArgumentException ("OrderStatus: " + type + " is unknown."); } return result; } }
UTF-8
Java
2,025
java
OrderStatus.java
Java
[]
null
[]
package com.roundaboutam.trader.ramfix; import java.util.HashMap; import java.util.Map; public class OrderStatus { static private final Map<String, OrderStatus> known = new HashMap<>(); // Trader Engine Types static public final OrderStatus NEW = new OrderStatus("New"); static public final OrderStatus PARTIAL_FILL = new OrderStatus("PartialFill"); static public final OrderStatus FILL = new OrderStatus("Filled"); static public final OrderStatus DONE_FOR_DAY = new OrderStatus("DoneForDay"); static public final OrderStatus CANCELED = new OrderStatus("Canceled"); static public final OrderStatus REPLACE = new OrderStatus("Replaced"); static public final OrderStatus STOPPED = new OrderStatus("Stopped"); static public final OrderStatus SUSPENDED = new OrderStatus("Suspended"); static public final OrderStatus REJECTED = new OrderStatus("Rejected"); static public final OrderStatus PENDING_CANCEL = new OrderStatus("PendingCancel"); static public final OrderStatus PENDING_REPLACE = new OrderStatus("PendingReplace"); static public final OrderStatus PENDING_NEW = new OrderStatus("PendingNew"); static private final OrderStatus[] array = { NEW, PARTIAL_FILL, FILL, DONE_FOR_DAY, CANCELED, REPLACE, STOPPED, SUSPENDED, REJECTED, PENDING_CANCEL, PENDING_REPLACE, PENDING_NEW}; private final String name; private OrderStatus(String name) { this.name = name; synchronized (OrderStatus.class) { known.put(name, this); } } public String getName() { return name; } public String toString() { return name; } static public Object[] toArray() { return array; } public static OrderStatus parse(String type) throws IllegalArgumentException { OrderStatus result = known.get(type); if (result == null) { throw new IllegalArgumentException ("OrderStatus: " + type + " is unknown."); } return result; } }
2,025
0.688889
0.688889
59
33.322033
31.380898
97
false
false
0
0
0
0
0
0
0.779661
false
false
4
1fc665c37396ab208499cb97bf2b857a9398bd0e
11,106,785,463,482
4cfde2129509ee387a876b35197bbc08233e74e2
/src/main/java/com/kamranyaseen/webflux/functional/router/RoutingConfiguration.java
f27173ff9827105de53cba86cecc5121d54fc662
[ "MIT" ]
permissive
kamranyaseen/SpringBoot-WebFlux-Functional-RestAPIs
https://github.com/kamranyaseen/SpringBoot-WebFlux-Functional-RestAPIs
ae4f00d22e00c78e01999e4447616cd815e96d49
fe369842b0b2861bff7febef851f5271cb4d1d1f
refs/heads/master
2021-04-27T00:15:02.230000
2018-03-04T10:46:41
2018-03-04T10:46:41
123,779,112
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kamranyaseen.webflux.functional.router; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.reactive.function.server.RouterFunction; import org.springframework.web.reactive.function.server.ServerResponse; import com.kamranyaseen.webflux.functional.handler.CustomerHandler; import static org.springframework.web.reactive.function.server.RequestPredicates.*; import static org.springframework.web.reactive.function.server.RouterFunctions.route; import org.springframework.http.MediaType; @Configuration public class RoutingConfiguration { @Bean public RouterFunction<ServerResponse> monoRouterFunction(CustomerHandler customerHandler) { return route(GET("/api/customer").and(accept(MediaType.APPLICATION_JSON)), customerHandler::getAll) .andRoute(GET("/api/customer/{id}").and(accept(MediaType.APPLICATION_JSON)), customerHandler::getCustomer) .andRoute(POST("/api/customer/post").and(accept(MediaType.APPLICATION_JSON)), customerHandler::postCustomer) .andRoute(PUT("/api/customer/put/{id}").and(accept(MediaType.APPLICATION_JSON)), customerHandler::putCustomer) .andRoute(DELETE("/api/customer/delete/{id}").and(accept(MediaType.APPLICATION_JSON)), customerHandler::deleteCustomer); } }
UTF-8
Java
1,374
java
RoutingConfiguration.java
Java
[]
null
[]
package com.kamranyaseen.webflux.functional.router; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.reactive.function.server.RouterFunction; import org.springframework.web.reactive.function.server.ServerResponse; import com.kamranyaseen.webflux.functional.handler.CustomerHandler; import static org.springframework.web.reactive.function.server.RequestPredicates.*; import static org.springframework.web.reactive.function.server.RouterFunctions.route; import org.springframework.http.MediaType; @Configuration public class RoutingConfiguration { @Bean public RouterFunction<ServerResponse> monoRouterFunction(CustomerHandler customerHandler) { return route(GET("/api/customer").and(accept(MediaType.APPLICATION_JSON)), customerHandler::getAll) .andRoute(GET("/api/customer/{id}").and(accept(MediaType.APPLICATION_JSON)), customerHandler::getCustomer) .andRoute(POST("/api/customer/post").and(accept(MediaType.APPLICATION_JSON)), customerHandler::postCustomer) .andRoute(PUT("/api/customer/put/{id}").and(accept(MediaType.APPLICATION_JSON)), customerHandler::putCustomer) .andRoute(DELETE("/api/customer/delete/{id}").and(accept(MediaType.APPLICATION_JSON)), customerHandler::deleteCustomer); } }
1,374
0.781659
0.781659
27
49.925926
45.428761
136
false
false
0
0
0
0
0
0
0.740741
false
false
4
599dd0c9ddbf3bb869fabc62ee71406ed2967e8d
16,406,775,134,039
3f8449a18768478eb85e46859e28627af2dfc2b8
/app/src/main/java/com/example/worldmapexchange/AllObjectAdapter.java
b3dcf63925498d0b6c5745160306138bc5e211ad
[]
no_license
gigajet/WorldMapExchange
https://github.com/gigajet/WorldMapExchange
339d1a861fc220e0dd82b34e85e9a668a4f0d436
1ea178933f2ace4858f5473baf3c98a7d464726d
refs/heads/master
2022-12-16T06:56:10.131000
2020-09-22T22:23:54
2020-09-22T22:23:54
288,427,738
0
0
null
false
2020-09-22T15:21:58
2020-08-18T10:42:52
2020-09-22T15:16:38
2020-09-22T15:21:56
40,912
0
0
0
Java
false
false
package com.example.worldmapexchange; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.caverock.androidsvg.SVGImageView; import java.math.RoundingMode; import java.text.NumberFormat; import java.util.ArrayList; public class AllObjectAdapter extends ArrayAdapter<AllObject> { public AllObjectAdapter(Context context, ArrayList<AllObject> currencyInfoArrayList) { super(context, 0, currencyInfoArrayList); } private static class ViewHolder { TextView txtName; SVGImageView im; TextView resText; } @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { AllObject currencyInfo = getItem(position); ViewHolder viewHolder; if (convertView == null) { viewHolder = new ViewHolder(); LayoutInflater inflater = LayoutInflater.from(this.getContext()); convertView = inflater.inflate(R.layout.item_layout1, parent, false); viewHolder.txtName = convertView.findViewById(R.id.textViewName); viewHolder.im = convertView.findViewById(R.id.imageView); viewHolder.resText = convertView.findViewById(R.id.resText); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.txtName.setText(currencyInfo.code + "(" + currencyInfo.name + ")"); if (Resources.chosenMode == 9) viewHolder.im.setImageAsset("image/" + currencyInfo.src); else viewHolder.im.setImageAsset("image/blank.svg"); viewHolder.im.setScaleX(1); viewHolder.im.setScaleY(1); // // convertView.setOnClickListener(new View.OnClickListener() { // @SuppressLint("ResourceAsColor") // @Override // public void onClick(View v) { // //TextView cur = (TextView)MainActivity.getInstance().findViewById(R.id.convertedCurrency); // String txt = ((TextView)v.findViewById(R.id.textViewName)).getText().toString().substring(0, 3); // //cur.setText(txt); // // } // }); NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(4); nf.setMinimumFractionDigits(2); nf.setRoundingMode(RoundingMode.CEILING); nf.setGroupingUsed(true); nf.setMinimumIntegerDigits(1); nf.setMaximumIntegerDigits(56); viewHolder.resText.setText(nf.format(currencyInfo.value)); return convertView; } }
UTF-8
Java
2,838
java
AllObjectAdapter.java
Java
[]
null
[]
package com.example.worldmapexchange; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.caverock.androidsvg.SVGImageView; import java.math.RoundingMode; import java.text.NumberFormat; import java.util.ArrayList; public class AllObjectAdapter extends ArrayAdapter<AllObject> { public AllObjectAdapter(Context context, ArrayList<AllObject> currencyInfoArrayList) { super(context, 0, currencyInfoArrayList); } private static class ViewHolder { TextView txtName; SVGImageView im; TextView resText; } @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { AllObject currencyInfo = getItem(position); ViewHolder viewHolder; if (convertView == null) { viewHolder = new ViewHolder(); LayoutInflater inflater = LayoutInflater.from(this.getContext()); convertView = inflater.inflate(R.layout.item_layout1, parent, false); viewHolder.txtName = convertView.findViewById(R.id.textViewName); viewHolder.im = convertView.findViewById(R.id.imageView); viewHolder.resText = convertView.findViewById(R.id.resText); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.txtName.setText(currencyInfo.code + "(" + currencyInfo.name + ")"); if (Resources.chosenMode == 9) viewHolder.im.setImageAsset("image/" + currencyInfo.src); else viewHolder.im.setImageAsset("image/blank.svg"); viewHolder.im.setScaleX(1); viewHolder.im.setScaleY(1); // // convertView.setOnClickListener(new View.OnClickListener() { // @SuppressLint("ResourceAsColor") // @Override // public void onClick(View v) { // //TextView cur = (TextView)MainActivity.getInstance().findViewById(R.id.convertedCurrency); // String txt = ((TextView)v.findViewById(R.id.textViewName)).getText().toString().substring(0, 3); // //cur.setText(txt); // // } // }); NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(4); nf.setMinimumFractionDigits(2); nf.setRoundingMode(RoundingMode.CEILING); nf.setGroupingUsed(true); nf.setMinimumIntegerDigits(1); nf.setMaximumIntegerDigits(56); viewHolder.resText.setText(nf.format(currencyInfo.value)); return convertView; } }
2,838
0.656801
0.652572
87
31.620689
27.776712
114
false
false
0
0
0
0
0
0
0.609195
false
false
4
9feabca8476aec241f2954e6ff4608c67948f8ba
17,506,286,699,273
774abf455f007d057239be6990282987bff12965
/src/main/java/cn/dubby/nw/Main.java
967dd84e699e92656c9f8f3e1cb3afca4617ada1
[]
no_license
dubby1994/nw
https://github.com/dubby1994/nw
9d817753d4a2c34914328d1033e7a4366b82f7dd
2295471a1e59c526c08fd574d7b08a7b1dfe8997
refs/heads/master
2020-05-26T23:39:43.290000
2019-05-24T11:52:19
2019-05-24T11:52:19
188,413,339
0
0
null
false
2019-10-29T23:52:35
2019-05-24T11:51:45
2019-05-24T11:52:35
2019-10-29T23:52:34
8
0
0
1
Java
false
false
package cn.dubby.nw; import cn.dubby.nw.handler.AuthHandler; import cn.dubby.nw.handler.HttpStaticFileServerInitializer; import cn.dubby.nw.util.RandomStringUtil; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.Channel; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.handler.logging.LogLevel; import io.netty.handler.logging.LoggingHandler; import io.netty.handler.ssl.SslContext; import io.netty.handler.ssl.SslContextBuilder; import io.netty.handler.ssl.SslProvider; import io.netty.handler.ssl.util.SelfSignedCertificate; import io.netty.util.internal.logging.InternalLogger; import io.netty.util.internal.logging.InternalLoggerFactory; import io.netty.util.internal.logging.Slf4JLoggerFactory; /** * @author dubby * @date 2019/5/21 14:33 */ public class Main { private static final InternalLogger logger; static { InternalLoggerFactory.setDefaultFactory(Slf4JLoggerFactory.INSTANCE); logger = InternalLoggerFactory.getInstance(AuthHandler.class); } private static final String PATH = System.getProperty("path", "/"); private static final String TOKEN = System.getProperty("token", RandomStringUtil.random(100)); private static final boolean SSL = System.getProperty("ssl") != null; private static final int PORT = Integer.parseInt(System.getProperty("port", SSL ? "8443" : "8080")); public static void main(String[] args) throws Exception { final SslContext sslCtx; if (SSL) { SelfSignedCertificate ssc = new SelfSignedCertificate(); sslCtx = SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()) .sslProvider(SslProvider.JDK).build(); } else { sslCtx = null; } EventLoopGroup bossGroup = new NioEventLoopGroup(1); EventLoopGroup workerGroup = new NioEventLoopGroup(5); try { ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new HttpStaticFileServerInitializer(sslCtx, PATH, TOKEN)); Channel ch = b.bind(PORT).sync().channel(); logger.info("Open your web browser and navigate to {}://127.0.0.1:{}/", sslCtx == null ? "http" : "https", PORT); logger.info("token:[{}]", TOKEN); ch.closeFuture().sync(); } finally { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } } }
UTF-8
Java
2,710
java
Main.java
Java
[ { "context": "ternal.logging.Slf4JLoggerFactory;\n\n/**\n * @author dubby\n * @date 2019/5/21 14:33\n */\npublic class Main {\n", "end": 854, "score": 0.9996113777160645, "start": 849, "tag": "USERNAME", "value": "dubby" }, { "context": ".info(\"Open your web browser and navigate to {}://127.0.0.1:{}/\", sslCtx == null ? \"http\" : \"https\", PORT);\n ", "end": 2448, "score": 0.999690592288971, "start": 2439, "tag": "IP_ADDRESS", "value": "127.0.0.1" } ]
null
[]
package cn.dubby.nw; import cn.dubby.nw.handler.AuthHandler; import cn.dubby.nw.handler.HttpStaticFileServerInitializer; import cn.dubby.nw.util.RandomStringUtil; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.Channel; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.handler.logging.LogLevel; import io.netty.handler.logging.LoggingHandler; import io.netty.handler.ssl.SslContext; import io.netty.handler.ssl.SslContextBuilder; import io.netty.handler.ssl.SslProvider; import io.netty.handler.ssl.util.SelfSignedCertificate; import io.netty.util.internal.logging.InternalLogger; import io.netty.util.internal.logging.InternalLoggerFactory; import io.netty.util.internal.logging.Slf4JLoggerFactory; /** * @author dubby * @date 2019/5/21 14:33 */ public class Main { private static final InternalLogger logger; static { InternalLoggerFactory.setDefaultFactory(Slf4JLoggerFactory.INSTANCE); logger = InternalLoggerFactory.getInstance(AuthHandler.class); } private static final String PATH = System.getProperty("path", "/"); private static final String TOKEN = System.getProperty("token", RandomStringUtil.random(100)); private static final boolean SSL = System.getProperty("ssl") != null; private static final int PORT = Integer.parseInt(System.getProperty("port", SSL ? "8443" : "8080")); public static void main(String[] args) throws Exception { final SslContext sslCtx; if (SSL) { SelfSignedCertificate ssc = new SelfSignedCertificate(); sslCtx = SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()) .sslProvider(SslProvider.JDK).build(); } else { sslCtx = null; } EventLoopGroup bossGroup = new NioEventLoopGroup(1); EventLoopGroup workerGroup = new NioEventLoopGroup(5); try { ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new HttpStaticFileServerInitializer(sslCtx, PATH, TOKEN)); Channel ch = b.bind(PORT).sync().channel(); logger.info("Open your web browser and navigate to {}://127.0.0.1:{}/", sslCtx == null ? "http" : "https", PORT); logger.info("token:[{}]", TOKEN); ch.closeFuture().sync(); } finally { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } } }
2,710
0.687454
0.675646
73
36.123287
29.705378
125
false
false
0
0
0
0
0
0
0.671233
false
false
4
4e153ce4ccb0c7d7104473e9301ba511bed59f6b
3,212,635,562,408
e8829576e273d608997430a1d3fa8d35cf622dc6
/weibo/src/com/hwh/www/dao/DianzanDao.java
88128a2313c3f810ab520e1fcb740f234eaad21c
[]
no_license
DespairC/hwhWeiBoSystem
https://github.com/DespairC/hwhWeiBoSystem
4ab2bdc2d119bb299cf4e6e1b994831d5bed73ab
f805531b3d9a7f2fcb13f830518051f8f24696ed
refs/heads/master
2021-02-07T03:12:46.933000
2020-02-29T13:51:39
2020-02-29T13:51:39
243,975,928
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hwh.www.dao; import com.hwh.www.po.Dianz; import com.hwh.www.po.Wenzhang; import com.hwh.www.until.DButil; import java.sql.*; import java.util.ArrayList; import java.util.List; public class DianzanDao { public static int userdznumbe=0; public static int textdznumbe=0; //-------------------------输出用户点赞的文章和人的数量---------------------------(接收用户名) public static List<Dianz> findTextDz(String uname){ List<Dianz> dzWzdate = new ArrayList<Dianz>(); try{ userdznumbe=0; Connection conn = DButil.theSqlConnection(); Statement statement = conn.createStatement(); String sql="select * from dz where uname='"+ uname +"'"; ResultSet rs = statement.executeQuery(sql); while (rs.next()) { Dianz dz = new Dianz(); userdznumbe++; dz.setTextname(rs.getString("textname")); dzWzdate.add(dz); } DButil.closeResource(conn); } catch (SQLException e){ e.printStackTrace(); } catch (Exception e){ e.printStackTrace(); } return dzWzdate; } //-------------------输出文章点赞数和点赞的人----------------(接收文章名字) public static List<Dianz> findDz(String textname){ List<Dianz> dzdate = new ArrayList<Dianz>(); try{ textdznumbe=0; Connection conn = DButil.theSqlConnection(); Statement statement = conn.createStatement(); String sql="select * from dz where textname='" + textname +"'"; ResultSet rs = statement.executeQuery(sql); while (rs.next()) { Dianz dz = new Dianz(); textdznumbe++; dz.setUname(rs.getString("uname")); dzdate.add(dz); } DButil.closeResource(conn); } catch (SQLException e){ e.printStackTrace(); } catch (Exception e){ e.printStackTrace(); } return dzdate; } //-----------------------删除订阅记录-------------------- public static void delDianz(String uname,String textname){ try{ Connection conn = DButil.theSqlConnection(); String sql = "delete from dz where uname=? and textname=?"; PreparedStatement psql = conn.prepareStatement(sql); psql.setString(1,uname); psql.setString(2,textname); psql.execute(); DButil.closeResource(conn); //查询文章总点赞数 findDz(textname); System.out.println("文章点赞数:"+textdznumbe); System.out.println("个人点赞数:"+userdznumbe); WenzhangDao.addNumberDz(textdznumbe,textname); } catch (SQLException e){ e.printStackTrace(); } catch (Exception e){ e.printStackTrace(); } } //----------------------增加点赞信息-------------------- public static void nextDianz(String uname,String textname){ try{ Connection conn = DButil.theSqlConnection(); String sql = "insert into dz "+ "(uname,textname) " + "value (?,?)"; PreparedStatement psql = conn.prepareStatement(sql); psql.setString(1,uname); psql.setString(2,textname); psql.execute(); DButil.closeResource(conn); //查询文章总点赞数 findDz(textname); System.out.println("文章点赞数:"+textdznumbe); System.out.println("个人点赞数:"+userdznumbe); WenzhangDao.addNumberDz(textdznumbe,textname); } catch (SQLException e){ e.printStackTrace(); } catch (Exception e){ e.printStackTrace(); } } //-----------------------增加点赞的前提函数-------------------------------- public static void addDz(String uname,String textname){ try{ Connection conn = DButil.theSqlConnection(); String sql="select * from dz where uname='"+ uname +"'and textname='"+ textname +"'"; Statement statement = conn.createStatement(); ResultSet rs = statement.executeQuery(sql); if(!rs.next()) { nextDianz(uname, textname); } } catch (SQLException e){ e.printStackTrace(); } catch (Exception e){ e.printStackTrace(); } } //------------------------判断是否点赞过-----------------------------(用于文字显示) public static int judgeDianz(String uname,String textname) { try { Connection conn = DButil.theSqlConnection(); String sql="select * from dz where uname='"+ uname +"'and textname='"+ textname +"'"; Statement statement = conn.createStatement(); ResultSet rs = statement.executeQuery(sql); if (rs.next()) return 1;//是,返回1 } catch (SQLException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return 0;//否,返回0 } public static void main(String args[]){ // System.out.print(judgeDianz("admin","全玻璃iPhone外壳")); delDianz("admin","全玻璃iPhone外壳"); // addDz("admin","全玻璃iPhone外壳"); // delDianz("admin","10000"); // nextDianz("admin","测试1"); // System.out.print(judgeDianz("admin","全玻璃iPhone外壳")); // List<Dianz> fansdata = findDz("全玻璃iPhone外壳"); // for(Dianz dz:fansdata){ // System.out.println(dz.getUname()); // } // System.out.println(textdznumbe); } }
UTF-8
Java
5,908
java
DianzanDao.java
Java
[]
null
[]
package com.hwh.www.dao; import com.hwh.www.po.Dianz; import com.hwh.www.po.Wenzhang; import com.hwh.www.until.DButil; import java.sql.*; import java.util.ArrayList; import java.util.List; public class DianzanDao { public static int userdznumbe=0; public static int textdznumbe=0; //-------------------------输出用户点赞的文章和人的数量---------------------------(接收用户名) public static List<Dianz> findTextDz(String uname){ List<Dianz> dzWzdate = new ArrayList<Dianz>(); try{ userdznumbe=0; Connection conn = DButil.theSqlConnection(); Statement statement = conn.createStatement(); String sql="select * from dz where uname='"+ uname +"'"; ResultSet rs = statement.executeQuery(sql); while (rs.next()) { Dianz dz = new Dianz(); userdznumbe++; dz.setTextname(rs.getString("textname")); dzWzdate.add(dz); } DButil.closeResource(conn); } catch (SQLException e){ e.printStackTrace(); } catch (Exception e){ e.printStackTrace(); } return dzWzdate; } //-------------------输出文章点赞数和点赞的人----------------(接收文章名字) public static List<Dianz> findDz(String textname){ List<Dianz> dzdate = new ArrayList<Dianz>(); try{ textdznumbe=0; Connection conn = DButil.theSqlConnection(); Statement statement = conn.createStatement(); String sql="select * from dz where textname='" + textname +"'"; ResultSet rs = statement.executeQuery(sql); while (rs.next()) { Dianz dz = new Dianz(); textdznumbe++; dz.setUname(rs.getString("uname")); dzdate.add(dz); } DButil.closeResource(conn); } catch (SQLException e){ e.printStackTrace(); } catch (Exception e){ e.printStackTrace(); } return dzdate; } //-----------------------删除订阅记录-------------------- public static void delDianz(String uname,String textname){ try{ Connection conn = DButil.theSqlConnection(); String sql = "delete from dz where uname=? and textname=?"; PreparedStatement psql = conn.prepareStatement(sql); psql.setString(1,uname); psql.setString(2,textname); psql.execute(); DButil.closeResource(conn); //查询文章总点赞数 findDz(textname); System.out.println("文章点赞数:"+textdznumbe); System.out.println("个人点赞数:"+userdznumbe); WenzhangDao.addNumberDz(textdznumbe,textname); } catch (SQLException e){ e.printStackTrace(); } catch (Exception e){ e.printStackTrace(); } } //----------------------增加点赞信息-------------------- public static void nextDianz(String uname,String textname){ try{ Connection conn = DButil.theSqlConnection(); String sql = "insert into dz "+ "(uname,textname) " + "value (?,?)"; PreparedStatement psql = conn.prepareStatement(sql); psql.setString(1,uname); psql.setString(2,textname); psql.execute(); DButil.closeResource(conn); //查询文章总点赞数 findDz(textname); System.out.println("文章点赞数:"+textdznumbe); System.out.println("个人点赞数:"+userdznumbe); WenzhangDao.addNumberDz(textdznumbe,textname); } catch (SQLException e){ e.printStackTrace(); } catch (Exception e){ e.printStackTrace(); } } //-----------------------增加点赞的前提函数-------------------------------- public static void addDz(String uname,String textname){ try{ Connection conn = DButil.theSqlConnection(); String sql="select * from dz where uname='"+ uname +"'and textname='"+ textname +"'"; Statement statement = conn.createStatement(); ResultSet rs = statement.executeQuery(sql); if(!rs.next()) { nextDianz(uname, textname); } } catch (SQLException e){ e.printStackTrace(); } catch (Exception e){ e.printStackTrace(); } } //------------------------判断是否点赞过-----------------------------(用于文字显示) public static int judgeDianz(String uname,String textname) { try { Connection conn = DButil.theSqlConnection(); String sql="select * from dz where uname='"+ uname +"'and textname='"+ textname +"'"; Statement statement = conn.createStatement(); ResultSet rs = statement.executeQuery(sql); if (rs.next()) return 1;//是,返回1 } catch (SQLException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return 0;//否,返回0 } public static void main(String args[]){ // System.out.print(judgeDianz("admin","全玻璃iPhone外壳")); delDianz("admin","全玻璃iPhone外壳"); // addDz("admin","全玻璃iPhone外壳"); // delDianz("admin","10000"); // nextDianz("admin","测试1"); // System.out.print(judgeDianz("admin","全玻璃iPhone外壳")); // List<Dianz> fansdata = findDz("全玻璃iPhone外壳"); // for(Dianz dz:fansdata){ // System.out.println(dz.getUname()); // } // System.out.println(textdznumbe); } }
5,908
0.518861
0.515658
157
34.796177
20.780546
97
false
false
0
0
0
0
0
0
0.675159
false
false
4
3c1d01223839b890e3b56423ea149619aa6602ed
2,860,448,264,899
56a339df512c7ff745bc62dc8ecbf0f352ea8ac0
/fpml/src-gen/it/unibo/fPML/EffectFullIfBody.java
31254536e80481b708e055f0a962142a655e1f1d
[]
no_license
benkio/FPML
https://github.com/benkio/FPML
d455e0426c38f11e1cbc61d0733e250f9ff48070
84cbb660b68ce105a8c26fd49a5c3074ac9abecc
refs/heads/master
2021-01-12T12:20:29.216000
2017-01-18T12:05:00
2017-01-18T12:05:00
72,444,788
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * generated by Xtext 2.10.0 */ package it.unibo.fPML; import org.eclipse.emf.ecore.EObject; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Effect Full If Body</b></em>'. * <!-- end-user-doc --> * * <p> * The following features are supported: * </p> * <ul> * <li>{@link it.unibo.fPML.EffectFullIfBody#getFunctionReference <em>Function Reference</em>}</li> * <li>{@link it.unibo.fPML.EffectFullIfBody#getFunctionExpression <em>Function Expression</em>}</li> * </ul> * * @see it.unibo.fPML.FPMLPackage#getEffectFullIfBody() * @model * @generated */ public interface EffectFullIfBody extends EObject { /** * Returns the value of the '<em><b>Function Reference</b></em>' reference. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Function Reference</em>' reference isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Function Reference</em>' reference. * @see #setFunctionReference(EffectFullFunction) * @see it.unibo.fPML.FPMLPackage#getEffectFullIfBody_FunctionReference() * @model * @generated */ EffectFullFunction getFunctionReference(); /** * Sets the value of the '{@link it.unibo.fPML.EffectFullIfBody#getFunctionReference <em>Function Reference</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Function Reference</em>' reference. * @see #getFunctionReference() * @generated */ void setFunctionReference(EffectFullFunction value); /** * Returns the value of the '<em><b>Function Expression</b></em>' containment reference. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Function Expression</em>' containment reference isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Function Expression</em>' containment reference. * @see #setFunctionExpression(EffectFullExpression) * @see it.unibo.fPML.FPMLPackage#getEffectFullIfBody_FunctionExpression() * @model containment="true" * @generated */ EffectFullExpression getFunctionExpression(); /** * Sets the value of the '{@link it.unibo.fPML.EffectFullIfBody#getFunctionExpression <em>Function Expression</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Function Expression</em>' containment reference. * @see #getFunctionExpression() * @generated */ void setFunctionExpression(EffectFullExpression value); } // EffectFullIfBody
UTF-8
Java
2,690
java
EffectFullIfBody.java
Java
[]
null
[]
/** * generated by Xtext 2.10.0 */ package it.unibo.fPML; import org.eclipse.emf.ecore.EObject; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Effect Full If Body</b></em>'. * <!-- end-user-doc --> * * <p> * The following features are supported: * </p> * <ul> * <li>{@link it.unibo.fPML.EffectFullIfBody#getFunctionReference <em>Function Reference</em>}</li> * <li>{@link it.unibo.fPML.EffectFullIfBody#getFunctionExpression <em>Function Expression</em>}</li> * </ul> * * @see it.unibo.fPML.FPMLPackage#getEffectFullIfBody() * @model * @generated */ public interface EffectFullIfBody extends EObject { /** * Returns the value of the '<em><b>Function Reference</b></em>' reference. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Function Reference</em>' reference isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Function Reference</em>' reference. * @see #setFunctionReference(EffectFullFunction) * @see it.unibo.fPML.FPMLPackage#getEffectFullIfBody_FunctionReference() * @model * @generated */ EffectFullFunction getFunctionReference(); /** * Sets the value of the '{@link it.unibo.fPML.EffectFullIfBody#getFunctionReference <em>Function Reference</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Function Reference</em>' reference. * @see #getFunctionReference() * @generated */ void setFunctionReference(EffectFullFunction value); /** * Returns the value of the '<em><b>Function Expression</b></em>' containment reference. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Function Expression</em>' containment reference isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Function Expression</em>' containment reference. * @see #setFunctionExpression(EffectFullExpression) * @see it.unibo.fPML.FPMLPackage#getEffectFullIfBody_FunctionExpression() * @model containment="true" * @generated */ EffectFullExpression getFunctionExpression(); /** * Sets the value of the '{@link it.unibo.fPML.EffectFullIfBody#getFunctionExpression <em>Function Expression</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Function Expression</em>' containment reference. * @see #getFunctionExpression() * @generated */ void setFunctionExpression(EffectFullExpression value); } // EffectFullIfBody
2,690
0.670632
0.669145
79
33.050632
33.358013
141
false
false
0
0
0
0
0
0
0.101266
false
false
4
d42b51f582d634875f181d51832e595e92dd3765
23,682,449,739,454
932fb4a5089b082d0b7b3266bf7620f2c588955b
/simulation/SimulationParameters.java
fb274c2dc03d4d0e7e75fb9a6daaa075fd08d4d1
[]
no_license
vozabal/vsp
https://github.com/vozabal/vsp
fb0e8b2a6c9befbdb9402386132b0e788fb20802
6902b26d1e080f383a750926300f3fd15b306fdf
refs/heads/master
2021-01-10T01:35:53.044000
2016-01-18T01:12:34
2016-01-18T01:12:34
49,495,764
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package simulation; import simulation.QueueSimulation.Distribution; /** * Represents and object that preservers the simulated queue network parameters. * * @author Miroslav Vozabal */ public class SimulationParameters { /** The random values distribution. Arrivals of the transactions (times of the services). */ private Distribution distribution; /** The mean frequency of the entry stream 1. */ private double lambda1; /** The mean frequency of the entry stream 2. */ private double lambda2; /** The mean frequency of the service of the server 1. */ private double ts1; /** The mean frequency of the service of the server 2. */ private double ts2; /** The mean frequency of the service of the server 3. */ private double ts3; /** The mean frequency of the service of the server 4. */ private double ts4; /** The probability of hanging a transaction over from the server 2 to the server 3. */ private double prb2; /** The probability of hanging a transaction over from the server 3 to the server 4. */ private double prb3; /** The coefficient of the variance (only for Gaussian distribution). */ private double varianceCoefficient; /** * @return the distribution */ public Distribution getDistribution() { return distribution; } /** * @param distribution the distribution to set */ public void setDistribution(Distribution distribution) { this.distribution = distribution; } /** * @return the lambda1 */ public double getLambda1() { return lambda1; } /** * @param lambda1 the lambda1 to set */ public void setLambda1(double lambda1) { this.lambda1 = lambda1; } /** * @return the lambda2 */ public double getLambda2() { return lambda2; } /** * @param lambda2 the lambda2 to set */ public void setLambda2(double lambda2) { this.lambda2 = lambda2; } /** * @return the ts1 */ public double getTs1() { return ts1; } /** * @param ts1 the ts1 to set */ public void setTs1(double ts1) { this.ts1 = ts1; } /** * @return the ts2 */ public double getTs2() { return ts2; } /** * @param ts2 the ts2 to set */ public void setTs2(double ts2) { this.ts2 = ts2; } /** * @return the ts3 */ public double getTs3() { return ts3; } /** * @param ts3 the ts3 to set */ public void setTs3(double ts3) { this.ts3 = ts3; } /** * @return the ts4 */ public double getTs4() { return ts4; } /** * @param ts4 the ts4 to set */ public void setTs4(double ts4) { this.ts4 = ts4; } /** * @return the prb2 */ public double getPrb2() { return prb2; } /** * @param prb2 the prb2 to set */ public void setPrb2(double prb2) { this.prb2 = prb2; } /** * @return the prb3 */ public double getPrb3() { return prb3; } /** * @param prb3 the prb3 to set */ public void setPrb3(double prb3) { this.prb3 = prb3; } /** * @return the varianceCoefficient */ public double getVarianceCoefficient() { return varianceCoefficient; } /** * @param varianceCoefficient the varianceCoefficient to set */ public void setVarianceCoefficient(double varianceCoefficient) { this.varianceCoefficient = varianceCoefficient; } }
UTF-8
Java
3,821
java
SimulationParameters.java
Java
[ { "context": " simulated queue network parameters.\n *\n * @author Miroslav Vozabal\n */\npublic class SimulationParameters {\n \n ", "end": 187, "score": 0.9998798966407776, "start": 171, "tag": "NAME", "value": "Miroslav Vozabal" } ]
null
[]
package simulation; import simulation.QueueSimulation.Distribution; /** * Represents and object that preservers the simulated queue network parameters. * * @author <NAME> */ public class SimulationParameters { /** The random values distribution. Arrivals of the transactions (times of the services). */ private Distribution distribution; /** The mean frequency of the entry stream 1. */ private double lambda1; /** The mean frequency of the entry stream 2. */ private double lambda2; /** The mean frequency of the service of the server 1. */ private double ts1; /** The mean frequency of the service of the server 2. */ private double ts2; /** The mean frequency of the service of the server 3. */ private double ts3; /** The mean frequency of the service of the server 4. */ private double ts4; /** The probability of hanging a transaction over from the server 2 to the server 3. */ private double prb2; /** The probability of hanging a transaction over from the server 3 to the server 4. */ private double prb3; /** The coefficient of the variance (only for Gaussian distribution). */ private double varianceCoefficient; /** * @return the distribution */ public Distribution getDistribution() { return distribution; } /** * @param distribution the distribution to set */ public void setDistribution(Distribution distribution) { this.distribution = distribution; } /** * @return the lambda1 */ public double getLambda1() { return lambda1; } /** * @param lambda1 the lambda1 to set */ public void setLambda1(double lambda1) { this.lambda1 = lambda1; } /** * @return the lambda2 */ public double getLambda2() { return lambda2; } /** * @param lambda2 the lambda2 to set */ public void setLambda2(double lambda2) { this.lambda2 = lambda2; } /** * @return the ts1 */ public double getTs1() { return ts1; } /** * @param ts1 the ts1 to set */ public void setTs1(double ts1) { this.ts1 = ts1; } /** * @return the ts2 */ public double getTs2() { return ts2; } /** * @param ts2 the ts2 to set */ public void setTs2(double ts2) { this.ts2 = ts2; } /** * @return the ts3 */ public double getTs3() { return ts3; } /** * @param ts3 the ts3 to set */ public void setTs3(double ts3) { this.ts3 = ts3; } /** * @return the ts4 */ public double getTs4() { return ts4; } /** * @param ts4 the ts4 to set */ public void setTs4(double ts4) { this.ts4 = ts4; } /** * @return the prb2 */ public double getPrb2() { return prb2; } /** * @param prb2 the prb2 to set */ public void setPrb2(double prb2) { this.prb2 = prb2; } /** * @return the prb3 */ public double getPrb3() { return prb3; } /** * @param prb3 the prb3 to set */ public void setPrb3(double prb3) { this.prb3 = prb3; } /** * @return the varianceCoefficient */ public double getVarianceCoefficient() { return varianceCoefficient; } /** * @param varianceCoefficient the varianceCoefficient to set */ public void setVarianceCoefficient(double varianceCoefficient) { this.varianceCoefficient = varianceCoefficient; } }
3,811
0.554043
0.530489
204
17.730392
19.661369
96
false
false
0
0
0
0
0
0
0.156863
false
false
4
b112abc7b1832d36d83ba8a279551e55e7997e7e
687,194,774,178
6eeed60fe09a1d9aa1af07f17f93fe199c7ae92f
/app/src/main/java/com/uts/salon/ui/home/HomeFragment.java
71e92226325aab3b83363ab9ef4a22a3cc4615b7
[]
no_license
180709733/UTS_PBP_D_Kelompok_5
https://github.com/180709733/UTS_PBP_D_Kelompok_5
4fb7c5e4148f2769b2c592eb571b65afefe39ec8
094089e3a8550da7f08fbfae76e2248914ec3442
refs/heads/master
2023-08-28T19:02:08.142000
2021-10-25T14:55:28
2021-10-25T14:55:28
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.uts.salon.ui.home; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import androidx.fragment.app.Fragment; import com.uts.salon.Model.User; import com.uts.salon.Preferences.UserPreferences; import com.uts.salon.R; import com.uts.salon.ui.Pesan.PesanActivity; import com.uts.salon.ui.Pesan.TampilActivity; import com.uts.salon.ui.auth.LoginActivity; import com.google.android.material.button.MaterialButton; import com.uts.salon.ui.maps.MapsActivity; import com.uts.salon.ui.maps.MapActivity; public class HomeFragment extends Fragment { private TextView tvWelcome; private MaterialButton btnLogout, btnLokasi, btnPesan, btnTampil, btnMap; private User user; private UserPreferences userPreferences; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View root = inflater.inflate(R.layout.fragment_home, container, false); userPreferences = new UserPreferences(getContext()); tvWelcome = root.findViewById(R.id.tvWelcome); btnLogout = root.findViewById(R.id.btnLogout); btnLokasi = root.findViewById(R.id.btnLokasi); btnPesan = root.findViewById(R.id.btnPesan); btnTampil = root.findViewById(R.id.btnTampil); //btnMap = root.findViewById(R.id.btnMap); user = userPreferences.getUserLogin(); checkLogin(); tvWelcome.setText("Selamat datang, "+user.getName()); btnLogout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { userPreferences.logout(); Toast.makeText(getContext(), "Baiii baiii", Toast.LENGTH_SHORT).show(); checkLogin(); } }); btnLokasi.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(getContext(), MapActivity.class)); } }); /*btnPesan.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(getContext(), PesanActivity.class)); } }); btnTampil.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(getContext(), TampilActivity.class)); } }); btnLokasi.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(getContext(), MapActivity.class)); } }); */ return root; } private void checkLogin(){ /* this function will check if user login , akan memunculkan toast jika tidak redirect ke login activity */ if(!userPreferences.checkLogin()){ startActivity(new Intent(getContext(), LoginActivity.class)); getActivity().finish(); }else { Toast.makeText(getContext(), "Welcome back !", Toast.LENGTH_SHORT).show(); } } }
UTF-8
Java
3,421
java
HomeFragment.java
Java
[]
null
[]
package com.uts.salon.ui.home; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import androidx.fragment.app.Fragment; import com.uts.salon.Model.User; import com.uts.salon.Preferences.UserPreferences; import com.uts.salon.R; import com.uts.salon.ui.Pesan.PesanActivity; import com.uts.salon.ui.Pesan.TampilActivity; import com.uts.salon.ui.auth.LoginActivity; import com.google.android.material.button.MaterialButton; import com.uts.salon.ui.maps.MapsActivity; import com.uts.salon.ui.maps.MapActivity; public class HomeFragment extends Fragment { private TextView tvWelcome; private MaterialButton btnLogout, btnLokasi, btnPesan, btnTampil, btnMap; private User user; private UserPreferences userPreferences; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View root = inflater.inflate(R.layout.fragment_home, container, false); userPreferences = new UserPreferences(getContext()); tvWelcome = root.findViewById(R.id.tvWelcome); btnLogout = root.findViewById(R.id.btnLogout); btnLokasi = root.findViewById(R.id.btnLokasi); btnPesan = root.findViewById(R.id.btnPesan); btnTampil = root.findViewById(R.id.btnTampil); //btnMap = root.findViewById(R.id.btnMap); user = userPreferences.getUserLogin(); checkLogin(); tvWelcome.setText("Selamat datang, "+user.getName()); btnLogout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { userPreferences.logout(); Toast.makeText(getContext(), "Baiii baiii", Toast.LENGTH_SHORT).show(); checkLogin(); } }); btnLokasi.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(getContext(), MapActivity.class)); } }); /*btnPesan.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(getContext(), PesanActivity.class)); } }); btnTampil.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(getContext(), TampilActivity.class)); } }); btnLokasi.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(getContext(), MapActivity.class)); } }); */ return root; } private void checkLogin(){ /* this function will check if user login , akan memunculkan toast jika tidak redirect ke login activity */ if(!userPreferences.checkLogin()){ startActivity(new Intent(getContext(), LoginActivity.class)); getActivity().finish(); }else { Toast.makeText(getContext(), "Welcome back !", Toast.LENGTH_SHORT).show(); } } }
3,421
0.643671
0.643671
99
33.565655
26.100103
115
false
false
0
0
0
0
0
0
0.686869
false
false
4
876b0903127ef7010a7598e80fb3884558c2df75
18,322,330,536,111
fd9c5d4ff3c1723fb735132218cedaf0f078cae6
/component-dsl/itests/src/main/java/org/apache/aries/osgi/functional/test/HighestRankingRouter.java
e2554a886c9540f808b838557d9f963ed037db40
[ "Apache-2.0" ]
permissive
gaoliujie2016/aries
https://github.com/gaoliujie2016/aries
607ffa10a135995fcd7d4d62064b24b81db33f4b
3cf085c0d411183d6ef65f5a0bc36aae316c480c
refs/heads/trunk
2021-09-24T02:15:48.282000
2021-09-16T02:20:57
2021-09-16T02:20:57
92,562,434
0
0
null
true
2017-05-27T01:56:30
2017-05-27T01:56:30
2017-04-28T21:26:59
2017-05-25T18:10:29
61,408
0
0
0
null
null
null
/* * 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.aries.osgi.functional.test; import org.apache.aries.osgi.functional.Event; import org.apache.aries.osgi.functional.OSGi; import org.osgi.framework.ServiceReference; import java.util.Comparator; import java.util.PriorityQueue; import java.util.function.Consumer; import static org.apache.aries.osgi.functional.OSGi.serviceReferences; /** * @author Carlos Sierra Andrés */ public class HighestRankingRouter<T extends Comparable<? super T>> implements Consumer<OSGi.Router<T>> { private PriorityQueue<Event<T>> _instances; public static <T> OSGi<ServiceReference<T>> highest(Class<T> clazz) { return serviceReferences(clazz).route(new HighestRankingRouter<>()); } @Override public void accept(OSGi.Router<T> router) { router.onIncoming(sr -> { Event<T> old = _instances.peek(); _instances.add(sr); if (_instances.peek() == sr) { if (old != null) { router.signalLeave(old); } router.signalAdd(sr); } }); router.onLeaving(sr -> { Event<T> old = _instances.peek(); _instances.remove(sr); Event<T> current = _instances.peek(); if (current != old) { router.signalLeave(old); if (current != null) { router.signalAdd(current); } } }); router.onStart( () -> _instances = new PriorityQueue<>( Comparator.<Event<T>, T>comparing(Event::getContent). reversed())); router.onClose(() -> { _instances.forEach(router::signalLeave); _instances.clear(); }); } }
UTF-8
Java
2,593
java
HighestRankingRouter.java
Java
[ { "context": "functional.OSGi.serviceReferences;\n\n/**\n * @author Carlos Sierra Andrés\n */\npublic class HighestRankingRouter<T extends C", "end": 1194, "score": 0.9998404383659363, "start": 1174, "tag": "NAME", "value": "Carlos Sierra Andrés" } ]
null
[]
/* * 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.aries.osgi.functional.test; import org.apache.aries.osgi.functional.Event; import org.apache.aries.osgi.functional.OSGi; import org.osgi.framework.ServiceReference; import java.util.Comparator; import java.util.PriorityQueue; import java.util.function.Consumer; import static org.apache.aries.osgi.functional.OSGi.serviceReferences; /** * @author <NAME> */ public class HighestRankingRouter<T extends Comparable<? super T>> implements Consumer<OSGi.Router<T>> { private PriorityQueue<Event<T>> _instances; public static <T> OSGi<ServiceReference<T>> highest(Class<T> clazz) { return serviceReferences(clazz).route(new HighestRankingRouter<>()); } @Override public void accept(OSGi.Router<T> router) { router.onIncoming(sr -> { Event<T> old = _instances.peek(); _instances.add(sr); if (_instances.peek() == sr) { if (old != null) { router.signalLeave(old); } router.signalAdd(sr); } }); router.onLeaving(sr -> { Event<T> old = _instances.peek(); _instances.remove(sr); Event<T> current = _instances.peek(); if (current != old) { router.signalLeave(old); if (current != null) { router.signalAdd(current); } } }); router.onStart( () -> _instances = new PriorityQueue<>( Comparator.<Event<T>, T>comparing(Event::getContent). reversed())); router.onClose(() -> { _instances.forEach(router::signalLeave); _instances.clear(); }); } }
2,578
0.62037
0.618827
85
29.494118
25.420984
76
false
false
0
0
0
0
0
0
0.364706
false
false
4
8a65e6b7cc882bd9058cc8a20436796986890b12
111,669,211,849
125ddf08fadf2cc27bd1ea00df98a569e9301f05
/Apps/popquiz/src/main/java/com/nu/popquiz/domain/Choice.java
d80e7c3136ff9586d5573ef14cc8e0187be475d4
[]
no_license
jaydg2000/android
https://github.com/jaydg2000/android
efbd1205e8e89dd242b94b8a007ec8f65800ed9c
52a70984d94d89e217cfd678acf29087abb5a4af
refs/heads/master
2018-05-14T04:11:17.415000
2015-07-05T13:07:51
2015-07-05T13:07:51
30,030,897
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nu.popquiz.domain; /** * Created by jay on 5/26/15. */ public class Choice { private final boolean isCorrect; private final String text; public Choice(String text, boolean isCorrect) { this.text = text; this.isCorrect = isCorrect; } public String getText() { return text; } public boolean isCorrect() { return isCorrect; } }
UTF-8
Java
408
java
Choice.java
Java
[ { "context": "package com.nu.popquiz.domain;\n\n/**\n * Created by jay on 5/26/15.\n */\npublic class Choice {\n\n privat", "end": 53, "score": 0.9830729961395264, "start": 50, "tag": "USERNAME", "value": "jay" } ]
null
[]
package com.nu.popquiz.domain; /** * Created by jay on 5/26/15. */ public class Choice { private final boolean isCorrect; private final String text; public Choice(String text, boolean isCorrect) { this.text = text; this.isCorrect = isCorrect; } public String getText() { return text; } public boolean isCorrect() { return isCorrect; } }
408
0.610294
0.598039
23
16.73913
15.277768
51
false
false
0
0
0
0
0
0
0.347826
false
false
3
8a9737947310e369ac3e4b6725013f8e9c21e4a7
14,826,227,174,837
867e495f4846074b6c8db28a4a4dea2967294233
/src/com/company/exception/FunctionHasNoLimitException.java
359d5c099448f6a32cce5c2ed2ef172e97f10b1f
[]
no_license
Sardaan/Integral
https://github.com/Sardaan/Integral
cca9a133b108920cb38dd4bc0bcb13fb8d87b16f
7f18ce1ed6d730449c27b0fbe48a5123228c5db2
refs/heads/master
2022-11-12T10:07:26.739000
2020-06-30T03:51:33
2020-06-30T03:51:33
275,991,414
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.company.exception; public class FunctionHasNoLimitException extends Exception{ public FunctionHasNoLimitException(){ super("Function has no limit"); } }
UTF-8
Java
182
java
FunctionHasNoLimitException.java
Java
[]
null
[]
package com.company.exception; public class FunctionHasNoLimitException extends Exception{ public FunctionHasNoLimitException(){ super("Function has no limit"); } }
182
0.747253
0.747253
7
25
21.494184
59
false
false
0
0
0
0
0
0
0.285714
false
false
3
d7669f6b91911248bba00e735aa95205d966c2cd
8,297,876,839,535
c4ddd7abf7406dd1bc6fbbfcd0a1c96c680133a1
/inv-winningList/src/main/java/com/test/inv/winning/ctl/ApiController.java
e813cda9d0133ac6af24b321ce031df00cd209e1
[]
no_license
p4a6i/inv-wallet-pcf_poc
https://github.com/p4a6i/inv-wallet-pcf_poc
f6b8b3d7cdb96e9d66057b7f28d97b1fe6c37752
eaa0013d0c250cf8c35a7044216edd0a844b01e6
refs/heads/master
2022-05-01T04:36:55.765000
2018-08-02T03:23:08
2018-08-02T03:23:08
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.test.inv.winning.ctl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.test.inv.winning.service.WinningListService; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.extern.slf4j.Slf4j; @RestController @RequestMapping("/api") @RefreshScope @Slf4j public class ApiController { @Value("${env.server}") public String env = ""; @Autowired private WinningListService winningListService; @GetMapping(value = "/winningList/{invTerm}") @ApiOperation(value = "查詢中獎發票號碼清單") public String inv( @ApiParam(name = "invTerm", value = "查詢開獎期別,年分為民國年,月份必須為雙數月. 格式(yyyMM)", defaultValue = "10104") @PathVariable String invTerm) { log.info(">>>>>>>> env:[{}], query interm:[{}]",env, invTerm); try { return winningListService.query(invTerm); } catch (Exception e) { String err = "{\"message\":\""+e.toString()+"\"}"; return err; } } }
UTF-8
Java
1,388
java
ApiController.java
Java
[]
null
[]
package com.test.inv.winning.ctl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.test.inv.winning.service.WinningListService; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.extern.slf4j.Slf4j; @RestController @RequestMapping("/api") @RefreshScope @Slf4j public class ApiController { @Value("${env.server}") public String env = ""; @Autowired private WinningListService winningListService; @GetMapping(value = "/winningList/{invTerm}") @ApiOperation(value = "查詢中獎發票號碼清單") public String inv( @ApiParam(name = "invTerm", value = "查詢開獎期別,年分為民國年,月份必須為雙數月. 格式(yyyMM)", defaultValue = "10104") @PathVariable String invTerm) { log.info(">>>>>>>> env:[{}], query interm:[{}]",env, invTerm); try { return winningListService.query(invTerm); } catch (Exception e) { String err = "{\"message\":\""+e.toString()+"\"}"; return err; } } }
1,388
0.756818
0.750758
42
30.428572
25.132168
99
false
false
0
0
0
0
0
0
1.357143
false
false
3
3289b6de89b47cf6d57cce09896dd23d3b8a6f0f
23,785,528,948,251
2838cfca6a006dc90a2aa13bca382ee873ff371a
/src/diretriz/DiretrizDAO.java
74d7610d1ff0180fae65fc88b7e7a81a5b25df47
[]
no_license
johanessevero/matriz_web
https://github.com/johanessevero/matriz_web
91ee53dca5cfcd2ff86c4708d287f6ef506c702f
87961fca9f05f155abad5cd18fb2bace5bedc986
refs/heads/master
2018-01-01T08:34:16.768000
2016-10-25T22:48:49
2016-10-25T22:48:49
71,945,429
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package diretriz; import util.DAOException; /** * Interface para a classe de acesso a dados referente a entidade Diretriz - camada de acesso a dados/model * @author Johanes Severo * */ public interface DiretrizDAO { public Diretriz inserir(Diretriz diretriz) throws DAOException; }
UTF-8
Java
306
java
DiretrizDAO.java
Java
[ { "context": "etriz - camada de acesso a dados/model\r\n * @author Johanes Severo\r\n *\r\n */\r\npublic interface DiretrizDAO {\r\n\r\n\tpubl", "end": 189, "score": 0.9998692870140076, "start": 175, "tag": "NAME", "value": "Johanes Severo" } ]
null
[]
package diretriz; import util.DAOException; /** * Interface para a classe de acesso a dados referente a entidade Diretriz - camada de acesso a dados/model * @author <NAME> * */ public interface DiretrizDAO { public Diretriz inserir(Diretriz diretriz) throws DAOException; }
298
0.72549
0.72549
14
19.857143
29.866028
107
false
false
0
0
0
0
0
0
0.357143
false
false
3
4b465d90e8657ada467c1736702dee280bec7b08
32,890,859,577,919
1de795aafb7b5e9a59d54951427bb0ec23349ff8
/nhesb/src/com/project/util/KafkaMsgConsumer.java
e76cb16516a9fe1e95c83916527f90732fd67904
[]
no_license
jeffreyning/nhEsb
https://github.com/jeffreyning/nhEsb
36226cbf3938c301b0b3e015a49d3fcae941df79
32c85740d17440cbd95951139d8a210e11bc8a6f
refs/heads/master
2023-03-19T17:48:11.368000
2017-08-21T09:25:09
2017-08-21T09:25:09
72,590,553
5
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.project.util; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; import kafka.consumer.ConsumerConfig; import kafka.consumer.ConsumerIterator; import kafka.consumer.KafkaStream; import kafka.javaapi.consumer.ConsumerConnector; import com.nh.micro.rule.engine.core.GroovyExecUtil; /** * * @author ninghao * */ public class KafkaMsgConsumer extends Thread { private final ConsumerConnector consumer; private String topic = "test"; private String zkUrl = "localhost:2181,localhost:3181,localhost:4181"; private String groupId = "0"; public String getGroupId() { return groupId; } public void setGroupId(String groupId) { this.groupId = groupId; } public String getZkUrl() { return zkUrl; } public void setZkUrl(String zkUrl) { this.zkUrl = zkUrl; } public String getTopic() { return topic; } public void setTopic(String topic) { this.topic = topic; } public KafkaMsgConsumer() { consumer = kafka.consumer.Consumer .createJavaConsumerConnector(createConsumerConfig()); this.start(); } private ConsumerConfig createConsumerConfig() { Properties props = new Properties(); props.put("zookeeper.connect", zkUrl); props.put("group.id", groupId); props.put("zookeeper.session.timeout.ms", "10000"); return new ConsumerConfig(props); } public void run() { Map<String, Integer> topickMap = new HashMap<String, Integer>(); topickMap.put(topic, 1); Map<String, List<KafkaStream<byte[], byte[]>>> streamMap = consumer .createMessageStreams(topickMap); KafkaStream<byte[], byte[]> stream = streamMap.get(topic).get(0); ConsumerIterator<byte[], byte[]> it = stream.iterator(); while (true) { try { if (it.hasNext()) { String recvStr = new String(it.next().message(), "utf-8"); GroovyExecUtil.execGroovyRetObj("micro_log_platform","saveLog", recvStr); } } catch (Exception e) { e.printStackTrace(); continue; } } } }
UTF-8
Java
2,070
java
KafkaMsgConsumer.java
Java
[ { "context": "ngine.core.GroovyExecUtil;\r\n\r\n/**\r\n * \r\n * @author ninghao\r\n *\r\n */\r\npublic class KafkaMsgConsumer extends T", "end": 387, "score": 0.9991629719734192, "start": 380, "tag": "USERNAME", "value": "ninghao" } ]
null
[]
package com.project.util; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; import kafka.consumer.ConsumerConfig; import kafka.consumer.ConsumerIterator; import kafka.consumer.KafkaStream; import kafka.javaapi.consumer.ConsumerConnector; import com.nh.micro.rule.engine.core.GroovyExecUtil; /** * * @author ninghao * */ public class KafkaMsgConsumer extends Thread { private final ConsumerConnector consumer; private String topic = "test"; private String zkUrl = "localhost:2181,localhost:3181,localhost:4181"; private String groupId = "0"; public String getGroupId() { return groupId; } public void setGroupId(String groupId) { this.groupId = groupId; } public String getZkUrl() { return zkUrl; } public void setZkUrl(String zkUrl) { this.zkUrl = zkUrl; } public String getTopic() { return topic; } public void setTopic(String topic) { this.topic = topic; } public KafkaMsgConsumer() { consumer = kafka.consumer.Consumer .createJavaConsumerConnector(createConsumerConfig()); this.start(); } private ConsumerConfig createConsumerConfig() { Properties props = new Properties(); props.put("zookeeper.connect", zkUrl); props.put("group.id", groupId); props.put("zookeeper.session.timeout.ms", "10000"); return new ConsumerConfig(props); } public void run() { Map<String, Integer> topickMap = new HashMap<String, Integer>(); topickMap.put(topic, 1); Map<String, List<KafkaStream<byte[], byte[]>>> streamMap = consumer .createMessageStreams(topickMap); KafkaStream<byte[], byte[]> stream = streamMap.get(topic).get(0); ConsumerIterator<byte[], byte[]> it = stream.iterator(); while (true) { try { if (it.hasNext()) { String recvStr = new String(it.next().message(), "utf-8"); GroovyExecUtil.execGroovyRetObj("micro_log_platform","saveLog", recvStr); } } catch (Exception e) { e.printStackTrace(); continue; } } } }
2,070
0.67971
0.669565
86
22.093023
21.016953
78
false
false
0
0
0
0
0
0
1.813954
false
false
3
6cd1ee57381b1fdc8dfcd9ede984352754fe2b64
30,305,289,294,734
054df10b2e9210aa5b471a55fa6a34b7b0c2b6c1
/src/main/java/com/zhr/student/controller/EquController.java
9ac76f6fc53eb42d154566c9a6ab7b2165a54146
[]
no_license
HarryZHR/springboot-demo
https://github.com/HarryZHR/springboot-demo
fa1d2fb0392e7f90ea62c4458d661e78ef5e23ee
47d15d1a6de7ea03d222543cf5b1a8cd8708beb9
refs/heads/master
2022-07-12T12:40:03.073000
2019-08-26T05:56:31
2019-08-26T05:56:31
142,879,392
0
0
null
false
2022-06-29T17:36:05
2018-07-30T13:28:40
2019-08-26T05:56:49
2022-06-29T17:36:05
120
0
0
4
Java
false
false
package com.zhr.student.controller; import com.zhr.student.common.util.ExcelUtil; import com.zhr.student.dao.EquipmentDAO; import com.zhr.student.dao.ProductCategoryDAO; import com.zhr.student.entity.Equipment; import com.zhr.student.entity.ProductCategory; import org.apache.poi.ss.usermodel.*; import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; @Controller("equController") @RequestMapping("/equ") public class EquController { @Resource private EquipmentDAO equipmentDAO; @Resource private ProductCategoryDAO productCategoryDAO; @GetMapping("/export") @ResponseBody public int exportEquipment() { List<Equipment> equipments = equipmentDAO.listAll(); List<String> sqls = new ArrayList<>(); for (Equipment equipment : equipments) { String sql = "update equipment_information set origin_id= "+equipment.getOriginId()+" where id = "+equipment.getId()+";"; sqls.add(sql); } write2(sqls); return 0; } @GetMapping("/import") @ResponseBody public int importCategory() throws IOException { // List<Equipment> equipmentHas = equipmentDAO.listAll(); List<Equipment> oneToMany = new ArrayList<>(); List<Equipment> none = new ArrayList<>(); List<Equipment> equipments = read(); int count = 0; for (Equipment equipment : equipments) { String name = equipment.getEquName() != null ? equipment.getEquName().trim() : null; String model = equipment.getEquModel() != null ? equipment.getEquModel().trim() : null; String cate = equipment.getCategory() != null ? equipment.getCategory().trim() : null; List<Equipment> equList = equipmentDAO.listEquByNameModelAndCate(name, model, cate); if (equList.size() > 1) { oneToMany.add(equipment); System.out.println(111); // List<Equipment> equipmentList = equipmentDAO.listEquFactory(equipment.getEquName(), equipment.getEquModel(), equipment.getEquFactory()); // if (equipmentList.size() == 1) { // equipment.setId(equipmentList.get(0).getId()); // } else { // } } else if (equList.size() == 1){ // List<ProductCategory> productCategories = productCategoryDAO.getProductByName(equipment.getCategory(), 2); // if (productCategories.size() > 1) { // System.out.println(2222); // } else if (productCategories.size() == 1) { // ProductCategory productCategory = productCategories.get(0); Equipment equipment1 = equList.get(0); // equipment1.setCategory(String.valueOf(productCategory.getId())); equipmentDAO.updateEqu1(equipment1.getId(), equipment.getOriginId()); // } } else { none.add(equipment); } } write(oneToMany, "oneToMany"); write(none, "none"); return count; } private List<Equipment> read() throws IOException { File file = new File("C://Users//user//Desktop//公共库0524.xlsx"); FileInputStream inputStream = new FileInputStream(file); Sheet sheet = ExcelUtil.getFirstSheet(inputStream); inputStream.close(); List<Equipment> equs = new ArrayList<>(); if (sheet != null) { int i = 1; Row row; while (i <= 30000) { row = sheet.getRow(i); if (row != null) { Equipment cate = new Equipment(); int columnCount = row.getLastCellNum(); int j = 0; while (j < columnCount) { Cell cell = row.getCell(j); String content = ExcelUtil.getCellValue(cell); switch (j++) { case 0: cate.setOriginId(content); break; case 2: cate.setEquName(content); break; case 3: cate.setEquModel(content); break; case 7: cate.setCategory(content); break; case 11: cate.setEquFactory(content); break; default: break; } } equs.add(cate); } i++; } } return equs; } private void write(List<Equipment> equipmentList, String type) { SXSSFWorkbook wb = new SXSSFWorkbook(100); Sheet sh = wb.createSheet(); /*List<String> titles = new ArrayList<>(); titles.add("id"); titles.add("equ_name"); titles.add("equ_model"); titles.add("equ_factory"); titles.add("category"); titles.add("originId"); Row row1 = sh.createRow(0); for(int i = 0; i < titles.size(); i++){ Cell cell = row1.createCell(i); cell.setCellValue(titles.get(i)); }*/ CellStyle cellStyle = wb.createCellStyle(); CreationHelper creationHelper = wb.getCreationHelper(); cellStyle.setDataFormat(creationHelper.createDataFormat().getFormat("yyyy-MM-dd")); for(int i = 0; i < equipmentList.size(); i++){ Row row = sh.createRow(i); Cell cell2 = row.createCell(1); cell2.setCellType(CellType.STRING); cell2.setCellStyle(cellStyle); cell2.setCellValue(equipmentList.get(i).getEquName()); Cell cell3 = row.createCell(2); cell3.setCellType(CellType.STRING); cell3.setCellValue(equipmentList.get(i).getEquModel()); Cell cell4 = row.createCell(3); cell4.setCellType(CellType.STRING); cell4.setCellValue(equipmentList.get(i).getEquFactory()); Cell cell5 = row.createCell(4); cell5.setCellType(CellType.NUMERIC); cell5.setCellValue(equipmentList.get(i).getCategory()); Cell cell6 = row.createCell(5); cell6.setCellType(CellType.NUMERIC); cell6.setCellValue(equipmentList.get(i).getOriginId()); } FileOutputStream out; try { if ("oneToMany".equals(type)) { out = new FileOutputStream("D://对应数据库多条数据.xlsx"); } else { out = new FileOutputStream("D://对应数据库0条数据.xlsx"); } wb.write(out); out.close(); } catch (IOException e) { e.printStackTrace(); } // dispose of temporary files backing this workbook on disk wb.dispose(); } private void write2(List<String> sqls) { SXSSFWorkbook wb = new SXSSFWorkbook(100); Sheet sh = wb.createSheet(); CellStyle cellStyle = wb.createCellStyle(); CreationHelper creationHelper = wb.getCreationHelper(); cellStyle.setDataFormat(creationHelper.createDataFormat().getFormat("yyyy-MM-dd")); for(int i = 0; i < sqls.size(); i++){ Row row = sh.createRow(i); Cell cell2 = row.createCell(1); cell2.setCellType(CellType.STRING); cell2.setCellStyle(cellStyle); cell2.setCellValue(sqls.get(i)); } FileOutputStream out; try { out = new FileOutputStream("D://sqll.xlsx"); wb.write(out); out.close(); } catch (IOException e) { e.printStackTrace(); } // dispose of temporary files backing this workbook on disk wb.dispose(); } }
UTF-8
Java
8,523
java
EquController.java
Java
[]
null
[]
package com.zhr.student.controller; import com.zhr.student.common.util.ExcelUtil; import com.zhr.student.dao.EquipmentDAO; import com.zhr.student.dao.ProductCategoryDAO; import com.zhr.student.entity.Equipment; import com.zhr.student.entity.ProductCategory; import org.apache.poi.ss.usermodel.*; import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; @Controller("equController") @RequestMapping("/equ") public class EquController { @Resource private EquipmentDAO equipmentDAO; @Resource private ProductCategoryDAO productCategoryDAO; @GetMapping("/export") @ResponseBody public int exportEquipment() { List<Equipment> equipments = equipmentDAO.listAll(); List<String> sqls = new ArrayList<>(); for (Equipment equipment : equipments) { String sql = "update equipment_information set origin_id= "+equipment.getOriginId()+" where id = "+equipment.getId()+";"; sqls.add(sql); } write2(sqls); return 0; } @GetMapping("/import") @ResponseBody public int importCategory() throws IOException { // List<Equipment> equipmentHas = equipmentDAO.listAll(); List<Equipment> oneToMany = new ArrayList<>(); List<Equipment> none = new ArrayList<>(); List<Equipment> equipments = read(); int count = 0; for (Equipment equipment : equipments) { String name = equipment.getEquName() != null ? equipment.getEquName().trim() : null; String model = equipment.getEquModel() != null ? equipment.getEquModel().trim() : null; String cate = equipment.getCategory() != null ? equipment.getCategory().trim() : null; List<Equipment> equList = equipmentDAO.listEquByNameModelAndCate(name, model, cate); if (equList.size() > 1) { oneToMany.add(equipment); System.out.println(111); // List<Equipment> equipmentList = equipmentDAO.listEquFactory(equipment.getEquName(), equipment.getEquModel(), equipment.getEquFactory()); // if (equipmentList.size() == 1) { // equipment.setId(equipmentList.get(0).getId()); // } else { // } } else if (equList.size() == 1){ // List<ProductCategory> productCategories = productCategoryDAO.getProductByName(equipment.getCategory(), 2); // if (productCategories.size() > 1) { // System.out.println(2222); // } else if (productCategories.size() == 1) { // ProductCategory productCategory = productCategories.get(0); Equipment equipment1 = equList.get(0); // equipment1.setCategory(String.valueOf(productCategory.getId())); equipmentDAO.updateEqu1(equipment1.getId(), equipment.getOriginId()); // } } else { none.add(equipment); } } write(oneToMany, "oneToMany"); write(none, "none"); return count; } private List<Equipment> read() throws IOException { File file = new File("C://Users//user//Desktop//公共库0524.xlsx"); FileInputStream inputStream = new FileInputStream(file); Sheet sheet = ExcelUtil.getFirstSheet(inputStream); inputStream.close(); List<Equipment> equs = new ArrayList<>(); if (sheet != null) { int i = 1; Row row; while (i <= 30000) { row = sheet.getRow(i); if (row != null) { Equipment cate = new Equipment(); int columnCount = row.getLastCellNum(); int j = 0; while (j < columnCount) { Cell cell = row.getCell(j); String content = ExcelUtil.getCellValue(cell); switch (j++) { case 0: cate.setOriginId(content); break; case 2: cate.setEquName(content); break; case 3: cate.setEquModel(content); break; case 7: cate.setCategory(content); break; case 11: cate.setEquFactory(content); break; default: break; } } equs.add(cate); } i++; } } return equs; } private void write(List<Equipment> equipmentList, String type) { SXSSFWorkbook wb = new SXSSFWorkbook(100); Sheet sh = wb.createSheet(); /*List<String> titles = new ArrayList<>(); titles.add("id"); titles.add("equ_name"); titles.add("equ_model"); titles.add("equ_factory"); titles.add("category"); titles.add("originId"); Row row1 = sh.createRow(0); for(int i = 0; i < titles.size(); i++){ Cell cell = row1.createCell(i); cell.setCellValue(titles.get(i)); }*/ CellStyle cellStyle = wb.createCellStyle(); CreationHelper creationHelper = wb.getCreationHelper(); cellStyle.setDataFormat(creationHelper.createDataFormat().getFormat("yyyy-MM-dd")); for(int i = 0; i < equipmentList.size(); i++){ Row row = sh.createRow(i); Cell cell2 = row.createCell(1); cell2.setCellType(CellType.STRING); cell2.setCellStyle(cellStyle); cell2.setCellValue(equipmentList.get(i).getEquName()); Cell cell3 = row.createCell(2); cell3.setCellType(CellType.STRING); cell3.setCellValue(equipmentList.get(i).getEquModel()); Cell cell4 = row.createCell(3); cell4.setCellType(CellType.STRING); cell4.setCellValue(equipmentList.get(i).getEquFactory()); Cell cell5 = row.createCell(4); cell5.setCellType(CellType.NUMERIC); cell5.setCellValue(equipmentList.get(i).getCategory()); Cell cell6 = row.createCell(5); cell6.setCellType(CellType.NUMERIC); cell6.setCellValue(equipmentList.get(i).getOriginId()); } FileOutputStream out; try { if ("oneToMany".equals(type)) { out = new FileOutputStream("D://对应数据库多条数据.xlsx"); } else { out = new FileOutputStream("D://对应数据库0条数据.xlsx"); } wb.write(out); out.close(); } catch (IOException e) { e.printStackTrace(); } // dispose of temporary files backing this workbook on disk wb.dispose(); } private void write2(List<String> sqls) { SXSSFWorkbook wb = new SXSSFWorkbook(100); Sheet sh = wb.createSheet(); CellStyle cellStyle = wb.createCellStyle(); CreationHelper creationHelper = wb.getCreationHelper(); cellStyle.setDataFormat(creationHelper.createDataFormat().getFormat("yyyy-MM-dd")); for(int i = 0; i < sqls.size(); i++){ Row row = sh.createRow(i); Cell cell2 = row.createCell(1); cell2.setCellType(CellType.STRING); cell2.setCellStyle(cellStyle); cell2.setCellValue(sqls.get(i)); } FileOutputStream out; try { out = new FileOutputStream("D://sqll.xlsx"); wb.write(out); out.close(); } catch (IOException e) { e.printStackTrace(); } // dispose of temporary files backing this workbook on disk wb.dispose(); } }
8,523
0.548391
0.53896
223
37.040359
25.37244
154
false
false
0
0
0
0
0
0
0.663677
false
false
3
403a856cf5f0b4ab4fbd12a8be4477eab8fec726
1,451,698,973,365
db8364c7a67d610d3c77c9c96842f741f31652d2
/《Java经典编程300例》/032-point.java
71b88ab6cb54eceed839829b328c80995e2b4699
[]
no_license
yangsong1993/learn
https://github.com/yangsong1993/learn
f69c2de988badff69bf88e904d6e2ef8314d4a06
3d2131c537daba4f8fe8f91a771992aa7a146ac4
refs/heads/master
2020-04-23T16:08:26.843000
2020-03-29T15:25:01
2020-03-29T15:25:01
171,287,840
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Creator: YangSong * Date: 2019-11-11 16:56:03 * Reference: 《Java经典编程300例》 * Demo: 032 * Tip: 二维数组的行列互换 */ public class ArrayRowColumnSwap { // 打印二维数组的自定义函数 public static void printArray(int[][] arr) { for (int i = 0; i < arr.length; i++) { for (int j = 0; j < arr.length; j++) { System.out.print(arr[i][j] + " "); // System.out.print(),不换行打印 } System.out.println(""); // System.out.println(),换行打印 } } // 主函数入口 public static void main(String[] args) { int arr_start[][] = new int[][] { {1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; // 创建转置前的二维数组 System.out.println("before exchange the array: "); printArray(arr_start); // 打印转置前的二维数组 int arr_end[][] = new int[arr_start.length][arr_start.length]; // 创建转置后的二维数组;arr_start.length = 3 for (int i = 0; i < arr_start.length; i++) { for (int j = 0; j < arr_start[i].length; j++) { arr_end[i][j] = arr_start[i][j]; // 交换数组的索引,即交换了其值 } } System.out.println("after exchange: "); printArray(arr_end); } }
UTF-8
Java
1,357
java
032-point.java
Java
[ { "context": "/*\n * Creator: YangSong\n * Date: 2019-11-11 16:56:03\n * Reference:", "end": 27, "score": 0.9962118864059448, "start": 19, "tag": "NAME", "value": "YangSong" } ]
null
[]
/* * Creator: YangSong * Date: 2019-11-11 16:56:03 * Reference: 《Java经典编程300例》 * Demo: 032 * Tip: 二维数组的行列互换 */ public class ArrayRowColumnSwap { // 打印二维数组的自定义函数 public static void printArray(int[][] arr) { for (int i = 0; i < arr.length; i++) { for (int j = 0; j < arr.length; j++) { System.out.print(arr[i][j] + " "); // System.out.print(),不换行打印 } System.out.println(""); // System.out.println(),换行打印 } } // 主函数入口 public static void main(String[] args) { int arr_start[][] = new int[][] { {1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; // 创建转置前的二维数组 System.out.println("before exchange the array: "); printArray(arr_start); // 打印转置前的二维数组 int arr_end[][] = new int[arr_start.length][arr_start.length]; // 创建转置后的二维数组;arr_start.length = 3 for (int i = 0; i < arr_start.length; i++) { for (int j = 0; j < arr_start[i].length; j++) { arr_end[i][j] = arr_start[i][j]; // 交换数组的索引,即交换了其值 } } System.out.println("after exchange: "); printArray(arr_end); } }
1,357
0.498728
0.46989
38
30.026316
27.767347
106
false
false
0
0
0
0
0
0
0.657895
false
false
3
8dbda8371018a911bfec4fc61f8e272ac637cb7b
6,493,990,560,503
7da937461c5e7f295cd0007e0b57e47bd3b036c8
/src/main/java/com/pojo/StudentEntity.java
06719a7c742023f054b773ef3dcabb20dc170807
[]
no_license
x-z-c/SecondDemo
https://github.com/x-z-c/SecondDemo
6795bac478f9a56175ee38d8156cb2a83e465619
e664995b683e9097f7744585d3130ae0aa21258c
refs/heads/master
2020-05-13T19:15:35.690000
2019-04-18T11:40:57
2019-04-18T11:40:57
181,652,347
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pojo; public class StudentEntity { int xid,jid; public int getJid() { return jid; } public void setJid(int jid) { this.jid = jid; } String xjg,xdate,xbj,jpy,jtype; //xjg學生提交的作業 public String getJpy() { return jpy; } public void setJpy(String jpy) { this.jpy = jpy; } public String getJtype() { return jtype; } public void setJtype(String jtype) { this.jtype = jtype; } public int getXid() { return xid; } public void setXid(int xid) { this.xid = xid; } public String getXjg() { return xjg; } public void setXjg(String xjg) { this.xjg = xjg; } public String getXdate() { return xdate; } public void setXdate(String xdate) { this.xdate = xdate; } public String getXbj() { return xbj; } public void setXbj(String xbj) { this.xbj = xbj; } }
UTF-8
Java
1,017
java
StudentEntity.java
Java
[]
null
[]
package com.pojo; public class StudentEntity { int xid,jid; public int getJid() { return jid; } public void setJid(int jid) { this.jid = jid; } String xjg,xdate,xbj,jpy,jtype; //xjg學生提交的作業 public String getJpy() { return jpy; } public void setJpy(String jpy) { this.jpy = jpy; } public String getJtype() { return jtype; } public void setJtype(String jtype) { this.jtype = jtype; } public int getXid() { return xid; } public void setXid(int xid) { this.xid = xid; } public String getXjg() { return xjg; } public void setXjg(String xjg) { this.xjg = xjg; } public String getXdate() { return xdate; } public void setXdate(String xdate) { this.xdate = xdate; } public String getXbj() { return xbj; } public void setXbj(String xbj) { this.xbj = xbj; } }
1,017
0.526421
0.526421
63
14.920635
13.81775
54
false
false
0
0
0
0
0
0
0.349206
false
false
3
ab90146987ddb7b0fb36c2ae98b8a1e688e34b68
20,392,504,721,514
1ab53f75f575a4048674eb1889e951fc8c4128b0
/Java_Core_Home/src/home/generic/thuvien/ThuVienGeneric.java
27f2cf644757d9f8c3e173ba8aa1796f3a6bde47
[]
no_license
chinhvq/VQC-Java
https://github.com/chinhvq/VQC-Java
3911f70450ffa57cd5082d5ac3031cff2f78fe34
369ddf566e305ac603ab4645c8dc47af487c2418
refs/heads/master
2021-09-16T05:29:28.209000
2018-06-17T02:19:35
2018-06-17T02:19:35
125,210,181
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package home.generic.thuvien; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; public class ThuVienGeneric { static List<BookGeneric> bookGenerics = new ArrayList<>(); static List<VideoGeneric> videoGenerics = new ArrayList<>(); public static void main(String[] args) { System.out.println("Day la bai Generic I"); BookGeneric bookGeneric = new BookGeneric("Thep da toi the day", "NBX Van Hoa", 250); add(bookGenerics, bookGeneric); bookGeneric = new BookGeneric("7 Thoi Quan", "NXB Ha Noi", 400); add(bookGenerics, bookGeneric); bookGeneric = new BookGeneric("Dat nuoc toi", "NBX Quan Doi", 300); add(bookGenerics, bookGeneric); add(bookGenerics, null); VideoGeneric videoGeneric = new VideoGeneric("Too fast and too furious", "Dai truyen hinh TP HCM", 400.30); add(videoGenerics, videoGeneric); videoGeneric = new VideoGeneric("Canh sat hinh su", "Dai truyen hinh Viet Nam", 5000); add(videoGenerics, videoGeneric); videoGeneric = new VideoGeneric("Bong dung muon hat", "Dai truyen hinh TP HCM", 500.20); add(videoGenerics, videoGeneric); add(videoGenerics, videoGeneric); bookGeneric = findLast(bookGenerics); System.out.print("\nThe last book of the list: \n\t" + bookGeneric); videoGeneric = findLast(videoGenerics); System.out.print("\nThe last video of the list: \n\t" + videoGeneric); System.out.println("\nDanh sach Book truoc khi sap xep theo ten"); System.out.println(bookGenerics); bookGenerics.sort(null); System.out.println("\nDanh sach Book sau khi sap xep theo ten"); System.out.println(bookGenerics); bookGenerics.sort(new SortByPagesGeneric()); System.out.println("\nDanh sach Book sau khi sap xep theo pages tang dan"); System.out.println(bookGenerics); bookGenerics.sort(new SortByPagesInReverseOrderGeneric<>(new SortByPagesGeneric())); System.out.println("\nDanh sach Book sau khi sap xep theo pages giam dan"); System.out.println(bookGenerics); System.out.println("\nDanh sach Video truoc khi sap xep theo ten"); System.out.println(videoGenerics); videoGenerics.sort(null); System.out.println("\nDanh sach Video sau khi sap xep theo ten"); System.out.println(videoGenerics); videoGenerics.sort(new SortByDurationGeneric()); System.out.println("\nDanh sach Video sau khi sap xep theo duration tang dan"); System.out.println(videoGenerics); videoGenerics.sort(new SortByDurationInReverseOrderGeneric<>(new SortByDurationGeneric())); System.out.println("\nDanh sach Video sau khi sap xep theo duration giam dan"); System.out.println(videoGenerics); } private static <E> boolean add(Collection<E> E, E e) { if (e == null) { System.out.print("Please input item information for \" " + String.valueOf(e).toUpperCase() + " \""); return false; } else if (find(E, e)) { System.out.println("\nItem \"" + e.toString() + "\"\nalready exist in library"); return false; } else { E.add(e); return true; } } private static <E> boolean find(Collection<E> E, E e) { if (e == null) { return false; } else { if (E.contains(e)) { return true; } } return false; } private static <E> E findLast(Collection<E> X) { E e = null; Iterator<E> itr = X.iterator(); while (itr.hasNext()) { e = itr.next(); } return e; } }
UTF-8
Java
3,432
java
ThuVienGeneric.java
Java
[]
null
[]
package home.generic.thuvien; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; public class ThuVienGeneric { static List<BookGeneric> bookGenerics = new ArrayList<>(); static List<VideoGeneric> videoGenerics = new ArrayList<>(); public static void main(String[] args) { System.out.println("Day la bai Generic I"); BookGeneric bookGeneric = new BookGeneric("Thep da toi the day", "NBX Van Hoa", 250); add(bookGenerics, bookGeneric); bookGeneric = new BookGeneric("7 Thoi Quan", "NXB Ha Noi", 400); add(bookGenerics, bookGeneric); bookGeneric = new BookGeneric("Dat nuoc toi", "NBX Quan Doi", 300); add(bookGenerics, bookGeneric); add(bookGenerics, null); VideoGeneric videoGeneric = new VideoGeneric("Too fast and too furious", "Dai truyen hinh TP HCM", 400.30); add(videoGenerics, videoGeneric); videoGeneric = new VideoGeneric("Canh sat hinh su", "Dai truyen hinh Viet Nam", 5000); add(videoGenerics, videoGeneric); videoGeneric = new VideoGeneric("Bong dung muon hat", "Dai truyen hinh TP HCM", 500.20); add(videoGenerics, videoGeneric); add(videoGenerics, videoGeneric); bookGeneric = findLast(bookGenerics); System.out.print("\nThe last book of the list: \n\t" + bookGeneric); videoGeneric = findLast(videoGenerics); System.out.print("\nThe last video of the list: \n\t" + videoGeneric); System.out.println("\nDanh sach Book truoc khi sap xep theo ten"); System.out.println(bookGenerics); bookGenerics.sort(null); System.out.println("\nDanh sach Book sau khi sap xep theo ten"); System.out.println(bookGenerics); bookGenerics.sort(new SortByPagesGeneric()); System.out.println("\nDanh sach Book sau khi sap xep theo pages tang dan"); System.out.println(bookGenerics); bookGenerics.sort(new SortByPagesInReverseOrderGeneric<>(new SortByPagesGeneric())); System.out.println("\nDanh sach Book sau khi sap xep theo pages giam dan"); System.out.println(bookGenerics); System.out.println("\nDanh sach Video truoc khi sap xep theo ten"); System.out.println(videoGenerics); videoGenerics.sort(null); System.out.println("\nDanh sach Video sau khi sap xep theo ten"); System.out.println(videoGenerics); videoGenerics.sort(new SortByDurationGeneric()); System.out.println("\nDanh sach Video sau khi sap xep theo duration tang dan"); System.out.println(videoGenerics); videoGenerics.sort(new SortByDurationInReverseOrderGeneric<>(new SortByDurationGeneric())); System.out.println("\nDanh sach Video sau khi sap xep theo duration giam dan"); System.out.println(videoGenerics); } private static <E> boolean add(Collection<E> E, E e) { if (e == null) { System.out.print("Please input item information for \" " + String.valueOf(e).toUpperCase() + " \""); return false; } else if (find(E, e)) { System.out.println("\nItem \"" + e.toString() + "\"\nalready exist in library"); return false; } else { E.add(e); return true; } } private static <E> boolean find(Collection<E> E, E e) { if (e == null) { return false; } else { if (E.contains(e)) { return true; } } return false; } private static <E> E findLast(Collection<E> X) { E e = null; Iterator<E> itr = X.iterator(); while (itr.hasNext()) { e = itr.next(); } return e; } }
3,432
0.689103
0.68211
95
34.126316
28.772882
109
false
false
0
0
0
0
0
0
2.505263
false
false
3
5f4b295d30f556eabb686f6ce19edcfee39ad8fb
1,709,397,005,166
b5e01780265cc40c0e6bf204c5e864aacaf5f626
/app/src/main/java/com/sunlands/intl/yingshi/ui/community/presenter/MyCollectPresenter.java
83715ca578a3ef4bb696930c3613fa227d4261b4
[]
no_license
wojiaoyanxin/swonline
https://github.com/wojiaoyanxin/swonline
3e024c36021d686a5e7c2182091a833678a23cde
544840a952aea2ff00846096bd7062198e772eb6
refs/heads/master
2022-04-16T13:26:15.013000
2020-03-26T08:21:04
2020-03-26T08:21:04
250,190,401
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sunlands.intl.yingshi.ui.community.presenter; import com.sunlands.comm_core.base.mvp.MvpBasePresenter; import com.sunlands.comm_core.net.BaseModel; import com.sunlands.comm_core.net.MVPModelCallbacks; import com.sunlands.intl.yingshi.bean.MyCollectBean; import com.sunlands.intl.yingshi.groovy.CheckNet; import com.sunlands.intl.yingshi.ui.community.IMessageContract; import com.sunlands.intl.yingshi.ui.community.model.MyCollectModel; import com.sunlands.intl.yingshi.ui.community.view.MyCollectActivity; /** * 当前包名: com.sunlands.intl.yingshi.ui.community.presenter * 创 建 人: xueh * 创建日期: 2019/4/15 14:45 * 备注: */ public class MyCollectPresenter extends MvpBasePresenter<IMessageContract.IMyCollect, MyCollectModel> { public MyCollectPresenter(IMessageContract.IMyCollect iMyCollect) { super(iMyCollect); } @Override protected MyCollectModel createModel() { return new MyCollectModel(); } public void getMine(int limit, String type,String viewId) { if (type.equals(MyCollectActivity.MY_COLLECT)) { getMineCollect(limit); } else if (type.equals(MyCollectActivity.MY_PUBLISH)) { getMineThread(limit,viewId); } } @CheckNet private void getMineThread(int limit,String viewId ) { getView().showLoading(); getModel().mine_Thread(0, limit,viewId, getView().getLifecycleSubject(), new MVPModelCallbacks<MyCollectBean>() { @Override public void onSuccess(MyCollectBean data) { getView().onMineSuccess(data); getView().hideLoading(); } @Override public void onException(BaseModel model) { getView().hideLoading(); } @Override public void onError(Throwable e) { getView().hideLoading(); } }); } @CheckNet private void getMineCollect(int limit) { getView().showLoading(); getModel().mine_Collect(0, limit, getView().getLifecycleSubject(), new MVPModelCallbacks<MyCollectBean>() { @Override public void onSuccess(MyCollectBean data) { getView().onMineSuccess(data); getView().hideLoading(); } @Override public void onException(BaseModel model) { getView().hideLoading(); } @Override public void onError(Throwable e) { getView().hideLoading(); } }); } }
UTF-8
Java
2,603
java
MyCollectPresenter.java
Java
[ { "context": "ands.intl.yingshi.ui.community.presenter\n * 创 建 人: xueh\n * 创建日期: 2019/4/15 14:45\n * 备注:\n */\npublic class ", "end": 596, "score": 0.9993886947631836, "start": 592, "tag": "USERNAME", "value": "xueh" } ]
null
[]
package com.sunlands.intl.yingshi.ui.community.presenter; import com.sunlands.comm_core.base.mvp.MvpBasePresenter; import com.sunlands.comm_core.net.BaseModel; import com.sunlands.comm_core.net.MVPModelCallbacks; import com.sunlands.intl.yingshi.bean.MyCollectBean; import com.sunlands.intl.yingshi.groovy.CheckNet; import com.sunlands.intl.yingshi.ui.community.IMessageContract; import com.sunlands.intl.yingshi.ui.community.model.MyCollectModel; import com.sunlands.intl.yingshi.ui.community.view.MyCollectActivity; /** * 当前包名: com.sunlands.intl.yingshi.ui.community.presenter * 创 建 人: xueh * 创建日期: 2019/4/15 14:45 * 备注: */ public class MyCollectPresenter extends MvpBasePresenter<IMessageContract.IMyCollect, MyCollectModel> { public MyCollectPresenter(IMessageContract.IMyCollect iMyCollect) { super(iMyCollect); } @Override protected MyCollectModel createModel() { return new MyCollectModel(); } public void getMine(int limit, String type,String viewId) { if (type.equals(MyCollectActivity.MY_COLLECT)) { getMineCollect(limit); } else if (type.equals(MyCollectActivity.MY_PUBLISH)) { getMineThread(limit,viewId); } } @CheckNet private void getMineThread(int limit,String viewId ) { getView().showLoading(); getModel().mine_Thread(0, limit,viewId, getView().getLifecycleSubject(), new MVPModelCallbacks<MyCollectBean>() { @Override public void onSuccess(MyCollectBean data) { getView().onMineSuccess(data); getView().hideLoading(); } @Override public void onException(BaseModel model) { getView().hideLoading(); } @Override public void onError(Throwable e) { getView().hideLoading(); } }); } @CheckNet private void getMineCollect(int limit) { getView().showLoading(); getModel().mine_Collect(0, limit, getView().getLifecycleSubject(), new MVPModelCallbacks<MyCollectBean>() { @Override public void onSuccess(MyCollectBean data) { getView().onMineSuccess(data); getView().hideLoading(); } @Override public void onException(BaseModel model) { getView().hideLoading(); } @Override public void onError(Throwable e) { getView().hideLoading(); } }); } }
2,603
0.626408
0.621359
79
31.594936
27.03187
121
false
false
0
0
0
0
0
0
0.468354
false
false
3
db22f614e55121435a6cf2c3e222df4fecc75df2
19,473,381,749,929
427d2ce46622a75e5075783d9fe7be6588dcdf51
/src/verjinxer/util/Sorter.java
48db36be22260e3110fa2964152638bc7cdf0637
[]
no_license
srbehera11/verjinxer
https://github.com/srbehera11/verjinxer
dd36ba9950658fcbe6b9103668dc1bbeb633bfd5
00dedb1af2d1ba762a4969bb3a0823f302b86bb7
refs/heads/master
2021-01-10T03:39:00.785000
2010-05-18T16:13:59
2010-05-18T16:13:59
49,094,639
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Sorter.java * * Created on 20. April 2007, 14:21 * */ package verjinxer.util; /** * * @author Sven Rahmann */ public final class Sorter { public Sorter(Sortable ss) { s = ss; } private final Sortable s; /** given a Sortable, build a heap starting at node i. There a n nodes in total. */ private void heapify(int p, final int n) { for (int r, l= (p<<1)+1; l < n; p= l, l= (p<<1)+1) { // l is the maximum of l and r, the two subnodes of p if ((r= l+1) < n && s.compare(l, r) < 0) l= r; // check if parent p is less than maximum l if (s.compare(p, l) < 0) s.swap(p, l); else break; } } // build a heap out of the Sortable in place private void phase1() { final int n=s.length(); // heapify all the non-leaf nodes for (int p= n/2; p >= 0; p--) heapify(p, n); } // sort the Sortable private void phase2() { for (int n= s.length(); --n > 0; ) { s.swap(0, n); // put the root element in its place heapify(0, n); // and restore the heap again } } // driver for the worked methods public Sortable heapsort() { phase1(); // build initial heap phase2(); // heapsort the sortable given the heap return s; // return the Sortable for convenience } /*************************************************************************/ private int partition(int l, int r) { int m = (l+r)/2; while (l <= r) { while (s.compare(m,r)<0) r--; while (s.compare(l,m)<0) l++; if (l<r) { if(l==m) m=r; else if(r==m) m=l; s.swap(l++, r--); } else return r; } return r; } private void quicksortRec(final int l, final int r) { if (l < r) { final int m = partition(l, r); quicksortRec(m + 1, r); quicksortRec(l, m); } } public Sortable quicksort() { quicksortRec(0,s.length()-1); return s; } /*************************************************************************/ }
UTF-8
Java
2,050
java
Sorter.java
Java
[ { "context": " *\n */\n\npackage verjinxer.util;\n\n/**\n *\n * @author Sven Rahmann\n */\n\npublic final class Sorter {\n \n public Sort", "end": 120, "score": 0.9997240304946899, "start": 108, "tag": "NAME", "value": "Sven Rahmann" } ]
null
[]
/* * Sorter.java * * Created on 20. April 2007, 14:21 * */ package verjinxer.util; /** * * @author <NAME> */ public final class Sorter { public Sorter(Sortable ss) { s = ss; } private final Sortable s; /** given a Sortable, build a heap starting at node i. There a n nodes in total. */ private void heapify(int p, final int n) { for (int r, l= (p<<1)+1; l < n; p= l, l= (p<<1)+1) { // l is the maximum of l and r, the two subnodes of p if ((r= l+1) < n && s.compare(l, r) < 0) l= r; // check if parent p is less than maximum l if (s.compare(p, l) < 0) s.swap(p, l); else break; } } // build a heap out of the Sortable in place private void phase1() { final int n=s.length(); // heapify all the non-leaf nodes for (int p= n/2; p >= 0; p--) heapify(p, n); } // sort the Sortable private void phase2() { for (int n= s.length(); --n > 0; ) { s.swap(0, n); // put the root element in its place heapify(0, n); // and restore the heap again } } // driver for the worked methods public Sortable heapsort() { phase1(); // build initial heap phase2(); // heapsort the sortable given the heap return s; // return the Sortable for convenience } /*************************************************************************/ private int partition(int l, int r) { int m = (l+r)/2; while (l <= r) { while (s.compare(m,r)<0) r--; while (s.compare(l,m)<0) l++; if (l<r) { if(l==m) m=r; else if(r==m) m=l; s.swap(l++, r--); } else return r; } return r; } private void quicksortRec(final int l, final int r) { if (l < r) { final int m = partition(l, r); quicksortRec(m + 1, r); quicksortRec(l, m); } } public Sortable quicksort() { quicksortRec(0,s.length()-1); return s; } /*************************************************************************/ }
2,044
0.486829
0.47122
91
21.527473
20.977926
85
false
false
0
0
0
0
0
0
0.648352
false
false
3
a8e0e291e2034b270fb3b3eedf87f4c0cf9a68fa
11,493,332,487,130
af1e28cb3f34b05811474c17e7863f401c954d1b
/factoryPattern/ModelCode.java
323d60859d49672aae2e1c49e5aad79c869bf3d2
[]
no_license
Lawshiga95/Java-Training
https://github.com/Lawshiga95/Java-Training
b7b94d5703000a4efc707a60971a4f287667bba2
5d147a11df3a174456b3935daf5b8f61b0230186
refs/heads/main
2023-02-17T11:24:42.963000
2021-01-16T05:48:11
2021-01-16T05:48:11
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lawshiga.factoryPattern; public enum ModelCode { HONDA, JAGUAR, MERCEDES, TATA; }
UTF-8
Java
99
java
ModelCode.java
Java
[]
null
[]
package com.lawshiga.factoryPattern; public enum ModelCode { HONDA, JAGUAR, MERCEDES, TATA; }
99
0.747475
0.747475
5
18.799999
15.587174
36
false
false
0
0
0
0
0
0
1
false
false
3
7fbc64d99d7f3e55da7108ac56885ffa5ebaa5da
32,624,571,615,788
f15889af407de46a94fd05f6226c66182c6085d0
/phonestore/src/main/java/com/oreon/phonestore/web/action/commerce/ProductListQueryBase.java
7af4a360dac699721d53af643ac24b26a8ab477a
[]
no_license
oreon/sfcode-full
https://github.com/oreon/sfcode-full
231149f07c5b0b9b77982d26096fc88116759e5b
bea6dba23b7824de871d2b45d2a51036b88d4720
refs/heads/master
2021-01-10T06:03:27.674000
2015-04-27T10:23:10
2015-04-27T10:23:10
55,370,912
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.oreon.phonestore.web.action.commerce; import com.oreon.phonestore.domain.commerce.Product; import org.witchcraft.seam.action.BaseAction; import java.util.Arrays; import java.util.Date; import java.util.List; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; import org.jboss.seam.framework.EntityQuery; import org.witchcraft.base.entity.BaseQuery; import org.witchcraft.base.entity.Range; import org.jboss.seam.annotations.Observer; import java.math.BigDecimal; import org.jboss.seam.annotations.security.Restrict; import com.oreon.phonestore.domain.commerce.Product; /** * * @author WitchcraftMDA Seam Cartridge - * */ public abstract class ProductListQueryBase extends BaseQuery<Product, Long> { private static final String EJBQL = "select product from Product product"; protected Product product = new Product(); public Product getProduct() { return product; } @Override public Product getInstance() { return getProduct(); } @Override protected String getql() { return EJBQL; } @Override @Restrict("#{s:hasPermission('product', 'view')}") public List<Product> getResultList() { return super.getResultList(); } @Override public Class<Product> getEntityClass() { return Product.class; } @Override public String[] getEntityRestrictions() { return RESTRICTIONS; } private Range<BigDecimal> priceRange = new Range<BigDecimal>(); public Range<BigDecimal> getPriceRange() { return priceRange; } public void setPrice(Range<BigDecimal> priceRange) { this.priceRange = priceRange; } private static final String[] RESTRICTIONS = { "product.id = #{productList.product.id}", "product.archived = #{productList.product.archived}", "lower(product.name) like concat(lower(#{productList.product.name}),'%')", "product.price >= #{productList.priceRange.begin}", "product.price <= #{productList.priceRange.end}", "product.dateCreated <= #{productList.dateCreatedRange.end}", "product.dateCreated >= #{productList.dateCreatedRange.begin}",}; @Observer("archivedProduct") public void onArchive() { refresh(); } /** create comma delimited row * @param builder */ //@Override public void createCsvString(StringBuilder builder, Product e) { builder.append("\"" + (e.getName() != null ? e.getName().replace(",", "") : "") + "\","); builder.append("\"" + (e.getPrice() != null ? e.getPrice() : "") + "\","); builder.append("\r\n"); } /** create the headings * @param builder */ //@Override public void createCSvTitles(StringBuilder builder) { builder.append("Name" + ","); builder.append("Price" + ","); builder.append("\r\n"); } }
UTF-8
Java
2,855
java
ProductListQueryBase.java
Java
[ { "context": "e.domain.commerce.Product;\r\n\r\n/**\r\n * \r\n * @author WitchcraftMDA Seam Cartridge - \r\n *\r\n */\r\npublic abstract clas", "end": 711, "score": 0.8450362682342529, "start": 699, "tag": "USERNAME", "value": "WitchcraftMD" }, { "context": "erce.Product;\r\n\r\n/**\r\n * \r\n * @author WitchcraftMDA Seam Cartridge - \r\n *\r\n */\r\npublic abstract class", "end": 712, "score": 0.7952684164047241, "start": 711, "tag": "NAME", "value": "A" }, { "context": "rce.Product;\r\n\r\n/**\r\n * \r\n * @author WitchcraftMDA Seam Cartridge - \r\n *\r\n */\r\npublic abstract class ProductListQue", "end": 727, "score": 0.9185803532600403, "start": 713, "tag": "NAME", "value": "Seam Cartridge" } ]
null
[]
package com.oreon.phonestore.web.action.commerce; import com.oreon.phonestore.domain.commerce.Product; import org.witchcraft.seam.action.BaseAction; import java.util.Arrays; import java.util.Date; import java.util.List; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; import org.jboss.seam.framework.EntityQuery; import org.witchcraft.base.entity.BaseQuery; import org.witchcraft.base.entity.Range; import org.jboss.seam.annotations.Observer; import java.math.BigDecimal; import org.jboss.seam.annotations.security.Restrict; import com.oreon.phonestore.domain.commerce.Product; /** * * @author WitchcraftMDA <NAME> - * */ public abstract class ProductListQueryBase extends BaseQuery<Product, Long> { private static final String EJBQL = "select product from Product product"; protected Product product = new Product(); public Product getProduct() { return product; } @Override public Product getInstance() { return getProduct(); } @Override protected String getql() { return EJBQL; } @Override @Restrict("#{s:hasPermission('product', 'view')}") public List<Product> getResultList() { return super.getResultList(); } @Override public Class<Product> getEntityClass() { return Product.class; } @Override public String[] getEntityRestrictions() { return RESTRICTIONS; } private Range<BigDecimal> priceRange = new Range<BigDecimal>(); public Range<BigDecimal> getPriceRange() { return priceRange; } public void setPrice(Range<BigDecimal> priceRange) { this.priceRange = priceRange; } private static final String[] RESTRICTIONS = { "product.id = #{productList.product.id}", "product.archived = #{productList.product.archived}", "lower(product.name) like concat(lower(#{productList.product.name}),'%')", "product.price >= #{productList.priceRange.begin}", "product.price <= #{productList.priceRange.end}", "product.dateCreated <= #{productList.dateCreatedRange.end}", "product.dateCreated >= #{productList.dateCreatedRange.begin}",}; @Observer("archivedProduct") public void onArchive() { refresh(); } /** create comma delimited row * @param builder */ //@Override public void createCsvString(StringBuilder builder, Product e) { builder.append("\"" + (e.getName() != null ? e.getName().replace(",", "") : "") + "\","); builder.append("\"" + (e.getPrice() != null ? e.getPrice() : "") + "\","); builder.append("\r\n"); } /** create the headings * @param builder */ //@Override public void createCSvTitles(StringBuilder builder) { builder.append("Name" + ","); builder.append("Price" + ","); builder.append("\r\n"); } }
2,847
0.675306
0.675306
122
21.40164
22.270933
77
false
false
0
0
0
0
0
0
1.278689
false
false
3
b8954d591c4471ea0dd89954bbd5214a840a7c9f
14,645,838,496,943
7ab26d4bc788b5d437cb69992ea94b56a4899b6c
/jPSICS/src/org/catacomb/numeric/data/NumVectorSet.java
4b824f21f9373d16f67ec6621d7b29eb5e87db56
[]
no_license
MattNolanLab/PSICS
https://github.com/MattNolanLab/PSICS
d8e777d9a18e332231de244c23431b34c655cfa5
68b4f17e9aef2e6c7ca3c23da2a175eeaeb7251f
refs/heads/master
2021-05-27T02:01:24.747000
2014-05-13T16:19:21
2014-05-13T16:19:21
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.catacomb.numeric.data; import java.util.ArrayList; public interface NumVectorSet extends NumDataItem { public ArrayList<NumVector> getVectors(); public ArrayList<NumVector> getByIndex(int[] ia); }
UTF-8
Java
242
java
NumVectorSet.java
Java
[]
null
[]
package org.catacomb.numeric.data; import java.util.ArrayList; public interface NumVectorSet extends NumDataItem { public ArrayList<NumVector> getVectors(); public ArrayList<NumVector> getByIndex(int[] ia); }
242
0.702479
0.702479
16
14.125
19.338676
52
false
false
0
0
0
0
0
0
0.25
false
false
3
2b38d206420a1d5d6c3e2a1ce9117b68a6641d51
24,215,025,653,534
f71078322b0dea54ec4de6be4bc5490a4a428822
/api/src/main/java/org/openmrs/module/pharmacy/DrugOrder.java
1d3729fad497a5c10cc16aa5822975b98c87b9bd
[]
no_license
KinyuaNgugi/OpenMRS-module-pharmacy
https://github.com/KinyuaNgugi/OpenMRS-module-pharmacy
cc1e8551a8fb359fa18a863bc503d2a6446c9d3a
e67d3af7193e3695f0fef2aa851b7f94e17c11f8
refs/heads/master
2021-01-10T16:43:55.610000
2015-06-05T08:59:19
2015-06-05T08:59:19
36,854,783
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.openmrs.module.pharmacy; import org.openmrs.BaseOpenmrsObject; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import java.io.Serializable; import java.util.Date; import java.util.Set; /** * Created by kinyua on 5/27/15. */ @Entity @Table(name="pharmacy_myDrugOrder") public class DrugOrder extends BaseOpenmrsObject implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name="myDrugOrderId") private Integer id; @Id @Column(name="unitsDelivered") private String unitsDelivered; @Id @Column(name="dateOfDelivery") private Date dateOfDelivery; @Id @Column(name="dateOfExpiry") private Date dateOfExpiry; @Id @Column(name="myDrugId") private Integer myDrugId; public Set<DrugOrder> getMyDrugOrders() { return myDrugOrders; } public void setMyDrugOrders(Set<DrugOrder> myDrugOrders) { this.myDrugOrders = myDrugOrders; } private Set<DrugOrder> myDrugOrders; public Integer getMyDrugId() { return myDrugId; } public void setMyDrugId(Integer myDrugId) { this.myDrugId = myDrugId; } public String getUnitsDelivered() { return unitsDelivered; } public void setUnitsDelivered(String unitsDelivered) { this.unitsDelivered = unitsDelivered; } public Date getDateOfDelivery() { return dateOfDelivery; } public void setDateOfDelivery(Date dateOfDelivery) { this.dateOfDelivery = dateOfDelivery; } public Date getDateOfExpiry() { return dateOfExpiry; } public void setDateOfExpiry(Date dateOfExpiry) { this.dateOfExpiry = dateOfExpiry; } @Override public Integer getId() { return id; } @Override public void setId(Integer id) { this.id= id; } }
UTF-8
Java
1,951
java
DrugOrder.java
Java
[ { "context": "til.Date;\nimport java.util.Set;\n\n/**\n * Created by kinyua on 5/27/15.\n */\n@Entity\n@Table(name=\"pharmacy_myD", "end": 303, "score": 0.999293863773346, "start": 297, "tag": "USERNAME", "value": "kinyua" } ]
null
[]
package org.openmrs.module.pharmacy; import org.openmrs.BaseOpenmrsObject; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import java.io.Serializable; import java.util.Date; import java.util.Set; /** * Created by kinyua on 5/27/15. */ @Entity @Table(name="pharmacy_myDrugOrder") public class DrugOrder extends BaseOpenmrsObject implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name="myDrugOrderId") private Integer id; @Id @Column(name="unitsDelivered") private String unitsDelivered; @Id @Column(name="dateOfDelivery") private Date dateOfDelivery; @Id @Column(name="dateOfExpiry") private Date dateOfExpiry; @Id @Column(name="myDrugId") private Integer myDrugId; public Set<DrugOrder> getMyDrugOrders() { return myDrugOrders; } public void setMyDrugOrders(Set<DrugOrder> myDrugOrders) { this.myDrugOrders = myDrugOrders; } private Set<DrugOrder> myDrugOrders; public Integer getMyDrugId() { return myDrugId; } public void setMyDrugId(Integer myDrugId) { this.myDrugId = myDrugId; } public String getUnitsDelivered() { return unitsDelivered; } public void setUnitsDelivered(String unitsDelivered) { this.unitsDelivered = unitsDelivered; } public Date getDateOfDelivery() { return dateOfDelivery; } public void setDateOfDelivery(Date dateOfDelivery) { this.dateOfDelivery = dateOfDelivery; } public Date getDateOfExpiry() { return dateOfExpiry; } public void setDateOfExpiry(Date dateOfExpiry) { this.dateOfExpiry = dateOfExpiry; } @Override public Integer getId() { return id; } @Override public void setId(Integer id) { this.id= id; } }
1,951
0.675038
0.671963
94
19.75532
18.438332
74
false
false
0
0
0
0
0
0
0.297872
false
false
3
f3016e1155b597b57d7b6346c754516b242d0969
22,539,988,416,273
d53811c822844e6080598baf87452fd40ed49307
/model/src/main/java/com/idss/capital/model/entity/neo/NeoNodeEntity.java
f815a5461df0e77e0cf7027cdee9af5acfc56096
[]
no_license
sun86yu/capital-analyse
https://github.com/sun86yu/capital-analyse
47555887ed2fa4138e1500c4c344354a3b5686e2
546b111ab87bb0d760b5fedd0516d80d55af5f3c
refs/heads/master
2020-05-14T23:37:02.833000
2019-06-26T08:13:42
2019-06-26T08:13:42
181,997,288
0
0
null
false
2020-02-04T23:54:12
2019-04-18T01:51:16
2019-06-26T09:10:06
2020-02-04T23:54:11
802
0
0
1
Java
false
false
package com.idss.capital.model.entity.neo; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.neo4j.ogm.annotation.*; import java.util.List; /** * 往 neo4j 导入数据时使用的用户信息类 * 从数据库取数据,然后导入到 csv 时使用的用户信息类 */ @NodeEntity(label = "User") public class NeoNodeEntity { @Id @GeneratedValue private Long id; /** * 对手帐户列表 */ @Relationship(type = "Transfer", direction = Relationship.OUTGOING) private List<NeoNodeEntity> targetUserList; /** * 转帐记录列表 */ @JsonIgnoreProperties("targetUser") @Relationship(type = "Transfer", direction = Relationship.INCOMING) private List<NeoRelationEntity> transList; /** * 转帐记录统计 */ @JsonIgnoreProperties("targetUser") @Relationship(type = "Statistics", direction = Relationship.INCOMING) private List<NeoStatisticsEntity> statisticsList; /** * 用户名称 */ @Property(name = "name") private String name; /** * 用户卡号 */ @Property(name = "card") private String cardNo; /** * 用户帐号 */ @Property(name = "account") private String account; /** * 用户帐号ID */ @Property(name = "acct_id") private String accountId; /** * 证件号 */ @Property(name = "identy_no") private String identyNo; /** * 用户所属案件编号 */ @Property(name = "ca_id") private String caseId; /** * 用户所属分析的批次 */ @Property(name = "batch_id") private String batchId; /** * 来源. 1 表示是主帐号; 0 表示是对手帐号 */ @Property(name = "is_main") private String isMain; /** * 和主帐号关联的数目 */ @Property(name = "main_cnt") private String mainCnt; /** * 资金总量分箱结果 */ @Property(name = "total_money_level") private String totalMoneyLevel; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public List<NeoNodeEntity> getTargetUserList() { return targetUserList; } public void setTargetUserList(List<NeoNodeEntity> targetUserList) { this.targetUserList = targetUserList; } public List<NeoRelationEntity> getTransList() { return transList; } public void setTransList(List<NeoRelationEntity> transList) { this.transList = transList; } public List<NeoStatisticsEntity> getStatisticsList() { return statisticsList; } public void setStatisticsList(List<NeoStatisticsEntity> statisticsList) { this.statisticsList = statisticsList; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCardNo() { return cardNo; } public void setCardNo(String cardNo) { this.cardNo = cardNo; } public String getAccount() { return account; } public void setAccount(String account) { this.account = account; } public String getAccountId() { return accountId; } public void setAccountId(String accountId) { this.accountId = accountId; } public String getIdentyNo() { return identyNo; } public void setIdentyNo(String identyNo) { this.identyNo = identyNo; } public String getCaseId() { return caseId; } public void setCaseId(String caseId) { this.caseId = caseId; } public String getBatchId() { return batchId; } public void setBatchId(String batchId) { this.batchId = batchId; } public String getIsMain() { return isMain; } public void setIsMain(String isMain) { this.isMain = isMain; } public String getMainCnt() { return mainCnt; } public void setMainCnt(String mainCnt) { this.mainCnt = mainCnt; } public String getTotalMoneyLevel() { return totalMoneyLevel; } public void setTotalMoneyLevel(String totalMoneyLevel) { this.totalMoneyLevel = totalMoneyLevel; } }
UTF-8
Java
4,319
java
NeoNodeEntity.java
Java
[]
null
[]
package com.idss.capital.model.entity.neo; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.neo4j.ogm.annotation.*; import java.util.List; /** * 往 neo4j 导入数据时使用的用户信息类 * 从数据库取数据,然后导入到 csv 时使用的用户信息类 */ @NodeEntity(label = "User") public class NeoNodeEntity { @Id @GeneratedValue private Long id; /** * 对手帐户列表 */ @Relationship(type = "Transfer", direction = Relationship.OUTGOING) private List<NeoNodeEntity> targetUserList; /** * 转帐记录列表 */ @JsonIgnoreProperties("targetUser") @Relationship(type = "Transfer", direction = Relationship.INCOMING) private List<NeoRelationEntity> transList; /** * 转帐记录统计 */ @JsonIgnoreProperties("targetUser") @Relationship(type = "Statistics", direction = Relationship.INCOMING) private List<NeoStatisticsEntity> statisticsList; /** * 用户名称 */ @Property(name = "name") private String name; /** * 用户卡号 */ @Property(name = "card") private String cardNo; /** * 用户帐号 */ @Property(name = "account") private String account; /** * 用户帐号ID */ @Property(name = "acct_id") private String accountId; /** * 证件号 */ @Property(name = "identy_no") private String identyNo; /** * 用户所属案件编号 */ @Property(name = "ca_id") private String caseId; /** * 用户所属分析的批次 */ @Property(name = "batch_id") private String batchId; /** * 来源. 1 表示是主帐号; 0 表示是对手帐号 */ @Property(name = "is_main") private String isMain; /** * 和主帐号关联的数目 */ @Property(name = "main_cnt") private String mainCnt; /** * 资金总量分箱结果 */ @Property(name = "total_money_level") private String totalMoneyLevel; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public List<NeoNodeEntity> getTargetUserList() { return targetUserList; } public void setTargetUserList(List<NeoNodeEntity> targetUserList) { this.targetUserList = targetUserList; } public List<NeoRelationEntity> getTransList() { return transList; } public void setTransList(List<NeoRelationEntity> transList) { this.transList = transList; } public List<NeoStatisticsEntity> getStatisticsList() { return statisticsList; } public void setStatisticsList(List<NeoStatisticsEntity> statisticsList) { this.statisticsList = statisticsList; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCardNo() { return cardNo; } public void setCardNo(String cardNo) { this.cardNo = cardNo; } public String getAccount() { return account; } public void setAccount(String account) { this.account = account; } public String getAccountId() { return accountId; } public void setAccountId(String accountId) { this.accountId = accountId; } public String getIdentyNo() { return identyNo; } public void setIdentyNo(String identyNo) { this.identyNo = identyNo; } public String getCaseId() { return caseId; } public void setCaseId(String caseId) { this.caseId = caseId; } public String getBatchId() { return batchId; } public void setBatchId(String batchId) { this.batchId = batchId; } public String getIsMain() { return isMain; } public void setIsMain(String isMain) { this.isMain = isMain; } public String getMainCnt() { return mainCnt; } public void setMainCnt(String mainCnt) { this.mainCnt = mainCnt; } public String getTotalMoneyLevel() { return totalMoneyLevel; } public void setTotalMoneyLevel(String totalMoneyLevel) { this.totalMoneyLevel = totalMoneyLevel; } }
4,319
0.602158
0.601177
208
18.60577
18.159241
77
false
false
0
0
0
0
0
0
0.245192
false
false
3
40b81110e47fccf8ce66312184fc4351daf316b4
21,036,749,854,756
fe0ca77f6cd2b2d01ef5cdc602b9b5a2bda2b1ee
/whcg2/.svn/pristine/70/70832abe32302c4ba097958bfc28cad28bd3cdd9.svn-base
9c44381bd668927b1a1ae3678c74deaa7b18c0a1
[]
no_license
1239708082/whcg
https://github.com/1239708082/whcg
ddcaf4f7deb0f5b0f5e984b707bae41a8d6845e7
a310cad778bfe8586b0988e4e3b49e1bc4e13589
refs/heads/master
2022-12-23T01:13:11.632000
2019-09-12T03:34:36
2019-09-12T03:34:36
207,947,387
1
0
null
false
2022-12-12T21:41:49
2019-09-12T02:27:52
2019-09-12T07:00:07
2022-12-12T21:41:45
1,381
0
0
9
Java
false
false
package com.ltsk.whcg.base.mapper; import com.ltsk.whcg.entity.GfclRealtime; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface HouseholdGarbageCarMapper { /** * 查询所有生活垃圾车辆总数 * @param xzqh_str * @return */ @Select({"<script>", "SELECT count(*) sum FROM GFCL_REALTIME t", "WHERE updatetime > trunc( sysdate -1/1440) ", "<when test='xzqh_str!=null'>", "AND xzqhname = #{xzqh_str}", "</when>", "</script>"}) Integer count(@Param("xzqh_str")String xzqh_str); /** * 查询在线车辆数量 * @param carstatus * @param xzqh * @return */ @Select({"<script>", "SELECT * FROM GFCL_REALTIME t", "WHERE t.carstatus != 'null' and carstatus != #{carstatus} and updatetime > trunc( sysdate -1/1440)", "<when test='xzqh!=null'>", "AND xzqhname = #{xzqh}", "</when>", "</script>"}) List<GfclRealtime> getAllRealtime(@Param("carstatus") String carstatus,@Param("xzqh") String xzqh); }
UTF-8
Java
1,180
70832abe32302c4ba097958bfc28cad28bd3cdd9.svn-base
Java
[]
null
[]
package com.ltsk.whcg.base.mapper; import com.ltsk.whcg.entity.GfclRealtime; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface HouseholdGarbageCarMapper { /** * 查询所有生活垃圾车辆总数 * @param xzqh_str * @return */ @Select({"<script>", "SELECT count(*) sum FROM GFCL_REALTIME t", "WHERE updatetime > trunc( sysdate -1/1440) ", "<when test='xzqh_str!=null'>", "AND xzqhname = #{xzqh_str}", "</when>", "</script>"}) Integer count(@Param("xzqh_str")String xzqh_str); /** * 查询在线车辆数量 * @param carstatus * @param xzqh * @return */ @Select({"<script>", "SELECT * FROM GFCL_REALTIME t", "WHERE t.carstatus != 'null' and carstatus != #{carstatus} and updatetime > trunc( sysdate -1/1440)", "<when test='xzqh!=null'>", "AND xzqhname = #{xzqh}", "</when>", "</script>"}) List<GfclRealtime> getAllRealtime(@Param("carstatus") String carstatus,@Param("xzqh") String xzqh); }
1,180
0.614035
0.605263
41
26.804878
24.491133
109
false
false
0
0
0
0
0
0
0.951219
false
false
3
7d7aa7d099bcedb422e70665d5ac98c2f043cd98
1,941,325,267,344
4256f9fce4f4160cc2114ef6936a5349253e0395
/seage-problems/discrete/sat/src/main/java/org/seage/problem/sat/grasp/SatObjectiveFunction.java
d074ba34538b4091accb5f4e5b0ab867b832685d
[]
no_license
cs12b033/seage
https://github.com/cs12b033/seage
3b87701ac4a0038cb88b94001dd4f6022a9d8723
66c3e75ed8c4381d063d48367cfcf81ad56084f3
refs/heads/master
2018-10-26T03:54:54.327000
2014-11-16T23:03:49
2014-11-16T23:03:49
26,805,167
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/******************************************************************************* * Copyright (c) 2009 Richard Malek and SEAGE contributors * This file is part of SEAGE. * SEAGE is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * SEAGE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with SEAGE. If not, see <http://www.gnu.org/licenses/>. * */ /** * Contributors: * Martin Zaloga * - Initial implementation */ package org.seage.problem.sat.grasp; import org.seage.data.ObjectCloner; import org.seage.metaheuristic.grasp.IMove; import org.seage.metaheuristic.grasp.IObjectiveFunction; import org.seage.metaheuristic.grasp.Solution; import org.seage.problem.sat.Formula; import org.seage.problem.sat.FormulaEvaluator; /** * * @author Martin Zaloga */ public class SatObjectiveFunction implements IObjectiveFunction { private Formula _formula; public SatObjectiveFunction(Formula formula) { _formula = formula; } public void reset() { } //OK public double evaluateMove(Solution sol, IMove move) throws Exception { if(move == null) return evaluate((SatSolution)sol); else { SatSolution s = (SatSolution)ObjectCloner.deepCopy(sol); move.apply(s); return evaluate(s); } } private int evaluate(SatSolution sol) { return FormulaEvaluator.evaluate(_formula, sol.getLiteralValues()); } }
UTF-8
Java
1,903
java
SatObjectiveFunction.java
Java
[ { "context": "****************************\n * Copyright (c) 2009 Richard Malek and SEAGE contributors\n\n * This file is part of S", "end": 116, "score": 0.9997766017913818, "start": 103, "tag": "NAME", "value": "Richard Malek" }, { "context": "rg/licenses/>.\n *\n */\n\n/**\n * Contributors:\n * Martin Zaloga\n * - Initial implementation\n */\npackage org.s", "end": 842, "score": 0.999822735786438, "start": 829, "tag": "NAME", "value": "Martin Zaloga" }, { "context": "e.problem.sat.FormulaEvaluator;\n\n/**\n *\n * @author Martin Zaloga\n */\npublic class SatObjectiveFunction implements ", "end": 1218, "score": 0.9996876120567322, "start": 1205, "tag": "NAME", "value": "Martin Zaloga" } ]
null
[]
/******************************************************************************* * Copyright (c) 2009 <NAME> and SEAGE contributors * This file is part of SEAGE. * SEAGE is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * SEAGE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with SEAGE. If not, see <http://www.gnu.org/licenses/>. * */ /** * Contributors: * <NAME> * - Initial implementation */ package org.seage.problem.sat.grasp; import org.seage.data.ObjectCloner; import org.seage.metaheuristic.grasp.IMove; import org.seage.metaheuristic.grasp.IObjectiveFunction; import org.seage.metaheuristic.grasp.Solution; import org.seage.problem.sat.Formula; import org.seage.problem.sat.FormulaEvaluator; /** * * @author <NAME> */ public class SatObjectiveFunction implements IObjectiveFunction { private Formula _formula; public SatObjectiveFunction(Formula formula) { _formula = formula; } public void reset() { } //OK public double evaluateMove(Solution sol, IMove move) throws Exception { if(move == null) return evaluate((SatSolution)sol); else { SatSolution s = (SatSolution)ObjectCloner.deepCopy(sol); move.apply(s); return evaluate(s); } } private int evaluate(SatSolution sol) { return FormulaEvaluator.evaluate(_formula, sol.getLiteralValues()); } }
1,882
0.665791
0.663163
69
26.57971
25.885706
80
false
false
0
0
0
0
0
0
0.304348
false
false
3
72f4a03d12542cb39bc213be4f8bd28be02d2dd6
1,941,325,267,153
4878f6bd5ab0020992ba8c8b3ac076a5643f82d7
/src/test/java/com/scala/qa/contentmanager/PageObjects/System/UserProfile.java
bff297243f135ae335eae67ee2784048a7cc9e08
[]
no_license
kpatel-scala/CM_Automation
https://github.com/kpatel-scala/CM_Automation
5fd1b9f8e3392ae8b91505605757557c54ef4b8d
c0da2ed5344611684ffe27de4ab54ee7f8ade817
refs/heads/master
2021-01-12T02:30:53.412000
2017-01-04T21:14:57
2017-01-04T21:14:57
78,053,907
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.scala.qa.contentmanager.PageObjects.System; import com.scala.qa.contentmanager.Base.PageBase; import com.scala.qa.contentmanager.PageObjects.RightNavMenu; //import org.apache.tools.ant.filters.LineContains; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; /** * Created by kpatel on 11/28/2016. */ public class UserProfile extends PageBase { private RightNavMenu rightNav; @FindBy(xpath = "//nav/ul[@class=\"right\"]//li[@class=\"right\"]/descendant::a[@href=\"#user\"]") private WebElement eleUserProfile; @FindBy(xpath = "//div[@class=\"main\"]//div[@class=\"actionPanel\"]/button[@class=\"newItem\"]") private WebElement eleBtnNew; @FindBy(xpath = "//li[@class=\"username\"]//input[@data-property=\"username\"]") private WebElement eleInputUserName; @FindBy(xpath = "//section[@class=\"content\"]//div[@class=\"formContainer\"]//li[@class=\"password\"]//input[@data-property=\"password\"]") private WebElement eleInputPassword; @FindBy(xpath = "//section[@class=\"content\"]//div[@class=\"formContainer\"]//li[@class=\"confirmPassword\"]//input[@data-property=\"confirmPassword\"]") private WebElement eleInputConfirmPwd; @FindBy(xpath = "//li[@class=\"firstname\"]//input[@data-property=\"firstname\"]") private WebElement eleInputFName; @FindBy(xpath = "//li[@class=\"lastname\"]//input[@data-property=\"lastname\"]") private WebElement eleInputLName; @FindBy(xpath = "//li[@class=\"emailaddress\"]//input[@data-property=\"emailaddress\"]") private WebElement eleInputEmail; @FindBy(xpath = "//div[@class=\"inlineEdit multiSelect\"]//ul[@class=\"options\"]/li[@data-value=\"22\"]/input[@type=\"checkbox\"]") private WebElement eleChkBoxAdmin; @FindBy(xpath = "//div[@class=\"inlineEdit multiSelect\"]//ul[@class=\"options\"]/li[@data-value=\"28\"]/input[@type=\"checkbox\"]") private WebElement eleChkBoxGraphicD; @FindBy(xpath = "//div[@class=\"inlineEdit multiSelect\"]//ul[@class=\"options\"]/li[@data-value=\"27\"]/input[@type=\"checkbox\"]") private WebElement eleChkBoxMsgEditor; @FindBy(xpath = "//div[@class=\"inlineEdit multiSelect\"]//ul[@class=\"options\"]/li[@data-value=\"26\"]/input[@type=\"checkbox\"]") private WebElement eleChkBoxMsgManager; @FindBy(xpath = "//div[@class=\"inlineEdit multiSelect\"]//ul[@class=\"options\"]/li[@data-value=\"29\"]/input[@type=\"checkbox\"]") private WebElement eleChkBoxNTManager; @FindBy(xpath = "//div[@class=\"inlineEdit multiSelect\"]//ul[@class=\"options\"]/li[@data-value=\"25\"]/input[@type=\"checkbox\"]") private WebElement eleChkBoxScheduleManager; @FindBy(xpath = "//div[@class=\"inlineEdit multiSelect\"]//ul[@class=\"options\"]/li[@data-value=\"24\"]/input[@type=\"checkbox\"]") private WebElement eleChkBoxViewer; @FindBy(xpath = "//footer/div[@class=\"actions\"]/button[@class=\"button-primary save\"]") private WebElement eleBtnSave; @FindBy(xpath = "//div[@class=\"detail box user\"]//dt[@data-tabgroup=\"personalInformation\"]") private WebElement elePersonalInfoTab; @FindBy(xpath = "//div[@class=\"detail box user\"]//dt[@data-tabgroup=\"workgroup\"]") private WebElement eleWorkgroupTab; @FindBy(xpath = "//div[@class=\"detail box user\"]//dt[@data-tabgroup=\"regionalSettings\"]") private WebElement eleRegionalSettingTab; @FindBy(xpath = "//div[@class=\"detail box user\"]//dt[@data-tabgroup=\"miscellaneousSettings\"]") private WebElement eleMiscTab; @FindBy(xpath = "//div[@class=\"main\"]/descendant::button[@class=\"button-primary saveAndClose\"]") private WebElement eleBtnSaveNClose; public UserProfile(WebDriver driver){ super(); } public void clickUserProfileMenu() throws Exception { rightNav = new RightNavMenu(driver); rightNav.clickSystemMenu(); clickElement(eleUserProfile, "UserProfile Landing page"); } public boolean createNewUser(String userName, String pwd, String lastName, String eMail, String role) throws Exception { try { clickUserProfileMenu(); clickElement(eleBtnNew, "New User button"); enterText(eleInputUserName, userName, "Enter new users info - UserName"); enterText(eleInputPassword, pwd, "Enter new users info - Password"); enterText(eleInputConfirmPwd, pwd, "Enter new users info - ConfirmPassword"); enterText(eleInputFName, userName, "Enter new users info - FirstName"); enterText(eleInputLName, lastName, "Enter new users info - LastName"); enterText(eleInputEmail, eMail, "Enter new users info - Email"); pickItem("//div[@class=\"inlineEdit multiSelect\"]//ul[@class=\"options\"]/li", role); clickElement(eleBtnSave, "Save New User window"); return true; }catch (Exception e){return false;} } public void selectWG(String userName, String wgName) throws Exception { // clickElement(driver.findElement(By.linkText(userName)),"Open User Profile"); String pathtoWG = "//dd[@class=\"workgroup\"]//ul[@class=\"basic hierarchical\"]/descendant::span[text()=\"" + wgName +"\"]"; clickElement(eleWorkgroupTab, "Open workgroup tab"); clickElement(driver.findElement(By.xpath(pathtoWG)), "Select workgroup"); clickElement(eleBtnSaveNClose, "Save User Profile"); } public boolean openUser(String userProfile) throws Exception { clickUserProfileMenu(); try { clickElement(driver.findElement(By.linkText(userProfile)), "Open a user profile"); return true; }catch (Exception e){ return false; } } public boolean clickUserProfileTabs() throws Exception { try { clickElement(elePersonalInfoTab, "Click on personal info tab"); clickElement(eleWorkgroupTab, "Click on workgroup tab"); clickElement(eleRegionalSettingTab, "Click on Regional settings taB"); clickElement(eleMiscTab, "Click on Miscellaneous tab"); return true; }catch (Exception e){ return false;} } public boolean isNotDisplayed(String name) throws Exception { rightNav = new RightNavMenu(driver); switch(name.toLowerCase()) { case "user profile": rightNav.clickSystemMenu(); return isNotDisplayed(eleUserProfile); case "new": clickUserProfileMenu(); return isNotDisplayed(eleBtnNew); } return false; } public boolean isDisplayed(String name) throws Exception { rightNav = new RightNavMenu(driver); switch(name.toLowerCase()){ case "user profile": rightNav.clickSystemMenu(); return isDisplayed(eleUserProfile); case "new": clickUserProfileMenu(); return isDisplayed(eleBtnNew); } return false; } }
UTF-8
Java
7,105
java
UserProfile.java
Java
[ { "context": "a.selenium.support.PageFactory;\n\n/**\n * Created by kpatel on 11/28/2016.\n */\npublic class UserProfile exten", "end": 444, "score": 0.9996304512023926, "start": 438, "tag": "USERNAME", "value": "kpatel" }, { "context": ");\n }\n\n\n public boolean createNewUser(String userName, String pwd, String lastName, String eMail, Strin", "end": 4059, "score": 0.9041581749916077, "start": 4051, "tag": "USERNAME", "value": "userName" }, { "context": " button\");\n enterText(eleInputUserName, userName, \"Enter new users info - UserName\");\n ", "end": 4290, "score": 0.9230115413665771, "start": 4282, "tag": "USERNAME", "value": "userName" } ]
null
[]
package com.scala.qa.contentmanager.PageObjects.System; import com.scala.qa.contentmanager.Base.PageBase; import com.scala.qa.contentmanager.PageObjects.RightNavMenu; //import org.apache.tools.ant.filters.LineContains; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; /** * Created by kpatel on 11/28/2016. */ public class UserProfile extends PageBase { private RightNavMenu rightNav; @FindBy(xpath = "//nav/ul[@class=\"right\"]//li[@class=\"right\"]/descendant::a[@href=\"#user\"]") private WebElement eleUserProfile; @FindBy(xpath = "//div[@class=\"main\"]//div[@class=\"actionPanel\"]/button[@class=\"newItem\"]") private WebElement eleBtnNew; @FindBy(xpath = "//li[@class=\"username\"]//input[@data-property=\"username\"]") private WebElement eleInputUserName; @FindBy(xpath = "//section[@class=\"content\"]//div[@class=\"formContainer\"]//li[@class=\"password\"]//input[@data-property=\"password\"]") private WebElement eleInputPassword; @FindBy(xpath = "//section[@class=\"content\"]//div[@class=\"formContainer\"]//li[@class=\"confirmPassword\"]//input[@data-property=\"confirmPassword\"]") private WebElement eleInputConfirmPwd; @FindBy(xpath = "//li[@class=\"firstname\"]//input[@data-property=\"firstname\"]") private WebElement eleInputFName; @FindBy(xpath = "//li[@class=\"lastname\"]//input[@data-property=\"lastname\"]") private WebElement eleInputLName; @FindBy(xpath = "//li[@class=\"emailaddress\"]//input[@data-property=\"emailaddress\"]") private WebElement eleInputEmail; @FindBy(xpath = "//div[@class=\"inlineEdit multiSelect\"]//ul[@class=\"options\"]/li[@data-value=\"22\"]/input[@type=\"checkbox\"]") private WebElement eleChkBoxAdmin; @FindBy(xpath = "//div[@class=\"inlineEdit multiSelect\"]//ul[@class=\"options\"]/li[@data-value=\"28\"]/input[@type=\"checkbox\"]") private WebElement eleChkBoxGraphicD; @FindBy(xpath = "//div[@class=\"inlineEdit multiSelect\"]//ul[@class=\"options\"]/li[@data-value=\"27\"]/input[@type=\"checkbox\"]") private WebElement eleChkBoxMsgEditor; @FindBy(xpath = "//div[@class=\"inlineEdit multiSelect\"]//ul[@class=\"options\"]/li[@data-value=\"26\"]/input[@type=\"checkbox\"]") private WebElement eleChkBoxMsgManager; @FindBy(xpath = "//div[@class=\"inlineEdit multiSelect\"]//ul[@class=\"options\"]/li[@data-value=\"29\"]/input[@type=\"checkbox\"]") private WebElement eleChkBoxNTManager; @FindBy(xpath = "//div[@class=\"inlineEdit multiSelect\"]//ul[@class=\"options\"]/li[@data-value=\"25\"]/input[@type=\"checkbox\"]") private WebElement eleChkBoxScheduleManager; @FindBy(xpath = "//div[@class=\"inlineEdit multiSelect\"]//ul[@class=\"options\"]/li[@data-value=\"24\"]/input[@type=\"checkbox\"]") private WebElement eleChkBoxViewer; @FindBy(xpath = "//footer/div[@class=\"actions\"]/button[@class=\"button-primary save\"]") private WebElement eleBtnSave; @FindBy(xpath = "//div[@class=\"detail box user\"]//dt[@data-tabgroup=\"personalInformation\"]") private WebElement elePersonalInfoTab; @FindBy(xpath = "//div[@class=\"detail box user\"]//dt[@data-tabgroup=\"workgroup\"]") private WebElement eleWorkgroupTab; @FindBy(xpath = "//div[@class=\"detail box user\"]//dt[@data-tabgroup=\"regionalSettings\"]") private WebElement eleRegionalSettingTab; @FindBy(xpath = "//div[@class=\"detail box user\"]//dt[@data-tabgroup=\"miscellaneousSettings\"]") private WebElement eleMiscTab; @FindBy(xpath = "//div[@class=\"main\"]/descendant::button[@class=\"button-primary saveAndClose\"]") private WebElement eleBtnSaveNClose; public UserProfile(WebDriver driver){ super(); } public void clickUserProfileMenu() throws Exception { rightNav = new RightNavMenu(driver); rightNav.clickSystemMenu(); clickElement(eleUserProfile, "UserProfile Landing page"); } public boolean createNewUser(String userName, String pwd, String lastName, String eMail, String role) throws Exception { try { clickUserProfileMenu(); clickElement(eleBtnNew, "New User button"); enterText(eleInputUserName, userName, "Enter new users info - UserName"); enterText(eleInputPassword, pwd, "Enter new users info - Password"); enterText(eleInputConfirmPwd, pwd, "Enter new users info - ConfirmPassword"); enterText(eleInputFName, userName, "Enter new users info - FirstName"); enterText(eleInputLName, lastName, "Enter new users info - LastName"); enterText(eleInputEmail, eMail, "Enter new users info - Email"); pickItem("//div[@class=\"inlineEdit multiSelect\"]//ul[@class=\"options\"]/li", role); clickElement(eleBtnSave, "Save New User window"); return true; }catch (Exception e){return false;} } public void selectWG(String userName, String wgName) throws Exception { // clickElement(driver.findElement(By.linkText(userName)),"Open User Profile"); String pathtoWG = "//dd[@class=\"workgroup\"]//ul[@class=\"basic hierarchical\"]/descendant::span[text()=\"" + wgName +"\"]"; clickElement(eleWorkgroupTab, "Open workgroup tab"); clickElement(driver.findElement(By.xpath(pathtoWG)), "Select workgroup"); clickElement(eleBtnSaveNClose, "Save User Profile"); } public boolean openUser(String userProfile) throws Exception { clickUserProfileMenu(); try { clickElement(driver.findElement(By.linkText(userProfile)), "Open a user profile"); return true; }catch (Exception e){ return false; } } public boolean clickUserProfileTabs() throws Exception { try { clickElement(elePersonalInfoTab, "Click on personal info tab"); clickElement(eleWorkgroupTab, "Click on workgroup tab"); clickElement(eleRegionalSettingTab, "Click on Regional settings taB"); clickElement(eleMiscTab, "Click on Miscellaneous tab"); return true; }catch (Exception e){ return false;} } public boolean isNotDisplayed(String name) throws Exception { rightNav = new RightNavMenu(driver); switch(name.toLowerCase()) { case "user profile": rightNav.clickSystemMenu(); return isNotDisplayed(eleUserProfile); case "new": clickUserProfileMenu(); return isNotDisplayed(eleBtnNew); } return false; } public boolean isDisplayed(String name) throws Exception { rightNav = new RightNavMenu(driver); switch(name.toLowerCase()){ case "user profile": rightNav.clickSystemMenu(); return isDisplayed(eleUserProfile); case "new": clickUserProfileMenu(); return isDisplayed(eleBtnNew); } return false; } }
7,105
0.66221
0.659113
134
52.022388
52.001217
197
false
false
0
0
0
0
0
0
0.776119
false
false
3
5a93e139c87db826cd7908d82aeb67f62095e612
309,237,694,417
3af589d94451a010c11aba82d55d385b9b493142
/src/java/forgot_password.java
9d61e6977bdad983edbdeca9fc6ecad11a026dd2
[ "MIT" ]
permissive
Sayan216016/Banking-Software
https://github.com/Sayan216016/Banking-Software
ba5688193ce4ed26ab38540402f1425a3a7ea82f
5d79232fd3691f9583bfa748368b13072ddc2dd4
refs/heads/master
2020-05-18T02:46:56.236000
2019-04-29T19:05:51
2019-04-29T19:05:51
184,126,787
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.Date; import java.util.Properties; import javax.mail.Message; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author rohan */ public class forgot_password extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { Class.forName("oracle.jdbc.driver.OracleDriver"); String url = "jdbc:oracle:thin:@localhost:1521:XE"; Connection con = DriverManager.getConnection(url, "ob_banking", "1234"); String email = request.getParameter("email"); String sql = "select password from customer where email=?"; PreparedStatement ps = con.prepareStatement(sql); ps.setString(1, email); ResultSet rs = ps.executeQuery(); if (rs.next()) { String m_pass = rs.getString("password"); String host = "smtp.gmail.com"; String to = email;//request.getParameter("to"); String from = "bharosabanking@gmail.com"; String subject = "Password Recovery"; String messageText = "Hi your password is : " + m_pass; boolean sessionDebug = false; // Create some properties and get the default Session. Properties props = System.getProperties(); props.put("mail.host", host); props.put("mail.transport.protocol", "smtp"); props.setProperty("mail.transport.protocol", "smtp"); props.setProperty("mail.host", "smtp.gmail.com"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); props.put("mail.debug", "true"); props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.socketFactory.fallback", "false"); Session mailSession = Session.getInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication( "bharosabanking@gmail.com", "obbbharosa");// Specify the Username and the PassWord } }); // Set debug on the Session // Passing false will not echo debug info, and passing True will. mailSession.setDebug(sessionDebug); // Instantiate a new MimeMessage and fill it with the // required information. Message msg = new MimeMessage(mailSession); msg.setFrom(new InternetAddress(from)); InternetAddress[] address = {new InternetAddress(to)}; msg.setRecipients(Message.RecipientType.TO, address); msg.setSubject(subject); msg.setSentDate(new Date()); msg.setText(messageText); // Hand the message to the default transport service // for delivery. Transport.send(msg); out.println("<script type=\"text/javascript\">"); out.println("alert('We have sent your password to your email');"); out.println("location='jsp_signin.jsp';"); out.println("</script>"); } else { out.println("<script type=\"text/javascript\">"); out.println("alert('Your email is not in our records!!!!');"); out.println("location='jsp_signup.jsp';"); out.println("</script>"); } } catch (Exception e) { } /* TODO output your page here. You may use following sample code. */ } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
UTF-8
Java
6,252
java
forgot_password.java
Java
[ { "context": "rvlet.http.HttpServletResponse;\n\n/**\n *\n * @author rohan\n */\npublic class forgot_password extends HttpServ", "end": 819, "score": 0.999091625213623, "start": 814, "tag": "USERNAME", "value": "rohan" }, { "context": "ameter(\"to\"); \n\n String from = \"bharosabanking@gmail.com\";\n\n String subject = \"Password Rec", "end": 2198, "score": 0.9999266862869263, "start": 2174, "tag": "EMAIL", "value": "bharosabanking@gmail.com" }, { "context": "dAuthentication(\n \"bharosabanking@gmail.com\", \"obbbharosa\");// Specify the Username and the P", "end": 3441, "score": 0.9998974800109863, "start": 3417, "tag": "EMAIL", "value": "bharosabanking@gmail.com" }, { "context": " \"bharosabanking@gmail.com\", \"obbbharosa\");// Specify the Username and the PassWord\n ", "end": 3455, "score": 0.9189034700393677, "start": 3445, "tag": "PASSWORD", "value": "obbbharosa" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.Date; import java.util.Properties; import javax.mail.Message; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author rohan */ public class forgot_password extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { Class.forName("oracle.jdbc.driver.OracleDriver"); String url = "jdbc:oracle:thin:@localhost:1521:XE"; Connection con = DriverManager.getConnection(url, "ob_banking", "1234"); String email = request.getParameter("email"); String sql = "select password from customer where email=?"; PreparedStatement ps = con.prepareStatement(sql); ps.setString(1, email); ResultSet rs = ps.executeQuery(); if (rs.next()) { String m_pass = rs.getString("password"); String host = "smtp.gmail.com"; String to = email;//request.getParameter("to"); String from = "<EMAIL>"; String subject = "Password Recovery"; String messageText = "Hi your password is : " + m_pass; boolean sessionDebug = false; // Create some properties and get the default Session. Properties props = System.getProperties(); props.put("mail.host", host); props.put("mail.transport.protocol", "smtp"); props.setProperty("mail.transport.protocol", "smtp"); props.setProperty("mail.host", "smtp.gmail.com"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); props.put("mail.debug", "true"); props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.socketFactory.fallback", "false"); Session mailSession = Session.getInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication( "<EMAIL>", "<PASSWORD>");// Specify the Username and the PassWord } }); // Set debug on the Session // Passing false will not echo debug info, and passing True will. mailSession.setDebug(sessionDebug); // Instantiate a new MimeMessage and fill it with the // required information. Message msg = new MimeMessage(mailSession); msg.setFrom(new InternetAddress(from)); InternetAddress[] address = {new InternetAddress(to)}; msg.setRecipients(Message.RecipientType.TO, address); msg.setSubject(subject); msg.setSentDate(new Date()); msg.setText(messageText); // Hand the message to the default transport service // for delivery. Transport.send(msg); out.println("<script type=\"text/javascript\">"); out.println("alert('We have sent your password to your email');"); out.println("location='jsp_signin.jsp';"); out.println("</script>"); } else { out.println("<script type=\"text/javascript\">"); out.println("alert('Your email is not in our records!!!!');"); out.println("location='jsp_signup.jsp';"); out.println("</script>"); } } catch (Exception e) { } /* TODO output your page here. You may use following sample code. */ } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
6,218
0.616603
0.614044
161
37.832298
27.010519
123
false
false
0
0
0
0
0
0
0.63354
false
false
3
4f143733c7111e86271b3611373ca05a6e00816a
14,345,190,821,651
83d0d6c160e3719e0710559b631206d11f0783bc
/sukkiri01/src/model/HealthCheckLogic.java
47ba7703c92b267f69b75ab860856ab439d62df7
[]
no_license
taro1210/eternity
https://github.com/taro1210/eternity
6f0567b28ccbab83798038f5dd800e812342d69d
61c67550f135b8fcb4328cf4fe691fd5c2ff8f34
refs/heads/master
2020-03-26T10:33:41.125000
2018-10-31T08:12:38
2018-10-31T08:12:38
144,804,531
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package model; import java.math.BigDecimal; import java.math.RoundingMode; public class HealthCheckLogic { public void exe(Health health) { double height = health.getHeight(); double weight = health.getWeight(); BigDecimal bd = new BigDecimal(weight / (height / 100.0 * height / 100.0)); bd = bd.setScale(1, RoundingMode.HALF_UP); double bmi = bd.doubleValue(); health.setBmi(bmi); String bodyType; if (bmi < 18.5) { bodyType = "痩せ型"; } else if (bmi < 25) { bodyType = "標準"; } else { bodyType = "肥満"; } health.setBodyType(bodyType); String messege = ""; int msg = (int) (Math.random() * 3); if (bmi < 18.5) { switch (msg) { case 0: messege = "少し痩せすぎです、ご飯を食べましょう"; break; case 1: messege = "貧血は大丈夫でしょうか?激しい運動の後は栄養を補給しましょう"; break; case 2: messege = "ストレスなどを抱えてはいませんか?周りに相談してみては?"; break; } } else if (bmi < 25) { switch (msg) { case 0: messege = "適正体重です。このまま維持していきましょう"; break; case 1: messege = "適度に運動などを取り入れこの体型を維持しましょう"; break; case 2: messege = "改善の必要はなさそうです。これからもこの調子でいきましょう"; break; } } else { switch (msg) { case 0: messege = "少し肥満気味です。食事などを改善しましょう"; break; case 1: messege = "運動などはされていますか?もう少し体を動かすようにしましょう"; break; case 2: messege = "お腹回りなど変化は見られませんか?毎日の積み重ねで改善していきましょう"; break; } } health.setMessege(messege); } }
UTF-8
Java
1,951
java
HealthCheckLogic.java
Java
[]
null
[]
package model; import java.math.BigDecimal; import java.math.RoundingMode; public class HealthCheckLogic { public void exe(Health health) { double height = health.getHeight(); double weight = health.getWeight(); BigDecimal bd = new BigDecimal(weight / (height / 100.0 * height / 100.0)); bd = bd.setScale(1, RoundingMode.HALF_UP); double bmi = bd.doubleValue(); health.setBmi(bmi); String bodyType; if (bmi < 18.5) { bodyType = "痩せ型"; } else if (bmi < 25) { bodyType = "標準"; } else { bodyType = "肥満"; } health.setBodyType(bodyType); String messege = ""; int msg = (int) (Math.random() * 3); if (bmi < 18.5) { switch (msg) { case 0: messege = "少し痩せすぎです、ご飯を食べましょう"; break; case 1: messege = "貧血は大丈夫でしょうか?激しい運動の後は栄養を補給しましょう"; break; case 2: messege = "ストレスなどを抱えてはいませんか?周りに相談してみては?"; break; } } else if (bmi < 25) { switch (msg) { case 0: messege = "適正体重です。このまま維持していきましょう"; break; case 1: messege = "適度に運動などを取り入れこの体型を維持しましょう"; break; case 2: messege = "改善の必要はなさそうです。これからもこの調子でいきましょう"; break; } } else { switch (msg) { case 0: messege = "少し肥満気味です。食事などを改善しましょう"; break; case 1: messege = "運動などはされていますか?もう少し体を動かすようにしましょう"; break; case 2: messege = "お腹回りなど変化は見られませんか?毎日の積み重ねで改善していきましょう"; break; } } health.setMessege(messege); } }
1,951
0.591126
0.571331
66
20.227272
15.909589
77
false
false
0
0
0
0
0
0
3.030303
false
false
3
b42f9eab80b00566d998035bf360dd46ff3298d2
16,578,573,822,549
ccd246b15257f2f86e489b3bf38ff0ffdd5f3fd7
/Spring-09-ORM-DerivedQueries/src/main/java/com/practice/repository/EmployeeRepository.java
902a9b700241bcfb33d9ee6fca644d23acf6a814
[]
no_license
mehmeticme/Spring-Framework-Learning
https://github.com/mehmeticme/Spring-Framework-Learning
44399654c2413af70a5d0ebc197f95414d0ca36f
5d92f78898e5f8b681338589eb37451f81a22b30
refs/heads/main
2023-02-25T17:33:30.670000
2021-01-30T16:31:00
2021-01-30T16:31:00
304,898,608
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.practice.repository; import com.practice.entity.Employees; import org.springframework.data.jpa.repository.JpaRepository; import java.time.LocalDate; import java.util.List; public interface EmployeeRepository extends JpaRepository<Employees,Long> { // Diplay all employees with email address '' List<Employees> findByEmail(String email); // Display All employees with first Name '' and last name '', also show all employees with a email address '' List<Employees> findByFirstNameAndLastNameOrEmail(String firstName, String lastName, String email); // Display all employees that first name is not '' List<Employees> findByFirstNameIsNot(String firstName); // Display all employees where last name starts with '' List<Employees> findByLastNameStartsWith(String pattern); // Display all employees with salaries higher than '' List<Employees> findBySalaryGreaterThan(Integer salary); // Display all employees with salaries less than equal '' List<Employees> findBySalaryLessThanEqual(Integer salary); // Display all employees that has been hired between '' and '' List<Employees> findByHireDateBetween(LocalDate startDate, LocalDate endDate); // Display all employees where salaries greater and equal to '' in order List<Employees> findBySalaryGreaterThanEqualAndOrderBySalaryDesc(Integer salary); // Display top unique 3 employees that is making less than '' List<Employees> findDistinctTop3BySalaryLessThan(Integer salary); // Display all employees that do not have email address List<Employees> findByEmailIsNull(); }
UTF-8
Java
1,625
java
EmployeeRepository.java
Java
[]
null
[]
package com.practice.repository; import com.practice.entity.Employees; import org.springframework.data.jpa.repository.JpaRepository; import java.time.LocalDate; import java.util.List; public interface EmployeeRepository extends JpaRepository<Employees,Long> { // Diplay all employees with email address '' List<Employees> findByEmail(String email); // Display All employees with first Name '' and last name '', also show all employees with a email address '' List<Employees> findByFirstNameAndLastNameOrEmail(String firstName, String lastName, String email); // Display all employees that first name is not '' List<Employees> findByFirstNameIsNot(String firstName); // Display all employees where last name starts with '' List<Employees> findByLastNameStartsWith(String pattern); // Display all employees with salaries higher than '' List<Employees> findBySalaryGreaterThan(Integer salary); // Display all employees with salaries less than equal '' List<Employees> findBySalaryLessThanEqual(Integer salary); // Display all employees that has been hired between '' and '' List<Employees> findByHireDateBetween(LocalDate startDate, LocalDate endDate); // Display all employees where salaries greater and equal to '' in order List<Employees> findBySalaryGreaterThanEqualAndOrderBySalaryDesc(Integer salary); // Display top unique 3 employees that is making less than '' List<Employees> findDistinctTop3BySalaryLessThan(Integer salary); // Display all employees that do not have email address List<Employees> findByEmailIsNull(); }
1,625
0.762462
0.761231
44
35.93182
33.777615
113
false
false
0
0
0
0
0
0
0.454545
false
false
3
be1cb308c4f5c02947ab2098232873f29afe3a26
20,495,583,987,116
d74d98a9fb832025841222c41e27664a5d3ed57c
/app/src/main/java/com/improve/home/MainPopularController.java
fc9c9cd3a629d0043119b70752e6f726c7f54ba4
[]
no_license
gotoperfect/AndoAndroid
https://github.com/gotoperfect/AndoAndroid
26ade6d4395c2485f56ad0e7821c50336ac4cf7d
eccb46e70fd2e61a66c79c206eb2246cf38fc447
refs/heads/master
2022-11-29T17:23:13.742000
2020-08-07T03:18:13
2020-08-07T03:18:13
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.improve.home; import android.content.Context; import com.improve.R; import com.improve.common.DataManager; /** * Created by javakam on 2018/7/17. */ public class MainPopularController extends MainController { public MainPopularController(Context context) { super(context); } @Override protected String getTitle() { return getContext().getString(R.string.nav_pop); } @Override protected MainItemAdapter getItemAdapter() { return new MainItemAdapter(getContext(), DataManager.getPopularDescriptions()); } }
UTF-8
Java
580
java
MainPopularController.java
Java
[ { "context": "com.improve.common.DataManager;\n\n/**\n * Created by javakam on 2018/7/17.\n */\npublic class MainPopularControl", "end": 147, "score": 0.9996894001960754, "start": 140, "tag": "USERNAME", "value": "javakam" } ]
null
[]
package com.improve.home; import android.content.Context; import com.improve.R; import com.improve.common.DataManager; /** * Created by javakam on 2018/7/17. */ public class MainPopularController extends MainController { public MainPopularController(Context context) { super(context); } @Override protected String getTitle() { return getContext().getString(R.string.nav_pop); } @Override protected MainItemAdapter getItemAdapter() { return new MainItemAdapter(getContext(), DataManager.getPopularDescriptions()); } }
580
0.708621
0.696552
25
22.200001
23.251667
87
false
false
0
0
0
0
0
0
0.32
false
false
3
a8e45c52611c048c4324afb1a3ca0ec4b2bb3222
39,487,929,324,825
4c1f00cd8eaafa70ba44815c91dd3b73b378f95e
/src/main/java/model/Comment.java
15403177e309886b81334751983e6eac5e4f68c5
[]
no_license
zxc19990331/SpringWebAlbum
https://github.com/zxc19990331/SpringWebAlbum
8779457a8aa08b0680dc13da51ff30787c4f32f9
9dd3ea60250ebbda984d360f29eee1740d3a6c67
refs/heads/master
2022-12-26T01:28:14.210000
2020-02-21T12:44:29
2020-02-21T12:44:29
227,489,733
9
0
null
false
2022-12-16T07:52:22
2019-12-12T00:54:03
2022-01-20T14:43:22
2022-12-16T07:52:19
2,515
5
0
5
Java
false
false
package model; import java.util.Map; import constant.Constant; public class Comment { private String id = ""; private String context = ""; private String createTime = ""; private String userId = ""; private String fromId = ""; public Comment(){ } public Comment(Map<String, Object> map){ setId((String) map.get(Constant.COM_ID)); setContext((String) map.get(Constant.COM_CONTEXT)); setCreateTime((String) map.get(Constant.CREATE_TIME)); setUserId((String) map.get(Constant.COM_USERID)); setFromId((String) map.get(Constant.COM_FROMID)); } public void setId(String id){ this.id = id; } public String getId(){ return id; } public void setContext(String context){ this.context = context; } public String getContext(){ return context; } public void setCreateTime(String createTime){ this.createTime = createTime; } public String getCreateTime(){ return createTime; } public void setUserId(String userId){ this.userId = userId; } public String getUserId(){ return userId; } public void setFromId(String fromId){ this.fromId = fromId; } public String getFromId(){ return fromId; } }
UTF-8
Java
1,324
java
Comment.java
Java
[]
null
[]
package model; import java.util.Map; import constant.Constant; public class Comment { private String id = ""; private String context = ""; private String createTime = ""; private String userId = ""; private String fromId = ""; public Comment(){ } public Comment(Map<String, Object> map){ setId((String) map.get(Constant.COM_ID)); setContext((String) map.get(Constant.COM_CONTEXT)); setCreateTime((String) map.get(Constant.CREATE_TIME)); setUserId((String) map.get(Constant.COM_USERID)); setFromId((String) map.get(Constant.COM_FROMID)); } public void setId(String id){ this.id = id; } public String getId(){ return id; } public void setContext(String context){ this.context = context; } public String getContext(){ return context; } public void setCreateTime(String createTime){ this.createTime = createTime; } public String getCreateTime(){ return createTime; } public void setUserId(String userId){ this.userId = userId; } public String getUserId(){ return userId; } public void setFromId(String fromId){ this.fromId = fromId; } public String getFromId(){ return fromId; } }
1,324
0.607251
0.607251
59
21.440678
17.810938
62
false
false
0
0
0
0
0
0
0.40678
false
false
3
b6c3c27a6bdb3a5ac63a6c921ff32ca5cc677ceb
35,613,868,865,602
9da6d11a4415801831f383a41472bccf24b4c502
/StrategyDesignPattern/src/test/Client1.java
793b31c3101d9ffeb7911319c6b4bac91bfc8477
[]
no_license
nikant20/SpringSampleCodes
https://github.com/nikant20/SpringSampleCodes
0125791bf7451bfce5b290b1c4b09bfa26aead77
667087a4c0ca24f41908c5088ae3094e327052b9
refs/heads/master
2023-02-01T09:19:54.513000
2020-12-12T02:13:19
2020-12-12T02:13:19
320,728,361
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package test; import tech.nikant.components.EngineType; import tech.nikant.components.Vehicle; import tech.nikant.factory.VehicleFactory; public class Client1 { public static void main(String[] args) { try { Vehicle vehicle=VehicleFactory.getInstance(EngineType.DIESEL); vehicle.startJounery("Patna", "Chandigarh"); } catch(IllegalArgumentException iae) { iae.printStackTrace(); } } }
UTF-8
Java
410
java
Client1.java
Java
[ { "context": "ance(EngineType.DIESEL);\n\t\t\tvehicle.startJounery(\"Patna\", \"Chandigarh\");\n\t\t\t}\n\t\t\tcatch(IllegalArgumentExc", "end": 309, "score": 0.9997196793556213, "start": 304, "tag": "NAME", "value": "Patna" } ]
null
[]
package test; import tech.nikant.components.EngineType; import tech.nikant.components.Vehicle; import tech.nikant.factory.VehicleFactory; public class Client1 { public static void main(String[] args) { try { Vehicle vehicle=VehicleFactory.getInstance(EngineType.DIESEL); vehicle.startJounery("Patna", "Chandigarh"); } catch(IllegalArgumentException iae) { iae.printStackTrace(); } } }
410
0.74878
0.746341
17
23.117647
20.195755
65
false
false
0
0
0
0
0
0
1.823529
false
false
3
fe047b72c2dbab74d81d03f6efc67ab946d3affd
39,651,138,096,389
b697a2f112676d4dd4c5d7b6cd9edeaf669cb3e8
/spring/LearnDesginPattern/com/wangjinpeng/pizza/Pizza.java
4d19014c97456d45dad68797f9b61ad58fc5c49b
[ "MIT" ]
permissive
wjpworking/CodeBackup
https://github.com/wjpworking/CodeBackup
9ebf398bc4f9bd5f5640b06cc3f06240f7ac29c5
7f18f9364034d1e3f0c11e7ce7d8ecb153cc364b
refs/heads/master
2016-09-23T07:48:26.058000
2016-09-22T05:35:42
2016-09-22T05:35:42
47,490,853
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wangjinpeng.pizza; import java.util.ArrayList; /** * Name: Pizza.java * Author: wangjinpeng * Data: 2015/12/4 * Time: 19:46 */ public abstract class Pizza { String name; String dough; String sauce; ArrayList toppings = new ArrayList(); void prepare() { System.out.println("准备中" + name); System.out.println("正在制作面团"); System.out.println("添加调料中"); System.out.println("Adding toppings"); for (Object topping : toppings) { System.out.println(" " + topping); } } void bake() { System.out.println("Bake for 25 minutes at 350"); } void cut() { System.out.println("Cutting the pizza into diagonal slices"); } void box() { System.out.println("Please pizza in official PizzaStore box"); } public String getName() { return name; } }
UTF-8
Java
925
java
Pizza.java
Java
[ { "context": "til.ArrayList;\n\n/**\n * Name: Pizza.java\n * Author: wangjinpeng\n * Data: 2015/12/4\n * Time: 19:46\n */\n\n\npublic ab", "end": 107, "score": 0.9982939958572388, "start": 96, "tag": "USERNAME", "value": "wangjinpeng" } ]
null
[]
package com.wangjinpeng.pizza; import java.util.ArrayList; /** * Name: Pizza.java * Author: wangjinpeng * Data: 2015/12/4 * Time: 19:46 */ public abstract class Pizza { String name; String dough; String sauce; ArrayList toppings = new ArrayList(); void prepare() { System.out.println("准备中" + name); System.out.println("正在制作面团"); System.out.println("添加调料中"); System.out.println("Adding toppings"); for (Object topping : toppings) { System.out.println(" " + topping); } } void bake() { System.out.println("Bake for 25 minutes at 350"); } void cut() { System.out.println("Cutting the pizza into diagonal slices"); } void box() { System.out.println("Please pizza in official PizzaStore box"); } public String getName() { return name; } }
925
0.584169
0.566332
45
18.933332
18.888445
70
false
false
0
0
0
0
0
0
0.333333
false
false
3
90954d1398691bd290b69a59d780b493bd00d9c2
36,309,653,558,400
2ce9ba2bf30ac063813370bb6a1d6bf463bb4c41
/workspace/gestorWeb/services/data_impl/src/main/java/es/salazaryasociados/services/data/impl/dto/PaymentDTOConverter.java
d3d0d74a34d987fa35ddcffe172dc920ead43df4
[]
no_license
LuisLozano/GestorWeb
https://github.com/LuisLozano/GestorWeb
a4369f95c58015e537a34cc0f8f087b7424e6861
c4673ded406a3f23f924aee171ad595db7bf61d6
refs/heads/master
2021-01-10T16:58:14.298000
2017-11-24T22:28:03
2017-11-24T22:28:36
52,603,942
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package es.salazaryasociados.services.data.impl.dto; import es.salazaryasociados.model.Pago; import es.salazaryasociados.services.data.dto.PaymentDTO; import lombok.Setter; public class PaymentDTOConverter extends EntityToDTO<Pago, PaymentDTO> { @Setter private FileSummaryDTOConverter fileConverter; @Setter private ClientSummaryDTOConverter clientSummaryConverter; public PaymentDTOConverter(Class<Pago> entityClass, Class<PaymentDTO> dtoClass) { super(entityClass, dtoClass); } @Override public Pago createEntity() { return new Pago(); } @Override public PaymentDTO createDTO() { return new PaymentDTO(); } public PaymentDTO getDto(Pago entity) { PaymentDTO result = super.getDto(entity); //Obtener Expediente if (entity.getExpediente() != null) { result.setFile(fileConverter.getDto(entity.getExpediente())); } //Obtener clientes: if (entity.getPagador() != null) { result.setPayer(clientSummaryConverter.getDto(entity.getPagador())); } return result; } public Pago getEntity(PaymentDTO dto) { Pago result = super.getEntity(dto); //Obtener Expediente if (dto.getFile() != null) { result.setExpediente(fileConverter.getEntity(dto.getFile())); } //Obtener clientes: if (dto.getPayer() != null) { result.setPagador(clientSummaryConverter.getEntity(dto.getPayer())); } return result; } }
UTF-8
Java
1,441
java
PaymentDTOConverter.java
Java
[]
null
[]
package es.salazaryasociados.services.data.impl.dto; import es.salazaryasociados.model.Pago; import es.salazaryasociados.services.data.dto.PaymentDTO; import lombok.Setter; public class PaymentDTOConverter extends EntityToDTO<Pago, PaymentDTO> { @Setter private FileSummaryDTOConverter fileConverter; @Setter private ClientSummaryDTOConverter clientSummaryConverter; public PaymentDTOConverter(Class<Pago> entityClass, Class<PaymentDTO> dtoClass) { super(entityClass, dtoClass); } @Override public Pago createEntity() { return new Pago(); } @Override public PaymentDTO createDTO() { return new PaymentDTO(); } public PaymentDTO getDto(Pago entity) { PaymentDTO result = super.getDto(entity); //Obtener Expediente if (entity.getExpediente() != null) { result.setFile(fileConverter.getDto(entity.getExpediente())); } //Obtener clientes: if (entity.getPagador() != null) { result.setPayer(clientSummaryConverter.getDto(entity.getPagador())); } return result; } public Pago getEntity(PaymentDTO dto) { Pago result = super.getEntity(dto); //Obtener Expediente if (dto.getFile() != null) { result.setExpediente(fileConverter.getEntity(dto.getFile())); } //Obtener clientes: if (dto.getPayer() != null) { result.setPagador(clientSummaryConverter.getEntity(dto.getPayer())); } return result; } }
1,441
0.704372
0.704372
59
22.423729
23.215427
82
false
false
0
0
0
0
0
0
1.694915
false
false
3
facc34584bc79f4d05cdd46a57823f5b78705088
34,033,320,912,480
70b9743bbf6af5e9990c73a3a2862927ad91b093
/src/main/java/il/co/codeguru/corewars8086/memory/RealModeMemory.java
9b7b348b548b4e76af757cd8add9193e4ce41194
[ "Apache-2.0" ]
permissive
codeguru-il/corewars8086
https://github.com/codeguru-il/corewars8086
31fffc833774661e3921bef7071fb28516f8ce27
999071591366e6943780943a077b63b2b7ff6242
refs/heads/master
2023-03-19T11:04:36.814000
2023-03-14T21:30:51
2023-03-14T21:30:51
6,730,830
25
18
Apache-2.0
false
2023-03-14T21:30:52
2012-11-17T01:39:29
2022-11-27T20:36:33
2023-03-14T21:30:51
333
31
19
11
Java
false
false
package il.co.codeguru.corewars8086.memory; /** * Interface for 16bit Real-Mode memory. * * @author DL */ public interface RealModeMemory { /** * Reads a single byte from the specified address. * * @param address Real-mode address to read from. * @return the read byte. * * @throws MemoryException on any error. */ public abstract byte readByte(RealModeAddress address) throws MemoryException; /** * Reads a single word from the specified address. * * @param address Real-mode address to read from. * @return the read word. * * @throws MemoryException on any error. */ public abstract short readWord(RealModeAddress address) throws MemoryException; /** * Writes a single byte to the specified address. * * @param address Real-mode address to write to. * @param value Data to write. * * @throws MemoryException on any error. */ public abstract void writeByte(RealModeAddress address, byte value) throws MemoryException; /** * Writes a single word to the specified address. * * @param address Real-mode address to write to. * @param value Data to write. * * @throws MemoryException on any error. */ public abstract void writeWord(RealModeAddress address, short value) throws MemoryException; /** * Reads a single byte from the specified address, in order to execute it. * * @param address Real-mode address to read from. * @return the read byte. * * @throws MemoryException on any error. */ public abstract byte readExecuteByte(RealModeAddress address) throws MemoryException; /** * Reads a single word from the specified address, in order to execute it. * * @param address Real-mode address to read from. * @return the read word. * * @throws MemoryException on any error. */ public abstract short readExecuteWord(RealModeAddress address) throws MemoryException; }
UTF-8
Java
2,186
java
RealModeMemory.java
Java
[ { "context": "rface for 16bit Real-Mode memory.\r\n * \r\n * @author DL\r\n */\r\npublic interface RealModeMemory {\r\n\r\n /*", "end": 112, "score": 0.8061952590942383, "start": 110, "tag": "USERNAME", "value": "DL" } ]
null
[]
package il.co.codeguru.corewars8086.memory; /** * Interface for 16bit Real-Mode memory. * * @author DL */ public interface RealModeMemory { /** * Reads a single byte from the specified address. * * @param address Real-mode address to read from. * @return the read byte. * * @throws MemoryException on any error. */ public abstract byte readByte(RealModeAddress address) throws MemoryException; /** * Reads a single word from the specified address. * * @param address Real-mode address to read from. * @return the read word. * * @throws MemoryException on any error. */ public abstract short readWord(RealModeAddress address) throws MemoryException; /** * Writes a single byte to the specified address. * * @param address Real-mode address to write to. * @param value Data to write. * * @throws MemoryException on any error. */ public abstract void writeByte(RealModeAddress address, byte value) throws MemoryException; /** * Writes a single word to the specified address. * * @param address Real-mode address to write to. * @param value Data to write. * * @throws MemoryException on any error. */ public abstract void writeWord(RealModeAddress address, short value) throws MemoryException; /** * Reads a single byte from the specified address, in order to execute it. * * @param address Real-mode address to read from. * @return the read byte. * * @throws MemoryException on any error. */ public abstract byte readExecuteByte(RealModeAddress address) throws MemoryException; /** * Reads a single word from the specified address, in order to execute it. * * @param address Real-mode address to read from. * @return the read word. * * @throws MemoryException on any error. */ public abstract short readExecuteWord(RealModeAddress address) throws MemoryException; }
2,186
0.612992
0.610247
73
27.945206
25.233099
83
false
false
0
0
0
0
0
0
0.178082
false
false
3
d2337c62b79e9bb2ad56c12f37db7d75952d3615
910,533,070,582
d93ee1beefc597cecf59b40eddedb8e54fe82dcf
/service/MenuService/src/main/java/com/example/MenuService/Service/MenuService.java
1de9b1de34145868483a6ec13b9311c95f862b47
[]
no_license
preawphuak/SOA2019_Group1
https://github.com/preawphuak/SOA2019_Group1
e63a0a890254647cfc078280126273d00b76ef78
13c97aa83aae3211d307fafc46e5dbb77f9c7229
refs/heads/master
2020-05-19T21:05:22.376000
2019-05-06T14:34:13
2019-05-06T14:34:13
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.MenuService.Service; import com.example.MenuService.Model.Menu; import org.springframework.stereotype.Service; @Service public class MenuService { private Menu menu; public MenuService(){} public Menu getMenu() { return menu; } public void setMenu(Menu menu) { this.menu = menu; } public String getCategory(){ return "Category"; } public Menu getMenu(String name){ menu = new Menu(); menu.setFoodName(name); return menu; } public Menu getMenuCategory(String type){ menu = new Menu(); menu.setCategory(type); return menu; } public Menu getMenuByMember(String memberId){ //get menu from db menu = new Menu(); menu.setMemberId(memberId); return menu; } public Menu getMenuDetail(String MenuId) { //get menu from db 'menuId' menu = new Menu(); return menu; } }
UTF-8
Java
980
java
MenuService.java
Java
[]
null
[]
package com.example.MenuService.Service; import com.example.MenuService.Model.Menu; import org.springframework.stereotype.Service; @Service public class MenuService { private Menu menu; public MenuService(){} public Menu getMenu() { return menu; } public void setMenu(Menu menu) { this.menu = menu; } public String getCategory(){ return "Category"; } public Menu getMenu(String name){ menu = new Menu(); menu.setFoodName(name); return menu; } public Menu getMenuCategory(String type){ menu = new Menu(); menu.setCategory(type); return menu; } public Menu getMenuByMember(String memberId){ //get menu from db menu = new Menu(); menu.setMemberId(memberId); return menu; } public Menu getMenuDetail(String MenuId) { //get menu from db 'menuId' menu = new Menu(); return menu; } }
980
0.59898
0.59898
50
18.620001
15.64211
49
false
false
0
0
0
0
0
0
0.36
false
false
3
913287c50dea4a5f428941bf1f1788ed57a731f6
4,449,586,125,941
a86695d7781108ee9f608cf6884d765ba2fea159
/src/main/java/ui/rmi/client/Client.java
6b0255143e338bc1c027e72e50549b5d76abed64
[]
no_license
iosifsecheleadan/laboratory-problems
https://github.com/iosifsecheleadan/laboratory-problems
bd323a81db5d37c73470fb49445d13e116782613
17f814b37677d040caf7e3f859cf9a17fcb66c91
refs/heads/master
2023-05-31T05:26:31.994000
2020-05-02T12:02:13
2020-05-02T12:02:13
383,742,613
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ui.rmi.client; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import service.AssignmentService; import service.ProblemService; import service.StudentService; import ui.console.Console; /** * Run Client in Console with Server configured Service * @see ClientConfiguration * @author sechelea */ public class Client { public static void main(String[] args) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ClientConfiguration.class); StudentService studentService = context.getBean(StudentService.class); ProblemService problemService = context.getBean(ProblemService.class); AssignmentService assignmentService = context.getBean(AssignmentService.class); Console userInterface = new Console(studentService, problemService, assignmentService); userInterface.run(); } }
UTF-8
Java
928
java
Client.java
Java
[ { "context": "red Service\n * @see ClientConfiguration\n * @author sechelea\n */\npublic class Client {\n public static void ", "end": 337, "score": 0.9997082352638245, "start": 329, "tag": "USERNAME", "value": "sechelea" } ]
null
[]
package ui.rmi.client; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import service.AssignmentService; import service.ProblemService; import service.StudentService; import ui.console.Console; /** * Run Client in Console with Server configured Service * @see ClientConfiguration * @author sechelea */ public class Client { public static void main(String[] args) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ClientConfiguration.class); StudentService studentService = context.getBean(StudentService.class); ProblemService problemService = context.getBean(ProblemService.class); AssignmentService assignmentService = context.getBean(AssignmentService.class); Console userInterface = new Console(studentService, problemService, assignmentService); userInterface.run(); } }
928
0.767241
0.767241
26
34.692307
31.107468
95
false
false
0
0
0
0
0
0
0.538462
false
false
3
8b8ce6956e8798b291aece24105166361303f1ac
12,128,987,651,225
7edb1692b89ec99cd4916579038221349f7e5dc4
/src/main/java/Astrologer/Cards/Stars/Fireball.java
904b590610d70881d176c6951f8742d7f4065015
[]
no_license
Alchyr/Astrologer
https://github.com/Alchyr/Astrologer
98aec0cf91578b51c9cb14901693d9725db77287
7f30bcd7d0b62acc859394fd45386268d94b4541
refs/heads/master
2022-02-20T13:33:05.610000
2022-02-05T22:26:17
2022-02-05T22:26:17
180,099,227
1
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package Astrologer.Cards.Stars; import Astrologer.Abstracts.StarCard; import Astrologer.Enums.CustomTags; import Astrologer.Powers.Starlit; import Astrologer.Util.CardInfo; import com.badlogic.gdx.math.MathUtils; import com.megacrit.cardcrawl.actions.AbstractGameAction; import com.megacrit.cardcrawl.actions.animations.VFXAction; import com.megacrit.cardcrawl.actions.common.ApplyPowerAction; import com.megacrit.cardcrawl.actions.common.DamageAction; import com.megacrit.cardcrawl.cards.DamageInfo; import com.megacrit.cardcrawl.characters.AbstractPlayer; import com.megacrit.cardcrawl.core.Settings; import com.megacrit.cardcrawl.dungeons.AbstractDungeon; import com.megacrit.cardcrawl.monsters.AbstractMonster; import com.megacrit.cardcrawl.vfx.combat.FireballEffect; import static Astrologer.AstrologerMod.makeID; public class Fireball extends StarCard { private final static CardInfo cardInfo = new CardInfo( "Fireball", 2, CardType.ATTACK, CardTarget.ENEMY, CardRarity.UNCOMMON ); public final static String ID = makeID(cardInfo.cardName); private final static int DAMAGE = 17; private final static int UPG_DAMAGE = 4; private final static int DEBUFF = 1; private final static int UPG_DEBUFF = 1; public Fireball() { super(cardInfo,false); setDamage(DAMAGE, UPG_DAMAGE); setMagic(DEBUFF, UPG_DEBUFF); } public void use(AbstractPlayer p, AbstractMonster m) { if (m != null) AbstractDungeon.actionManager.addToBottom(new VFXAction(new FireballEffect(p.hb.cX, p.hb.cY + MathUtils.random(200, 250) * Settings.scale, m.hb.cX, m.hb.cY), 0.5f)); AbstractDungeon.actionManager.addToBottom(new DamageAction(m, new DamageInfo(p, this.damage, this.damageTypeForTurn), AbstractGameAction.AttackEffect.FIRE)); AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(m, p, new Starlit(m, this.magicNumber), this.magicNumber)); } }
UTF-8
Java
2,008
java
Fireball.java
Java
[]
null
[]
package Astrologer.Cards.Stars; import Astrologer.Abstracts.StarCard; import Astrologer.Enums.CustomTags; import Astrologer.Powers.Starlit; import Astrologer.Util.CardInfo; import com.badlogic.gdx.math.MathUtils; import com.megacrit.cardcrawl.actions.AbstractGameAction; import com.megacrit.cardcrawl.actions.animations.VFXAction; import com.megacrit.cardcrawl.actions.common.ApplyPowerAction; import com.megacrit.cardcrawl.actions.common.DamageAction; import com.megacrit.cardcrawl.cards.DamageInfo; import com.megacrit.cardcrawl.characters.AbstractPlayer; import com.megacrit.cardcrawl.core.Settings; import com.megacrit.cardcrawl.dungeons.AbstractDungeon; import com.megacrit.cardcrawl.monsters.AbstractMonster; import com.megacrit.cardcrawl.vfx.combat.FireballEffect; import static Astrologer.AstrologerMod.makeID; public class Fireball extends StarCard { private final static CardInfo cardInfo = new CardInfo( "Fireball", 2, CardType.ATTACK, CardTarget.ENEMY, CardRarity.UNCOMMON ); public final static String ID = makeID(cardInfo.cardName); private final static int DAMAGE = 17; private final static int UPG_DAMAGE = 4; private final static int DEBUFF = 1; private final static int UPG_DEBUFF = 1; public Fireball() { super(cardInfo,false); setDamage(DAMAGE, UPG_DAMAGE); setMagic(DEBUFF, UPG_DEBUFF); } public void use(AbstractPlayer p, AbstractMonster m) { if (m != null) AbstractDungeon.actionManager.addToBottom(new VFXAction(new FireballEffect(p.hb.cX, p.hb.cY + MathUtils.random(200, 250) * Settings.scale, m.hb.cX, m.hb.cY), 0.5f)); AbstractDungeon.actionManager.addToBottom(new DamageAction(m, new DamageInfo(p, this.damage, this.damageTypeForTurn), AbstractGameAction.AttackEffect.FIRE)); AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(m, p, new Starlit(m, this.magicNumber), this.magicNumber)); } }
2,008
0.746016
0.739044
53
36.905659
36.436176
177
false
false
0
0
0
0
0
0
0.943396
false
false
3
95d7c6e3e70434343fe66690f313addcbaf3a583
12,498,354,838,945
2d24e6a5b7dfc87dc902b48f4e56671a01472502
/src/jus/poc/prodcons/v2/ProdConsBuffer.java
4e8621abc1a8a696e707c78d74183ce29392f7df
[]
no_license
varenneremi/BuffProdCons
https://github.com/varenneremi/BuffProdCons
0263bd0e33de41e0bf724bbbc94945b8a1482c5e
99863bc469c2b6c3dca19229badf26bf67ba15f2
refs/heads/master
2020-04-08T22:23:48.052000
2018-12-14T08:53:59
2018-12-14T08:53:59
159,785,544
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package jus.poc.prodcons.v2; import java.util.ArrayList; public class ProdConsBuffer implements IProdConsBuffer{ int nbreMess; int sizeBuf; int prodTime; int consTime; ArrayList<Message> buffer; int consoCompte; ProdConsBuffer (int sizeB) { this.sizeBuf = sizeB; buffer = new ArrayList<Message>(sizeB); consoCompte = 0; System.out.println(" *** ConsBuffer size "+sizeBuf + " *** "); } public synchronized void put(Message m) throws InterruptedException { System.out.println(" + Producteur ID: " + m.prod.getId() + " put "+ m.message); while(nmsg() == sizeBuf ) { System.out.println(" ++ Prod en attente ! Buffer contient " + buffer.size() + " sur " + sizeBuf + " messages"); this.wait(); } buffer.add(m); System.out.println(" ++ Ajout ; buffer contient " + buffer.size() + " sur " + sizeBuf + " messages"); this.notifyAll(); } public synchronized Message get() throws InterruptedException { while(nmsg() == 0) { System.out.println(" -- Conso en attente ! Consommés " + consoCompte); this.wait(); } Message m = buffer.remove(0); System.out.println(" -- Nombre de message consommé : " + (consoCompte+1) + " ; buffer contient " + buffer.size() + " sur " + sizeBuf + " messages"); this.notifyAll(); return m; } @Override public int nmsg() { // TODO Auto-generated method stub return buffer.size(); } }
UTF-8
Java
1,433
java
ProdConsBuffer.java
Java
[]
null
[]
package jus.poc.prodcons.v2; import java.util.ArrayList; public class ProdConsBuffer implements IProdConsBuffer{ int nbreMess; int sizeBuf; int prodTime; int consTime; ArrayList<Message> buffer; int consoCompte; ProdConsBuffer (int sizeB) { this.sizeBuf = sizeB; buffer = new ArrayList<Message>(sizeB); consoCompte = 0; System.out.println(" *** ConsBuffer size "+sizeBuf + " *** "); } public synchronized void put(Message m) throws InterruptedException { System.out.println(" + Producteur ID: " + m.prod.getId() + " put "+ m.message); while(nmsg() == sizeBuf ) { System.out.println(" ++ Prod en attente ! Buffer contient " + buffer.size() + " sur " + sizeBuf + " messages"); this.wait(); } buffer.add(m); System.out.println(" ++ Ajout ; buffer contient " + buffer.size() + " sur " + sizeBuf + " messages"); this.notifyAll(); } public synchronized Message get() throws InterruptedException { while(nmsg() == 0) { System.out.println(" -- Conso en attente ! Consommés " + consoCompte); this.wait(); } Message m = buffer.remove(0); System.out.println(" -- Nombre de message consommé : " + (consoCompte+1) + " ; buffer contient " + buffer.size() + " sur " + sizeBuf + " messages"); this.notifyAll(); return m; } @Override public int nmsg() { // TODO Auto-generated method stub return buffer.size(); } }
1,433
0.62963
0.626136
48
28.8125
32.887215
152
false
false
0
0
0
0
0
0
0.5625
false
false
3
b35b1e53a81a83cd33533a41608fd97da41caf01
19,516,331,401,000
915c230874f51ecef937c4882b8d7ffd51d1a6f3
/src/com/group5/android/fd/entity/ItemEntity.java
6fdc0ecae93b4c4f4b81d21d055045182d402af9
[]
no_license
daohoangson/DTUI_201105_Android
https://github.com/daohoangson/DTUI_201105_Android
d685f2fe022710435fa3a2640ca12af6afcfed16
85dfb323cf92aae8767530236bb8dd1738f5a867
refs/heads/master
2021-01-18T15:59:22.595000
2011-05-24T19:20:36
2011-05-24T19:20:36
1,718,229
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.group5.android.fd.entity; import org.json.JSONException; import org.json.JSONObject; import android.content.ContentValues; import android.database.Cursor; import com.group5.android.fd.DbAdapter; /** * An item * * @author Nguyen Huu Ha * */ public class ItemEntity extends AbstractEntity { /** * */ private static final long serialVersionUID = 6704341940680459268L; public int itemId; public String itemName; public String itemDescription; public double price; public int categoryId; // get values from JSONObject , from server for sync() public void parse(JSONObject jsonObject) throws JSONException { itemId = jsonObject.getInt("item_id"); itemName = jsonObject.getString("item_name"); itemDescription = jsonObject.getString("item_description"); price = jsonObject.getDouble("price"); categoryId = jsonObject.getInt("category_id"); parseImages(jsonObject); } // get values from cursor public void parse(Cursor cursor) { itemId = cursor.getInt(DbAdapter.ITEM_INDEX_ID); itemName = cursor.getString(DbAdapter.ITEM_INDEX_NAME); itemDescription = cursor.getString(DbAdapter.ITEM_INDEX_DESCRIPTION); price = cursor.getDouble(DbAdapter.ITEM_INDEX_PRICE); categoryId = cursor.getInt(DbAdapter.ITEM_INDEX_CATEGORY_ID); parseImages(cursor, DbAdapter.ITEM_INDEX_CATEGORY_ID); } // save values to database public void save(DbAdapter dbAdapter) { ContentValues values = new ContentValues(); values.put(DbAdapter.ITEM_KEY_ID, itemId); values.put(DbAdapter.ITEM_KEY_NAME, itemName); values.put(DbAdapter.ITEM_KEY_DESCRIPTION, itemDescription); values.put(DbAdapter.ITEM_KEY_PRICE, price); values.put(DbAdapter.ITEM_KEY_CATEGORY_ID, categoryId); saveImages(values); dbAdapter.getDb().insert(DbAdapter.DATABASE_TABLE_ITEM, null, values); onUpdated(AbstractEntity.TARGET_LOCAL_DATABASE); } }
UTF-8
Java
1,870
java
ItemEntity.java
Java
[ { "context": "droid.fd.DbAdapter;\n\n/**\n * An item\n * \n * @author Nguyen Huu Ha\n * \n */\npublic class ItemEntity extends AbstractE", "end": 254, "score": 0.999854564666748, "start": 241, "tag": "NAME", "value": "Nguyen Huu Ha" } ]
null
[]
package com.group5.android.fd.entity; import org.json.JSONException; import org.json.JSONObject; import android.content.ContentValues; import android.database.Cursor; import com.group5.android.fd.DbAdapter; /** * An item * * @author <NAME> * */ public class ItemEntity extends AbstractEntity { /** * */ private static final long serialVersionUID = 6704341940680459268L; public int itemId; public String itemName; public String itemDescription; public double price; public int categoryId; // get values from JSONObject , from server for sync() public void parse(JSONObject jsonObject) throws JSONException { itemId = jsonObject.getInt("item_id"); itemName = jsonObject.getString("item_name"); itemDescription = jsonObject.getString("item_description"); price = jsonObject.getDouble("price"); categoryId = jsonObject.getInt("category_id"); parseImages(jsonObject); } // get values from cursor public void parse(Cursor cursor) { itemId = cursor.getInt(DbAdapter.ITEM_INDEX_ID); itemName = cursor.getString(DbAdapter.ITEM_INDEX_NAME); itemDescription = cursor.getString(DbAdapter.ITEM_INDEX_DESCRIPTION); price = cursor.getDouble(DbAdapter.ITEM_INDEX_PRICE); categoryId = cursor.getInt(DbAdapter.ITEM_INDEX_CATEGORY_ID); parseImages(cursor, DbAdapter.ITEM_INDEX_CATEGORY_ID); } // save values to database public void save(DbAdapter dbAdapter) { ContentValues values = new ContentValues(); values.put(DbAdapter.ITEM_KEY_ID, itemId); values.put(DbAdapter.ITEM_KEY_NAME, itemName); values.put(DbAdapter.ITEM_KEY_DESCRIPTION, itemDescription); values.put(DbAdapter.ITEM_KEY_PRICE, price); values.put(DbAdapter.ITEM_KEY_CATEGORY_ID, categoryId); saveImages(values); dbAdapter.getDb().insert(DbAdapter.DATABASE_TABLE_ITEM, null, values); onUpdated(AbstractEntity.TARGET_LOCAL_DATABASE); } }
1,863
0.75615
0.74492
65
27.76923
23.250984
72
false
false
0
0
0
0
0
0
1.569231
false
false
3
558a86c213a0ff0b7bd3117ff899a00a0626fd86
24,592,982,743,093
6f8be3fddcd2a9c817108b553bb3a3739e9bafd0
/src/main/java/br/com/tsi/utfpr/xenon/domain/config/property/ThymeleafProperty.java
5bcabba72d4f9598619bee45fe8afe60cad4922f
[]
no_license
MarcusViniciusCavalcanti/xenon-web-app
https://github.com/MarcusViniciusCavalcanti/xenon-web-app
29970b6221eef2f4b65641ff0f38036764a9b7df
16ff270ecdf063f1f5061388ee5c5ff99b585622
refs/heads/main
2023-06-18T22:21:46.829000
2021-07-17T16:37:24
2021-07-17T16:37:24
356,666,104
0
0
null
false
2021-07-04T21:46:39
2021-04-10T18:41:00
2021-07-04T21:21:32
2021-07-04T21:46:39
1,942
0
0
0
Java
false
false
package br.com.tsi.utfpr.xenon.domain.config.property; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; @Data @ConfigurationProperties("xenon.configurations.thymeleaf") public class ThymeleafProperty { private boolean cache = false; }
UTF-8
Java
289
java
ThymeleafProperty.java
Java
[]
null
[]
package br.com.tsi.utfpr.xenon.domain.config.property; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; @Data @ConfigurationProperties("xenon.configurations.thymeleaf") public class ThymeleafProperty { private boolean cache = false; }
289
0.816609
0.816609
11
25.272728
26.017794
75
false
false
0
0
0
0
0
0
0.363636
false
false
3