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
1bbeda9056817006c6497b48a2fcf0bf309d3b11
24,713,241,850,624
d1c5e7ba287683bfab079a784713d28f55fbc338
/RoseGarden.java
c1e6cb3444d8bcd2f7a13e0c0cb4fe1e0df1fde7
[]
no_license
ranley123/Leetcode
https://github.com/ranley123/Leetcode
f04956bfac631efbc09b7aee68bc56f720831d0c
4f03af10c117d3427811dfa7ba498848ba40a665
refs/heads/master
2021-01-01T23:29:40.140000
2020-02-09T23:34:38
2020-02-09T23:34:38
239,391,098
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Arrays; public class RoseGarden { static int minDaysBloom(int[] a, int k, int n) { int len = a.length; int[] dp = new int[len]; dp[0] = Math.max(a[0], a[1]); for(int i = 1; i < len - 1; i++) { dp[i] = Math.min(Math.max(a[i - 1], a[i]), Math.max(a[i], a[i + 1])); } dp[len - 1] = Math.max(a[len - 1], a[len - 2]); Arrays.sort(dp); int res = 0; int curn = 0; int i = 0; while(i < len - k) { if(curn == n) return res; if(isSame(dp, i, i + k - 1)) { res = Math.max(res, dp[i]); curn--; i += k; } else i++; } return res; } static boolean isSame(int[] dp, int i, int j) { return dp[i] == dp[j]; } public static void main(String[] args) { int[] a = {1, 2, 4, 9, 3, 4, 1}; int k = 2; int n = 3; System.out.println(minDaysBloom(a, k, n)); } }
UTF-8
Java
837
java
RoseGarden.java
Java
[]
null
[]
import java.util.Arrays; public class RoseGarden { static int minDaysBloom(int[] a, int k, int n) { int len = a.length; int[] dp = new int[len]; dp[0] = Math.max(a[0], a[1]); for(int i = 1; i < len - 1; i++) { dp[i] = Math.min(Math.max(a[i - 1], a[i]), Math.max(a[i], a[i + 1])); } dp[len - 1] = Math.max(a[len - 1], a[len - 2]); Arrays.sort(dp); int res = 0; int curn = 0; int i = 0; while(i < len - k) { if(curn == n) return res; if(isSame(dp, i, i + k - 1)) { res = Math.max(res, dp[i]); curn--; i += k; } else i++; } return res; } static boolean isSame(int[] dp, int i, int j) { return dp[i] == dp[j]; } public static void main(String[] args) { int[] a = {1, 2, 4, 9, 3, 4, 1}; int k = 2; int n = 3; System.out.println(minDaysBloom(a, k, n)); } }
837
0.501792
0.474313
42
18.928572
16.857092
72
false
false
0
0
0
0
0
0
2.952381
false
false
10
2383639a651844fbb7ce085c01553fa413bf2a93
12,189,117,221,466
a4ae88a3821e1d60a80f2b0b5ac856e815377b81
/swiftcom2Ejb/src/main/java/com/jnj/gtsc/swiftcom2/business/swiftcom/formatter/iso20022/pain00100103/context/GeneralContext.java
cd7c78f85e195e8801893570d52f5558b88b8028
[]
no_license
rcommers/swiftcom
https://github.com/rcommers/swiftcom
8138927c96414cb0fef88efb6354d128c3501bb1
fb036f93b8e7d445ad06cca49127eb5502b6ee9e
refs/heads/master
2017-10-03T01:45:44.645000
2016-09-20T18:27:04
2016-09-20T18:27:04
68,741,031
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jnj.gtsc.swiftcom2.business.swiftcom.formatter.iso20022.pain00100103.context; import com.jnj.gtsc.swiftcom2.business.swiftcom.valueobject.PaymentValueObject; public class GeneralContext implements IContext{ private PaymentValueObject payment; private Object contextData; public GeneralContext(PaymentValueObject payment, Object contextData) { super(); this.payment = payment; this.contextData = contextData; } public void setPayment(PaymentValueObject payment) { this.payment = payment; } public PaymentValueObject getPayment() { return payment; } public void setContextData(Object contextData) { this.contextData = contextData; } public Object getContextData() { return contextData; } }
UTF-8
Java
770
java
GeneralContext.java
Java
[]
null
[]
package com.jnj.gtsc.swiftcom2.business.swiftcom.formatter.iso20022.pain00100103.context; import com.jnj.gtsc.swiftcom2.business.swiftcom.valueobject.PaymentValueObject; public class GeneralContext implements IContext{ private PaymentValueObject payment; private Object contextData; public GeneralContext(PaymentValueObject payment, Object contextData) { super(); this.payment = payment; this.contextData = contextData; } public void setPayment(PaymentValueObject payment) { this.payment = payment; } public PaymentValueObject getPayment() { return payment; } public void setContextData(Object contextData) { this.contextData = contextData; } public Object getContextData() { return contextData; } }
770
0.750649
0.731169
31
22.838709
25.288141
89
false
false
0
0
0
0
0
0
1.387097
false
false
10
5d7325babbb28745af766e57726894830bf58051
3,504,693,352,885
dc205dc86b60e80c7723721927cead8bbcb9ae49
/src/test/java/jp/thotta/oml/client/io/FeatureTest.java
f31b028fd0a7d34eb729469f61f719579d05bb43
[]
no_license
toru1055/oml-client
https://github.com/toru1055/oml-client
50faf446d78a3478a9321818398bc3967975321d
c2f1a149d327716f50923107841cc0d13768172f
refs/heads/master
2021-01-10T01:56:10.297000
2016-03-19T00:26:28
2016-03-19T00:26:28
53,230,076
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package jp.thotta.oml.client.io; import junit.framework.TestCase; public class FeatureTest extends TestCase { public void testHashKey() { Feature f = new Feature("key", 5.5); assertEquals(f.key(), "key"); assertEquals(f.value(), 5.5, 0.001); assertEquals(f.hashKey(), "106079"); } }
UTF-8
Java
305
java
FeatureTest.java
Java
[ { "context": "ue(), 5.5, 0.001);\n assertEquals(f.hashKey(), \"106079\");\n }\n}\n", "end": 295, "score": 0.9986695647239685, "start": 289, "tag": "KEY", "value": "106079" } ]
null
[]
package jp.thotta.oml.client.io; import junit.framework.TestCase; public class FeatureTest extends TestCase { public void testHashKey() { Feature f = new Feature("key", 5.5); assertEquals(f.key(), "key"); assertEquals(f.value(), 5.5, 0.001); assertEquals(f.hashKey(), "106079"); } }
305
0.668852
0.622951
12
24.416666
17.036522
43
false
false
0
0
0
0
0
0
0.916667
false
false
10
758af2bc8bc2d3f91a49b3ac36a802d54ed4abdf
30,434,138,309,419
d38900c06a75e6c71b51f4290809763218626411
/agp-core/src/main/java/com/lvsint/abp/server/settlement/bet/CoupledOutcome.java
a973d88e8ddf0f9295d37d06aa4ed39de548a66c
[]
no_license
XClouded/avp
https://github.com/XClouded/avp
ef5d0df5fd06d67793f93539e6421c5c8cef06c5
4a41681376cd3e1ec7f814dcd1f178d89e94f3d6
refs/heads/master
2017-02-26T23:03:31.245000
2014-07-22T19:03:40
2014-07-22T19:03:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lvsint.abp.server.settlement.bet; /** * <p> * Title: $Id: CoupledOutcome.java,v 1.1 2006/12/11 08:26:49 ordishs Exp $ * </p> * <p> * * Description: * * </p> * <p> * Copyright: Copyright 2005 * </p> * <p> * Company: Laverock von Schoultz * </p> * * @author Mark Mahieu * @version $Revision: 1.1 $ */ public class CoupledOutcome { private long id; private boolean notResulted; private boolean withdrawn; public CoupledOutcome(long id, boolean notResulted, boolean withdrawn) { this.id = id; this.notResulted = notResulted; this.withdrawn = withdrawn; } /** * @return Returns the outcomeId. */ public long getId() { return id; } /** * @return Returns whether the outcome was void */ public boolean isWithdrawn() { return withdrawn; } /** * @return Returns whether the outcome is still awaiting a result. */ public boolean isNotResulted() { return notResulted; } }
UTF-8
Java
1,036
java
CoupledOutcome.java
Java
[ { "context": "pany: Laverock von Schoultz\n * </p>\n * \n * @author Mark Mahieu\n * @version $Revision: 1.1 $\n */\npublic class Cou", "end": 299, "score": 0.9998639822006226, "start": 288, "tag": "NAME", "value": "Mark Mahieu" } ]
null
[]
package com.lvsint.abp.server.settlement.bet; /** * <p> * Title: $Id: CoupledOutcome.java,v 1.1 2006/12/11 08:26:49 ordishs Exp $ * </p> * <p> * * Description: * * </p> * <p> * Copyright: Copyright 2005 * </p> * <p> * Company: Laverock von Schoultz * </p> * * @author <NAME> * @version $Revision: 1.1 $ */ public class CoupledOutcome { private long id; private boolean notResulted; private boolean withdrawn; public CoupledOutcome(long id, boolean notResulted, boolean withdrawn) { this.id = id; this.notResulted = notResulted; this.withdrawn = withdrawn; } /** * @return Returns the outcomeId. */ public long getId() { return id; } /** * @return Returns whether the outcome was void */ public boolean isWithdrawn() { return withdrawn; } /** * @return Returns whether the outcome is still awaiting a result. */ public boolean isNotResulted() { return notResulted; } }
1,031
0.589768
0.568533
57
17.192982
18.987936
76
false
false
0
0
0
0
0
0
0.22807
false
false
10
794b52ded7d4c792b8d50c0a3d1222a51fa219d7
36,215,164,257,309
6d17da4d0dd67f4e7ff1fb6e2c4e0d43af14202b
/src/main/java/com/neueda/trade/server/model/BuySell.java
097e3d353bb8cb1bec9227b1f818b758996378e3
[]
no_license
ugine/trial
https://github.com/ugine/trial
46cef968bd2c0fb2e90e5b5c868619e61ca8fad7
8463e38e6c6240cb56c96897cf2dbdc383d9206f
refs/heads/master
2021-06-21T00:30:39.632000
2017-07-18T16:29:30
2017-07-18T16:29:30
100,501,780
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.neueda.trade.server.model; import com.fasterxml.jackson.annotation.JsonProperty; /** * Class to encapsulate possible Buy/Sell states and JSON representation * * @author Neueda * */ public enum BuySell { @JsonProperty("B") Buy, @JsonProperty("S") Sell }
UTF-8
Java
296
java
BuySell.java
Java
[ { "context": "ll states and JSON representation\r\n * \r\n * @author Neueda\r\n *\r\n */\r\npublic enum BuySell {\r\n @JsonProper", "end": 199, "score": 0.6847381591796875, "start": 194, "tag": "USERNAME", "value": "Neued" }, { "context": "tes and JSON representation\r\n * \r\n * @author Neueda\r\n *\r\n */\r\npublic enum BuySell {\r\n @JsonPropert", "end": 200, "score": 0.5916906595230103, "start": 199, "tag": "NAME", "value": "a" } ]
null
[]
package com.neueda.trade.server.model; import com.fasterxml.jackson.annotation.JsonProperty; /** * Class to encapsulate possible Buy/Sell states and JSON representation * * @author Neueda * */ public enum BuySell { @JsonProperty("B") Buy, @JsonProperty("S") Sell }
296
0.679054
0.679054
14
19.142857
21.682308
72
false
false
0
0
0
0
0
0
0.214286
false
false
10
d7a4f9928786215dc358e16020be15b60d58f5a0
1,898,375,595,778
ef2e4f5ee23befd1138f875fbb732f765ba30551
/src/main/java/cn/edu/buaa/crypto/application/qlw17/revocation/RevokeBinaryTree.java
5e5f875a28e06648ccd403ea607c1270ecc8dbbf
[]
no_license
jokester/CloudCrypto
https://github.com/jokester/CloudCrypto
1cd439bd4cf49b998cca8904a168b334061a19eb
e3a17c71b3844226c9366eba1048073d0d8bda1f
refs/heads/master
2021-01-12T18:59:22.561000
2016-07-21T10:26:54
2016-07-21T10:26:54
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.edu.buaa.crypto.application.qlw17.revocation; import it.unisa.dia.gas.jpbc.Pairing; /** * Created by Weiran Liu on 2016/7/20. */ public class RevokeBinaryTree { private Pairing pairing; }
UTF-8
Java
208
java
RevokeBinaryTree.java
Java
[ { "context": " it.unisa.dia.gas.jpbc.Pairing;\n\n/**\n * Created by Weiran Liu on 2016/7/20.\n */\npublic class RevokeBinaryTree {", "end": 125, "score": 0.999786376953125, "start": 115, "tag": "NAME", "value": "Weiran Liu" } ]
null
[]
package cn.edu.buaa.crypto.application.qlw17.revocation; import it.unisa.dia.gas.jpbc.Pairing; /** * Created by <NAME> on 2016/7/20. */ public class RevokeBinaryTree { private Pairing pairing; }
204
0.735577
0.692308
11
17.90909
19.505032
56
false
false
0
0
0
0
0
0
0.272727
false
false
10
8ca19cc0b4e3475cdc7fec11752dbd665e5b8725
2,662,879,743,436
22e673e91bc83ead900ca6c32043d2e6554c58ec
/HW12/src/edu/umb/cs681/hw12/MultiThread.java
3f41b0d5abe566eea27ff5262a939b0aa5addb68
[]
no_license
nathan-vo810/CS681-UMB
https://github.com/nathan-vo810/CS681-UMB
26dfc3a6007c96a6d83f87b352a04eb6b53893aa
abb4abdbe8542da52f4b819705ebd83ee4b27fb2
refs/heads/master
2023-02-01T21:15:50.721000
2020-12-18T19:08:43
2020-12-18T19:08:43
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.umb.cs681.hw12; public class MultiThread implements Runnable { public void run() { Customer customer = new Customer(new Address("Martin Luther King", "Raleigh", "NC", 27717)); customer.getAddress().change("Ocher St", "Graham", "TX", 89703); customer.setAddress(new Address("Butler St", "New York", "NY", 10929)); System.out.println(customer.getAddress()); } public static void main(String[] args) { MultiThread m1 = new MultiThread(); MultiThread m2 = new MultiThread(); MultiThread m3 = new MultiThread(); MultiThread m4 = new MultiThread(); new Thread(m1).start(); new Thread(m2).start(); new Thread(m3).start(); new Thread(m4).start(); } }
UTF-8
Java
770
java
MultiThread.java
Java
[ { "context": " Customer customer = new Customer(new Address(\"Martin Luther King\", \"Raleigh\", \"NC\", 27717));\n customer.getA", "end": 173, "score": 0.9998937249183655, "start": 155, "tag": "NAME", "value": "Martin Luther King" } ]
null
[]
package edu.umb.cs681.hw12; public class MultiThread implements Runnable { public void run() { Customer customer = new Customer(new Address("<NAME>", "Raleigh", "NC", 27717)); customer.getAddress().change("Ocher St", "Graham", "TX", 89703); customer.setAddress(new Address("Butler St", "New York", "NY", 10929)); System.out.println(customer.getAddress()); } public static void main(String[] args) { MultiThread m1 = new MultiThread(); MultiThread m2 = new MultiThread(); MultiThread m3 = new MultiThread(); MultiThread m4 = new MultiThread(); new Thread(m1).start(); new Thread(m2).start(); new Thread(m3).start(); new Thread(m4).start(); } }
758
0.612987
0.576623
22
34
26.193336
100
false
false
0
0
0
0
0
0
1
false
false
10
8c9438e37ed5545d201a4f0f51561c75443c0894
31,722,628,501,778
2d7c0ebbb085a5528033dcc55d1c3cdf4e53c00f
/src/main/java/com/marqo404/appcys/persistence/RequerimientoDetalleMapper.java
072bfa842b68b09ff5d8031e2de00c1e1ffff1dd
[ "Apache-2.0" ]
permissive
marcolopezpe/appcys
https://github.com/marcolopezpe/appcys
225b5d815cc06e33032b81d82012d8d59a3ac704
3ce17339f19984f33caa321ec1c600122c54290b
refs/heads/master
2021-06-02T20:01:15.200000
2016-09-11T20:46:21
2016-09-11T20:46:21
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.marqo404.appcys.persistence; import java.util.List; import com.marqo404.appcys.domain.RequerimientoDetalle; public interface RequerimientoDetalleMapper { void save(RequerimientoDetalle detalle); void deleteByReqId(Integer reqId); List<RequerimientoDetalle> getListByReqId(Integer reqId); }
UTF-8
Java
315
java
RequerimientoDetalleMapper.java
Java
[]
null
[]
package com.marqo404.appcys.persistence; import java.util.List; import com.marqo404.appcys.domain.RequerimientoDetalle; public interface RequerimientoDetalleMapper { void save(RequerimientoDetalle detalle); void deleteByReqId(Integer reqId); List<RequerimientoDetalle> getListByReqId(Integer reqId); }
315
0.815873
0.796825
15
20
22.22311
58
false
false
0
0
0
0
0
0
0.8
false
false
10
71eb5b4f4a472f57da3a2029f1b8b6a5864afe5c
18,580,028,565,990
37f0d96e9f42b36b18b7036161c5561217c55d97
/smallJavaProjects/Operators/src/com/eftekherhusain/Main.java
0bae6bd78683d949549082d854d1fdb94656b4b3
[]
no_license
ehusain000/Java-Projects
https://github.com/ehusain000/Java-Projects
4c7042a497e9b20bf59bafb5a8fc02ca87fc135c
f35a11d8623747f1dcc5d729a2849711101da0dd
refs/heads/master
2020-04-20T16:22:23.675000
2019-02-13T19:22:50
2019-02-13T19:22:50
168,956,490
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.eftekherhusain; public class Main { public static void main(String[] args) { double firstdouble = 20d; double seconddouble = 80d; double mysum = (firstdouble + seconddouble ) * 25 ; System.out.println( "My Sum is = " + mysum ); double myremainder = mysum % 40; System.out.println("My remainder is = " + myremainder); if (myremainder <= 20){ System.out.println("Total was ove the limit"); } } }
UTF-8
Java
506
java
Main.java
Java
[]
null
[]
package com.eftekherhusain; public class Main { public static void main(String[] args) { double firstdouble = 20d; double seconddouble = 80d; double mysum = (firstdouble + seconddouble ) * 25 ; System.out.println( "My Sum is = " + mysum ); double myremainder = mysum % 40; System.out.println("My remainder is = " + myremainder); if (myremainder <= 20){ System.out.println("Total was ove the limit"); } } }
506
0.56917
0.549407
22
22
22.338308
63
false
false
0
0
0
0
0
0
0.363636
false
false
10
94ccbb8f170b3365fe58ce8e63b2694e1984f408
11,063,835,821,535
877f6d343aae50e0a3bd24088be164ce3191f318
/app/src/main/java/snow/app/ideeleeservice/servicepricing/ServicePricingActivity.java
87ff35aa243eef4a1496894bcb35c584121b9d25
[]
no_license
freelanceapp/IdeeleeService
https://github.com/freelanceapp/IdeeleeService
6b9283a1b6ba78e0689beebfdb2c969cdd87b9a8
94f09ea75a3c261334c3641d8d09645ba4fe943c
refs/heads/master
2020-06-18T07:13:24.958000
2019-07-03T12:39:32
2019-07-03T12:39:32
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package snow.app.ideeleeservice.servicepricing; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; import snow.app.ideeleeservice.R; import snow.app.ideeleeservice.servicepricing.adapter.ActiveServiceAdapter; public class ServicePricingActivity extends AppCompatActivity { @BindView(R.id.service_rv) RecyclerView service_rv; ActiveServiceAdapter activeServiceAdapter; @BindView(R.id.title) TextView title; @BindView(R.id.back) ImageView backbutton1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_service_pricing); ButterKnife.bind(this); service_rv.setLayoutManager(new LinearLayoutManager(this)); ArrayList<String> data = new ArrayList<String>(); data.add("Car Repairing"); data.add("Home Cleaning"); data.add("Electrician"); activeServiceAdapter = new ActiveServiceAdapter(this, data); service_rv.setAdapter(activeServiceAdapter); activeServiceAdapter.notifyDataSetChanged(); backbutton1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); title.setText(getString(R.string.service_pricing)); } }
UTF-8
Java
1,646
java
ServicePricingActivity.java
Java
[]
null
[]
package snow.app.ideeleeservice.servicepricing; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; import snow.app.ideeleeservice.R; import snow.app.ideeleeservice.servicepricing.adapter.ActiveServiceAdapter; public class ServicePricingActivity extends AppCompatActivity { @BindView(R.id.service_rv) RecyclerView service_rv; ActiveServiceAdapter activeServiceAdapter; @BindView(R.id.title) TextView title; @BindView(R.id.back) ImageView backbutton1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_service_pricing); ButterKnife.bind(this); service_rv.setLayoutManager(new LinearLayoutManager(this)); ArrayList<String> data = new ArrayList<String>(); data.add("Car Repairing"); data.add("Home Cleaning"); data.add("Electrician"); activeServiceAdapter = new ActiveServiceAdapter(this, data); service_rv.setAdapter(activeServiceAdapter); activeServiceAdapter.notifyDataSetChanged(); backbutton1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); title.setText(getString(R.string.service_pricing)); } }
1,646
0.727825
0.724787
49
32.591835
21.891121
75
false
false
0
0
0
0
0
0
0.653061
false
false
10
478017fa547b2f06ff37cf164c563bb2789936fa
13,915,694,088,142
166b8320b94dcf5932062b8ac4f90dc353767d39
/core/src/main/java/org/infinispan/factories/AbstractNamedCacheComponentFactory.java
ea7e618d526c4b94bd4e3c0300093757fa400a8c
[ "Apache-2.0" ]
permissive
Cotton-Ben/infinispan
https://github.com/Cotton-Ben/infinispan
87e0caeeba2616dd7eb5a96b896b462ed9de5d67
2ba2d9992cd0018829d9ba0b0d4ba74bab49616b
refs/heads/master
2020-12-31T02:22:26.654000
2014-07-11T16:48:15
2014-07-11T16:48:15
16,557,570
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.infinispan.factories; import org.infinispan.configuration.cache.Configuration; import org.infinispan.factories.annotations.Inject; import org.infinispan.factories.scopes.Scope; import org.infinispan.factories.scopes.Scopes; /** * A component factory for creating components scoped per-cache. * * @author Manik Surtani * @since 4.0 */ @Scope(Scopes.NAMED_CACHE) public abstract class AbstractNamedCacheComponentFactory extends AbstractComponentFactory { protected Configuration configuration; protected ComponentRegistry componentRegistry; @Inject private void injectGlobalDependencies(Configuration configuration, ComponentRegistry componentRegistry) { this.componentRegistry = componentRegistry; this.configuration = configuration; } }
UTF-8
Java
784
java
AbstractNamedCacheComponentFactory.java
Java
[ { "context": "reating components scoped per-cache.\n *\n * @author Manik Surtani\n * @since 4.0\n */\n@Scope(Scopes.NAMED_CACHE)\npubl", "end": 334, "score": 0.9998626708984375, "start": 321, "tag": "NAME", "value": "Manik Surtani" } ]
null
[]
package org.infinispan.factories; import org.infinispan.configuration.cache.Configuration; import org.infinispan.factories.annotations.Inject; import org.infinispan.factories.scopes.Scope; import org.infinispan.factories.scopes.Scopes; /** * A component factory for creating components scoped per-cache. * * @author <NAME> * @since 4.0 */ @Scope(Scopes.NAMED_CACHE) public abstract class AbstractNamedCacheComponentFactory extends AbstractComponentFactory { protected Configuration configuration; protected ComponentRegistry componentRegistry; @Inject private void injectGlobalDependencies(Configuration configuration, ComponentRegistry componentRegistry) { this.componentRegistry = componentRegistry; this.configuration = configuration; } }
777
0.806122
0.803571
24
31.666666
29.343748
108
false
false
0
0
0
0
0
0
0.416667
false
false
10
826f84a822ccb9530ca2de96ee39095e800452e8
14,181,982,070,152
9829ad17a69ab8c96a53fef41c8eefdc1de93c49
/unit_9_ionio/src/test/java/ua/com/alevel/service/AuthorServiceTest.java
7e9a7de62d9a2577a3e1632a8a18cf177b89c60a
[]
no_license
yevhiena/nix-4
https://github.com/yevhiena/nix-4
889c7df08a0f7af92d0504d27b5ba397e372570a
d98b402a1bca71516cae3a4823bc89c2f7148676
refs/heads/main
2023-06-16T17:17:30.951000
2021-07-02T15:34:16
2021-07-02T15:34:16
343,230,679
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ua.com.alevel.service; import com.opencsv.CSVWriter; import org.apache.commons.collections.CollectionUtils; import org.junit.jupiter.api.*; import ua.com.alevel.entity.Author; import ua.com.alevel.entity.Book; import ua.com.alevel.service.impl.AuthorServiceImpl; import ua.com.alevel.service.impl.BookServiceImpl; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.List; @TestMethodOrder(MethodOrderer.OrderAnnotation.class) public class AuthorServiceTest { private static final AuthorService authorService = new AuthorServiceImpl(); private static final BookService bookService = new BookServiceImpl(); private static final String fileAuthors = "src/main/java/ua/com/alevel/db/authors.csv"; private static final String fileBooks = "src/main/java/ua/com/alevel/db/books.csv"; private static final String firstName = "Name"; private static final String lastName = "Surname"; private static final int initialSize = 10; private static final String title = "Title"; @BeforeAll public static void initAuthor() throws IOException { try (CSVWriter writer = new CSVWriter(new FileWriter(fileAuthors))) { String[] header = {"id", "first_name", "last_name", "visible"}; writer.writeNext(header); } try (CSVWriter writer = new CSVWriter(new FileWriter(fileBooks))) { String[] header = {"id", "title", "author_id", "visible"}; writer.writeNext(header); } for (int i = 0; i < initialSize; i++) { String firstName = "Name" + i; String lastName = "Surname" + i; Author author = new Author(); author.setFirstName(firstName); author.setLastName(lastName); authorService.create(author); } Assertions.assertTrue(CollectionUtils.isNotEmpty(authorService.read())); } @Test @Order(1) public void readAll() { List<Author> authors = authorService.read(); Assertions.assertTrue(CollectionUtils.isNotEmpty(authors)); Assertions.assertEquals(initialSize, authors.size()); } @Test @Order(2) public void createAuthor() { int previous = authorService.read().size(); Author author = new Author(); author.setFirstName(firstName); author.setLastName(lastName); authorService.create(author); author = authorService.findAuthorByName(firstName, lastName); int last = authorService.read().size(); Assertions.assertNotNull(author); Assertions.assertEquals(previous + 1, last); } @Test @Order(3) public void readAuthorById() { int authorId = authorService.findAuthorByName(firstName, lastName).getId(); Author author = authorService.read(authorId); Assertions.assertEquals(firstName, author.getFirstName()); Assertions.assertEquals(lastName, author.getLastName()); } @Test @Order(4) public void findAuthorByName(){ Author author = authorService.findAuthorByName(firstName, lastName); Assertions.assertNotNull(author); Assertions.assertEquals(firstName, author.getFirstName()); Assertions.assertEquals(lastName, author.getLastName()); } @Test @Order(5) public void readAuthorsByBook(){ Author author = authorService.findAuthorByName(firstName, lastName); List<Author> authors = new ArrayList<>(); authors.add(author); List<Integer> authorId = new ArrayList<>(); authorId.add(author.getId()); Book book = new Book(); book.setTitle(title); book.setAuthorId(authorId); bookService.create(book); book = bookService.findBookByName(title); Assertions.assertEquals(authorService.readAuthorsByBook(book.getId()).size(), 1); Assertions.assertEquals(authors, authorService.readAuthorsByBook(book.getId())); } @Test @Order(6) public void existAuthor(){ int authorId = authorService.findAuthorByName(firstName, lastName).getId(); Assertions.assertTrue(authorService.exist(authorId)); } @Test @Order(7) public void updateAuthor() { int authorId = 1; Author authorInDB = authorService.read(authorId); String updName = lastName + " updated"; authorInDB.setLastName(updName); authorService.update(authorInDB); authorInDB = authorService.read(authorId); Assertions.assertEquals(updName, authorInDB.getLastName()); } @Test @Order(8) public void deleteAuthor(){ int previous = authorService.read().size(); Author author = authorService.findAuthorByName(firstName, lastName); authorService.delete(author.getId()); author = authorService.findAuthorByName(firstName, lastName); int last = authorService.read().size(); Assertions.assertNull(author); Assertions.assertEquals(previous - 1, last); } @AfterAll static void cleanList() throws IOException { try (CSVWriter writer = new CSVWriter(new FileWriter(fileAuthors))) { String[] header = {"id", "first_name", "last_name", "visible"}; writer.writeNext(header); } try (CSVWriter writer = new CSVWriter(new FileWriter(fileBooks))) { String[] header = {"id", "title", "author_id", "visible"}; writer.writeNext(header); } Assertions.assertEquals(0, authorService.read().size()); Assertions.assertEquals(0, bookService.read().size()); } }
UTF-8
Java
5,677
java
AuthorServiceTest.java
Java
[ { "context": "sv\";\n private static final String firstName = \"Name\";\n private static final String lastName = \"Sur", "end": 903, "score": 0.9782981276512146, "start": 899, "tag": "NAME", "value": "Name" }, { "context": "ame\";\n private static final String lastName = \"Surname\";\n private static final int initialSize = 10;\n", "end": 957, "score": 0.9855833053588867, "start": 950, "tag": "NAME", "value": "Surname" }, { "context": "rService.read(authorId);\n\n String updName = lastName + \" updated\";\n authorInDB.setLastName(updN", "end": 4400, "score": 0.6405063271522522, "start": 4392, "tag": "NAME", "value": "lastName" }, { "context": " Author author = authorService.findAuthorByName(firstName, lastName);\n authorService.delete(author.g", "end": 4801, "score": 0.5983641743659973, "start": 4792, "tag": "NAME", "value": "firstName" } ]
null
[]
package ua.com.alevel.service; import com.opencsv.CSVWriter; import org.apache.commons.collections.CollectionUtils; import org.junit.jupiter.api.*; import ua.com.alevel.entity.Author; import ua.com.alevel.entity.Book; import ua.com.alevel.service.impl.AuthorServiceImpl; import ua.com.alevel.service.impl.BookServiceImpl; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.List; @TestMethodOrder(MethodOrderer.OrderAnnotation.class) public class AuthorServiceTest { private static final AuthorService authorService = new AuthorServiceImpl(); private static final BookService bookService = new BookServiceImpl(); private static final String fileAuthors = "src/main/java/ua/com/alevel/db/authors.csv"; private static final String fileBooks = "src/main/java/ua/com/alevel/db/books.csv"; private static final String firstName = "Name"; private static final String lastName = "Surname"; private static final int initialSize = 10; private static final String title = "Title"; @BeforeAll public static void initAuthor() throws IOException { try (CSVWriter writer = new CSVWriter(new FileWriter(fileAuthors))) { String[] header = {"id", "first_name", "last_name", "visible"}; writer.writeNext(header); } try (CSVWriter writer = new CSVWriter(new FileWriter(fileBooks))) { String[] header = {"id", "title", "author_id", "visible"}; writer.writeNext(header); } for (int i = 0; i < initialSize; i++) { String firstName = "Name" + i; String lastName = "Surname" + i; Author author = new Author(); author.setFirstName(firstName); author.setLastName(lastName); authorService.create(author); } Assertions.assertTrue(CollectionUtils.isNotEmpty(authorService.read())); } @Test @Order(1) public void readAll() { List<Author> authors = authorService.read(); Assertions.assertTrue(CollectionUtils.isNotEmpty(authors)); Assertions.assertEquals(initialSize, authors.size()); } @Test @Order(2) public void createAuthor() { int previous = authorService.read().size(); Author author = new Author(); author.setFirstName(firstName); author.setLastName(lastName); authorService.create(author); author = authorService.findAuthorByName(firstName, lastName); int last = authorService.read().size(); Assertions.assertNotNull(author); Assertions.assertEquals(previous + 1, last); } @Test @Order(3) public void readAuthorById() { int authorId = authorService.findAuthorByName(firstName, lastName).getId(); Author author = authorService.read(authorId); Assertions.assertEquals(firstName, author.getFirstName()); Assertions.assertEquals(lastName, author.getLastName()); } @Test @Order(4) public void findAuthorByName(){ Author author = authorService.findAuthorByName(firstName, lastName); Assertions.assertNotNull(author); Assertions.assertEquals(firstName, author.getFirstName()); Assertions.assertEquals(lastName, author.getLastName()); } @Test @Order(5) public void readAuthorsByBook(){ Author author = authorService.findAuthorByName(firstName, lastName); List<Author> authors = new ArrayList<>(); authors.add(author); List<Integer> authorId = new ArrayList<>(); authorId.add(author.getId()); Book book = new Book(); book.setTitle(title); book.setAuthorId(authorId); bookService.create(book); book = bookService.findBookByName(title); Assertions.assertEquals(authorService.readAuthorsByBook(book.getId()).size(), 1); Assertions.assertEquals(authors, authorService.readAuthorsByBook(book.getId())); } @Test @Order(6) public void existAuthor(){ int authorId = authorService.findAuthorByName(firstName, lastName).getId(); Assertions.assertTrue(authorService.exist(authorId)); } @Test @Order(7) public void updateAuthor() { int authorId = 1; Author authorInDB = authorService.read(authorId); String updName = lastName + " updated"; authorInDB.setLastName(updName); authorService.update(authorInDB); authorInDB = authorService.read(authorId); Assertions.assertEquals(updName, authorInDB.getLastName()); } @Test @Order(8) public void deleteAuthor(){ int previous = authorService.read().size(); Author author = authorService.findAuthorByName(firstName, lastName); authorService.delete(author.getId()); author = authorService.findAuthorByName(firstName, lastName); int last = authorService.read().size(); Assertions.assertNull(author); Assertions.assertEquals(previous - 1, last); } @AfterAll static void cleanList() throws IOException { try (CSVWriter writer = new CSVWriter(new FileWriter(fileAuthors))) { String[] header = {"id", "first_name", "last_name", "visible"}; writer.writeNext(header); } try (CSVWriter writer = new CSVWriter(new FileWriter(fileBooks))) { String[] header = {"id", "title", "author_id", "visible"}; writer.writeNext(header); } Assertions.assertEquals(0, authorService.read().size()); Assertions.assertEquals(0, bookService.read().size()); } }
5,677
0.653162
0.650167
183
30.021858
27.026188
91
false
false
0
0
0
0
0
0
0.644809
false
false
10
60b87fbecbd81b861d692b3a4e24d6382ad2b248
19,061,064,904,360
c1d0e265e22d55c92a9197a19624d87c43b495c6
/src/java/com/sinesection/logisticraft/container/BucketResultSlot.java
e61b7495cc3429d9ee81d28803d53b446b0e9053
[]
no_license
geekman9097/Logisticraft-1.07.10
https://github.com/geekman9097/Logisticraft-1.07.10
a6d2b1fa4556c0867485a2bff5c5353d1eb6d947
d728287ac1714e51730711b1142aff2cb795c012
refs/heads/master
2021-05-14T00:15:18.096000
2018-08-01T15:07:36
2018-08-01T15:07:36
116,536,513
0
0
null
false
2018-08-07T13:44:40
2018-01-07T04:12:26
2018-08-01T15:07:43
2018-08-07T13:44:40
4,820
0
0
0
HTML
false
null
package com.sinesection.logisticraft.container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class BucketResultSlot extends Slot { public BucketResultSlot(IInventory inventory, int slot, int x, int y) { super(inventory, slot, x, y); } @Override public boolean isItemValid(ItemStack stack) { return false; } }
UTF-8
Java
421
java
BucketResultSlot.java
Java
[]
null
[]
package com.sinesection.logisticraft.container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class BucketResultSlot extends Slot { public BucketResultSlot(IInventory inventory, int slot, int x, int y) { super(inventory, slot, x, y); } @Override public boolean isItemValid(ItemStack stack) { return false; } }
421
0.741093
0.741093
18
21.388889
22.188934
72
false
false
0
0
0
0
0
0
1.222222
false
false
10
9f106eda8c7a5d8596fe31c8c400102f5c7bdb87
24,326,694,820,530
791ce15facf99c3e93a5975a55fa41670eda2cd2
/src/com/rubaanxd/arrays/Operaciones.java
5f2dc071f712ec04489953c6475107e6fa0519f3
[]
no_license
Rubaanxd/BibliotecaRubaanxD
https://github.com/Rubaanxd/BibliotecaRubaanxD
acfdd151ac0e94fb4275e45f3e8a63b2f0ac87ec
a3adc371404b4b8806e5bc54a53fd674ad0f7d5f
refs/heads/master
2020-09-16T18:03:03.367000
2020-02-21T16:16:41
2020-02-21T16:16:41
223,847,240
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rubaanxd.arrays; /** * Operaciones * Clase para hacer Operaciones Aritmeticas en consola tipos de Arrays * <p> * @author RubaanxD * @version 1.0 * @since 2019 */ public class Operaciones { /** * Suma todos los enteros de un array * * @param array Array que queremos sumar * @return Resultado de la suma */ public static int sumaArray(int array[]) { int suma = 0; for (int i = 0; i < array.length; i++) { suma += array[i]; } return suma; } /** * Suma todos los enteros largos de un array * * @param array Array que queremos sumar * @return Resultado de la suma */ public static long sumaArray(long array[]) { long suma = 0; for (int i = 0; i < array.length; i++) { suma += array[i]; } return suma; } /** * Suma todos los doubles en un array * * @param array Array que queremos sumar * @return Resultado de la suma */ public static double sumaArray(double array[]) { double suma = 0; for (int i = 0; i < array.length; i++) { suma += array[i]; } return suma; } /** * Devuelve la media de todos los numeros enteros de un array * * @param array Array que queremos hacer la media * @return Resultado de la media */ public static double mediaArray(int array[]) { int suma = sumaArray(array); return suma / array.length; } /** * Devuelve la media de todos los numeros reales de un array * * @param array Array que queremos hacer la media * @return Resultado de la media */ public static double mediaArray(double array[]) { double suma = sumaArray(array); return suma / array.length; } /** * Devuelve la media de todos los numeros largos de un array * * @param array Array que queremos hacer la media * @return Resultado de la media */ public static long mediaArray(long array[]) { long suma = sumaArray(array); return suma / array.length; } }
UTF-8
Java
2,176
java
Operaciones.java
Java
[ { "context": "ticas en consola tipos de Arrays\n * <p>\n * @author RubaanxD\n * @version 1.0\n * @since 2019\n */\npublic class O", "end": 146, "score": 0.9877617955207825, "start": 138, "tag": "USERNAME", "value": "RubaanxD" } ]
null
[]
package com.rubaanxd.arrays; /** * Operaciones * Clase para hacer Operaciones Aritmeticas en consola tipos de Arrays * <p> * @author RubaanxD * @version 1.0 * @since 2019 */ public class Operaciones { /** * Suma todos los enteros de un array * * @param array Array que queremos sumar * @return Resultado de la suma */ public static int sumaArray(int array[]) { int suma = 0; for (int i = 0; i < array.length; i++) { suma += array[i]; } return suma; } /** * Suma todos los enteros largos de un array * * @param array Array que queremos sumar * @return Resultado de la suma */ public static long sumaArray(long array[]) { long suma = 0; for (int i = 0; i < array.length; i++) { suma += array[i]; } return suma; } /** * Suma todos los doubles en un array * * @param array Array que queremos sumar * @return Resultado de la suma */ public static double sumaArray(double array[]) { double suma = 0; for (int i = 0; i < array.length; i++) { suma += array[i]; } return suma; } /** * Devuelve la media de todos los numeros enteros de un array * * @param array Array que queremos hacer la media * @return Resultado de la media */ public static double mediaArray(int array[]) { int suma = sumaArray(array); return suma / array.length; } /** * Devuelve la media de todos los numeros reales de un array * * @param array Array que queremos hacer la media * @return Resultado de la media */ public static double mediaArray(double array[]) { double suma = sumaArray(array); return suma / array.length; } /** * Devuelve la media de todos los numeros largos de un array * * @param array Array que queremos hacer la media * @return Resultado de la media */ public static long mediaArray(long array[]) { long suma = sumaArray(array); return suma / array.length; } }
2,176
0.56204
0.556526
100
20.76
20.050995
70
false
false
0
0
0
0
0
0
0.22
false
false
10
1e1443b452383171d510dde7f83fcc25f09ed056
29,901,562,348,868
9b01776330a8d85cb82a1845eae4e32d5646850d
/service/service-edu/src/main/java/com/atguigu/edu_service/feign/fallback/VodFileDegradeFeignClient.java
4c0d38148907aa0cff1427dbfe918577d2f7f0d5
[]
no_license
Marce-Ling/guli-parent
https://github.com/Marce-Ling/guli-parent
bd881b1641929b27650c4cd997d1257e1849cc72
a060ea0a6786bd1348bfc399518daed2af937f39
refs/heads/master
2023-02-08T22:12:22.594000
2020-12-18T03:13:22
2020-12-18T03:13:22
320,201,007
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.atguigu.edu_service.feign.fallback; import com.atguigu.common_utils.R; import com.atguigu.edu_service.feign.VoDClient; import org.springframework.stereotype.Component; import java.util.List; /** * @Author Administrator * @CreateTime 2020-11-29 * @Description */ @Component public class VodFileDegradeFeignClient implements VoDClient { @Override public R removeById(String id) { return R.error().message("time out"); } @Override public R removeByIdList(List<String> videoIdList) { return R.error().message("time out"); } }
UTF-8
Java
582
java
VodFileDegradeFeignClient.java
Java
[ { "context": "Component;\n\nimport java.util.List;\n\n/**\n * @Author Administrator\n * @CreateTime 2020-11-29\n * @Description\n */\n@Co", "end": 234, "score": 0.8230099081993103, "start": 221, "tag": "NAME", "value": "Administrator" } ]
null
[]
package com.atguigu.edu_service.feign.fallback; import com.atguigu.common_utils.R; import com.atguigu.edu_service.feign.VoDClient; import org.springframework.stereotype.Component; import java.util.List; /** * @Author Administrator * @CreateTime 2020-11-29 * @Description */ @Component public class VodFileDegradeFeignClient implements VoDClient { @Override public R removeById(String id) { return R.error().message("time out"); } @Override public R removeByIdList(List<String> videoIdList) { return R.error().message("time out"); } }
582
0.714777
0.701031
25
22.280001
19.977026
61
false
false
0
0
0
0
0
0
0.28
false
false
10
88e4c156da7f488344796ed48f5c035dfd0d49a6
36,086,315,233,300
f84d988e162125846b9bcafa596dfc1eadc6c3a4
/src/main/java/com/epta/service/FieldService.java
f44242b8c0510366680262f501ae214748b3af20
[]
no_license
GlowingRuby/epta
https://github.com/GlowingRuby/epta
97782d3dc5f283d8cb0c8fd560d1ae6452a877e0
7279233bf928059dbed8c6f3c91e43a5566fb76c
refs/heads/master
2018-09-26T10:32:37.605000
2018-06-20T13:13:29
2018-06-20T13:13:29
106,297,180
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.epta.service; import com.epta.common.PageResultInfo; import com.epta.model.Field; import com.github.pagehelper.PageInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; /** * Created by Administrator on 2017/6/20 0020. */ @Service public class FieldService extends ResultBaseService<Field> { private static final Logger logger = LoggerFactory.getLogger(FieldService.class); public PageResultInfo queryList(int page, int limit) { try { PageInfo<Field> pageInfo = queryPageListByWhere(null, page, limit); return PageResultInfo.buildSuccess(pageInfo.getTotal(), pageInfo.getList()); } catch (Exception e) { logger.error("queryList fail", e); return PageResultInfo.buildFail("查询失败"); } } }
UTF-8
Java
853
java
FieldService.java
Java
[ { "context": "ngframework.stereotype.Service;\n\n/**\n * Created by Administrator on 2017/6/20 0020.\n */\n@Service\npublic class Fiel", "end": 270, "score": 0.5358313918113708, "start": 257, "tag": "USERNAME", "value": "Administrator" } ]
null
[]
package com.epta.service; import com.epta.common.PageResultInfo; import com.epta.model.Field; import com.github.pagehelper.PageInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; /** * Created by Administrator on 2017/6/20 0020. */ @Service public class FieldService extends ResultBaseService<Field> { private static final Logger logger = LoggerFactory.getLogger(FieldService.class); public PageResultInfo queryList(int page, int limit) { try { PageInfo<Field> pageInfo = queryPageListByWhere(null, page, limit); return PageResultInfo.buildSuccess(pageInfo.getTotal(), pageInfo.getList()); } catch (Exception e) { logger.error("queryList fail", e); return PageResultInfo.buildFail("查询失败"); } } }
853
0.707692
0.692308
28
29.178572
27.084595
88
false
false
0
0
0
0
0
0
0.607143
false
false
10
32f4c83a077cfb1d46c701a9104fb9d8eb9813e3
16,011,638,083,152
79675610f82378100f0e7c967c5c8fe5ec1812cd
/src/com/tellyouiam/string/stringbuffer/Docs.java
e8cad2463cbdd65193bb205b9daf70a451d651fb
[]
no_license
hophiducanh/a-littlebit-about-java
https://github.com/hophiducanh/a-littlebit-about-java
20700e3df493114e555a954b86da9a2a28842480
c9fc97e1b7560c4bf1f905e55aa2c31cc49812a1
refs/heads/master
2020-05-05T07:14:13.087000
2020-04-22T16:21:08
2020-04-22T16:21:08
179,818,154
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tellyouiam.string.stringbuffer; /** * String là Immutable không thay đổi được, nhưng java hỗ trợ StringBuilder và StringBuffer để thay đổi mà không * ảnh hưởng đến hiệu năng ứng dụng (StringBuffer và StringBuilder là MUTABLE) * */ public class Docs { }
UTF-8
Java
310
java
Docs.java
Java
[]
null
[]
package com.tellyouiam.string.stringbuffer; /** * String là Immutable không thay đổi được, nhưng java hỗ trợ StringBuilder và StringBuffer để thay đổi mà không * ảnh hưởng đến hiệu năng ứng dụng (StringBuffer và StringBuilder là MUTABLE) * */ public class Docs { }
310
0.759259
0.759259
9
29
38.447655
112
false
false
0
0
0
0
0
0
0.222222
false
false
10
7d237b4a6041bd144bba967a453a365853cb320f
16,535,624,148,155
5617ac04441fe25df9fba6ff28a03da960342dd3
/src/Golovach_courses/Lection20/CircleThatFigure.java
3b0875040632d6c8d9d4533bc57f0fbb14c83ebe
[]
no_license
alek5andrgromov/Java_project
https://github.com/alek5andrgromov/Java_project
b20aaed376ae23945c49ea4c7b5ec141685ef471
a016a42a2520d33f2484611ca8e5a8b95452bea8
refs/heads/master
2020-12-25T22:30:27.983000
2016-08-21T05:22:51
2016-08-21T05:22:51
63,353,813
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Golovach_courses.Lection20; /** * Created by rockx5g on 13.08.16. */ public class CircleThatFigure implements Figure{ private final double radius; public CircleThatFigure(double radius) { this.radius = radius; } public double getRadius() { return radius; } }
UTF-8
Java
308
java
CircleThatFigure.java
Java
[ { "context": "age Golovach_courses.Lection20;\n\n/**\n * Created by rockx5g on 13.08.16.\n */\npublic class CircleThatFigure im", "end": 62, "score": 0.9995008707046509, "start": 55, "tag": "USERNAME", "value": "rockx5g" } ]
null
[]
package Golovach_courses.Lection20; /** * Created by rockx5g on 13.08.16. */ public class CircleThatFigure implements Figure{ private final double radius; public CircleThatFigure(double radius) { this.radius = radius; } public double getRadius() { return radius; } }
308
0.665584
0.636364
16
18.25
17.086178
48
false
false
0
0
0
0
0
0
0.25
false
false
10
b8e6ec661ba85bc9f107aad12cd471f45d395b23
1,967,095,027,349
854d8f0c593f53e059cfc597397cf5f03b8ab8f6
/Snipeware/Client.java
8e3e5aac5299247de928f7fd23d014373dade79a
[]
no_license
5l1v3r1/Snipeware
https://github.com/5l1v3r1/Snipeware
b9fa2a394b7ca387bc4b130b3038fc49f3f94086
9ae527cf66c99ddc7e415d97ea00ae2cde0c2557
refs/heads/main
2023-08-22T20:26:19.497000
2021-10-15T22:29:34
2021-10-15T22:29:34
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Snipeware; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.lang.management.ManagementFactory; import java.net.URI; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; import javax.swing.JOptionPane; import org.apache.commons.lang3.SystemUtils; import com.thealtening.AltService; import Snipeware.api.annotations.Handler; import Snipeware.api.bus.Bus; import Snipeware.api.bus.BusImpl; import Snipeware.command.Command; import Snipeware.events.Event; import Snipeware.events.player.EventKeyPress; import Snipeware.events.player.EventSendMessage; import Snipeware.gui.alt.system.AccountManager; import Snipeware.hwid.NoStackTraceThrowable; import Snipeware.management.CommandManager; import Snipeware.management.ConfigManager; import Snipeware.management.FontManager; import Snipeware.management.ModuleManager; import Snipeware.security.Util; import net.arikia.dev.drpc.DiscordRPC; import net.minecraft.client.Minecraft; import net.minecraft.network.play.client.C21CandidateSalvationPacket; import net.minecraft.server.integrated.IntegratedServer; public enum Client { INSTANCE; public DiscordRP discordRP = new DiscordRP(); private ModuleManager moduleManager; private Bus<Event> eventapi; public String user = ""; private FontManager fontManager; private AccountManager accountManager; private AltService altService = new AltService(); private File directory; private File configDirectory; private CommandManager commandManager; private ConfigManager configManager; private File dataFile; public static String build = "1.03"; public static List<String> hwidList = new ArrayList<>(); public static final String HWID_URL = "https://pastebin.com/raw/QYeNr1g3"; public static boolean nigger = true; public static String DID = null; public static final String verificationstring = setup(); public static boolean nomeaningbool = false; public static final List<String> launchArgs = ManagementFactory.getRuntimeMXBean().getInputArguments(); public static final char[] iloveyou = sex(); public static URI wtf; public static BufferedReader halal; public static final Client getInstance(){ return INSTANCE; } static { try { ProcessBuilder processBuilder = new ProcessBuilder(); processBuilder.command("tasklist.exe"); Process process = processBuilder.start(); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); halal = reader; }catch(Exception e) { } wtf pogy = () -> new Snipeware.security.AntiDebug(); pogy.omg(); } try { wtf = new URI(Util.stringify(Client.iloveyou)); }catch(Exception e) { e.printStackTrace(); } } public static void copyToClipboard(String s) { StringSelection selection = new StringSelection(s); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(selection, selection); } private static String setup() { if(SystemUtils.IS_OS_WINDOWS) { return INetHandlerNiggerToServer.getID(); }else { return getHWID(); } } private static char[] sex(){ return INetHandlerNiggerToServer.sex2(); } public void start() { String hwidstorage = verificationstring; try { wtf = new URI(Util.stringify(Client.iloveyou)); }catch(Exception e) { e.printStackTrace(); } System.out.println("[HWID Reminder] Your HWID is "+hwidstorage); System.out.println("[Snipeware] Please wait while we verify you..."); copyToClipboard(hwidstorage); startAuth(); prepare(); if(nigger) { copyToClipboard(hwidstorage); stop(); } } public void prepare() { directory = new File(Minecraft.getMinecraft().mcDataDir, "Snipeware"); configDirectory = new File(directory, "configs"); if (!directory.exists()) { directory.mkdir(); } if (!configDirectory.exists()) { configDirectory.mkdir(); } dataFile = new File(directory, "modules.txt"); eventapi = new BusImpl<Event>(); moduleManager = new ModuleManager(); configManager = new ConfigManager(); commandManager = new CommandManager(); fontManager = new FontManager(); accountManager = new AccountManager(directory); configManager.loadConfigs(); moduleManager.loadModules(dataFile); eventapi.register(this); nigger = false; if(nigger) { copyToClipboard(verificationstring); stop(); } } /* public void judenschweincheck() { // Seconf form of HWID protection, disabled as we already have one - Napoleon ZoomberParts hwidList = NetworkUtil.getHWIDList(); if (!hwidList.contains(HWIDUtil.getEncryptedHWID(KEY))) { FrameUtil.Display(); throw new NoStackTraceThrowable("Verify HWID Failed!"); // HWID Failure is haram in many ways than one } } */ public ConfigManager getConfigManager() { return configManager; } public void stop() { try { Minecraft.discordRP.shutdown(); accountManager.save(); if (!dataFile.exists()) { dataFile.createNewFile(); } moduleManager.saveModules(dataFile); eventapi.unregister(this); Minecraft.stopIntegratedServer(); }catch(Exception e){ System.out.println("Error while saving config"); } // Do you has the drip my nigga Koljan? - Napoleon ZoomberParts } public static String getHWID() { try{ String toEncrypt = System.getenv("COMPUTERNAME") + System.getProperty("user.name") + System.getenv("PROCESSOR_IDENTIFIER") + System.getenv("PROCESSOR_LEVEL"); MessageDigest md = MessageDigest.getInstance("MD5"); md.update(toEncrypt.getBytes()); StringBuffer hexString = new StringBuffer(); byte byteData[] = md.digest(); for (byte aByteData : byteData) { String hex = Integer.toHexString(0xff & aByteData); if (hex.length() == 1) hexString.append('0'); hexString.append(hex); } return hexString.toString(); } catch (Exception e) { e.printStackTrace(); return "Error"; } } public void forceStop() { stop(); System.out.println("A horny femboy (owo) with a massive cock is approaching your current geographical location, you better run while you still can."); System.exit(0); } //fuck you napoleon removed that shit :kek: @Handler public void onKeyPress(final EventKeyPress event) { moduleManager.getModules().stream().filter(module -> module.getKey() == event.getKey()).forEach(module -> module.toggle()); } private void startAuth() { new Thread(()->{ if(INetHandlerNiggerToServer.whitelisted(Client.verificationstring)) { System.out.println("Welcome, your HWID has been Authenticated. NapoliHWID protection, Leaking jar = I will find you jew."); Client.nomeaningbool = false; //nigger = false; }else{ System.out.println("JUDENSCHWEIN DETECTED, ENGAGE HYDRA LOCKING PROTOCOLS." + INetHandlerNiggerToServer.getID()); C21CandidateSalvationPacket.Display(); // wtf men how hydra get into src - Napoleon ZoomberParts } }, "Main").start(); } @Handler public void onSendMessage(final EventSendMessage eventChat) { for (final Command command : commandManager.getComands()) { String chatMessage = eventChat.getMessage(); String formattedMessage = chatMessage.replace(".", ""); String[] regexFormattedMessage = formattedMessage.split(" "); if (regexFormattedMessage[0].equalsIgnoreCase(command.getCommandName())) { ArrayList<String> list = new ArrayList<>(Arrays.asList(regexFormattedMessage)); list.remove(command.getCommandName()); regexFormattedMessage = list.toArray(new String[0]); command.executeCommand(regexFormattedMessage); } } if (eventChat.getMessage().startsWith(".")) { eventChat.setCancelled(true); } } public ModuleManager getModuleManager() { return moduleManager; } public Bus getEventManager() { return eventapi; } public DiscordRP getDiscordRP(){ return discordRP; } public FontManager getFontManager() { return fontManager; } public AccountManager getAccountManager() { return accountManager; } public void switchToMojang() { try { altService.switchService(AltService.EnumAltService.MOJANG); } catch (NoSuchFieldException | IllegalAccessException e) { System.out.println("Couldnt switch to modank altservice"); } } public void switchToTheAltening() { try { altService.switchService(AltService.EnumAltService.THEALTENING); } catch (NoSuchFieldException | IllegalAccessException e) { System.out.println("Couldnt switch to altening altservice"); } } public File getConfigDirectory() { return configDirectory; } public File getDirectory() { return directory; } } interface wtf { void omg(); }
UTF-8
Java
9,485
java
Client.java
Java
[]
null
[]
package Snipeware; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.lang.management.ManagementFactory; import java.net.URI; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; import javax.swing.JOptionPane; import org.apache.commons.lang3.SystemUtils; import com.thealtening.AltService; import Snipeware.api.annotations.Handler; import Snipeware.api.bus.Bus; import Snipeware.api.bus.BusImpl; import Snipeware.command.Command; import Snipeware.events.Event; import Snipeware.events.player.EventKeyPress; import Snipeware.events.player.EventSendMessage; import Snipeware.gui.alt.system.AccountManager; import Snipeware.hwid.NoStackTraceThrowable; import Snipeware.management.CommandManager; import Snipeware.management.ConfigManager; import Snipeware.management.FontManager; import Snipeware.management.ModuleManager; import Snipeware.security.Util; import net.arikia.dev.drpc.DiscordRPC; import net.minecraft.client.Minecraft; import net.minecraft.network.play.client.C21CandidateSalvationPacket; import net.minecraft.server.integrated.IntegratedServer; public enum Client { INSTANCE; public DiscordRP discordRP = new DiscordRP(); private ModuleManager moduleManager; private Bus<Event> eventapi; public String user = ""; private FontManager fontManager; private AccountManager accountManager; private AltService altService = new AltService(); private File directory; private File configDirectory; private CommandManager commandManager; private ConfigManager configManager; private File dataFile; public static String build = "1.03"; public static List<String> hwidList = new ArrayList<>(); public static final String HWID_URL = "https://pastebin.com/raw/QYeNr1g3"; public static boolean nigger = true; public static String DID = null; public static final String verificationstring = setup(); public static boolean nomeaningbool = false; public static final List<String> launchArgs = ManagementFactory.getRuntimeMXBean().getInputArguments(); public static final char[] iloveyou = sex(); public static URI wtf; public static BufferedReader halal; public static final Client getInstance(){ return INSTANCE; } static { try { ProcessBuilder processBuilder = new ProcessBuilder(); processBuilder.command("tasklist.exe"); Process process = processBuilder.start(); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); halal = reader; }catch(Exception e) { } wtf pogy = () -> new Snipeware.security.AntiDebug(); pogy.omg(); } try { wtf = new URI(Util.stringify(Client.iloveyou)); }catch(Exception e) { e.printStackTrace(); } } public static void copyToClipboard(String s) { StringSelection selection = new StringSelection(s); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(selection, selection); } private static String setup() { if(SystemUtils.IS_OS_WINDOWS) { return INetHandlerNiggerToServer.getID(); }else { return getHWID(); } } private static char[] sex(){ return INetHandlerNiggerToServer.sex2(); } public void start() { String hwidstorage = verificationstring; try { wtf = new URI(Util.stringify(Client.iloveyou)); }catch(Exception e) { e.printStackTrace(); } System.out.println("[HWID Reminder] Your HWID is "+hwidstorage); System.out.println("[Snipeware] Please wait while we verify you..."); copyToClipboard(hwidstorage); startAuth(); prepare(); if(nigger) { copyToClipboard(hwidstorage); stop(); } } public void prepare() { directory = new File(Minecraft.getMinecraft().mcDataDir, "Snipeware"); configDirectory = new File(directory, "configs"); if (!directory.exists()) { directory.mkdir(); } if (!configDirectory.exists()) { configDirectory.mkdir(); } dataFile = new File(directory, "modules.txt"); eventapi = new BusImpl<Event>(); moduleManager = new ModuleManager(); configManager = new ConfigManager(); commandManager = new CommandManager(); fontManager = new FontManager(); accountManager = new AccountManager(directory); configManager.loadConfigs(); moduleManager.loadModules(dataFile); eventapi.register(this); nigger = false; if(nigger) { copyToClipboard(verificationstring); stop(); } } /* public void judenschweincheck() { // Seconf form of HWID protection, disabled as we already have one - Napoleon ZoomberParts hwidList = NetworkUtil.getHWIDList(); if (!hwidList.contains(HWIDUtil.getEncryptedHWID(KEY))) { FrameUtil.Display(); throw new NoStackTraceThrowable("Verify HWID Failed!"); // HWID Failure is haram in many ways than one } } */ public ConfigManager getConfigManager() { return configManager; } public void stop() { try { Minecraft.discordRP.shutdown(); accountManager.save(); if (!dataFile.exists()) { dataFile.createNewFile(); } moduleManager.saveModules(dataFile); eventapi.unregister(this); Minecraft.stopIntegratedServer(); }catch(Exception e){ System.out.println("Error while saving config"); } // Do you has the drip my nigga Koljan? - Napoleon ZoomberParts } public static String getHWID() { try{ String toEncrypt = System.getenv("COMPUTERNAME") + System.getProperty("user.name") + System.getenv("PROCESSOR_IDENTIFIER") + System.getenv("PROCESSOR_LEVEL"); MessageDigest md = MessageDigest.getInstance("MD5"); md.update(toEncrypt.getBytes()); StringBuffer hexString = new StringBuffer(); byte byteData[] = md.digest(); for (byte aByteData : byteData) { String hex = Integer.toHexString(0xff & aByteData); if (hex.length() == 1) hexString.append('0'); hexString.append(hex); } return hexString.toString(); } catch (Exception e) { e.printStackTrace(); return "Error"; } } public void forceStop() { stop(); System.out.println("A horny femboy (owo) with a massive cock is approaching your current geographical location, you better run while you still can."); System.exit(0); } //fuck you napoleon removed that shit :kek: @Handler public void onKeyPress(final EventKeyPress event) { moduleManager.getModules().stream().filter(module -> module.getKey() == event.getKey()).forEach(module -> module.toggle()); } private void startAuth() { new Thread(()->{ if(INetHandlerNiggerToServer.whitelisted(Client.verificationstring)) { System.out.println("Welcome, your HWID has been Authenticated. NapoliHWID protection, Leaking jar = I will find you jew."); Client.nomeaningbool = false; //nigger = false; }else{ System.out.println("JUDENSCHWEIN DETECTED, ENGAGE HYDRA LOCKING PROTOCOLS." + INetHandlerNiggerToServer.getID()); C21CandidateSalvationPacket.Display(); // wtf men how hydra get into src - Napoleon ZoomberParts } }, "Main").start(); } @Handler public void onSendMessage(final EventSendMessage eventChat) { for (final Command command : commandManager.getComands()) { String chatMessage = eventChat.getMessage(); String formattedMessage = chatMessage.replace(".", ""); String[] regexFormattedMessage = formattedMessage.split(" "); if (regexFormattedMessage[0].equalsIgnoreCase(command.getCommandName())) { ArrayList<String> list = new ArrayList<>(Arrays.asList(regexFormattedMessage)); list.remove(command.getCommandName()); regexFormattedMessage = list.toArray(new String[0]); command.executeCommand(regexFormattedMessage); } } if (eventChat.getMessage().startsWith(".")) { eventChat.setCancelled(true); } } public ModuleManager getModuleManager() { return moduleManager; } public Bus getEventManager() { return eventapi; } public DiscordRP getDiscordRP(){ return discordRP; } public FontManager getFontManager() { return fontManager; } public AccountManager getAccountManager() { return accountManager; } public void switchToMojang() { try { altService.switchService(AltService.EnumAltService.MOJANG); } catch (NoSuchFieldException | IllegalAccessException e) { System.out.println("Couldnt switch to modank altservice"); } } public void switchToTheAltening() { try { altService.switchService(AltService.EnumAltService.THEALTENING); } catch (NoSuchFieldException | IllegalAccessException e) { System.out.println("Couldnt switch to altening altservice"); } } public File getConfigDirectory() { return configDirectory; } public File getDirectory() { return directory; } } interface wtf { void omg(); }
9,485
0.694254
0.692356
319
28.733541
27.70299
171
false
false
0
0
0
0
0
0
1.401254
false
false
10
8d24078953a82fe9903658278dee53b2c70d48d9
15,668,040,716,056
ffe51eec5172ce23e75b6afe3a25e60c8464f247
/Homework/Task5/ConsoleMenu/src/com/company/MainMenuForDocuments.java
1c35e7187103251764f783a25e92d6df0fbafbc5
[]
no_license
DmitrijMikhailov/JAVA_IT_PARK_3
https://github.com/DmitrijMikhailov/JAVA_IT_PARK_3
c8297bf3bb69039c3e9f62fc045e54b05d4358d8
322fd493d5b2ba89769170a568c0f597fb9df91f
refs/heads/master
2021-09-07T07:26:48.458000
2018-02-19T15:56:26
2018-02-19T15:56:26
104,495,321
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.company; import java.io.IOException; import java.util.Scanner; /** * Created by Дмитрий on 03.10.2017. */ public class MainMenuForDocuments { public static void main(String[] args) throws IOException { Scanner scanner = new Scanner(System.in); System.out.println(" Введите сколько документов вы хотите создать: "); int sizeArray = scanner.nextInt(); Document arrayDocuments [] = new Document[sizeArray]; Document document [] = new Document[sizeArray]; DocumentWithObjects documentWithObjects = new DocumentWithObjects(); while (true){ Menu.showObjectDocumentMenu(); int command = scanner.nextInt(); switch (command){ case 1: { documentWithObjects.showDocumentsName(document); } break; case 2: { documentWithObjects.createDocument(arrayDocuments, document); } break; case 3:{ int numberDeleteDocument = scanner.nextInt(); documentWithObjects.deleteDocument(document, numberDeleteDocument); } break; case 4: { int numberDoc = scanner.nextInt(); Main.DocumentWork(document[numberDoc]);}break; case 5: { System.exit(0); } } } // меню должно позволять работать с отдельным документом } }
UTF-8
Java
1,458
java
MainMenuForDocuments.java
Java
[ { "context": "tion;\nimport java.util.Scanner;\n\n/**\n * Created by Дмитрий on 03.10.2017.\n */\npublic class MainMenuForDocume", "end": 102, "score": 0.9998396039009094, "start": 95, "tag": "NAME", "value": "Дмитрий" } ]
null
[]
package com.company; import java.io.IOException; import java.util.Scanner; /** * Created by Дмитрий on 03.10.2017. */ public class MainMenuForDocuments { public static void main(String[] args) throws IOException { Scanner scanner = new Scanner(System.in); System.out.println(" Введите сколько документов вы хотите создать: "); int sizeArray = scanner.nextInt(); Document arrayDocuments [] = new Document[sizeArray]; Document document [] = new Document[sizeArray]; DocumentWithObjects documentWithObjects = new DocumentWithObjects(); while (true){ Menu.showObjectDocumentMenu(); int command = scanner.nextInt(); switch (command){ case 1: { documentWithObjects.showDocumentsName(document); } break; case 2: { documentWithObjects.createDocument(arrayDocuments, document); } break; case 3:{ int numberDeleteDocument = scanner.nextInt(); documentWithObjects.deleteDocument(document, numberDeleteDocument); } break; case 4: { int numberDoc = scanner.nextInt(); Main.DocumentWork(document[numberDoc]);}break; case 5: { System.exit(0); } } } // меню должно позволять работать с отдельным документом } }
1,458
0.620513
0.610256
33
40.39394
28.304556
96
false
false
0
0
0
0
0
0
0.727273
false
false
10
92e2533ca8491d8131b6c2a357fee31d294ef4ac
29,180,007,863,107
4f65ac8e55e12699ae62f7ab450f1a8ce6a4f020
/CS367_Homeworks/SimpleStack.java
57fc352232ca6abcdc84153dbf236bef4bc7b0b4
[]
no_license
QihongL/CS367_DataStructures
https://github.com/QihongL/CS367_DataStructures
375d39853042910ed87bf020a6af9ffa53da8924
d677ea000109c2e35f2d2a68e2642ee2b81ee631
refs/heads/master
2021-05-01T12:16:55.579000
2016-11-06T04:16:26
2016-11-06T04:16:26
30,516,758
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.EmptyStackException; import javax.swing.tree.ExpandVetoException; public class SimpleStack<E> implements StackADT<E>{ private static final int INITSIZE = 10; private E[] items; private int numItems; // constructor public SimpleStack(){ items = (E[])(new Object[INITSIZE]); numItems = 0; } @Override public boolean isEmpty() { // TODO Auto-generated method stub if (numItems == 0) return true; return false; } @Override public void push(E ob) { // TODO Auto-generated method stub if(items.length == numItems){ // expand } else { items[numItems] = ob; numItems ++; } } @Override public E pop() throws EmptyStackException { // TODO Auto-generated method stub if(numItems == 0){ throw new EmptyStackException(); } else { numItems --; return items[numItems]; } } @Override public E peek() throws EmptyStackException { // TODO Auto-generated method stub if(numItems == 0){ throw new EmptyStackException(); } else { return items[numItems - 1]; } } @Override public String toString(){ String s = ""; for(int i = numItems - 1; i >= 0; i --){ s += (String)items[i] + "\n"; } return s; } }
UTF-8
Java
1,208
java
SimpleStack.java
Java
[]
null
[]
import java.util.EmptyStackException; import javax.swing.tree.ExpandVetoException; public class SimpleStack<E> implements StackADT<E>{ private static final int INITSIZE = 10; private E[] items; private int numItems; // constructor public SimpleStack(){ items = (E[])(new Object[INITSIZE]); numItems = 0; } @Override public boolean isEmpty() { // TODO Auto-generated method stub if (numItems == 0) return true; return false; } @Override public void push(E ob) { // TODO Auto-generated method stub if(items.length == numItems){ // expand } else { items[numItems] = ob; numItems ++; } } @Override public E pop() throws EmptyStackException { // TODO Auto-generated method stub if(numItems == 0){ throw new EmptyStackException(); } else { numItems --; return items[numItems]; } } @Override public E peek() throws EmptyStackException { // TODO Auto-generated method stub if(numItems == 0){ throw new EmptyStackException(); } else { return items[numItems - 1]; } } @Override public String toString(){ String s = ""; for(int i = numItems - 1; i >= 0; i --){ s += (String)items[i] + "\n"; } return s; } }
1,208
0.642384
0.634934
71
16.014084
14.806253
51
false
false
0
0
0
0
0
0
1.647887
false
false
10
caeb3429943fc38232e8994b18f974b224f2c935
15,977,278,386,967
a0d27e6743a93e4541f3513ab29b31f4549bdbe0
/src/main/java/au/com/nbnco/springseed/utils/StringConstants.java
d352d67ba52ef55e8ae38b40fea7fa2d4eaa018a
[]
no_license
steveteng/springseed
https://github.com/steveteng/springseed
4e0facb3eef299d155e3cf4c6a6265aa2c36186d
659caf583535c9e3376c03c4e570f371266614d9
refs/heads/master
2016-09-05T12:00:20.650000
2014-07-30T03:19:03
2014-07-30T03:19:03
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package au.com.nbnco.springseed.utils; /** * Contains all string constants */ public final class StringConstants { public static final String REQUEST = "request"; private StringConstants() { } }
UTF-8
Java
204
java
StringConstants.java
Java
[]
null
[]
package au.com.nbnco.springseed.utils; /** * Contains all string constants */ public final class StringConstants { public static final String REQUEST = "request"; private StringConstants() { } }
204
0.72549
0.72549
13
14.692307
17.691305
48
false
false
0
0
0
0
0
0
0.384615
false
false
10
0eb292e39a6892d97fae5ddd2ed3eea063f8b211
16,999,480,563,165
2a8b6bfde119b39caf873f9042819f6d454c6955
/ValidSquare.java
b579f45c77ae9b193ac1bfd4234f0fea364e4e76
[]
no_license
imchakreshtiwari/leetCodeMay20Challenge
https://github.com/imchakreshtiwari/leetCodeMay20Challenge
fade098a8d374c0bf7f64214febc74bc393b599c
c79091bc2c3c7bc5fbe7c0c6acd6a22b9f3ccf68
refs/heads/master
2022-07-13T14:11:39.692000
2020-05-13T08:58:29
2020-05-13T08:58:29
260,320,544
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.lang.Math; class Solution { public boolean isPerfectSquare(int num) { double n= Math.sqrt(num); if(n==(int)n){ return true; }else{ return false; } } } //Your runtime beats 100.00 % of java submissions.
UTF-8
Java
265
java
ValidSquare.java
Java
[]
null
[]
import java.lang.Math; class Solution { public boolean isPerfectSquare(int num) { double n= Math.sqrt(num); if(n==(int)n){ return true; }else{ return false; } } } //Your runtime beats 100.00 % of java submissions.
265
0.577358
0.558491
13
18.538462
15.340321
50
false
false
0
0
0
0
0
0
0.307692
false
false
10
23fb1f8e3e0d53314cfb7ac075622174e785a243
8,598,524,588,696
4268cc1332ef8d4dc1e9e312f31bcad7ec475b0a
/ribbon-service/src/main/java/com/bravo/springcloud/tutorial/ribbon/service/controller/HelloWorldController.java
0527fba42403347c30512b30791921086787e938
[]
no_license
JiaoJianbo/springcloud-tutorial
https://github.com/JiaoJianbo/springcloud-tutorial
279cb53a45a29609a010455d9c05b42f800f188b
0826acd647bb004429cb0ff60f2c8b263858f581
refs/heads/master
2020-03-24T23:59:31.825000
2019-04-15T03:59:55
2019-04-15T03:59:55
143,164,374
0
0
null
false
2018-09-30T06:09:02
2018-08-01T14:05:55
2018-08-06T04:08:19
2018-09-30T06:09:02
27
0
0
0
Java
false
null
package com.bravo.springcloud.tutorial.ribbon.service.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.bravo.springcloud.tutorial.ribbon.service.client.HelloWorldService; @RestController public class HelloWorldController { @Autowired HelloWorldService helloWorldService; @RequestMapping(value="/hi") public String sayHello() { return helloWorldService.getHelloContent(); } }
UTF-8
Java
549
java
HelloWorldController.java
Java
[]
null
[]
package com.bravo.springcloud.tutorial.ribbon.service.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.bravo.springcloud.tutorial.ribbon.service.client.HelloWorldService; @RestController public class HelloWorldController { @Autowired HelloWorldService helloWorldService; @RequestMapping(value="/hi") public String sayHello() { return helloWorldService.getHelloContent(); } }
549
0.834244
0.834244
18
29.5
26.579546
78
false
false
0
0
0
0
0
0
0.777778
false
false
10
6e572a49650d5cbbde4adc871a4ba7e440786102
14,645,838,481,269
97f699d5780edced83932817f97ca2d237e93b15
/src/action/UserAction.java
f380286fcc8d8a43a84f35fb38e2a5fc456dbdd0
[]
no_license
xianyusPadding/javaWeb-yuanlaishini
https://github.com/xianyusPadding/javaWeb-yuanlaishini
289bc7bb96a5cc85ea18f9a5d7958ddcd4487430
bd5f68e4dfe7e5ad5c80a4832eb1cb66f3b417ad
refs/heads/master
2021-01-23T13:09:54.881000
2017-07-02T03:11:06
2017-07-02T03:11:06
93,232,284
4
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package action; import java.util.List; import javaBean.User; import utils.OptionDB; public class UserAction { OptionDB db =new OptionDB(); public boolean insert(User user){ return db.insertUser(user); } public User selectUser_single(String u_id){ return db.selectUser(u_id); } public boolean update(User user){ return db.alterUser(user); } public List<User> selectUser_all(String u_id){ return db.selectUser_all(u_id); } }
UTF-8
Java
465
java
UserAction.java
Java
[]
null
[]
package action; import java.util.List; import javaBean.User; import utils.OptionDB; public class UserAction { OptionDB db =new OptionDB(); public boolean insert(User user){ return db.insertUser(user); } public User selectUser_single(String u_id){ return db.selectUser(u_id); } public boolean update(User user){ return db.alterUser(user); } public List<User> selectUser_all(String u_id){ return db.selectUser_all(u_id); } }
465
0.694624
0.694624
22
19.136364
15.184608
47
false
false
0
0
0
0
0
0
1.181818
false
false
10
8e7b89e3acb48dcca7eb74b95a14ff52fb976cd2
23,459,111,411,001
32f38cd53372ba374c6dab6cc27af78f0a1b0190
/app/src/main/java/defpackage/at.java
0312603208fa7a6bec9f3954663d228fd32b329c
[ "BSD-3-Clause" ]
permissive
shuixi2013/AmapCode
https://github.com/shuixi2013/AmapCode
9ea7aefb42e0413f348f238f0721c93245f4eac6
1a3a8d4dddfcc5439df8df570000cca12b15186a
refs/heads/master
2023-06-06T23:08:57.391000
2019-08-29T04:36:02
2019-08-29T04:36:02
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package defpackage; /* renamed from: at reason: default package */ /* compiled from: NetWorkKalmanFilter */ final class at { long a = 0; double b; double c; double d; double e; double f; double g; double h; double i = 0.0d; double j = 0.0d; double k = 0.0d; at() { } public final void a() { this.a = 0; this.k = 0.0d; } }
UTF-8
Java
401
java
at.java
Java
[]
null
[]
package defpackage; /* renamed from: at reason: default package */ /* compiled from: NetWorkKalmanFilter */ final class at { long a = 0; double b; double c; double d; double e; double f; double g; double h; double i = 0.0d; double j = 0.0d; double k = 0.0d; at() { } public final void a() { this.a = 0; this.k = 0.0d; } }
401
0.523691
0.498753
25
15.04
10.974443
46
false
false
0
0
0
0
0
0
0.56
false
false
10
00d504f12bdf322dd0c5fd24d3370e9067ab2785
7,679,401,533,731
bfdca6079d9e88c629a6416c4a30af7fcb6b1ff0
/src/main/java/com/pec/studentportal/Repository/RegisteredUserRepository.java
a2faee61f11d43ec737422e455d9a12cca1edfa1
[]
no_license
venktesh-99/StudentConveniencePortal
https://github.com/venktesh-99/StudentConveniencePortal
7174edd44b1d5db897516405e9c3a2a14f41831d
f46d8d64a914971cfd3d3533faf4f8483ffecb54
refs/heads/master
2023-05-14T06:43:31.188000
2021-06-03T07:33:08
2021-06-03T07:33:08
300,721,944
0
0
null
false
2020-12-26T06:54:47
2020-10-02T19:52:48
2020-11-29T09:29:28
2020-12-26T06:48:33
81
0
0
0
Java
false
false
package com.pec.studentportal.Repository; import com.pec.studentportal.Entity.RegisteredUser; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface RegisteredUserRepository extends JpaRepository<RegisteredUser, Integer> { public RegisteredUser findByEmailId(String emailId); }
UTF-8
Java
372
java
RegisteredUserRepository.java
Java
[]
null
[]
package com.pec.studentportal.Repository; import com.pec.studentportal.Entity.RegisteredUser; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface RegisteredUserRepository extends JpaRepository<RegisteredUser, Integer> { public RegisteredUser findByEmailId(String emailId); }
372
0.846774
0.846774
12
30
30.224163
90
false
false
0
0
0
0
0
0
0.5
false
false
10
6ce41db0e409bfa423584531de296e8f7ace74fb
13,855,564,510,671
3c939e176560c7a1190aa0c52ea7d6a476b04be6
/src/main/java/coding/net/plugin/CodingUrl.java
6b82aefeadec73ce80e377e512405b72cfbcf648
[]
no_license
belieberll/coding.net
https://github.com/belieberll/coding.net
06af57ce8bdfc85959c695a7c18474f075b105b3
62e5d428a87587fe96d1b54a7aca22a2a12d4744
refs/heads/master
2021-08-30T21:51:14.754000
2017-12-19T15:06:16
2017-12-19T15:06:16
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package coding.net.plugin; import org.apache.commons.lang.StringUtils; /** * Created by Administrator on 2016/9/4 0004. */ public final class CodingUrl { private static String normalize(String url) { if (StringUtils.isBlank(url)) { return null; } // Strip "/tree/..." if (url.contains("/tree/")) { url = url.replaceFirst("/tree/.*$", ""); } if (!url.endsWith("/")) { url += '/'; } return url; } private final String baseUrl; CodingUrl(final String input) { this.baseUrl = normalize(input); } @Override public String toString() { return this.baseUrl; } public String baseUrl() { return this.baseUrl; } public String commitId(final String id) { return new StringBuilder().append(baseUrl).append("commit/").append(id).toString(); } }
UTF-8
Java
921
java
CodingUrl.java
Java
[]
null
[]
package coding.net.plugin; import org.apache.commons.lang.StringUtils; /** * Created by Administrator on 2016/9/4 0004. */ public final class CodingUrl { private static String normalize(String url) { if (StringUtils.isBlank(url)) { return null; } // Strip "/tree/..." if (url.contains("/tree/")) { url = url.replaceFirst("/tree/.*$", ""); } if (!url.endsWith("/")) { url += '/'; } return url; } private final String baseUrl; CodingUrl(final String input) { this.baseUrl = normalize(input); } @Override public String toString() { return this.baseUrl; } public String baseUrl() { return this.baseUrl; } public String commitId(final String id) { return new StringBuilder().append(baseUrl).append("commit/").append(id).toString(); } }
921
0.557003
0.546145
42
20.928572
19.804272
91
false
false
0
0
0
0
0
0
0.285714
false
false
10
4e761b4d86c872c4eda0b8ccb14008d660b835be
9,706,626,137,366
a1faf3a8e6e8047834cba6e98cea08ba7fbd1d72
/src/main/java/org/fgi/clearcase/AttributeType.java
4c728b19479227315516edb4cfc366a6299cdbde
[]
no_license
FranckG/clearcase2git
https://github.com/FranckG/clearcase2git
3fdbb982bef12155f5cf3b83d44c617686f233e3
a31d967c0eaca0b6c5aaa6cee04e929c2bde419c
refs/heads/master
2021-01-13T02:18:22.332000
2016-11-05T22:25:41
2016-11-05T22:25:41
39,472,720
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.fgi.clearcase; public class AttributeType extends AbstractCcObject { /** * @param selector_p */ public AttributeType(final Selector selector_p) { super(selector_p); } /** * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(final Object toCompare_p) { if (this == toCompare_p) { return true; } if (null == toCompare_p) { return false; } if (getClass() != toCompare_p.getClass()) { return false; } final AttributeType other = (AttributeType) toCompare_p; final Selector selector = this.getSelector(); final Selector otherSelector = other.getSelector(); if (null == selector) { if (null != otherSelector) { return false; } } else if (!selector.equals(otherSelector)) { return false; } return true; } /** * @see java.lang.Object#hashCode() */ @Override public int hashCode() { return super.hashCode(); } }
UTF-8
Java
1,046
java
AttributeType.java
Java
[]
null
[]
package org.fgi.clearcase; public class AttributeType extends AbstractCcObject { /** * @param selector_p */ public AttributeType(final Selector selector_p) { super(selector_p); } /** * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(final Object toCompare_p) { if (this == toCompare_p) { return true; } if (null == toCompare_p) { return false; } if (getClass() != toCompare_p.getClass()) { return false; } final AttributeType other = (AttributeType) toCompare_p; final Selector selector = this.getSelector(); final Selector otherSelector = other.getSelector(); if (null == selector) { if (null != otherSelector) { return false; } } else if (!selector.equals(otherSelector)) { return false; } return true; } /** * @see java.lang.Object#hashCode() */ @Override public int hashCode() { return super.hashCode(); } }
1,046
0.57935
0.57935
48
19.75
18.430613
60
false
false
0
0
0
0
0
0
0.25
false
false
10
5311c313a02dec623d7dc413561a2749f900704b
29,222,957,490,095
3b52123f981f73ac3ca82045a1b34db2be7fc96f
/src/main/java/pl/dzielins42/dmtools/util/random/RandomAdapter.java
a9fc353ec86bb7d8a5a724b3b7afb9c8ac9ab130
[ "Apache-2.0" ]
permissive
dzielins42/spongy-elephant
https://github.com/dzielins42/spongy-elephant
01cef881bfb0b4c855a6538d1630c1f6d54ed895
0493154b61797693db9ac8e0c17798ebc0ce302f
refs/heads/master
2020-03-19T09:50:47.158000
2018-06-13T13:16:23
2018-06-13T13:16:23
136,321,640
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pl.dzielins42.dmtools.util.random; import java.util.Random; public final class RandomAdapter implements RandomProvider { private Random random; public RandomAdapter() { this(new Random()); } public RandomAdapter(Random random) { if (random == null) { throw new IllegalArgumentException(); } this.random = random; } public boolean nextBoolean() { return random.nextBoolean(); } public double nextDouble() { return random.nextDouble(); } public float nextFloat() { return random.nextFloat(); } public int nextInt() { return random.nextInt(); } public int nextInt(int bound) { return random.nextInt(bound); } public long nextLong() { return random.nextLong(); } public double nextGaussian() { return random.nextGaussian(); } }
UTF-8
Java
920
java
RandomAdapter.java
Java
[ { "context": "package pl.dzielins42.dmtools.util.random;\n\nimport java.util.Random;\n\np", "end": 21, "score": 0.9485167264938354, "start": 11, "tag": "USERNAME", "value": "dzielins42" } ]
null
[]
package pl.dzielins42.dmtools.util.random; import java.util.Random; public final class RandomAdapter implements RandomProvider { private Random random; public RandomAdapter() { this(new Random()); } public RandomAdapter(Random random) { if (random == null) { throw new IllegalArgumentException(); } this.random = random; } public boolean nextBoolean() { return random.nextBoolean(); } public double nextDouble() { return random.nextDouble(); } public float nextFloat() { return random.nextFloat(); } public int nextInt() { return random.nextInt(); } public int nextInt(int bound) { return random.nextInt(bound); } public long nextLong() { return random.nextLong(); } public double nextGaussian() { return random.nextGaussian(); } }
920
0.6
0.597826
48
18.1875
16.938192
60
false
false
0
0
0
0
0
0
0.270833
false
false
10
54cf690a7adcd51edc2fff9eed79ea59a3434704
31,456,340,498,034
1e1c84e19a4bcd2903fe0b60614a06ef7b698327
/CobwebApp/src/main/java/cobweb3d/core/Updatable.java
47b163c0eb335bb72bc80e3217619dd89232ee47
[]
no_license
COBWEB-ca/cobweb3d
https://github.com/COBWEB-ca/cobweb3d
ffe1c3af431060b169e009949f4b95ca7c57b28c
03bd2efb750bb2a3c53c5015ca6ff317ac043bbf
refs/heads/master
2021-01-12T14:41:45.334000
2019-01-02T21:52:31
2019-01-02T21:52:31
127,575,486
2
4
null
false
2019-01-02T21:52:32
2018-03-31T22:14:27
2018-11-19T22:56:32
2019-01-02T21:52:32
379
0
4
1
Java
false
null
package cobweb3d.core; /** * Component of the simulation that changes with time. update() will be called at every simulation * step. */ public interface Updatable { /** * Updates the state of the simulation component for the current time step */ default void update() { } }
UTF-8
Java
301
java
Updatable.java
Java
[]
null
[]
package cobweb3d.core; /** * Component of the simulation that changes with time. update() will be called at every simulation * step. */ public interface Updatable { /** * Updates the state of the simulation component for the current time step */ default void update() { } }
301
0.671096
0.667774
14
20.5
29.28615
98
false
false
0
0
0
0
0
0
0.071429
false
false
10
3ddd2c3868301bdce77a6b36f70ab81c01d38407
23,398,981,882,217
0493ffe947dad031c7b19145523eb39209e8059a
/OpenJdk8uTest/src/test/sun/java2d/X11SurfaceData/DrawImageBgTest/DrawImageBgTest.java
09d1dbb8c7b715916534e50f166f40f5d369ff6e
[]
no_license
thelinh95/Open_Jdk8u_Test
https://github.com/thelinh95/Open_Jdk8u_Test
7612f1b63b5001d1df85c1df0d70627b123de80f
4df362a71e680dbd7dfbb28c8922e8f20373757a
refs/heads/master
2021-01-16T19:27:30.506000
2017-08-13T23:26:05
2017-08-13T23:26:05
100,169,775
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package test.sun.java2d.X11SurfaceData.DrawImageBgTest; /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 6603887 * @summary Verifies that drawImage with bg color works correctly for ICM image * @run main/othervm DrawImageBgTest * @run main/othervm -Dsun.java2d.pmoffscreen=true DrawImageBgTest */ import java.awt.Color; import java.awt.Graphics; import java.awt.GraphicsConfiguration; import java.awt.GraphicsEnvironment; import java.awt.image.BufferedImage; import java.awt.image.IndexColorModel; import java.awt.image.VolatileImage; import java.awt.image.WritableRaster; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class DrawImageBgTest { public static void main(String[] args) { GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment(). getDefaultScreenDevice().getDefaultConfiguration(); if (gc.getColorModel().getPixelSize() <= 8) { System.out.println("8-bit color model, test considered passed"); return; } /* * Set up images: * 1.) VolatileImge for rendering to, * 2.) BufferedImage for reading back the contents of the VI * 3.) The image triggering the problem */ VolatileImage vImg = null; BufferedImage readBackBImg; // create a BITMASK ICM such that the transparent color is // tr. black (and it's the first in the color map so a buffered image // created with this ICM is transparent byte r[] = { 0x00, (byte)0xff}; byte g[] = { 0x00, (byte)0xff}; byte b[] = { 0x00, (byte)0xff}; IndexColorModel icm = new IndexColorModel(8, 2, r, g, b, 0); WritableRaster wr = icm.createCompatibleWritableRaster(25, 25); BufferedImage tImg = new BufferedImage(icm, wr, false, null); do { if (vImg == null || vImg.validate(gc) == VolatileImage.IMAGE_INCOMPATIBLE) { vImg = gc.createCompatibleVolatileImage(tImg.getWidth(), tImg.getHeight()); } Graphics viG = vImg.getGraphics(); viG.setColor(Color.red); viG.fillRect(0, 0, vImg.getWidth(), vImg.getHeight()); viG.drawImage(tImg, 0, 0, Color.green, null); viG.fillRect(0, 0, vImg.getWidth(), vImg.getHeight()); viG.drawImage(tImg, 0, 0, Color.white, null); readBackBImg = vImg.getSnapshot(); } while (vImg.contentsLost()); for (int x = 0; x < readBackBImg.getWidth(); x++) { for (int y = 0; y < readBackBImg.getHeight(); y++) { int currPixel = readBackBImg.getRGB(x, y); if (currPixel != Color.white.getRGB()) { String fileName = "DrawImageBgTest.png"; try { ImageIO.write(readBackBImg, "png", new File(fileName)); System.err.println("Dumped image to " + fileName); } catch (IOException ex) {} throw new RuntimeException("Test Failed: found wrong color: 0x"+ Integer.toHexString(currPixel)); } } } System.out.println("Test Passed."); } }
UTF-8
Java
4,419
java
DrawImageBgTest.java
Java
[]
null
[]
package test.sun.java2d.X11SurfaceData.DrawImageBgTest; /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 6603887 * @summary Verifies that drawImage with bg color works correctly for ICM image * @run main/othervm DrawImageBgTest * @run main/othervm -Dsun.java2d.pmoffscreen=true DrawImageBgTest */ import java.awt.Color; import java.awt.Graphics; import java.awt.GraphicsConfiguration; import java.awt.GraphicsEnvironment; import java.awt.image.BufferedImage; import java.awt.image.IndexColorModel; import java.awt.image.VolatileImage; import java.awt.image.WritableRaster; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class DrawImageBgTest { public static void main(String[] args) { GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment(). getDefaultScreenDevice().getDefaultConfiguration(); if (gc.getColorModel().getPixelSize() <= 8) { System.out.println("8-bit color model, test considered passed"); return; } /* * Set up images: * 1.) VolatileImge for rendering to, * 2.) BufferedImage for reading back the contents of the VI * 3.) The image triggering the problem */ VolatileImage vImg = null; BufferedImage readBackBImg; // create a BITMASK ICM such that the transparent color is // tr. black (and it's the first in the color map so a buffered image // created with this ICM is transparent byte r[] = { 0x00, (byte)0xff}; byte g[] = { 0x00, (byte)0xff}; byte b[] = { 0x00, (byte)0xff}; IndexColorModel icm = new IndexColorModel(8, 2, r, g, b, 0); WritableRaster wr = icm.createCompatibleWritableRaster(25, 25); BufferedImage tImg = new BufferedImage(icm, wr, false, null); do { if (vImg == null || vImg.validate(gc) == VolatileImage.IMAGE_INCOMPATIBLE) { vImg = gc.createCompatibleVolatileImage(tImg.getWidth(), tImg.getHeight()); } Graphics viG = vImg.getGraphics(); viG.setColor(Color.red); viG.fillRect(0, 0, vImg.getWidth(), vImg.getHeight()); viG.drawImage(tImg, 0, 0, Color.green, null); viG.fillRect(0, 0, vImg.getWidth(), vImg.getHeight()); viG.drawImage(tImg, 0, 0, Color.white, null); readBackBImg = vImg.getSnapshot(); } while (vImg.contentsLost()); for (int x = 0; x < readBackBImg.getWidth(); x++) { for (int y = 0; y < readBackBImg.getHeight(); y++) { int currPixel = readBackBImg.getRGB(x, y); if (currPixel != Color.white.getRGB()) { String fileName = "DrawImageBgTest.png"; try { ImageIO.write(readBackBImg, "png", new File(fileName)); System.err.println("Dumped image to " + fileName); } catch (IOException ex) {} throw new RuntimeException("Test Failed: found wrong color: 0x"+ Integer.toHexString(currPixel)); } } } System.out.println("Test Passed."); } }
4,419
0.618466
0.602172
110
39.172726
26.720051
79
false
false
0
0
0
0
0
0
0.827273
false
false
10
c574d9505f565dbec25f156a2cb3bc1f9935adc8
7,619,272,005,367
6d52e0235ae39337b01784d53c5eff3c76d5d528
/com.yzd.hazelcast-lean/02-hazelcast-in-grpc/src/test/java/com/yzd/sender/SenderServerTest.java
ec3f96fb7d200cf6510afe5bf8f80c63228337ac
[ "MIT" ]
permissive
yaozd/com.yzd.hazelcast-lean
https://github.com/yaozd/com.yzd.hazelcast-lean
7c567e92b98063e9fef3906562e58ab463ed1afc
64370268f7660c3fe8007c11d15e9c4448456680
refs/heads/master
2022-12-30T16:32:32.165000
2020-10-13T10:08:23
2020-10-13T10:08:23
289,815,212
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yzd.sender; import com.yzd.grpc.SenderGrpc; import com.yzd.grpc.SenderProtos; import io.grpc.ManagedChannel; import io.grpc.netty.NettyChannelBuilder; import io.grpc.stub.StreamObserver; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import lombok.extern.slf4j.Slf4j; import org.junit.Test; /** * @Author: yaozh * @Description: */ @Slf4j public class SenderServerTest { @Test public void client() throws InterruptedException { EventLoopGroup senderGroup = new NioEventLoopGroup(1); NettyChannelBuilder channelBuilder = NettyChannelBuilder.forAddress("localhost", 8899) .directExecutor() .eventLoopGroup(senderGroup) .maxInboundMessageSize(1024 * 1024 * 500).usePlaintext(); ManagedChannel channel = channelBuilder.build(); //双向流式通信 StreamObserver<SenderProtos.DataStreamRequest> requestObserver = SenderGrpc.newStub(channel).sendStream(new StreamObserver<SenderProtos.DataStreamResponse>() { @Override public void onNext(SenderProtos.DataStreamResponse response) { log.info("UUID:{},isOk:{}", response.getUuid(), response.getIsOk()); } @Override public void onError(Throwable t) { log.error("error!", t); } @Override public void onCompleted() { } }); for (int i = 0; i < 1000; i++) { requestObserver.onNext(SenderProtos.DataStreamRequest.newBuilder() .setUuid(String.valueOf(i)).setRequestInfo("hello world!").build()); } requestObserver.onCompleted(); Thread.currentThread().join(); } }
UTF-8
Java
1,883
java
SenderServerTest.java
Java
[ { "context": "f4j.Slf4j;\nimport org.junit.Test;\n\n/**\n * @Author: yaozh\n * @Description:\n */\n@Slf4j\npublic class SenderSe", "end": 366, "score": 0.9996569752693176, "start": 361, "tag": "USERNAME", "value": "yaozh" } ]
null
[]
package com.yzd.sender; import com.yzd.grpc.SenderGrpc; import com.yzd.grpc.SenderProtos; import io.grpc.ManagedChannel; import io.grpc.netty.NettyChannelBuilder; import io.grpc.stub.StreamObserver; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import lombok.extern.slf4j.Slf4j; import org.junit.Test; /** * @Author: yaozh * @Description: */ @Slf4j public class SenderServerTest { @Test public void client() throws InterruptedException { EventLoopGroup senderGroup = new NioEventLoopGroup(1); NettyChannelBuilder channelBuilder = NettyChannelBuilder.forAddress("localhost", 8899) .directExecutor() .eventLoopGroup(senderGroup) .maxInboundMessageSize(1024 * 1024 * 500).usePlaintext(); ManagedChannel channel = channelBuilder.build(); //双向流式通信 StreamObserver<SenderProtos.DataStreamRequest> requestObserver = SenderGrpc.newStub(channel).sendStream(new StreamObserver<SenderProtos.DataStreamResponse>() { @Override public void onNext(SenderProtos.DataStreamResponse response) { log.info("UUID:{},isOk:{}", response.getUuid(), response.getIsOk()); } @Override public void onError(Throwable t) { log.error("error!", t); } @Override public void onCompleted() { } }); for (int i = 0; i < 1000; i++) { requestObserver.onNext(SenderProtos.DataStreamRequest.newBuilder() .setUuid(String.valueOf(i)).setRequestInfo("hello world!").build()); } requestObserver.onCompleted(); Thread.currentThread().join(); } }
1,883
0.605024
0.592197
52
35
27.496153
110
false
false
0
0
0
0
0
0
0.5
false
false
10
7fb2757ad8977b882d8a917f1dcc45f642ef9c2d
19,404,662,288,949
fd8b8bbbdabb77bbc7b49421601012143b2449cd
/app/src/main/java/com/starshow/app/eventbus/UploadEvent.java
9cf4af9290100065a49b6c44612f2cc697f46d2a
[]
no_license
v5lukia/StarShow
https://github.com/v5lukia/StarShow
a10928446f10e1ec5f09e083435d33bcf48d1418
b37362e5d60bc44477f33575b886a26b5ae63dcf
refs/heads/master
2019-07-23T21:57:50.509000
2017-02-14T10:14:47
2017-02-14T10:14:47
81,932,115
4
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.starshow.app.eventbus; /** * Created by hasee on 2016/5/31. */ public class UploadEvent { private int id; private String time; private String url; private boolean isSuccess; private boolean isVideo; private String className;//来自哪个类 public String getClassName() { return className; } public void setClassName(String className) { this.className = className; } public UploadEvent() { } public String getTime() { return time; } public int getId() { return id; } public void setId(int id) { this.id = id; } public void setTime(String time) { this.time = time; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public boolean isSuccess() { return isSuccess; } public void setSuccess(boolean success) { isSuccess = success; } public boolean isVideo() { return isVideo; } public void setVideo(boolean video) { isVideo = video; } public UploadEvent(String time, String url, boolean isSuccess, boolean isVideo, String className) { this.time = time; this.url = url; this.isSuccess = isSuccess; this.isVideo = isVideo; this.className = className; } }
UTF-8
Java
1,394
java
UploadEvent.java
Java
[ { "context": "kage com.starshow.app.eventbus;\n\n/**\n * Created by hasee on 2016/5/31.\n */\npublic class UploadEvent {\n ", "end": 59, "score": 0.9996556639671326, "start": 54, "tag": "USERNAME", "value": "hasee" } ]
null
[]
package com.starshow.app.eventbus; /** * Created by hasee on 2016/5/31. */ public class UploadEvent { private int id; private String time; private String url; private boolean isSuccess; private boolean isVideo; private String className;//来自哪个类 public String getClassName() { return className; } public void setClassName(String className) { this.className = className; } public UploadEvent() { } public String getTime() { return time; } public int getId() { return id; } public void setId(int id) { this.id = id; } public void setTime(String time) { this.time = time; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public boolean isSuccess() { return isSuccess; } public void setSuccess(boolean success) { isSuccess = success; } public boolean isVideo() { return isVideo; } public void setVideo(boolean video) { isVideo = video; } public UploadEvent(String time, String url, boolean isSuccess, boolean isVideo, String className) { this.time = time; this.url = url; this.isSuccess = isSuccess; this.isVideo = isVideo; this.className = className; } }
1,394
0.586705
0.581647
74
17.702703
17.410566
103
false
false
0
0
0
0
0
0
0.378378
false
false
10
439b887948e55840135b1f50827726dafd3c5c72
9,345,848,879,999
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/13/13_1f616dc7ab69bb0a98caaccdbb932cef6ee2b7e2/SettingsObserver/13_1f616dc7ab69bb0a98caaccdbb932cef6ee2b7e2_SettingsObserver_s.java
3c70caaa800cacd0d148ce60bf054dd98ec0e62d
[]
no_license
zhongxingyu/Seer
https://github.com/zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516000
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
false
2023-06-22T07:55:57
2020-04-28T11:07:49
2023-06-21T00:53:27
2023-06-22T07:55:57
2,849,868
2
2
0
null
false
false
/** * @author: Justin Peterson, Alex Bogart * @email: Jmp3833@rit.edu * SettingsObserver.java Will listen to invoked commands from the settings * portion of the menu bar. These functionalities have been grouped * into a single class since they are rather simple. */ package Observers; import javax.swing.JFrame; import javax.swing.JOptionPane; import Text_Windows.FileReader; import Views.TextTabWindow; import Command.Receiver ; public class SettingsObserver implements Receiver{ FileReader fr; TextTabWindow mainWindow; public SettingsObserver(FileReader tabProxy, TextTabWindow mainWindow) { this.fr = tabProxy; this.mainWindow = mainWindow; } /** * Requests a change in tab length via Integer input from the user */ public void changeTabLength(){ //Opens a dialog box for the user to select tab length. String str = JOptionPane.showInputDialog(null, "Input desired tab length: ", "Tab Length", 1); try{ int tabLength = Integer.parseInt(str); // is an integer! if (tabLength > 0 && tabLength < 10 ){ fr.getSelectedTextArea(mainWindow).setTabSize(tabLength); } else{ JOptionPane.showMessageDialog(null,"The tab length must be an\n " + "integer between 1 and 9.\nPlease try again."); } } catch (NumberFormatException e) { // not an integer! } } /** * Enables text wrapping in the HTML editor. */ public void enableTextWrapping(){ fr.getSelectedTextArea(mainWindow).setLineWrap(true); } /** * Disables text wrapping in the HTML editor. */ public void disableTextWrapping(){ fr.getSelectedTextArea(mainWindow).setLineWrap(false); } }
UTF-8
Java
1,760
java
13_1f616dc7ab69bb0a98caaccdbb932cef6ee2b7e2_SettingsObserver_s.java
Java
[ { "context": " /**\n * @author: Justin Peterson, Alex Bogart\n * @email: Jmp3833@rit.edu\n * Sett", "end": 33, "score": 0.9998508095741272, "start": 18, "tag": "NAME", "value": "Justin Peterson" }, { "context": " /**\n * @author: Justin Peterson, Alex Bogart\n * @email: Jmp3833@rit.edu\n * SettingsObserver.", "end": 46, "score": 0.9998432397842407, "start": 35, "tag": "NAME", "value": "Alex Bogart" }, { "context": " @author: Justin Peterson, Alex Bogart\n * @email: Jmp3833@rit.edu\n * SettingsObserver.java Will listen to invoked ", "end": 74, "score": 0.9999322891235352, "start": 59, "tag": "EMAIL", "value": "Jmp3833@rit.edu" } ]
null
[]
/** * @author: <NAME>, <NAME> * @email: <EMAIL> * SettingsObserver.java Will listen to invoked commands from the settings * portion of the menu bar. These functionalities have been grouped * into a single class since they are rather simple. */ package Observers; import javax.swing.JFrame; import javax.swing.JOptionPane; import Text_Windows.FileReader; import Views.TextTabWindow; import Command.Receiver ; public class SettingsObserver implements Receiver{ FileReader fr; TextTabWindow mainWindow; public SettingsObserver(FileReader tabProxy, TextTabWindow mainWindow) { this.fr = tabProxy; this.mainWindow = mainWindow; } /** * Requests a change in tab length via Integer input from the user */ public void changeTabLength(){ //Opens a dialog box for the user to select tab length. String str = JOptionPane.showInputDialog(null, "Input desired tab length: ", "Tab Length", 1); try{ int tabLength = Integer.parseInt(str); // is an integer! if (tabLength > 0 && tabLength < 10 ){ fr.getSelectedTextArea(mainWindow).setTabSize(tabLength); } else{ JOptionPane.showMessageDialog(null,"The tab length must be an\n " + "integer between 1 and 9.\nPlease try again."); } } catch (NumberFormatException e) { // not an integer! } } /** * Enables text wrapping in the HTML editor. */ public void enableTextWrapping(){ fr.getSelectedTextArea(mainWindow).setLineWrap(true); } /** * Disables text wrapping in the HTML editor. */ public void disableTextWrapping(){ fr.getSelectedTextArea(mainWindow).setLineWrap(false); } }
1,738
0.66875
0.663068
71
23.774649
23.62989
81
false
false
0
0
0
0
0
0
1.647887
false
false
10
5169715946d9cfa5abc6403752df11e436745173
22,402,549,479,347
84ff535b0006231a6143285e009730f000017e25
/src/main/java/com/pws/fastjson/FieldAnalyze.java
55433607c85421c2de0cda4c048e62da624260a2
[]
no_license
WeiShengPan/Java-features
https://github.com/WeiShengPan/Java-features
ffa16bc2d596468337616a67e337faa36191691c
facce92040ad47d4aa51f1ccd3467baaa0ffe390
refs/heads/master
2020-12-02T18:12:49.837000
2020-11-30T09:23:20
2020-11-30T09:23:20
96,494,840
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pws.fastjson; import com.alibaba.fastjson.JSONObject; import com.pws.javafeatures.util.PrintUtil; import lombok.extern.slf4j.Slf4j; /** * 使用com.alibaba.fastjson解析json字符串时的特性 * * @author panws * @since 2017-10-18 */ @Slf4j public class FieldAnalyze { private static final String TO_ANALYZE = "{\"strExist\":\"exist\",\"intExist\":1,\"boolExist\":true,\"strNumber\":\"999\",\"strBool\":\"false\"}"; private static final String STR_EXIST = "strExist"; private static final String STR_NOT_EXIST = "strNotExist"; private static final String INT_EXIST = "intExist"; private static final String INT_NOT_EXIST = "intNotExist"; private static final String BOOL_EXIST = "boolExist"; private static final String BOOL_NOT_EXIST = "boolNotExist"; private static final String STR_NUMBER = "strNumber"; private static final String STR_BOOL = "strBool"; public static void main(String[] args) { JSONObject jsonObj = JSONObject.parseObject(TO_ANALYZE); log.info(jsonObj.toJSONString()); PrintUtil.printSep(); /* 按类型解析 */ String strExist = jsonObj.getString(STR_EXIST); String strNotExist = jsonObj.getString(STR_NOT_EXIST); log.info("String exist: ", strExist); log.info("String not exist: ", strNotExist); int intValueExist = jsonObj.getIntValue(INT_EXIST); int intValueNotExist = jsonObj.getIntValue(INT_NOT_EXIST); Integer integerExist = jsonObj.getInteger(INT_EXIST); Integer integerNotExist = jsonObj.getInteger(INT_NOT_EXIST); log.info("int value exist: ", intValueExist); log.info("int value not exist: ", intValueNotExist); log.info("Integer exist: ", integerExist); log.info("Integer not exist: ", integerNotExist); boolean booleanValueExist = jsonObj.getBooleanValue(BOOL_EXIST); boolean booleanValueNotExist = jsonObj.getBooleanValue(BOOL_NOT_EXIST); Boolean booleanExist = jsonObj.getBoolean(BOOL_EXIST); Boolean booleanNotExist = jsonObj.getBoolean(BOOL_NOT_EXIST); log.info("boolean value exist: ", booleanValueExist); log.info("boolean value not exist: ", booleanValueNotExist); log.info("Boolean exist: ", booleanExist); log.info("Boolean not exist: ", booleanNotExist); PrintUtil.printSep(); /* 跨类型解析 */ //正常解析 String strFromInt = jsonObj.getString(INT_EXIST); //正常解析 String strFromBool = jsonObj.getString(BOOL_EXIST); log.info("string from int: ", strFromInt); log.info("string from bool: ", strFromBool); //String为数字时可以正常解析,其他值会抛出异常java.lang.NumberFormatException int intValueFromStr = jsonObj.getIntValue(STR_NUMBER); //Boolean为true时为1,false为0 int intValueFromBool = jsonObj.getIntValue(BOOL_EXIST); //String为数字时可以正常解析,其他值会抛出异常java.lang.NumberFormatException Integer integerFromStr = jsonObj.getInteger(STR_NUMBER); //Boolean为true时为1,false为0 Integer integerFromBool = jsonObj.getInteger(BOOL_EXIST); log.info("int value from String number: ", intValueFromStr); log.info("int value from bool: ", intValueFromBool); log.info("Integer from String number: ", integerFromStr); log.info("Integer from bool: ", integerFromBool); //String为true或false时可以正常解析,其他值会抛出异常com.alibaba.fastjson.JSONException: can not cast to boolean boolean booleanValueFromStr = jsonObj.getBooleanValue(STR_BOOL); //当int值为1时为true,其他值都为false boolean booleanValueFromInt = jsonObj.getBooleanValue(INT_EXIST); //String为true或false时可以正常解析,其他值会抛出异常com.alibaba.fastjson.JSONException: can not cast to boolean Boolean booleanFromStr = jsonObj.getBoolean(STR_BOOL); //当int值为1时为true,其他值都为false Boolean booleanFromInt = jsonObj.getBoolean(INT_EXIST); log.info("boolean value from String boolean: ", booleanValueFromStr); log.info("boolean value from int: ", booleanValueFromInt); log.info("Boolean from String boolean: ", booleanFromStr); log.info("Boolean from int: ", booleanFromInt); } }
UTF-8
Java
4,094
java
FieldAnalyze.java
Java
[ { "context": " 使用com.alibaba.fastjson解析json字符串时的特性\n *\n * @author panws\n * @since 2017-10-18\n */\n@Slf4j\npublic class Fiel", "end": 208, "score": 0.9996994733810425, "start": 203, "tag": "USERNAME", "value": "panws" } ]
null
[]
package com.pws.fastjson; import com.alibaba.fastjson.JSONObject; import com.pws.javafeatures.util.PrintUtil; import lombok.extern.slf4j.Slf4j; /** * 使用com.alibaba.fastjson解析json字符串时的特性 * * @author panws * @since 2017-10-18 */ @Slf4j public class FieldAnalyze { private static final String TO_ANALYZE = "{\"strExist\":\"exist\",\"intExist\":1,\"boolExist\":true,\"strNumber\":\"999\",\"strBool\":\"false\"}"; private static final String STR_EXIST = "strExist"; private static final String STR_NOT_EXIST = "strNotExist"; private static final String INT_EXIST = "intExist"; private static final String INT_NOT_EXIST = "intNotExist"; private static final String BOOL_EXIST = "boolExist"; private static final String BOOL_NOT_EXIST = "boolNotExist"; private static final String STR_NUMBER = "strNumber"; private static final String STR_BOOL = "strBool"; public static void main(String[] args) { JSONObject jsonObj = JSONObject.parseObject(TO_ANALYZE); log.info(jsonObj.toJSONString()); PrintUtil.printSep(); /* 按类型解析 */ String strExist = jsonObj.getString(STR_EXIST); String strNotExist = jsonObj.getString(STR_NOT_EXIST); log.info("String exist: ", strExist); log.info("String not exist: ", strNotExist); int intValueExist = jsonObj.getIntValue(INT_EXIST); int intValueNotExist = jsonObj.getIntValue(INT_NOT_EXIST); Integer integerExist = jsonObj.getInteger(INT_EXIST); Integer integerNotExist = jsonObj.getInteger(INT_NOT_EXIST); log.info("int value exist: ", intValueExist); log.info("int value not exist: ", intValueNotExist); log.info("Integer exist: ", integerExist); log.info("Integer not exist: ", integerNotExist); boolean booleanValueExist = jsonObj.getBooleanValue(BOOL_EXIST); boolean booleanValueNotExist = jsonObj.getBooleanValue(BOOL_NOT_EXIST); Boolean booleanExist = jsonObj.getBoolean(BOOL_EXIST); Boolean booleanNotExist = jsonObj.getBoolean(BOOL_NOT_EXIST); log.info("boolean value exist: ", booleanValueExist); log.info("boolean value not exist: ", booleanValueNotExist); log.info("Boolean exist: ", booleanExist); log.info("Boolean not exist: ", booleanNotExist); PrintUtil.printSep(); /* 跨类型解析 */ //正常解析 String strFromInt = jsonObj.getString(INT_EXIST); //正常解析 String strFromBool = jsonObj.getString(BOOL_EXIST); log.info("string from int: ", strFromInt); log.info("string from bool: ", strFromBool); //String为数字时可以正常解析,其他值会抛出异常java.lang.NumberFormatException int intValueFromStr = jsonObj.getIntValue(STR_NUMBER); //Boolean为true时为1,false为0 int intValueFromBool = jsonObj.getIntValue(BOOL_EXIST); //String为数字时可以正常解析,其他值会抛出异常java.lang.NumberFormatException Integer integerFromStr = jsonObj.getInteger(STR_NUMBER); //Boolean为true时为1,false为0 Integer integerFromBool = jsonObj.getInteger(BOOL_EXIST); log.info("int value from String number: ", intValueFromStr); log.info("int value from bool: ", intValueFromBool); log.info("Integer from String number: ", integerFromStr); log.info("Integer from bool: ", integerFromBool); //String为true或false时可以正常解析,其他值会抛出异常com.alibaba.fastjson.JSONException: can not cast to boolean boolean booleanValueFromStr = jsonObj.getBooleanValue(STR_BOOL); //当int值为1时为true,其他值都为false boolean booleanValueFromInt = jsonObj.getBooleanValue(INT_EXIST); //String为true或false时可以正常解析,其他值会抛出异常com.alibaba.fastjson.JSONException: can not cast to boolean Boolean booleanFromStr = jsonObj.getBoolean(STR_BOOL); //当int值为1时为true,其他值都为false Boolean booleanFromInt = jsonObj.getBoolean(INT_EXIST); log.info("boolean value from String boolean: ", booleanValueFromStr); log.info("boolean value from int: ", booleanValueFromInt); log.info("Boolean from String boolean: ", booleanFromStr); log.info("Boolean from int: ", booleanFromInt); } }
4,094
0.748954
0.743462
102
36.490196
28.052032
147
false
false
0
0
0
0
0
0
2.078431
false
false
10
af75121fb07478a2337009c8bd43ab854471f215
17,884,243,832,724
92613098825a5acd8637044edbf79ab7d5203441
/src/main/java/org/mimirframework/classification/optimization/MultiClassLogisticFunction.java
374a2c2392d101fa4b6a1728260f38ccb1e9754d
[]
no_license
briljant/mimir
https://github.com/briljant/mimir
7f190e963c05985f6fa78c8772a5042970757dbe
b189566914a6498b2c65bc4709c68f4a039dc69a
refs/heads/master
2017-12-05T08:02:39.193000
2015-11-17T22:28:56
2015-11-17T22:28:56
46,061,725
3
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.mimirframework.classification.optimization; import org.briljantframework.array.Arrays; import org.briljantframework.array.DoubleArray; import org.briljantframework.array.IntArray; import org.briljantframework.optimize.DifferentialFunction; /** * @author Isak Karlsson */ public class MultiClassLogisticFunction implements DifferentialFunction { private final DoubleArray x; private final IntArray y; private final double lambda; private final int k; public MultiClassLogisticFunction(DoubleArray x, IntArray y, double lambda, int k) { this.x = x; this.y = y; this.lambda = lambda; this.k = k; } @Override public double gradientCost(DoubleArray w, DoubleArray g) { double f = 0.0; int n = x.rows(); int p = x.columns(); w = w.reshape(p, k); g = g.reshape(p, k); g.assign(0); DoubleArray prob = DoubleArray.zeros(k); for (int i = 0; i < n; i++) { DoubleArray xi = x.getRow(i); for (int j = 0; j < k; j++) { prob.set(j, Arrays.inner(xi, w.getColumn(j))); } OptimizationUtils.softMax(prob); f -= OptimizationUtils.stableLog(prob.get(y.get(i))); for (int j = 0; j < k; j++) { double yi = (y.get(i) == j ? 1.0 : 0.0) - prob.get(j); for (int l = 1; l < p; l++) { g.set(l, j, g.get(l, j) - yi * x.get(i, l)); } g.set(0, j, g.get(0, j) - yi); } } return computeShrinkage(w, f, p); } @Override public double cost(DoubleArray w) { double f = 0.0; int n = x.rows(); int p = x.columns(); w = w.reshape(p, k); DoubleArray prob = DoubleArray.zeros(k); for (int i = 0; i < n; i++) { DoubleArray xi = x.getRow(i); for (int j = 0; j < k; j++) { prob.set(j, Arrays.inner(xi, w.getColumn(j))); } OptimizationUtils.softMax(prob); f -= OptimizationUtils.stableLog(prob.get(y.get(i))); } return computeShrinkage(w, f, p); } private double computeShrinkage(DoubleArray w, double f, int p) { if (lambda != 0.0) { double w2 = 0.0; for (int i = 0; i < k; i++) { for (int j = 0; j < p; j++) { double v = w.get(j, i); w2 += v * v; } } f += 0.5 * lambda * w2; } return f; } }
UTF-8
Java
2,287
java
MultiClassLogisticFunction.java
Java
[ { "context": "ork.optimize.DifferentialFunction;\n\n/**\n * @author Isak Karlsson\n */\npublic class MultiClassLogisticFunction imple", "end": 282, "score": 0.9997995495796204, "start": 269, "tag": "NAME", "value": "Isak Karlsson" } ]
null
[]
package org.mimirframework.classification.optimization; import org.briljantframework.array.Arrays; import org.briljantframework.array.DoubleArray; import org.briljantframework.array.IntArray; import org.briljantframework.optimize.DifferentialFunction; /** * @author <NAME> */ public class MultiClassLogisticFunction implements DifferentialFunction { private final DoubleArray x; private final IntArray y; private final double lambda; private final int k; public MultiClassLogisticFunction(DoubleArray x, IntArray y, double lambda, int k) { this.x = x; this.y = y; this.lambda = lambda; this.k = k; } @Override public double gradientCost(DoubleArray w, DoubleArray g) { double f = 0.0; int n = x.rows(); int p = x.columns(); w = w.reshape(p, k); g = g.reshape(p, k); g.assign(0); DoubleArray prob = DoubleArray.zeros(k); for (int i = 0; i < n; i++) { DoubleArray xi = x.getRow(i); for (int j = 0; j < k; j++) { prob.set(j, Arrays.inner(xi, w.getColumn(j))); } OptimizationUtils.softMax(prob); f -= OptimizationUtils.stableLog(prob.get(y.get(i))); for (int j = 0; j < k; j++) { double yi = (y.get(i) == j ? 1.0 : 0.0) - prob.get(j); for (int l = 1; l < p; l++) { g.set(l, j, g.get(l, j) - yi * x.get(i, l)); } g.set(0, j, g.get(0, j) - yi); } } return computeShrinkage(w, f, p); } @Override public double cost(DoubleArray w) { double f = 0.0; int n = x.rows(); int p = x.columns(); w = w.reshape(p, k); DoubleArray prob = DoubleArray.zeros(k); for (int i = 0; i < n; i++) { DoubleArray xi = x.getRow(i); for (int j = 0; j < k; j++) { prob.set(j, Arrays.inner(xi, w.getColumn(j))); } OptimizationUtils.softMax(prob); f -= OptimizationUtils.stableLog(prob.get(y.get(i))); } return computeShrinkage(w, f, p); } private double computeShrinkage(DoubleArray w, double f, int p) { if (lambda != 0.0) { double w2 = 0.0; for (int i = 0; i < k; i++) { for (int j = 0; j < p; j++) { double v = w.get(j, i); w2 += v * v; } } f += 0.5 * lambda * w2; } return f; } }
2,280
0.567119
0.554875
85
25.905882
20.093092
86
false
false
0
0
0
0
0
0
0.988235
false
false
10
ea4f90bc2ae40ad49a777ae5eced4c20379172a8
18,476,949,378,111
4ee784be35ed57b96142c63effa20819588c05e0
/vjezba5-6/src/main/java/Sensor.java
38bd4ba18cd205f4a7bf44506ca814295ccdc219
[]
no_license
Zcicvaric/JavaVjezbe
https://github.com/Zcicvaric/JavaVjezbe
907f217817f0af03d04633e3b807090871c48081
48111e921cc987d2eec90e52f1101e1c2cb77007
refs/heads/master
2023-04-29T23:58:33.744000
2021-04-27T16:55:52
2021-04-27T16:55:52
218,973,108
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.concurrent.ThreadLocalRandom; import org.eclipse.paho.client.mqttv3.MqttClient; import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttMessage; import org.json.JSONObject; class Sensor implements Runnable{ private String sensor_name; private int value; private int minimum_value; private int maximum_value; private Device device; private MqttClient mqttclient; private int update_interval; private Thread t; private String unit; public Sensor(String name,int min_value,int max_value,int update_interval,String unit,Device device){ this.sensor_name=name; this.minimum_value=min_value; this.maximum_value=max_value; this.device=device; this.update_interval=update_interval; this.mqttclient=device.get_client(); this.unit=unit; } private void read_value(){ this.value=ThreadLocalRandom.current().nextInt(minimum_value, maximum_value + 1); } public void run(){ while(true){ try { Thread.sleep(update_interval*1000); read_value(); String content=" = "+Integer.toString(value); MqttMessage message = new MqttMessage(content.getBytes()); message.setQos(2); mqttclient.publish(device.get_name()+"/"+sensor_name, message); //System.out.println("Message published from sensor ["+sensor_name+"]" ); } catch (MqttException|InterruptedException ex) { //Logger.getLogger(Sensor.class.getName()).log(Level.SEVERE, null, ex); return; } } } public void start_publishing(){ if (t == null) { t = new Thread (this, "senzori"); t.start (); } System.out.println("Sensor: ["+this.sensor_name+"] started"); } public void stop_publishing(){ if (t != null) { t.interrupt (); } System.out.println("Sensor: ["+this.sensor_name+"] stopped"); } public JSONObject export_to_json_object(){ JSONObject this_sensor = new JSONObject(); this_sensor.put("sensor_name", this.sensor_name); this_sensor.put("minimum_value", this.minimum_value); this_sensor.put("maximum_value", this.maximum_value); this_sensor.put("update_interval", this.update_interval); this_sensor.put("unit", this.unit); this_sensor.put("device", this.device.get_name()); return this_sensor; } }
UTF-8
Java
2,581
java
Sensor.java
Java
[]
null
[]
import java.util.concurrent.ThreadLocalRandom; import org.eclipse.paho.client.mqttv3.MqttClient; import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttMessage; import org.json.JSONObject; class Sensor implements Runnable{ private String sensor_name; private int value; private int minimum_value; private int maximum_value; private Device device; private MqttClient mqttclient; private int update_interval; private Thread t; private String unit; public Sensor(String name,int min_value,int max_value,int update_interval,String unit,Device device){ this.sensor_name=name; this.minimum_value=min_value; this.maximum_value=max_value; this.device=device; this.update_interval=update_interval; this.mqttclient=device.get_client(); this.unit=unit; } private void read_value(){ this.value=ThreadLocalRandom.current().nextInt(minimum_value, maximum_value + 1); } public void run(){ while(true){ try { Thread.sleep(update_interval*1000); read_value(); String content=" = "+Integer.toString(value); MqttMessage message = new MqttMessage(content.getBytes()); message.setQos(2); mqttclient.publish(device.get_name()+"/"+sensor_name, message); //System.out.println("Message published from sensor ["+sensor_name+"]" ); } catch (MqttException|InterruptedException ex) { //Logger.getLogger(Sensor.class.getName()).log(Level.SEVERE, null, ex); return; } } } public void start_publishing(){ if (t == null) { t = new Thread (this, "senzori"); t.start (); } System.out.println("Sensor: ["+this.sensor_name+"] started"); } public void stop_publishing(){ if (t != null) { t.interrupt (); } System.out.println("Sensor: ["+this.sensor_name+"] stopped"); } public JSONObject export_to_json_object(){ JSONObject this_sensor = new JSONObject(); this_sensor.put("sensor_name", this.sensor_name); this_sensor.put("minimum_value", this.minimum_value); this_sensor.put("maximum_value", this.maximum_value); this_sensor.put("update_interval", this.update_interval); this_sensor.put("unit", this.unit); this_sensor.put("device", this.device.get_name()); return this_sensor; } }
2,581
0.611391
0.607904
70
35.871429
24.102709
105
false
false
0
0
0
0
0
0
0.871429
false
false
10
1489aaa238b4f916f5f6fe5331b1148b6556bd3c
2,001,454,777,697
62ff27cf26f0f1bb6fe6ca2e0d3d8518ee5e68f3
/src/com/jt/frame/SnakeFrame.java
50b14dbfebe0f97d291aa892031a49f9390a082f
[ "Apache-2.0" ]
permissive
xubuhui/snakename
https://github.com/xubuhui/snakename
47cc81f82188456b3af8ce9fff46f4e87902c333
24cce2f039886ca6fb7e034e102ec2465d6de092
refs/heads/master
2020-09-29T09:15:57.075000
2019-12-12T05:58:16
2019-12-12T05:58:16
227,008,079
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jt.frame; import javax.swing.JFrame; import com.jt.panel.ButtonPanel; import com.jt.panel.SnakePanel; import com.jt.util.Config; public class SnakeFrame extends BaseFrame{ public SnakePanel snakePanel =new SnakePanel(); ButtonPanel buttonPanel =new ButtonPanel(this); //用户创建游戏界面的窗体 public SnakeFrame() { //设置窗体信息 initFrame(); //设置关闭窗口时程序终止 this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); addComponents(); //设置可见 this.setVisible(true); } public void addComponents() { this.add(snakePanel); //获取焦点 snakePanel.setFocusable(true); snakePanel.requestFocus(); this.add(buttonPanel); } }
GB18030
Java
717
java
SnakeFrame.java
Java
[]
null
[]
package com.jt.frame; import javax.swing.JFrame; import com.jt.panel.ButtonPanel; import com.jt.panel.SnakePanel; import com.jt.util.Config; public class SnakeFrame extends BaseFrame{ public SnakePanel snakePanel =new SnakePanel(); ButtonPanel buttonPanel =new ButtonPanel(this); //用户创建游戏界面的窗体 public SnakeFrame() { //设置窗体信息 initFrame(); //设置关闭窗口时程序终止 this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); addComponents(); //设置可见 this.setVisible(true); } public void addComponents() { this.add(snakePanel); //获取焦点 snakePanel.setFocusable(true); snakePanel.requestFocus(); this.add(buttonPanel); } }
717
0.731783
0.731783
35
17.428572
15.580731
54
false
false
0
0
0
0
0
0
1.514286
false
false
10
d54a13f379faadd4b1bff510c565cf74fa478b3f
25,606,595,048,043
b4e4ab3fdaf818b8a48fe945391ae1be74b4008f
/source/utils/utils-common/src/test/java/test/my/utils/security/ShaUtilsTest.java
dfd6cf3b5055e2a1adafc79995cc5af89e1046c4
[ "Apache-2.0" ]
permissive
Spark3122/jdchain
https://github.com/Spark3122/jdchain
78ef86ffdec066a1514c3152b35a42955fa2866d
3378c0321b2fcffa5b91eb9739001784751742c5
refs/heads/master
2020-07-27T20:27:35.258000
2019-09-04T17:51:15
2019-09-04T17:51:15
209,207,377
1
0
Apache-2.0
true
2019-09-18T03:17:36
2019-09-18T03:17:36
2019-09-18T03:17:34
2019-09-05T04:09:04
7,988
0
0
0
null
false
false
package test.my.utils.security; import static org.junit.Assert.*; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Random; import java.util.UUID; import org.junit.Test; import com.jd.blockchain.utils.security.RandomUtils; import com.jd.blockchain.utils.security.ShaUtils; public class ShaUtilsTest { // @Test // public void testHash_128() throws UnsupportedEncodingException { // String text = "the text with fixed size"; // byte[] hashBytes = ShaUtils.hash_128(text.getBytes("UTF-8")); // assertEquals(16, hashBytes.length); // // text = UUID.randomUUID().toString(); // hashBytes = ShaUtils.hash_128(text.getBytes("UTF-8")); // assertEquals(16, hashBytes.length); // // StringBuilder bigText = new StringBuilder(); // for (int i = 0; i < 256; i++) { // bigText.append((char)(97+(i% 20))); // } // hashBytes = ShaUtils.hash_128(bigText.toString().getBytes("UTF-8")); // assertEquals(16, hashBytes.length); // } @Test public void testHash_256ByteArray() throws UnsupportedEncodingException { String text = "the text with fixed size"; byte[] hashBytes = ShaUtils.hash_256(text.getBytes("UTF-8")); assertEquals(32, hashBytes.length); text = UUID.randomUUID().toString(); hashBytes = ShaUtils.hash_256(text.getBytes("UTF-8")); assertEquals(32, hashBytes.length); StringBuilder bigText = new StringBuilder(); for (int i = 0; i < 512; i++) { bigText.append((char)(97+(i% 20))); } hashBytes = ShaUtils.hash_256(bigText.toString().getBytes("UTF-8")); assertEquals(32, hashBytes.length); } /** * 验证采用不同的缓存数组大小进行 hash 计算是否会影响其计算结果;<br> * * 注:显然,算法本身的效果是不会受算法调用方式的影响的;测试的结果也表明这一点; */ @Test public void testHash_256_withDiffBuffSize() { byte[] randBytes = RandomUtils.generateRandomBytes(256); ByteArrayInputStream in = new ByteArrayInputStream(randBytes); byte[] hash1 = hash_256(in, 32); in = new ByteArrayInputStream(randBytes); byte[] hash2 = hash_256(in, 32); in = new ByteArrayInputStream(randBytes); byte[] hash3 = hash_256(in, 64); in = new ByteArrayInputStream(randBytes); byte[] hash4 = hash_256(in, 128); assertArrayEquals(hash1, hash2); assertArrayEquals(hash1, hash3); assertArrayEquals(hash1, hash4); } private static byte[] hash_256(InputStream input, int buffSize) { MessageDigest md = null; try { md = MessageDigest.getInstance("SHA-256"); byte[] buff =new byte[buffSize]; int len = 0; while((len=input.read(buff)) > 0){ md.update(buff, 0, len); } return md.digest(); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException(e.getMessage(), e); } catch (IOException e) { throw new IllegalStateException(e.getMessage(), e); } } }
UTF-8
Java
3,169
java
ShaUtilsTest.java
Java
[]
null
[]
package test.my.utils.security; import static org.junit.Assert.*; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Random; import java.util.UUID; import org.junit.Test; import com.jd.blockchain.utils.security.RandomUtils; import com.jd.blockchain.utils.security.ShaUtils; public class ShaUtilsTest { // @Test // public void testHash_128() throws UnsupportedEncodingException { // String text = "the text with fixed size"; // byte[] hashBytes = ShaUtils.hash_128(text.getBytes("UTF-8")); // assertEquals(16, hashBytes.length); // // text = UUID.randomUUID().toString(); // hashBytes = ShaUtils.hash_128(text.getBytes("UTF-8")); // assertEquals(16, hashBytes.length); // // StringBuilder bigText = new StringBuilder(); // for (int i = 0; i < 256; i++) { // bigText.append((char)(97+(i% 20))); // } // hashBytes = ShaUtils.hash_128(bigText.toString().getBytes("UTF-8")); // assertEquals(16, hashBytes.length); // } @Test public void testHash_256ByteArray() throws UnsupportedEncodingException { String text = "the text with fixed size"; byte[] hashBytes = ShaUtils.hash_256(text.getBytes("UTF-8")); assertEquals(32, hashBytes.length); text = UUID.randomUUID().toString(); hashBytes = ShaUtils.hash_256(text.getBytes("UTF-8")); assertEquals(32, hashBytes.length); StringBuilder bigText = new StringBuilder(); for (int i = 0; i < 512; i++) { bigText.append((char)(97+(i% 20))); } hashBytes = ShaUtils.hash_256(bigText.toString().getBytes("UTF-8")); assertEquals(32, hashBytes.length); } /** * 验证采用不同的缓存数组大小进行 hash 计算是否会影响其计算结果;<br> * * 注:显然,算法本身的效果是不会受算法调用方式的影响的;测试的结果也表明这一点; */ @Test public void testHash_256_withDiffBuffSize() { byte[] randBytes = RandomUtils.generateRandomBytes(256); ByteArrayInputStream in = new ByteArrayInputStream(randBytes); byte[] hash1 = hash_256(in, 32); in = new ByteArrayInputStream(randBytes); byte[] hash2 = hash_256(in, 32); in = new ByteArrayInputStream(randBytes); byte[] hash3 = hash_256(in, 64); in = new ByteArrayInputStream(randBytes); byte[] hash4 = hash_256(in, 128); assertArrayEquals(hash1, hash2); assertArrayEquals(hash1, hash3); assertArrayEquals(hash1, hash4); } private static byte[] hash_256(InputStream input, int buffSize) { MessageDigest md = null; try { md = MessageDigest.getInstance("SHA-256"); byte[] buff =new byte[buffSize]; int len = 0; while((len=input.read(buff)) > 0){ md.update(buff, 0, len); } return md.digest(); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException(e.getMessage(), e); } catch (IOException e) { throw new IllegalStateException(e.getMessage(), e); } } }
3,169
0.67743
0.643163
102
27.754902
21.454208
74
false
false
0
0
0
0
0
0
2.205882
false
false
10
9918fc25cb60a346aec08789db905e2543ac623e
14,310,831,052,511
46dbfb6d8ea712422428692ec9101b80824bf8b8
/app/src/main/java/com/geek/pet/mvp/recycle/model/RecycleListModel.java
1c3b4f20d278033b0d50779ecdf83d33fc9cfea0
[]
no_license
ipfs666/pet
https://github.com/ipfs666/pet
7a72e27debc7e071a1ee9e2894d566072d2a7890
549400acedb426b2418b743d18f05d22108027ae
refs/heads/master
2020-03-13T13:30:58.581000
2018-04-26T10:42:16
2018-04-26T10:42:16
131,140,318
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.geek.pet.mvp.recycle.model; import com.geek.pet.api.BaseApi; import com.geek.pet.mvp.recycle.contract.RecycleListContract; import com.geek.pet.storage.BaseArrayData; import com.geek.pet.storage.BaseResponse; import com.geek.pet.storage.entity.recycle.ArticleBean; import com.jess.arms.di.scope.ActivityScope; import com.jess.arms.integration.IRepositoryManager; import com.jess.arms.mvp.BaseModel; import javax.inject.Inject; import io.reactivex.Observable; @ActivityScope public class RecycleListModel extends BaseModel implements RecycleListContract.Model { @Inject RecycleListModel(IRepositoryManager repositoryManager) { super(repositoryManager); } @Override public Observable<BaseResponse<BaseArrayData<ArticleBean>>> articleList(int pageNumber, int pageSize, String type, String category) { return mRepositoryManager.obtainRetrofitService(BaseApi.class).articleList(pageNumber, pageSize, type, category); } @Override public void onDestroy() { super.onDestroy(); } }
UTF-8
Java
1,143
java
RecycleListModel.java
Java
[]
null
[]
package com.geek.pet.mvp.recycle.model; import com.geek.pet.api.BaseApi; import com.geek.pet.mvp.recycle.contract.RecycleListContract; import com.geek.pet.storage.BaseArrayData; import com.geek.pet.storage.BaseResponse; import com.geek.pet.storage.entity.recycle.ArticleBean; import com.jess.arms.di.scope.ActivityScope; import com.jess.arms.integration.IRepositoryManager; import com.jess.arms.mvp.BaseModel; import javax.inject.Inject; import io.reactivex.Observable; @ActivityScope public class RecycleListModel extends BaseModel implements RecycleListContract.Model { @Inject RecycleListModel(IRepositoryManager repositoryManager) { super(repositoryManager); } @Override public Observable<BaseResponse<BaseArrayData<ArticleBean>>> articleList(int pageNumber, int pageSize, String type, String category) { return mRepositoryManager.obtainRetrofitService(BaseApi.class).articleList(pageNumber, pageSize, type, category); } @Override public void onDestroy() { super.onDestroy(); } }
1,143
0.715661
0.715661
37
29.918919
30.475847
106
false
false
0
0
0
0
0
0
0.540541
false
false
10
3672a301ff102daaa55156f0550315a1d36fa290
12,996,571,059,542
876d0866575161f80206ee2309053a5b2faf8c86
/src/main/java/net/filipvanlaenen/sapor2md/ProbabilityMassFunctionCombination.java
786923f0fadc45626665dde85b8599ea9f66a771
[]
no_license
filipvanlaenen/sapor2md
https://github.com/filipvanlaenen/sapor2md
e069b615f09f2025e61a4d6470a8a7b1c8b91f19
4db7baf24f6aacabd2deb5178d5496adad63210f
refs/heads/master
2021-07-09T14:13:47.748000
2020-10-02T10:32:48
2020-10-02T10:32:48
197,765,329
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.filipvanlaenen.sapor2md; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; /** * A class representing a probability mass function combination. Such a * combination consists of a number of parliamentary groups with each of them a * probability mass function associated to them. The probability mass function * may have a voting intention percentage share, a number of seats, or anything * else that is comparable as the discrete value. * * @param <T> The type of the keys for the probability mass functions. */ public abstract class ProbabilityMassFunctionCombination<T extends Comparable<T>> { /** * Magic number 0.95, or 95 percent. */ protected static final double NINETY_FIVE_PERCENT = 0.95D; /** * A map holding the probability mass functions per group. */ private final Map<String, ProbabilityMassFunction<T>> map = new HashMap<>(); /** * Returns the map holding the probability mass functions per group. * * @return The map holding the probability mass functions per group. */ Map<String, ProbabilityMassFunction<T>> getMap() { return map; } /** * Returns a set with all groups, sorted. The groups are sorted descending on * median first, upper bound of the 95 percent confidence interval second, and * lower bound of the 95 percent confidence interval third. If the median and * the confidence intervals are equal, the groups are sorted alphabetically on * their name. * * @return A set containing all the groups, sorted. */ List<String> getSortedGroups() { List<String> sortedGroups = new ArrayList<String>(map.keySet()); sortedGroups.sort(new Comparator<String>() { @Override public int compare(final String group1, final String group2) { return compareGroups(group1, group2); } }); return sortedGroups; } /** * Compares two groups for sorting. The groups are sorted descending on median * first, upper bound of the 95 percent confidence interval second, and lower * bound of the 95 percent confidence interval third. If the median and the * confidence intervals are equal, the groups are sorted alphabetically on their * name. * * @param group1 The name of the first group. * @param group2 The name of the second group. * @return The comparison result. */ int compareGroups(final String group1, final String group2) { int compareMedian = getMedian(group2).compareTo(getMedian(group1)); if (compareMedian == 0) { ConfidenceInterval<T> c1 = getConfidenceInterval(group1, NINETY_FIVE_PERCENT); ConfidenceInterval<T> c2 = getConfidenceInterval(group2, NINETY_FIVE_PERCENT); int compareUpperBound = c2.getUpperBound().compareTo(c1.getUpperBound()); if (compareUpperBound == 0) { int compareLowerBound = c2.getLowerBound().compareTo(c1.getLowerBound()); if (compareLowerBound == 0) { return group1.compareToIgnoreCase(group2); } else { return compareLowerBound; } } else { return compareUpperBound; } } else { return compareMedian; } } /** * Returns the probability of a parliamentary group obtaining a value. * * @param group The name of the parliamentary group. * @param value A value. * @return The probability of the parliamentary group to obtain the value. */ double getProbability(final String group, final T value) { return map.get(group).getProbability(value); } /** * Returns the median of a parliamentary group. * * @param group The name of the parliamentary group. * @return The median for the parliamentary group. */ T getMedian(final String group) { return map.get(group).getMedian(); } /** * Returns the confidence interval for a group. * * @param group The name of the parliamentary group. * @param confidence The level of confidence required. * @return The confidence interval for the given confidence for a group. */ ConfidenceInterval<T> getConfidenceInterval(final String group, final double confidence) { return map.get(group).getConfidenceInterval(confidence); } /** * Calculates the medians. * * @return The medians. */ protected Map<String, T> calculateMedians() { Map<String, T> medians = new HashMap<String, T>(); for (String g : map.keySet()) { medians.put(g, map.get(g).getMedian()); } return medians; } }
UTF-8
Java
4,881
java
ProbabilityMassFunctionCombination.java
Java
[ { "context": "package net.filipvanlaenen.sapor2md;\n\nimport java.util.ArrayList;\nim", "end": 18, "score": 0.5192751288414001, "start": 15, "tag": "USERNAME", "value": "ipv" }, { "context": "package net.filipvanlaenen.sapor2md;\n\nimport java.util.ArrayList;\nimport jav", "end": 26, "score": 0.5441456437110901, "start": 22, "tag": "USERNAME", "value": "enen" } ]
null
[]
package net.filipvanlaenen.sapor2md; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; /** * A class representing a probability mass function combination. Such a * combination consists of a number of parliamentary groups with each of them a * probability mass function associated to them. The probability mass function * may have a voting intention percentage share, a number of seats, or anything * else that is comparable as the discrete value. * * @param <T> The type of the keys for the probability mass functions. */ public abstract class ProbabilityMassFunctionCombination<T extends Comparable<T>> { /** * Magic number 0.95, or 95 percent. */ protected static final double NINETY_FIVE_PERCENT = 0.95D; /** * A map holding the probability mass functions per group. */ private final Map<String, ProbabilityMassFunction<T>> map = new HashMap<>(); /** * Returns the map holding the probability mass functions per group. * * @return The map holding the probability mass functions per group. */ Map<String, ProbabilityMassFunction<T>> getMap() { return map; } /** * Returns a set with all groups, sorted. The groups are sorted descending on * median first, upper bound of the 95 percent confidence interval second, and * lower bound of the 95 percent confidence interval third. If the median and * the confidence intervals are equal, the groups are sorted alphabetically on * their name. * * @return A set containing all the groups, sorted. */ List<String> getSortedGroups() { List<String> sortedGroups = new ArrayList<String>(map.keySet()); sortedGroups.sort(new Comparator<String>() { @Override public int compare(final String group1, final String group2) { return compareGroups(group1, group2); } }); return sortedGroups; } /** * Compares two groups for sorting. The groups are sorted descending on median * first, upper bound of the 95 percent confidence interval second, and lower * bound of the 95 percent confidence interval third. If the median and the * confidence intervals are equal, the groups are sorted alphabetically on their * name. * * @param group1 The name of the first group. * @param group2 The name of the second group. * @return The comparison result. */ int compareGroups(final String group1, final String group2) { int compareMedian = getMedian(group2).compareTo(getMedian(group1)); if (compareMedian == 0) { ConfidenceInterval<T> c1 = getConfidenceInterval(group1, NINETY_FIVE_PERCENT); ConfidenceInterval<T> c2 = getConfidenceInterval(group2, NINETY_FIVE_PERCENT); int compareUpperBound = c2.getUpperBound().compareTo(c1.getUpperBound()); if (compareUpperBound == 0) { int compareLowerBound = c2.getLowerBound().compareTo(c1.getLowerBound()); if (compareLowerBound == 0) { return group1.compareToIgnoreCase(group2); } else { return compareLowerBound; } } else { return compareUpperBound; } } else { return compareMedian; } } /** * Returns the probability of a parliamentary group obtaining a value. * * @param group The name of the parliamentary group. * @param value A value. * @return The probability of the parliamentary group to obtain the value. */ double getProbability(final String group, final T value) { return map.get(group).getProbability(value); } /** * Returns the median of a parliamentary group. * * @param group The name of the parliamentary group. * @return The median for the parliamentary group. */ T getMedian(final String group) { return map.get(group).getMedian(); } /** * Returns the confidence interval for a group. * * @param group The name of the parliamentary group. * @param confidence The level of confidence required. * @return The confidence interval for the given confidence for a group. */ ConfidenceInterval<T> getConfidenceInterval(final String group, final double confidence) { return map.get(group).getConfidenceInterval(confidence); } /** * Calculates the medians. * * @return The medians. */ protected Map<String, T> calculateMedians() { Map<String, T> medians = new HashMap<String, T>(); for (String g : map.keySet()) { medians.put(g, map.get(g).getMedian()); } return medians; } }
4,881
0.64454
0.636345
134
35.425373
29.585539
94
false
false
0
0
0
0
0
0
0.38806
false
false
10
89d9ad21b299386ceaa25c730c6464f5d2b4e68d
28,784,870,859,672
55f24996c0c23ffccd9313aab2f6e592045299b6
/blocks/cocoon-session-fw/cocoon-session-fw-impl/src/main/java/org/apache/cocoon/webapps/session/context/SessionContext.java
51808079be22a130333b5ea77fe82ea8ddf99ce3
[ "Apache-2.0" ]
permissive
apache/cocoon
https://github.com/apache/cocoon
8c02bc6adf53488e11da3ccdd2bfeda74d831710
68e7a576e54e43b5e10ecdf3e713aef224ddda21
refs/heads/trunk
2023-09-03T15:52:29.338000
2023-08-01T08:49:28
2023-08-01T08:49:28
206,428
22
34
Apache-2.0
false
2023-08-01T07:30:54
2009-05-21T02:12:25
2023-07-25T13:41:21
2023-08-01T07:30:54
364,312
22
22
9
Java
false
false
/* * 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.cocoon.webapps.session.context; import java.io.IOException; import java.io.Serializable; import org.w3c.dom.DocumentFragment; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import org.xml.sax.ContentHandler; import org.xml.sax.ext.LexicalHandler; import org.apache.excalibur.source.SourceParameters; import org.apache.cocoon.ProcessingException; /** * Interface for a SessionContext. * This interface describes a SessionContext. The SessionContext is a data * container containing structured XML which can be retrieved/set by the * session transformer. * This interface does not specify how the session context stores the data. * This is left to the implementation itself, but actually this interface * is build in the DOM model. * As this context is used in a web context, all methods must be synchronized. * * @deprecated This block is deprecated and will be removed in future versions. * @version $Id$ */ public interface SessionContext extends Serializable { /** Set the name of the context. * This method must be invoked in the init phase. * In addition a load and a save resource can be provided. */ void setup(String value, String loadResource, String saveResource); /** * Get the name of the context */ String getName(); /** * Get a document fragment. * If the node specified by the path exist, its content is returned * as a DocumentFragment. * If the node does not exists, <CODE>null</CODE> is returned. */ DocumentFragment getXML(String path) throws ProcessingException ; /** * Set a document fragment at the given path. * The implementation of this method is context specific. * Usually all children of the node specified by the path are removed * and the children of the fragment are inserted as new children. * If the path is not existent it is created. */ void setXML(String path, DocumentFragment fragment) throws ProcessingException; /** * Append a document fragment at the given path. * The implementation of this method is context specific. * Usually the children of the fragment are appended as new children of the * node specified by the path. * If the path is not existent it is created and this method should work * in the same way as setXML. */ void appendXML(String path, DocumentFragment fragment) throws ProcessingException; /** * Remove some content from the context. * The implementation of this method is context specific. * Usually this method should remove all children of the node specified * by the path. */ void removeXML(String path) throws ProcessingException; /** * Set a context attribute. * Attributes over a means to store any data (object) in a session * context. If <CODE>value</CODE> is <CODE>null</CODE> the attribute is * removed. If already an attribute exists with the same key, the value * is overwritten with the new one. */ void setAttribute(String key, Object value) throws ProcessingException; /** * Get the value of a context attribute. * If the attribute is not available return <CODE>null</CODE>. */ Object getAttribute(String key) throws ProcessingException; /** * Get the value of a context attribute. * If the attribute is not available the return the * <CODE>defaultObject</CODE>. */ Object getAttribute(String key, Object defaultObject) throws ProcessingException; /** * Get a copy of the first node specified by the path. * If the node does not exist, <CODE>null</CODE> is returned. */ Node getSingleNode(String path) throws ProcessingException; /** * Get a copy of all nodes specified by the path. */ NodeList getNodeList(String path) throws ProcessingException; /** * Set the value of a node. The node is copied before insertion. */ void setNode(String path, Node node) throws ProcessingException; /** * Get the value of this node. * This is similiar to the xsl:value-of function. * If the node does not exist, <code>null</code> is returned. */ String getValueOfNode(String path) throws ProcessingException; /** * Set the value of a node. * All children of the node are removed beforehand and one single text * node with the given value is appended to the node. */ void setValueOfNode(String path, String value) throws ProcessingException; /** * Stream the XML directly to the handler. * This streams the contents of getXML() to the given handler without * creating a DocumentFragment containing a copy of the data. * If no data is available (if the path does not exist) <code>false</code> is * returned, otherwise <code>true</code>. */ boolean streamXML(String path, ContentHandler contentHandler, LexicalHandler lexicalHandler) throws SAXException, ProcessingException; /** * Try to load XML into the context. * If the context does not provide the ability of loading, * an exception is thrown. */ void loadXML(String path, SourceParameters parameters) throws SAXException, ProcessingException, IOException; /** * Try to save XML from the context. * If the context does not provide the ability of saving, * an exception is thrown. */ void saveXML(String path, SourceParameters parameters) throws SAXException, ProcessingException, IOException; }
UTF-8
Java
6,551
java
SessionContext.java
Java
[]
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.cocoon.webapps.session.context; import java.io.IOException; import java.io.Serializable; import org.w3c.dom.DocumentFragment; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import org.xml.sax.ContentHandler; import org.xml.sax.ext.LexicalHandler; import org.apache.excalibur.source.SourceParameters; import org.apache.cocoon.ProcessingException; /** * Interface for a SessionContext. * This interface describes a SessionContext. The SessionContext is a data * container containing structured XML which can be retrieved/set by the * session transformer. * This interface does not specify how the session context stores the data. * This is left to the implementation itself, but actually this interface * is build in the DOM model. * As this context is used in a web context, all methods must be synchronized. * * @deprecated This block is deprecated and will be removed in future versions. * @version $Id$ */ public interface SessionContext extends Serializable { /** Set the name of the context. * This method must be invoked in the init phase. * In addition a load and a save resource can be provided. */ void setup(String value, String loadResource, String saveResource); /** * Get the name of the context */ String getName(); /** * Get a document fragment. * If the node specified by the path exist, its content is returned * as a DocumentFragment. * If the node does not exists, <CODE>null</CODE> is returned. */ DocumentFragment getXML(String path) throws ProcessingException ; /** * Set a document fragment at the given path. * The implementation of this method is context specific. * Usually all children of the node specified by the path are removed * and the children of the fragment are inserted as new children. * If the path is not existent it is created. */ void setXML(String path, DocumentFragment fragment) throws ProcessingException; /** * Append a document fragment at the given path. * The implementation of this method is context specific. * Usually the children of the fragment are appended as new children of the * node specified by the path. * If the path is not existent it is created and this method should work * in the same way as setXML. */ void appendXML(String path, DocumentFragment fragment) throws ProcessingException; /** * Remove some content from the context. * The implementation of this method is context specific. * Usually this method should remove all children of the node specified * by the path. */ void removeXML(String path) throws ProcessingException; /** * Set a context attribute. * Attributes over a means to store any data (object) in a session * context. If <CODE>value</CODE> is <CODE>null</CODE> the attribute is * removed. If already an attribute exists with the same key, the value * is overwritten with the new one. */ void setAttribute(String key, Object value) throws ProcessingException; /** * Get the value of a context attribute. * If the attribute is not available return <CODE>null</CODE>. */ Object getAttribute(String key) throws ProcessingException; /** * Get the value of a context attribute. * If the attribute is not available the return the * <CODE>defaultObject</CODE>. */ Object getAttribute(String key, Object defaultObject) throws ProcessingException; /** * Get a copy of the first node specified by the path. * If the node does not exist, <CODE>null</CODE> is returned. */ Node getSingleNode(String path) throws ProcessingException; /** * Get a copy of all nodes specified by the path. */ NodeList getNodeList(String path) throws ProcessingException; /** * Set the value of a node. The node is copied before insertion. */ void setNode(String path, Node node) throws ProcessingException; /** * Get the value of this node. * This is similiar to the xsl:value-of function. * If the node does not exist, <code>null</code> is returned. */ String getValueOfNode(String path) throws ProcessingException; /** * Set the value of a node. * All children of the node are removed beforehand and one single text * node with the given value is appended to the node. */ void setValueOfNode(String path, String value) throws ProcessingException; /** * Stream the XML directly to the handler. * This streams the contents of getXML() to the given handler without * creating a DocumentFragment containing a copy of the data. * If no data is available (if the path does not exist) <code>false</code> is * returned, otherwise <code>true</code>. */ boolean streamXML(String path, ContentHandler contentHandler, LexicalHandler lexicalHandler) throws SAXException, ProcessingException; /** * Try to load XML into the context. * If the context does not provide the ability of loading, * an exception is thrown. */ void loadXML(String path, SourceParameters parameters) throws SAXException, ProcessingException, IOException; /** * Try to save XML from the context. * If the context does not provide the ability of saving, * an exception is thrown. */ void saveXML(String path, SourceParameters parameters) throws SAXException, ProcessingException, IOException; }
6,551
0.69104
0.689971
187
34.032085
25.592424
81
false
false
0
0
0
0
0
0
0.320856
false
false
10
928c1b5af86c64be9bd7ff650e0e0e5dd5f2e9a1
7,310,034,396,025
382d8077f763f993085c4bd0b93488e3017adeb5
/lib_skin/src/main/java/com/lxy/module/skin/util/LResourceProviderUtil.java
314dc6dc04de839d2c9e22f171608a7eaee1fa3d
[]
no_license
onlike/Android_Skin_Module
https://github.com/onlike/Android_Skin_Module
330e0cba5d329df72b13db591f7917830dca98fe
2c31f5508c843fcfc1a7325fc1ce513680191c9d
refs/heads/master
2021-08-18T15:50:57.929000
2021-04-06T08:25:14
2021-04-06T08:25:14
124,825,544
11
1
null
false
2018-03-12T11:48:51
2018-03-12T02:55:51
2018-03-12T02:59:44
2018-03-12T11:48:51
179
0
0
0
Java
false
null
package com.lxy.module.skin.util; import android.annotation.SuppressLint; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; import android.graphics.drawable.Drawable; import com.lxy.module.skin.SkinManager; import com.lxy.module.skin.config.SkinConfig; /** * Created by lxy on 2018/3/6. * */ public class LResourceProviderUtil { public static int getColor(Context context, Resources skinResource, int resId) { int originColor = context.getResources().getColor(resId); if (skinResource == null || SkinManager.getInstance().isDefaultSkin()) { return originColor; } int finalColor = 0; String resName = context.getResources().getResourceEntryName(resId); int trueResId = skinResource.getIdentifier(resName, SkinConfig.ATTR_VALUE_TYPE_COLOR, SkinConfig.VERIFY_SKIN_PACKAGE_NAME); try { finalColor = skinResource.getColor(trueResId); } catch (Resources.NotFoundException e) { e.printStackTrace(); finalColor = originColor; } return finalColor; } @SuppressLint("NewApi") public static Drawable getDrawable(Context context, Resources skinResource, int resId) { Drawable originDrawable = context.getResources().getDrawable(resId); if (skinResource == null || SkinManager.getInstance().isDefaultSkin()) { return originDrawable; } Drawable finalDrawable = null; String resName = context.getResources().getResourceEntryName(resId); int trueResId = skinResource.getIdentifier(resName, SkinConfig.ATTR_VALUE_TYPE_BACKGROUND, SkinConfig.VERIFY_SKIN_PACKAGE_NAME); try { if (android.os.Build.VERSION.SDK_INT < 22) { finalDrawable = skinResource.getDrawable(trueResId); } else { finalDrawable = skinResource.getDrawable(trueResId, null); } } catch (Resources.NotFoundException e) { e.printStackTrace(); finalDrawable = originDrawable; } return finalDrawable; } public static ColorStateList getColorStateList(Context context, Resources skinResource, int resId) { ColorStateList originColorList = context.getResources().getColorStateList(resId); if (skinResource == null || SkinManager.getInstance().isDefaultSkin()) { return originColorList; } ColorStateList finalColorList = null; String resName = context.getResources().getResourceEntryName(resId); int trueResId = skinResource.getIdentifier(resName, SkinConfig.ATTR_VALUE_TYPE_COLOR, SkinConfig.VERIFY_SKIN_PACKAGE_NAME); try { if (trueResId == 0) { finalColorList = originColorList; } else { finalColorList = skinResource.getColorStateList(trueResId); } } catch (Resources.NotFoundException e) { e.printStackTrace(); } if (finalColorList == null){ int[][] states = new int[1][1]; finalColorList = new ColorStateList(states, new int[]{context.getResources().getColor(resId)}); } return finalColorList; } }
UTF-8
Java
3,482
java
LResourceProviderUtil.java
Java
[ { "context": ".module.skin.config.SkinConfig;\n\n/**\n * Created by lxy on 2018/3/6.\n * \n */\npublic class LResourceProvid", "end": 340, "score": 0.9994887113571167, "start": 337, "tag": "USERNAME", "value": "lxy" } ]
null
[]
package com.lxy.module.skin.util; import android.annotation.SuppressLint; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; import android.graphics.drawable.Drawable; import com.lxy.module.skin.SkinManager; import com.lxy.module.skin.config.SkinConfig; /** * Created by lxy on 2018/3/6. * */ public class LResourceProviderUtil { public static int getColor(Context context, Resources skinResource, int resId) { int originColor = context.getResources().getColor(resId); if (skinResource == null || SkinManager.getInstance().isDefaultSkin()) { return originColor; } int finalColor = 0; String resName = context.getResources().getResourceEntryName(resId); int trueResId = skinResource.getIdentifier(resName, SkinConfig.ATTR_VALUE_TYPE_COLOR, SkinConfig.VERIFY_SKIN_PACKAGE_NAME); try { finalColor = skinResource.getColor(trueResId); } catch (Resources.NotFoundException e) { e.printStackTrace(); finalColor = originColor; } return finalColor; } @SuppressLint("NewApi") public static Drawable getDrawable(Context context, Resources skinResource, int resId) { Drawable originDrawable = context.getResources().getDrawable(resId); if (skinResource == null || SkinManager.getInstance().isDefaultSkin()) { return originDrawable; } Drawable finalDrawable = null; String resName = context.getResources().getResourceEntryName(resId); int trueResId = skinResource.getIdentifier(resName, SkinConfig.ATTR_VALUE_TYPE_BACKGROUND, SkinConfig.VERIFY_SKIN_PACKAGE_NAME); try { if (android.os.Build.VERSION.SDK_INT < 22) { finalDrawable = skinResource.getDrawable(trueResId); } else { finalDrawable = skinResource.getDrawable(trueResId, null); } } catch (Resources.NotFoundException e) { e.printStackTrace(); finalDrawable = originDrawable; } return finalDrawable; } public static ColorStateList getColorStateList(Context context, Resources skinResource, int resId) { ColorStateList originColorList = context.getResources().getColorStateList(resId); if (skinResource == null || SkinManager.getInstance().isDefaultSkin()) { return originColorList; } ColorStateList finalColorList = null; String resName = context.getResources().getResourceEntryName(resId); int trueResId = skinResource.getIdentifier(resName, SkinConfig.ATTR_VALUE_TYPE_COLOR, SkinConfig.VERIFY_SKIN_PACKAGE_NAME); try { if (trueResId == 0) { finalColorList = originColorList; } else { finalColorList = skinResource.getColorStateList(trueResId); } } catch (Resources.NotFoundException e) { e.printStackTrace(); } if (finalColorList == null){ int[][] states = new int[1][1]; finalColorList = new ColorStateList(states, new int[]{context.getResources().getColor(resId)}); } return finalColorList; } }
3,482
0.614877
0.61143
119
28.260504
28.300447
107
false
false
0
0
0
0
0
0
0.487395
false
false
10
7995d494d6e1e6f1a97e30074842bcc31f3eb2ee
17,386,027,653,962
736c6ef2e953c4ed77378a7564a30b2405af6f58
/orange-manager/src/main/java/org/orange/manager/util/MessageUtil.java
a2d19c064a91dab571288b1f3be8012f5b2f9817
[]
no_license
HiramJoyce/orange
https://github.com/HiramJoyce/orange
0e40b8022b39d52855be9c5386da36666f532e80
948b83b1c82e0e0245a686b7ffe49be5cce4f27c
refs/heads/master
2020-11-26T23:29:49.101000
2020-01-17T09:02:41
2020-01-17T09:02:41
229,230,197
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.orange.manager.util; import org.orange.manager.domain.Message; import org.orange.manager.domain.MessageEnum; public class MessageUtil { public static Message command(String data) { return new Message(MessageEnum.COMMAND_CODE.getCode(), data); } public static Message heartbeat() { return new Message(MessageEnum.HEARTBEAT_CODE.getCode(), "heartbeat"); } }
UTF-8
Java
381
java
MessageUtil.java
Java
[]
null
[]
package org.orange.manager.util; import org.orange.manager.domain.Message; import org.orange.manager.domain.MessageEnum; public class MessageUtil { public static Message command(String data) { return new Message(MessageEnum.COMMAND_CODE.getCode(), data); } public static Message heartbeat() { return new Message(MessageEnum.HEARTBEAT_CODE.getCode(), "heartbeat"); } }
381
0.766404
0.766404
16
22.8125
24.44693
72
false
false
0
0
0
0
0
0
0.9375
false
false
10
9f8b1d7e801247941203e7351043cdbca434794f
19,636,590,535,184
656709359cba8849074447b15e5c43c66e41e8df
/chat/Servidor/Servidor.java
57bb314dd6fe2650605b26f30e1a2b5a34ee5010
[]
no_license
zynks/chat-tematico-maligno
https://github.com/zynks/chat-tematico-maligno
e3f4042f7fab0c6a77d2a3b233e6209c92cf5ae6
9acb3e6bbd1ca342f7a3bed388b804d7d5244fce
refs/heads/master
2020-06-01T02:13:54.726000
2019-06-06T14:33:59
2019-06-06T14:33:59
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.HashMap; public class Servidor { public static void main (String[] args) { if (args.length>1) { System.err.println ("Uso esperado: java Servidor [PORTA]\n"); return; } int porta=12345; if (args.length==1) porta = Integer.parseInt(args[0]); HashMap<String,Parceiro> usuarios = new HashMap<String,Parceiro> (); AceitadoraDeConexao aceitadoraDeConexao=null; try { aceitadoraDeConexao = new AceitadoraDeConexao (porta, usuarios); aceitadoraDeConexao.start(); } catch (Exception erro) { System.err.println ("Escolha uma porta liberada para uso!\n"); return; } for(;;) { System.out.println ("O servidor esta ativo! Para desativa-lo,"); System.out.println ("use o comando \"desativar\"\n"); System.out.print ("> "); String comando=null; try { comando = Teclado.getUmString(); } catch (Exception erro) {} if (comando.toLowerCase().equals("desativar")) { synchronized (usuarios) { for (Parceiro usuario:usuarios.values()) { try { usuario.receba (new Comunicado ("FIM")); usuario.adeus (); } catch (Exception erro) {} } } System.out.println ("O servidor foi desativado!\n"); System.exit(0); } else System.err.println ("Comando invalido!\n"); } } }
UTF-8
Java
1,916
java
Servidor.java
Java
[]
null
[]
import java.util.HashMap; public class Servidor { public static void main (String[] args) { if (args.length>1) { System.err.println ("Uso esperado: java Servidor [PORTA]\n"); return; } int porta=12345; if (args.length==1) porta = Integer.parseInt(args[0]); HashMap<String,Parceiro> usuarios = new HashMap<String,Parceiro> (); AceitadoraDeConexao aceitadoraDeConexao=null; try { aceitadoraDeConexao = new AceitadoraDeConexao (porta, usuarios); aceitadoraDeConexao.start(); } catch (Exception erro) { System.err.println ("Escolha uma porta liberada para uso!\n"); return; } for(;;) { System.out.println ("O servidor esta ativo! Para desativa-lo,"); System.out.println ("use o comando \"desativar\"\n"); System.out.print ("> "); String comando=null; try { comando = Teclado.getUmString(); } catch (Exception erro) {} if (comando.toLowerCase().equals("desativar")) { synchronized (usuarios) { for (Parceiro usuario:usuarios.values()) { try { usuario.receba (new Comunicado ("FIM")); usuario.adeus (); } catch (Exception erro) {} } } System.out.println ("O servidor foi desativado!\n"); System.exit(0); } else System.err.println ("Comando invalido!\n"); } } }
1,916
0.434238
0.429541
72
25.625
21.403166
76
false
false
0
0
0
0
0
0
0.375
false
false
10
b5bfa50c8939b4b65ba04f6303daa35f2a2224d8
1,391,569,413,379
b8adcb3fb4181ab5910874bb53090bc7da980c81
/app/src/main/java/com/example/helpme/Details.java
1c4d48e22783dc4b4d6e319f1eeb3e84fdc48a48
[]
no_license
adas7579/HelpMe
https://github.com/adas7579/HelpMe
32f725ee92b27c7589717f88ea953e5951ead94d
b5a25770bcb88b7dafa8ba983a9af0b7b418766c
refs/heads/master
2020-06-12T11:15:57.969000
2019-07-03T04:45:23
2019-07-03T04:45:23
194,265,913
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.helpme; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import android.Manifest; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class Details extends AppCompatActivity { TextView na,pf,con,loc,rat; Sql sq=new Sql(this); String[] sp; int flag=0; Button fa; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_details); flag=getIntent().getIntExtra("flag",0); fa=findViewById(R.id.fa); if(flag==1) fa.setText("REMOVE FAVOURITE"); na=findViewById(R.id.na); pf=findViewById(R.id.pf); con=findViewById(R.id.con); loc=findViewById(R.id.loc); rat=findViewById(R.id.rat); String data=getIntent().getStringExtra("data"); sp =data.split(":"); na.setText(sp[1]); pf.setText(sp[2]); con.setText(sp[3]); loc.setText(sp[4]); rat.setText(sp[5]); Button call=findViewById(R.id.call); call.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String number=con.getText().toString(); Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:"+number)); try { startActivity(callIntent); }catch (SecurityException e){per();} } }); fa.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ok(); } }); } void ok() { if(flag==0) { int p=sq.add(sp); if(p==0) Toast.makeText(this,"Already Added!",Toast.LENGTH_SHORT).show(); else Toast.makeText(this,"Successfully Added",Toast.LENGTH_SHORT).show(); } else { sq.exe(sp[0]); Toast.makeText(this,"Removed From Favourites",Toast.LENGTH_SHORT).show(); Intent ff=new Intent(getApplicationContext(),fav.class); startActivity(ff); finish(); } } public void per() { if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { String pms[] = {Manifest.permission.CALL_PHONE}; ActivityCompat.requestPermissions(this, pms, 131); } } }
UTF-8
Java
2,880
java
Details.java
Java
[]
null
[]
package com.example.helpme; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import android.Manifest; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class Details extends AppCompatActivity { TextView na,pf,con,loc,rat; Sql sq=new Sql(this); String[] sp; int flag=0; Button fa; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_details); flag=getIntent().getIntExtra("flag",0); fa=findViewById(R.id.fa); if(flag==1) fa.setText("REMOVE FAVOURITE"); na=findViewById(R.id.na); pf=findViewById(R.id.pf); con=findViewById(R.id.con); loc=findViewById(R.id.loc); rat=findViewById(R.id.rat); String data=getIntent().getStringExtra("data"); sp =data.split(":"); na.setText(sp[1]); pf.setText(sp[2]); con.setText(sp[3]); loc.setText(sp[4]); rat.setText(sp[5]); Button call=findViewById(R.id.call); call.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String number=con.getText().toString(); Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:"+number)); try { startActivity(callIntent); }catch (SecurityException e){per();} } }); fa.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ok(); } }); } void ok() { if(flag==0) { int p=sq.add(sp); if(p==0) Toast.makeText(this,"Already Added!",Toast.LENGTH_SHORT).show(); else Toast.makeText(this,"Successfully Added",Toast.LENGTH_SHORT).show(); } else { sq.exe(sp[0]); Toast.makeText(this,"Removed From Favourites",Toast.LENGTH_SHORT).show(); Intent ff=new Intent(getApplicationContext(),fav.class); startActivity(ff); finish(); } } public void per() { if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { String pms[] = {Manifest.permission.CALL_PHONE}; ActivityCompat.requestPermissions(this, pms, 131); } } }
2,880
0.586111
0.58125
111
24.945946
24.249393
143
false
false
0
0
0
0
0
0
0.621622
false
false
10
bf4f4c6aceafd84eecb657701400260be9a8366f
25,486,335,942,802
abfa87b9a06699c02d77117d443836560063e7f9
/src/main/java/br/com/springproject02/service/UsuarioService.java
bdcae9c51605f0c82dbe0df4e466498353f18406
[]
no_license
Luka73/SpringProject02
https://github.com/Luka73/SpringProject02
e05cfc1a72667e216684426b91153d9b69db2f21
0d6fac73e66d32a7738a5fc2fb9b47cb1236329c
refs/heads/main
2023-03-26T07:40:45.219000
2021-03-25T01:00:56
2021-03-25T01:00:56
345,267,537
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.springproject02.service; import br.com.springproject02.entity.Usuario; import br.com.springproject02.interfaces.IUsuarioRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.transaction.Transactional; import java.util.List; @Service //define como classe de serviço do Spring @Transactional //permite o uso de transações de banco de dados public class UsuarioService { @Autowired private IUsuarioRepository usuarioRepository; public void createOrUpdate(Usuario usuario) throws Exception { if(usuario.getIdUsuario() == null && usuarioRepository.get(usuario.getEmail()).size() == 1) throw new Exception("O email informado já encontra-se cadastrado."); usuarioRepository.save(usuario); } public void delete(Usuario usuario) throws Exception { usuarioRepository.delete(usuario); } public List<Usuario> getAll() throws Exception { return (List<Usuario>) usuarioRepository.findAll(); } public Usuario get(Integer id) throws Exception{ return usuarioRepository.findById(id).get(); } public Usuario get(String email, String senha) throws Exception{ List<Usuario> result = usuarioRepository.get(email, senha); if(result.size() == 1) return result.get(0); //retornando o usuario obtido return null; } }
UTF-8
Java
1,439
java
UsuarioService.java
Java
[]
null
[]
package br.com.springproject02.service; import br.com.springproject02.entity.Usuario; import br.com.springproject02.interfaces.IUsuarioRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.transaction.Transactional; import java.util.List; @Service //define como classe de serviço do Spring @Transactional //permite o uso de transações de banco de dados public class UsuarioService { @Autowired private IUsuarioRepository usuarioRepository; public void createOrUpdate(Usuario usuario) throws Exception { if(usuario.getIdUsuario() == null && usuarioRepository.get(usuario.getEmail()).size() == 1) throw new Exception("O email informado já encontra-se cadastrado."); usuarioRepository.save(usuario); } public void delete(Usuario usuario) throws Exception { usuarioRepository.delete(usuario); } public List<Usuario> getAll() throws Exception { return (List<Usuario>) usuarioRepository.findAll(); } public Usuario get(Integer id) throws Exception{ return usuarioRepository.findById(id).get(); } public Usuario get(String email, String senha) throws Exception{ List<Usuario> result = usuarioRepository.get(email, senha); if(result.size() == 1) return result.get(0); //retornando o usuario obtido return null; } }
1,439
0.721254
0.714983
45
30.911112
28.000652
99
false
false
0
0
0
0
0
0
0.4
false
false
10
64d57548fa705eb0f1fb3a895e5c03274ca4c8b5
6,536,940,270,754
cf777d28c47058530aefd7b480bbeccdf1738d3c
/leetcode/7-reverse-integer.java
5116fa8f1767128be1687c98dd621a520b8ce795
[]
no_license
param17/coding-practise
https://github.com/param17/coding-practise
de337f0b0ba40d531918b172a3c455e2af90c1dd
76e77aa743c98faf9159981084be13f27f9b1c3d
refs/heads/master
2021-08-26T07:28:24.163000
2017-11-22T08:32:15
2017-11-22T08:32:15
110,504,383
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
//7. Reverse Integer //https://leetcode.com/problems/reverse-integer/description/ class Solution { public int reverse(int x) { int negative=0; long result=0; while(x!=0){ result = result*10 + x%10; x /= 10; if(result>Integer.MAX_VALUE||result<Integer.MIN_VALUE){ return 0; } } return (int)result; } }
UTF-8
Java
438
java
7-reverse-integer.java
Java
[]
null
[]
//7. Reverse Integer //https://leetcode.com/problems/reverse-integer/description/ class Solution { public int reverse(int x) { int negative=0; long result=0; while(x!=0){ result = result*10 + x%10; x /= 10; if(result>Integer.MAX_VALUE||result<Integer.MIN_VALUE){ return 0; } } return (int)result; } }
438
0.486301
0.461187
20
20.9
17.472549
67
false
false
0
0
0
0
0
0
0.4
false
false
10
cc10ac1235d6431fa333d03669624c7d2c7b72a9
23,656,679,875,330
890800045995c7092c18fc9e8cd0a53bf02d2028
/musidian-service-mall/src/main/java/com/shennong/dao/GoodsspecpropertyDao.java
81646b7d56c00287e4a000b2420c6bcbcd7c1c50
[]
no_license
jiejie2050/study
https://github.com/jiejie2050/study
4c80a1e8efc5701748ed58a53fae485364170627
d2fe77b29e06738106a0ee125378b7725b748360
refs/heads/master
2017-12-02T10:42:44.160000
2017-11-24T09:55:52
2017-11-24T09:55:52
85,267,221
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.shennong.dao; import com.musidian.dao.BaseDao; import com.shennong.entity.Goodsspecproperty; /** * * @author 木四点 * @version 创建时间:2016-11-22 * */ public interface GoodsspecpropertyDao extends BaseDao<Goodsspecproperty>{ }
UTF-8
Java
253
java
GoodsspecpropertyDao.java
Java
[ { "context": "nnong.entity.Goodsspecproperty;\n\n/**\n* \n* @author 木四点\n* @version 创建时间:2016-11-22\n*\n*/\npublic interface ", "end": 127, "score": 0.9885270595550537, "start": 124, "tag": "NAME", "value": "木四点" } ]
null
[]
package com.shennong.dao; import com.musidian.dao.BaseDao; import com.shennong.entity.Goodsspecproperty; /** * * @author 木四点 * @version 创建时间:2016-11-22 * */ public interface GoodsspecpropertyDao extends BaseDao<Goodsspecproperty>{ }
253
0.767932
0.734177
14
15.928572
21.238321
73
false
false
0
0
0
0
0
0
0.214286
false
false
10
a163640bcc766abca8f1a60bc3fe79d866f86fe5
6,631,429,546,367
3dfd70b8dc6cd7791ed856349921fd21d0bf50d5
/daikan/src/com/hltc/controller/AuthController.java
fe9e2b3bed3b1fc230fb1c27f16963d8142de7c1
[]
no_license
ChenHenghua/daikan
https://github.com/ChenHenghua/daikan
534e35a06c7b28328507b8af1a754a109aa12d8c
d803bd86183603c1b5a4ee0b4825291400fa6387
refs/heads/master
2020-04-16T13:31:51.600000
2016-06-06T08:42:30
2016-06-06T08:42:30
36,235,293
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hltc.controller; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Map; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import com.google.gson.JsonArray; import com.hltc.common.ErrorCode; import com.hltc.common.GlobalConstant; import com.hltc.common.Result; import com.hltc.entity.Token; import com.hltc.entity.User; import com.hltc.service.IUserService; import com.hltc.util.BeanUtil; import com.hltc.util.LogUtil; import static com.hltc.util.SecurityUtil.*; /** * 授权模块控制器 */ @Controller @Scope("prototype") @RequestMapping(value="/v1/auth") public class AuthController { @Autowired private IUserService userService; /** * 获取ossToken * @param jobj * @return */ @RequestMapping(value="/oss_token.json", method=RequestMethod.POST) public @ResponseBody Object login_by_token(@RequestBody JSONObject jobj){ //step0 参数验证 Map result = parametersValidate(jobj, new String[]{"user_id","token","content"}, true, String.class); if(null == result.get(Result.SUCCESS)) return result; //step1 登录验证 result = userService.loginByToken(jobj.getString("user_id"), jobj.getString("token")); if(null == result.get(Result.SUCCESS)) return result; JSONObject o = new JSONObject(); try { o.put("ossToken", generateOSSToken("wxGYeoOqFGIikopt", "eQyS38ArhJo0fIotIuLoiz0FCx0J4N", jobj.getString("content"))); } catch (Exception e) { LogUtil.error(e.getMessage()); e.printStackTrace(); } return Result.success(o); } }
UTF-8
Java
2,136
java
AuthController.java
Java
[ { "context": "\t\t\n\t\ttry {\n\t\t\to.put(\"ossToken\", generateOSSToken(\"wxGYeoOqFGIikopt\", \"eQyS38ArhJo0fIotIuLoiz0FCx0J4N\", jobj.getStrin", "end": 1914, "score": 0.7494654059410095, "start": 1898, "tag": "PASSWORD", "value": "wxGYeoOqFGIikopt" }, { "context": "\"ossToken\", generateOSSToken(\"wxGYeoOqFGIikopt\", \"eQyS38ArhJo0fIotIuLoiz0FCx0J4N\", jobj.getString(\"co", "end": 1919, "score": 0.6183115839958191, "start": 1918, "tag": "PASSWORD", "value": "e" }, { "context": "ossToken\", generateOSSToken(\"wxGYeoOqFGIikopt\", \"eQyS38ArhJo0fIotIuLoiz0FCx0J4N\", jobj.getString(\"cont", "end": 1921, "score": 0.505513608455658, "start": 1919, "tag": "KEY", "value": "Qy" }, { "context": "sToken\", generateOSSToken(\"wxGYeoOqFGIikopt\", \"eQyS38ArhJo0fIotIuLoiz0FCx0J4N\", jobj.getString(\"content\"))", "end": 1927, "score": 0.5229591727256775, "start": 1921, "tag": "PASSWORD", "value": "S38Arh" }, { "context": "\", generateOSSToken(\"wxGYeoOqFGIikopt\", \"eQyS38ArhJo0fIotIuLoiz0FCx0J4N\", jobj.getString(\"content\")));", "end": 1929, "score": 0.4879530668258667, "start": 1927, "tag": "KEY", "value": "Jo" }, { "context": " generateOSSToken(\"wxGYeoOqFGIikopt\", \"eQyS38ArhJo0fIotIuLoiz0FCx0J4N\", jobj.getString(\"content\")));\n\t", "end": 1931, "score": 0.5372809171676636, "start": 1929, "tag": "PASSWORD", "value": "0f" }, { "context": "enerateOSSToken(\"wxGYeoOqFGIikopt\", \"eQyS38ArhJo0fIotIuLoiz0FCx0J4N\", jobj.getString(\"content\")));\n\t\t", "end": 1932, "score": 0.4950505495071411, "start": 1931, "tag": "KEY", "value": "I" }, { "context": "nerateOSSToken(\"wxGYeoOqFGIikopt\", \"eQyS38ArhJo0fIotIuLoiz0FCx0J4N\", jobj.getString(\"content\")));\n\t\t} ca", "end": 1936, "score": 0.5159437656402588, "start": 1932, "tag": "PASSWORD", "value": "otIu" }, { "context": "teOSSToken(\"wxGYeoOqFGIikopt\", \"eQyS38ArhJo0fIotIuLoiz0FCx0J4N\", jobj.getString(\"content\")));\n\t\t} catc", "end": 1938, "score": 0.5009132027626038, "start": 1936, "tag": "KEY", "value": "Lo" }, { "context": "OSSToken(\"wxGYeoOqFGIikopt\", \"eQyS38ArhJo0fIotIuLoiz0FCx0J4N\", jobj.getString(\"content\")));\n\t\t} catch (", "end": 1941, "score": 0.5065410137176514, "start": 1938, "tag": "PASSWORD", "value": "iz0" }, { "context": "Token(\"wxGYeoOqFGIikopt\", \"eQyS38ArhJo0fIotIuLoiz0FCx0J4N\", jobj.getString(\"content\")));\n\t\t} catch (Except", "end": 1947, "score": 0.5139328837394714, "start": 1941, "tag": "KEY", "value": "FCx0J4" }, { "context": "\"wxGYeoOqFGIikopt\", \"eQyS38ArhJo0fIotIuLoiz0FCx0J4N\", jobj.getString(\"content\")));\n\t\t} catch (Excepti", "end": 1948, "score": 0.5214259028434753, "start": 1947, "tag": "PASSWORD", "value": "N" } ]
null
[]
package com.hltc.controller; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Map; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import com.google.gson.JsonArray; import com.hltc.common.ErrorCode; import com.hltc.common.GlobalConstant; import com.hltc.common.Result; import com.hltc.entity.Token; import com.hltc.entity.User; import com.hltc.service.IUserService; import com.hltc.util.BeanUtil; import com.hltc.util.LogUtil; import static com.hltc.util.SecurityUtil.*; /** * 授权模块控制器 */ @Controller @Scope("prototype") @RequestMapping(value="/v1/auth") public class AuthController { @Autowired private IUserService userService; /** * 获取ossToken * @param jobj * @return */ @RequestMapping(value="/oss_token.json", method=RequestMethod.POST) public @ResponseBody Object login_by_token(@RequestBody JSONObject jobj){ //step0 参数验证 Map result = parametersValidate(jobj, new String[]{"user_id","token","content"}, true, String.class); if(null == result.get(Result.SUCCESS)) return result; //step1 登录验证 result = userService.loginByToken(jobj.getString("user_id"), jobj.getString("token")); if(null == result.get(Result.SUCCESS)) return result; JSONObject o = new JSONObject(); try { o.put("ossToken", generateOSSToken("<PASSWORD>", "eQy<PASSWORD>Jo0fI<PASSWORD>Loiz0FCx0J4N", jobj.getString("content"))); } catch (Exception e) { LogUtil.error(e.getMessage()); e.printStackTrace(); } return Result.success(o); } }
2,140
0.772122
0.76784
70
29.028572
25.982946
120
false
false
0
0
0
0
0
0
1.328571
false
false
10
b1c44a452d0fb7d31e85a2289a440f1c074e351b
16,260,746,205,879
475ae36f55e20d20b07b90cd1d47db643c2c9ac1
/msk-dev/msk-ds/src/main/java/com/msk/ds/bean/DS173201Param.java
046819ef88201e2a96a66b52fe3559fc543843aa
[]
no_license
moutainhigh/xcdv1
https://github.com/moutainhigh/xcdv1
ec364b5d78c55d42ecb6fd42c589069b2e33db92
22dcf0ff9ec645c0e5cef946ff5451730f518b22
refs/heads/master
2021-06-22T00:38:58.095000
2017-08-14T02:57:37
2017-08-14T02:57:37
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.msk.ds.bean; import java.math.BigDecimal; import java.util.List; /** * zhou_yajun on 2016/1/28. */ public class DS173201Param { /** serialVersionUID */ private static final long serialVersionUID = 1L; private String areaCode; private String sellerCode; private String areaName; private String sellerName; private String distMonth; public String getAreaCode() { return areaCode; } public void setAreaCode(String areaCode) { this.areaCode = areaCode; } public String getSellerCode() { return sellerCode; } public void setSellerCode(String sellerCode) { this.sellerCode = sellerCode; } public String getAreaName() { return areaName; } public void setAreaName(String areaName) { this.areaName = areaName; } public String getSellerName() { return sellerName; } public void setSellerName(String sellerName) { this.sellerName = sellerName; } public String getDistMonth() { return distMonth; } public void setDistMonth(String distMonth) { this.distMonth = distMonth; } }
UTF-8
Java
1,184
java
DS173201Param.java
Java
[ { "context": "va.math.BigDecimal;\nimport java.util.List;\n\n/**\n * zhou_yajun on 2016/1/28.\n */\npublic class DS173201Param {\n ", "end": 96, "score": 0.9994168877601624, "start": 86, "tag": "USERNAME", "value": "zhou_yajun" } ]
null
[]
package com.msk.ds.bean; import java.math.BigDecimal; import java.util.List; /** * zhou_yajun on 2016/1/28. */ public class DS173201Param { /** serialVersionUID */ private static final long serialVersionUID = 1L; private String areaCode; private String sellerCode; private String areaName; private String sellerName; private String distMonth; public String getAreaCode() { return areaCode; } public void setAreaCode(String areaCode) { this.areaCode = areaCode; } public String getSellerCode() { return sellerCode; } public void setSellerCode(String sellerCode) { this.sellerCode = sellerCode; } public String getAreaName() { return areaName; } public void setAreaName(String areaName) { this.areaName = areaName; } public String getSellerName() { return sellerName; } public void setSellerName(String sellerName) { this.sellerName = sellerName; } public String getDistMonth() { return distMonth; } public void setDistMonth(String distMonth) { this.distMonth = distMonth; } }
1,184
0.641047
0.629223
62
18.096775
16.880711
52
false
false
0
0
0
0
0
0
0.306452
false
false
10
7ca919116dcda2a0057becb0e7e36e4b6bcb4423
26,027,501,837,185
692f1cd0320a82b11329bb0818d0883c694fce97
/app/src/main/java/com/samsung/srin/bilkill/service/TrackingService.java
aa897124a50d5484d905aebd68b27eba1e15bbed
[]
no_license
testdeveloper12/knox
https://github.com/testdeveloper12/knox
7b3c5f003dc570f2e079952faf2a35f22a0d48d0
32d6e670fceee2dec1972d7a694ecc59e172b85e
refs/heads/master
2020-04-22T16:19:09.289000
2018-01-29T02:28:15
2018-01-29T02:28:15
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.samsung.srin.bilkill.service; import android.app.IntentService; import android.content.Context; import android.content.Intent; import android.location.Location; import android.location.LocationManager; import android.util.Log; import com.samsung.srin.bilkill.HttpClient; import com.samsung.srin.bilkill.R; import com.samsung.srin.bilkill.util.RegisterUtil; import org.json.JSONException; import org.json.JSONObject; import java.io.IOException; import java.util.Calendar; import java.util.List; /** * Created by SRIN on 8/13/2015. */ public class TrackingService extends IntentService { public final static int TIME_INTERVAL = 5*60; public final static long LOCATION_UPDATE_MIN_DIFF_TIME = 30*60*1000; private final static String TAG = TrackingService.class.getCanonicalName(); public TrackingService(){ super("TrackingService"); } @Override protected void onHandleIntent(Intent intent) { Log.d(TAG, "Time = " + System.currentTimeMillis()); Location location = getLocation(); try { if(location != null) { sendLocationUpdate(location); } } catch (IOException e){ Log.d(TAG, "IO Exception when send location update", e); } } private void sendLocationUpdate(Location location) throws IOException { JSONObject jsonRequest = new JSONObject(); try { jsonRequest.put("device_id", RegisterUtil.getRegistrationId(this)); jsonRequest.put("device_location", String.format("%f,%f", location.getLatitude(), location.getLongitude())); }catch (JSONException e){ Log.e(TAG, "JSON Exception", e); } String url = getLocationUpdateUrl(this); Log.d(TAG, "Post request to : " + url); Log.d(TAG, "json : " + jsonRequest.toString()); HttpClient.getInstance().post(getApplicationContext(),url, jsonRequest.toString()); } private String getLocationUpdateUrl(Context context){ String serverUrl = context.getString(R.string.server_uri); return context.getString(R.string.loc_update_uri, serverUrl); } private Location getLocation(){ // LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); // return locationManager.getLastKnownLocation(locationManager.GPS_PROVIDER); return getBestLocation(); } private Location getBestLocation() { LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); List<String> matchingProviders = locationManager.getAllProviders(); long minTime = System.currentTimeMillis() - LOCATION_UPDATE_MIN_DIFF_TIME; long bestTime = Long.MAX_VALUE; float bestAccuracy = Float.MAX_VALUE; Location bestResult = null; for (String provider: matchingProviders) { Location location = locationManager.getLastKnownLocation(provider); if (location != null) { float accuracy = location.getAccuracy(); long time = location.getTime(); if ((time > minTime && accuracy < bestAccuracy)) { bestResult = location; bestAccuracy = accuracy; bestTime = time; } else if (time < minTime && bestAccuracy == Float.MAX_VALUE && time > bestTime){ bestResult = location; bestTime = time; } } } return bestResult; } }
UTF-8
Java
3,637
java
TrackingService.java
Java
[ { "context": "alendar;\nimport java.util.List;\n\n/**\n * Created by SRIN on 8/13/2015.\n */\npublic class TrackingService ex", "end": 533, "score": 0.9977874755859375, "start": 529, "tag": "USERNAME", "value": "SRIN" } ]
null
[]
package com.samsung.srin.bilkill.service; import android.app.IntentService; import android.content.Context; import android.content.Intent; import android.location.Location; import android.location.LocationManager; import android.util.Log; import com.samsung.srin.bilkill.HttpClient; import com.samsung.srin.bilkill.R; import com.samsung.srin.bilkill.util.RegisterUtil; import org.json.JSONException; import org.json.JSONObject; import java.io.IOException; import java.util.Calendar; import java.util.List; /** * Created by SRIN on 8/13/2015. */ public class TrackingService extends IntentService { public final static int TIME_INTERVAL = 5*60; public final static long LOCATION_UPDATE_MIN_DIFF_TIME = 30*60*1000; private final static String TAG = TrackingService.class.getCanonicalName(); public TrackingService(){ super("TrackingService"); } @Override protected void onHandleIntent(Intent intent) { Log.d(TAG, "Time = " + System.currentTimeMillis()); Location location = getLocation(); try { if(location != null) { sendLocationUpdate(location); } } catch (IOException e){ Log.d(TAG, "IO Exception when send location update", e); } } private void sendLocationUpdate(Location location) throws IOException { JSONObject jsonRequest = new JSONObject(); try { jsonRequest.put("device_id", RegisterUtil.getRegistrationId(this)); jsonRequest.put("device_location", String.format("%f,%f", location.getLatitude(), location.getLongitude())); }catch (JSONException e){ Log.e(TAG, "JSON Exception", e); } String url = getLocationUpdateUrl(this); Log.d(TAG, "Post request to : " + url); Log.d(TAG, "json : " + jsonRequest.toString()); HttpClient.getInstance().post(getApplicationContext(),url, jsonRequest.toString()); } private String getLocationUpdateUrl(Context context){ String serverUrl = context.getString(R.string.server_uri); return context.getString(R.string.loc_update_uri, serverUrl); } private Location getLocation(){ // LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); // return locationManager.getLastKnownLocation(locationManager.GPS_PROVIDER); return getBestLocation(); } private Location getBestLocation() { LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); List<String> matchingProviders = locationManager.getAllProviders(); long minTime = System.currentTimeMillis() - LOCATION_UPDATE_MIN_DIFF_TIME; long bestTime = Long.MAX_VALUE; float bestAccuracy = Float.MAX_VALUE; Location bestResult = null; for (String provider: matchingProviders) { Location location = locationManager.getLastKnownLocation(provider); if (location != null) { float accuracy = location.getAccuracy(); long time = location.getTime(); if ((time > minTime && accuracy < bestAccuracy)) { bestResult = location; bestAccuracy = accuracy; bestTime = time; } else if (time < minTime && bestAccuracy == Float.MAX_VALUE && time > bestTime){ bestResult = location; bestTime = time; } } } return bestResult; } }
3,637
0.637888
0.632939
108
32.685184
28.264835
111
false
false
0
0
0
0
0
0
0.611111
false
false
10
01775b96f9a6f956a7c5956b5cd4d188c7d8e496
33,998,961,122,477
c859b11e23236a6a452cd5a33b66f34797a2f6d8
/VitualChat1/src/Frame/ChatFrame.java
7593db912468d9da9b91ce84bd1c1c20973bd83e
[]
no_license
zhengdaoli/VitualChat
https://github.com/zhengdaoli/VitualChat
ea09aa4061baf6576a621380b2abd2cccf40895f
64334e46fd9e80302836309de16a6833e5fd8fd0
refs/heads/master
2021-05-30T19:15:45.257000
2016-03-15T13:38:11
2016-03-15T13:38:11
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Frame; import java.awt.BorderLayout; import java.awt.Button; import java.awt.Color; import java.awt.FlowLayout; import java.awt.Frame; import java.awt.Image; import java.awt.Label; import java.awt.Panel; import java.awt.TextArea; import java.awt.TextField; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.io.IOException; import java.io.InputStream; import java.net.ServerSocket; import java.net.Socket; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.text.TabableView; import org.json.JSONException; import org.json.JSONObject; import org.omg.CORBA.portable.OutputStream; import java.io.*; ///////////directly scp to chat each other!!!!!!!!!!!!!1 public class ChatFrame extends JFrame implements Runnable,ActionListener{ private int port; private String ip; String ChatName; JPanel head ; JPanel show ; JPanel write ; JScrollPane jspshow; JScrollPane jspwrite; ImageIcon User; JLabel headlb; JTextArea showta; JTextArea writeta; JTextField showname; JButton sendjb; DataOutputStream outmes; public ChatFrame(String chatname){//主动聊天 try { outmes=new DataOutputStream(Launch.cssocket.getOutputStream()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } this.port= port; this.ChatName=chatname; this.setLayout(new BorderLayout()); head=new JPanel(); head.setSize(400, 100); User=new ImageIcon("img/user1.jpg");//User=new ImageIcon("img/chatname.jpg"); Image user; user=User.getImage().getScaledInstance(80, 80, Image.SCALE_FAST); User =new ImageIcon(user); headlb=new JLabel(User); showname=new JTextField(chatname); // show=new JPanel(); // show.setSize(400, 200); write=new JPanel(); write.setSize(400, 200); jspshow=new JScrollPane(showta=new JTextArea(10,30)); jspshow.setSize(500, 200); jspwrite=new JScrollPane(writeta=new JTextArea(7,20)); jspwrite.setSize(400,200); head.add(headlb); head.add(showname); // show.add(showta=new JTextArea(15,30)); write.add(jspwrite); // write.add(writeta=new JTextArea(7,20)); write.add(sendjb=new JButton("send")); sendjb.addActionListener(this); showta.disable(); showta.setLineWrap(true); writeta.setLineWrap(true); this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.out.println("it works??"); Launch.chatManager.Remove(ChatName); System.out.println(Launch.chatManager.Check(ChatName)); dispose(); } }); this.add(head,"North"); this.add(jspshow,"Center"); this.add(write,"South"); this.setVisible(true); this.setLocationRelativeTo(null); this.setSize(400, 500); } //////////////用来监听是否下线???????????? @Override public void run() { // TODO Auto-generated method stub } public void showmes(String mes){ showta.append(mes+"\n"); } @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub try { JSONObject mes=new JSONObject(); mes.put("type", "1"); mes.put("chatname", ChatName); mes.put("content", writeta.getText()); outmes.writeUTF(mes.toString()); outmes.flush(); String mymes ="我说:"+writeta.getText()+"\n"; showta.append(mymes); writeta.setText(""); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (JSONException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }
GB18030
Java
4,291
java
ChatFrame.java
Java
[ { "context": "e();\r\n\t\t\t}\r\n\t\t\tthis.port= port;\r\n\t\t\tthis.ChatName=chatname;\r\n\t\t\tthis.setLayout(new BorderLayout());\r\n\t\t\thead", "end": 1858, "score": 0.979839563369751, "start": 1850, "tag": "USERNAME", "value": "chatname" } ]
null
[]
package Frame; import java.awt.BorderLayout; import java.awt.Button; import java.awt.Color; import java.awt.FlowLayout; import java.awt.Frame; import java.awt.Image; import java.awt.Label; import java.awt.Panel; import java.awt.TextArea; import java.awt.TextField; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.io.IOException; import java.io.InputStream; import java.net.ServerSocket; import java.net.Socket; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.text.TabableView; import org.json.JSONException; import org.json.JSONObject; import org.omg.CORBA.portable.OutputStream; import java.io.*; ///////////directly scp to chat each other!!!!!!!!!!!!!1 public class ChatFrame extends JFrame implements Runnable,ActionListener{ private int port; private String ip; String ChatName; JPanel head ; JPanel show ; JPanel write ; JScrollPane jspshow; JScrollPane jspwrite; ImageIcon User; JLabel headlb; JTextArea showta; JTextArea writeta; JTextField showname; JButton sendjb; DataOutputStream outmes; public ChatFrame(String chatname){//主动聊天 try { outmes=new DataOutputStream(Launch.cssocket.getOutputStream()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } this.port= port; this.ChatName=chatname; this.setLayout(new BorderLayout()); head=new JPanel(); head.setSize(400, 100); User=new ImageIcon("img/user1.jpg");//User=new ImageIcon("img/chatname.jpg"); Image user; user=User.getImage().getScaledInstance(80, 80, Image.SCALE_FAST); User =new ImageIcon(user); headlb=new JLabel(User); showname=new JTextField(chatname); // show=new JPanel(); // show.setSize(400, 200); write=new JPanel(); write.setSize(400, 200); jspshow=new JScrollPane(showta=new JTextArea(10,30)); jspshow.setSize(500, 200); jspwrite=new JScrollPane(writeta=new JTextArea(7,20)); jspwrite.setSize(400,200); head.add(headlb); head.add(showname); // show.add(showta=new JTextArea(15,30)); write.add(jspwrite); // write.add(writeta=new JTextArea(7,20)); write.add(sendjb=new JButton("send")); sendjb.addActionListener(this); showta.disable(); showta.setLineWrap(true); writeta.setLineWrap(true); this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.out.println("it works??"); Launch.chatManager.Remove(ChatName); System.out.println(Launch.chatManager.Check(ChatName)); dispose(); } }); this.add(head,"North"); this.add(jspshow,"Center"); this.add(write,"South"); this.setVisible(true); this.setLocationRelativeTo(null); this.setSize(400, 500); } //////////////用来监听是否下线???????????? @Override public void run() { // TODO Auto-generated method stub } public void showmes(String mes){ showta.append(mes+"\n"); } @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub try { JSONObject mes=new JSONObject(); mes.put("type", "1"); mes.put("chatname", ChatName); mes.put("content", writeta.getText()); outmes.writeUTF(mes.toString()); outmes.flush(); String mymes ="我说:"+writeta.getText()+"\n"; showta.append(mymes); writeta.setText(""); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (JSONException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }
4,291
0.661005
0.646615
174
22.350574
16.70013
80
false
false
0
0
0
0
0
0
2.465517
false
false
10
a77219b22015c7ce1ba4d53c8906d55f4f417287
7,679,401,569,716
031220c2c805db63d5f8c23138289a9e993632c5
/GitJenkins/src/GitIsFun/CalenderMain.java
c43135179137d46c6c22d29dee99048f9dc82301
[]
no_license
serakis/EclipseRepo
https://github.com/serakis/EclipseRepo
5f3697a9224e99c10b3e38abc1eeb67a86479726
35bda0071550bc1e6b456bd7a065f7a9a609c102
refs/heads/master
2021-01-21T01:46:53.670000
2013-03-22T09:08:50
2013-03-22T09:08:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package GitIsFun; public class CalenderMain { public static void main(String[] args){ CalenderClass Appoint1 = new CalenderClass(1, "Meeting planned"); CalenderClass Appoint2 = new CalenderClass(2, "Kick Off planned"); System.out.println(Appoint1.toString()); System.out.println(Appoint2.toString()); } }
UTF-8
Java
320
java
CalenderMain.java
Java
[]
null
[]
package GitIsFun; public class CalenderMain { public static void main(String[] args){ CalenderClass Appoint1 = new CalenderClass(1, "Meeting planned"); CalenderClass Appoint2 = new CalenderClass(2, "Kick Off planned"); System.out.println(Appoint1.toString()); System.out.println(Appoint2.toString()); } }
320
0.7375
0.71875
12
25.666666
24.770054
68
false
false
0
0
0
0
0
0
1.583333
false
false
10
78ad4a4376538686e264cbf97fc006f54ade57ea
35,278,861,371,113
c1209f2752f2872dd613817f887481d01453fdba
/src/main/java/com/djcps/boot/modules/user/package-info.java
d70788f07a0c483005402c64258690ecb94ab10d
[]
no_license
clamwork/bi
https://github.com/clamwork/bi
a0d23bc161e291793aa45905b7f085fa4f277774
501ab909556c13a873c711c768041dd4c06fa053
refs/heads/master
2021-04-09T11:16:45.184000
2018-06-25T06:13:09
2018-06-25T06:13:09
125,317,496
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * 用户模块 * 包含内部用户、外部用户 * @author Chengw * @since 2018/3/15 10:15. * @version 1.0.0 */ package com.djcps.boot.modules.user;
UTF-8
Java
160
java
package-info.java
Java
[ { "context": "/**\n * 用户模块\n * 包含内部用户、外部用户\n * @author Chengw\n * @since 2018/3/15 10:15.\n * @version 1.0.0\n */\n", "end": 44, "score": 0.998070478439331, "start": 38, "tag": "USERNAME", "value": "Chengw" } ]
null
[]
/** * 用户模块 * 包含内部用户、外部用户 * @author Chengw * @since 2018/3/15 10:15. * @version 1.0.0 */ package com.djcps.boot.modules.user;
160
0.630769
0.523077
8
15.375
10.734728
36
false
false
0
0
0
0
0
0
0.125
false
false
10
9da5d74fdea54eaacd9243d70dc29d15fbb7e49c
901,943,188,561
d2984ba2b5ff607687aac9c65ccefa1bd6e41ede
/src/net/datenwerke/gxtdto/client/resources/BaseResources.java
d9743f63209d9a5a94c2519d26872ceb74435a0e
[]
no_license
bireports/ReportServer
https://github.com/bireports/ReportServer
da979eaf472b3e199e6fbd52b3031f0e819bff14
0f9b9dca75136c2bfc20aa611ebbc7dc24cfde62
refs/heads/master
2020-04-18T10:18:56.181000
2019-01-25T00:45:14
2019-01-25T00:45:14
167,463,795
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * ReportServer * Copyright (c) 2018 InfoFabrik GmbH * http://reportserver.net/ * * * This file is part of ReportServer. * * ReportServer is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package net.datenwerke.gxtdto.client.resources; import com.google.gwt.core.client.GWT; import com.google.gwt.resources.client.ClientBundle; import com.google.gwt.resources.client.ImageResource; public interface BaseResources extends ClientBundle { public static BaseResources INSTANCE = GWT.create(BaseResources.class); @Source("img/i/s.gif") ImageResource emptyImage(); @Source("img/i/column_single.png") ImageResource columnSingle(); @Source("img/i/column_double.png") ImageResource columnDouble(); @Source("img/i/column_double_l.png") ImageResource columnDoubleL(); @Source("img/i/column_double_r.png") ImageResource columnDoubleR(); @Source("img/i/column_tripple.png") ImageResource columnTripple(); @Source("img/i/100bar.png") ImageResource saikuChart100bar(); @Source("img/i/area.png") ImageResource saikuChartArea(); @Source("img/i/bar.png") ImageResource saikuChartBar(); @Source("img/i/dot.png") ImageResource saikuChartDot(); @Source("img/i/heat.png") ImageResource saikuChartHeat(); @Source("img/i/line.png") ImageResource saikuChartLine(); @Source("img/i/multiple.png") ImageResource saikuChartMultiple(); @Source("img/i/pie.png") ImageResource saikuChartPie(); @Source("img/i/stackedbar.png") ImageResource saikuChartStackedbar(); @Source("img/i/waterfall.png") ImageResource saikuChartWaterfall(); @Source("img/i/sunburst.png") ImageResource saikuChartSunburst(); @Source("img/i/multiplesunburst.png") ImageResource saikuChartMultiSunburst(); }
UTF-8
Java
2,425
java
BaseResources.java
Java
[]
null
[]
/* * ReportServer * Copyright (c) 2018 InfoFabrik GmbH * http://reportserver.net/ * * * This file is part of ReportServer. * * ReportServer is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package net.datenwerke.gxtdto.client.resources; import com.google.gwt.core.client.GWT; import com.google.gwt.resources.client.ClientBundle; import com.google.gwt.resources.client.ImageResource; public interface BaseResources extends ClientBundle { public static BaseResources INSTANCE = GWT.create(BaseResources.class); @Source("img/i/s.gif") ImageResource emptyImage(); @Source("img/i/column_single.png") ImageResource columnSingle(); @Source("img/i/column_double.png") ImageResource columnDouble(); @Source("img/i/column_double_l.png") ImageResource columnDoubleL(); @Source("img/i/column_double_r.png") ImageResource columnDoubleR(); @Source("img/i/column_tripple.png") ImageResource columnTripple(); @Source("img/i/100bar.png") ImageResource saikuChart100bar(); @Source("img/i/area.png") ImageResource saikuChartArea(); @Source("img/i/bar.png") ImageResource saikuChartBar(); @Source("img/i/dot.png") ImageResource saikuChartDot(); @Source("img/i/heat.png") ImageResource saikuChartHeat(); @Source("img/i/line.png") ImageResource saikuChartLine(); @Source("img/i/multiple.png") ImageResource saikuChartMultiple(); @Source("img/i/pie.png") ImageResource saikuChartPie(); @Source("img/i/stackedbar.png") ImageResource saikuChartStackedbar(); @Source("img/i/waterfall.png") ImageResource saikuChartWaterfall(); @Source("img/i/sunburst.png") ImageResource saikuChartSunburst(); @Source("img/i/multiplesunburst.png") ImageResource saikuChartMultiSunburst(); }
2,425
0.717526
0.71299
87
25.873564
22.023396
75
false
false
0
0
0
0
0
0
0.885057
false
false
10
52beb3f754acbb382fdb74fa9f993d7bab6f7c24
2,267,742,797,863
818af66b4fd2ee2358c13ab5f998df5952d2e87d
/lab_2_3/src/java/by/bsuir/vsrpp/tsopr/dbcontroller/PostJpaController.java
08e5267158464ef88f45b86e2b34227c71fceb9a
[]
no_license
zloykrivedka/labsSit
https://github.com/zloykrivedka/labsSit
6c7d89edc538976c915ceda2b67ee69ab40dcb8a
19eaa9d7da3ce80bab91da22a400421a83667a4b
refs/heads/master
2018-01-12T03:06:47.219000
2015-06-06T13:41:09
2015-06-06T13:41:09
36,980,254
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 by.bsuir.vsrpp.tsopr.dbcontroller; import by.bsuir.vsrpp.tsopr.dbcontroller.exceptions.IllegalOrphanException; import by.bsuir.vsrpp.tsopr.dbcontroller.exceptions.NonexistentEntityException; import java.io.Serializable; import javax.persistence.Query; import javax.persistence.EntityNotFoundException; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Root; import by.bsuir.vsrpp.tsopr.model.Personal; import by.bsuir.vsrpp.tsopr.model.Post; import java.util.ArrayList; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; /** * * @author krivedko */ public class PostJpaController implements Serializable { public PostJpaController(EntityManagerFactory emf) { this.emf = emf; } private EntityManagerFactory emf = null; public EntityManager getEntityManager() { return emf.createEntityManager(); } public void create(Post post) { if (post.getPersonalList() == null) { post.setPersonalList(new ArrayList<Personal>()); } EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); List<Personal> attachedPersonalList = new ArrayList<Personal>(); for (Personal personalListPersonalToAttach : post.getPersonalList()) { personalListPersonalToAttach = em.getReference(personalListPersonalToAttach.getClass(), personalListPersonalToAttach.getIdPersonal()); attachedPersonalList.add(personalListPersonalToAttach); } post.setPersonalList(attachedPersonalList); em.persist(post); for (Personal personalListPersonal : post.getPersonalList()) { Post oldIdPostOfPersonalListPersonal = personalListPersonal.getIdPost(); personalListPersonal.setIdPost(post); personalListPersonal = em.merge(personalListPersonal); if (oldIdPostOfPersonalListPersonal != null) { oldIdPostOfPersonalListPersonal.getPersonalList().remove(personalListPersonal); oldIdPostOfPersonalListPersonal = em.merge(oldIdPostOfPersonalListPersonal); } } em.getTransaction().commit(); } finally { if (em != null) { em.close(); } } } public void edit(Post post) throws IllegalOrphanException, NonexistentEntityException, Exception { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); Post persistentPost = em.find(Post.class, post.getIdPost()); List<Personal> personalListOld = persistentPost.getPersonalList(); List<Personal> personalListNew = post.getPersonalList(); List<String> illegalOrphanMessages = null; if (illegalOrphanMessages != null) { throw new IllegalOrphanException(illegalOrphanMessages); } List<Personal> attachedPersonalListNew = new ArrayList<Personal>(); personalListNew = attachedPersonalListNew; post.setPersonalList(personalListNew); post = em.merge(post); for (Personal personalListNewPersonal : personalListNew) { if (!personalListOld.contains(personalListNewPersonal)) { Post oldIdPostOfPersonalListNewPersonal = personalListNewPersonal.getIdPost(); personalListNewPersonal.setIdPost(post); personalListNewPersonal = em.merge(personalListNewPersonal); if (oldIdPostOfPersonalListNewPersonal != null && !oldIdPostOfPersonalListNewPersonal.equals(post)) { oldIdPostOfPersonalListNewPersonal.getPersonalList().remove(personalListNewPersonal); oldIdPostOfPersonalListNewPersonal = em.merge(oldIdPostOfPersonalListNewPersonal); } } } em.getTransaction().commit(); } catch (Exception ex) { String msg = ex.getLocalizedMessage(); if (msg == null || msg.length() == 0) { Integer id = post.getIdPost(); if (findPost(id) == null) { throw new NonexistentEntityException("The post with id " + id + " no longer exists."); } } throw ex; } finally { if (em != null) { em.close(); } } } public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); Post post; try { post = em.getReference(Post.class, id); post.getIdPost(); } catch (EntityNotFoundException enfe) { throw new NonexistentEntityException("The post with id " + id + " no longer exists.", enfe); } List<String> illegalOrphanMessages = null; List<Personal> personalListOrphanCheck = post.getPersonalList(); for (Personal personalListOrphanCheckPersonal : personalListOrphanCheck) { if (illegalOrphanMessages == null) { illegalOrphanMessages = new ArrayList<String>(); } illegalOrphanMessages.add("This Post (" + post + ") cannot be destroyed since the Personal " + personalListOrphanCheckPersonal + " in its personalList field has a non-nullable idPost field."); } if (illegalOrphanMessages != null) { throw new IllegalOrphanException(illegalOrphanMessages); } em.remove(post); em.getTransaction().commit(); } finally { if (em != null) { em.close(); } } } public List<Post> findPostEntities() { return findPostEntities(true, -1, -1); } public List<Post> findPostEntities(int maxResults, int firstResult) { return findPostEntities(false, maxResults, firstResult); } private List<Post> findPostEntities(boolean all, int maxResults, int firstResult) { EntityManager em = getEntityManager(); try { CriteriaQuery cq = em.getCriteriaBuilder().createQuery(); cq.select(cq.from(Post.class)); Query q = em.createQuery(cq); if (!all) { q.setMaxResults(maxResults); q.setFirstResult(firstResult); } return q.getResultList(); } finally { em.close(); } } public Post findPost(Integer id) { EntityManager em = getEntityManager(); try { return em.find(Post.class, id); } finally { em.close(); } } public int getPostCount() { EntityManager em = getEntityManager(); try { CriteriaQuery cq = em.getCriteriaBuilder().createQuery(); Root<Post> rt = cq.from(Post.class); cq.select(em.getCriteriaBuilder().count(rt)); Query q = em.createQuery(cq); return ((Long) q.getSingleResult()).intValue(); } finally { em.close(); } } }
UTF-8
Java
7,670
java
PostJpaController.java
Java
[ { "context": "rsistence.EntityManagerFactory;\n\n/**\n *\n * @author krivedko\n */\npublic class PostJpaController implements Ser", "end": 834, "score": 0.9995477795600891, "start": 826, "tag": "USERNAME", "value": "krivedko" } ]
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 by.bsuir.vsrpp.tsopr.dbcontroller; import by.bsuir.vsrpp.tsopr.dbcontroller.exceptions.IllegalOrphanException; import by.bsuir.vsrpp.tsopr.dbcontroller.exceptions.NonexistentEntityException; import java.io.Serializable; import javax.persistence.Query; import javax.persistence.EntityNotFoundException; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Root; import by.bsuir.vsrpp.tsopr.model.Personal; import by.bsuir.vsrpp.tsopr.model.Post; import java.util.ArrayList; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; /** * * @author krivedko */ public class PostJpaController implements Serializable { public PostJpaController(EntityManagerFactory emf) { this.emf = emf; } private EntityManagerFactory emf = null; public EntityManager getEntityManager() { return emf.createEntityManager(); } public void create(Post post) { if (post.getPersonalList() == null) { post.setPersonalList(new ArrayList<Personal>()); } EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); List<Personal> attachedPersonalList = new ArrayList<Personal>(); for (Personal personalListPersonalToAttach : post.getPersonalList()) { personalListPersonalToAttach = em.getReference(personalListPersonalToAttach.getClass(), personalListPersonalToAttach.getIdPersonal()); attachedPersonalList.add(personalListPersonalToAttach); } post.setPersonalList(attachedPersonalList); em.persist(post); for (Personal personalListPersonal : post.getPersonalList()) { Post oldIdPostOfPersonalListPersonal = personalListPersonal.getIdPost(); personalListPersonal.setIdPost(post); personalListPersonal = em.merge(personalListPersonal); if (oldIdPostOfPersonalListPersonal != null) { oldIdPostOfPersonalListPersonal.getPersonalList().remove(personalListPersonal); oldIdPostOfPersonalListPersonal = em.merge(oldIdPostOfPersonalListPersonal); } } em.getTransaction().commit(); } finally { if (em != null) { em.close(); } } } public void edit(Post post) throws IllegalOrphanException, NonexistentEntityException, Exception { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); Post persistentPost = em.find(Post.class, post.getIdPost()); List<Personal> personalListOld = persistentPost.getPersonalList(); List<Personal> personalListNew = post.getPersonalList(); List<String> illegalOrphanMessages = null; if (illegalOrphanMessages != null) { throw new IllegalOrphanException(illegalOrphanMessages); } List<Personal> attachedPersonalListNew = new ArrayList<Personal>(); personalListNew = attachedPersonalListNew; post.setPersonalList(personalListNew); post = em.merge(post); for (Personal personalListNewPersonal : personalListNew) { if (!personalListOld.contains(personalListNewPersonal)) { Post oldIdPostOfPersonalListNewPersonal = personalListNewPersonal.getIdPost(); personalListNewPersonal.setIdPost(post); personalListNewPersonal = em.merge(personalListNewPersonal); if (oldIdPostOfPersonalListNewPersonal != null && !oldIdPostOfPersonalListNewPersonal.equals(post)) { oldIdPostOfPersonalListNewPersonal.getPersonalList().remove(personalListNewPersonal); oldIdPostOfPersonalListNewPersonal = em.merge(oldIdPostOfPersonalListNewPersonal); } } } em.getTransaction().commit(); } catch (Exception ex) { String msg = ex.getLocalizedMessage(); if (msg == null || msg.length() == 0) { Integer id = post.getIdPost(); if (findPost(id) == null) { throw new NonexistentEntityException("The post with id " + id + " no longer exists."); } } throw ex; } finally { if (em != null) { em.close(); } } } public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); Post post; try { post = em.getReference(Post.class, id); post.getIdPost(); } catch (EntityNotFoundException enfe) { throw new NonexistentEntityException("The post with id " + id + " no longer exists.", enfe); } List<String> illegalOrphanMessages = null; List<Personal> personalListOrphanCheck = post.getPersonalList(); for (Personal personalListOrphanCheckPersonal : personalListOrphanCheck) { if (illegalOrphanMessages == null) { illegalOrphanMessages = new ArrayList<String>(); } illegalOrphanMessages.add("This Post (" + post + ") cannot be destroyed since the Personal " + personalListOrphanCheckPersonal + " in its personalList field has a non-nullable idPost field."); } if (illegalOrphanMessages != null) { throw new IllegalOrphanException(illegalOrphanMessages); } em.remove(post); em.getTransaction().commit(); } finally { if (em != null) { em.close(); } } } public List<Post> findPostEntities() { return findPostEntities(true, -1, -1); } public List<Post> findPostEntities(int maxResults, int firstResult) { return findPostEntities(false, maxResults, firstResult); } private List<Post> findPostEntities(boolean all, int maxResults, int firstResult) { EntityManager em = getEntityManager(); try { CriteriaQuery cq = em.getCriteriaBuilder().createQuery(); cq.select(cq.from(Post.class)); Query q = em.createQuery(cq); if (!all) { q.setMaxResults(maxResults); q.setFirstResult(firstResult); } return q.getResultList(); } finally { em.close(); } } public Post findPost(Integer id) { EntityManager em = getEntityManager(); try { return em.find(Post.class, id); } finally { em.close(); } } public int getPostCount() { EntityManager em = getEntityManager(); try { CriteriaQuery cq = em.getCriteriaBuilder().createQuery(); Root<Post> rt = cq.from(Post.class); cq.select(em.getCriteriaBuilder().count(rt)); Query q = em.createQuery(cq); return ((Long) q.getSingleResult()).intValue(); } finally { em.close(); } } }
7,670
0.601043
0.600652
193
38.740932
31.612537
208
false
false
0
0
0
0
0
0
0.57513
false
false
10
e004ec0faa2f73b67c5bfe42e283a994815f294e
28,810,640,682,925
e0fd093ecfa2e5fe26554fcc9eb5f8165d387b28
/src/main/java/com/shbaoyuantech/beans/GradeBean.java
6524b8aa41b5ca94566b72be3c79d894279c69f8
[]
no_license
zzls66/data-synchronize
https://github.com/zzls66/data-synchronize
00b30c07e12172c3ac4c026602afb1e0e7148493
20dc2810d8e3579d3e37cd713741712872596c2a
refs/heads/master
2020-04-02T01:48:26.682000
2019-03-01T02:51:51
2019-03-01T02:51:51
153,876,045
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.shbaoyuantech.beans; import com.shbaoyuantech.annotations.MappingBean; import com.shbaoyuantech.annotations.MappingColumn; @MappingBean(table = "by_grade", collection = "dim_grades") public class GradeBean extends BaseBean { @MappingColumn(column = "name", field = "name") private String name; }
UTF-8
Java
319
java
GradeBean.java
Java
[]
null
[]
package com.shbaoyuantech.beans; import com.shbaoyuantech.annotations.MappingBean; import com.shbaoyuantech.annotations.MappingColumn; @MappingBean(table = "by_grade", collection = "dim_grades") public class GradeBean extends BaseBean { @MappingColumn(column = "name", field = "name") private String name; }
319
0.76489
0.76489
11
28
22.847319
59
false
false
0
0
0
0
0
0
0.545455
false
false
10
cf54086f000febbe56d2e4181e03c8cdfef5415a
19,859,928,796,588
1f5d28a6a2063ecd2d28b76693a441aede6c41eb
/src/main/java/com/exorath/serverarchitect/handler/GitLabHandler.java
1ee916fea4610213b90ee87c83368b14ef2eab15
[ "Apache-2.0" ]
permissive
Exorath/ServerArchitect
https://github.com/Exorath/ServerArchitect
410199400a282ca47077c561bdf6b723d126fc8d
edc687fc9c1ed2382a92046f5390952d2bf6cedb
refs/heads/master
2020-06-26T01:15:40.494000
2017-08-18T19:56:11
2017-08-18T19:56:11
74,608,699
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2016 Exorath * * 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.exorath.serverarchitect.handler; import java.io.File; import java.util.Map; /** * Created by toonsev on 11/24/2016. */ public class GitLabHandler implements ConfigHandler { private static final String TYPE_ID = "type"; @Override public void loadPlugins(Map<String, Object> configSection, File pluginsDir) { } @Override public void loadMaps(Map<String, Object> configSection, File mapsDir) { MapType type = configSection.containsKey(TYPE_ID) ? MapType.valueOf((String) configSection.get(TYPE_ID)) : MapType.MAP_IN_REPO; switch(type){ case ALL_MAPS_IN_REPO: //todo fix this break; case MAP_IN_REPO: break; } } }
UTF-8
Java
1,377
java
GitLabHandler.java
Java
[ { "context": ".io.File;\nimport java.util.Map;\n\n/**\n * Created by toonsev on 11/24/2016.\n */\npublic class GitLabHandler imp", "end": 734, "score": 0.9996657371520996, "start": 727, "tag": "USERNAME", "value": "toonsev" } ]
null
[]
/* * Copyright 2016 Exorath * * 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.exorath.serverarchitect.handler; import java.io.File; import java.util.Map; /** * Created by toonsev on 11/24/2016. */ public class GitLabHandler implements ConfigHandler { private static final String TYPE_ID = "type"; @Override public void loadPlugins(Map<String, Object> configSection, File pluginsDir) { } @Override public void loadMaps(Map<String, Object> configSection, File mapsDir) { MapType type = configSection.containsKey(TYPE_ID) ? MapType.valueOf((String) configSection.get(TYPE_ID)) : MapType.MAP_IN_REPO; switch(type){ case ALL_MAPS_IN_REPO: //todo fix this break; case MAP_IN_REPO: break; } } }
1,377
0.661583
0.649964
49
27.102041
30.863918
135
false
false
0
0
0
0
0
0
0.326531
false
false
10
e20b6cd1550462a0babd489aff3fa032ca04c7ff
31,722,628,479,513
927addfb5383365a2320716488513b6327cba8cf
/Project-Airline_Ticketing_System/WEB-INF/classes/AutoCompleteServlet.java
9c7c039451b9931506c353b1410df161421fd1e7
[]
no_license
arnabm13/WEB-Enterprise
https://github.com/arnabm13/WEB-Enterprise
bb2323a315d9b27e3f37f4c548f3a89372207dd7
87093b10b22f4bab6472b7cb4ddf7c102499e890
refs/heads/master
2021-01-21T11:23:16.378000
2017-05-18T21:54:58
2017-05-18T21:54:58
91,739,623
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.*; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Arrays; import java.util.List; import java.util.Set; import java.util.Date; import javax.servlet.http.*; import javax.servlet.RequestDispatcher; import java.util.*; import java.text.*; import java.io.IOException; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.*; import javax.servlet.RequestDispatcher; import java.util.HashMap; import java.util.*; import java.util.Iterator; import java.io.*; public class AutoCompleteServlet extends HttpServlet { private ServletContext context; HashMap complist; String targetId=null; public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String action = request.getParameter("action"); targetId = request.getParameter("searchId"); if (targetId != null) { targetId = targetId.trim(); } else { context.getRequestDispatcher("/error").forward(request, response); } boolean namesAdded = false; StringBuffer sb = new StringBuffer(); if (action.equals("complete")) { if (!targetId.equals("")) { AjaxUtility a=new AjaxUtility(); sb=a.readdata(targetId.toLowerCase()); if(sb!=null || !sb.equals("")) { namesAdded=true; } if (namesAdded) { response.setContentType("text/xml"); response.getWriter().write("<products>" + sb.toString() + "</products>"); } } else { //nothing to show response.setStatus(HttpServletResponse.SC_NO_CONTENT); } } if (action.equals("lookup")) { complist=(HashMap)AjaxUtility.getData(); System.out.println(targetId.trim()); if ((targetId != null) && complist.containsKey(targetId)) { //request.setAttribute("ProductDetail",complist.get(targetId.trim())); //request.getRequestDispatcher("/ProductDetail").forward(request, response); } } } }
UTF-8
Java
2,722
java
AutoCompleteServlet.java
Java
[]
null
[]
import java.io.*; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Arrays; import java.util.List; import java.util.Set; import java.util.Date; import javax.servlet.http.*; import javax.servlet.RequestDispatcher; import java.util.*; import java.text.*; import java.io.IOException; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.*; import javax.servlet.RequestDispatcher; import java.util.HashMap; import java.util.*; import java.util.Iterator; import java.io.*; public class AutoCompleteServlet extends HttpServlet { private ServletContext context; HashMap complist; String targetId=null; public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String action = request.getParameter("action"); targetId = request.getParameter("searchId"); if (targetId != null) { targetId = targetId.trim(); } else { context.getRequestDispatcher("/error").forward(request, response); } boolean namesAdded = false; StringBuffer sb = new StringBuffer(); if (action.equals("complete")) { if (!targetId.equals("")) { AjaxUtility a=new AjaxUtility(); sb=a.readdata(targetId.toLowerCase()); if(sb!=null || !sb.equals("")) { namesAdded=true; } if (namesAdded) { response.setContentType("text/xml"); response.getWriter().write("<products>" + sb.toString() + "</products>"); } } else { //nothing to show response.setStatus(HttpServletResponse.SC_NO_CONTENT); } } if (action.equals("lookup")) { complist=(HashMap)AjaxUtility.getData(); System.out.println(targetId.trim()); if ((targetId != null) && complist.containsKey(targetId)) { //request.setAttribute("ProductDetail",complist.get(targetId.trim())); //request.getRequestDispatcher("/ProductDetail").forward(request, response); } } } }
2,722
0.608376
0.608376
91
28.912088
22.540146
94
false
false
0
0
0
0
0
0
0.582418
false
false
10
6bc97b78bb23c781d7e6257464af570fea8bbd6b
592,705,518,826
1b133b266935e6651ccb255ccad3f37e3373e29a
/2.JavaCore/src/com/javarush/task/task19/task1919/Solution.java
fdfbd559cd71bf930f7c63bde00ce1da7ec2418e
[]
no_license
Sky53/JavaRushTasks
https://github.com/Sky53/JavaRushTasks
3fa05f8f85876a5ce15b22784ef5a4e1dbde7f13
cb546c799d2bd1983197096c316ae62ccf51337e
refs/heads/master
2020-04-11T12:27:08.727000
2018-12-14T12:21:15
2018-12-14T12:21:15
161,780,807
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.javarush.task.task19.task1919; /* Считаем зарплаты */ import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.Map; import java.util.TreeMap; public class Solution { public static void main(String[] args) throws IOException { Map<String, Double> map = new TreeMap<>(); String fileName = args[0]; BufferedReader reader = new BufferedReader(new FileReader(fileName)); while (reader.ready()){ String str = reader.readLine(); String[] strings = str.split(" "); //map.put(strings[0],Double.parseDouble(strings[1])); addMaps(strings[0],Double.parseDouble(strings[1]),map); } reader.close(); for (Map.Entry<String,Double> pairMap : map.entrySet()){ System.out.println(pairMap.getKey() + " " + pairMap.getValue()); } } private static void addMaps(String name, Double value, Map<String, Double> map){ if (map.containsKey(name)){ map.put(name,map.get(name) + value); } else { map.put(name,value); } } }
UTF-8
Java
1,204
java
Solution.java
Java
[]
null
[]
package com.javarush.task.task19.task1919; /* Считаем зарплаты */ import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.Map; import java.util.TreeMap; public class Solution { public static void main(String[] args) throws IOException { Map<String, Double> map = new TreeMap<>(); String fileName = args[0]; BufferedReader reader = new BufferedReader(new FileReader(fileName)); while (reader.ready()){ String str = reader.readLine(); String[] strings = str.split(" "); //map.put(strings[0],Double.parseDouble(strings[1])); addMaps(strings[0],Double.parseDouble(strings[1]),map); } reader.close(); for (Map.Entry<String,Double> pairMap : map.entrySet()){ System.out.println(pairMap.getKey() + " " + pairMap.getValue()); } } private static void addMaps(String name, Double value, Map<String, Double> map){ if (map.containsKey(name)){ map.put(name,map.get(name) + value); } else { map.put(name,value); } } }
1,204
0.61312
0.603869
45
25.422222
24.932343
84
false
false
0
0
0
0
0
0
0.622222
false
false
10
61e11b8fe3195486a84ac801385f7543c643017b
36,266,703,851,145
5b7e3967546ed5e2b4671f5fefb8bf6c65d8d4b2
/java/designPattern/factoryCreaterObject/CarCreater.java
b3e8ed8341d6aa3c90d75aac07c90e68f926a843
[ "Apache-2.0" ]
permissive
IsBigLin/designPattern
https://github.com/IsBigLin/designPattern
26da1b378d693571c2b02222079c7768c054cba0
78f98f290a4931500ca0556299f5a2dc70617581
refs/heads/master
2021-10-24T12:28:47.654000
2019-03-26T03:48:45
2019-03-26T03:48:45
103,499,601
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package designPattern.factoryCreaterObject; /** * Created by lnq on 2017/5/22. */ public class CarCreater implements FactoryCreater { @Override public <T extends Car> T creater(Class<T> clazz) { T car = null; try { car = (T)clazz.forName(clazz.getName()).newInstance(); } catch (Exception e) { e.printStackTrace(); } return car; } }
UTF-8
Java
413
java
CarCreater.java
Java
[ { "context": "gnPattern.factoryCreaterObject;\n\n/**\n * Created by lnq on 2017/5/22.\n */\npublic class CarCreater impleme", "end": 66, "score": 0.9995484352111816, "start": 63, "tag": "USERNAME", "value": "lnq" } ]
null
[]
package designPattern.factoryCreaterObject; /** * Created by lnq on 2017/5/22. */ public class CarCreater implements FactoryCreater { @Override public <T extends Car> T creater(Class<T> clazz) { T car = null; try { car = (T)clazz.forName(clazz.getName()).newInstance(); } catch (Exception e) { e.printStackTrace(); } return car; } }
413
0.581114
0.564165
17
23.294117
20.06098
67
false
false
0
0
0
0
0
0
0.294118
false
false
10
529ab1a0904b2f63624ec1e0e4f68ef0229d6547
26,027,501,845,745
d8312dbc4f4f660232df48e4deec1fdb2e17b2d7
/src/com/black/selfthings/MySelfEvent.java
8db0dd6fd0ce4541b0e5127af68e4177e4d9646d
[]
no_license
EvilCodes/SpringExercise
https://github.com/EvilCodes/SpringExercise
1a949634b30425e56709110c55ae817e4719f116
497cfccc6525e8bc8cdd9248daf0bf340b466963
refs/heads/master
2021-08-28T05:35:25.368000
2017-12-11T09:52:24
2017-12-11T09:52:24
107,775,969
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.black.selfthings; import org.springframework.context.ApplicationEvent; public class MySelfEvent extends ApplicationEvent{ public MySelfEvent(Object source) { super(source); } public String toString(){ return "用户自定义的Event"; } }
UTF-8
Java
267
java
MySelfEvent.java
Java
[]
null
[]
package com.black.selfthings; import org.springframework.context.ApplicationEvent; public class MySelfEvent extends ApplicationEvent{ public MySelfEvent(Object source) { super(source); } public String toString(){ return "用户自定义的Event"; } }
267
0.760784
0.760784
16
14.9375
18.102034
52
false
false
0
0
0
0
0
0
0.875
false
false
10
661706e33a8008c069dd338c47daac57aac41a8b
1,030,792,220,116
b2987a582dcb2fc1eea11ab7fc0663ef0481effd
/src/main/java/com/proyecto/util/demaaaa.java
1481f8d40f01064eb617dd671ebeb922a8b5d92a
[]
no_license
disney8/TestSpring
https://github.com/disney8/TestSpring
e733080cc4db7913fd8210bd9aba1c03fd882967
5731257f75870e966378ea0685489ad55e590714
refs/heads/main
2023-01-14T12:05:53.710000
2020-11-24T18:42:17
2020-11-24T18:42:17
315,697,336
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.proyecto.util; public class demaaaa { }
UTF-8
Java
54
java
demaaaa.java
Java
[]
null
[]
package com.proyecto.util; public class demaaaa { }
54
0.740741
0.740741
5
9.8
11.668761
26
false
false
0
0
0
0
0
0
0.2
false
false
10
5982f39320d419ad9f06b4bbe0f353b5936cd2fc
20,349,555,074,342
41c3170816207387cbc6af2ce1f5e0c05aa98546
/app/src/main/java/com/example/moviedb/model/IProfileModel.java
13213189f0f700974841b34d922886d94fecd86a
[]
no_license
ShweYamone/MovieDB
https://github.com/ShweYamone/MovieDB
0153a83d6baa8c1130a08a779d85dcf2b6f50c54
68e2b6b38794fd68acee796b49be2ea41bceddd4
refs/heads/master
2020-09-09T06:10:27.467000
2019-12-20T08:00:43
2019-12-20T08:00:43
221,369,566
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.moviedb.model; import com.example.moviedb.util.ServiceHelper; import io.reactivex.Observable; /** * Created by kaungkhantsoe on 2019-10-21. **/ public interface IProfileModel { Observable<ProfileInfoModel> getRequestTokenFromApi(ServiceHelper.ApiService service); Observable<ProfileInfoModel> getLoginValidteFromApi(ServiceHelper.ApiService service, LoginRequestBody requestBody); Observable<ProfileInfoModel> getSessionByRequestTokenFromApi(ServiceHelper.ApiService service, RequestTokenBody requestTokenBody); }
UTF-8
Java
552
java
IProfileModel.java
Java
[ { "context": "import io.reactivex.Observable;\n\n/**\n * Created by kaungkhantsoe on 2019-10-21.\n **/\npublic interface IProfileMode", "end": 148, "score": 0.9996455311775208, "start": 135, "tag": "USERNAME", "value": "kaungkhantsoe" } ]
null
[]
package com.example.moviedb.model; import com.example.moviedb.util.ServiceHelper; import io.reactivex.Observable; /** * Created by kaungkhantsoe on 2019-10-21. **/ public interface IProfileModel { Observable<ProfileInfoModel> getRequestTokenFromApi(ServiceHelper.ApiService service); Observable<ProfileInfoModel> getLoginValidteFromApi(ServiceHelper.ApiService service, LoginRequestBody requestBody); Observable<ProfileInfoModel> getSessionByRequestTokenFromApi(ServiceHelper.ApiService service, RequestTokenBody requestTokenBody); }
552
0.82971
0.815217
15
35.799999
43.419197
134
false
false
0
0
0
0
0
0
0.533333
false
false
10
e8d2fdfe47e3f2f203aede3a857dcaef3a28d0e7
35,811,437,315,560
60c294d5eb66cd1d8fcb2ecda807ecf2f59e7bb2
/src/test/java/com/mycompany/adventofcode2018/day4/Day4Test.java
42913b86f0cf2138ca4151b37e5bc3c3b89d2784
[]
no_license
MarkUgarov/AdventOfCode2018
https://github.com/MarkUgarov/AdventOfCode2018
09ec958d7a9f88899be3c5ba27cf619ee3ec4e83
c0901d5ebe182229b8d8ecd1d105d1fce7871bee
refs/heads/master
2020-04-09T08:07:36.231000
2018-12-15T14:07:31
2018-12-15T14:07:31
160,183,258
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 com.mycompany.adventofcode2018.day4; import java.util.ArrayList; import org.junit.Test; import static org.junit.Assert.*; /** * * @author mark2d2 */ public class Day4Test { public Day4Test() { } /** * Test of getGuardWithMostSleep method, of class Day4. */ @Test public void testGetGuardWithMostSleep() { System.out.println("getGuardWithMostSleep"); ArrayList<String> data = new ArrayList<>(); Day4 instance = new Day4(); data.add("[1518-11-01 00:00] Guard #10 begins shift"); data.add("[1518-11-01 00:05] falls asleep"); data.add("[1518-11-01 00:25] wakes up"); data.add("[1518-11-01 00:30] falls asleep"); data.add("[1518-11-01 00:55] wakes up"); data.add("[1518-11-01 23:58] Guard #99 begins shift"); data.add("[1518-11-02 00:40] falls asleep"); data.add("[1518-11-02 00:50] wakes up"); data.add("[1518-11-03 00:05] Guard #10 begins shift"); data.add("[1518-11-03 00:24] falls asleep"); data.add("[1518-11-03 00:29] wakes up"); data.add("[1518-11-04 00:02] Guard #99 begins shift"); data.add("[1518-11-04 00:36] falls asleep"); data.add("[1518-11-04 00:46] wakes up"); data.add("[1518-11-05 00:03] Guard #99 begins shift"); data.add("[1518-11-05 00:45] falls asleep"); data.add("[1518-11-05 00:55] wakes up"); String expResult = "10"; String result = instance.getGuardWithMostSleep(data).getId(); assertEquals(expResult, result); } /** * Test of getProductOfIdAndSleepAmount method, of class Day4. */ @Test public void testGetProductOfIdAndSleepAmount() { System.out.println("getProductOfIdAndSleepAmount"); ArrayList<String> data = new ArrayList<>(); data.add("[1518-11-01 00:00] Guard #10 begins shift"); data.add("[1518-11-01 00:05] falls asleep"); data.add("[1518-11-01 00:25] wakes up"); data.add("[1518-11-01 00:30] falls asleep"); data.add("[1518-11-01 00:55] wakes up"); data.add("[1518-11-01 23:58] Guard #99 begins shift"); data.add("[1518-11-02 00:40] falls asleep"); data.add("[1518-11-02 00:50] wakes up"); data.add("[1518-11-03 00:05] Guard #10 begins shift"); data.add("[1518-11-03 00:24] falls asleep"); data.add("[1518-11-03 00:29] wakes up"); data.add("[1518-11-04 00:02] Guard #99 begins shift"); data.add("[1518-11-04 00:36] falls asleep"); data.add("[1518-11-04 00:46] wakes up"); data.add("[1518-11-05 00:03] Guard #99 begins shift"); data.add("[1518-11-05 00:45] falls asleep"); data.add("[1518-11-05 00:55] wakes up"); Day4 instance = new Day4(); int expResult = 240; int result = instance.getProductOfIdAndMaxSleepMinute(data); assertEquals(expResult, result); } /** * Test of getProductOfIdAndMaxSleepMinute method, of class Day4. */ @Test public void testGetProductOfIdAndMaxSleepMinute() { System.out.println("getProductOfIdAndMaxSleepMinute"); ArrayList<String> data = new ArrayList<>(); data.add("[1518-11-01 00:00] Guard #10 begins shift"); data.add("[1518-11-01 00:05] falls asleep"); data.add("[1518-11-01 00:25] wakes up"); data.add("[1518-11-01 00:30] falls asleep"); data.add("[1518-11-01 00:55] wakes up"); data.add("[1518-11-01 23:58] Guard #99 begins shift"); data.add("[1518-11-02 00:40] falls asleep"); data.add("[1518-11-02 00:50] wakes up"); data.add("[1518-11-03 00:05] Guard #10 begins shift"); data.add("[1518-11-03 00:24] falls asleep"); data.add("[1518-11-03 00:29] wakes up"); data.add("[1518-11-04 00:02] Guard #99 begins shift"); data.add("[1518-11-04 00:36] falls asleep"); data.add("[1518-11-04 00:46] wakes up"); data.add("[1518-11-05 00:03] Guard #99 begins shift"); data.add("[1518-11-05 00:45] falls asleep"); data.add("[1518-11-05 00:55] wakes up"); Day4 instance = new Day4(); int expResult = 240; int result = instance.getProductOfIdAndMaxSleepMinute(data); assertEquals(expResult, result); } /** * Test of getProductOfIdAndValueOfMaxSleepMinute method, of class Day4. */ @Test public void testGetProductOfIdAndValueOfMaxSleepMinute() { System.out.println("getProductOfIdAndValueOfMaxSleepMinute"); ArrayList<String> data = new ArrayList<>(); data.add("[1518-11-01 00:00] Guard #10 begins shift"); data.add("[1518-11-01 00:05] falls asleep"); data.add("[1518-11-01 00:25] wakes up"); data.add("[1518-11-01 00:30] falls asleep"); data.add("[1518-11-01 00:55] wakes up"); data.add("[1518-11-01 23:58] Guard #99 begins shift"); data.add("[1518-11-02 00:40] falls asleep"); data.add("[1518-11-02 00:50] wakes up"); data.add("[1518-11-03 00:05] Guard #10 begins shift"); data.add("[1518-11-03 00:24] falls asleep"); data.add("[1518-11-03 00:29] wakes up"); data.add("[1518-11-04 00:02] Guard #99 begins shift"); data.add("[1518-11-04 00:36] falls asleep"); data.add("[1518-11-04 00:46] wakes up"); data.add("[1518-11-05 00:03] Guard #99 begins shift"); data.add("[1518-11-05 00:45] falls asleep"); data.add("[1518-11-05 00:55] wakes up"); Day4 instance = new Day4(); int expResult = 4455; int result = instance.getProductOfIdAndValueOfMaxSleepMinute(data); assertEquals(expResult, result); } }
UTF-8
Java
5,933
java
Day4Test.java
Java
[ { "context": "port static org.junit.Assert.*;\n\n/**\n *\n * @author mark2d2\n */\npublic class Day4Test {\n \n public Day4T", "end": 342, "score": 0.9995055198669434, "start": 335, "tag": "USERNAME", "value": "mark2d2" } ]
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 com.mycompany.adventofcode2018.day4; import java.util.ArrayList; import org.junit.Test; import static org.junit.Assert.*; /** * * @author mark2d2 */ public class Day4Test { public Day4Test() { } /** * Test of getGuardWithMostSleep method, of class Day4. */ @Test public void testGetGuardWithMostSleep() { System.out.println("getGuardWithMostSleep"); ArrayList<String> data = new ArrayList<>(); Day4 instance = new Day4(); data.add("[1518-11-01 00:00] Guard #10 begins shift"); data.add("[1518-11-01 00:05] falls asleep"); data.add("[1518-11-01 00:25] wakes up"); data.add("[1518-11-01 00:30] falls asleep"); data.add("[1518-11-01 00:55] wakes up"); data.add("[1518-11-01 23:58] Guard #99 begins shift"); data.add("[1518-11-02 00:40] falls asleep"); data.add("[1518-11-02 00:50] wakes up"); data.add("[1518-11-03 00:05] Guard #10 begins shift"); data.add("[1518-11-03 00:24] falls asleep"); data.add("[1518-11-03 00:29] wakes up"); data.add("[1518-11-04 00:02] Guard #99 begins shift"); data.add("[1518-11-04 00:36] falls asleep"); data.add("[1518-11-04 00:46] wakes up"); data.add("[1518-11-05 00:03] Guard #99 begins shift"); data.add("[1518-11-05 00:45] falls asleep"); data.add("[1518-11-05 00:55] wakes up"); String expResult = "10"; String result = instance.getGuardWithMostSleep(data).getId(); assertEquals(expResult, result); } /** * Test of getProductOfIdAndSleepAmount method, of class Day4. */ @Test public void testGetProductOfIdAndSleepAmount() { System.out.println("getProductOfIdAndSleepAmount"); ArrayList<String> data = new ArrayList<>(); data.add("[1518-11-01 00:00] Guard #10 begins shift"); data.add("[1518-11-01 00:05] falls asleep"); data.add("[1518-11-01 00:25] wakes up"); data.add("[1518-11-01 00:30] falls asleep"); data.add("[1518-11-01 00:55] wakes up"); data.add("[1518-11-01 23:58] Guard #99 begins shift"); data.add("[1518-11-02 00:40] falls asleep"); data.add("[1518-11-02 00:50] wakes up"); data.add("[1518-11-03 00:05] Guard #10 begins shift"); data.add("[1518-11-03 00:24] falls asleep"); data.add("[1518-11-03 00:29] wakes up"); data.add("[1518-11-04 00:02] Guard #99 begins shift"); data.add("[1518-11-04 00:36] falls asleep"); data.add("[1518-11-04 00:46] wakes up"); data.add("[1518-11-05 00:03] Guard #99 begins shift"); data.add("[1518-11-05 00:45] falls asleep"); data.add("[1518-11-05 00:55] wakes up"); Day4 instance = new Day4(); int expResult = 240; int result = instance.getProductOfIdAndMaxSleepMinute(data); assertEquals(expResult, result); } /** * Test of getProductOfIdAndMaxSleepMinute method, of class Day4. */ @Test public void testGetProductOfIdAndMaxSleepMinute() { System.out.println("getProductOfIdAndMaxSleepMinute"); ArrayList<String> data = new ArrayList<>(); data.add("[1518-11-01 00:00] Guard #10 begins shift"); data.add("[1518-11-01 00:05] falls asleep"); data.add("[1518-11-01 00:25] wakes up"); data.add("[1518-11-01 00:30] falls asleep"); data.add("[1518-11-01 00:55] wakes up"); data.add("[1518-11-01 23:58] Guard #99 begins shift"); data.add("[1518-11-02 00:40] falls asleep"); data.add("[1518-11-02 00:50] wakes up"); data.add("[1518-11-03 00:05] Guard #10 begins shift"); data.add("[1518-11-03 00:24] falls asleep"); data.add("[1518-11-03 00:29] wakes up"); data.add("[1518-11-04 00:02] Guard #99 begins shift"); data.add("[1518-11-04 00:36] falls asleep"); data.add("[1518-11-04 00:46] wakes up"); data.add("[1518-11-05 00:03] Guard #99 begins shift"); data.add("[1518-11-05 00:45] falls asleep"); data.add("[1518-11-05 00:55] wakes up"); Day4 instance = new Day4(); int expResult = 240; int result = instance.getProductOfIdAndMaxSleepMinute(data); assertEquals(expResult, result); } /** * Test of getProductOfIdAndValueOfMaxSleepMinute method, of class Day4. */ @Test public void testGetProductOfIdAndValueOfMaxSleepMinute() { System.out.println("getProductOfIdAndValueOfMaxSleepMinute"); ArrayList<String> data = new ArrayList<>(); data.add("[1518-11-01 00:00] Guard #10 begins shift"); data.add("[1518-11-01 00:05] falls asleep"); data.add("[1518-11-01 00:25] wakes up"); data.add("[1518-11-01 00:30] falls asleep"); data.add("[1518-11-01 00:55] wakes up"); data.add("[1518-11-01 23:58] Guard #99 begins shift"); data.add("[1518-11-02 00:40] falls asleep"); data.add("[1518-11-02 00:50] wakes up"); data.add("[1518-11-03 00:05] Guard #10 begins shift"); data.add("[1518-11-03 00:24] falls asleep"); data.add("[1518-11-03 00:29] wakes up"); data.add("[1518-11-04 00:02] Guard #99 begins shift"); data.add("[1518-11-04 00:36] falls asleep"); data.add("[1518-11-04 00:46] wakes up"); data.add("[1518-11-05 00:03] Guard #99 begins shift"); data.add("[1518-11-05 00:45] falls asleep"); data.add("[1518-11-05 00:55] wakes up"); Day4 instance = new Day4(); int expResult = 4455; int result = instance.getProductOfIdAndValueOfMaxSleepMinute(data); assertEquals(expResult, result); } }
5,933
0.596494
0.446654
147
39.360546
22.811546
79
false
false
0
0
0
0
0
0
0.727891
false
false
10
75023603da279be64e847c5cff6b1f70caa18c29
35,399,120,466,919
9e7c62271e6aedb81eedd20beb1ec26355dd4a17
/Samorukov_Dmitry - Java Engineer/Code/backend/src/main/java/com/dev/backend/model/OrderLine.java
05de84c23589c1bed612cb038a14a07437981be2
[]
no_license
Tr1aL/Crossover-Technical-Trial
https://github.com/Tr1aL/Crossover-Technical-Trial
d85170d243a20a1c6359c972ebf902a198f3c0fd
642f766642341a319c98c3057dc50ed2d7ac7d44
refs/heads/master
2021-01-10T15:14:41.184000
2016-03-31T16:19:49
2016-03-31T16:19:49
49,068,967
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dev.backend.model; import javax.persistence.*; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; /** * OrderLine model */ @Entity @Table(name = "df_orderLines") public class OrderLine { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "c_id") private Integer id; @Column(name = "c_orderNum") @NotNull private String orderNum; @Column(name = "c_product") @NotNull private String product; @Column(name = "c_quantity") @NotNull @Min(value = 0) private Integer quantity = 0; public OrderLine() { } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getOrderNum() { return orderNum; } public void setOrderNum(String orderNum) { this.orderNum = orderNum; } public String getProduct() { return product; } public void setProduct(String product) { this.product = product; } public Integer getQuantity() { return quantity; } public void setQuantity(Integer quantity) { this.quantity = quantity; } }
UTF-8
Java
1,217
java
OrderLine.java
Java
[]
null
[]
package com.dev.backend.model; import javax.persistence.*; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; /** * OrderLine model */ @Entity @Table(name = "df_orderLines") public class OrderLine { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "c_id") private Integer id; @Column(name = "c_orderNum") @NotNull private String orderNum; @Column(name = "c_product") @NotNull private String product; @Column(name = "c_quantity") @NotNull @Min(value = 0) private Integer quantity = 0; public OrderLine() { } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getOrderNum() { return orderNum; } public void setOrderNum(String orderNum) { this.orderNum = orderNum; } public String getProduct() { return product; } public void setProduct(String product) { this.product = product; } public Integer getQuantity() { return quantity; } public void setQuantity(Integer quantity) { this.quantity = quantity; } }
1,217
0.617913
0.61627
66
17.439394
15.358473
55
false
false
0
0
0
0
0
0
0.242424
false
false
10
07fcedd698303d9ddc226508884a39a9d98a8904
34,866,544,524,802
dfeaed9f239bda29e0b541172066f434fc79b83d
/jooq/src/main/java/dshumsky/jooq/generated/tables/records/GptContractRecalculationRulesRecord.java
81200646425a8e9d0f191cf4658bd2936ee87264
[]
no_license
dshumsky/dshumsky
https://github.com/dshumsky/dshumsky
e93be79564cc1b25fd23d5880ad1bcfd597280be
4ec215a549fac13050d658fa2f286ec40eda95c8
refs/heads/master
2016-08-30T19:55:44.765000
2016-04-08T14:58:56
2016-04-08T14:58:56
32,314,490
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * This class is generated by jOOQ */ package dshumsky.jooq.generated.tables.records; /** * This class is generated by jOOQ. */ @javax.annotation.Generated( value = { "http://www.jooq.org", "jOOQ version:3.5.0" }, comments = "This class is generated by jOOQ" ) @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class GptContractRecalculationRulesRecord extends org.jooq.impl.UpdatableRecordImpl<dshumsky.jooq.generated.tables.records.GptContractRecalculationRulesRecord> implements org.jooq.Record18<java.lang.Long, java.lang.String, java.math.BigDecimal, java.lang.Boolean, java.lang.Boolean, java.lang.Byte, java.lang.Long, java.lang.Long, java.lang.Long, java.lang.Byte, java.lang.Long, java.lang.Byte, java.lang.Byte, java.lang.Boolean, java.lang.Byte, java.lang.Byte, java.lang.Long, java.lang.Long> { private static final long serialVersionUID = -1285463888; /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.ID</code>. */ public void setId(java.lang.Long value) { setValue(0, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.ID</code>. */ public java.lang.Long getId() { return (java.lang.Long) getValue(0); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CURRENCY</code>. */ public void setCurrency(java.lang.String value) { setValue(1, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CURRENCY</code>. */ public java.lang.String getCurrency() { return (java.lang.String) getValue(1); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.VALUE</code>. */ public void setValue(java.math.BigDecimal value) { setValue(2, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.VALUE</code>. */ public java.math.BigDecimal getValue() { return (java.math.BigDecimal) getValue(2); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CALCULATE_FROM_NETTO</code>. */ public void setCalculateFromNetto(java.lang.Boolean value) { setValue(3, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CALCULATE_FROM_NETTO</code>. */ public java.lang.Boolean getCalculateFromNetto() { return (java.lang.Boolean) getValue(3); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.NETTO_FROM_NETTO_APPLIED</code>. */ public void setNettoFromNettoApplied(java.lang.Boolean value) { setValue(4, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.NETTO_FROM_NETTO_APPLIED</code>. */ public java.lang.Boolean getNettoFromNettoApplied() { return (java.lang.Boolean) getValue(4); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.DISCOUNT_SOURCE_TYPE</code>. */ public void setDiscountSourceType(java.lang.Byte value) { setValue(5, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.DISCOUNT_SOURCE_TYPE</code>. */ public java.lang.Byte getDiscountSourceType() { return (java.lang.Byte) getValue(5); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.SOURCE_ROOM_TYPE_ID</code>. */ public void setSourceRoomTypeId(java.lang.Long value) { setValue(6, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.SOURCE_ROOM_TYPE_ID</code>. */ public java.lang.Long getSourceRoomTypeId() { return (java.lang.Long) getValue(6); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.SOURCE_CATEGORY_ID</code>. */ public void setSourceCategoryId(java.lang.Long value) { setValue(7, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.SOURCE_CATEGORY_ID</code>. */ public java.lang.Long getSourceCategoryId() { return (java.lang.Long) getValue(7); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.SOURCE_MEAL_TYPE_ID</code>. */ public void setSourceMealTypeId(java.lang.Long value) { setValue(8, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.SOURCE_MEAL_TYPE_ID</code>. */ public java.lang.Long getSourceMealTypeId() { return (java.lang.Long) getValue(8); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.OPERATION_PRICE</code>. */ public void setOperationPrice(java.lang.Byte value) { setValue(9, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.OPERATION_PRICE</code>. */ public java.lang.Byte getOperationPrice() { return (java.lang.Byte) getValue(9); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CONTRACT_ID</code>. */ public void setContractId(java.lang.Long value) { setValue(10, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CONTRACT_ID</code>. */ public java.lang.Long getContractId() { return (java.lang.Long) getValue(10); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.PRICE_TYPE</code>. */ public void setPriceType(java.lang.Byte value) { setValue(11, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.PRICE_TYPE</code>. */ public java.lang.Byte getPriceType() { return (java.lang.Byte) getValue(11); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.RECALCULATION_TYPE</code>. */ public void setRecalculationType(java.lang.Byte value) { setValue(12, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.RECALCULATION_TYPE</code>. */ public java.lang.Byte getRecalculationType() { return (java.lang.Byte) getValue(12); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CHECKED</code>. */ public void setChecked(java.lang.Boolean value) { setValue(13, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CHECKED</code>. */ public java.lang.Boolean getChecked() { return (java.lang.Boolean) getValue(13); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.EXTRABED_PRICE_TYPE</code>. */ public void setExtrabedPriceType(java.lang.Byte value) { setValue(14, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.EXTRABED_PRICE_TYPE</code>. */ public java.lang.Byte getExtrabedPriceType() { return (java.lang.Byte) getValue(14); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CHILDREN_DISCOUNT_PRICE_TYPE</code>. */ public void setChildrenDiscountPriceType(java.lang.Byte value) { setValue(15, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CHILDREN_DISCOUNT_PRICE_TYPE</code>. */ public java.lang.Byte getChildrenDiscountPriceType() { return (java.lang.Byte) getValue(15); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CHILDREN_PRICE_ID</code>. */ public void setChildrenPriceId(java.lang.Long value) { setValue(16, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CHILDREN_PRICE_ID</code>. */ public java.lang.Long getChildrenPriceId() { return (java.lang.Long) getValue(16); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.EXTRA_BED_PRICE_ID</code>. */ public void setExtraBedPriceId(java.lang.Long value) { setValue(17, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.EXTRA_BED_PRICE_ID</code>. */ public java.lang.Long getExtraBedPriceId() { return (java.lang.Long) getValue(17); } // ------------------------------------------------------------------------- // Primary key information // ------------------------------------------------------------------------- /** * {@inheritDoc} */ @Override public org.jooq.Record1<java.lang.Long> key() { return (org.jooq.Record1) super.key(); } // ------------------------------------------------------------------------- // Record18 type implementation // ------------------------------------------------------------------------- /** * {@inheritDoc} */ @Override public org.jooq.Row18<java.lang.Long, java.lang.String, java.math.BigDecimal, java.lang.Boolean, java.lang.Boolean, java.lang.Byte, java.lang.Long, java.lang.Long, java.lang.Long, java.lang.Byte, java.lang.Long, java.lang.Byte, java.lang.Byte, java.lang.Boolean, java.lang.Byte, java.lang.Byte, java.lang.Long, java.lang.Long> fieldsRow() { return (org.jooq.Row18) super.fieldsRow(); } /** * {@inheritDoc} */ @Override public org.jooq.Row18<java.lang.Long, java.lang.String, java.math.BigDecimal, java.lang.Boolean, java.lang.Boolean, java.lang.Byte, java.lang.Long, java.lang.Long, java.lang.Long, java.lang.Byte, java.lang.Long, java.lang.Byte, java.lang.Byte, java.lang.Boolean, java.lang.Byte, java.lang.Byte, java.lang.Long, java.lang.Long> valuesRow() { return (org.jooq.Row18) super.valuesRow(); } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Long> field1() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.ID; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.String> field2() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.CURRENCY; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.math.BigDecimal> field3() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.VALUE; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Boolean> field4() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.CALCULATE_FROM_NETTO; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Boolean> field5() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.NETTO_FROM_NETTO_APPLIED; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Byte> field6() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.DISCOUNT_SOURCE_TYPE; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Long> field7() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.SOURCE_ROOM_TYPE_ID; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Long> field8() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.SOURCE_CATEGORY_ID; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Long> field9() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.SOURCE_MEAL_TYPE_ID; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Byte> field10() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.OPERATION_PRICE; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Long> field11() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.CONTRACT_ID; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Byte> field12() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.PRICE_TYPE; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Byte> field13() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.RECALCULATION_TYPE; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Boolean> field14() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.CHECKED; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Byte> field15() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.EXTRABED_PRICE_TYPE; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Byte> field16() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.CHILDREN_DISCOUNT_PRICE_TYPE; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Long> field17() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.CHILDREN_PRICE_ID; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Long> field18() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.EXTRA_BED_PRICE_ID; } /** * {@inheritDoc} */ @Override public java.lang.Long value1() { return getId(); } /** * {@inheritDoc} */ @Override public java.lang.String value2() { return getCurrency(); } /** * {@inheritDoc} */ @Override public java.math.BigDecimal value3() { return getValue(); } /** * {@inheritDoc} */ @Override public java.lang.Boolean value4() { return getCalculateFromNetto(); } /** * {@inheritDoc} */ @Override public java.lang.Boolean value5() { return getNettoFromNettoApplied(); } /** * {@inheritDoc} */ @Override public java.lang.Byte value6() { return getDiscountSourceType(); } /** * {@inheritDoc} */ @Override public java.lang.Long value7() { return getSourceRoomTypeId(); } /** * {@inheritDoc} */ @Override public java.lang.Long value8() { return getSourceCategoryId(); } /** * {@inheritDoc} */ @Override public java.lang.Long value9() { return getSourceMealTypeId(); } /** * {@inheritDoc} */ @Override public java.lang.Byte value10() { return getOperationPrice(); } /** * {@inheritDoc} */ @Override public java.lang.Long value11() { return getContractId(); } /** * {@inheritDoc} */ @Override public java.lang.Byte value12() { return getPriceType(); } /** * {@inheritDoc} */ @Override public java.lang.Byte value13() { return getRecalculationType(); } /** * {@inheritDoc} */ @Override public java.lang.Boolean value14() { return getChecked(); } /** * {@inheritDoc} */ @Override public java.lang.Byte value15() { return getExtrabedPriceType(); } /** * {@inheritDoc} */ @Override public java.lang.Byte value16() { return getChildrenDiscountPriceType(); } /** * {@inheritDoc} */ @Override public java.lang.Long value17() { return getChildrenPriceId(); } /** * {@inheritDoc} */ @Override public java.lang.Long value18() { return getExtraBedPriceId(); } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value1(java.lang.Long value) { setId(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value2(java.lang.String value) { setCurrency(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value3(java.math.BigDecimal value) { setValue(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value4(java.lang.Boolean value) { setCalculateFromNetto(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value5(java.lang.Boolean value) { setNettoFromNettoApplied(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value6(java.lang.Byte value) { setDiscountSourceType(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value7(java.lang.Long value) { setSourceRoomTypeId(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value8(java.lang.Long value) { setSourceCategoryId(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value9(java.lang.Long value) { setSourceMealTypeId(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value10(java.lang.Byte value) { setOperationPrice(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value11(java.lang.Long value) { setContractId(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value12(java.lang.Byte value) { setPriceType(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value13(java.lang.Byte value) { setRecalculationType(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value14(java.lang.Boolean value) { setChecked(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value15(java.lang.Byte value) { setExtrabedPriceType(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value16(java.lang.Byte value) { setChildrenDiscountPriceType(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value17(java.lang.Long value) { setChildrenPriceId(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value18(java.lang.Long value) { setExtraBedPriceId(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord values(java.lang.Long value1, java.lang.String value2, java.math.BigDecimal value3, java.lang.Boolean value4, java.lang.Boolean value5, java.lang.Byte value6, java.lang.Long value7, java.lang.Long value8, java.lang.Long value9, java.lang.Byte value10, java.lang.Long value11, java.lang.Byte value12, java.lang.Byte value13, java.lang.Boolean value14, java.lang.Byte value15, java.lang.Byte value16, java.lang.Long value17, java.lang.Long value18) { return this; } // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- /** * Create a detached GptContractRecalculationRulesRecord */ public GptContractRecalculationRulesRecord() { super(dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES); } /** * Create a detached, initialised GptContractRecalculationRulesRecord */ public GptContractRecalculationRulesRecord(java.lang.Long id, java.lang.String currency, java.math.BigDecimal value, java.lang.Boolean calculateFromNetto, java.lang.Boolean nettoFromNettoApplied, java.lang.Byte discountSourceType, java.lang.Long sourceRoomTypeId, java.lang.Long sourceCategoryId, java.lang.Long sourceMealTypeId, java.lang.Byte operationPrice, java.lang.Long contractId, java.lang.Byte priceType, java.lang.Byte recalculationType, java.lang.Boolean checked, java.lang.Byte extrabedPriceType, java.lang.Byte childrenDiscountPriceType, java.lang.Long childrenPriceId, java.lang.Long extraBedPriceId) { super(dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES); setValue(0, id); setValue(1, currency); setValue(2, value); setValue(3, calculateFromNetto); setValue(4, nettoFromNettoApplied); setValue(5, discountSourceType); setValue(6, sourceRoomTypeId); setValue(7, sourceCategoryId); setValue(8, sourceMealTypeId); setValue(9, operationPrice); setValue(10, contractId); setValue(11, priceType); setValue(12, recalculationType); setValue(13, checked); setValue(14, extrabedPriceType); setValue(15, childrenDiscountPriceType); setValue(16, childrenPriceId); setValue(17, extraBedPriceId); } }
UTF-8
Java
19,762
java
GptContractRecalculationRulesRecord.java
Java
[]
null
[]
/** * This class is generated by jOOQ */ package dshumsky.jooq.generated.tables.records; /** * This class is generated by jOOQ. */ @javax.annotation.Generated( value = { "http://www.jooq.org", "jOOQ version:3.5.0" }, comments = "This class is generated by jOOQ" ) @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class GptContractRecalculationRulesRecord extends org.jooq.impl.UpdatableRecordImpl<dshumsky.jooq.generated.tables.records.GptContractRecalculationRulesRecord> implements org.jooq.Record18<java.lang.Long, java.lang.String, java.math.BigDecimal, java.lang.Boolean, java.lang.Boolean, java.lang.Byte, java.lang.Long, java.lang.Long, java.lang.Long, java.lang.Byte, java.lang.Long, java.lang.Byte, java.lang.Byte, java.lang.Boolean, java.lang.Byte, java.lang.Byte, java.lang.Long, java.lang.Long> { private static final long serialVersionUID = -1285463888; /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.ID</code>. */ public void setId(java.lang.Long value) { setValue(0, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.ID</code>. */ public java.lang.Long getId() { return (java.lang.Long) getValue(0); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CURRENCY</code>. */ public void setCurrency(java.lang.String value) { setValue(1, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CURRENCY</code>. */ public java.lang.String getCurrency() { return (java.lang.String) getValue(1); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.VALUE</code>. */ public void setValue(java.math.BigDecimal value) { setValue(2, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.VALUE</code>. */ public java.math.BigDecimal getValue() { return (java.math.BigDecimal) getValue(2); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CALCULATE_FROM_NETTO</code>. */ public void setCalculateFromNetto(java.lang.Boolean value) { setValue(3, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CALCULATE_FROM_NETTO</code>. */ public java.lang.Boolean getCalculateFromNetto() { return (java.lang.Boolean) getValue(3); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.NETTO_FROM_NETTO_APPLIED</code>. */ public void setNettoFromNettoApplied(java.lang.Boolean value) { setValue(4, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.NETTO_FROM_NETTO_APPLIED</code>. */ public java.lang.Boolean getNettoFromNettoApplied() { return (java.lang.Boolean) getValue(4); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.DISCOUNT_SOURCE_TYPE</code>. */ public void setDiscountSourceType(java.lang.Byte value) { setValue(5, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.DISCOUNT_SOURCE_TYPE</code>. */ public java.lang.Byte getDiscountSourceType() { return (java.lang.Byte) getValue(5); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.SOURCE_ROOM_TYPE_ID</code>. */ public void setSourceRoomTypeId(java.lang.Long value) { setValue(6, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.SOURCE_ROOM_TYPE_ID</code>. */ public java.lang.Long getSourceRoomTypeId() { return (java.lang.Long) getValue(6); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.SOURCE_CATEGORY_ID</code>. */ public void setSourceCategoryId(java.lang.Long value) { setValue(7, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.SOURCE_CATEGORY_ID</code>. */ public java.lang.Long getSourceCategoryId() { return (java.lang.Long) getValue(7); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.SOURCE_MEAL_TYPE_ID</code>. */ public void setSourceMealTypeId(java.lang.Long value) { setValue(8, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.SOURCE_MEAL_TYPE_ID</code>. */ public java.lang.Long getSourceMealTypeId() { return (java.lang.Long) getValue(8); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.OPERATION_PRICE</code>. */ public void setOperationPrice(java.lang.Byte value) { setValue(9, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.OPERATION_PRICE</code>. */ public java.lang.Byte getOperationPrice() { return (java.lang.Byte) getValue(9); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CONTRACT_ID</code>. */ public void setContractId(java.lang.Long value) { setValue(10, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CONTRACT_ID</code>. */ public java.lang.Long getContractId() { return (java.lang.Long) getValue(10); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.PRICE_TYPE</code>. */ public void setPriceType(java.lang.Byte value) { setValue(11, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.PRICE_TYPE</code>. */ public java.lang.Byte getPriceType() { return (java.lang.Byte) getValue(11); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.RECALCULATION_TYPE</code>. */ public void setRecalculationType(java.lang.Byte value) { setValue(12, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.RECALCULATION_TYPE</code>. */ public java.lang.Byte getRecalculationType() { return (java.lang.Byte) getValue(12); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CHECKED</code>. */ public void setChecked(java.lang.Boolean value) { setValue(13, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CHECKED</code>. */ public java.lang.Boolean getChecked() { return (java.lang.Boolean) getValue(13); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.EXTRABED_PRICE_TYPE</code>. */ public void setExtrabedPriceType(java.lang.Byte value) { setValue(14, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.EXTRABED_PRICE_TYPE</code>. */ public java.lang.Byte getExtrabedPriceType() { return (java.lang.Byte) getValue(14); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CHILDREN_DISCOUNT_PRICE_TYPE</code>. */ public void setChildrenDiscountPriceType(java.lang.Byte value) { setValue(15, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CHILDREN_DISCOUNT_PRICE_TYPE</code>. */ public java.lang.Byte getChildrenDiscountPriceType() { return (java.lang.Byte) getValue(15); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CHILDREN_PRICE_ID</code>. */ public void setChildrenPriceId(java.lang.Long value) { setValue(16, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.CHILDREN_PRICE_ID</code>. */ public java.lang.Long getChildrenPriceId() { return (java.lang.Long) getValue(16); } /** * Setter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.EXTRA_BED_PRICE_ID</code>. */ public void setExtraBedPriceId(java.lang.Long value) { setValue(17, value); } /** * Getter for <code>bot.GPT_CONTRACT_RECALCULATION_RULES.EXTRA_BED_PRICE_ID</code>. */ public java.lang.Long getExtraBedPriceId() { return (java.lang.Long) getValue(17); } // ------------------------------------------------------------------------- // Primary key information // ------------------------------------------------------------------------- /** * {@inheritDoc} */ @Override public org.jooq.Record1<java.lang.Long> key() { return (org.jooq.Record1) super.key(); } // ------------------------------------------------------------------------- // Record18 type implementation // ------------------------------------------------------------------------- /** * {@inheritDoc} */ @Override public org.jooq.Row18<java.lang.Long, java.lang.String, java.math.BigDecimal, java.lang.Boolean, java.lang.Boolean, java.lang.Byte, java.lang.Long, java.lang.Long, java.lang.Long, java.lang.Byte, java.lang.Long, java.lang.Byte, java.lang.Byte, java.lang.Boolean, java.lang.Byte, java.lang.Byte, java.lang.Long, java.lang.Long> fieldsRow() { return (org.jooq.Row18) super.fieldsRow(); } /** * {@inheritDoc} */ @Override public org.jooq.Row18<java.lang.Long, java.lang.String, java.math.BigDecimal, java.lang.Boolean, java.lang.Boolean, java.lang.Byte, java.lang.Long, java.lang.Long, java.lang.Long, java.lang.Byte, java.lang.Long, java.lang.Byte, java.lang.Byte, java.lang.Boolean, java.lang.Byte, java.lang.Byte, java.lang.Long, java.lang.Long> valuesRow() { return (org.jooq.Row18) super.valuesRow(); } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Long> field1() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.ID; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.String> field2() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.CURRENCY; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.math.BigDecimal> field3() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.VALUE; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Boolean> field4() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.CALCULATE_FROM_NETTO; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Boolean> field5() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.NETTO_FROM_NETTO_APPLIED; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Byte> field6() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.DISCOUNT_SOURCE_TYPE; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Long> field7() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.SOURCE_ROOM_TYPE_ID; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Long> field8() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.SOURCE_CATEGORY_ID; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Long> field9() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.SOURCE_MEAL_TYPE_ID; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Byte> field10() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.OPERATION_PRICE; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Long> field11() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.CONTRACT_ID; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Byte> field12() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.PRICE_TYPE; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Byte> field13() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.RECALCULATION_TYPE; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Boolean> field14() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.CHECKED; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Byte> field15() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.EXTRABED_PRICE_TYPE; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Byte> field16() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.CHILDREN_DISCOUNT_PRICE_TYPE; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Long> field17() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.CHILDREN_PRICE_ID; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Long> field18() { return dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES.EXTRA_BED_PRICE_ID; } /** * {@inheritDoc} */ @Override public java.lang.Long value1() { return getId(); } /** * {@inheritDoc} */ @Override public java.lang.String value2() { return getCurrency(); } /** * {@inheritDoc} */ @Override public java.math.BigDecimal value3() { return getValue(); } /** * {@inheritDoc} */ @Override public java.lang.Boolean value4() { return getCalculateFromNetto(); } /** * {@inheritDoc} */ @Override public java.lang.Boolean value5() { return getNettoFromNettoApplied(); } /** * {@inheritDoc} */ @Override public java.lang.Byte value6() { return getDiscountSourceType(); } /** * {@inheritDoc} */ @Override public java.lang.Long value7() { return getSourceRoomTypeId(); } /** * {@inheritDoc} */ @Override public java.lang.Long value8() { return getSourceCategoryId(); } /** * {@inheritDoc} */ @Override public java.lang.Long value9() { return getSourceMealTypeId(); } /** * {@inheritDoc} */ @Override public java.lang.Byte value10() { return getOperationPrice(); } /** * {@inheritDoc} */ @Override public java.lang.Long value11() { return getContractId(); } /** * {@inheritDoc} */ @Override public java.lang.Byte value12() { return getPriceType(); } /** * {@inheritDoc} */ @Override public java.lang.Byte value13() { return getRecalculationType(); } /** * {@inheritDoc} */ @Override public java.lang.Boolean value14() { return getChecked(); } /** * {@inheritDoc} */ @Override public java.lang.Byte value15() { return getExtrabedPriceType(); } /** * {@inheritDoc} */ @Override public java.lang.Byte value16() { return getChildrenDiscountPriceType(); } /** * {@inheritDoc} */ @Override public java.lang.Long value17() { return getChildrenPriceId(); } /** * {@inheritDoc} */ @Override public java.lang.Long value18() { return getExtraBedPriceId(); } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value1(java.lang.Long value) { setId(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value2(java.lang.String value) { setCurrency(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value3(java.math.BigDecimal value) { setValue(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value4(java.lang.Boolean value) { setCalculateFromNetto(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value5(java.lang.Boolean value) { setNettoFromNettoApplied(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value6(java.lang.Byte value) { setDiscountSourceType(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value7(java.lang.Long value) { setSourceRoomTypeId(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value8(java.lang.Long value) { setSourceCategoryId(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value9(java.lang.Long value) { setSourceMealTypeId(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value10(java.lang.Byte value) { setOperationPrice(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value11(java.lang.Long value) { setContractId(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value12(java.lang.Byte value) { setPriceType(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value13(java.lang.Byte value) { setRecalculationType(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value14(java.lang.Boolean value) { setChecked(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value15(java.lang.Byte value) { setExtrabedPriceType(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value16(java.lang.Byte value) { setChildrenDiscountPriceType(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value17(java.lang.Long value) { setChildrenPriceId(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord value18(java.lang.Long value) { setExtraBedPriceId(value); return this; } /** * {@inheritDoc} */ @Override public GptContractRecalculationRulesRecord values(java.lang.Long value1, java.lang.String value2, java.math.BigDecimal value3, java.lang.Boolean value4, java.lang.Boolean value5, java.lang.Byte value6, java.lang.Long value7, java.lang.Long value8, java.lang.Long value9, java.lang.Byte value10, java.lang.Long value11, java.lang.Byte value12, java.lang.Byte value13, java.lang.Boolean value14, java.lang.Byte value15, java.lang.Byte value16, java.lang.Long value17, java.lang.Long value18) { return this; } // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- /** * Create a detached GptContractRecalculationRulesRecord */ public GptContractRecalculationRulesRecord() { super(dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES); } /** * Create a detached, initialised GptContractRecalculationRulesRecord */ public GptContractRecalculationRulesRecord(java.lang.Long id, java.lang.String currency, java.math.BigDecimal value, java.lang.Boolean calculateFromNetto, java.lang.Boolean nettoFromNettoApplied, java.lang.Byte discountSourceType, java.lang.Long sourceRoomTypeId, java.lang.Long sourceCategoryId, java.lang.Long sourceMealTypeId, java.lang.Byte operationPrice, java.lang.Long contractId, java.lang.Byte priceType, java.lang.Byte recalculationType, java.lang.Boolean checked, java.lang.Byte extrabedPriceType, java.lang.Byte childrenDiscountPriceType, java.lang.Long childrenPriceId, java.lang.Long extraBedPriceId) { super(dshumsky.jooq.generated.tables.GptContractRecalculationRules.GPT_CONTRACT_RECALCULATION_RULES); setValue(0, id); setValue(1, currency); setValue(2, value); setValue(3, calculateFromNetto); setValue(4, nettoFromNettoApplied); setValue(5, discountSourceType); setValue(6, sourceRoomTypeId); setValue(7, sourceCategoryId); setValue(8, sourceMealTypeId); setValue(9, operationPrice); setValue(10, contractId); setValue(11, priceType); setValue(12, recalculationType); setValue(13, checked); setValue(14, extrabedPriceType); setValue(15, childrenDiscountPriceType); setValue(16, childrenPriceId); setValue(17, extraBedPriceId); } }
19,762
0.697348
0.68657
799
23.733418
45.04533
617
false
false
0
0
0
0
0
0
1.350438
false
false
10
adc5d367c728b123b5525eb4d05aa73294a48d08
34,961,033,800,121
a5921ab09a97ede2dd3e165b796e19d145059664
/src/main/java/com/cmu/edu/enterprisewebdevelopment/repository/TagRepository.java
7af598854c4755f296d51a81b45582d1436a65b1
[]
no_license
HaoZhan1/Blog-System
https://github.com/HaoZhan1/Blog-System
f6cbbca3159b0b3267f252b3bfabc17c640738b3
bc6178e8a962cedda0a102871c41157cdb467f10
refs/heads/master
2020-03-16T13:05:50.032000
2018-05-09T01:34:01
2018-05-09T01:34:01
132,681,226
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cmu.edu.enterprisewebdevelopment.repository; import com.cmu.edu.enterprisewebdevelopment.domain.Tag; import org.springframework.data.jpa.repository.JpaRepository; public interface TagRepository extends JpaRepository<Tag, Long> { }
UTF-8
Java
245
java
TagRepository.java
Java
[]
null
[]
package com.cmu.edu.enterprisewebdevelopment.repository; import com.cmu.edu.enterprisewebdevelopment.domain.Tag; import org.springframework.data.jpa.repository.JpaRepository; public interface TagRepository extends JpaRepository<Tag, Long> { }
245
0.844898
0.844898
7
34
29.316011
65
false
false
0
0
0
0
0
0
0.571429
false
false
10
079dbb1b2ec93f46df39555534724b67e885d1da
35,527,969,477,482
2707f6118d868286c872a3e9935d50488c8d42a4
/ZoraSA/BUPPolarityDetection/src/main/java/com/bupsolutions/polaritydetection/nlp/NGramExtractor.java
eb9fc6900589b41ddfb9fd287d54b8efef48796f
[]
no_license
fowzan123/ZAGA
https://github.com/fowzan123/ZAGA
d86373f00568727733d30b102f3433bffbf5b7ca
9b3b9886370165c3a2cbb5c52d2930466da51597
refs/heads/master
2023-06-24T02:49:10.039000
2021-07-28T18:32:38
2021-07-28T18:32:38
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bupsolutions.polaritydetection.nlp; import opennlp.tools.ngram.NGramGenerator; import java.util.Collection; import java.util.List; import java.util.stream.Collectors; public class NGramExtractor { private static final String SEPARATOR = " "; public List<String> ngrams(List<String> tokens, int n) { return NGramGenerator.generate(tokens, n, SEPARATOR); } public List<List<String>> mapNGrams(List<List<String>> sentences, int n) { return sentences.stream().map(sentence -> ngrams(sentence, n) ).collect(Collectors.toList()); } public List<String> flatMapNGrams(List<List<String>> sentences, int n) { return mapNGrams(sentences, n).stream() .flatMap(Collection::stream) .collect(Collectors.toList()); } }
UTF-8
Java
832
java
NGramExtractor.java
Java
[]
null
[]
package com.bupsolutions.polaritydetection.nlp; import opennlp.tools.ngram.NGramGenerator; import java.util.Collection; import java.util.List; import java.util.stream.Collectors; public class NGramExtractor { private static final String SEPARATOR = " "; public List<String> ngrams(List<String> tokens, int n) { return NGramGenerator.generate(tokens, n, SEPARATOR); } public List<List<String>> mapNGrams(List<List<String>> sentences, int n) { return sentences.stream().map(sentence -> ngrams(sentence, n) ).collect(Collectors.toList()); } public List<String> flatMapNGrams(List<List<String>> sentences, int n) { return mapNGrams(sentences, n).stream() .flatMap(Collection::stream) .collect(Collectors.toList()); } }
832
0.665865
0.665865
28
28.714285
24.999796
79
false
false
0
0
0
0
0
0
0.571429
false
false
10
9f6ce8addb6c281c9ec36709e18b74c9704d825b
34,127,810,161,158
74d16c286b2fb9a208bc70319753642b939244b2
/src/test/java/com/webservice/ExternalAPIIntergration/resource/ExternalResourceUnitTest.java
4def2c76a4faaf7004ba9d53bc9bed3daf6e0045
[]
no_license
mallam01/External-API-Intergration
https://github.com/mallam01/External-API-Intergration
82e2c1fcbfc5a83a2a313c1ca81d465ed6c35c55
336b5c7436fa902f1ca90b809cda9907d8460609
refs/heads/master
2020-04-29T16:57:01.343000
2020-04-18T23:46:22
2020-04-18T23:46:22
176,280,226
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.webservice.ExternalAPIIntergration.resource; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import javax.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import com.webservice.ExternalAPIIntergration.service.ExternalService; public class ExternalResourceUnitTest { @InjectMocks ExternalResource externalResource; @Mock ExternalService externalService; @Before public void init() { MockitoAnnotations.initMocks(this); } @Test public void testGetAllValues() { Response mockResponse = mock(Response.class); when(externalService.retireveAllData()).thenReturn(mockResponse); Response actualResponse = externalResource.getAllValues(); assertEquals(mockResponse, actualResponse); } @Test public void testCallServiceOnce() { externalService.retireveAllData(); verify(externalService, times(1)).retireveAllData(); } }
UTF-8
Java
1,137
java
ExternalResourceUnitTest.java
Java
[]
null
[]
package com.webservice.ExternalAPIIntergration.resource; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import javax.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import com.webservice.ExternalAPIIntergration.service.ExternalService; public class ExternalResourceUnitTest { @InjectMocks ExternalResource externalResource; @Mock ExternalService externalService; @Before public void init() { MockitoAnnotations.initMocks(this); } @Test public void testGetAllValues() { Response mockResponse = mock(Response.class); when(externalService.retireveAllData()).thenReturn(mockResponse); Response actualResponse = externalResource.getAllValues(); assertEquals(mockResponse, actualResponse); } @Test public void testCallServiceOnce() { externalService.retireveAllData(); verify(externalService, times(1)).retireveAllData(); } }
1,137
0.80299
0.802111
47
23.19149
21.170673
70
false
false
0
0
0
0
0
0
1.085106
false
false
10
8d37ef1adba43c968475754836b63ad05d145490
20,993,800,175,879
cdf887904a45489171f09314c124130ddccde056
/java/src/modele/outils/Joueur.java
02a4e02ff7f85bf232f8cff2df2c62535758b060
[]
no_license
DylanADS/Cochonou-adventures
https://github.com/DylanADS/Cochonou-adventures
5068e0216269ed077145bf675c83f7527c899be4
3414c09fae837ab8f5af098fd7680ec1830ff691
refs/heads/main
2023-02-15T02:04:13.219000
2021-01-06T11:02:15
2021-01-06T11:02:15
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package modele.outils; import modele.jeu.bonus.Bonus; import java.io.Serializable; public class Joueur implements Serializable { private final String nom; private int vie; private int score; public Bonus[] bonus = new Bonus[5]; public Joueur(String nom) { this.nom = nom; this.vie = 5; this.score = 0; } @Override public String toString() { return "Joueur{" + "nom='" + nom + '\'' + ", vie=" + vie + ", score=" + score + '}'; } public void gagnerUneVie() { this.vie++; } public void perdreUneVie() { if (!plusDeVie()) this.vie--; } public void gagner(int n) { this.score += n; } public boolean plusDeVie() { return this.vie == 0; } public int getScore() { return score; } public int getVie() { return vie; } public String getNom() { return nom; } public Bonus[] getBonus() { return bonus; } public void setScore(int score) { this.score = score; } }
UTF-8
Java
1,082
java
Joueur.java
Java
[]
null
[]
package modele.outils; import modele.jeu.bonus.Bonus; import java.io.Serializable; public class Joueur implements Serializable { private final String nom; private int vie; private int score; public Bonus[] bonus = new Bonus[5]; public Joueur(String nom) { this.nom = nom; this.vie = 5; this.score = 0; } @Override public String toString() { return "Joueur{" + "nom='" + nom + '\'' + ", vie=" + vie + ", score=" + score + '}'; } public void gagnerUneVie() { this.vie++; } public void perdreUneVie() { if (!plusDeVie()) this.vie--; } public void gagner(int n) { this.score += n; } public boolean plusDeVie() { return this.vie == 0; } public int getScore() { return score; } public int getVie() { return vie; } public String getNom() { return nom; } public Bonus[] getBonus() { return bonus; } public void setScore(int score) { this.score = score; } }
1,082
0.532348
0.528651
67
15.149254
13.010046
45
false
false
0
0
0
0
0
0
0.328358
false
false
10
57621a663b5b3ebe379a745936dda0380d5362bf
9,380,208,626,482
e7d8780100b87ba96aca4a972b47b667a21b2ada
/E-CommerceAutomation/src/Excelutilities/ExcelutilEx1.java
f34bb8d62708a9c15449029196cc689a7173a317
[]
no_license
srutibekkeri/AutomationE-Commerce
https://github.com/srutibekkeri/AutomationE-Commerce
ff8a1c4ae226b39703c0a6985db8331970d2a891
cb2098b6531a2ba581a695a3a76fa63ea843d551
refs/heads/master
2023-07-05T16:31:52.654000
2021-08-26T18:12:41
2021-08-26T18:12:41
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Excelutilities; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.TreeMap; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.ss.usermodel.DataFormatter; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class ExcelutilEx1 { public static void getRowCount() throws IOException { XSSFWorkbook workbook=new XSSFWorkbook("/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceAutomation/Excelfiles/Book1.xlsx"); XSSFSheet sheet = workbook.getSheet("Sheet1"); //number of rows// int rowcount = sheet.getPhysicalNumberOfRows(); System.out.println(rowcount); } //cell information// public static void getCellData() throws IOException { XSSFWorkbook workbook=new XSSFWorkbook("/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceAutomation/Excelfiles/Book6.xlsx"); XSSFSheet sheet = workbook.getSheet("Sheet1"); String value = sheet.getRow(0).getCell(0).getStringCellValue(); System.out.println(value); } //number of columns// public static void getcellNumbers() throws IOException { XSSFWorkbook workbook=new XSSFWorkbook("/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceAutomation/Excelfiles/Book6.xlsx"); XSSFSheet sheet = workbook.getSheet("Sheet1"); double valuee1 = sheet.getRow(1).getCell(1).getNumericCellValue(); System.out.println(valuee1); } public static Map<String,String> getMapData() throws IOException { XSSFWorkbook workbook=new XSSFWorkbook("/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceAutomation/Excelfiles/Book5.xlsx"); XSSFSheet sheet = workbook.getSheet("Sheet1"); int lastrowcount = sheet.getLastRowNum(); System.out.println(lastrowcount);//printing last row count// TreeMap<String,String> testdata=new TreeMap<String,String>();//Map is used to print pair and treemap for sorted output for(int i=0;i<=lastrowcount;i++)//loop to traverse till lastrow { XSSFRow row = sheet.getRow(i);//copy all row information in "row" String key = row.getCell(0).getStringCellValue().trim();//first column info String value = row.getCell(1).getStringCellValue().trim();//second column info testdata.put(key, value);//first column info is stored in "key" and second column info is stored in "value" } return testdata;//have to use return statement when we use any datatype for method other than void } public static List<Map<String,String>> getTestDatalist() throws IOException { Map<String,String>testdata=null; XSSFWorkbook workbook=new XSSFWorkbook("/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceAutomation/Excelfiles/Book6.xlsx"); XSSFSheet sheet = workbook.getSheet("Sheet1"); int lastrowcount = sheet.getPhysicalNumberOfRows(); short lastcolumn = sheet.getRow(0).getLastCellNum(); System.out.println(lastrowcount); System.out.println(lastcolumn); ArrayList list=new ArrayList(); for(int i=0;i<lastcolumn;i++) { XSSFRow rowcount = sheet.getRow(0); XSSFCell cell = rowcount.getCell(i); String rowHeaders = cell.getStringCellValue(); list.add(rowHeaders); } ArrayList<Map<String,String>> testdataAll=new ArrayList<Map<String,String>>(); for(int j=1;j<lastrowcount;j++) { XSSFRow rows = sheet.getRow(j); testdata=new TreeMap<String,String>(); for(int k=0;k<lastcolumn;k++) { String colvalues = rows.getCell(k).getStringCellValue(); testdata.put((String) list.get(k),colvalues); } testdataAll.add(testdata); } return testdataAll; } public void writeTest(String name,int i,int j) throws InvalidFormatException, IOException { File src = new File("/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceAutomation/Excelfiles/Book1.xlsx");//file is copied in src FileInputStream filesss = new FileInputStream(src); XSSFWorkbook workbook=new XSSFWorkbook(filesss); XSSFSheet sheet = workbook.getSheet("Sheet1"); sheet.getRow(i).getCell(j).setCellValue(name); FileOutputStream fout = new FileOutputStream(src);//path where data need to be edited workbook.write(fout);//write instruction workbook.close();//close workbook once editing is completed } public static int getRowCount(String Xfile,String sheetname) throws IOException { XSSFWorkbook workbook=new XSSFWorkbook(Xfile); XSSFSheet sheet = workbook.getSheet(sheetname); int rowcount = sheet.getLastRowNum(); workbook.close(); return rowcount; } public static int cellCount(String Xfile,String sheetname, int rownumb) throws IOException { XSSFWorkbook workbook=new XSSFWorkbook(Xfile); XSSFSheet sheet = workbook.getSheet(sheetname); int Cellcount = sheet.getRow(rownumb).getLastCellNum(); workbook.close(); return Cellcount; } public static String cellData(String Xfile,String sheetname, int rownumb,int cellnumb) throws IOException { XSSFWorkbook workbook=new XSSFWorkbook(Xfile); XSSFSheet sheet = workbook.getSheet(sheetname); XSSFCell Celldata = sheet.getRow(rownumb).getCell(cellnumb); DataFormatter formatter = new DataFormatter(); String Cellvalues = formatter.formatCellValue(Celldata); return Cellvalues; } }
UTF-8
Java
5,446
java
ExcelutilEx1.java
Java
[ { "context": "\n\t\tXSSFWorkbook workbook=new XSSFWorkbook(\"/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceAutomation", "end": 693, "score": 0.8992397785186768, "start": 682, "tag": "USERNAME", "value": "abhaymanoli" }, { "context": "\n\t\tXSSFWorkbook workbook=new XSSFWorkbook(\"/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceAutomation", "end": 1072, "score": 0.8742549419403076, "start": 1061, "tag": "USERNAME", "value": "abhaymanoli" }, { "context": "\n\t\tXSSFWorkbook workbook=new XSSFWorkbook(\"/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceA", "end": 1429, "score": 0.7422128915786743, "start": 1427, "tag": "USERNAME", "value": "ab" }, { "context": "SFWorkbook workbook=new XSSFWorkbook(\"/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceAutomat", "end": 1435, "score": 0.517821192741394, "start": 1432, "tag": "USERNAME", "value": "man" }, { "context": "\n\t\tXSSFWorkbook workbook=new XSSFWorkbook(\"/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceAutomation", "end": 1803, "score": 0.9842440485954285, "start": 1792, "tag": "USERNAME", "value": "abhaymanoli" }, { "context": "\n\t\tXSSFWorkbook workbook=new XSSFWorkbook(\"/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceAutomat", "end": 2868, "score": 0.7055732607841492, "start": 2860, "tag": "USERNAME", "value": "abhayman" }, { "context": "orkbook workbook=new XSSFWorkbook(\"/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceAutomation", "end": 2871, "score": 0.46216881275177, "start": 2868, "tag": "NAME", "value": "oli" }, { "context": "ion, IOException\n\t{\n\t\tFile src = new File(\"/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceAutomation", "end": 3964, "score": 0.9991112947463989, "start": 3953, "tag": "USERNAME", "value": "abhaymanoli" } ]
null
[]
package Excelutilities; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.TreeMap; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.ss.usermodel.DataFormatter; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class ExcelutilEx1 { public static void getRowCount() throws IOException { XSSFWorkbook workbook=new XSSFWorkbook("/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceAutomation/Excelfiles/Book1.xlsx"); XSSFSheet sheet = workbook.getSheet("Sheet1"); //number of rows// int rowcount = sheet.getPhysicalNumberOfRows(); System.out.println(rowcount); } //cell information// public static void getCellData() throws IOException { XSSFWorkbook workbook=new XSSFWorkbook("/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceAutomation/Excelfiles/Book6.xlsx"); XSSFSheet sheet = workbook.getSheet("Sheet1"); String value = sheet.getRow(0).getCell(0).getStringCellValue(); System.out.println(value); } //number of columns// public static void getcellNumbers() throws IOException { XSSFWorkbook workbook=new XSSFWorkbook("/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceAutomation/Excelfiles/Book6.xlsx"); XSSFSheet sheet = workbook.getSheet("Sheet1"); double valuee1 = sheet.getRow(1).getCell(1).getNumericCellValue(); System.out.println(valuee1); } public static Map<String,String> getMapData() throws IOException { XSSFWorkbook workbook=new XSSFWorkbook("/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceAutomation/Excelfiles/Book5.xlsx"); XSSFSheet sheet = workbook.getSheet("Sheet1"); int lastrowcount = sheet.getLastRowNum(); System.out.println(lastrowcount);//printing last row count// TreeMap<String,String> testdata=new TreeMap<String,String>();//Map is used to print pair and treemap for sorted output for(int i=0;i<=lastrowcount;i++)//loop to traverse till lastrow { XSSFRow row = sheet.getRow(i);//copy all row information in "row" String key = row.getCell(0).getStringCellValue().trim();//first column info String value = row.getCell(1).getStringCellValue().trim();//second column info testdata.put(key, value);//first column info is stored in "key" and second column info is stored in "value" } return testdata;//have to use return statement when we use any datatype for method other than void } public static List<Map<String,String>> getTestDatalist() throws IOException { Map<String,String>testdata=null; XSSFWorkbook workbook=new XSSFWorkbook("/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceAutomation/Excelfiles/Book6.xlsx"); XSSFSheet sheet = workbook.getSheet("Sheet1"); int lastrowcount = sheet.getPhysicalNumberOfRows(); short lastcolumn = sheet.getRow(0).getLastCellNum(); System.out.println(lastrowcount); System.out.println(lastcolumn); ArrayList list=new ArrayList(); for(int i=0;i<lastcolumn;i++) { XSSFRow rowcount = sheet.getRow(0); XSSFCell cell = rowcount.getCell(i); String rowHeaders = cell.getStringCellValue(); list.add(rowHeaders); } ArrayList<Map<String,String>> testdataAll=new ArrayList<Map<String,String>>(); for(int j=1;j<lastrowcount;j++) { XSSFRow rows = sheet.getRow(j); testdata=new TreeMap<String,String>(); for(int k=0;k<lastcolumn;k++) { String colvalues = rows.getCell(k).getStringCellValue(); testdata.put((String) list.get(k),colvalues); } testdataAll.add(testdata); } return testdataAll; } public void writeTest(String name,int i,int j) throws InvalidFormatException, IOException { File src = new File("/Users/abhaymanoli/Desktop/Automation Workspace/E-CommerceAutomation/Excelfiles/Book1.xlsx");//file is copied in src FileInputStream filesss = new FileInputStream(src); XSSFWorkbook workbook=new XSSFWorkbook(filesss); XSSFSheet sheet = workbook.getSheet("Sheet1"); sheet.getRow(i).getCell(j).setCellValue(name); FileOutputStream fout = new FileOutputStream(src);//path where data need to be edited workbook.write(fout);//write instruction workbook.close();//close workbook once editing is completed } public static int getRowCount(String Xfile,String sheetname) throws IOException { XSSFWorkbook workbook=new XSSFWorkbook(Xfile); XSSFSheet sheet = workbook.getSheet(sheetname); int rowcount = sheet.getLastRowNum(); workbook.close(); return rowcount; } public static int cellCount(String Xfile,String sheetname, int rownumb) throws IOException { XSSFWorkbook workbook=new XSSFWorkbook(Xfile); XSSFSheet sheet = workbook.getSheet(sheetname); int Cellcount = sheet.getRow(rownumb).getLastCellNum(); workbook.close(); return Cellcount; } public static String cellData(String Xfile,String sheetname, int rownumb,int cellnumb) throws IOException { XSSFWorkbook workbook=new XSSFWorkbook(Xfile); XSSFSheet sheet = workbook.getSheet(sheetname); XSSFCell Celldata = sheet.getRow(rownumb).getCell(cellnumb); DataFormatter formatter = new DataFormatter(); String Cellvalues = formatter.formatCellValue(Celldata); return Cellvalues; } }
5,446
0.757253
0.752112
196
26.785715
33.843655
139
false
false
0
0
0
0
0
0
1.367347
false
false
10
6aa5cac6776061adb77166cd39bf87e749f00982
35,656,818,500,112
1a729c8f5f9f07a9617dd42b0f1dbb9b785f29d8
/view/ThumbnailPanel.java
d71fff1a2c2f3c06cda960ddcb703baa74119d8d
[]
no_license
cankevinlaurent/prezoom
https://github.com/cankevinlaurent/prezoom
14d0e57345c5e9d1bff4729a8ea21b8663c39d06
967edc59ccb76119d52da94735618275fbb7856e
refs/heads/main
2023-04-08T22:09:19.824000
2021-04-07T00:34:56
2021-04-07T00:34:56
355,361,169
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * THIS FILE WAS PREPARED BY DELTA GROUP. IT WAS COMPLETED BY US ALONG. */ package view; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Graphics2D; import java.awt.Image; import java.awt.image.BufferedImage; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JPanel; import controller.Controller; import model.State; /** * The Thumbnail panel on the left side of the Main Window. It is inside a * JScrollPane on the left side of the Main Window. It uses the states * information to draw all thumbnials, each of which reflects one state along * with its graphics. * * @author Delta Group */ public class ThumbnailPanel extends JPanel { private static final long serialVersionUID = 375497L; private final Controller ctr; /** * The constructor. * * @param c - the controller */ public ThumbnailPanel(final Controller c) { ctr = c; setPreferredSize(new Dimension(80, 1000)); setLayout(new FlowLayout()); } /** * Display all states in forms of thumbnails. Every time, it clears all current * Thumbnails on the Thumbnail panel, and then focuses one thumbnail. The * thumbnail is created via the BufferedImage. */ public void display() { removeAll(); for (State st : ctr.getStates()) { BufferedImage bImage = new BufferedImage(1920, 1920, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = bImage.createGraphics(); g2d.setBackground(Color.WHITE); g2d.fillRect(0, 0, 1920, 1920); Thumbnail tn = new Thumbnail(ctr, st.getID()); st.display(g2d, st, ctr); tn.setIcon(new ImageIcon(bImage.getScaledInstance(80, 80, Image.SCALE_DEFAULT))); if (ctr.getFocusedID() == tn.getID()) tn.setBorder(BorderFactory.createLineBorder(Color.RED)); add(tn, BorderLayout.PAGE_START); } repaint(); revalidate(); } }
UTF-8
Java
1,979
java
ThumbnailPanel.java
Java
[ { "context": "e state along\n * with its graphics.\n * \n * @author Delta Group\n */\n\npublic class ThumbnailPanel extends JPanel {", "end": 711, "score": 0.9893604516983032, "start": 700, "tag": "NAME", "value": "Delta Group" } ]
null
[]
/** * THIS FILE WAS PREPARED BY DELTA GROUP. IT WAS COMPLETED BY US ALONG. */ package view; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Graphics2D; import java.awt.Image; import java.awt.image.BufferedImage; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JPanel; import controller.Controller; import model.State; /** * The Thumbnail panel on the left side of the Main Window. It is inside a * JScrollPane on the left side of the Main Window. It uses the states * information to draw all thumbnials, each of which reflects one state along * with its graphics. * * @author <NAME> */ public class ThumbnailPanel extends JPanel { private static final long serialVersionUID = 375497L; private final Controller ctr; /** * The constructor. * * @param c - the controller */ public ThumbnailPanel(final Controller c) { ctr = c; setPreferredSize(new Dimension(80, 1000)); setLayout(new FlowLayout()); } /** * Display all states in forms of thumbnails. Every time, it clears all current * Thumbnails on the Thumbnail panel, and then focuses one thumbnail. The * thumbnail is created via the BufferedImage. */ public void display() { removeAll(); for (State st : ctr.getStates()) { BufferedImage bImage = new BufferedImage(1920, 1920, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = bImage.createGraphics(); g2d.setBackground(Color.WHITE); g2d.fillRect(0, 0, 1920, 1920); Thumbnail tn = new Thumbnail(ctr, st.getID()); st.display(g2d, st, ctr); tn.setIcon(new ImageIcon(bImage.getScaledInstance(80, 80, Image.SCALE_DEFAULT))); if (ctr.getFocusedID() == tn.getID()) tn.setBorder(BorderFactory.createLineBorder(Color.RED)); add(tn, BorderLayout.PAGE_START); } repaint(); revalidate(); } }
1,974
0.689237
0.669025
74
25.743244
22.856226
79
false
false
0
0
0
0
0
0
1.067568
false
false
10
be83ce9d803e24b686b66d587a1bc151aac4344a
27,084,063,810,107
52cdf2157a3fdcbe8dd40d9bef2d41208447267f
/src/main/java/org/wuyechun/util/ws/InfoSearchServices.java
185173d6228a33983c7e1f330fe8eb9c31d453a9
[]
no_license
wuyechun2018/dbquery
https://github.com/wuyechun2018/dbquery
3099d4ffd2e3323beaaab1cf030b38d35a5c0732
32ca5ca4df5e0bc2bec4afdce8f1c61683491c30
refs/heads/master
2021-01-10T01:53:13.298000
2015-05-29T03:22:49
2015-05-29T03:22:49
36,424,262
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.wuyechun.util.ws; import java.net.MalformedURLException; import java.net.URL; import javax.xml.namespace.QName; import javax.xml.ws.Service; import javax.xml.ws.WebEndpoint; import javax.xml.ws.WebServiceClient; import javax.xml.ws.WebServiceException; import javax.xml.ws.WebServiceFeature; /** * This class was generated by the JAX-WS RI. * JAX-WS RI 2.2.4-b01 * Generated source version: 2.2 * */ @WebServiceClient(name = "InfoSearchServices", targetNamespace = "http://tempuri.org/", wsdlLocation = "http://172.16.7.107:3164/InfoSearchServices.asmx?WSDL") public class InfoSearchServices extends Service { private final static URL INFOSEARCHSERVICES_WSDL_LOCATION; private final static WebServiceException INFOSEARCHSERVICES_EXCEPTION; private final static QName INFOSEARCHSERVICES_QNAME = new QName("http://tempuri.org/", "InfoSearchServices"); static { URL url = null; WebServiceException e = null; try { url = new URL("http://172.16.7.107:3164/InfoSearchServices.asmx?WSDL"); } catch (MalformedURLException ex) { e = new WebServiceException(ex); } INFOSEARCHSERVICES_WSDL_LOCATION = url; INFOSEARCHSERVICES_EXCEPTION = e; } public InfoSearchServices() { super(__getWsdlLocation(), INFOSEARCHSERVICES_QNAME); } public InfoSearchServices(WebServiceFeature... features) { super(__getWsdlLocation(), INFOSEARCHSERVICES_QNAME, features); } public InfoSearchServices(URL wsdlLocation) { super(wsdlLocation, INFOSEARCHSERVICES_QNAME); } public InfoSearchServices(URL wsdlLocation, WebServiceFeature... features) { super(wsdlLocation, INFOSEARCHSERVICES_QNAME, features); } public InfoSearchServices(URL wsdlLocation, QName serviceName) { super(wsdlLocation, serviceName); } public InfoSearchServices(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { super(wsdlLocation, serviceName, features); } /** * * @return * returns InfoSearchServicesSoap */ @WebEndpoint(name = "InfoSearchServicesSoap") public InfoSearchServicesSoap getInfoSearchServicesSoap() { return super.getPort(new QName("http://tempuri.org/", "InfoSearchServicesSoap"), InfoSearchServicesSoap.class); } /** * * @param features * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. * @return * returns InfoSearchServicesSoap */ @WebEndpoint(name = "InfoSearchServicesSoap") public InfoSearchServicesSoap getInfoSearchServicesSoap(WebServiceFeature... features) { return super.getPort(new QName("http://tempuri.org/", "InfoSearchServicesSoap"), InfoSearchServicesSoap.class, features); } private static URL __getWsdlLocation() { if (INFOSEARCHSERVICES_EXCEPTION!= null) { throw INFOSEARCHSERVICES_EXCEPTION; } return INFOSEARCHSERVICES_WSDL_LOCATION; } }
UTF-8
Java
3,242
java
InfoSearchServices.java
Java
[ { "context": "e = \"http://tempuri.org/\", wsdlLocation = \"http://172.16.7.107:3164/InfoSearchServices.asmx?WSDL\")\r\npublic class", "end": 565, "score": 0.9995455741882324, "start": 553, "tag": "IP_ADDRESS", "value": "172.16.7.107" }, { "context": "\n try {\r\n url = new URL(\"http://172.16.7.107:3164/InfoSearchServices.asmx?WSDL\");\r\n } c", "end": 1058, "score": 0.9996693134307861, "start": 1046, "tag": "IP_ADDRESS", "value": "172.16.7.107" } ]
null
[]
package org.wuyechun.util.ws; import java.net.MalformedURLException; import java.net.URL; import javax.xml.namespace.QName; import javax.xml.ws.Service; import javax.xml.ws.WebEndpoint; import javax.xml.ws.WebServiceClient; import javax.xml.ws.WebServiceException; import javax.xml.ws.WebServiceFeature; /** * This class was generated by the JAX-WS RI. * JAX-WS RI 2.2.4-b01 * Generated source version: 2.2 * */ @WebServiceClient(name = "InfoSearchServices", targetNamespace = "http://tempuri.org/", wsdlLocation = "http://172.16.7.107:3164/InfoSearchServices.asmx?WSDL") public class InfoSearchServices extends Service { private final static URL INFOSEARCHSERVICES_WSDL_LOCATION; private final static WebServiceException INFOSEARCHSERVICES_EXCEPTION; private final static QName INFOSEARCHSERVICES_QNAME = new QName("http://tempuri.org/", "InfoSearchServices"); static { URL url = null; WebServiceException e = null; try { url = new URL("http://172.16.7.107:3164/InfoSearchServices.asmx?WSDL"); } catch (MalformedURLException ex) { e = new WebServiceException(ex); } INFOSEARCHSERVICES_WSDL_LOCATION = url; INFOSEARCHSERVICES_EXCEPTION = e; } public InfoSearchServices() { super(__getWsdlLocation(), INFOSEARCHSERVICES_QNAME); } public InfoSearchServices(WebServiceFeature... features) { super(__getWsdlLocation(), INFOSEARCHSERVICES_QNAME, features); } public InfoSearchServices(URL wsdlLocation) { super(wsdlLocation, INFOSEARCHSERVICES_QNAME); } public InfoSearchServices(URL wsdlLocation, WebServiceFeature... features) { super(wsdlLocation, INFOSEARCHSERVICES_QNAME, features); } public InfoSearchServices(URL wsdlLocation, QName serviceName) { super(wsdlLocation, serviceName); } public InfoSearchServices(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { super(wsdlLocation, serviceName, features); } /** * * @return * returns InfoSearchServicesSoap */ @WebEndpoint(name = "InfoSearchServicesSoap") public InfoSearchServicesSoap getInfoSearchServicesSoap() { return super.getPort(new QName("http://tempuri.org/", "InfoSearchServicesSoap"), InfoSearchServicesSoap.class); } /** * * @param features * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. * @return * returns InfoSearchServicesSoap */ @WebEndpoint(name = "InfoSearchServicesSoap") public InfoSearchServicesSoap getInfoSearchServicesSoap(WebServiceFeature... features) { return super.getPort(new QName("http://tempuri.org/", "InfoSearchServicesSoap"), InfoSearchServicesSoap.class, features); } private static URL __getWsdlLocation() { if (INFOSEARCHSERVICES_EXCEPTION!= null) { throw INFOSEARCHSERVICES_EXCEPTION; } return INFOSEARCHSERVICES_WSDL_LOCATION; } }
3,242
0.677051
0.666872
93
32.838711
36.187473
181
false
false
0
0
0
0
0
0
0.526882
false
false
10
5b5866a4b8a1c1f055c471e0059a33a94ad18605
16,260,746,232,666
733d0cce1a30d25b62b9f87aebb645002fea2f13
/java/aulas/src/listaheranca/Fornecedor.java
273a5b4d76560d116bbfbf69e4f11601162533d5
[]
no_license
tatiantunes/turma16java
https://github.com/tatiantunes/turma16java
24d6761845b5bd1cd45fa4e788f04d8e66516822
7d9760e0023e27ecd35ea4786ada4c576c0e46e5
refs/heads/main
2023-03-11T08:31:10.853000
2021-02-19T21:23:31
2021-02-19T21:23:31
329,984,607
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package listaheranca; /*Considere, como subclasse da classe Pessoa (desenvolvida no exercício anterior) a classe Fornecedor. * Considere que cada instância da classe Fornecedor tem, para além dos atributos que caracterizam a classe Pessoa, * os atributos valorCredito (correspondente ao crédito máximo atribuído ao fornecedor) e valorDivida * (montante da dívida para com o fornecedor). Implemente na classe Fornecedor, para além dos usuais métodos seletores * e modificadores, um método obterSaldo() que devolve a diferença entre os valores dos atributos valorCredito e valorDivida. * */ public class Fornecedor extends Pessoa { public double valorCredito; public double valorDivida; public Fornecedor(String nome, String endereco, String telefone,double valorCredito, double valorDivida) { super(nome, endereco, telefone); this.valorCredito = valorCredito; this.valorDivida = valorDivida; } public Fornecedor() { } public double getValorCredito() { return valorCredito; } public void setValorCredito(double valorCredito) { this.valorCredito = valorCredito; } public double getValorDivida() { return valorDivida; } public void setValorDivida(double valorDivida) { this.valorDivida = valorDivida; } public void ObterSaldo() { double dif; dif = valorCredito - valorDivida; System.out.printf("O saldo foi %f",dif); } }
ISO-8859-1
Java
1,396
java
Fornecedor.java
Java
[]
null
[]
package listaheranca; /*Considere, como subclasse da classe Pessoa (desenvolvida no exercício anterior) a classe Fornecedor. * Considere que cada instância da classe Fornecedor tem, para além dos atributos que caracterizam a classe Pessoa, * os atributos valorCredito (correspondente ao crédito máximo atribuído ao fornecedor) e valorDivida * (montante da dívida para com o fornecedor). Implemente na classe Fornecedor, para além dos usuais métodos seletores * e modificadores, um método obterSaldo() que devolve a diferença entre os valores dos atributos valorCredito e valorDivida. * */ public class Fornecedor extends Pessoa { public double valorCredito; public double valorDivida; public Fornecedor(String nome, String endereco, String telefone,double valorCredito, double valorDivida) { super(nome, endereco, telefone); this.valorCredito = valorCredito; this.valorDivida = valorDivida; } public Fornecedor() { } public double getValorCredito() { return valorCredito; } public void setValorCredito(double valorCredito) { this.valorCredito = valorCredito; } public double getValorDivida() { return valorDivida; } public void setValorDivida(double valorDivida) { this.valorDivida = valorDivida; } public void ObterSaldo() { double dif; dif = valorCredito - valorDivida; System.out.printf("O saldo foi %f",dif); } }
1,396
0.760289
0.760289
45
29.777779
36.054829
127
false
false
0
0
0
0
0
0
1.555556
false
false
10
b6c60737bcf3bc477e24089bc779da32e73ab8e2
11,252,814,366,833
a40ae0fef89bb418e7749ede7ec2d9326abdf7da
/app/src/main/java/com/dressme/RatingModel.java
6a4eb075533ef8a7c4f8f1fd0da908fd0599a92d
[]
no_license
zacharymontoya/DressMe-android
https://github.com/zacharymontoya/DressMe-android
75642fd59a225804f916a24b434faab6b693018b
4b1acbebe7bff9242d489bd76cf23cd1b61ae09f
refs/heads/master
2019-01-01T19:12:57.851000
2015-03-08T15:52:23
2015-03-08T15:52:23
31,800,432
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dressme; public class RatingModel { private String reviewerId; private int score; private String comment; public RatingModel(String reviewerId, int score, String comment) { this.reviewerId = reviewerId; this.score = score; this.comment = comment; } public String getReviewerId() { return reviewerId; } public void setReviewerId(String reviewerId) { this.reviewerId = reviewerId; } public int getScore() { return score; } public void setScore(int score) { this.score = score; } public String getComment() { return comment; } public void setComment(String comment) { this.comment = comment; } }
UTF-8
Java
753
java
RatingModel.java
Java
[]
null
[]
package com.dressme; public class RatingModel { private String reviewerId; private int score; private String comment; public RatingModel(String reviewerId, int score, String comment) { this.reviewerId = reviewerId; this.score = score; this.comment = comment; } public String getReviewerId() { return reviewerId; } public void setReviewerId(String reviewerId) { this.reviewerId = reviewerId; } public int getScore() { return score; } public void setScore(int score) { this.score = score; } public String getComment() { return comment; } public void setComment(String comment) { this.comment = comment; } }
753
0.61753
0.61753
37
19.351351
17.208132
70
false
false
0
0
0
0
0
0
0.405405
false
false
10
5253256259eac2e3293be71c32864540ea85419b
8,443,905,745,859
051377a9472339b036b7822ac0ce667f39c24f26
/Java/binape/lang/tinylisp/AddProc.java
6e0137701baedbd9e7cde0327834dde04f810975
[]
no_license
binape/tinylisp
https://github.com/binape/tinylisp
4812f9ad90ac145037e08e30c740b80e5cc6936a
aeccd360c723d29761a54325135149bbe97ad882
refs/heads/master
2019-07-16T02:06:44.866000
2018-05-04T10:32:38
2018-05-04T10:32:38
65,743,045
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package binape.lang.tinylisp; import java.math.BigDecimal; class AddProc extends ProcAdapter { @Override public Object eval(Evaluator evaluator, ListNode nodes, Env env) { BigDecimal sum = BigDecimal.ZERO; for (Node node : nodes) { Object ret = evaluator.eval(node, env); if (ret instanceof BigDecimal) sum = sum.add((BigDecimal)ret); else throw new RuntimeException("[add] not BigDecimal, " + node); } return sum; } }
UTF-8
Java
533
java
AddProc.java
Java
[]
null
[]
package binape.lang.tinylisp; import java.math.BigDecimal; class AddProc extends ProcAdapter { @Override public Object eval(Evaluator evaluator, ListNode nodes, Env env) { BigDecimal sum = BigDecimal.ZERO; for (Node node : nodes) { Object ret = evaluator.eval(node, env); if (ret instanceof BigDecimal) sum = sum.add((BigDecimal)ret); else throw new RuntimeException("[add] not BigDecimal, " + node); } return sum; } }
533
0.592871
0.592871
19
27.105263
22.715389
76
false
false
0
0
0
0
0
0
0.578947
false
false
10
bf056616ec895415e040b040d35757085c4ace9d
11,141,145,223,437
3c9d2d01c8afbdd88af353cd4bff8ce375e4b456
/thirdweek/src/main/java/com/cable/gateway/inbound/OkhttpOutboundHandler.java
74cf92051cfd542f524b7cc4dbef805087f74824
[]
no_license
dumpCable/javaHomeWork
https://github.com/dumpCable/javaHomeWork
9b77776ab7db5fce295066f28c2bd80a7ab442e0
24262dc681ea98d7114462f636189bac620cc391
refs/heads/master
2023-08-25T05:00:56.514000
2021-09-21T13:43:17
2021-09-21T13:43:17
393,583,369
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cable.gateway.inbound; public class OkhttpOutboundHandler { }
UTF-8
Java
75
java
OkhttpOutboundHandler.java
Java
[]
null
[]
package com.cable.gateway.inbound; public class OkhttpOutboundHandler { }
75
0.813333
0.813333
4
17.75
17.268106
36
false
false
0
0
0
0
0
0
0.25
false
false
10
bca63c98e1d01922375af821ba19bfb967be0d26
11,141,145,223,394
9c894d887f158c48df23061b6b7fe5fad5820e65
/app/src/main/java/mud/arca/io/mud/Analysis/charts/MoodVsDayOfWeekView.java
c5faf7dcce4651095c4f61a0cbbadb24b81e793a
[]
no_license
ARCA-Industries/mud
https://github.com/ARCA-Industries/mud
5958c404a5cc5c25fbdf106c74137811382f5410
d2dc9fa5b7590fc1055404831bdcf1064e92af02
refs/heads/master
2020-08-27T13:40:21.542000
2020-05-21T00:25:07
2020-05-21T00:25:07
217,391,537
0
1
null
false
2020-05-13T00:43:16
2019-10-24T20:40:03
2020-05-12T22:52:13
2020-05-13T00:43:15
1,289
0
1
0
Java
false
false
package mud.arca.io.mud.Analysis.charts; import android.content.Context; import android.util.AttributeSet; import mud.arca.io.mud.Analysis.AnalysisChart; import mud.arca.io.mud.Analysis.ChartWithDates; import mud.arca.io.mud.Analysis.DayAxisVF; import mud.arca.io.mud.Analysis.DayOfWeekVF; import mud.arca.io.mud.Analysis.ShareableChart; import mud.arca.io.mud.DataStructures.Day; import mud.arca.io.mud.DataStructures.User; import mud.arca.io.mud.Util.Util; import com.github.mikephil.charting.charts.BarChart; import com.github.mikephil.charting.components.XAxis; import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.NoSuchElementException; public class MoodVsDayOfWeekView extends BarChart implements AnalysisChart, ChartWithDates, ShareableChart { public MoodVsDayOfWeekView(Context context) { super(context); init(null, 0); } public MoodVsDayOfWeekView(Context context, AttributeSet attrs) { super(context, attrs); init(attrs, 0); } public MoodVsDayOfWeekView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(attrs, defStyle); } private void init(AttributeSet attrs, int defStyle) { } private Date startDate; private Date endDate; ArrayList<Float> xValues; ArrayList<Float> yValues; public void setStartDate(Date startDate) { this.startDate = startDate; } public void setEndDate(Date endDate) { this.endDate = endDate; } @Override public void setDaysAndVariable(Collection<Day> days, String varName) { // Not used } public void plotListOfDays(Collection<Day> dayData) { } /** * Update the plot based on startDate, endDate. */ public void updateChart() { // map[dayOfWeek] = ArrayList of mood recordings HashMap<Integer, ArrayList<Float>> map = new HashMap<>(); for (int i = 1; i <= 7; i++) { map.put(i, new ArrayList<>()); } // Loop through the days and put mood recordings into 7 lists based on day of week. ArrayList<Day> dayData = User.getCurrentUser().fetchDays(startDate, endDate); for (Day day : dayData) { try { float avgMood = day.getAverageMood(); int dayOfWeek = Util.getDayOfWeek(day.getDate()); map.get(dayOfWeek).add(avgMood); } catch (NoSuchElementException e) { // Do nothing } } //Util.debug("map: " + map); // xValues is [1,2,3,4,5,6,7] as floats // yValues is the average mood for the corresponding day. xValues = new ArrayList<>(); yValues = new ArrayList<>(); for (int i = 1; i <= 7; i++) { xValues.add((float) i); yValues.add(Util.getAverage(map.get(i))); } VariableVsTimeView.plotFloats(xValues, yValues, this); // Apply the value formatter DayOfWeekVF this.getXAxis().setValueFormatter(new DayOfWeekVF(this)); XAxis xAxis = this.getXAxis(); xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); } }
UTF-8
Java
3,234
java
MoodVsDayOfWeekView.java
Java
[]
null
[]
package mud.arca.io.mud.Analysis.charts; import android.content.Context; import android.util.AttributeSet; import mud.arca.io.mud.Analysis.AnalysisChart; import mud.arca.io.mud.Analysis.ChartWithDates; import mud.arca.io.mud.Analysis.DayAxisVF; import mud.arca.io.mud.Analysis.DayOfWeekVF; import mud.arca.io.mud.Analysis.ShareableChart; import mud.arca.io.mud.DataStructures.Day; import mud.arca.io.mud.DataStructures.User; import mud.arca.io.mud.Util.Util; import com.github.mikephil.charting.charts.BarChart; import com.github.mikephil.charting.components.XAxis; import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.NoSuchElementException; public class MoodVsDayOfWeekView extends BarChart implements AnalysisChart, ChartWithDates, ShareableChart { public MoodVsDayOfWeekView(Context context) { super(context); init(null, 0); } public MoodVsDayOfWeekView(Context context, AttributeSet attrs) { super(context, attrs); init(attrs, 0); } public MoodVsDayOfWeekView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(attrs, defStyle); } private void init(AttributeSet attrs, int defStyle) { } private Date startDate; private Date endDate; ArrayList<Float> xValues; ArrayList<Float> yValues; public void setStartDate(Date startDate) { this.startDate = startDate; } public void setEndDate(Date endDate) { this.endDate = endDate; } @Override public void setDaysAndVariable(Collection<Day> days, String varName) { // Not used } public void plotListOfDays(Collection<Day> dayData) { } /** * Update the plot based on startDate, endDate. */ public void updateChart() { // map[dayOfWeek] = ArrayList of mood recordings HashMap<Integer, ArrayList<Float>> map = new HashMap<>(); for (int i = 1; i <= 7; i++) { map.put(i, new ArrayList<>()); } // Loop through the days and put mood recordings into 7 lists based on day of week. ArrayList<Day> dayData = User.getCurrentUser().fetchDays(startDate, endDate); for (Day day : dayData) { try { float avgMood = day.getAverageMood(); int dayOfWeek = Util.getDayOfWeek(day.getDate()); map.get(dayOfWeek).add(avgMood); } catch (NoSuchElementException e) { // Do nothing } } //Util.debug("map: " + map); // xValues is [1,2,3,4,5,6,7] as floats // yValues is the average mood for the corresponding day. xValues = new ArrayList<>(); yValues = new ArrayList<>(); for (int i = 1; i <= 7; i++) { xValues.add((float) i); yValues.add(Util.getAverage(map.get(i))); } VariableVsTimeView.plotFloats(xValues, yValues, this); // Apply the value formatter DayOfWeekVF this.getXAxis().setValueFormatter(new DayOfWeekVF(this)); XAxis xAxis = this.getXAxis(); xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); } }
3,234
0.646568
0.642239
106
29.509434
23.419571
91
false
false
0
0
0
0
0
0
0.698113
false
false
10
270ea737eb23972dab601bb60d27c2249d5bf613
11,493,332,546,009
9ec599e529ebc4596ab2ce7bb6446bd9eeba4816
/CatchUpRRunnable.java
ca86bb6ac1efe3d1caf1983fd1e0f1783e3e6004
[]
no_license
TheAttackingEyebrows/src
https://github.com/TheAttackingEyebrows/src
47f2d65480e8913f23aa0d9f77a1ff6fc3449944
02fa7cee788b5f6c114c735507be9fc755a017aa
refs/heads/master
2021-05-16T16:25:17.929000
2018-02-02T05:59:29
2018-02-02T05:59:29
119,938,830
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.PrintWriter; import java.net.InetSocketAddress; import java.net.Socket; import java.net.SocketTimeoutException; import java.util.ArrayList; import java.util.Base64; public class CatchUpRRunnable implements Runnable { private ServerInfo ip; private Blockchain blockchain; int gap; public CatchUpRRunnable(ServerInfo ip, Blockchain blockchain, int gap) { this.ip = ip; this.blockchain = blockchain; this.gap = gap; } @Override public void run() { try { Socket toServer = new Socket(); if(gap < 0){ System.out.println("init!"); toServer.connect(new InetSocketAddress(ip.getHost(), ip.getPort())); PrintWriter printWriter = new PrintWriter(toServer.getOutputStream(), true); printWriter.println("cu"); printWriter.flush(); ObjectOutputStream oos = new ObjectOutputStream(toServer.getOutputStream()); ObjectInputStream ois = new ObjectInputStream(toServer.getInputStream()); try { Block last = (Block) ois.readObject(); if(last != null){ blockchain.setHead(last); blockchain.setLength(blockchain.getLength() + 1); ois.close(); printWriter.close(); toServer.close(); while(!Base64.getEncoder().encodeToString(last.getPreviousHash()).equals("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=")){ Socket newSocket = new Socket(); newSocket.connect(new InetSocketAddress(ip.getHost(), ip.getPort())); printWriter = new PrintWriter(newSocket.getOutputStream(), true); printWriter.println("cu|" + Base64.getEncoder().encodeToString(last.getPreviousHash())); printWriter.flush(); oos = new ObjectOutputStream(newSocket.getOutputStream()); ois = new ObjectInputStream(newSocket.getInputStream()); Block temp = (Block) ois.readObject(); last.setPreviousBlock(temp); blockchain.setLength(blockchain.getLength() + 1); last = temp; ois.close(); printWriter.close(); newSocket.close(); } } } catch(ClassNotFoundException e){ } printWriter.close(); toServer.close(); ois.close(); } else{ if(gap > 0){ System.out.println("need to catch up"); Block localTail = null; Block remoteTail = null; toServer.connect(new InetSocketAddress(ip.getHost(), ip.getPort())); PrintWriter printWriter = new PrintWriter(toServer.getOutputStream(), true); printWriter.println("cu"); printWriter.flush(); ObjectOutputStream oos = new ObjectOutputStream(toServer.getOutputStream()); ObjectInputStream ois = new ObjectInputStream(toServer.getInputStream()); try{ Block last = (Block) ois.readObject(); Block lastHead = last; ois.close(); printWriter.close(); toServer.close(); for(int i = 0; i < gap - 1; i ++){ System.out.println("add more!"); Socket newSocket = new Socket(); newSocket.connect(new InetSocketAddress(ip.getHost(), ip.getPort())); printWriter = new PrintWriter(newSocket.getOutputStream(), true); printWriter.println("cu|" + Base64.getEncoder().encodeToString(last.getPreviousHash())); printWriter.flush(); oos = new ObjectOutputStream(newSocket.getOutputStream()); ois = new ObjectInputStream(newSocket.getInputStream()); Block temp = (Block) ois.readObject(); last.setPreviousBlock(temp); last.setPreviousHash(temp.calculateHash()); blockchain.setLength(blockchain.getLength() + 1); last = temp; ois.close(); printWriter.close(); newSocket.close(); } remoteTail = last; if(blockchain.getHead() == null){ blockchain.setHead(lastHead); blockchain.setLength(blockchain.getLength() + 1); localTail = last; }else{ last.setPreviousBlock(blockchain.getHead()); last.setPreviousHash(blockchain.getHead().calculateHash()); localTail = last; blockchain.setHead(lastHead); blockchain.setLength(blockchain.getLength() + 1); } while(!hashComapre(localTail.getPreviousHash(), remoteTail.getPreviousHash())){ System.out.println("what!!"); Socket newSocket = new Socket(); newSocket.connect(new InetSocketAddress(ip.getHost(), ip.getPort())); printWriter = new PrintWriter(newSocket.getOutputStream(), true); printWriter.println("cu|" + Base64.getEncoder().encodeToString(remoteTail.getPreviousHash())); printWriter.flush(); oos = new ObjectOutputStream(newSocket.getOutputStream()); ois = new ObjectInputStream(newSocket.getInputStream()); Block temp = (Block) ois.readObject(); ois.close(); printWriter.close(); newSocket.close(); remoteTail = temp; blockchain.getPool().addAll(localTail.getPreviousBlock().getTransactions()); for(Transaction t: temp.getTransactions()){ blockchain.getPool().remove(t); } Block sub = new Block(); sub.setTransactions(temp.getTransactions()); sub.setPreviousBlock(localTail.getPreviousBlock().getPreviousBlock()); sub.setPreviousHash(localTail.getPreviousBlock().getPreviousHash()); localTail.setPreviousBlock(sub); localTail.setPreviousHash(sub.calculateHash()); localTail = sub; } } catch(ClassNotFoundException e){ } printWriter.close(); toServer.close(); ois.close(); } else{ try{ System.out.println("incoherent!"); toServer.connect(new InetSocketAddress(ip.getHost(), ip.getPort())); PrintWriter printWriter = new PrintWriter(toServer.getOutputStream(), true); printWriter.println("cu"); printWriter.flush(); ObjectOutputStream oos = new ObjectOutputStream(toServer.getOutputStream()); ObjectInputStream ois = new ObjectInputStream(toServer.getInputStream()); Block remoteTail = (Block) ois.readObject(); ois.close(); printWriter.close(); toServer.close(); Block localTail = blockchain.getHead(); blockchain.getPool().addAll(localTail.getTransactions()); for(Transaction t: remoteTail.getTransactions()){ blockchain.getPool().remove(t); } Block stt = new Block(); stt.getTransactions().addAll(remoteTail.getTransactions()); stt.setPreviousBlock(localTail.getPreviousBlock()); stt.setPreviousHash(localTail.getPreviousHash()); blockchain.setHead(stt); localTail = stt; while(!hashComapre(localTail.getPreviousHash(), remoteTail.getPreviousHash())){ System.out.println("Still wrong!"); Socket newSocket = new Socket(); newSocket.connect(new InetSocketAddress(ip.getHost(), ip.getPort())); printWriter = new PrintWriter(newSocket.getOutputStream(), true); printWriter.println("cu|" + Base64.getEncoder().encodeToString(remoteTail.getPreviousHash())); printWriter.flush(); oos = new ObjectOutputStream(newSocket.getOutputStream()); ois = new ObjectInputStream(newSocket.getInputStream()); Block temp = (Block) ois.readObject(); ois.close(); printWriter.close(); newSocket.close(); remoteTail = temp; if(localTail.getPreviousBlock() != null){ blockchain.getPool().addAll(localTail.getPreviousBlock().getTransactions()); } for(Transaction t: temp.getTransactions()){ blockchain.getPool().remove(t); } Block sub = new Block(); sub.setTransactions(temp.getTransactions()); if(localTail.getPreviousBlock().getPreviousBlock() != null){ sub.setPreviousBlock(localTail.getPreviousBlock().getPreviousBlock()); sub.setPreviousHash(localTail.getPreviousBlock().getPreviousHash()); } localTail.setPreviousBlock(sub); localTail.setPreviousHash(sub.calculateHash()); localTail = sub; } } catch(ClassNotFoundException e){ } } } } catch (IOException e) { } } private boolean hashComapre(byte[] b1, byte[] b2){ for(int i = 0; i < b1.length; i++){ if(b1[i] != b2[i]){ return false; } } return true; } }
UTF-8
Java
11,717
java
CatchUpRRunnable.java
Java
[]
null
[]
import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.PrintWriter; import java.net.InetSocketAddress; import java.net.Socket; import java.net.SocketTimeoutException; import java.util.ArrayList; import java.util.Base64; public class CatchUpRRunnable implements Runnable { private ServerInfo ip; private Blockchain blockchain; int gap; public CatchUpRRunnable(ServerInfo ip, Blockchain blockchain, int gap) { this.ip = ip; this.blockchain = blockchain; this.gap = gap; } @Override public void run() { try { Socket toServer = new Socket(); if(gap < 0){ System.out.println("init!"); toServer.connect(new InetSocketAddress(ip.getHost(), ip.getPort())); PrintWriter printWriter = new PrintWriter(toServer.getOutputStream(), true); printWriter.println("cu"); printWriter.flush(); ObjectOutputStream oos = new ObjectOutputStream(toServer.getOutputStream()); ObjectInputStream ois = new ObjectInputStream(toServer.getInputStream()); try { Block last = (Block) ois.readObject(); if(last != null){ blockchain.setHead(last); blockchain.setLength(blockchain.getLength() + 1); ois.close(); printWriter.close(); toServer.close(); while(!Base64.getEncoder().encodeToString(last.getPreviousHash()).equals("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=")){ Socket newSocket = new Socket(); newSocket.connect(new InetSocketAddress(ip.getHost(), ip.getPort())); printWriter = new PrintWriter(newSocket.getOutputStream(), true); printWriter.println("cu|" + Base64.getEncoder().encodeToString(last.getPreviousHash())); printWriter.flush(); oos = new ObjectOutputStream(newSocket.getOutputStream()); ois = new ObjectInputStream(newSocket.getInputStream()); Block temp = (Block) ois.readObject(); last.setPreviousBlock(temp); blockchain.setLength(blockchain.getLength() + 1); last = temp; ois.close(); printWriter.close(); newSocket.close(); } } } catch(ClassNotFoundException e){ } printWriter.close(); toServer.close(); ois.close(); } else{ if(gap > 0){ System.out.println("need to catch up"); Block localTail = null; Block remoteTail = null; toServer.connect(new InetSocketAddress(ip.getHost(), ip.getPort())); PrintWriter printWriter = new PrintWriter(toServer.getOutputStream(), true); printWriter.println("cu"); printWriter.flush(); ObjectOutputStream oos = new ObjectOutputStream(toServer.getOutputStream()); ObjectInputStream ois = new ObjectInputStream(toServer.getInputStream()); try{ Block last = (Block) ois.readObject(); Block lastHead = last; ois.close(); printWriter.close(); toServer.close(); for(int i = 0; i < gap - 1; i ++){ System.out.println("add more!"); Socket newSocket = new Socket(); newSocket.connect(new InetSocketAddress(ip.getHost(), ip.getPort())); printWriter = new PrintWriter(newSocket.getOutputStream(), true); printWriter.println("cu|" + Base64.getEncoder().encodeToString(last.getPreviousHash())); printWriter.flush(); oos = new ObjectOutputStream(newSocket.getOutputStream()); ois = new ObjectInputStream(newSocket.getInputStream()); Block temp = (Block) ois.readObject(); last.setPreviousBlock(temp); last.setPreviousHash(temp.calculateHash()); blockchain.setLength(blockchain.getLength() + 1); last = temp; ois.close(); printWriter.close(); newSocket.close(); } remoteTail = last; if(blockchain.getHead() == null){ blockchain.setHead(lastHead); blockchain.setLength(blockchain.getLength() + 1); localTail = last; }else{ last.setPreviousBlock(blockchain.getHead()); last.setPreviousHash(blockchain.getHead().calculateHash()); localTail = last; blockchain.setHead(lastHead); blockchain.setLength(blockchain.getLength() + 1); } while(!hashComapre(localTail.getPreviousHash(), remoteTail.getPreviousHash())){ System.out.println("what!!"); Socket newSocket = new Socket(); newSocket.connect(new InetSocketAddress(ip.getHost(), ip.getPort())); printWriter = new PrintWriter(newSocket.getOutputStream(), true); printWriter.println("cu|" + Base64.getEncoder().encodeToString(remoteTail.getPreviousHash())); printWriter.flush(); oos = new ObjectOutputStream(newSocket.getOutputStream()); ois = new ObjectInputStream(newSocket.getInputStream()); Block temp = (Block) ois.readObject(); ois.close(); printWriter.close(); newSocket.close(); remoteTail = temp; blockchain.getPool().addAll(localTail.getPreviousBlock().getTransactions()); for(Transaction t: temp.getTransactions()){ blockchain.getPool().remove(t); } Block sub = new Block(); sub.setTransactions(temp.getTransactions()); sub.setPreviousBlock(localTail.getPreviousBlock().getPreviousBlock()); sub.setPreviousHash(localTail.getPreviousBlock().getPreviousHash()); localTail.setPreviousBlock(sub); localTail.setPreviousHash(sub.calculateHash()); localTail = sub; } } catch(ClassNotFoundException e){ } printWriter.close(); toServer.close(); ois.close(); } else{ try{ System.out.println("incoherent!"); toServer.connect(new InetSocketAddress(ip.getHost(), ip.getPort())); PrintWriter printWriter = new PrintWriter(toServer.getOutputStream(), true); printWriter.println("cu"); printWriter.flush(); ObjectOutputStream oos = new ObjectOutputStream(toServer.getOutputStream()); ObjectInputStream ois = new ObjectInputStream(toServer.getInputStream()); Block remoteTail = (Block) ois.readObject(); ois.close(); printWriter.close(); toServer.close(); Block localTail = blockchain.getHead(); blockchain.getPool().addAll(localTail.getTransactions()); for(Transaction t: remoteTail.getTransactions()){ blockchain.getPool().remove(t); } Block stt = new Block(); stt.getTransactions().addAll(remoteTail.getTransactions()); stt.setPreviousBlock(localTail.getPreviousBlock()); stt.setPreviousHash(localTail.getPreviousHash()); blockchain.setHead(stt); localTail = stt; while(!hashComapre(localTail.getPreviousHash(), remoteTail.getPreviousHash())){ System.out.println("Still wrong!"); Socket newSocket = new Socket(); newSocket.connect(new InetSocketAddress(ip.getHost(), ip.getPort())); printWriter = new PrintWriter(newSocket.getOutputStream(), true); printWriter.println("cu|" + Base64.getEncoder().encodeToString(remoteTail.getPreviousHash())); printWriter.flush(); oos = new ObjectOutputStream(newSocket.getOutputStream()); ois = new ObjectInputStream(newSocket.getInputStream()); Block temp = (Block) ois.readObject(); ois.close(); printWriter.close(); newSocket.close(); remoteTail = temp; if(localTail.getPreviousBlock() != null){ blockchain.getPool().addAll(localTail.getPreviousBlock().getTransactions()); } for(Transaction t: temp.getTransactions()){ blockchain.getPool().remove(t); } Block sub = new Block(); sub.setTransactions(temp.getTransactions()); if(localTail.getPreviousBlock().getPreviousBlock() != null){ sub.setPreviousBlock(localTail.getPreviousBlock().getPreviousBlock()); sub.setPreviousHash(localTail.getPreviousBlock().getPreviousHash()); } localTail.setPreviousBlock(sub); localTail.setPreviousHash(sub.calculateHash()); localTail = sub; } } catch(ClassNotFoundException e){ } } } } catch (IOException e) { } } private boolean hashComapre(byte[] b1, byte[] b2){ for(int i = 0; i < b1.length; i++){ if(b1[i] != b2[i]){ return false; } } return true; } }
11,717
0.46616
0.463856
275
41.607273
33.32777
146
false
false
0
0
0
0
0
0
0.658182
false
false
10
dbc1f32aa4515d57cc5118543cfc76a311e6e0e8
14,869,176,821,339
26a12fd1dd5d082fbc8d3adf2e04024cfafb85b1
/app/src/main/java/com/example/dm2/actividades17_intents/Actividad5.java
32830983f6c0a8d8bfa2f2446ff2576ea492cc39
[]
no_license
DavidManteiga/Actividades17_intents
https://github.com/DavidManteiga/Actividades17_intents
992af3f66000cd32ca6830cd71b210f2e217cef1
682724548164187478f8b5d8bb6ebe01b72c0975
refs/heads/master
2021-01-10T18:04:40.083000
2015-10-08T07:07:33
2015-10-08T07:07:33
43,868,994
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.dm2.actividades17_intents; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.provider.MediaStore; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.WindowManager; import android.widget.Button; public class Actividad5 extends AppCompatActivity implements Button.OnClickListener{ private Button seleccionar; private Button generar; private static final int SELECT_PICTURE = 1; private String selectedImagePath; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_actividad5); seleccionar=(Button)findViewById(R.id.seleccionar); seleccionar.setOnClickListener(this); generar=(Button)findViewById(R.id.generar); generar.setOnClickListener(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_actividad5, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @Override public void onClick(View v) { if (v.getId()==findViewById(R.id.seleccionar).getId()) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select Picture"), SELECT_PICTURE); } if (v.getId()==findViewById(R.id.generar).getId()) { } } public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (requestCode == SELECT_PICTURE) { Uri selectedImageUri = data.getData(); selectedImagePath = getPath(selectedImageUri); } } } public String getPath(Uri uri) { // just some safety built in if( uri == null ) { // TODO perform some logging or show user feedback return null; } // try to retrieve the image from the media store first // this will only work for images selected from gallery String[] projection = { MediaStore.Images.Media.DATA }; Cursor cursor = managedQuery(uri, projection, null, null, null); if( cursor != null ){ int column_index = cursor .getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); return cursor.getString(column_index); } // this is our fallback here return uri.getPath(); } }
UTF-8
Java
3,320
java
Actividad5.java
Java
[]
null
[]
package com.example.dm2.actividades17_intents; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.provider.MediaStore; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.WindowManager; import android.widget.Button; public class Actividad5 extends AppCompatActivity implements Button.OnClickListener{ private Button seleccionar; private Button generar; private static final int SELECT_PICTURE = 1; private String selectedImagePath; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_actividad5); seleccionar=(Button)findViewById(R.id.seleccionar); seleccionar.setOnClickListener(this); generar=(Button)findViewById(R.id.generar); generar.setOnClickListener(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_actividad5, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @Override public void onClick(View v) { if (v.getId()==findViewById(R.id.seleccionar).getId()) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select Picture"), SELECT_PICTURE); } if (v.getId()==findViewById(R.id.generar).getId()) { } } public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (requestCode == SELECT_PICTURE) { Uri selectedImageUri = data.getData(); selectedImagePath = getPath(selectedImageUri); } } } public String getPath(Uri uri) { // just some safety built in if( uri == null ) { // TODO perform some logging or show user feedback return null; } // try to retrieve the image from the media store first // this will only work for images selected from gallery String[] projection = { MediaStore.Images.Media.DATA }; Cursor cursor = managedQuery(uri, projection, null, null, null); if( cursor != null ){ int column_index = cursor .getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); return cursor.getString(column_index); } // this is our fallback here return uri.getPath(); } }
3,320
0.64006
0.637651
105
30.619047
24.041386
84
false
false
0
0
0
0
0
0
0.485714
false
false
10
7c2b710d1bf0977988238cb75720b06d062a6b89
36,850,819,411,890
999af8ab47da2768b5d718f9dfbeaa9b99f95d16
/placepostbeta/app/src/main/java/com/placepost/placepostbeta/SettingsPageFragment.java
1f24e1543e4dcb16896fdd81c1c85cf9f9f88b82
[]
no_license
placepost/android_client
https://github.com/placepost/android_client
a8c7e9398edf6baadb4db43471a6ad63bf770a4b
21fef236be0ab9ad446fe50441982b49d8d19aed
refs/heads/master
2020-04-15T02:12:34.974000
2015-03-08T02:36:25
2015-03-08T02:36:25
31,832,317
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.placepost.placepostbeta; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class SettingsPageFragment extends Fragment { private SessionManager mSessionManager; @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.settings_fragment, container, false); mSessionManager = new SessionManager(getActivity().getApplicationContext()); TextView userInfo = (TextView) rootView.findViewById(R.id.user_info); TextView userToken = (TextView) rootView.findViewById(R.id.user_token); if (mSessionManager.isLoggedIn()) { String usernameString = mSessionManager.getLoggedInUsername(); String userTokenString = mSessionManager.getSessionToken(); userInfo.setText("User logged in -- " + usernameString); userToken.setText("Token: " + userTokenString); } else { userInfo.setText("User not logged in"); } View logoutLink = rootView.findViewById(R.id.logout_link); logoutLink.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText( getActivity().getApplicationContext(), "logging out user", Toast.LENGTH_SHORT).show(); /* */ // ProgressDialog progress = new ProgressDialog(getActivity()); //progress.setTitle("Loading"); // progress.setMessage("Logging out..."); // progress.show(); // log out user mSessionManager.logout(); /* try { Thread.sleep(3000); } catch (InterruptedException e) { } /* */ // To dismiss the dialog //progress.dismiss(); // if successful load activity for main app home Intent intent = new Intent(getActivity(), LandingPageActivity.class); startActivity(intent); } }); return rootView; } @Override public void onResume() { super.onResume(); } }
UTF-8
Java
2,611
java
SettingsPageFragment.java
Java
[]
null
[]
package com.placepost.placepostbeta; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class SettingsPageFragment extends Fragment { private SessionManager mSessionManager; @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.settings_fragment, container, false); mSessionManager = new SessionManager(getActivity().getApplicationContext()); TextView userInfo = (TextView) rootView.findViewById(R.id.user_info); TextView userToken = (TextView) rootView.findViewById(R.id.user_token); if (mSessionManager.isLoggedIn()) { String usernameString = mSessionManager.getLoggedInUsername(); String userTokenString = mSessionManager.getSessionToken(); userInfo.setText("User logged in -- " + usernameString); userToken.setText("Token: " + userTokenString); } else { userInfo.setText("User not logged in"); } View logoutLink = rootView.findViewById(R.id.logout_link); logoutLink.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText( getActivity().getApplicationContext(), "logging out user", Toast.LENGTH_SHORT).show(); /* */ // ProgressDialog progress = new ProgressDialog(getActivity()); //progress.setTitle("Loading"); // progress.setMessage("Logging out..."); // progress.show(); // log out user mSessionManager.logout(); /* try { Thread.sleep(3000); } catch (InterruptedException e) { } /* */ // To dismiss the dialog //progress.dismiss(); // if successful load activity for main app home Intent intent = new Intent(getActivity(), LandingPageActivity.class); startActivity(intent); } }); return rootView; } @Override public void onResume() { super.onResume(); } }
2,611
0.598238
0.59594
78
32.474358
24.903261
87
false
false
0
0
0
0
0
0
0.538462
false
false
10
62de64b259ee7794b880e0291d9472a2b7a662a8
2,740,189,193,482
769c57f639c6f7140788b48c2bf52dd2de2bd5e9
/src/base/No125.java
6ad57587af5c84637a9a76150c6e131fc7c22d8a
[]
no_license
GKCY/leetcode-2020
https://github.com/GKCY/leetcode-2020
466b9504de0d8291f270f0ddcc260f0de759f4a2
f6b97cf55c91b000464153cd3f09d1271d8e6c69
refs/heads/master
2021-05-26T10:18:44.732000
2020-09-30T05:10:42
2020-09-30T05:10:42
254,092,836
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package base; import java.util.ArrayList; public class No125 { public boolean isPalindrome(String s) { ArrayList<Character> list = new ArrayList<>(); for (char ch : s.toCharArray()) { if (ch >= 'a' && ch <= 'z') list.add(ch); else if (ch >= 'A' && ch <= 'Z') { int offset = ch - 'A'; list.add((char) ('a' + offset)); } else if (ch >= '0' && ch <= '9') list.add(ch); } if (list.size() == 0) return true; int i = 0, j = list.size(); while (i < j) { if (list.get(i) != list.get(j)) return false; i++; j--; } return true; } }
UTF-8
Java
777
java
No125.java
Java
[]
null
[]
package base; import java.util.ArrayList; public class No125 { public boolean isPalindrome(String s) { ArrayList<Character> list = new ArrayList<>(); for (char ch : s.toCharArray()) { if (ch >= 'a' && ch <= 'z') list.add(ch); else if (ch >= 'A' && ch <= 'Z') { int offset = ch - 'A'; list.add((char) ('a' + offset)); } else if (ch >= '0' && ch <= '9') list.add(ch); } if (list.size() == 0) return true; int i = 0, j = list.size(); while (i < j) { if (list.get(i) != list.get(j)) return false; i++; j--; } return true; } }
777
0.3861
0.377091
30
24.9
15.542093
54
false
false
0
0
0
0
0
0
0.466667
false
false
10
cf95babc195fac9048df6bebd89d3b0f5a5bfad2
35,751,307,804,203
10ee24bc52f1a8cc1d631e02acaf43e548cbca5d
/src/test/java/Operation/UIOperation.java
73db60b57258b69d5a4fba89c372fa46973138b1
[]
no_license
rupeshrrk/WordPress
https://github.com/rupeshrrk/WordPress
bfd0694f836275e40e76ec59c9600feec20b6810
73c7f94e4465a9799ae1cad26a710e9a148485fa
refs/heads/master
2023-06-10T16:11:38.665000
2021-06-21T10:20:10
2021-06-21T10:20:10
378,890,257
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Operation; import java.awt.Robot; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; import java.awt.event.KeyEvent; import java.util.List; import java.util.Properties; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.Keys; 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.Select; import org.openqa.selenium.support.ui.WebDriverWait; public class UIOperation { WebDriver driver; public UIOperation(WebDriver driver){ this.driver = driver; } public WebElement getElement(By locator) { return driver.findElement(locator); } public void selectDropdownValueBy(By locator, String type, String value) { Select select = new Select(getElement(locator)); switch(type){ case "index": select.selectByIndex(Integer.parseInt(value)); break; case "value": select.selectByValue(value); break; case "visibletext": select.selectByVisibleText(value); break; default: System.out.print("Please pass the correct selection criteria"); break; } } public void scrollValue(Properties p, String objectname, String objectType, String value) throws NumberFormatException, Exception { Actions action= new Actions(driver); Thread.sleep(3000); action.dragAndDropBy(driver.findElement(this.getObject(p, objectname, objectType)),Integer.parseInt(value), 0).build().perform(); Thread.sleep(3000); } public void perform(Properties p,String operation,String objectName,String objectType,String value) throws Exception{ System.out.println(""); switch (operation.toUpperCase()) { case "CLICK": //Perform click driver.findElement(this.getObject(p,objectName,objectType)).click(); Thread.sleep(3000); break; case "ENTER_TEXT": //Set text on control driver.findElement(this.getObject(p,objectName,objectType)).sendKeys(p.getProperty(value)); Thread.sleep(3000); break; case "CLEAR_TEXT": driver.findElement(this.getObject(p, objectName, objectType)).clear(); Thread.sleep(3000); break; case "MAXIMISE": driver.manage().window().maximize(); Thread.sleep(3000); break; case "GOTOURL": //Get url of application driver.get(p.getProperty(value)); Thread.sleep(3000); break; case "ACTION_COMMAND": Actions action1 = new Actions(driver); Thread.sleep(1000); action1.moveToElement(driver.findElement(this.getObject(p, objectName, objectType))).build().perform(); Thread.sleep(3000); break; case "ACTION_CLICK": Actions action2 = new Actions(driver); action2.moveToElement(driver.findElement(this.getObject(p, objectName, objectType))).click().build() .perform(); Thread.sleep(3000); break; case "JEXECUTESCRIPT_SCROLL_TO_VIEW": JavascriptExecutor jsc = (JavascriptExecutor) driver; jsc.executeScript("arguments[0].scrollIntoView();", driver.findElement(this.getObject(p, objectName, objectType))); break; case "IMPLICIT_WAIT": // Perform click driver.manage().timeouts().implicitlyWait(Integer.parseInt(p.getProperty(value)), TimeUnit.SECONDS); break; case "EXPLICIT_WAIT": WebDriverWait wait = new WebDriverWait(driver, 10); WebElement element = wait .until(ExpectedConditions.visibilityOfElementLocated(this.getObject(p, objectName, objectType))); break; case "SELECT_DROPDOWN_TEXT": this.selectDropdownValueBy(this.getObject(p, objectName, objectType),"visibletext", p.getProperty(value)); break; case "SELECT_DROPDOWN_VALUE": this.selectDropdownValueBy(this.getObject(p, objectName, objectType),"value", p.getProperty(value)); break; case "REFRESH": driver.navigate().refresh(); Thread.sleep(3000); break; case "NAVIGATE_BACK": driver.navigate().back(); Thread.sleep(3000); break; case "GETTEXT": // Get text of an element driver.findElement(this.getObject(p, objectName, objectType)).getText(); Thread.sleep(3000); break; case "SELECT_DROPDOWN_INDEX": this.selectDropdownValueBy(this.getObject(p, objectName, objectType),"index", p.getProperty(value)); break; case "MULTI_SELECT_DROPDOWN": Select dropdown= new Select(driver.findElement(this.getObject(p, objectName, objectType))); List<WebElement> options = dropdown.getOptions(); break; case "GETFIRSTSELECTED_DROPDOWN": new Select(driver.findElement(this.getObject(p, objectName, objectType))).getFirstSelectedOption(); break; case "JEXECUTESCRIPT_CLICK": JavascriptExecutor js = (JavascriptExecutor)driver; js.executeScript(p.getProperty("scriptpart1"), driver.findElement(this.getObject(p, objectName, objectType))); Thread.sleep(3000); break; case "JEXECUTESCRIPT_TEXT": JavascriptExecutor jse = (JavascriptExecutor)driver; jse.executeScript("arguments[0].value='"+ p.getProperty(value) +"';", driver.findElement(this.getObject(p, objectName, objectType))); break; case "ACTION_TEXT": Actions action3=new Actions(driver); action3 .moveToElement(driver.findElement(this.getObject(p, objectName, objectType))) .click() .sendKeys(p.getProperty(value)) .build() .perform(); Thread.sleep(3000); break; case "SCROLL_VALUE": this.scrollValue(p, objectName, objectType, p.getProperty("scrollByValue")); break; case "SWITCH_TO_IFRAME": driver.switchTo().frame(p.getProperty("iframeval")); Thread.sleep(3000); break; case "PRESS_ENTER": driver.findElement(this.getObject(p, objectName, objectType)).sendKeys(Keys.ENTER); Thread.sleep(2000); break; case "ROBOT_KEYS": Robot r = new Robot(); r.keyPress(KeyEvent.VK_ENTER); r.keyRelease(KeyEvent.VK_ENTER); Thread.sleep(3000); break; case "ROBOT_KEY_ESC": Robot r1 = new Robot(); // r1.keyPress(Integer.parseInt(p.getProperty(value))); // r1.keyRelease(Integer.parseInt(p.getProperty(value))); r1.keyPress(KeyEvent.VK_ESCAPE); r1.keyRelease(KeyEvent.VK_ESCAPE); Thread.sleep(3000); break; case "ROBOT_KEYS_TAB": Robot r2 = new Robot(); r2.keyPress(KeyEvent.VK_TAB); r2.keyRelease(KeyEvent.VK_TAB); Thread.sleep(3000); break; case "COPY_AND_PASTE_TEXT": //String text = "Hello World"; StringSelection stringSelection = new StringSelection(p.getProperty(value)); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(stringSelection, stringSelection); Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_CONTROL); robot.keyPress(KeyEvent.VK_V); robot.keyRelease(KeyEvent.VK_V); robot.keyRelease(KeyEvent.VK_CONTROL); break; case "FILE_UPLOAD": Runtime.getRuntime().exec(p.getProperty(value)); Thread.sleep(3000); break; default: break; } } // private By getObject(Properties p,String objectName,String objectType) throws Exception{ //Find by xpath if(objectType.equalsIgnoreCase("XPATH")){ return By.xpath(p.getProperty(objectName)); } //find by class else if(objectType.equalsIgnoreCase("CLASSNAME")){ return By.className(p.getProperty(objectName)); } //find by name else if(objectType.equalsIgnoreCase("NAME")){ return By.name(p.getProperty(objectName)); } //Find by css else if(objectType.equalsIgnoreCase("CSS")){ return By.cssSelector(p.getProperty(objectName)); } //find by link else if(objectType.equalsIgnoreCase("LINK")){ return By.linkText(p.getProperty(objectName)); } //find by partial link else if(objectType.equalsIgnoreCase("PARTIALLINK")){ return By.partialLinkText(p.getProperty(objectName)); } else if(objectType.equalsIgnoreCase("ID")){ return By.id(p.getProperty(objectName)); } else if(objectType.equalsIgnoreCase("TAGNAME")){ return By.tagName(p.getProperty(objectName)); } else { throw new Exception("Wrong object type"); } } }
UTF-8
Java
9,785
java
UIOperation.java
Java
[ { "context": "\"COPY_AND_PASTE_TEXT\":\r\n \t//String text = \"Hello World\";\r\n \tStringSelection stringSelection", "end": 7512, "score": 0.5585411787033081, "start": 7507, "tag": "NAME", "value": "Hello" } ]
null
[]
package Operation; import java.awt.Robot; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; import java.awt.event.KeyEvent; import java.util.List; import java.util.Properties; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.Keys; 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.Select; import org.openqa.selenium.support.ui.WebDriverWait; public class UIOperation { WebDriver driver; public UIOperation(WebDriver driver){ this.driver = driver; } public WebElement getElement(By locator) { return driver.findElement(locator); } public void selectDropdownValueBy(By locator, String type, String value) { Select select = new Select(getElement(locator)); switch(type){ case "index": select.selectByIndex(Integer.parseInt(value)); break; case "value": select.selectByValue(value); break; case "visibletext": select.selectByVisibleText(value); break; default: System.out.print("Please pass the correct selection criteria"); break; } } public void scrollValue(Properties p, String objectname, String objectType, String value) throws NumberFormatException, Exception { Actions action= new Actions(driver); Thread.sleep(3000); action.dragAndDropBy(driver.findElement(this.getObject(p, objectname, objectType)),Integer.parseInt(value), 0).build().perform(); Thread.sleep(3000); } public void perform(Properties p,String operation,String objectName,String objectType,String value) throws Exception{ System.out.println(""); switch (operation.toUpperCase()) { case "CLICK": //Perform click driver.findElement(this.getObject(p,objectName,objectType)).click(); Thread.sleep(3000); break; case "ENTER_TEXT": //Set text on control driver.findElement(this.getObject(p,objectName,objectType)).sendKeys(p.getProperty(value)); Thread.sleep(3000); break; case "CLEAR_TEXT": driver.findElement(this.getObject(p, objectName, objectType)).clear(); Thread.sleep(3000); break; case "MAXIMISE": driver.manage().window().maximize(); Thread.sleep(3000); break; case "GOTOURL": //Get url of application driver.get(p.getProperty(value)); Thread.sleep(3000); break; case "ACTION_COMMAND": Actions action1 = new Actions(driver); Thread.sleep(1000); action1.moveToElement(driver.findElement(this.getObject(p, objectName, objectType))).build().perform(); Thread.sleep(3000); break; case "ACTION_CLICK": Actions action2 = new Actions(driver); action2.moveToElement(driver.findElement(this.getObject(p, objectName, objectType))).click().build() .perform(); Thread.sleep(3000); break; case "JEXECUTESCRIPT_SCROLL_TO_VIEW": JavascriptExecutor jsc = (JavascriptExecutor) driver; jsc.executeScript("arguments[0].scrollIntoView();", driver.findElement(this.getObject(p, objectName, objectType))); break; case "IMPLICIT_WAIT": // Perform click driver.manage().timeouts().implicitlyWait(Integer.parseInt(p.getProperty(value)), TimeUnit.SECONDS); break; case "EXPLICIT_WAIT": WebDriverWait wait = new WebDriverWait(driver, 10); WebElement element = wait .until(ExpectedConditions.visibilityOfElementLocated(this.getObject(p, objectName, objectType))); break; case "SELECT_DROPDOWN_TEXT": this.selectDropdownValueBy(this.getObject(p, objectName, objectType),"visibletext", p.getProperty(value)); break; case "SELECT_DROPDOWN_VALUE": this.selectDropdownValueBy(this.getObject(p, objectName, objectType),"value", p.getProperty(value)); break; case "REFRESH": driver.navigate().refresh(); Thread.sleep(3000); break; case "NAVIGATE_BACK": driver.navigate().back(); Thread.sleep(3000); break; case "GETTEXT": // Get text of an element driver.findElement(this.getObject(p, objectName, objectType)).getText(); Thread.sleep(3000); break; case "SELECT_DROPDOWN_INDEX": this.selectDropdownValueBy(this.getObject(p, objectName, objectType),"index", p.getProperty(value)); break; case "MULTI_SELECT_DROPDOWN": Select dropdown= new Select(driver.findElement(this.getObject(p, objectName, objectType))); List<WebElement> options = dropdown.getOptions(); break; case "GETFIRSTSELECTED_DROPDOWN": new Select(driver.findElement(this.getObject(p, objectName, objectType))).getFirstSelectedOption(); break; case "JEXECUTESCRIPT_CLICK": JavascriptExecutor js = (JavascriptExecutor)driver; js.executeScript(p.getProperty("scriptpart1"), driver.findElement(this.getObject(p, objectName, objectType))); Thread.sleep(3000); break; case "JEXECUTESCRIPT_TEXT": JavascriptExecutor jse = (JavascriptExecutor)driver; jse.executeScript("arguments[0].value='"+ p.getProperty(value) +"';", driver.findElement(this.getObject(p, objectName, objectType))); break; case "ACTION_TEXT": Actions action3=new Actions(driver); action3 .moveToElement(driver.findElement(this.getObject(p, objectName, objectType))) .click() .sendKeys(p.getProperty(value)) .build() .perform(); Thread.sleep(3000); break; case "SCROLL_VALUE": this.scrollValue(p, objectName, objectType, p.getProperty("scrollByValue")); break; case "SWITCH_TO_IFRAME": driver.switchTo().frame(p.getProperty("iframeval")); Thread.sleep(3000); break; case "PRESS_ENTER": driver.findElement(this.getObject(p, objectName, objectType)).sendKeys(Keys.ENTER); Thread.sleep(2000); break; case "ROBOT_KEYS": Robot r = new Robot(); r.keyPress(KeyEvent.VK_ENTER); r.keyRelease(KeyEvent.VK_ENTER); Thread.sleep(3000); break; case "ROBOT_KEY_ESC": Robot r1 = new Robot(); // r1.keyPress(Integer.parseInt(p.getProperty(value))); // r1.keyRelease(Integer.parseInt(p.getProperty(value))); r1.keyPress(KeyEvent.VK_ESCAPE); r1.keyRelease(KeyEvent.VK_ESCAPE); Thread.sleep(3000); break; case "ROBOT_KEYS_TAB": Robot r2 = new Robot(); r2.keyPress(KeyEvent.VK_TAB); r2.keyRelease(KeyEvent.VK_TAB); Thread.sleep(3000); break; case "COPY_AND_PASTE_TEXT": //String text = "Hello World"; StringSelection stringSelection = new StringSelection(p.getProperty(value)); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(stringSelection, stringSelection); Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_CONTROL); robot.keyPress(KeyEvent.VK_V); robot.keyRelease(KeyEvent.VK_V); robot.keyRelease(KeyEvent.VK_CONTROL); break; case "FILE_UPLOAD": Runtime.getRuntime().exec(p.getProperty(value)); Thread.sleep(3000); break; default: break; } } // private By getObject(Properties p,String objectName,String objectType) throws Exception{ //Find by xpath if(objectType.equalsIgnoreCase("XPATH")){ return By.xpath(p.getProperty(objectName)); } //find by class else if(objectType.equalsIgnoreCase("CLASSNAME")){ return By.className(p.getProperty(objectName)); } //find by name else if(objectType.equalsIgnoreCase("NAME")){ return By.name(p.getProperty(objectName)); } //Find by css else if(objectType.equalsIgnoreCase("CSS")){ return By.cssSelector(p.getProperty(objectName)); } //find by link else if(objectType.equalsIgnoreCase("LINK")){ return By.linkText(p.getProperty(objectName)); } //find by partial link else if(objectType.equalsIgnoreCase("PARTIALLINK")){ return By.partialLinkText(p.getProperty(objectName)); } else if(objectType.equalsIgnoreCase("ID")){ return By.id(p.getProperty(objectName)); } else if(objectType.equalsIgnoreCase("TAGNAME")){ return By.tagName(p.getProperty(objectName)); } else { throw new Exception("Wrong object type"); } } }
9,785
0.596627
0.585999
306
29.98366
27.560564
142
false
false
0
0
0
0
0
0
1.830065
false
false
10
9e510307000985a1dc53428a77d5cca9ad988d12
36,790,689,874,797
7daab3e55caca95a6654d50ad26c816bd5a50738
/query_project/src/main/java/com/star/config/UserDetailsevImp.java
0493ffc04cdc49341224fb6f2fb2c18733ee25ba
[]
no_license
tanuj1811/Query-Hub
https://github.com/tanuj1811/Query-Hub
fd3c76f888cb077ac0aba2541a71e45a68495807
605f2e040e23bc10c96c6bd0871534335c2ea568
refs/heads/master
2023-08-16T23:44:01.749000
2021-09-16T02:03:50
2021-09-16T02:03:50
406,983,756
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.star.config; import com.star.dao.UserRespostory; import com.star.entity.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; public class UserDetailsevImp implements UserDetailsService { @Autowired private UserRespostory userRespostory; @Override public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException { //fetching data from database User user = userRespostory.getUserFromUserEmail(email); if(user == null) throw new UsernameNotFoundException("Couldn't found User"); UserDetail userDetail = new UserDetail(user); return userDetail; } }
UTF-8
Java
906
java
UserDetailsevImp.java
Java
[]
null
[]
package com.star.config; import com.star.dao.UserRespostory; import com.star.entity.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; public class UserDetailsevImp implements UserDetailsService { @Autowired private UserRespostory userRespostory; @Override public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException { //fetching data from database User user = userRespostory.getUserFromUserEmail(email); if(user == null) throw new UsernameNotFoundException("Couldn't found User"); UserDetail userDetail = new UserDetail(user); return userDetail; } }
906
0.761589
0.761589
29
30.241379
28.79973
90
false
false
0
0
0
0
0
0
0.413793
false
false
10
709cf492720977a1e548ca5adbdce271aa530763
34,763,465,331,637
a076c5e6f9aa8b7875af0c9c03ea89bd464b016d
/src/class25_Interface/FirstInterface.java
11cc3a0fdb13f23481f3bf7c42b94e735fa1260e
[]
no_license
Guljemal1994/JavaBasics
https://github.com/Guljemal1994/JavaBasics
c0f91189ad7b4735774e3eb1c4d99e2764ee23f6
4439131cef289031e9140b8e219fa048b000656d
refs/heads/master
2021-04-04T02:51:06.751000
2020-05-17T23:21:07
2020-05-17T23:21:07
248,418,906
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package class25_Interface; public interface FirstInterface { //**Follow Steps Carefully. //Step1: Create Interface as FirstInterface and create undefined method as firstMethod (without parameter) //Step 2: Create another interface as SecondInterface in which create a method as secondMethod (Without Parameter) //Step 3: Inherit both interfaces to Main class. //Step 4: Execute both methods public void firstMethod(); public void secondMethod(); } class SecondInterface implements FirstInterface{ @Override public void firstMethod() { System.out.println("First Method implementing multiple Inheritance"); } @Override public void secondMethod() { System.out.println("Second Method implementing multiple Inheritance"); } }
UTF-8
Java
754
java
FirstInterface.java
Java
[]
null
[]
package class25_Interface; public interface FirstInterface { //**Follow Steps Carefully. //Step1: Create Interface as FirstInterface and create undefined method as firstMethod (without parameter) //Step 2: Create another interface as SecondInterface in which create a method as secondMethod (Without Parameter) //Step 3: Inherit both interfaces to Main class. //Step 4: Execute both methods public void firstMethod(); public void secondMethod(); } class SecondInterface implements FirstInterface{ @Override public void firstMethod() { System.out.println("First Method implementing multiple Inheritance"); } @Override public void secondMethod() { System.out.println("Second Method implementing multiple Inheritance"); } }
754
0.766578
0.758621
31
23.32258
30.69768
114
false
false
0
0
0
0
0
0
0.83871
false
false
10
52cb3d5a0335c9384f88e01b69d1f58b03e291da
20,873,541,116,080
3d05655d7cd9b63c045ceb73a676127b608e73b3
/workspace/network/src/network2/MyMachineName.java
f3294b61f3e4d87d24c8c3334d01381337d0e9d1
[]
no_license
saeed-ab1/Advanced-Java
https://github.com/saeed-ab1/Advanced-Java
29862acd7e7ebeac3775d5dd9309a10b8a830dc5
0a705fb360efffb82a97fd3fffbf2224697a67c1
refs/heads/master
2020-03-06T02:35:13.160000
2017-07-08T04:22:54
2017-07-08T04:22:54
59,528,041
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package network2; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.net.UnknownHostException; public class MyMachineName { public static void main (String arg[]){ InetAddress local = null; try { local = InetAddress.getLocalHost(); } catch (UnknownHostException e){ System.err.println ("Identity Crisis!"); System.exit(0); } String strAddress1 = local.getHostName(); System.out.println ("Local Host = " + strAddress1); byte[] b = local.getAddress(); String strAddress=""; for (int i = 0; i < b.length; i++){ strAddress += ((int)255 & b[i]); if (i != b.length-1) strAddress += "."; System.out.println(b[i]); } System.out.println ("Local = " + strAddress); // ServerSocket servSock = new ServerSocket (6000); // while (true) // { // Socket inSock = servSock.accept(); // handleConnection(inSock); // inSock.close(); // } } }
UTF-8
Java
1,253
java
MyMachineName.java
Java
[]
null
[]
package network2; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.net.UnknownHostException; public class MyMachineName { public static void main (String arg[]){ InetAddress local = null; try { local = InetAddress.getLocalHost(); } catch (UnknownHostException e){ System.err.println ("Identity Crisis!"); System.exit(0); } String strAddress1 = local.getHostName(); System.out.println ("Local Host = " + strAddress1); byte[] b = local.getAddress(); String strAddress=""; for (int i = 0; i < b.length; i++){ strAddress += ((int)255 & b[i]); if (i != b.length-1) strAddress += "."; System.out.println(b[i]); } System.out.println ("Local = " + strAddress); // ServerSocket servSock = new ServerSocket (6000); // while (true) // { // Socket inSock = servSock.accept(); // handleConnection(inSock); // inSock.close(); // } } }
1,253
0.482043
0.471668
46
25.23913
17.290592
59
false
false
0
0
0
0
0
0
0.652174
false
false
10
ba0c4581ac99f2b064a80948acb41740ca1a26f0
35,287,451,341,791
433c088b0c2cb947e2f4ead01ab3763656af8102
/src/main/java/org/psc/unsafe/UnsafeLab.java
6e15f083623fb33f970f9c300cd756d38406e010
[]
no_license
sykq/snippets2
https://github.com/sykq/snippets2
45932c1d4c72c7b02f909606ccf70b74942eb327
4427b1396a5385e30df4307d566eff5f8904a6d4
refs/heads/main
2022-06-25T12:04:16.468000
2022-05-27T11:46:32
2022-05-27T11:46:32
196,440,911
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.psc.unsafe; import sun.misc.Unsafe; import java.lang.reflect.Field; public class UnsafeLab { public static Unsafe getUnsafe() throws NoSuchFieldException, IllegalAccessException { Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe"); theUnsafe.setAccessible(true); return (Unsafe) theUnsafe.get(null); } }
UTF-8
Java
365
java
UnsafeLab.java
Java
[]
null
[]
package org.psc.unsafe; import sun.misc.Unsafe; import java.lang.reflect.Field; public class UnsafeLab { public static Unsafe getUnsafe() throws NoSuchFieldException, IllegalAccessException { Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe"); theUnsafe.setAccessible(true); return (Unsafe) theUnsafe.get(null); } }
365
0.720548
0.720548
16
21.8125
26.620525
90
false
false
0
0
0
0
0
0
0.4375
false
false
10
6189d27ba28fae9a158eb2dc860ec8228e8e38ce
38,757,784,885,771
a681c5a063e955f2ef5782adf63e6dbd71ca9bc2
/java-interview-practice/src/com/tesco/practice/StringJoinDemo.java
28ed1002a023eb9a1d11015fc6846c547e37dae5
[]
no_license
LavanyaBM/java-Interview-practice
https://github.com/LavanyaBM/java-Interview-practice
8035092f26186653aba92b7b633e1746df581208
5c480d2de0e830d032b1c52e00383cc11812bb8d
refs/heads/master
2020-04-14T21:55:42.256000
2019-12-22T18:20:48
2019-12-22T18:20:48
164,144,993
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tesco.practice; import java.util.*; import java.util.stream.Collectors; public class StringJoinDemo { public static void main(String[] args) { List<String> list = new ArrayList<>(Arrays.asList("Lav","Kav","Mav","Nan")); System.out.println(list); String str = String.join(", ", list); System.out.println(str); List<Integer> intList = new ArrayList<>(); intList.add(1); intList.add(2); intList.add(3); intList.add(3); intList.add(3); System.out.println(intList); List<Integer> newList = new ArrayList<>(); for(Integer element : intList) { if(!newList.contains(element)) { newList.add(element); } } System.out.println(newList); System.out.println("-------------------------------"); List<Integer> inList = new ArrayList<>(); inList.add(1); inList.add(2); inList.add(3); inList.add(3); inList.add(3); System.out.println(inList); Set<Integer> set = new LinkedHashSet<>(); set.addAll(inList); inList.clear(); inList.addAll(set); System.out.println(inList); System.out.println("-------------------------------"); List<Integer> iList = new ArrayList<>(); iList.add(1); iList.add(2); iList.add(3); iList.add(3); iList.add(3); System.out.println(iList); List<Integer> newList1 = new ArrayList<>(); newList1 = iList.stream().distinct().collect(Collectors.toList()); System.out.println(newList1); } }
UTF-8
Java
1,452
java
StringJoinDemo.java
Java
[ { "context": "ist<String> list = new ArrayList<>(Arrays.asList(\"Lav\",\"Kav\",\"Mav\",\"Nan\"));\n \n System.out.println(lis", "end": 213, "score": 0.9995962381362915, "start": 210, "tag": "NAME", "value": "Lav" }, { "context": "ring> list = new ArrayList<>(Arrays.asList(\"Lav\",\"Kav\",\"Mav\",\"Nan\"));\n \n System.out.println(list);\n ", "end": 219, "score": 0.9996026754379272, "start": 216, "tag": "NAME", "value": "Kav" }, { "context": "list = new ArrayList<>(Arrays.asList(\"Lav\",\"Kav\",\"Mav\",\"Nan\"));\n \n System.out.println(list);\n \n Str", "end": 225, "score": 0.9995511770248413, "start": 222, "tag": "NAME", "value": "Mav" }, { "context": " new ArrayList<>(Arrays.asList(\"Lav\",\"Kav\",\"Mav\",\"Nan\"));\n \n System.out.println(list);\n \n String st", "end": 231, "score": 0.9988710284233093, "start": 228, "tag": "NAME", "value": "Nan" } ]
null
[]
package com.tesco.practice; import java.util.*; import java.util.stream.Collectors; public class StringJoinDemo { public static void main(String[] args) { List<String> list = new ArrayList<>(Arrays.asList("Lav","Kav","Mav","Nan")); System.out.println(list); String str = String.join(", ", list); System.out.println(str); List<Integer> intList = new ArrayList<>(); intList.add(1); intList.add(2); intList.add(3); intList.add(3); intList.add(3); System.out.println(intList); List<Integer> newList = new ArrayList<>(); for(Integer element : intList) { if(!newList.contains(element)) { newList.add(element); } } System.out.println(newList); System.out.println("-------------------------------"); List<Integer> inList = new ArrayList<>(); inList.add(1); inList.add(2); inList.add(3); inList.add(3); inList.add(3); System.out.println(inList); Set<Integer> set = new LinkedHashSet<>(); set.addAll(inList); inList.clear(); inList.addAll(set); System.out.println(inList); System.out.println("-------------------------------"); List<Integer> iList = new ArrayList<>(); iList.add(1); iList.add(2); iList.add(3); iList.add(3); iList.add(3); System.out.println(iList); List<Integer> newList1 = new ArrayList<>(); newList1 = iList.stream().distinct().collect(Collectors.toList()); System.out.println(newList1); } }
1,452
0.608815
0.596419
71
19.450705
17.830017
78
false
false
0
0
0
0
0
0
0.647887
false
false
10
e012fbba5ad7929ba105e87b5b7788be80305f63
35,407,710,421,817
3edd79f2abd09609a9a77fe6adbec81423a2ff7c
/ourProject1final/src/com/ourProject1/register/RegisterController.java
eb8e7460fc401b9973d84a408262ea3bd7f66312
[]
no_license
gowshalinirajalingam/onine-book-store-
https://github.com/gowshalinirajalingam/onine-book-store-
44fb8b85c1c7ffec1a4dd01e5de95fd12a13d1d8
17b23cc03752d1caf3e0a23999b99eb0b9d10c53
refs/heads/master
2020-03-27T12:48:09.683000
2018-08-29T08:44:32
2018-08-29T08:44:32
146,570,677
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ourProject1.register; import java.io.IOException; import java.io.PrintWriter; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.ourProject1.encrypt.perform; /** * Servlet implementation class RegisterController */ @WebServlet("/Register") public class RegisterController extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out=response.getWriter(); String fname, lname, pAddress, cAddress, mobNo, homeNo, email,pwd,conPwd; String regex = "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]).{8,}$"; Pattern pattern = Pattern.compile(regex); Pattern pattern2 = Pattern.compile("^[0-9]{10}$"); boolean valid = true; fname=request.getParameter("fname").toString(); lname=request.getParameter("lname").toString(); pAddress=request.getParameter("p_address").toString(); cAddress=request.getParameter("c_address").toString(); mobNo=request.getParameter("mobile").toString(); homeNo=request.getParameter("home_tel").toString(); email=request.getParameter("email").toString(); pwd=request.getParameter("pwd").toString(); conPwd=request.getParameter("con_pwd").toString(); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); java.util.Date date; java.sql.Date sqlStartDate = null; try { date = sdf1.parse(request.getParameter("DoB").toString()); sqlStartDate = new java.sql.Date(date.getTime()); } catch (ParseException e) { e.printStackTrace(); } String select[]= request.getParameterValues("selected"); if(select == null) { out.println("<script type=\"text/javascript\">"); out.println("alert('Select atleast one interest.');"); out.println("location='Register.jsp';"); out.println("</script>"); System.out.println("Select atleast one interest"); valid = false; } if (sqlStartDate.after(new Date())) { out.println("<script type=\"text/javascript\">"); out.println("alert('Date invalid. Cannot be a future date.');"); out.println("location='Register.jsp';"); out.println("</script>"); System.out.println("Date invalid"); valid = false; } Matcher matcher = pattern.matcher(pwd); if (!matcher.matches()) { out.println("<script type=\"text/javascript\">"); out.println("alert('Password should contains atleast 8 characters including a digit,a lower case,an uppercase letter,a special character and no spaces allowed');"); out.println("location='Register.jsp';"); out.println("</script>"); System.out.println("pass inval"); valid = false; } if (!pwd.equals(conPwd)) { out.println("<script type=\"text/javascript\">"); out.println("alert('Your password mismatch.');"); out.println("location='Register.jsp';"); out.println("</script>"); System.out.println("pass mismatch"); valid = false; } Matcher matcher2 = pattern2.matcher(mobNo); if (!matcher2.matches()) { out.println("<script type=\"text/javascript\">"); out.println("alert('Invalid Mobile No. Cannot contain characters.');"); out.println("location='Register.jsp';"); out.println("</script>"); System.out.println("mob inval"); valid = false; } Matcher matcher3 = pattern2.matcher(homeNo); if (!matcher3.matches()) { out.println("<script type=\"text/javascript\">"); out.println("alert('Invalid Home No. Cannot contain characters.');"); out.println("location='Register.jsp';"); out.println("</script>"); System.out.println("hp inval"); valid = false; } if (valid) { RegisterDao Rd=new RegisterDao(); Rd.registerDetails(fname,lname, sqlStartDate, pAddress, cAddress, mobNo, homeNo, email,perform.encrypt(pwd),select); out.println("<script type=\"text/javascript\">"); out.println("alert('Register Successful !!');"); out.println("location='index.jsp';"); out.println("</script>"); } } }
UTF-8
Java
4,483
java
RegisterController.java
Java
[]
null
[]
package com.ourProject1.register; import java.io.IOException; import java.io.PrintWriter; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.ourProject1.encrypt.perform; /** * Servlet implementation class RegisterController */ @WebServlet("/Register") public class RegisterController extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out=response.getWriter(); String fname, lname, pAddress, cAddress, mobNo, homeNo, email,pwd,conPwd; String regex = "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]).{8,}$"; Pattern pattern = Pattern.compile(regex); Pattern pattern2 = Pattern.compile("^[0-9]{10}$"); boolean valid = true; fname=request.getParameter("fname").toString(); lname=request.getParameter("lname").toString(); pAddress=request.getParameter("p_address").toString(); cAddress=request.getParameter("c_address").toString(); mobNo=request.getParameter("mobile").toString(); homeNo=request.getParameter("home_tel").toString(); email=request.getParameter("email").toString(); pwd=request.getParameter("pwd").toString(); conPwd=request.getParameter("con_pwd").toString(); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); java.util.Date date; java.sql.Date sqlStartDate = null; try { date = sdf1.parse(request.getParameter("DoB").toString()); sqlStartDate = new java.sql.Date(date.getTime()); } catch (ParseException e) { e.printStackTrace(); } String select[]= request.getParameterValues("selected"); if(select == null) { out.println("<script type=\"text/javascript\">"); out.println("alert('Select atleast one interest.');"); out.println("location='Register.jsp';"); out.println("</script>"); System.out.println("Select atleast one interest"); valid = false; } if (sqlStartDate.after(new Date())) { out.println("<script type=\"text/javascript\">"); out.println("alert('Date invalid. Cannot be a future date.');"); out.println("location='Register.jsp';"); out.println("</script>"); System.out.println("Date invalid"); valid = false; } Matcher matcher = pattern.matcher(pwd); if (!matcher.matches()) { out.println("<script type=\"text/javascript\">"); out.println("alert('Password should contains atleast 8 characters including a digit,a lower case,an uppercase letter,a special character and no spaces allowed');"); out.println("location='Register.jsp';"); out.println("</script>"); System.out.println("pass inval"); valid = false; } if (!pwd.equals(conPwd)) { out.println("<script type=\"text/javascript\">"); out.println("alert('Your password mismatch.');"); out.println("location='Register.jsp';"); out.println("</script>"); System.out.println("pass mismatch"); valid = false; } Matcher matcher2 = pattern2.matcher(mobNo); if (!matcher2.matches()) { out.println("<script type=\"text/javascript\">"); out.println("alert('Invalid Mobile No. Cannot contain characters.');"); out.println("location='Register.jsp';"); out.println("</script>"); System.out.println("mob inval"); valid = false; } Matcher matcher3 = pattern2.matcher(homeNo); if (!matcher3.matches()) { out.println("<script type=\"text/javascript\">"); out.println("alert('Invalid Home No. Cannot contain characters.');"); out.println("location='Register.jsp';"); out.println("</script>"); System.out.println("hp inval"); valid = false; } if (valid) { RegisterDao Rd=new RegisterDao(); Rd.registerDetails(fname,lname, sqlStartDate, pAddress, cAddress, mobNo, homeNo, email,perform.encrypt(pwd),select); out.println("<script type=\"text/javascript\">"); out.println("alert('Register Successful !!');"); out.println("location='index.jsp';"); out.println("</script>"); } } }
4,483
0.661611
0.657149
118
36.974575
26.306686
173
false
false
0
0
0
0
0
0
2.40678
false
false
10
6dfbaf011e025d6647823a1f1cf93d9668f84489
37,881,611,563,300
797293947ef68aab44503a22d9066410fcf63ff6
/process-manage/src/main/java/process/manage/philosopher/PhilosopherEat.java
4d637fd9caffcd5e4a7a4cd671cdc8322c68c692
[]
no_license
KnewHow/studyOS
https://github.com/KnewHow/studyOS
7497a3782f25e404b50f0209b163734ac6a045c3
fd5037fedaf1c1d99393f2218a1bc65cd30ccb45
refs/heads/master
2021-06-16T23:29:37.199000
2017-05-19T08:13:55
2017-05-19T08:13:55
90,276,707
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package process.manage.philosopher; import java.util.ArrayList; import java.util.List; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; /** * A Class to demo philosopher eating question. * @author ygh * May 4, 2017 */ public class PhilosopherEat { /** * Setting the quantity of philosophers */ public static final int TOTAL_MOUNT = 100; /* * Just a test method */ public static void main(String[] args) { Resource r = new Resource(); /** * A list to store the philosophers */ List<Philosopher> philosopherList = new ArrayList<Philosopher>(); for(int i=1;i<=TOTAL_MOUNT;i++){ Philosopher philosopher = new Philosopher("Philosopher "+i, i, false); philosopherList.add(philosopher); } /** * A list to store threads with philosopher and resource */ List<Thread> threadList = new ArrayList<Thread>(); for(int i=1;i<=TOTAL_MOUNT;i++){ Thread thread = new Thread(new Eat(philosopherList.get(i-1), r)); threadList.add(thread); } /** * start thread method. */ for(int i=1;i<=TOTAL_MOUNT;i++){ threadList.get(i-1).start(); } // Philosopher p1 = new Philosopher("Philosopher 1", 1, false); // Philosopher p2 = new Philosopher("Philosopher 2", 2, false); // Philosopher p3 = new Philosopher("Philosopher 3", 3, false); // Philosopher p4 = new Philosopher("Philosopher 4", 4, false); // Philosopher p5 = new Philosopher("Philosopher 5", 5, false); // Thread t1 = new Thread(new Eat(p1, r)); // Thread t2 = new Thread(new Eat(p2, r)); // Thread t3 = new Thread(new Eat(p3, r)); // Thread t4 = new Thread(new Eat(p4, r)); // Thread t5 = new Thread(new Eat(p5, r)); // t1.start(); // t2.start(); // t3.start(); // t4.start(); // t5.start(); } } /** * Define a Eat class to implement Runnable * Eat action need two class: philosoper(person) and resource(food) * @author ygh * May 4, 2017 */ class Eat implements Runnable { private Philosopher philosopher; private Resource resource; /** * Constructor of the Eat class to initialize attributes * @param philosopher The philosopher apply to eat * @param resource The resource eating need */ public Eat(Philosopher philosopher, Resource resource) { super(); this.philosopher = philosopher; this.resource = resource; } /** * The run method to execute many threads. */ public void run() { while (true) { resource.eat(philosopher); } } } /** * Define a resource class to initialize the chopsticks tag array and implement eat method * @author ygh * May 4, 2017 */ class Resource { Lock lock = new ReentrantLock(); private static int[] chopsticks = new int[PhilosopherEat.TOTAL_MOUNT]; /** * The no parameters constructor method of Resource to initialize chopticks tag array */ public Resource() { super(); for (int i = 0; i < chopsticks.length; i++) { chopsticks[i] = 1; } } /** * The method to control a philosopher eating. * If the chopsticks is enough, eating, else wait. * @param philosopher The philosopher apply to eat action */ public void eat(Philosopher philosopher) { try { lock.lock(); /** * If the resource in not enough,let philosopher wait. */ while (philosopher.isEat() || !philosopher.isCanEat(chopsticks)) { wait(); } philosopher.eat(chopsticks); philosopher.setEat(true); // Thread.sleep(40); philosopher.finishEat(chopsticks); notify(); } catch (Exception e) { } finally { lock.unlock(); } } } /** * * @author ygh * May 4, 2017 * Define a philosopher class to implement some functions. */ class Philosopher { /** * The name is the name of the philosopher */ private String name; /** * The id of the philosopher */ private int id; /** * Whether the philosopher has eaten. * true:the philosopher has eaten * false:the philosopher has not eaten */ private boolean isEat; /** * The constructor of Philosopher * @param name The name is the name of the philosopher * @param id The id of the philosopher * @param isEat Whether the philosopher has eaten,true:the philosopher has eaten * otherwise flase. */ public Philosopher(String name, int id, boolean isEat) { super(); this.name = name; this.id = id; this.isEat = isEat; } /** * get and set methods */ public int getId() { return id; } public void setId(int id) { this.id = id; } public boolean isEat() { return isEat; } public void setEat(boolean isEat) { this.isEat = isEat; } public String getName() { return name; } public void setName(String name) { this.name = name; } /** * The philosopher eat functions, in the here we just print a input to console * The functions if following: * first: philosopher get two chopsticks that we will let chopsticks array that index are philosopher'one * and philosopher's two set to be 0, the print a input to console.\ * * @param arr The array to store philosopher's chopsticks tags */ public void eat(int[] arr) { List<Integer> chopsList = this.getChopsticks(); arr[chopsList.get(0) - 1] = 0; arr[chopsList.get(1) - 1] = 0; System.out.println( this.getName() + " is eating with " + "chopstick " + chopsList.get(0) + " and " + chopsList.get(1)); } /** * Finish eat function,we will release the chopstics the philosopher's has taken * @param arr The array to store philosopher's chopsticks tags */ public void finishEat(int arr[]) { List<Integer> chopsList = this.getChopsticks(); arr[chopsList.get(0) - 1] = 1; arr[chopsList.get(1) - 1] = 1; } /** * Whether the philosopher can eat.We will set a N(N is the total quantity of the philosophers) length integer array to * store the chopsticks tags, and we will initialize it all to 1. * 1 indicates the index.th choptick can be used * 0 indicates the index.th choptick is being used,can be used now! * * If the arr[philosopher's one]==1 and arr[philosopher's two]==1 indicates * the philosopher can eat, otherwise can't * @param arr The integer array to store the chopticks tags * @return True will be returned if the philosopher can eat otherwise return false */ public boolean isCanEat(int[] arr) { List<Integer> chopsList = getChopsticks(); if (arr[chopsList.get(0) - 1] == 1 && arr[chopsList.get(1) - 1] == 1) { return true; } else { return false; } } /** * Get the philosopher's chopsticks by philosopher's id * when the philosopher's id not equal one,the chopstick one is the * philosopher's id and two is the philosopher's id -1. * But if the philosoper's id is equal one the chopstick one is the * philosopher's id and philosopher total mounts. * * @return a tow element list of integer to store the chopstick numbers which the philosopher * will use. */ public List<Integer> getChopsticks() { int chop_one = this.getId(); int chop_two = 0; if (chop_one == 1) { chop_two = PhilosopherEat.TOTAL_MOUNT; } else { chop_two = chop_one - 1; } List<Integer> chopsList = new ArrayList<Integer>(); chopsList.add(chop_one); chopsList.add(chop_two); return chopsList; } }
UTF-8
Java
7,159
java
PhilosopherEat.java
Java
[ { "context": "ss to demo philosopher eating question.\n * @author ygh\n * May 4, 2017\n */\npublic class PhilosopherEat {\n", "end": 244, "score": 0.9997154474258423, "start": 241, "tag": "USERNAME", "value": "ygh" }, { "context": ": philosoper(person) and resource(food)\n * @author ygh\n * May 4, 2017\n */\nclass Eat implements Runnable ", "end": 1907, "score": 0.9996698498725891, "start": 1904, "tag": "USERNAME", "value": "ygh" }, { "context": "icks tag array and implement eat method\n * @author ygh\n * May 4, 2017\n */\nclass Resource {\n\tLock lock = ", "end": 2566, "score": 0.9996903538703918, "start": 2563, "tag": "USERNAME", "value": "ygh" }, { "context": "y {\n\t\t\tlock.unlock();\n\t\t}\n\t}\n}\n\n/**\n * \n * @author ygh\n * May 4, 2017\n * Define a philosopher class to i", "end": 3539, "score": 0.9995647668838501, "start": 3536, "tag": "USERNAME", "value": "ygh" } ]
null
[]
package process.manage.philosopher; import java.util.ArrayList; import java.util.List; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; /** * A Class to demo philosopher eating question. * @author ygh * May 4, 2017 */ public class PhilosopherEat { /** * Setting the quantity of philosophers */ public static final int TOTAL_MOUNT = 100; /* * Just a test method */ public static void main(String[] args) { Resource r = new Resource(); /** * A list to store the philosophers */ List<Philosopher> philosopherList = new ArrayList<Philosopher>(); for(int i=1;i<=TOTAL_MOUNT;i++){ Philosopher philosopher = new Philosopher("Philosopher "+i, i, false); philosopherList.add(philosopher); } /** * A list to store threads with philosopher and resource */ List<Thread> threadList = new ArrayList<Thread>(); for(int i=1;i<=TOTAL_MOUNT;i++){ Thread thread = new Thread(new Eat(philosopherList.get(i-1), r)); threadList.add(thread); } /** * start thread method. */ for(int i=1;i<=TOTAL_MOUNT;i++){ threadList.get(i-1).start(); } // Philosopher p1 = new Philosopher("Philosopher 1", 1, false); // Philosopher p2 = new Philosopher("Philosopher 2", 2, false); // Philosopher p3 = new Philosopher("Philosopher 3", 3, false); // Philosopher p4 = new Philosopher("Philosopher 4", 4, false); // Philosopher p5 = new Philosopher("Philosopher 5", 5, false); // Thread t1 = new Thread(new Eat(p1, r)); // Thread t2 = new Thread(new Eat(p2, r)); // Thread t3 = new Thread(new Eat(p3, r)); // Thread t4 = new Thread(new Eat(p4, r)); // Thread t5 = new Thread(new Eat(p5, r)); // t1.start(); // t2.start(); // t3.start(); // t4.start(); // t5.start(); } } /** * Define a Eat class to implement Runnable * Eat action need two class: philosoper(person) and resource(food) * @author ygh * May 4, 2017 */ class Eat implements Runnable { private Philosopher philosopher; private Resource resource; /** * Constructor of the Eat class to initialize attributes * @param philosopher The philosopher apply to eat * @param resource The resource eating need */ public Eat(Philosopher philosopher, Resource resource) { super(); this.philosopher = philosopher; this.resource = resource; } /** * The run method to execute many threads. */ public void run() { while (true) { resource.eat(philosopher); } } } /** * Define a resource class to initialize the chopsticks tag array and implement eat method * @author ygh * May 4, 2017 */ class Resource { Lock lock = new ReentrantLock(); private static int[] chopsticks = new int[PhilosopherEat.TOTAL_MOUNT]; /** * The no parameters constructor method of Resource to initialize chopticks tag array */ public Resource() { super(); for (int i = 0; i < chopsticks.length; i++) { chopsticks[i] = 1; } } /** * The method to control a philosopher eating. * If the chopsticks is enough, eating, else wait. * @param philosopher The philosopher apply to eat action */ public void eat(Philosopher philosopher) { try { lock.lock(); /** * If the resource in not enough,let philosopher wait. */ while (philosopher.isEat() || !philosopher.isCanEat(chopsticks)) { wait(); } philosopher.eat(chopsticks); philosopher.setEat(true); // Thread.sleep(40); philosopher.finishEat(chopsticks); notify(); } catch (Exception e) { } finally { lock.unlock(); } } } /** * * @author ygh * May 4, 2017 * Define a philosopher class to implement some functions. */ class Philosopher { /** * The name is the name of the philosopher */ private String name; /** * The id of the philosopher */ private int id; /** * Whether the philosopher has eaten. * true:the philosopher has eaten * false:the philosopher has not eaten */ private boolean isEat; /** * The constructor of Philosopher * @param name The name is the name of the philosopher * @param id The id of the philosopher * @param isEat Whether the philosopher has eaten,true:the philosopher has eaten * otherwise flase. */ public Philosopher(String name, int id, boolean isEat) { super(); this.name = name; this.id = id; this.isEat = isEat; } /** * get and set methods */ public int getId() { return id; } public void setId(int id) { this.id = id; } public boolean isEat() { return isEat; } public void setEat(boolean isEat) { this.isEat = isEat; } public String getName() { return name; } public void setName(String name) { this.name = name; } /** * The philosopher eat functions, in the here we just print a input to console * The functions if following: * first: philosopher get two chopsticks that we will let chopsticks array that index are philosopher'one * and philosopher's two set to be 0, the print a input to console.\ * * @param arr The array to store philosopher's chopsticks tags */ public void eat(int[] arr) { List<Integer> chopsList = this.getChopsticks(); arr[chopsList.get(0) - 1] = 0; arr[chopsList.get(1) - 1] = 0; System.out.println( this.getName() + " is eating with " + "chopstick " + chopsList.get(0) + " and " + chopsList.get(1)); } /** * Finish eat function,we will release the chopstics the philosopher's has taken * @param arr The array to store philosopher's chopsticks tags */ public void finishEat(int arr[]) { List<Integer> chopsList = this.getChopsticks(); arr[chopsList.get(0) - 1] = 1; arr[chopsList.get(1) - 1] = 1; } /** * Whether the philosopher can eat.We will set a N(N is the total quantity of the philosophers) length integer array to * store the chopsticks tags, and we will initialize it all to 1. * 1 indicates the index.th choptick can be used * 0 indicates the index.th choptick is being used,can be used now! * * If the arr[philosopher's one]==1 and arr[philosopher's two]==1 indicates * the philosopher can eat, otherwise can't * @param arr The integer array to store the chopticks tags * @return True will be returned if the philosopher can eat otherwise return false */ public boolean isCanEat(int[] arr) { List<Integer> chopsList = getChopsticks(); if (arr[chopsList.get(0) - 1] == 1 && arr[chopsList.get(1) - 1] == 1) { return true; } else { return false; } } /** * Get the philosopher's chopsticks by philosopher's id * when the philosopher's id not equal one,the chopstick one is the * philosopher's id and two is the philosopher's id -1. * But if the philosoper's id is equal one the chopstick one is the * philosopher's id and philosopher total mounts. * * @return a tow element list of integer to store the chopstick numbers which the philosopher * will use. */ public List<Integer> getChopsticks() { int chop_one = this.getId(); int chop_two = 0; if (chop_one == 1) { chop_two = PhilosopherEat.TOTAL_MOUNT; } else { chop_two = chop_one - 1; } List<Integer> chopsList = new ArrayList<Integer>(); chopsList.add(chop_one); chopsList.add(chop_two); return chopsList; } }
7,159
0.66797
0.655119
287
23.947735
24.654844
120
false
false
0
0
0
0
0
0
1.679443
false
false
10
c4bf33f737e35307ba7eee5889921700412a3445
35,905,926,632,764
23d1d7988c3137aa03f91c94961a87f8cf3888fb
/WEB-INF/src/adultadmin/action/stat/SearecDpproductAction.java
78c808c6ecc1f540f3a9ad08464221ee0b0fab5e
[]
no_license
likgjava/mmbWare
https://github.com/likgjava/mmbWare
0a0e9962754a9d95dbece24ee4a0c5f73cbafa1f
b5eb4f1413c34b10a041428ed0dd8986e7618063
refs/heads/master
2018-01-10T03:07:35.620000
2015-12-29T08:41:15
2015-12-29T08:41:15
48,529,276
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package adultadmin.action.stat; import java.sql.ResultSet; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import mmb.util.comparator.ComparatorDpproductStat; import adultadmin.bean.stat.DpproductStatBean; import adultadmin.framework.BaseAction; import adultadmin.service.ServiceFactory; import adultadmin.service.infc.IBaseService; import adultadmin.service.infc.IProductStockService; import adultadmin.util.StringUtil; import adultadmin.util.db.DbOperation; public class SearecDpproductAction extends BaseAction { public void SearecDpproductStat2(HttpServletRequest request, HttpServletResponse response) { String startDate = StringUtil.dealParam(request.getParameter("startDate"));//开始时间 if(startDate==null)startDate=""; String endDate = StringUtil.dealParam(request.getParameter("endDate"));//结束时间 if(endDate==null)endDate=""; int proxy = StringUtil.toInt(request.getParameter("proxy"));//代理商 int parentId1 = StringUtil.StringToId(request.getParameter("parentId1"));//分类1 int parentId2 = StringUtil.StringToId(request.getParameter("parentId2"));//分类2 //System.out.println(startDate+"==="+endDate+"=="+proxy+"=="+parentId1+"=="+parentId2); if(startDate.equals("")&&endDate.equals("")&&proxy==-1&&parentId1==0&&parentId2==0){ //System.out.println("默认为空返回"); return; } //时间格式校验 Date date1 = null; Date date2 = null; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); if (startDate.length() > 0) { try { date1 = sdf.parse(startDate); } catch (Exception e) { request.setAttribute("result", "failure"); request.setAttribute("tip", "开始时间格式不对!"); return; } } if (endDate.length() > 0) { try { date2 = sdf.parse(endDate); } catch (Exception e) { request.setAttribute("result", "failure"); request.setAttribute("tip", "结束时间格式不对!"); return; } } if (date1 != null && date2 != null) { if (date2.before(date1)) { request.setAttribute("result", "failure"); request.setAttribute("tip", "结束时间必须在开始时间之后!"); return; } } //拼装查询条件 StringBuffer condition=new StringBuffer(); String outTime="";//产品出货时间 String creatTime="";//产品入库时间 String returnTime="";//产品的销售退货时间 if(startDate!=null){ outTime=(" and left(os.last_oper_time,10) >= '"+startDate+"' "); creatTime=(" and left(bs.create_datetime, 10) >= '"+startDate+"' "); returnTime=(" and left(so.create_datetime, 10) >= '"+startDate+"' "); request.setAttribute("startDate", startDate); } if(endDate!=null){ outTime=outTime+(" and left(os.last_oper_time,10)<= '"+endDate+"' "); creatTime=creatTime+(" and left(bs.create_datetime,10)<= '"+endDate+"' "); returnTime=returnTime+(" and left(so.create_datetime,10)<= '"+endDate+"' "); request.setAttribute("endDate", endDate); } if(proxy>0){ condition.append(" and d.id="+proxy); } if(parentId1>0){ condition.append(" and p.parent_id1="+parentId1); request.setAttribute("parentId1", ""+parentId1); } if(parentId2>0){ condition.append(" and p.parent_id2="+parentId2); request.setAttribute("parentId2", ""+parentId2); } //开启数据库连接 DbOperation dbOp = new DbOperation(); dbOp.init("adult_slave"); DpproductStatBean bean = null; List dpproductList = new ArrayList(); String query="select s8.product_id, s8.code,s8.name,s8.out_count,s8.in_count,s8.or_count,s9.last_time,s8.price5 from(" +"select s3.product_id,s3.code,s3.name,s3.price5,s3.out_count,s3.in_count,s5.or_count from" +" (select s2.product_id,s2.code,s2.name,s2.price5,s2.out_count,s2.in_count from" +" (select s1.product_id,s1.code,s1.name,s1.price5,s1.out_count,s4.in_count from" //销量统计 +" (select s.product_id,p.code,p.name,p.price5,sum(s.stockout_count) out_count from" +" (select osp.product_id ,osp.stockout_count ,os.last_oper_time last_time" +" from order_stock_product osp, order_stock os" +" where osp.order_stock_id = os.id" +" and os.status=2" +outTime+") s left join product p on s.product_id = p.id left outer join product_supplier c on p.id=c.product_id left join supplier_standard_info d on d.id=c.supplier_id " +" where 1=1 " +condition.toString() +" group by s.product_id) s1" //采购入库统计 +" left join(select s6.product_id, sum(s6.stockin_count) in_count" +" from (select bsp.product_id, bsp.stockin_count" +" from buy_stockin_product bsp,buy_stockin bs" +" where bsp.buy_stockin_id = bs.id" +" and bs.status in (4,6)" +creatTime+") s6" +" group by s6.product_id) s4" +" on s1.product_id=s4.product_id) s2 ) s3" //销售退货统计 +" left join (select s12.product_id,sum(s12.stock_bj) or_count " +" from (select sh.product_id,sh.stock_bj" +" from stock_history sh,stock_operation so" +" where sh.oper_id=so.id" +" and so.type=6 " +returnTime+")s12" +" group by s12.product_id) s5" +" on s3.product_id=s5.product_id) s8" //产品最近出货时间 +" left join (select osp.product_id,max(os.last_oper_time) last_time" +" from order_stock_product osp, order_stock os" +" where osp.order_stock_id = os.id" +" and os.status = 2 and left(os.last_oper_time, 10) <= '"+endDate+"' " +" group by osp.product_id) s9" +" on s8.product_id=s9.product_id" +" order by s9.last_time desc"; //System.out.println("-->"+query); ResultSet rs = dbOp.executeQuery(query); try { while (rs.next()) { bean=new DpproductStatBean(); bean.setProductId(rs.getInt(1));//商品ID bean.setCode(rs.getString(2));//编号 bean.setName(rs.getString(3));//名称 bean.setOutCount(rs.getInt(4));//销量 bean.setStockinCount(rs.getInt(5));//采购入库量 // bean.setReturnCount(rs.getInt(6));//采购退货量 bean.setOutReturnCount(rs.getInt(6));//销量退货量 bean.setLastTime(rs.getString(7));//产品最近出货时间 bean.setPrice5(rs.getFloat(8)); dpproductList.add(bean); } rs.close(); } catch (SQLException e) { e.printStackTrace(); } request.setAttribute("count", ""+dpproductList.size()); //关联各个库存数量 IProductStockService psService = ServiceFactory.createProductStockService(IBaseService.CONN_IN_SERVICE, null); try{ Iterator iter = dpproductList.listIterator(); while(iter.hasNext()){ DpproductStatBean dpproductStat = (DpproductStatBean)iter.next(); dpproductStat.setPsList(psService.getProductStockList("product_id=" + dpproductStat.getProductId(), -1, -1, null)); } } finally { dbOp.release();//释放所有资源 psService.releaseAll(); } request.setAttribute("dpproductList", dpproductList); } public void SearecDpproductStat(HttpServletRequest request, HttpServletResponse response) { String startDate = StringUtil.dealParam(request.getParameter("startDate"));//开始时间 if(startDate==null)startDate=""; String endDate = StringUtil.dealParam(request.getParameter("endDate"));//结束时间 if(endDate==null)endDate=""; int proxy = StringUtil.toInt(request.getParameter("proxy"));//代理商 int parentId1 = StringUtil.StringToId(request.getParameter("parentId1"));//分类1 int parentId2 = StringUtil.StringToId(request.getParameter("parentId2"));//分类2 //System.out.println(startDate+"==="+endDate+"=="+proxy+"=="+parentId1+"=="+parentId2); if(startDate.equals("")&&endDate.equals("")&&proxy==-1&&parentId1==0&&parentId2==0){ //System.out.println("默认为空返回"); return; } //时间格式校验 Date date1 = null; Date date2 = null; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); if (startDate.length() > 0) { try { date1 = sdf.parse(startDate); } catch (Exception e) { request.setAttribute("result", "failure"); request.setAttribute("tip", "开始时间格式不对!"); return; } } if (endDate.length() > 0) { try { date2 = sdf.parse(endDate); } catch (Exception e) { request.setAttribute("result", "failure"); request.setAttribute("tip", "结束时间格式不对!"); return; } } if (date1 != null && date2 != null) { if (date2.before(date1)) { request.setAttribute("result", "failure"); request.setAttribute("tip", "结束时间必须在开始时间之后!"); return; } } //拼装查询条件 StringBuffer condition=new StringBuffer(); if(startDate!=null){ condition.append(" and sc.create_datetime>='"); condition.append(startDate); condition.append("'"); request.setAttribute("startDate", startDate); } if(endDate!=null){ condition.append(" and sc.create_datetime<='"); condition.append(endDate); condition.append("'"); request.setAttribute("endDate", endDate); } if(proxy>0){ condition.append(" and d.id="+proxy); } if(parentId1>0){ condition.append(" and p.parent_id1="+parentId1); request.setAttribute("parentId1", ""+parentId1); } if(parentId2>0){ condition.append(" and p.parent_id2="+parentId2); request.setAttribute("parentId2", ""+parentId2); } //开启数据库连接 DbOperation dbOp = new DbOperation(); IProductStockService psService = ServiceFactory.createProductStockService(IBaseService.CONN_IN_SERVICE, null); dbOp.init("adult_slave2"); List dpproductList = new ArrayList(); String query="select sc.product_id,p.code,p.oriname,sc.stock_in_count,sc.stock_out_count,sc.create_datetime,sc.stock_price,sc.card_type from stock_card sc join product p on sc.product_id=p.id" +(proxy>0?" join product_supplier c on p.id=c.product_id join supplier_standard_info d on d.id=c.supplier_id":"") +" where sc.card_type in (1,2,5)" +condition +" order by create_datetime desc"; ResultSet rs = dbOp.executeQuery(query); try{ HashMap dppMap=new HashMap(); while(rs.next()){ int productId=rs.getInt(1); String productCode=rs.getString(2); String productName=rs.getString(3); int stockInCount=rs.getInt(4); int stockOutCount=rs.getInt(5); String createDatetime=rs.getString(6); float stockPrice=rs.getFloat(7);//库存单价 int cardType=rs.getInt(8);//进销存卡片类型 if(dppMap.get(productId+"")==null){ DpproductStatBean bean = new DpproductStatBean(); bean.setProductId(productId);//商品ID bean.setCode(productCode);//编号 bean.setName(productName);//名称 if(cardType==1){//采购入库 bean.setOutCount(0);//销量 bean.setStockinCount(stockInCount);//采购入库量 bean.setOutReturnCount(0);//销量退货量 }else if(cardType==2){//销售出库 bean.setOutCount(stockOutCount);//销量 bean.setStockinCount(0);//采购入库量 bean.setOutReturnCount(0);//销量退货量 }else if(cardType==5){//销售退货入库 bean.setOutCount(0);//销量 bean.setStockinCount(0);//采购入库量 bean.setOutReturnCount(stockInCount);//销量退货量 } bean.setLastTime(createDatetime);//产品最近出货时间 bean.setPrice5(stockPrice); bean.setFrequencyCount(1); dpproductList.add(bean); dppMap.put(productId+"", bean); }else{ DpproductStatBean bean = (DpproductStatBean)dppMap.get(productId+""); if(cardType==1){//采购入库 bean.setStockinCount(bean.getStockinCount()+stockInCount);//采购入库量 }else if(cardType==2){//销售出库 bean.setOutCount(bean.getOutCount()+stockOutCount);//销量 }else if(cardType==5){//销售退货入库 bean.setOutReturnCount(bean.getOutReturnCount()+stockInCount);//销量退货量 } bean.setFrequencyCount(bean.getFrequencyCount()+1); } } request.setAttribute("count", ""+dpproductList.size()); //关联各个库存数量 Iterator iter = dpproductList.listIterator(); while(iter.hasNext()){ DpproductStatBean dpproductStat = (DpproductStatBean)iter.next(); dpproductStat.setPsList(psService.getProductStockList("product_id=" + dpproductStat.getProductId(), -1, -1, null)); } }catch(Exception e){ e.printStackTrace(); }finally { dbOp.release();//释放所有资源 psService.releaseAll(); } ComparatorDpproductStat comparator = new ComparatorDpproductStat(); Collections.sort(dpproductList,comparator); //按照动碰频率排序 request.setAttribute("dpproductList", dpproductList); } }
UTF-8
Java
13,136
java
SearecDpproductAction.java
Java
[]
null
[]
package adultadmin.action.stat; import java.sql.ResultSet; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import mmb.util.comparator.ComparatorDpproductStat; import adultadmin.bean.stat.DpproductStatBean; import adultadmin.framework.BaseAction; import adultadmin.service.ServiceFactory; import adultadmin.service.infc.IBaseService; import adultadmin.service.infc.IProductStockService; import adultadmin.util.StringUtil; import adultadmin.util.db.DbOperation; public class SearecDpproductAction extends BaseAction { public void SearecDpproductStat2(HttpServletRequest request, HttpServletResponse response) { String startDate = StringUtil.dealParam(request.getParameter("startDate"));//开始时间 if(startDate==null)startDate=""; String endDate = StringUtil.dealParam(request.getParameter("endDate"));//结束时间 if(endDate==null)endDate=""; int proxy = StringUtil.toInt(request.getParameter("proxy"));//代理商 int parentId1 = StringUtil.StringToId(request.getParameter("parentId1"));//分类1 int parentId2 = StringUtil.StringToId(request.getParameter("parentId2"));//分类2 //System.out.println(startDate+"==="+endDate+"=="+proxy+"=="+parentId1+"=="+parentId2); if(startDate.equals("")&&endDate.equals("")&&proxy==-1&&parentId1==0&&parentId2==0){ //System.out.println("默认为空返回"); return; } //时间格式校验 Date date1 = null; Date date2 = null; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); if (startDate.length() > 0) { try { date1 = sdf.parse(startDate); } catch (Exception e) { request.setAttribute("result", "failure"); request.setAttribute("tip", "开始时间格式不对!"); return; } } if (endDate.length() > 0) { try { date2 = sdf.parse(endDate); } catch (Exception e) { request.setAttribute("result", "failure"); request.setAttribute("tip", "结束时间格式不对!"); return; } } if (date1 != null && date2 != null) { if (date2.before(date1)) { request.setAttribute("result", "failure"); request.setAttribute("tip", "结束时间必须在开始时间之后!"); return; } } //拼装查询条件 StringBuffer condition=new StringBuffer(); String outTime="";//产品出货时间 String creatTime="";//产品入库时间 String returnTime="";//产品的销售退货时间 if(startDate!=null){ outTime=(" and left(os.last_oper_time,10) >= '"+startDate+"' "); creatTime=(" and left(bs.create_datetime, 10) >= '"+startDate+"' "); returnTime=(" and left(so.create_datetime, 10) >= '"+startDate+"' "); request.setAttribute("startDate", startDate); } if(endDate!=null){ outTime=outTime+(" and left(os.last_oper_time,10)<= '"+endDate+"' "); creatTime=creatTime+(" and left(bs.create_datetime,10)<= '"+endDate+"' "); returnTime=returnTime+(" and left(so.create_datetime,10)<= '"+endDate+"' "); request.setAttribute("endDate", endDate); } if(proxy>0){ condition.append(" and d.id="+proxy); } if(parentId1>0){ condition.append(" and p.parent_id1="+parentId1); request.setAttribute("parentId1", ""+parentId1); } if(parentId2>0){ condition.append(" and p.parent_id2="+parentId2); request.setAttribute("parentId2", ""+parentId2); } //开启数据库连接 DbOperation dbOp = new DbOperation(); dbOp.init("adult_slave"); DpproductStatBean bean = null; List dpproductList = new ArrayList(); String query="select s8.product_id, s8.code,s8.name,s8.out_count,s8.in_count,s8.or_count,s9.last_time,s8.price5 from(" +"select s3.product_id,s3.code,s3.name,s3.price5,s3.out_count,s3.in_count,s5.or_count from" +" (select s2.product_id,s2.code,s2.name,s2.price5,s2.out_count,s2.in_count from" +" (select s1.product_id,s1.code,s1.name,s1.price5,s1.out_count,s4.in_count from" //销量统计 +" (select s.product_id,p.code,p.name,p.price5,sum(s.stockout_count) out_count from" +" (select osp.product_id ,osp.stockout_count ,os.last_oper_time last_time" +" from order_stock_product osp, order_stock os" +" where osp.order_stock_id = os.id" +" and os.status=2" +outTime+") s left join product p on s.product_id = p.id left outer join product_supplier c on p.id=c.product_id left join supplier_standard_info d on d.id=c.supplier_id " +" where 1=1 " +condition.toString() +" group by s.product_id) s1" //采购入库统计 +" left join(select s6.product_id, sum(s6.stockin_count) in_count" +" from (select bsp.product_id, bsp.stockin_count" +" from buy_stockin_product bsp,buy_stockin bs" +" where bsp.buy_stockin_id = bs.id" +" and bs.status in (4,6)" +creatTime+") s6" +" group by s6.product_id) s4" +" on s1.product_id=s4.product_id) s2 ) s3" //销售退货统计 +" left join (select s12.product_id,sum(s12.stock_bj) or_count " +" from (select sh.product_id,sh.stock_bj" +" from stock_history sh,stock_operation so" +" where sh.oper_id=so.id" +" and so.type=6 " +returnTime+")s12" +" group by s12.product_id) s5" +" on s3.product_id=s5.product_id) s8" //产品最近出货时间 +" left join (select osp.product_id,max(os.last_oper_time) last_time" +" from order_stock_product osp, order_stock os" +" where osp.order_stock_id = os.id" +" and os.status = 2 and left(os.last_oper_time, 10) <= '"+endDate+"' " +" group by osp.product_id) s9" +" on s8.product_id=s9.product_id" +" order by s9.last_time desc"; //System.out.println("-->"+query); ResultSet rs = dbOp.executeQuery(query); try { while (rs.next()) { bean=new DpproductStatBean(); bean.setProductId(rs.getInt(1));//商品ID bean.setCode(rs.getString(2));//编号 bean.setName(rs.getString(3));//名称 bean.setOutCount(rs.getInt(4));//销量 bean.setStockinCount(rs.getInt(5));//采购入库量 // bean.setReturnCount(rs.getInt(6));//采购退货量 bean.setOutReturnCount(rs.getInt(6));//销量退货量 bean.setLastTime(rs.getString(7));//产品最近出货时间 bean.setPrice5(rs.getFloat(8)); dpproductList.add(bean); } rs.close(); } catch (SQLException e) { e.printStackTrace(); } request.setAttribute("count", ""+dpproductList.size()); //关联各个库存数量 IProductStockService psService = ServiceFactory.createProductStockService(IBaseService.CONN_IN_SERVICE, null); try{ Iterator iter = dpproductList.listIterator(); while(iter.hasNext()){ DpproductStatBean dpproductStat = (DpproductStatBean)iter.next(); dpproductStat.setPsList(psService.getProductStockList("product_id=" + dpproductStat.getProductId(), -1, -1, null)); } } finally { dbOp.release();//释放所有资源 psService.releaseAll(); } request.setAttribute("dpproductList", dpproductList); } public void SearecDpproductStat(HttpServletRequest request, HttpServletResponse response) { String startDate = StringUtil.dealParam(request.getParameter("startDate"));//开始时间 if(startDate==null)startDate=""; String endDate = StringUtil.dealParam(request.getParameter("endDate"));//结束时间 if(endDate==null)endDate=""; int proxy = StringUtil.toInt(request.getParameter("proxy"));//代理商 int parentId1 = StringUtil.StringToId(request.getParameter("parentId1"));//分类1 int parentId2 = StringUtil.StringToId(request.getParameter("parentId2"));//分类2 //System.out.println(startDate+"==="+endDate+"=="+proxy+"=="+parentId1+"=="+parentId2); if(startDate.equals("")&&endDate.equals("")&&proxy==-1&&parentId1==0&&parentId2==0){ //System.out.println("默认为空返回"); return; } //时间格式校验 Date date1 = null; Date date2 = null; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); if (startDate.length() > 0) { try { date1 = sdf.parse(startDate); } catch (Exception e) { request.setAttribute("result", "failure"); request.setAttribute("tip", "开始时间格式不对!"); return; } } if (endDate.length() > 0) { try { date2 = sdf.parse(endDate); } catch (Exception e) { request.setAttribute("result", "failure"); request.setAttribute("tip", "结束时间格式不对!"); return; } } if (date1 != null && date2 != null) { if (date2.before(date1)) { request.setAttribute("result", "failure"); request.setAttribute("tip", "结束时间必须在开始时间之后!"); return; } } //拼装查询条件 StringBuffer condition=new StringBuffer(); if(startDate!=null){ condition.append(" and sc.create_datetime>='"); condition.append(startDate); condition.append("'"); request.setAttribute("startDate", startDate); } if(endDate!=null){ condition.append(" and sc.create_datetime<='"); condition.append(endDate); condition.append("'"); request.setAttribute("endDate", endDate); } if(proxy>0){ condition.append(" and d.id="+proxy); } if(parentId1>0){ condition.append(" and p.parent_id1="+parentId1); request.setAttribute("parentId1", ""+parentId1); } if(parentId2>0){ condition.append(" and p.parent_id2="+parentId2); request.setAttribute("parentId2", ""+parentId2); } //开启数据库连接 DbOperation dbOp = new DbOperation(); IProductStockService psService = ServiceFactory.createProductStockService(IBaseService.CONN_IN_SERVICE, null); dbOp.init("adult_slave2"); List dpproductList = new ArrayList(); String query="select sc.product_id,p.code,p.oriname,sc.stock_in_count,sc.stock_out_count,sc.create_datetime,sc.stock_price,sc.card_type from stock_card sc join product p on sc.product_id=p.id" +(proxy>0?" join product_supplier c on p.id=c.product_id join supplier_standard_info d on d.id=c.supplier_id":"") +" where sc.card_type in (1,2,5)" +condition +" order by create_datetime desc"; ResultSet rs = dbOp.executeQuery(query); try{ HashMap dppMap=new HashMap(); while(rs.next()){ int productId=rs.getInt(1); String productCode=rs.getString(2); String productName=rs.getString(3); int stockInCount=rs.getInt(4); int stockOutCount=rs.getInt(5); String createDatetime=rs.getString(6); float stockPrice=rs.getFloat(7);//库存单价 int cardType=rs.getInt(8);//进销存卡片类型 if(dppMap.get(productId+"")==null){ DpproductStatBean bean = new DpproductStatBean(); bean.setProductId(productId);//商品ID bean.setCode(productCode);//编号 bean.setName(productName);//名称 if(cardType==1){//采购入库 bean.setOutCount(0);//销量 bean.setStockinCount(stockInCount);//采购入库量 bean.setOutReturnCount(0);//销量退货量 }else if(cardType==2){//销售出库 bean.setOutCount(stockOutCount);//销量 bean.setStockinCount(0);//采购入库量 bean.setOutReturnCount(0);//销量退货量 }else if(cardType==5){//销售退货入库 bean.setOutCount(0);//销量 bean.setStockinCount(0);//采购入库量 bean.setOutReturnCount(stockInCount);//销量退货量 } bean.setLastTime(createDatetime);//产品最近出货时间 bean.setPrice5(stockPrice); bean.setFrequencyCount(1); dpproductList.add(bean); dppMap.put(productId+"", bean); }else{ DpproductStatBean bean = (DpproductStatBean)dppMap.get(productId+""); if(cardType==1){//采购入库 bean.setStockinCount(bean.getStockinCount()+stockInCount);//采购入库量 }else if(cardType==2){//销售出库 bean.setOutCount(bean.getOutCount()+stockOutCount);//销量 }else if(cardType==5){//销售退货入库 bean.setOutReturnCount(bean.getOutReturnCount()+stockInCount);//销量退货量 } bean.setFrequencyCount(bean.getFrequencyCount()+1); } } request.setAttribute("count", ""+dpproductList.size()); //关联各个库存数量 Iterator iter = dpproductList.listIterator(); while(iter.hasNext()){ DpproductStatBean dpproductStat = (DpproductStatBean)iter.next(); dpproductStat.setPsList(psService.getProductStockList("product_id=" + dpproductStat.getProductId(), -1, -1, null)); } }catch(Exception e){ e.printStackTrace(); }finally { dbOp.release();//释放所有资源 psService.releaseAll(); } ComparatorDpproductStat comparator = new ComparatorDpproductStat(); Collections.sort(dpproductList,comparator); //按照动碰频率排序 request.setAttribute("dpproductList", dpproductList); } }
13,136
0.661649
0.646031
327
35.987766
27.489
194
false
false
0
0
0
0
0
0
3.755352
false
false
10
0171f92929c56c7c1b9566acfeb00c38ed29a6eb
38,774,964,779,927
9c9a27384482236a5d1a7b14285e34889c6692c9
/ExamenServlet/src/java/Controlador/ControlLogin.java
62278a8fe445558fc3d823a21707b810a7511af8
[]
no_license
Josan45/NetBeansProjects
https://github.com/Josan45/NetBeansProjects
8f1b7b25ec373fe296c23cabba556ab3889a6125
a7c38bed45e23da68ba8811b3129cefb3a4e5ef9
refs/heads/master
2020-08-03T16:36:46.370000
2020-02-05T08:50:22
2020-02-05T08:50:22
211,815,365
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Controlador; import com.sun.corba.se.spi.protocol.RequestDispatcherDefault; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class ControlLogin extends HttpServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServletContext contexto=request.getServletContext(); RequestDispatcher rd; String usuario=request.getParameter("usuario"); String pass=request.getParameter("pass"); String[] letras={"T","R","W","A","G","M","Y","F","P","D","X","B","N","J","Z","S","Q","V","H","L","C","K","E"}; String letra=usuario.substring(8,9); String numero=usuario.substring(0,8); boolean dni=true; if(usuario.length()==9){ try{ int num=Integer.parseInt(numero); int letraDNI=num%23; if(letras[letraDNI].equals(letra)){ dni=true; }else{ dni=false; } }catch(NumberFormatException e){ dni=false; } if(dni==true && pass.equals("trebujena")){ rd=contexto.getRequestDispatcher("/Formulario.html"); rd.forward(request, response); }else{ rd=contexto.getRequestDispatcher("/LoginError.html"); rd.forward(request, response); } } } }
UTF-8
Java
1,841
java
ControlLogin.java
Java
[ { "context": " }\n if(dni==true && pass.equals(\"trebujena\")){\n rd=contexto.getRequestDispatc", "end": 1548, "score": 0.9911901354789734, "start": 1539, "tag": "PASSWORD", "value": "trebujena" } ]
null
[]
package Controlador; import com.sun.corba.se.spi.protocol.RequestDispatcherDefault; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class ControlLogin extends HttpServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServletContext contexto=request.getServletContext(); RequestDispatcher rd; String usuario=request.getParameter("usuario"); String pass=request.getParameter("pass"); String[] letras={"T","R","W","A","G","M","Y","F","P","D","X","B","N","J","Z","S","Q","V","H","L","C","K","E"}; String letra=usuario.substring(8,9); String numero=usuario.substring(0,8); boolean dni=true; if(usuario.length()==9){ try{ int num=Integer.parseInt(numero); int letraDNI=num%23; if(letras[letraDNI].equals(letra)){ dni=true; }else{ dni=false; } }catch(NumberFormatException e){ dni=false; } if(dni==true && pass.equals("<PASSWORD>")){ rd=contexto.getRequestDispatcher("/Formulario.html"); rd.forward(request, response); }else{ rd=contexto.getRequestDispatcher("/LoginError.html"); rd.forward(request, response); } } } }
1,842
0.565997
0.562194
54
33.074074
23.146755
118
false
false
0
0
0
0
0
0
1.018519
false
false
10
050a801102023615cc21cde09db4445e2bd9fe14
38,482,906,977,607
2ca14dcd12e8a51c662f15fee51439fba6054779
/Gobang/src/view/BoardPanel.java
f121740140ab0e0a2df72d0e038cd6bd2d78d131
[]
no_license
lzluozheng/java
https://github.com/lzluozheng/java
8e10d3a2b4748f3644a061d2ebb4b844a527060a
e19f2b4c6170ad012d20846c40e0d29a5b5f8d75
refs/heads/master
2023-07-03T00:22:19.837000
2021-08-06T08:52:36
2021-08-06T08:52:36
287,187,356
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package view; import model.ChessGame; import javax.swing.*; import java.awt.*; public class BoardPanel extends JPanel { private ChessGame chessGame; private int i; private int j; public BoardPanel(ChessGame chessGame1) { setBackground(new Color(0xDE, 0xB8, 0x87)); chessGame=chessGame1; } public void setChessGame(ChessGame chessGame1) { this.chessGame=chessGame1; } protected void paintComponent(Graphics g) { super.paintComponent(g); Dimension dimension=getSize(); int num=dimension.height/16; for (int i = 0; i < 15; i++) { g.drawLine(num, num+i*num,15*num, num+i*num); } for (int i = 0; i < 15; i++) { g.drawLine(num+i*num, num, num+i*num, 15*num); } int num2=num/10; g.fillOval(4*num-num2,4*num-num2,2*num2,num2*2); g.fillOval(12*num-num2,4*num-num2,2*num2,num2*2); g.fillOval(4*num-num2,12*num-num2,2*num2,num2*2); g.fillOval(12*num-num2,12*num-num2,2*num2,num2*2); g.fillOval(8*num-num2,8*num-num2,2*num2,num2*2); int [] in; int r=num*2/5; for (int i = 0; i <chessGame.getChessStack().length; i++) { in=chessGame.getChessStack().Getelem(i); if (in[2]==-1) { g.setColor(Color.BLACK); }else { g.setColor(Color.WHITE); } g.fillOval((in[1]-3)*num-r, (in[0]-3)*num-r, 2*r, 2*r); } if (chessGame.getChessStack().length!=0) { in=chessGame.getChessStack().Getelem(chessGame.getChessStack().length-1); g.setColor(Color.RED); g.fillOval((in[1]-3)*num-r/4, (in[0]-3)*num-r/4, r/2, r/2); } } }
UTF-8
Java
1,756
java
BoardPanel.java
Java
[]
null
[]
package view; import model.ChessGame; import javax.swing.*; import java.awt.*; public class BoardPanel extends JPanel { private ChessGame chessGame; private int i; private int j; public BoardPanel(ChessGame chessGame1) { setBackground(new Color(0xDE, 0xB8, 0x87)); chessGame=chessGame1; } public void setChessGame(ChessGame chessGame1) { this.chessGame=chessGame1; } protected void paintComponent(Graphics g) { super.paintComponent(g); Dimension dimension=getSize(); int num=dimension.height/16; for (int i = 0; i < 15; i++) { g.drawLine(num, num+i*num,15*num, num+i*num); } for (int i = 0; i < 15; i++) { g.drawLine(num+i*num, num, num+i*num, 15*num); } int num2=num/10; g.fillOval(4*num-num2,4*num-num2,2*num2,num2*2); g.fillOval(12*num-num2,4*num-num2,2*num2,num2*2); g.fillOval(4*num-num2,12*num-num2,2*num2,num2*2); g.fillOval(12*num-num2,12*num-num2,2*num2,num2*2); g.fillOval(8*num-num2,8*num-num2,2*num2,num2*2); int [] in; int r=num*2/5; for (int i = 0; i <chessGame.getChessStack().length; i++) { in=chessGame.getChessStack().Getelem(i); if (in[2]==-1) { g.setColor(Color.BLACK); }else { g.setColor(Color.WHITE); } g.fillOval((in[1]-3)*num-r, (in[0]-3)*num-r, 2*r, 2*r); } if (chessGame.getChessStack().length!=0) { in=chessGame.getChessStack().Getelem(chessGame.getChessStack().length-1); g.setColor(Color.RED); g.fillOval((in[1]-3)*num-r/4, (in[0]-3)*num-r/4, r/2, r/2); } } }
1,756
0.5541
0.502847
52
32.76923
21.363714
85
false
false
0
0
0
0
0
0
1.25
false
false
10
1587ca6d3499a8a0e57df626a6cb2abb0edb4bb2
35,914,516,554,708
4091f4f6138c19ef1cafb9632d82d8cf8df8b2ba
/src/com/yc/impl/TypeIteminfoDAOImpl.java
3c553416d95cea4ded22c6157c2c413b86874af2
[]
no_license
Alayman-39/Test01
https://github.com/Alayman-39/Test01
bf79efc2ff39fa81af9a19c446da2fc36f45f3fe
035976b37a3b9734f49f59912fe6d9575eaac3d8
refs/heads/master
2020-07-28T17:59:21.011000
2019-09-19T07:40:29
2019-09-19T07:40:29
209,485,571
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yc.impl; import java.util.ArrayList; import java.util.List; import com.yc.commons.DbHelper; import com.yc.dao.TypeItemInfoDAO; import com.yc.po.TypeIteminfoPO; import com.yc.vo.TypeItemVO; public class TypeIteminfoDAOImpl implements TypeItemInfoDAO{ DbHelper db = new DbHelper(); @Override public List<TypeItemVO> findByType(TypeItemVO vo) throws Exception { StringBuffer sb = new StringBuffer(); sb.append(" select t.*,i.* from typeinfo t inner join typeiteminfo i on t.tno=i.tno where i.tno=? "); List<Object> params= null; if(null!=vo){ params = new ArrayList<Object>(); if(null!=vo.getTno()){ params.add(vo.getTno()); sb.append(" and tno = ? "); }else if(null!=vo.getTino()){ params.add(vo.getTino()); sb.append(" and tino = ? "); } } sb.append(" group by tno "); return db.findMutil(sb.toString(), params, TypeItemVO.class); } @Override public List<TypeIteminfoPO> find(TypeIteminfoPO po) throws Exception { StringBuffer sb = new StringBuffer(); sb.append("select gno,gname,tino,price,intro,balance,unit,place,qualityPeriod," + "weight,pics,descr from goodsinfo where 1=1 "); List<Object> params = null; if(null!=po){ params = new ArrayList<Object>(); if(null!=po.getTino()){ params.add(po.getTino()); sb.append(" and tino = ? "); }else if(null!=po.getTname()){ params.add(po.getTname()); sb.append(" and tname = ? "); }else if(null!=po.getTno()){ params.add(po.getTno()); sb.append(" and tno = ? "); }else if(null!=po.getStatus()){ params.add(po.getStatus()); sb.append(" and status = ? "); } } sb.append(" order by tino asc "); return db.findMutil(sb.toString(), params, TypeIteminfoPO.class); } @Override public int addTypeIteminfo(TypeIteminfoPO po) throws Exception { // TODO Auto-generated method stub return 0; } @Override public List<TypeIteminfoPO> findByPage(TypeIteminfoPO po, Integer pageNum, Integer pageSize) throws Exception { // TODO Auto-generated method stub return null; } @Override public int totalPage(TypeIteminfoPO po) throws Exception { // TODO Auto-generated method stub return 0; } }
UTF-8
Java
2,256
java
TypeIteminfoDAOImpl.java
Java
[]
null
[]
package com.yc.impl; import java.util.ArrayList; import java.util.List; import com.yc.commons.DbHelper; import com.yc.dao.TypeItemInfoDAO; import com.yc.po.TypeIteminfoPO; import com.yc.vo.TypeItemVO; public class TypeIteminfoDAOImpl implements TypeItemInfoDAO{ DbHelper db = new DbHelper(); @Override public List<TypeItemVO> findByType(TypeItemVO vo) throws Exception { StringBuffer sb = new StringBuffer(); sb.append(" select t.*,i.* from typeinfo t inner join typeiteminfo i on t.tno=i.tno where i.tno=? "); List<Object> params= null; if(null!=vo){ params = new ArrayList<Object>(); if(null!=vo.getTno()){ params.add(vo.getTno()); sb.append(" and tno = ? "); }else if(null!=vo.getTino()){ params.add(vo.getTino()); sb.append(" and tino = ? "); } } sb.append(" group by tno "); return db.findMutil(sb.toString(), params, TypeItemVO.class); } @Override public List<TypeIteminfoPO> find(TypeIteminfoPO po) throws Exception { StringBuffer sb = new StringBuffer(); sb.append("select gno,gname,tino,price,intro,balance,unit,place,qualityPeriod," + "weight,pics,descr from goodsinfo where 1=1 "); List<Object> params = null; if(null!=po){ params = new ArrayList<Object>(); if(null!=po.getTino()){ params.add(po.getTino()); sb.append(" and tino = ? "); }else if(null!=po.getTname()){ params.add(po.getTname()); sb.append(" and tname = ? "); }else if(null!=po.getTno()){ params.add(po.getTno()); sb.append(" and tno = ? "); }else if(null!=po.getStatus()){ params.add(po.getStatus()); sb.append(" and status = ? "); } } sb.append(" order by tino asc "); return db.findMutil(sb.toString(), params, TypeIteminfoPO.class); } @Override public int addTypeIteminfo(TypeIteminfoPO po) throws Exception { // TODO Auto-generated method stub return 0; } @Override public List<TypeIteminfoPO> findByPage(TypeIteminfoPO po, Integer pageNum, Integer pageSize) throws Exception { // TODO Auto-generated method stub return null; } @Override public int totalPage(TypeIteminfoPO po) throws Exception { // TODO Auto-generated method stub return 0; } }
2,256
0.654255
0.652482
77
27.298702
23.648983
112
false
false
0
0
0
0
0
0
2.51948
false
false
10
d8491a9365fc39a89df6ff6fb02ee1070c9d0695
38,534,446,589,101
46178a1fe88b58118ff9a1e1c8c8d11a66094aac
/core/src/main/java/org/iottree/biz/client/form/IFormInvoker.java
b822300e49c9024dd4bc2be86bace57306aa53e1
[]
no_license
jasonzhu8888/iot-tree
https://github.com/jasonzhu8888/iot-tree
438370701c22bb3e10eb1d69dec2aa4536b9b37c
cf0a8321196489f339d9de3ed1451c9a8dd751be
refs/heads/master
2020-05-31T22:24:38.853000
2020-04-25T02:06:52
2020-04-25T02:06:52
190,515,663
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.iottree.biz.client.form; import java.util.*; /** * 为ToolAgent对应的应用实现应用表单支持所必须的实现接口 * 该实现比IAppInvoker更加严格,并且要求和工作流服务器配合的更加严密 * 对应IAppInvoker的实现,应用可以不用考虑WorkItem的保存——只需要使用它来定位到特定的调用 * 而IFormInvoker则需要考虑保存工作流服务器提供的很多参数 * 比如 * 1,同一个Form会在相同的流程中被调用多次,每次调用都需要IFrormInvoker的实现对其进行保存,每次调用都必须和WorkItem对应。 * 2,每个流程实例最终会产生一个或多个Form的内容实例,这些Form的实例必须和流程的实例对应。 * 3,流程能够提取Form控制项的任何信息作为流程实例的相关数据 * 4,IFormInvoker甚至提供动态定制表单接口,可以为工作流服务器提供动态创建并定制表单的能力 * 5,IFormInvoker可以通过接口,在完成一个工作项时通知工作流服务器——待定,是否可以通过工作流服务器定时查找状态(这样做效率偏低) * * @author Jason Zhu */ public interface IFormInvoker { public String getFormId(); public String getFormName(); public String getFormDesc(); /** * * @param default_ctrl * @param readctrls * @param writectrls */ public void OnInvoker(String default_ctrl,List<String> readctrls,List<String> writectrls); //public void }
GB18030
Java
1,558
java
IFormInvoker.java
Java
[ { "context": "器——待定,是否可以通过工作流服务器定时查找状态(这样做效率偏低)\r\n * \r\n * @author Jason Zhu\r\n */\r\npublic interface IFormInvoker\r\n{\r\n\t\r\n\tpubli", "end": 576, "score": 0.9988454580307007, "start": 567, "tag": "NAME", "value": "Jason Zhu" } ]
null
[]
package org.iottree.biz.client.form; import java.util.*; /** * 为ToolAgent对应的应用实现应用表单支持所必须的实现接口 * 该实现比IAppInvoker更加严格,并且要求和工作流服务器配合的更加严密 * 对应IAppInvoker的实现,应用可以不用考虑WorkItem的保存——只需要使用它来定位到特定的调用 * 而IFormInvoker则需要考虑保存工作流服务器提供的很多参数 * 比如 * 1,同一个Form会在相同的流程中被调用多次,每次调用都需要IFrormInvoker的实现对其进行保存,每次调用都必须和WorkItem对应。 * 2,每个流程实例最终会产生一个或多个Form的内容实例,这些Form的实例必须和流程的实例对应。 * 3,流程能够提取Form控制项的任何信息作为流程实例的相关数据 * 4,IFormInvoker甚至提供动态定制表单接口,可以为工作流服务器提供动态创建并定制表单的能力 * 5,IFormInvoker可以通过接口,在完成一个工作项时通知工作流服务器——待定,是否可以通过工作流服务器定时查找状态(这样做效率偏低) * * @author <NAME> */ public interface IFormInvoker { public String getFormId(); public String getFormName(); public String getFormDesc(); /** * * @param default_ctrl * @param readctrls * @param writectrls */ public void OnInvoker(String default_ctrl,List<String> readctrls,List<String> writectrls); //public void }
1,555
0.736111
0.730769
41
20.829268
23.619858
91
false
false
0
0
0
0
0
0
0.707317
false
false
10
726b2e1f009351a58b79a4c3929e8c36b5589882
28,647,431,926,804
45f722b2a0631eff4386b01aacfe150354770e02
/kankna-web/src/main/java/com/kankan/oauth/action/UserLoginAction.java
05677f5ead1fce1aa840dcf58c1c03fecf996424
[]
no_license
mupengfei/KankanUMS
https://github.com/mupengfei/KankanUMS
5b5d9edc96b78360b1ee95bc4127f45f03a1430b
0e09c2389419f834fe70106402dfc6076831e48a
refs/heads/master
2020-02-04T18:48:36.435000
2020-01-04T07:09:28
2020-01-04T07:09:28
40,467,917
0
0
null
false
2019-12-12T09:12:48
2015-08-10T06:58:32
2019-12-12T09:11:58
2019-12-12T09:12:47
57,656
0
0
10
Java
false
false
package com.kankan.oauth.action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import weibo4j.model.WeiboException; import com.kankan.core.util.JacksonUtil; import com.kankan.core.util.MessageDigestSecurity; import com.kankan.oauth.account.AccountInfo; import com.kankan.oauth.account.Credential; import com.kankan.oauth.exception.KanKanException; import com.kankan.oauth.model.KanKanUser; import com.kankan.oauth.service.KanKanUserInfoService; import com.kankan.oauth.service.KanKanUserService; import com.kankan.oauth.service.OAuth2Service; import com.qq.connect.QQConnectException; import com.qq.connect.api.OpenID; import com.qq.connect.api.qzone.UserInfo; import com.qq.connect.javabeans.AccessToken; import com.qq.connect.javabeans.qzone.UserInfoBean; @Controller public class UserLoginAction { Logger logger = Logger.getLogger(OAuth2Action.class); @Autowired private MessageDigestSecurity MD5Security; @Autowired private OAuth2Service oAuth2Service; @Autowired private KanKanUserInfoService kanKanUserInfoService; @Autowired private KanKanUserService kanKanUserService; @RequestMapping("/user/login") public ModelAndView authorize(String username, String password, HttpSession session) throws Exception { KanKanUser user = kanKanUserService.getKanKanUserByUserName(username); if (user == null || !user.getKk_passWord().equals(MD5Security.encode(password))) { // 錯誤頁面 logger.info("錯誤頁面"); return null; } Credential credential = (Credential) session.getAttribute("Credential"); credential = oAuth2Service.creatNewCredential(user, credential); return new ModelAndView("redirect:/oauth2/loginRedirect.do"); } @RequestMapping("/user/QQlogin") public void qqLogin(HttpServletRequest request, HttpServletResponse response) throws Exception { response.setContentType("text/html;charset=utf-8"); try { response.sendRedirect(new com.qq.connect.oauth.Oauth() .getAuthorizeURL(request)); } catch (QQConnectException e) { e.printStackTrace(); } } @RequestMapping("/user/qqafterlogin") public ModelAndView qqAfterlogin(HttpServletRequest request, HttpServletResponse response, HttpSession session) throws Exception { logger.info("qqafterlogin"); AccessToken accessTokenObj = (new com.qq.connect.oauth.Oauth()) .getAccessTokenByRequest(request); String accessToken = null, openID = null; if (accessTokenObj.getAccessToken().equals("")) { throw new KanKanException(-1, "Token 失效"); } accessToken = accessTokenObj.getAccessToken(); OpenID openIDObj = new OpenID(accessToken); openID = openIDObj.getUserOpenID(); UserInfo qzoneUserInfo = new UserInfo(accessToken, openID); UserInfoBean userInfoBean = qzoneUserInfo.getUserInfo(); logger.info("userInfoBean=" + userInfoBean.getNickname()); AccountInfo info = new AccountInfo(); info.setType("QQ"); info.setAccessToken(accessToken); info.setOpenId(openID); info.setUsername(userInfoBean.getNickname()); info.setAvatar(userInfoBean.getAvatar().getAvatarURL100()); return afterLogin(info, session); } @RequestMapping("/user/Sinalogin") public String sinalogin(HttpServletRequest request, HttpServletResponse response) throws Exception { try { weibo4j.Oauth oauth = new weibo4j.Oauth(); response.sendRedirect(oauth.authorize("code")); // 重定向到新浪授权页面 } catch (Exception e) { e.printStackTrace(); } return null; } @RequestMapping("/user/sinaAfterlogin") public ModelAndView sinaAfterlogin(HttpServletRequest request, HttpServletResponse response, HttpSession session) throws KanKanException, WeiboException { String openID = null; String code = request.getParameter("code"); if (code != null) { weibo4j.Oauth oauth = new weibo4j.Oauth(); weibo4j.http.AccessToken accessToken = oauth .getAccessTokenByCode(code); if (accessToken != null) { openID = accessToken.getUid(); weibo4j.Users users = new weibo4j.Users( accessToken.getAccessToken()); weibo4j.model.User user = users.showUserById(openID); AccountInfo info = new AccountInfo(); info.setType("SINA"); info.setAccessToken(accessToken.getAccessToken()); info.setOpenId(openID); info.setUsername(user.getName()); info.setAvatar(user.getAvatarLarge()); return afterLogin(info, session); } } return null; } private ModelAndView afterLogin(AccountInfo info, HttpSession session) throws KanKanException { KanKanUser kk_user = kanKanUserService.creatAndGetKanKanUser( info.getType(), info.getOpenId(), info.getAccessToken(), JacksonUtil.toString(info)); Credential credential = (Credential) session.getAttribute("Credential"); credential = oAuth2Service.creatNewCredential(kk_user, credential); return new ModelAndView("redirect:/oauth2/loginRedirect.do"); } }
UTF-8
Java
5,192
java
UserLoginAction.java
Java
[ { "context": "\n\t\t\t\tinfo.setOpenId(openID);\n\t\t\t\tinfo.setUsername(user.getName());\n\t\t\t\tinfo.setAvatar(user.getAvatarLarg", "end": 4555, "score": 0.9007904529571533, "start": 4551, "tag": "USERNAME", "value": "user" }, { "context": "info.setOpenId(openID);\n\t\t\t\tinfo.setUsername(user.getName());\n\t\t\t\tinfo.setAvatar(user.getAvatarLarge());\n\t\t", "end": 4563, "score": 0.6943104267120361, "start": 4556, "tag": "USERNAME", "value": "getName" } ]
null
[]
package com.kankan.oauth.action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import weibo4j.model.WeiboException; import com.kankan.core.util.JacksonUtil; import com.kankan.core.util.MessageDigestSecurity; import com.kankan.oauth.account.AccountInfo; import com.kankan.oauth.account.Credential; import com.kankan.oauth.exception.KanKanException; import com.kankan.oauth.model.KanKanUser; import com.kankan.oauth.service.KanKanUserInfoService; import com.kankan.oauth.service.KanKanUserService; import com.kankan.oauth.service.OAuth2Service; import com.qq.connect.QQConnectException; import com.qq.connect.api.OpenID; import com.qq.connect.api.qzone.UserInfo; import com.qq.connect.javabeans.AccessToken; import com.qq.connect.javabeans.qzone.UserInfoBean; @Controller public class UserLoginAction { Logger logger = Logger.getLogger(OAuth2Action.class); @Autowired private MessageDigestSecurity MD5Security; @Autowired private OAuth2Service oAuth2Service; @Autowired private KanKanUserInfoService kanKanUserInfoService; @Autowired private KanKanUserService kanKanUserService; @RequestMapping("/user/login") public ModelAndView authorize(String username, String password, HttpSession session) throws Exception { KanKanUser user = kanKanUserService.getKanKanUserByUserName(username); if (user == null || !user.getKk_passWord().equals(MD5Security.encode(password))) { // 錯誤頁面 logger.info("錯誤頁面"); return null; } Credential credential = (Credential) session.getAttribute("Credential"); credential = oAuth2Service.creatNewCredential(user, credential); return new ModelAndView("redirect:/oauth2/loginRedirect.do"); } @RequestMapping("/user/QQlogin") public void qqLogin(HttpServletRequest request, HttpServletResponse response) throws Exception { response.setContentType("text/html;charset=utf-8"); try { response.sendRedirect(new com.qq.connect.oauth.Oauth() .getAuthorizeURL(request)); } catch (QQConnectException e) { e.printStackTrace(); } } @RequestMapping("/user/qqafterlogin") public ModelAndView qqAfterlogin(HttpServletRequest request, HttpServletResponse response, HttpSession session) throws Exception { logger.info("qqafterlogin"); AccessToken accessTokenObj = (new com.qq.connect.oauth.Oauth()) .getAccessTokenByRequest(request); String accessToken = null, openID = null; if (accessTokenObj.getAccessToken().equals("")) { throw new KanKanException(-1, "Token 失效"); } accessToken = accessTokenObj.getAccessToken(); OpenID openIDObj = new OpenID(accessToken); openID = openIDObj.getUserOpenID(); UserInfo qzoneUserInfo = new UserInfo(accessToken, openID); UserInfoBean userInfoBean = qzoneUserInfo.getUserInfo(); logger.info("userInfoBean=" + userInfoBean.getNickname()); AccountInfo info = new AccountInfo(); info.setType("QQ"); info.setAccessToken(accessToken); info.setOpenId(openID); info.setUsername(userInfoBean.getNickname()); info.setAvatar(userInfoBean.getAvatar().getAvatarURL100()); return afterLogin(info, session); } @RequestMapping("/user/Sinalogin") public String sinalogin(HttpServletRequest request, HttpServletResponse response) throws Exception { try { weibo4j.Oauth oauth = new weibo4j.Oauth(); response.sendRedirect(oauth.authorize("code")); // 重定向到新浪授权页面 } catch (Exception e) { e.printStackTrace(); } return null; } @RequestMapping("/user/sinaAfterlogin") public ModelAndView sinaAfterlogin(HttpServletRequest request, HttpServletResponse response, HttpSession session) throws KanKanException, WeiboException { String openID = null; String code = request.getParameter("code"); if (code != null) { weibo4j.Oauth oauth = new weibo4j.Oauth(); weibo4j.http.AccessToken accessToken = oauth .getAccessTokenByCode(code); if (accessToken != null) { openID = accessToken.getUid(); weibo4j.Users users = new weibo4j.Users( accessToken.getAccessToken()); weibo4j.model.User user = users.showUserById(openID); AccountInfo info = new AccountInfo(); info.setType("SINA"); info.setAccessToken(accessToken.getAccessToken()); info.setOpenId(openID); info.setUsername(user.getName()); info.setAvatar(user.getAvatarLarge()); return afterLogin(info, session); } } return null; } private ModelAndView afterLogin(AccountInfo info, HttpSession session) throws KanKanException { KanKanUser kk_user = kanKanUserService.creatAndGetKanKanUser( info.getType(), info.getOpenId(), info.getAccessToken(), JacksonUtil.toString(info)); Credential credential = (Credential) session.getAttribute("Credential"); credential = oAuth2Service.creatNewCredential(kk_user, credential); return new ModelAndView("redirect:/oauth2/loginRedirect.do"); } }
5,192
0.769604
0.764752
157
31.815287
23.005903
78
false
false
0
0
0
0
0
0
2.171974
false
false
10
f9c22bcc1c64b32acbf156e73f2153008d457cf7
34,711,925,729,196
f45e01fb68e312830523773413629ea9d6d88932
/src/JDBCworking/result_statement.java
5f62f84664b56f5fb39079d83c9ffa5a273c8810
[]
no_license
garganish/swings_JDBC
https://github.com/garganish/swings_JDBC
6e973cb8f0ab273754543b996d45074d4fe53757
ea22b7bcf8c6ef0b2febe191db3d7b5fb02c48d3
refs/heads/master
2020-03-20T06:09:38.439000
2018-06-13T16:21:10
2018-06-13T16:21:10
137,240,795
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 JDBCworking; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.util.Scanner; public class result_statement { public static void main(String[] args) { Connection cc=null; try { Class.forName("com.mysql.jdbc.Driver"); String db_url="jdbc:mysql://192.168.64.2:3306/anish_working1"; String db_user=""; String db_pwd=""; cc=DriverManager.getConnection(db_url, db_user, db_pwd); String query="select courseid,coursename,coursefee"; query+=" from courses"; Statement smt=cc.createStatement(); //PreparedStatement smt=cc.prepareStatement(query); ResultSet res=smt.executeQuery(query); ResultSetMetaData meta=res.getMetaData(); for(int i=1;i<=meta.getColumnCount();i++) { System.out.println(meta.getColumnName(i) +"\t"); } System.out.println(" "); if(res.next()) { do { System.out.println(res.getString(1)+"\t\t"+res.getString("coursename")+"\t\t\t\t"+res.getString(3)); }while(res.next()); } else { System.out.println("there is no record present"); } res.close(); smt.close(); }catch(ClassNotFoundException | SQLException ex) { System.out.println(ex); } finally { try { if(cc!=null) { cc.close(); } }catch(SQLException ex) { System.out.println(ex); } } } }
UTF-8
Java
2,177
java
result_statement.java
Java
[ { "context": "Driver\");\n String db_url=\"jdbc:mysql://192.168.64.2:3306/anish_working1\";\n String db_user=", "end": 692, "score": 0.9995978474617004, "start": 680, "tag": "IP_ADDRESS", "value": "192.168.64.2" } ]
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 JDBCworking; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.util.Scanner; public class result_statement { public static void main(String[] args) { Connection cc=null; try { Class.forName("com.mysql.jdbc.Driver"); String db_url="jdbc:mysql://192.168.64.2:3306/anish_working1"; String db_user=""; String db_pwd=""; cc=DriverManager.getConnection(db_url, db_user, db_pwd); String query="select courseid,coursename,coursefee"; query+=" from courses"; Statement smt=cc.createStatement(); //PreparedStatement smt=cc.prepareStatement(query); ResultSet res=smt.executeQuery(query); ResultSetMetaData meta=res.getMetaData(); for(int i=1;i<=meta.getColumnCount();i++) { System.out.println(meta.getColumnName(i) +"\t"); } System.out.println(" "); if(res.next()) { do { System.out.println(res.getString(1)+"\t\t"+res.getString("coursename")+"\t\t\t\t"+res.getString(3)); }while(res.next()); } else { System.out.println("there is no record present"); } res.close(); smt.close(); }catch(ClassNotFoundException | SQLException ex) { System.out.println(ex); } finally { try { if(cc!=null) { cc.close(); } }catch(SQLException ex) { System.out.println(ex); } } } }
2,177
0.515388
0.507579
75
28.026667
22.260862
118
false
false
0
0
0
0
0
0
0.546667
false
false
10