hexsha
stringlengths
40
40
size
int64
3
1.05M
ext
stringclasses
1 value
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
5
1.02k
max_stars_repo_name
stringlengths
4
126
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
list
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
5
1.02k
max_issues_repo_name
stringlengths
4
114
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
list
max_issues_count
float64
1
92.2k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
5
1.02k
max_forks_repo_name
stringlengths
4
136
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
list
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
avg_line_length
float64
2.55
99.9
max_line_length
int64
3
1k
alphanum_fraction
float64
0.25
1
index
int64
0
1M
content
stringlengths
3
1.05M
923dfced3b533dd7fdc863add5989ea3c252b1a7
3,331
java
Java
deps/java/src/main/java/com/antgroup/antchain/openapi/deps/models/BatchqueryMachinegroupProgressRequest.java
alipay/antchain-openapi-prod-sdk
f78549e5135d91756093bd88d191ca260b28e083
[ "MIT" ]
6
2020-06-28T06:40:50.000Z
2022-02-25T11:02:18.000Z
deps/java/src/main/java/com/antgroup/antchain/openapi/deps/models/BatchqueryMachinegroupProgressRequest.java
alipay/antchain-openapi-prod-sdk
f78549e5135d91756093bd88d191ca260b28e083
[ "MIT" ]
null
null
null
deps/java/src/main/java/com/antgroup/antchain/openapi/deps/models/BatchqueryMachinegroupProgressRequest.java
alipay/antchain-openapi-prod-sdk
f78549e5135d91756093bd88d191ca260b28e083
[ "MIT" ]
6
2020-06-30T09:29:03.000Z
2022-01-07T10:42:22.000Z
25.234848
110
0.667667
1,000,569
// This file is auto-generated, don't edit it. Thanks. package com.antgroup.antchain.openapi.deps.models; import com.aliyun.tea.*; public class BatchqueryMachinegroupProgressRequest extends TeaModel { @NameInMap("auth_token") public String authToken; @NameInMap("tenant") public String tenant; // 当前页,默认 1 @NameInMap("page_no") public Long pageNo; // 分页大小,默认 20 @NameInMap("page_size") public Long pageSize; // 父节点 ID @NameInMap("parent_id") public String parentId; // 发布单 ID @NameInMap("plan_id") public String planId; // 发布进程 ID @NameInMap("process_definition_id") public String processDefinitionId; // 发布服务 ID @NameInMap("service_id") public String serviceId; // 状态 @NameInMap("state") public String state; // workspace @NameInMap("workspace") @Validation(required = true) public String workspace; public static BatchqueryMachinegroupProgressRequest build(java.util.Map<String, ?> map) throws Exception { BatchqueryMachinegroupProgressRequest self = new BatchqueryMachinegroupProgressRequest(); return TeaModel.build(map, self); } public BatchqueryMachinegroupProgressRequest setAuthToken(String authToken) { this.authToken = authToken; return this; } public String getAuthToken() { return this.authToken; } public BatchqueryMachinegroupProgressRequest setTenant(String tenant) { this.tenant = tenant; return this; } public String getTenant() { return this.tenant; } public BatchqueryMachinegroupProgressRequest setPageNo(Long pageNo) { this.pageNo = pageNo; return this; } public Long getPageNo() { return this.pageNo; } public BatchqueryMachinegroupProgressRequest setPageSize(Long pageSize) { this.pageSize = pageSize; return this; } public Long getPageSize() { return this.pageSize; } public BatchqueryMachinegroupProgressRequest setParentId(String parentId) { this.parentId = parentId; return this; } public String getParentId() { return this.parentId; } public BatchqueryMachinegroupProgressRequest setPlanId(String planId) { this.planId = planId; return this; } public String getPlanId() { return this.planId; } public BatchqueryMachinegroupProgressRequest setProcessDefinitionId(String processDefinitionId) { this.processDefinitionId = processDefinitionId; return this; } public String getProcessDefinitionId() { return this.processDefinitionId; } public BatchqueryMachinegroupProgressRequest setServiceId(String serviceId) { this.serviceId = serviceId; return this; } public String getServiceId() { return this.serviceId; } public BatchqueryMachinegroupProgressRequest setState(String state) { this.state = state; return this; } public String getState() { return this.state; } public BatchqueryMachinegroupProgressRequest setWorkspace(String workspace) { this.workspace = workspace; return this; } public String getWorkspace() { return this.workspace; } }
923dfd06a9b122c9e16a25bbf84ea296193a2d1b
1,041
java
Java
notifier/src/main/java/com/example/presentation/websocket/WebSocketNotifier.java
Fintan-contents/example-chat
f1285cd5bf1af50a80d6660f0be927fc33f64d37
[ "Apache-2.0" ]
8
2021-02-16T08:57:24.000Z
2022-02-07T06:09:40.000Z
notifier/src/main/java/com/example/presentation/websocket/WebSocketNotifier.java
Fintan-contents/example-chat
f1285cd5bf1af50a80d6660f0be927fc33f64d37
[ "Apache-2.0" ]
null
null
null
notifier/src/main/java/com/example/presentation/websocket/WebSocketNotifier.java
Fintan-contents/example-chat
f1285cd5bf1af50a80d6660f0be927fc33f64d37
[ "Apache-2.0" ]
3
2022-01-25T02:59:56.000Z
2022-02-27T20:11:40.000Z
25.390244
84
0.68684
1,000,570
package com.example.presentation.websocket; import java.io.IOException; import javax.websocket.Session; import com.example.domain.model.AccountId; import com.example.domain.model.Payload; import com.example.system.nablarch.handler.Notifier; import nablarch.core.log.Logger; import nablarch.core.log.LoggerManager; public class WebSocketNotifier implements Notifier { private static final Logger LOGGER = LoggerManager.get(WebSocketNotifier.class); private final Session session; private final AccountId accountId; public WebSocketNotifier(Session session, AccountId accountId) { this.session = session; this.accountId = accountId; } @Override public void notify(Payload payload) { try { session.getBasicRemote().sendText(payload.value()); } catch (IOException e) { if (LOGGER.isWarnEnabled()) { LOGGER.logWarn("Notify failure", e); } } } public AccountId accountId() { return accountId; } }
923dfdfb7818a9ce6d2a9824b434f2cf45884afb
8,528
java
Java
Quiz/app/src/main/java/com/example/quiz/MainActivity.java
harshitjain1371999/Assignment_3
5955747aa64cad3174913e9fe987da8b06b48129
[ "MIT" ]
null
null
null
Quiz/app/src/main/java/com/example/quiz/MainActivity.java
harshitjain1371999/Assignment_3
5955747aa64cad3174913e9fe987da8b06b48129
[ "MIT" ]
null
null
null
Quiz/app/src/main/java/com/example/quiz/MainActivity.java
harshitjain1371999/Assignment_3
5955747aa64cad3174913e9fe987da8b06b48129
[ "MIT" ]
null
null
null
35.09465
121
0.524508
1,000,571
package com.example.quiz; import android.graphics.Color; import android.os.CountDownTimer; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.content.Intent; import android.view.View; import android.widget.Button; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; import android.widget.Toast; import com.github.nkzawa.socketio.client.IO; import com.github.nkzawa.socketio.client.Socket; import com.github.nkzawa.emitter.Emitter; import org.json.JSONException; import org.json.JSONObject; import org.w3c.dom.Text; import java.net.URISyntaxException; import java.util.List; import java.util.Timer; import java.util.TimerTask; import static java.lang.Thread.sleep; public class MainActivity extends AppCompatActivity { List<Question> quesList; static int score=0; static int score_p2=0; int counter=10; boolean stop=false; boolean nextQuestion=false; boolean clicked=false; int qid=0; Question currentQ; TextView txtQuestion; static TextView level,user_1,user_2,score_1,score_2,time; TextView rda, rdb, rdc, rdd; String p1, p2; Intent intent1; JSONObject data; int index; String correct_answer; private Socket socket; private void setQuestionView() { runOnUiThread(new Runnable() { @Override public void run() { if (qid % 5 == 0) { int l = qid/5 + 1; level.setText("Level " + l); } currentQ = quesList.get(qid); rda.setBackgroundResource(R.drawable.textview_border); rdb.setBackgroundResource(R.drawable.textview_border); rdc.setBackgroundResource(R.drawable.textview_border); rdd.setBackgroundResource(R.drawable.textview_border); txtQuestion.setText(currentQ.getQUESTION()); rda.setText(currentQ.getOPTA()); rdb.setText(currentQ.getOPTB()); rdc.setText(currentQ.getOPTC()); rdd.setText(currentQ.getOPTD()); qid++; clicked=false; counter=10; } }); } @Override protected void onCreate(Bundle savedInstanceState) { p1 = MainScreen.text; p2 = loading.p2; index = loading.serverindex; super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); DatabaseCreate db = new DatabaseCreate(this); intent1=new Intent(MainActivity.this,SongService.class); quesList = db.getAllQuestions(); currentQ = quesList.get(qid); txtQuestion = (TextView) findViewById(R.id.question); level = (TextView) findViewById(R.id.level); user_1 = (TextView) findViewById(R.id.user_1); time = (TextView) findViewById(R.id.time); score_2 = (TextView) findViewById(R.id.score_2); user_2 = (TextView) findViewById(R.id.user_2); score_1 = (TextView) findViewById(R.id.score_1); rda = (TextView) findViewById(R.id.option_1); rdb = (TextView) findViewById(R.id.option_2); rdc = (TextView) findViewById(R.id.option_3); rdd = (TextView) findViewById(R.id.option_4); try { socket = IO.socket("http://10.42.0.1:3000"); socket.connect(); } catch (URISyntaxException e) { e.printStackTrace(); } user_1.setText(p1); user_2.setText(p2); setQuestionView(); String name = "Level 1"; level.setText(name); score_1.setText(String.valueOf(score)); startService(intent1); final Thread thread_1=new Thread(new Runnable() { @Override public void run() { counter=10; while(!Thread.currentThread().isInterrupted()&&!stop) { runOnUiThread(new Runnable() { @Override public void run() { time.setText(String.valueOf(counter)); } }); if (!clicked) counter--; if (counter == 1) socket.emit("updateResult", score, p1, index); try { sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } }); thread_1.start(); thread_3.start(); socket.on("update", new Emitter.Listener() { @Override public void call(Object... args) { nextQuestion=true; data = (JSONObject)args[0]; runOnUiThread(new Runnable() { @Override public void run() { try { score_2.setText(String.valueOf(data.get(p2))); } catch (JSONException e) { e.printStackTrace(); } } }); } }); socket.on("userdisconnect", new Emitter.Listener() { @Override public void call(Object... args) { runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(MainActivity.this, "The other user has left the game", Toast.LENGTH_SHORT).show(); Intent i1 = new Intent(MainActivity.this, mode.class); startActivity(i1); } }); } }); } Thread thread_3 = new Thread(new Runnable() { @Override public void run() { try{ while(true) { while (nextQuestion) { sleep(1000); System.out.println("Inside next question, qid: " + qid); if (qid < 20) { setQuestionView(); } else { exitmulti.result = score; exitmulti.score_2=Integer.valueOf(score_2.getText().toString()); stopService(intent1); Intent i1 = new Intent(MainActivity.this, exitmulti.class); startActivity(i1); } nextQuestion = false; } } } catch (Exception e){ e.printStackTrace(); } } }); public void click_handler(View v) { try { if (!clicked) { TextView selected_option = (TextView) v; score = Integer.valueOf(score_1.getText().toString()); if (currentQ.getANSWER().equals(selected_option.getText())) { selected_option.setBackgroundResource(R.drawable.greentextview); score = score + 10 + counter; score_1.setText(String.valueOf(score)); } else { selected_option.setBackgroundResource(R.drawable.redtextview); if (rda.getText().equals(currentQ.getANSWER())) rda.setBackgroundResource(R.drawable.greentextview); else if (rdb.getText().equals(currentQ.getANSWER())) rdb.setBackgroundResource(R.drawable.greentextview); else if (rdc.getText().equals(currentQ.getANSWER())) rdc.setBackgroundResource(R.drawable.greentextview); else rdd.setBackgroundResource(R.drawable.greentextview); } socket.emit("updateResult", score, p1, index); clicked=true; } } catch (Exception e) { e.printStackTrace(); } } @Override protected void onDestroy() { exitmulti.result = score; exitmulti.score_2=Integer.valueOf(score_2.getText().toString()); super.onDestroy(); stopService(intent1); socket.emit("beforedisconnect", index); socket.disconnect(); } }
923dfe8d515e2c3dcbe952313e78128cd11efe0e
439
java
Java
src/main/java/com/xpeppers/salestaxes/property/Property.java
paolomontana/sales-taxes-problem
bacfb0bdfc02b4430e73ee16aba75cef19f18c36
[ "Unlicense" ]
null
null
null
src/main/java/com/xpeppers/salestaxes/property/Property.java
paolomontana/sales-taxes-problem
bacfb0bdfc02b4430e73ee16aba75cef19f18c36
[ "Unlicense" ]
null
null
null
src/main/java/com/xpeppers/salestaxes/property/Property.java
paolomontana/sales-taxes-problem
bacfb0bdfc02b4430e73ee16aba75cef19f18c36
[ "Unlicense" ]
null
null
null
19.086957
75
0.715262
1,000,572
package com.xpeppers.salestaxes.property; import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "tax") public class Property { private int basic; private int duty; public int getBasic() { return basic; } public int getDuty() { return duty; } public void setDuty(int duty) { this.duty = duty; } public void setBasic(int basic) { this.basic = basic; } }
923dfefada962d5240b586ee9fcfdb34d42de5c6
3,377
java
Java
roj/kscript/parser/expr/Chained.java
roj234/rojlib
670fb138a212e072e5466f0cf7286162d0159eff
[ "MIT" ]
3
2021-12-11T02:00:38.000Z
2022-02-14T20:29:29.000Z
roj/kscript/parser/expr/Chained.java
roj234/rojlib
670fb138a212e072e5466f0cf7286162d0159eff
[ "MIT" ]
4
2022-01-31T06:47:55.000Z
2022-02-14T20:20:52.000Z
roj/kscript/parser/expr/Chained.java
roj234/rojlib
670fb138a212e072e5466f0cf7286162d0159eff
[ "MIT" ]
1
2021-11-08T23:39:57.000Z
2021-11-08T23:39:57.000Z
28.863248
80
0.617412
1,000,573
/* * This file is a part of MI * * The MIT License (MIT) * * Copyright (c) 2021 Roj234 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package roj.kscript.parser.expr; import roj.kscript.ast.ASTree; import roj.kscript.ast.CompileContext; import roj.kscript.type.KType; import roj.text.CharList; import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * 操作符 - 调用方法 * * @author Roj233 * @since 2020/10/13 22:17 */ public final class Chained implements Expression { public final List<Expression> par; public Chained() { par = new ArrayList<>(); } @Override public boolean isEqual(Expression left) { if (this == left) return true; if (!(left instanceof Chained)) return false; Chained method = (Chained) left; return ArrayDef.arrayEq(par, method.par); } @Override public void toVMCode(CompileContext ctx, boolean noRet) { int t; Expression last = par.get(t = par.size() - 1); for (int i = 0; i < t; i++) { par.get(i).toVMCode(ctx, true); } last.toVMCode(ctx, false); } @Override public void write(ASTree tree, boolean noRet) { int t; Expression last = par.get(t = par.size() - 1); for (int i = 0; i < t; i++) { par.get(i).write(tree, true); } last.write(tree, false); } @Nonnull @Override public Expression compress() { for (int i = 0; i < par.size(); i++) { par.set(i, par.get(i).compress()); } return par.size() == 1 ? par.get(0) : this; } @Override public KType compute(Map<String, KType> param) { for (int i = 0; i < par.size() - 1; i++) { par.get(i).compute(param); } return par.get(par.size() - 1).compute(param); } @Override public byte type() { return par.get(par.size() - 1).type(); } @Override public String toString() { CharList sb = new CharList(); for (int i = 0; i < par.size(); i++) { sb.append(par.get(i).toString()).append(", "); } sb.setIndex(sb.length() - 2); return sb.toString(); } public void append(Expression cur) { par.add(cur); } }
923dff2f7add98c9c8826d347bcbc200a4fab5f8
2,943
java
Java
src/main/java/com/wang/util/common/SerializableUtil.java
bugking-cyw/AuthShiro
f35b4cbb1851f882f82f9e8bb410932384c1cd5b
[ "MIT" ]
490
2019-05-10T10:38:18.000Z
2022-03-31T08:15:04.000Z
src/main/java/com/wang/util/common/SerializableUtil.java
bugking-cyw/AuthShiro
f35b4cbb1851f882f82f9e8bb410932384c1cd5b
[ "MIT" ]
18
2019-05-15T01:39:47.000Z
2022-02-12T13:59:05.000Z
src/main/java/com/wang/util/common/SerializableUtil.java
bugking-cyw/AuthShiro
f35b4cbb1851f882f82f9e8bb410932384c1cd5b
[ "MIT" ]
224
2019-05-10T10:38:20.000Z
2022-03-23T02:37:21.000Z
31.98913
109
0.56439
1,000,574
package com.wang.util.common; import com.wang.exception.CustomException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.*; /** * Serializable工具(JDK)(也可以使用Protobuf自行百度) * @author dolyw.com * @date 2018/9/4 15:13 */ public class SerializableUtil { private SerializableUtil() {} /** * logger */ private static final Logger logger = LoggerFactory.getLogger(SerializableUtil.class); /** * 序列化 * @param object * @return byte[] * @author dolyw.com * @date 2018/9/4 15:14 */ public static byte[] serializable(Object object) { ByteArrayOutputStream baos = null; ObjectOutputStream oos = null; try { baos = new ByteArrayOutputStream(); oos = new ObjectOutputStream(baos); oos.writeObject(object); return baos.toByteArray(); } catch (IOException e) { logger.error("SerializableUtil工具类序列化出现IOException异常:{}", e.getMessage()); throw new CustomException("SerializableUtil工具类序列化出现IOException异常:" + e.getMessage()); } finally { try { if (oos != null) { oos.close(); } if (baos != null) { baos.close(); } } catch (IOException e) { logger.error("SerializableUtil工具类反序列化出现IOException异常:{}", e.getMessage()); throw new CustomException("SerializableUtil工具类反序列化出现IOException异常:" + e.getMessage()); } } } /** * 反序列化 * @param bytes * @return java.lang.Object * @author dolyw.com * @date 2018/9/4 15:14 */ public static Object unserializable(byte[] bytes) { ByteArrayInputStream bais = null; ObjectInputStream ois = null; try { bais = new ByteArrayInputStream(bytes); ois = new ObjectInputStream(bais); return ois.readObject(); } catch (ClassNotFoundException e) { logger.error("SerializableUtil工具类反序列化出现ClassNotFoundException异常:{}", e.getMessage()); throw new CustomException("SerializableUtil工具类反序列化出现ClassNotFoundException异常:" + e.getMessage()); } catch (IOException e) { logger.error("SerializableUtil工具类反序列化出现IOException异常:{}", e.getMessage()); throw new CustomException("SerializableUtil工具类反序列化出现IOException异常:" + e.getMessage()); } finally { try { if (ois != null) { ois.close(); } if (bais != null) { bais.close(); } } catch (IOException e) { logger.error("SerializableUtil工具类反序列化出现IOException异常:{}", e.getMessage()); throw new CustomException("SerializableUtil工具类反序列化出现IOException异常:" + e.getMessage()); } } } }
923dffaed11d4983f9c8319760193f4dc6d94ca9
2,341
java
Java
DIA-Umpire/DIA-Umpire/src/MSUmpire/PSMDataStructure/EnzymeManager.java
CheYulin/DIA-Umpire-Maven
a3e855e71006336826525b8ab324affbd2372d0f
[ "MIT" ]
1
2017-12-28T02:37:07.000Z
2017-12-28T02:37:07.000Z
DIA-Umpire/DIA-Umpire/src/MSUmpire/PSMDataStructure/EnzymeManager.java
CheYulin/DIA-Umpire-Maven
a3e855e71006336826525b8ab324affbd2372d0f
[ "MIT" ]
null
null
null
DIA-Umpire/DIA-Umpire/src/MSUmpire/PSMDataStructure/EnzymeManager.java
CheYulin/DIA-Umpire-Maven
a3e855e71006336826525b8ab324affbd2372d0f
[ "MIT" ]
null
null
null
32.736111
106
0.700891
1,000,575
/* * Author: Chih-Chiang Tsou <upchh@example.com> * Nesvizhskii Lab, Department of Computational Medicine and Bioinformatics, * University of Michigan, Ann Arbor * * Copyright 2014 University of Michigan, Ann Arbor, MI * * 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 MSUmpire.PSMDataStructure; import com.compomics.util.experiment.biology.Enzyme; import com.compomics.util.experiment.biology.EnzymeFactory; import java.io.File; import java.io.IOException; import java.io.InputStream; import org.xmlpull.v1.XmlPullParserException; /** * Enzyme manager from compomics library * * @author Chih-Chiang Tsou <upchh@example.com> */ public class EnzymeManager { private static EnzymeManager enzymeManager; EnzymeFactory enzymeFactory = null; public EnzymeManager() throws XmlPullParserException, IOException { if (enzymeFactory == null) { enzymeFactory = EnzymeFactory.getInstance(); InputStream is = this.getClass().getClassLoader().getResourceAsStream("resource/enzymes.xml"); String tmpfile = "enzymes.xml"; InputStreamToFile convert = new InputStreamToFile(); File enzymeFile = convert.GetFile(is, tmpfile); enzymeFactory.importEnzymes(enzymeFile); } } public static EnzymeManager GetInstance() throws XmlPullParserException, IOException { if (enzymeManager == null) { enzymeManager = new EnzymeManager(); } return enzymeManager; } public Enzyme GetTrypsin() { return enzymeFactory.getEnzyme("Trypsin"); } public Enzyme GetTrypsinNoP() { return enzymeFactory.getEnzyme("Trypsin, no P rule"); } public Enzyme GetSemiTryptic() { return enzymeFactory.getEnzyme("Semi-Tryptic"); } }
923e00248c5e958b87761a0fe61533ba275a4aec
7,897
java
Java
com/planet_ink/coffee_mud/Races/Rabbit.java
RothchildDeSt/McMUD
9bdbb54465b96a3c99034788f53a207e1184733f
[ "Apache-2.0" ]
1
2019-11-22T14:10:04.000Z
2019-11-22T14:10:04.000Z
com/planet_ink/coffee_mud/Races/Rabbit.java
RothchildDeSt/McMUD
9bdbb54465b96a3c99034788f53a207e1184733f
[ "Apache-2.0" ]
null
null
null
com/planet_ink/coffee_mud/Races/Rabbit.java
RothchildDeSt/McMUD
9bdbb54465b96a3c99034788f53a207e1184733f
[ "Apache-2.0" ]
null
null
null
25.556634
116
0.673547
1,000,576
package com.planet_ink.coffee_mud.Races; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.core.*; import com.planet_ink.coffee_mud.core.collections.*; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Areas.interfaces.*; import com.planet_ink.coffee_mud.Behaviors.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.*; import com.planet_ink.coffee_mud.Commands.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Exits.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Libraries.interfaces.*; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.*; import com.planet_ink.coffee_mud.Races.interfaces.*; import java.util.*; /* Copyright 2001-2019 Bo Zimmerman 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. */ public class Rabbit extends StdRace { @Override public String ID() { return "Rabbit"; } private final static String localizedStaticName = CMLib.lang().L("Rabbit"); @Override public String name() { return localizedStaticName; } @Override public int shortestMale() { return 6; } @Override public int shortestFemale() { return 6; } @Override public int heightVariance() { return 3; } @Override public int lightestWeight() { return 10; } @Override public int weightVariance() { return 10; } @Override public long forbiddenWornBits() { return ~(Wearable.WORN_HEAD | Wearable.WORN_FEET | Wearable.WORN_NECK | Wearable.WORN_EARS | Wearable.WORN_EYES); } private final static String localizedStaticRacialCat = CMLib.lang().L("Rodent"); @Override public String racialCategory() { return localizedStaticRacialCat; } private final String[] racialAbilityNames = { "RabbitSpeak" }; private final int[] racialAbilityLevels = { 1 }; private final int[] racialAbilityProficiencies = { 100 }; private final boolean[] racialAbilityQuals = { false }; private final String[] racialAbilityParms = { "" }; @Override protected String[] racialAbilityNames() { return racialAbilityNames; } @Override protected int[] racialAbilityLevels() { return racialAbilityLevels; } @Override protected int[] racialAbilityProficiencies() { return racialAbilityProficiencies; } @Override protected boolean[] racialAbilityQuals() { return racialAbilityQuals; } @Override public String[] racialAbilityParms() { return racialAbilityParms; } // an ey ea he ne ar ha to le fo no gi mo wa ta wi private static final int[] parts={0 ,2 ,2 ,1 ,1 ,0 ,0 ,1 ,4 ,4 ,1 ,0 ,1 ,1 ,1 ,0 }; @Override public int[] bodyMask() { return parts; } private final int[] agingChart = { 0, 1, 2, 4, 7, 15, 20, 21, 22 }; @Override public int[] getAgingChart() { return agingChart; } private static Vector<RawMaterial> resources = new Vector<RawMaterial>(); @Override public int availabilityCode() { return Area.THEME_ALLTHEMES | Area.THEME_SKILLONLYMASK; } @Override public void affectPhyStats(final Physical affected, final PhyStats affectableStats) { super.affectPhyStats(affected,affectableStats); affectableStats.setSensesMask(affectableStats.sensesMask()|PhyStats.CAN_SEE_DARK); } @Override public void affectCharStats(final MOB affectedMOB, final CharStats affectableStats) { super.affectCharStats(affectedMOB, affectableStats); affectableStats.setRacialStat(CharStats.STAT_STRENGTH,3); affectableStats.setRacialStat(CharStats.STAT_DEXTERITY,3); affectableStats.setRacialStat(CharStats.STAT_INTELLIGENCE,1); } @Override public String arriveStr() { return "hops in"; } @Override public String leaveStr() { return "hops"; } @Override public Weapon myNaturalWeapon() { if(naturalWeapon==null) { naturalWeapon=CMClass.getWeapon("StdWeapon"); naturalWeapon.setName(L("a pair of sharp teeth")); naturalWeapon.setMaterial(RawMaterial.RESOURCE_BONE); naturalWeapon.setUsesRemaining(1000); naturalWeapon.setWeaponDamageType(Weapon.TYPE_PIERCING); } return naturalWeapon; } @Override public String makeMobName(final char gender, final int age) { switch(age) { case Race.AGE_INFANT: case Race.AGE_TODDLER: case Race.AGE_CHILD: switch(gender) { case 'M': case 'm': return "boy bunny"; case 'F': case 'f': return "girl bunny"; default: return "bunny"; } case Race.AGE_YOUNGADULT: case Race.AGE_MATURE: case Race.AGE_MIDDLEAGED: default: switch(gender) { case 'M': case 'm': return name().toLowerCase() + " buck"; case 'F': case 'f': return name().toLowerCase() + " doe"; default: return name().toLowerCase(); } case Race.AGE_OLD: case Race.AGE_VENERABLE: case Race.AGE_ANCIENT: switch(gender) { case 'M': case 'm': return "old " + name().toLowerCase() + " buck"; case 'F': case 'f': return "old " + name().toLowerCase() + " doe"; default: return "old " + name().toLowerCase(); } } } @Override public String healthText(final MOB viewer, final MOB mob) { final double pct=(CMath.div(mob.curState().getHitPoints(),mob.maxState().getHitPoints())); if(pct<.10) return L("^r@x1^r is one unhappy bunny!^N",mob.name(viewer)); else if(pct<.20) return L("^r@x1^r is covered in blood and matted hair.^N",mob.name(viewer)); else if(pct<.30) return L("^r@x1^r is bleeding badly from lots of wounds.^N",mob.name(viewer)); else if(pct<.40) return L("^y@x1^y has large patches of bloody matted fur.^N",mob.name(viewer)); else if(pct<.50) return L("^y@x1^y has some bloody matted fur.^N",mob.name(viewer)); else if(pct<.60) return L("^p@x1^p has a lot of cuts and gashes.^N",mob.name(viewer)); else if(pct<.70) return L("^p@x1^p has a few cut patches.^N",mob.name(viewer)); else if(pct<.80) return L("^g@x1^g has a cut patch of fur.^N",mob.name(viewer)); else if(pct<.90) return L("^g@x1^g has some disheveled fur.^N",mob.name(viewer)); else if(pct<.99) return L("^g@x1^g has some misplaced hairs.^N",mob.name(viewer)); else return L("^c@x1^c is in perfect health.^N",mob.name(viewer)); } @Override public List<RawMaterial> myResources() { synchronized(resources) { if(resources.size()==0) { resources.addElement(makeResource (L("a @x1 foot",name().toLowerCase()),RawMaterial.RESOURCE_MEAT)); resources.addElement(makeResource (L("some @x1 hair",name().toLowerCase()),RawMaterial.RESOURCE_FUR,L("@x1 hair",name().toLowerCase()))); resources.addElement(makeResource (L("some @x1 meat",name().toLowerCase()),RawMaterial.RESOURCE_MEAT)); resources.addElement(makeResource (L("some @x1 blood",name().toLowerCase()),RawMaterial.RESOURCE_BLOOD)); resources.addElement(makeResource (L("a pile of @x1 bones",name().toLowerCase()),RawMaterial.RESOURCE_BONE)); } } return resources; } }
923e00d8b490dbb60af7cca6d8c98e564c6e3003
4,263
java
Java
Other projects/CaseStudies/AnomicFTPD/src/de/anomic/ftpd/cachedClassLoader.java
ccol002/larva-rv-tool
c33174154b6656377c76842abf471e664e9def09
[ "MIT" ]
2
2020-08-06T15:16:11.000Z
2021-03-08T21:16:08.000Z
Other projects/CaseStudies/AnomicFTPD/src/de/anomic/ftpd/cachedClassLoader.java
ccol002/larva-rv-tool
c33174154b6656377c76842abf471e664e9def09
[ "MIT" ]
null
null
null
Other projects/CaseStudies/AnomicFTPD/src/de/anomic/ftpd/cachedClassLoader.java
ccol002/larva-rv-tool
c33174154b6656377c76842abf471e664e9def09
[ "MIT" ]
4
2018-02-15T16:06:46.000Z
2020-05-24T10:14:39.000Z
36.706897
79
0.717238
1,000,577
// cachedClassLoader.java // ----------------------- // (C) by Michael Peter Christen; hzdkv@example.com // first published on http://www.anomic.de // Frankfurt, Germany, 2004 // last major change: 11.03.2004 // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Using this software in any meaning (reading, learning, copying, compiling, // running) means that you agree that the Author(s) is (are) not responsible // for cost, loss of data or any harm that may be caused directly or indirectly // by usage of this softare or this documentation. The usage of this software // is on your own risk. The installation and usage (starting/running) of this // software may allow other people or application to access your computer and // any attached devices and is highly dependent on the configuration of the // software which must be done by the user of the software; the author(s) is // (are) also not responsible for proper configuration and usage of the // software, even if provoked by documentation provided together with // the software. // // Any changes to this file according to the GPL as documented in the file // gpl.txt aside this file in the shipment you received can be done to the // lines that follows this copyright notice here, but changes must not be // done inside the copyright notive above. A re-distribution must contain // the intact and unchanged copyright notice. // Contributions and changes to the program code must be marked as such. package de.anomic.ftpd; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Hashtable; public class cachedClassLoader extends ClassLoader { Hashtable classes; public cachedClassLoader() { super(); this.classes = new Hashtable(); } public cachedClassLoader(final ClassLoader parent) { super(parent); this.classes = new Hashtable(); } public Class loadClass(String classkey) throws ClassNotFoundException { // we consider that the classkey can either be only the name of a class, // or a partial or // complete path to a class file // normalize classkey: strip off '.class' if (classkey.endsWith(".class")) { classkey = classkey.substring(0, classkey.length() - 6); } // try to find the class in the hashtable Class c = (Class) this.classes.get(classkey); if (c != null) return c; // consider classkey as a file and extract the file name File classfile = new File(classkey); // this file cannot exist for real, since we stripped off the .class // we constructed the classfile for the only purpose to strip off the // name: // get the class name out of the classfile final String classname = classfile.getName(); // now that we have the name, we can create the real class file classfile = new File(classkey + ".class"); // first try: take the class out of the cache, denoted by the classname c = findLoadedClass(classname); if (c == null) { try { // second try: ask the system c = findSystemClass(classname); } catch (final ClassNotFoundException e) { // third try: load the file from the file system final int length = (int) classfile.length(); final byte[] b = new byte[length]; try { final InputStream is = new FileInputStream(classfile); is.read(b, 0, b.length); is.close(); // now make a class out of the stream c = defineClass(null, b, 0, b.length); resolveClass(c); this.classes.put(classkey, c); } catch (final IOException ee) { throw new ClassNotFoundException(classkey); } } } return c; } }
923e0119e7d3ff120f3e162ed50fa7f2212d8da8
2,546
java
Java
gemfire-junit/src/main/java/com/gemstone/gemfire/internal/cache/OplogEntryIdSetJUnitTest.java
xyxiaoyou/snappy-store
013ff282f888878cc99600e260ec1cde60112304
[ "Apache-2.0" ]
38
2016-01-04T01:31:40.000Z
2020-04-07T06:35:36.000Z
gemfire-junit/src/main/java/com/gemstone/gemfire/internal/cache/OplogEntryIdSetJUnitTest.java
xyxiaoyou/snappy-store
013ff282f888878cc99600e260ec1cde60112304
[ "Apache-2.0" ]
261
2016-01-07T09:14:26.000Z
2019-12-05T10:15:56.000Z
gemfire-junit/src/main/java/com/gemstone/gemfire/internal/cache/OplogEntryIdSetJUnitTest.java
xyxiaoyou/snappy-store
013ff282f888878cc99600e260ec1cde60112304
[ "Apache-2.0" ]
22
2016-03-09T05:47:09.000Z
2020-04-02T17:55:30.000Z
29.604651
77
0.690102
1,000,578
/* * Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you * may not use this file except in compliance with the License. You * may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. See accompanying * LICENSE file. */ package com.gemstone.gemfire.internal.cache; import java.io.*; import java.util.*; import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.internal.Assert; import com.gemstone.gemfire.distributed.*; import com.gemstone.gemfire.internal.cache.DiskStoreImpl.OplogEntryIdSet; import junit.framework.TestCase; /** * Tests DiskStoreImpl.OplogEntryIdSet * * @author darrel * */ public class OplogEntryIdSetJUnitTest extends TestCase { public OplogEntryIdSetJUnitTest(String arg0) { super(arg0); } public void testBasics() { OplogEntryIdSet s = new OplogEntryIdSet(); for (long i=1; i < 777777; i++) { assertEquals(false, s.contains(i)); } for (long i=1; i < 777777; i++) { s.add(i); } for (long i=1; i < 777777; i++) { assertEquals(true, s.contains(i)); } try { s.add(DiskStoreImpl.INVALID_ID); fail("expected IllegalArgumentException"); } catch (IllegalArgumentException expected) { } assertEquals(false, s.contains(0)); assertEquals(false, s.contains(0x00000000FFFFFFFFL)); s.add(0x00000000FFFFFFFFL); assertEquals(true, s.contains(0x00000000FFFFFFFFL)); for (long i=0x00000000FFFFFFFFL+1; i < 0x00000000FFFFFFFFL+777777; i++) { assertEquals(false, s.contains(i)); } for (long i=0x00000000FFFFFFFFL+1; i < 0x00000000FFFFFFFFL+777777; i++) { s.add(i); } for (long i=0x00000000FFFFFFFFL+1; i < 0x00000000FFFFFFFFL+777777; i++) { assertEquals(true, s.contains(i)); } for (long i=1; i < 777777; i++) { assertEquals(true, s.contains(i)); } assertEquals(false, s.contains(Long.MAX_VALUE)); s.add(Long.MAX_VALUE); assertEquals(true, s.contains(Long.MAX_VALUE)); assertEquals(false, s.contains(Long.MIN_VALUE)); s.add(Long.MIN_VALUE); assertEquals(true, s.contains(Long.MIN_VALUE)); } }
923e01f9f38d01b16eec71f923641bd7c0ff4bf5
382
java
Java
open-metadata-implementation/adapters/open-connectors/governance-daemon-connectors/open-lineage-connectors/janus-connector/src/main/java/org/odpi/openmetadata/openconnectors/governancedaemonconnectors/openlineageconnectors/janusconnector/utils/EdgeLabels.java
ruxandraRosu/egeria
f3906b67455fc0cd94df6480aefd45060690094e
[ "Apache-2.0" ]
null
null
null
open-metadata-implementation/adapters/open-connectors/governance-daemon-connectors/open-lineage-connectors/janus-connector/src/main/java/org/odpi/openmetadata/openconnectors/governancedaemonconnectors/openlineageconnectors/janusconnector/utils/EdgeLabels.java
ruxandraRosu/egeria
f3906b67455fc0cd94df6480aefd45060690094e
[ "Apache-2.0" ]
2
2019-09-24T18:35:21.000Z
2019-09-24T19:48:48.000Z
open-metadata-implementation/adapters/open-connectors/governance-daemon-connectors/open-lineage-connectors/janus-connector/src/main/java/org/odpi/openmetadata/openconnectors/governancedaemonconnectors/openlineageconnectors/janusconnector/utils/EdgeLabels.java
ruxandraRosu/egeria
f3906b67455fc0cd94df6480aefd45060690094e
[ "Apache-2.0" ]
null
null
null
31.833333
115
0.790576
1,000,579
/* SPDX-License-Identifier: Apache-2.0 */ /* Copyright Contributors to the ODPi Egeria project. */ package org.odpi.openmetadata.openconnectors.governancedaemonconnectors.openlineageconnectors.janusconnector.utils; public enum EdgeLabels { SCHEMA_ATTRIBUTE_TYPE, ATTRIBUTE_FOR_SCHEMA, GLOSSARY_TERM, SEMANTIC_ASSIGNMENT, DEPLOYED_DB_SCHEMA_TYPE, DATABASE; }
923e022af0efb849f26d34596a8e1c9b7f7301e5
3,064
java
Java
apiAuth/src/main/java/io/disordinary/react/APIAUTH.java
disordinary/APIAuthAndroid
4c2ae6d1c961b0cdc2cea34f0cf3b860b178cf37
[ "MIT" ]
null
null
null
apiAuth/src/main/java/io/disordinary/react/APIAUTH.java
disordinary/APIAuthAndroid
4c2ae6d1c961b0cdc2cea34f0cf3b860b178cf37
[ "MIT" ]
null
null
null
apiAuth/src/main/java/io/disordinary/react/APIAUTH.java
disordinary/APIAuthAndroid
4c2ae6d1c961b0cdc2cea34f0cf3b860b178cf37
[ "MIT" ]
null
null
null
26.877193
107
0.719321
1,000,580
package io.disordinary.react; import javax.annotation.Nullable; import com.facebook.common.logging.FLog; import com.facebook.infer.annotation.Assertions; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.Callback; import com.facebook.react.bridge.GuardedAsyncTask; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.WritableArray; import com.facebook.react.common.ReactConstants; // import com.facebook.react.modules.common.ModuleDataCleaner; import java.security.SignatureException; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import android.util.Base64; import java.security.MessageDigest; // public final class DBManager extends ReactContextBaseJavaModule implements ModuleDataCleaner.Cleanable { public final class APIAUTH extends ReactContextBaseJavaModule { private static final String HMAC_SHA1_ALGORITHM = "HmacSHA1"; private String _id = ""; private String _secret = ""; public APIAUTH(ReactApplicationContext reactContext) { super(reactContext); } @Override public String getName() { return "APIAUTH"; } @ReactMethod public void md5( String message , Callback callBack ) { String digest = null; try { // Create MD5 Hash /*MessageDigest digest = java.security.MessageDigest.getInstance("MD5"); digest.update(message.getBytes()); byte messageDigest[] = digest.digest(); // Create Hex String StringBuffer hexString = new StringBuffer(); for (int i=0; i<messageDigest.length; i++) { hexString.append(Integer.toHexString(0xFF & messageDigest[i])); }*/ MessageDigest md = MessageDigest.getInstance("MD5"); byte[] hash = md.digest(message.getBytes("UTF-8")); /* StringBuilder sb = new StringBuilder(2*hash.length); for(byte b : hash) { sb.append(String.format("%02x", b&0xff)); } digest = sb.toString();*/ callBack.invoke( null , Base64.encodeToString(hash , Base64.DEFAULT ) ); } catch (Exception e) { callBack.invoke( "failed to generate md5: " + e.getMessage() , null ); } } @ReactMethod public void hmac(String secret , String message , Callback callBack) { try { // get an hmac_sha1 key from the raw key bytes SecretKeySpec signingKey = new SecretKeySpec(secret.getBytes(), HMAC_SHA1_ALGORITHM); // get an hmac_sha1 Mac instance and initialize with the signing key Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM); mac.init(signingKey); // compute the hmac on input data bytes byte[] rawHmac = mac.doFinal(message.getBytes()); // base64-encode the hmac String result = Base64.encodeToString( rawHmac , Base64.DEFAULT );//new String( rawHmac ); callBack.invoke( null , result ) ; } catch (Exception e) { callBack.invoke( "failed to generate hmac: " + e.getMessage() , null ); } } }
923e02be5485975da748d0004bc655c099fb8c5d
2,058
java
Java
api/src/test/java/com/sourceallies/android/zonebeacon/data/model/SystemTypeTest.java
jonchapmansai/zonebeacon
7758cda14a348c5a94910e05eb2006ebd131b24c
[ "Apache-2.0" ]
4
2016-12-05T20:17:13.000Z
2020-04-15T14:43:58.000Z
api/src/test/java/com/sourceallies/android/zonebeacon/data/model/SystemTypeTest.java
jonchapmansai/zonebeacon
7758cda14a348c5a94910e05eb2006ebd131b24c
[ "Apache-2.0" ]
null
null
null
api/src/test/java/com/sourceallies/android/zonebeacon/data/model/SystemTypeTest.java
jonchapmansai/zonebeacon
7758cda14a348c5a94910e05eb2006ebd131b24c
[ "Apache-2.0" ]
2
2017-03-20T07:48:19.000Z
2019-07-16T21:00:33.000Z
28.583333
118
0.670554
1,000,581
/* * Copyright (C) 2016 Source Allies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.sourceallies.android.zonebeacon.data.model; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; public class SystemTypeTest extends DatabaseTableTest { private SystemType type; @Before public void setUp() { type = new SystemType(); } @Test public void test_getTableName() { assertEquals("system_type", type.getTableName()); } @Test public void test_indexes() { assertEquals(0, type.getIndexStatements().length); } @Test public void test_defaults() { assertEquals(1, type.getDefaultDataStatements().length); assertEquals("INSERT INTO 'system_type' ('_id', 'name', 'version') VALUES (1, 'CentraLite Elegance', '1.0');", type.getDefaultDataStatements()[0]); } @Test public void test_createTable() { assertEquals("create table if not exists system_type (_id integer primary key " + "autoincrement, name varchar(255) not null, version varchar(32));", type.getCreateStatement()); } @Test public void test_fillFromCursor() { setupMockCursor(SystemType.ALL_COLUMNS); type.fillFromCursor(cursor); assertColumnFilled(type.getId()); assertColumnFilled(type.getName()); assertColumnFilled(type.getVersion()); } @Override public DatabaseTable getDatabaseTable() { return type; } }
923e02c6398967cd8e85bc602de4521fd69471e7
3,466
java
Java
languages/languageDesign/feedback/problem/problem/source_gen/jetbrains/mps/lang/feedback/problem/editor/ProblemPointsToKindRoot_SubstituteMenu.java
trespasserw/MPS
dbc5c76496e8ccef46dd420eefcd5089b1bc234b
[ "Apache-2.0" ]
null
null
null
languages/languageDesign/feedback/problem/problem/source_gen/jetbrains/mps/lang/feedback/problem/editor/ProblemPointsToKindRoot_SubstituteMenu.java
trespasserw/MPS
dbc5c76496e8ccef46dd420eefcd5089b1bc234b
[ "Apache-2.0" ]
null
null
null
languages/languageDesign/feedback/problem/problem/source_gen/jetbrains/mps/lang/feedback/problem/editor/ProblemPointsToKindRoot_SubstituteMenu.java
trespasserw/MPS
dbc5c76496e8ccef46dd420eefcd5089b1bc234b
[ "Apache-2.0" ]
null
null
null
48.816901
286
0.804097
1,000,582
package jetbrains.mps.lang.feedback.problem.editor; /*Generated by MPS */ import jetbrains.mps.nodeEditor.menus.substitute.SubstituteMenuBase; import org.jetbrains.annotations.NotNull; import java.util.List; import jetbrains.mps.lang.editor.menus.MenuPart; import jetbrains.mps.openapi.editor.menus.substitute.SubstituteMenuItem; import jetbrains.mps.openapi.editor.menus.substitute.SubstituteMenuContext; import java.util.ArrayList; import jetbrains.mps.lang.editor.menus.EditorMenuDescriptorBase; import jetbrains.mps.smodel.SNodePointer; import jetbrains.mps.lang.editor.menus.ConceptMenusPart; import java.util.Collection; import jetbrains.mps.smodel.ConceptDescendantsCache; import org.jetbrains.mps.openapi.language.SAbstractConcept; import jetbrains.mps.lang.editor.menus.substitute.DefaultSubstituteMenuLookup; import jetbrains.mps.smodel.language.LanguageRegistry; import org.jetbrains.mps.openapi.language.SConcept; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; public class ProblemPointsToKindRoot_SubstituteMenu extends SubstituteMenuBase { @NotNull @Override protected List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> getParts(final SubstituteMenuContext _context) { List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> result = new ArrayList<MenuPart<SubstituteMenuItem, SubstituteMenuContext>>(); result.add(new SMP_Subconcepts_46r982_a()); return result; } @NotNull @Override public List<SubstituteMenuItem> createMenuItems(@NotNull SubstituteMenuContext context) { context.getEditorMenuTrace().pushTraceInfo(); context.getEditorMenuTrace().setDescriptor(new EditorMenuDescriptorBase("default substitute menu for " + "ProblemPointsToKindRoot", new SNodePointer("r:908dfefb-9454-4702-8da4-1ce2a1dc1656(jetbrains.mps.lang.feedback.problem.editor)", "7716791493893615836"))); try { return super.createMenuItems(context); } finally { context.getEditorMenuTrace().popTraceInfo(); } } public class SMP_Subconcepts_46r982_a extends ConceptMenusPart<SubstituteMenuItem, SubstituteMenuContext> { protected Collection getConcepts(final SubstituteMenuContext _context) { return ConceptDescendantsCache.getInstance().getDirectDescendants(CONCEPTS.ProblemPointsToKindRoot$AQ); } @NotNull @Override public List<SubstituteMenuItem> createItems(SubstituteMenuContext context) { context.getEditorMenuTrace().pushTraceInfo(); context.getEditorMenuTrace().setDescriptor(new EditorMenuDescriptorBase("include menus for all the direct subconcepts of " + "ProblemPointsToKindRoot", new SNodePointer("r:908dfefb-9454-4702-8da4-1ce2a1dc1656(jetbrains.mps.lang.feedback.problem.editor)", "7716791493893658270"))); try { return super.createItems(context); } finally { context.getEditorMenuTrace().popTraceInfo(); } } @Override protected Collection<SubstituteMenuItem> createItemsForConcept(SubstituteMenuContext context, SAbstractConcept concept) { return context.createItems(new DefaultSubstituteMenuLookup(LanguageRegistry.getInstance(context.getEditorContext().getRepository()), concept)); } } private static final class CONCEPTS { /*package*/ static final SConcept ProblemPointsToKindRoot$AQ = MetaAdapterFactory.getConcept(0x33598a476a947e1L, 0xac89a300c0fceab8L, 0x6b178cfa773dc73aL, "jetbrains.mps.lang.feedback.problem.structure.ProblemPointsToKindRoot"); } }
923e0392d9d127bfe1454ed7d252d22e7739ea8a
419
java
Java
hkc-code/src/main/java/org/hackercjc/hck/arithmetic/InsertSort.java
HackerCJC/sunflower-bible
6a4b32b0c649fa8aee9ee470a5e7c89c7675b9e6
[ "Apache-2.0" ]
null
null
null
hkc-code/src/main/java/org/hackercjc/hck/arithmetic/InsertSort.java
HackerCJC/sunflower-bible
6a4b32b0c649fa8aee9ee470a5e7c89c7675b9e6
[ "Apache-2.0" ]
null
null
null
hkc-code/src/main/java/org/hackercjc/hck/arithmetic/InsertSort.java
HackerCJC/sunflower-bible
6a4b32b0c649fa8aee9ee470a5e7c89c7675b9e6
[ "Apache-2.0" ]
null
null
null
20.95
58
0.520286
1,000,583
package org.hackercjc.hck.arithmetic; public class InsertSort { public static void main(String[] args) { } public void insertSort(int[] arr) { for (int i = 1; i < arr.length; i++) { // for (int j = arr.length-i -1 ; j>) } } public static void swap(int[] arr, int from, int to) { int tmp = arr[from]; arr[from] = arr[to]; arr[to] = tmp; } }
923e03c28a4d59b728e533bd4e8a7b0e6a01505a
1,091
java
Java
src/main/java/com/podio/oauth/OAuthAPI.java
OvalUK/podio-java
c1382d60f1cd9b25b350d7f1a1c191e8b96c8c01
[ "MIT" ]
13
2015-01-13T12:23:00.000Z
2018-05-21T17:57:50.000Z
src/main/java/com/podio/oauth/OAuthAPI.java
OvalUK/podio-java
c1382d60f1cd9b25b350d7f1a1c191e8b96c8c01
[ "MIT" ]
23
2015-01-12T21:29:22.000Z
2020-09-09T16:59:14.000Z
src/main/java/com/podio/oauth/OAuthAPI.java
OvalUK/podio-java
c1382d60f1cd9b25b350d7f1a1c191e8b96c8c01
[ "MIT" ]
18
2015-02-19T23:40:55.000Z
2021-07-19T11:16:17.000Z
34.09375
73
0.781852
1,000,584
package com.podio.oauth; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import com.podio.BaseAPI; import com.podio.ResourceFactory; import com.sun.jersey.api.client.WebResource; import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter; import com.sun.jersey.core.util.MultivaluedMapImpl; public class OAuthAPI extends BaseAPI { public OAuthAPI(ResourceFactory resourceFactory) { super(resourceFactory); } public OAuthToken getToken(OAuthClientCredentials clientCredentials, OAuthUserCredentials userCredentials) { MultivaluedMap<String, String> parameters = new MultivaluedMapImpl(); parameters.add("grant_type", userCredentials.getType()); userCredentials.addParameters(parameters); WebResource resource = getResourceFactory().getApiResource( "/oauth/token", false); resource.addFilter(new HTTPBasicAuthFilter(clientCredentials .getClientId(), clientCredentials.getClientSecret())); return resource.type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).post( OAuthToken.class, parameters); } }
923e03e75022314db7b8be9d867f58954e5a39c2
86
java
Java
src/main/java/com/flexicore/interfaces/WebSocketPlugin.java
wizzdi/flexicore-boot-vintage
8fdf299f2b7711f7ccac08656a1e2894c219ddb6
[ "Apache-2.0" ]
null
null
null
src/main/java/com/flexicore/interfaces/WebSocketPlugin.java
wizzdi/flexicore-boot-vintage
8fdf299f2b7711f7ccac08656a1e2894c219ddb6
[ "Apache-2.0" ]
null
null
null
src/main/java/com/flexicore/interfaces/WebSocketPlugin.java
wizzdi/flexicore-boot-vintage
8fdf299f2b7711f7ccac08656a1e2894c219ddb6
[ "Apache-2.0" ]
null
null
null
17.2
48
0.837209
1,000,585
package com.flexicore.interfaces; public interface WebSocketPlugin extends Plugin{ }
923e04a4a02be0e99ce4eecc06750a48588223e9
4,977
java
Java
EarlySleep/app/src/main/java/com/earlysleep/Activity/ChooseLingshen.java
earlysleep/earlysleep
cf918f6d2a1e2232c64bdc2f4e799fca23526fa3
[ "Apache-2.0" ]
null
null
null
EarlySleep/app/src/main/java/com/earlysleep/Activity/ChooseLingshen.java
earlysleep/earlysleep
cf918f6d2a1e2232c64bdc2f4e799fca23526fa3
[ "Apache-2.0" ]
null
null
null
EarlySleep/app/src/main/java/com/earlysleep/Activity/ChooseLingshen.java
earlysleep/earlysleep
cf918f6d2a1e2232c64bdc2f4e799fca23526fa3
[ "Apache-2.0" ]
null
null
null
25.01005
105
0.630299
1,000,586
package com.earlysleep.Activity; import android.database.Cursor; import android.media.MediaPlayer; import android.media.Ringtone; import android.media.RingtoneManager; import android.os.Bundle; import android.view.View; import android.view.animation.Animation; import android.view.animation.RotateAnimation; import android.widget.AdapterView; import android.widget.ImageView; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.earlysleep.Adapter.linsenadapter; import com.earlysleep.R; import com.earlysleep.model.Slect; import com.musketeer.baselibrary.Activity.BaseActivity; import com.musketeer.baselibrary.util.SharePreferenceUtils; import java.util.ArrayList; import java.util.List; import butterknife.Bind; /** * Created by Administrator on 2016/7/10 0010. */ public class ChooseLingshen extends BaseActivity { @Bind(R.id.headbar_left_imagebutton_two) ImageView back;//返回 @Bind(R.id.headbar_right_imagebutton_two) ImageView sure;//queing按钮 @Bind(R.id.headbar_title_two) TextView title; @Bind(R.id.default_headbar_two) RelativeLayout headerbar_two; @Bind(R.id.lingshen_lv)//铃声列表 ListView linlv; @Bind(R.id.jiazai) TextView jiazai; List<Ringtone> ll; MediaPlayer mediaPlayer; linsenadapter lad;//adpter boolean flag; // lla; List<String> lpath; List<String> name; @Override public void setContentView(Bundle savedInstanceState) { setContentView(R.layout.activity_choosse_linsen); } @Override public void initView() { headerbar_two.setBackgroundColor(getResources().getColor(R.color.titleblue)); back.setVisibility(View.VISIBLE); back.setImageResource(R.mipmap.back); back.setBackground(getResources().getDrawable(R.drawable.button_default_bg)); sure.setVisibility(View.VISIBLE); sure.setImageResource(R.mipmap.sure); sure.setBackground(getResources().getDrawable(R.drawable.button_default_bg)); title.setTextColor(getResources().getColor(R.color.white)); // final linsenadapter lad=new linsenadapter(getApplicationContext(),ll); // linlv.setAdapter(lad); // startActivity(intent); mediaPlayer=new MediaPlayer(); new Thread() { public void run() { ll=getRingtoneList(RingtoneManager.TYPE_ALARM); lad=new linsenadapter(getApplicationContext(),ll); runOnUiThread(new Runnable() { @Override public void run() { jiazai.setVisibility(View.GONE); linlv.setAdapter(lad); } }); } }.start(); linlv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Slect.setA(position); lad.notifyDataSetChanged(); } }); System.out.println("11111111111116666-----" + RingtoneManager .getDefaultUri(RingtoneManager.TYPE_ALARM)); } @Override public void initEvent() { back.setOnClickListener(this); sure.setOnClickListener(this); } @Override public void initData() { title.setText("添加铃声"); } public List<Ringtone> getRingtoneList(int type){ List<Ringtone> resArr = new ArrayList<>(); lpath=new ArrayList<>(); RingtoneManager manager = new RingtoneManager(this); manager.setType(type); Cursor cursor = manager.getCursor(); int count = cursor.getCount(); // cursor.close(); for(int i = 0 ; i < count ; i ++){ resArr.add(manager.getRingtone(i)); lpath.add(manager.getRingtoneUri(i).toString()); } // save(name,lpath); return resArr; } @Override public void onClick(View v) { super.onClick(v); switch (v.getId()) { case R.id.headbar_left_imagebutton_two: finish(); break; case R.id.headbar_right_imagebutton_two://确定 RingtoneManager manager = new RingtoneManager(this); // String path= getRingtoneUriPath(RingtoneManager.TYPE_ALARM,Slect.getA(),"ss"); ll.get(Slect.getA()).stop(); Toast.makeText(this, Slect.getA() + "dd", Toast.LENGTH_SHORT).show(); SharePreferenceUtils.putString(this, "linshenname", ll.get(Slect.getA()).getTitle(this)); SharePreferenceUtils.putString(this,"linshennamepath",lpath.get(Slect.getA())); finish(); break; } } @Override public void onBackPressed() { super.onBackPressed(); } }
923e0521d19e57b52fd6d7ec478d86ad208e2442
13,249
java
Java
google/apps/drive/activity/v2/google-apps-drive-activity-v2-java/grpc-google-apps-drive-activity-v2-java/src/main/java/com/google/apps/drive/activity/v2/DriveActivityServiceGrpc.java
googleapis/googleapis-gen
d84824c78563d59b0e58d5664bfaa430e9ad7e7a
[ "Apache-2.0" ]
7
2021-02-21T10:39:41.000Z
2021-12-07T07:31:28.000Z
google/apps/drive/activity/v2/google-apps-drive-activity-v2-java/grpc-google-apps-drive-activity-v2-java/src/main/java/com/google/apps/drive/activity/v2/DriveActivityServiceGrpc.java
googleapis/googleapis-gen
d84824c78563d59b0e58d5664bfaa430e9ad7e7a
[ "Apache-2.0" ]
6
2021-02-02T23:46:11.000Z
2021-11-15T01:46:02.000Z
google/apps/drive/activity/v2/google-apps-drive-activity-v2-java/grpc-google-apps-drive-activity-v2-java/src/main/java/com/google/apps/drive/activity/v2/DriveActivityServiceGrpc.java
googleapis/googleapis-gen
d84824c78563d59b0e58d5664bfaa430e9ad7e7a
[ "Apache-2.0" ]
4
2021-01-28T23:25:45.000Z
2021-08-30T01:55:16.000Z
42.329073
180
0.731829
1,000,587
package com.google.apps.drive.activity.v2; import static io.grpc.MethodDescriptor.generateFullMethodName; /** * <pre> * Service for querying activity on Drive items. Activity is user * or system action on Drive items that happened in the past. A Drive item can * be a file or folder, or a Team Drive. * </pre> */ @javax.annotation.Generated( value = "by gRPC proto compiler", comments = "Source: google/apps/drive/activity/v2/drive_activity_service.proto") public final class DriveActivityServiceGrpc { private DriveActivityServiceGrpc() {} public static final String SERVICE_NAME = "google.apps.drive.activity.v2.DriveActivityService"; // Static method descriptors that strictly reflect the proto. private static volatile io.grpc.MethodDescriptor<com.google.apps.drive.activity.v2.QueryDriveActivityRequest, com.google.apps.drive.activity.v2.QueryDriveActivityResponse> getQueryDriveActivityMethod; @io.grpc.stub.annotations.RpcMethod( fullMethodName = SERVICE_NAME + '/' + "QueryDriveActivity", requestType = com.google.apps.drive.activity.v2.QueryDriveActivityRequest.class, responseType = com.google.apps.drive.activity.v2.QueryDriveActivityResponse.class, methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor<com.google.apps.drive.activity.v2.QueryDriveActivityRequest, com.google.apps.drive.activity.v2.QueryDriveActivityResponse> getQueryDriveActivityMethod() { io.grpc.MethodDescriptor<com.google.apps.drive.activity.v2.QueryDriveActivityRequest, com.google.apps.drive.activity.v2.QueryDriveActivityResponse> getQueryDriveActivityMethod; if ((getQueryDriveActivityMethod = DriveActivityServiceGrpc.getQueryDriveActivityMethod) == null) { synchronized (DriveActivityServiceGrpc.class) { if ((getQueryDriveActivityMethod = DriveActivityServiceGrpc.getQueryDriveActivityMethod) == null) { DriveActivityServiceGrpc.getQueryDriveActivityMethod = getQueryDriveActivityMethod = io.grpc.MethodDescriptor.<com.google.apps.drive.activity.v2.QueryDriveActivityRequest, com.google.apps.drive.activity.v2.QueryDriveActivityResponse>newBuilder() .setType(io.grpc.MethodDescriptor.MethodType.UNARY) .setFullMethodName(generateFullMethodName(SERVICE_NAME, "QueryDriveActivity")) .setSampledToLocalTracing(true) .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( com.google.apps.drive.activity.v2.QueryDriveActivityRequest.getDefaultInstance())) .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( com.google.apps.drive.activity.v2.QueryDriveActivityResponse.getDefaultInstance())) .setSchemaDescriptor(new DriveActivityServiceMethodDescriptorSupplier("QueryDriveActivity")) .build(); } } } return getQueryDriveActivityMethod; } /** * Creates a new async stub that supports all call types for the service */ public static DriveActivityServiceStub newStub(io.grpc.Channel channel) { io.grpc.stub.AbstractStub.StubFactory<DriveActivityServiceStub> factory = new io.grpc.stub.AbstractStub.StubFactory<DriveActivityServiceStub>() { @java.lang.Override public DriveActivityServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { return new DriveActivityServiceStub(channel, callOptions); } }; return DriveActivityServiceStub.newStub(factory, channel); } /** * Creates a new blocking-style stub that supports unary and streaming output calls on the service */ public static DriveActivityServiceBlockingStub newBlockingStub( io.grpc.Channel channel) { io.grpc.stub.AbstractStub.StubFactory<DriveActivityServiceBlockingStub> factory = new io.grpc.stub.AbstractStub.StubFactory<DriveActivityServiceBlockingStub>() { @java.lang.Override public DriveActivityServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { return new DriveActivityServiceBlockingStub(channel, callOptions); } }; return DriveActivityServiceBlockingStub.newStub(factory, channel); } /** * Creates a new ListenableFuture-style stub that supports unary calls on the service */ public static DriveActivityServiceFutureStub newFutureStub( io.grpc.Channel channel) { io.grpc.stub.AbstractStub.StubFactory<DriveActivityServiceFutureStub> factory = new io.grpc.stub.AbstractStub.StubFactory<DriveActivityServiceFutureStub>() { @java.lang.Override public DriveActivityServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { return new DriveActivityServiceFutureStub(channel, callOptions); } }; return DriveActivityServiceFutureStub.newStub(factory, channel); } /** * <pre> * Service for querying activity on Drive items. Activity is user * or system action on Drive items that happened in the past. A Drive item can * be a file or folder, or a Team Drive. * </pre> */ public static abstract class DriveActivityServiceImplBase implements io.grpc.BindableService { /** * <pre> * Query past activity in Google Drive. * </pre> */ public void queryDriveActivity(com.google.apps.drive.activity.v2.QueryDriveActivityRequest request, io.grpc.stub.StreamObserver<com.google.apps.drive.activity.v2.QueryDriveActivityResponse> responseObserver) { io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getQueryDriveActivityMethod(), responseObserver); } @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) .addMethod( getQueryDriveActivityMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( new MethodHandlers< com.google.apps.drive.activity.v2.QueryDriveActivityRequest, com.google.apps.drive.activity.v2.QueryDriveActivityResponse>( this, METHODID_QUERY_DRIVE_ACTIVITY))) .build(); } } /** * <pre> * Service for querying activity on Drive items. Activity is user * or system action on Drive items that happened in the past. A Drive item can * be a file or folder, or a Team Drive. * </pre> */ public static final class DriveActivityServiceStub extends io.grpc.stub.AbstractAsyncStub<DriveActivityServiceStub> { private DriveActivityServiceStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { super(channel, callOptions); } @java.lang.Override protected DriveActivityServiceStub build( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { return new DriveActivityServiceStub(channel, callOptions); } /** * <pre> * Query past activity in Google Drive. * </pre> */ public void queryDriveActivity(com.google.apps.drive.activity.v2.QueryDriveActivityRequest request, io.grpc.stub.StreamObserver<com.google.apps.drive.activity.v2.QueryDriveActivityResponse> responseObserver) { io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getQueryDriveActivityMethod(), getCallOptions()), request, responseObserver); } } /** * <pre> * Service for querying activity on Drive items. Activity is user * or system action on Drive items that happened in the past. A Drive item can * be a file or folder, or a Team Drive. * </pre> */ public static final class DriveActivityServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<DriveActivityServiceBlockingStub> { private DriveActivityServiceBlockingStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { super(channel, callOptions); } @java.lang.Override protected DriveActivityServiceBlockingStub build( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { return new DriveActivityServiceBlockingStub(channel, callOptions); } /** * <pre> * Query past activity in Google Drive. * </pre> */ public com.google.apps.drive.activity.v2.QueryDriveActivityResponse queryDriveActivity(com.google.apps.drive.activity.v2.QueryDriveActivityRequest request) { return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getQueryDriveActivityMethod(), getCallOptions(), request); } } /** * <pre> * Service for querying activity on Drive items. Activity is user * or system action on Drive items that happened in the past. A Drive item can * be a file or folder, or a Team Drive. * </pre> */ public static final class DriveActivityServiceFutureStub extends io.grpc.stub.AbstractFutureStub<DriveActivityServiceFutureStub> { private DriveActivityServiceFutureStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { super(channel, callOptions); } @java.lang.Override protected DriveActivityServiceFutureStub build( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { return new DriveActivityServiceFutureStub(channel, callOptions); } /** * <pre> * Query past activity in Google Drive. * </pre> */ public com.google.common.util.concurrent.ListenableFuture<com.google.apps.drive.activity.v2.QueryDriveActivityResponse> queryDriveActivity( com.google.apps.drive.activity.v2.QueryDriveActivityRequest request) { return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getQueryDriveActivityMethod(), getCallOptions()), request); } } private static final int METHODID_QUERY_DRIVE_ACTIVITY = 0; private static final class MethodHandlers<Req, Resp> implements io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>, io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>, io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>, io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> { private final DriveActivityServiceImplBase serviceImpl; private final int methodId; MethodHandlers(DriveActivityServiceImplBase serviceImpl, int methodId) { this.serviceImpl = serviceImpl; this.methodId = methodId; } @java.lang.Override @java.lang.SuppressWarnings("unchecked") public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) { switch (methodId) { case METHODID_QUERY_DRIVE_ACTIVITY: serviceImpl.queryDriveActivity((com.google.apps.drive.activity.v2.QueryDriveActivityRequest) request, (io.grpc.stub.StreamObserver<com.google.apps.drive.activity.v2.QueryDriveActivityResponse>) responseObserver); break; default: throw new AssertionError(); } } @java.lang.Override @java.lang.SuppressWarnings("unchecked") public io.grpc.stub.StreamObserver<Req> invoke( io.grpc.stub.StreamObserver<Resp> responseObserver) { switch (methodId) { default: throw new AssertionError(); } } } private static abstract class DriveActivityServiceBaseDescriptorSupplier implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { DriveActivityServiceBaseDescriptorSupplier() {} @java.lang.Override public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { return com.google.apps.drive.activity.v2.DriveActivityServiceProto.getDescriptor(); } @java.lang.Override public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { return getFileDescriptor().findServiceByName("DriveActivityService"); } } private static final class DriveActivityServiceFileDescriptorSupplier extends DriveActivityServiceBaseDescriptorSupplier { DriveActivityServiceFileDescriptorSupplier() {} } private static final class DriveActivityServiceMethodDescriptorSupplier extends DriveActivityServiceBaseDescriptorSupplier implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { private final String methodName; DriveActivityServiceMethodDescriptorSupplier(String methodName) { this.methodName = methodName; } @java.lang.Override public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { return getServiceDescriptor().findMethodByName(methodName); } } private static volatile io.grpc.ServiceDescriptor serviceDescriptor; public static io.grpc.ServiceDescriptor getServiceDescriptor() { io.grpc.ServiceDescriptor result = serviceDescriptor; if (result == null) { synchronized (DriveActivityServiceGrpc.class) { result = serviceDescriptor; if (result == null) { serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) .setSchemaDescriptor(new DriveActivityServiceFileDescriptorSupplier()) .addMethod(getQueryDriveActivityMethod()) .build(); } } } return result; } }
923e05b6f1d6ca3ef55856da4f5157cffd088fb3
1,115
java
Java
src/main/java/com/yoyo/leetcode/case61/Solution.java
jsxzliyou/leetcode-training
cc101516f731a5578c25c1bf0669245b28f15d89
[ "MIT" ]
null
null
null
src/main/java/com/yoyo/leetcode/case61/Solution.java
jsxzliyou/leetcode-training
cc101516f731a5578c25c1bf0669245b28f15d89
[ "MIT" ]
null
null
null
src/main/java/com/yoyo/leetcode/case61/Solution.java
jsxzliyou/leetcode-training
cc101516f731a5578c25c1bf0669245b28f15d89
[ "MIT" ]
null
null
null
25.340909
55
0.509417
1,000,588
package main.java.com.yoyo.leetcode.case61; public class Solution { public ListNode rotateRight(ListNode head, int k) { if (head == null) return null; if (head.next == null) return head; /* * 应该先将链表闭合成环然后再在合适的位置将链表断开即可 * 1、循环链表记录链表的长度 * 2、将表尾的next赋值为head */ ListNode origin = head; int length = 1; for (;length<Integer.MAX_VALUE;length++) { if (origin.next != null) { origin = origin.next; }else{ origin.next = head; break; } } ListNode newHead = head; ListNode result = null; for (int i = 0;i<length-k%length-1;i++) { newHead = newHead.next; } result = newHead.next; newHead.next = null; return result; } public static void main(String[] args) { ListNode l1 = new ListNode(0); ListNode l2 = new ListNode(1); ListNode l3 = new ListNode(2); l2.next=l3; l1.next=l2; new Solution().rotateRight(l1,4); } }
923e07437068bcb0195f438f6de30326f3432b96
1,881
java
Java
src/main/runners/ExperimentalRunner.java
xzhangpeijin/MovieChainRunner
81f46cb62034661651831c00e9f4ee86f7bcdcbf
[ "Apache-2.0" ]
null
null
null
src/main/runners/ExperimentalRunner.java
xzhangpeijin/MovieChainRunner
81f46cb62034661651831c00e9f4ee86f7bcdcbf
[ "Apache-2.0" ]
null
null
null
src/main/runners/ExperimentalRunner.java
xzhangpeijin/MovieChainRunner
81f46cb62034661651831c00e9f4ee86f7bcdcbf
[ "Apache-2.0" ]
null
null
null
30.33871
86
0.715045
1,000,589
package main.runners; import java.io.File; import java.io.IOException; import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import main.Main; import main.utils.Graph; import main.utils.GraphUtils; import main.walkers.DeterministicWalker; import main.walkers.ExperimentalWalker; import main.walkers.FastWalker; import main.walkers.SlowWalker; import main.walkers.Walker; /** * Searches for the longest path in a given graph * * Writes all intermediate results to file * * Runs one thread per core in random walk unless specified * * @author Peijin Zhang */ @SuppressWarnings("unused") public class ExperimentalRunner { // Start search at 250 private static final int INITIAL_CUTOFF = 250; public static void runExperimental() throws IOException { int threads = Runtime.getRuntime().availableProcessors(); Graph component = Graph.readGraph( ExperimentalRunner.class.getResource("/CompleteComponent.txt")); Graph full = Graph.readGraph( ExperimentalRunner.class.getResource("/ReducedGraph.txt")); List<Integer> initStates = new ArrayList<Integer>(); for (int x = 0; x < component.size(); x++) { if (component.getInEdges(x).size() > 0 && component.getOutEdges(x).size() > 0) { initStates.add(x); } } AtomicInteger maxLength = new AtomicInteger(INITIAL_CUTOFF); Lock fileLock = new ReentrantLock(); System.out.println("Starting Experimental Run"); for (int x = 0; x < 1; x++) { Walker walker = new ExperimentalWalker(component, full, initStates, "results/ExperimentalResults.txt", maxLength, fileLock); Thread search = new Thread(walker); search.start(); } } }
923e07d5e456fb68c976b490a6b2c74e1ec339ab
486
java
Java
Algorithms, PART I/week2/BagStacksQueues/source/stack/LinkedStackOfStrings.java
nando-cezar/data-structure
160720fffadc146b4d1ae797af00e005cb99c344
[ "MIT" ]
null
null
null
Algorithms, PART I/week2/BagStacksQueues/source/stack/LinkedStackOfStrings.java
nando-cezar/data-structure
160720fffadc146b4d1ae797af00e005cb99c344
[ "MIT" ]
null
null
null
Algorithms, PART I/week2/BagStacksQueues/source/stack/LinkedStackOfStrings.java
nando-cezar/data-structure
160720fffadc146b4d1ae797af00e005cb99c344
[ "MIT" ]
null
null
null
18
35
0.537037
1,000,590
public class LinkedStackOfStrings { private Node first = null; private class Node{ String item; Node next; } public boolean isEmpty(){ return first == null; } public void push(String item){ Node oldFirst = first; first = new Node(); first.item = item; first.next = oldFirst; } public String pop(){ String item = first.item; first = first.next; return item; } }
923e07f6726e49a6a4e09605e123fd10f7e0ba16
200
java
Java
src/main/java/com/venti/model/dto/UserRegisterDTO.java
Godlumen/MineMine
7572a685875ded5af79e7c2a04bde2e467f09202
[ "Apache-2.0" ]
null
null
null
src/main/java/com/venti/model/dto/UserRegisterDTO.java
Godlumen/MineMine
7572a685875ded5af79e7c2a04bde2e467f09202
[ "Apache-2.0" ]
null
null
null
src/main/java/com/venti/model/dto/UserRegisterDTO.java
Godlumen/MineMine
7572a685875ded5af79e7c2a04bde2e467f09202
[ "Apache-2.0" ]
null
null
null
16.666667
30
0.735
1,000,591
package com.venti.model.dto; import lombok.Data; @Data public class UserRegisterDTO { private String mail; private String mobile; private String verifyCode; private String passwd; }
923e09775e090ccc9951fb8953bcc0b6f9f2472e
1,814
java
Java
src/main/java/com/all4canid/link/rest/ImportNewContractClientAdapter.java
wsapiens/kafka-link
ee98f396ab2f34b9830a3dcba23ed6506667f89a
[ "MIT" ]
null
null
null
src/main/java/com/all4canid/link/rest/ImportNewContractClientAdapter.java
wsapiens/kafka-link
ee98f396ab2f34b9830a3dcba23ed6506667f89a
[ "MIT" ]
null
null
null
src/main/java/com/all4canid/link/rest/ImportNewContractClientAdapter.java
wsapiens/kafka-link
ee98f396ab2f34b9830a3dcba23ed6506667f89a
[ "MIT" ]
null
null
null
23.868421
97
0.750827
1,000,592
package com.all4canid.link.rest; import java.util.List; import java.util.Optional; import org.apache.commons.lang3.StringUtils; import org.springframework.http.ResponseEntity; import com.all4canid.link.domain.job.LinkJob; //@Component("importNewContractClient") //@Scope("prototype") public class ImportNewContractClientAdapter extends AbstractRestfulClient implements LinkClient { public ImportNewContractClientAdapter() { super(); } public ImportNewContractClientAdapter(String proxyHost, String proxyPort) { super(proxyHost, proxyPort); } @Override public void setAuth(String username, String password) { if(StringUtils.isNotBlank(username)) { this.username = username; } if(StringUtils.isNotBlank(password)) { this.password = password; } } @Override public void setBaseUrl(String baseUrl) { if(StringUtils.isNotBlank(baseUrl)) { this.baseUrl = baseUrl; } } @Override public void setPayloadObject(Object payloadObject) { this.payloadObject = payloadObject; } @Override public LinkJob sendRequest() throws Exception { return sendImportRequest(Optional.of(this.getClass().getSimpleName())); } @Override public ResponseEntity<?> getResults(String uri) throws Exception { return getJsonResult(uri, Optional.of(this.getClass().getSimpleName())); } @Override public void setRequestContextPath(String requstContextPath) { if(StringUtils.isNotBlank(requstContextPath)) { this.requestContextPath = requstContextPath; } } @Override public void setErpAdapterVersion(String erpAdapterVersion) { if(StringUtils.isNotBlank(erpAdapterVersion)) { this.erpAdapterVersion = erpAdapterVersion; } } @Override public void setJobContextErrors(List<String> errors) { if(null != errors) { this.errors = errors; } } }
923e098d6644dcd164ff03c696ec80992cf61c4e
4,275
java
Java
splash/barcodeScanner/src/main/java/cn/hugo/android/scanner/PreferencesFragment.java
VictorXianwu/vscan
084231117f5b63f14a9a1271cd24abfaf3bdcad6
[ "MIT" ]
null
null
null
splash/barcodeScanner/src/main/java/cn/hugo/android/scanner/PreferencesFragment.java
VictorXianwu/vscan
084231117f5b63f14a9a1271cd24abfaf3bdcad6
[ "MIT" ]
null
null
null
splash/barcodeScanner/src/main/java/cn/hugo/android/scanner/PreferencesFragment.java
VictorXianwu/vscan
084231117f5b63f14a9a1271cd24abfaf3bdcad6
[ "MIT" ]
null
null
null
37.5
105
0.641871
1,000,593
package cn.hugo.android.scanner; /** * Created by Victor on 2015/3/20. */ import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Collection; import android.app.AlertDialog; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.CheckBoxPreference; import android.preference.EditTextPreference; import android.preference.Preference; import android.preference.PreferenceFragment; import android.preference.PreferenceScreen; public final class PreferencesFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener { private CheckBoxPreference[] checkBoxPrefs; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); addPreferencesFromResource(R.xml.preferences); PreferenceScreen preferences = getPreferenceScreen(); preferences.getSharedPreferences().registerOnSharedPreferenceChangeListener(this); checkBoxPrefs = findDecodePrefs(preferences, PreferencesActivity.KEY_DECODE_1D_PRODUCT, PreferencesActivity.KEY_DECODE_1D_INDUSTRIAL, PreferencesActivity.KEY_DECODE_QR, PreferencesActivity.KEY_DECODE_DATA_MATRIX, PreferencesActivity.KEY_DECODE_AZTEC, PreferencesActivity.KEY_DECODE_PDF417); disableLastCheckedPref(); EditTextPreference customProductSearch = (EditTextPreference) preferences.findPreference(PreferencesActivity.KEY_CUSTOM_PRODUCT_SEARCH); customProductSearch.setOnPreferenceChangeListener(new CustomSearchURLValidator()); } private static CheckBoxPreference[] findDecodePrefs(PreferenceScreen preferences, String... keys) { CheckBoxPreference[] prefs = new CheckBoxPreference[keys.length]; for (int i = 0; i < keys.length; i++) { prefs[i] = (CheckBoxPreference) preferences.findPreference(keys[i]); } return prefs; } @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { disableLastCheckedPref(); } private void disableLastCheckedPref() { Collection<CheckBoxPreference> checked = new ArrayList<CheckBoxPreference>(checkBoxPrefs.length); for (CheckBoxPreference pref : checkBoxPrefs) { if (pref.isChecked()) { checked.add(pref); } } boolean disable = checked.size() <= 1; for (CheckBoxPreference pref : checkBoxPrefs) { pref.setEnabled(!(disable && checked.contains(pref))); } } private class CustomSearchURLValidator implements Preference.OnPreferenceChangeListener { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { if (!isValid(newValue)) { AlertDialog.Builder builder = new AlertDialog.Builder(PreferencesFragment.this.getActivity()); builder.setTitle("error"); builder.setMessage("invalid value"); builder.setCancelable(true); builder.show(); return false; } return true; } private boolean isValid(Object newValue) { // Allow empty/null value if (newValue == null) { return true; } String valueString = newValue.toString(); if (valueString.isEmpty()) { return true; } // Before validating, remove custom placeholders, which will not // be considered valid parts of the URL in some locations: // Blank %t and %s: valueString = valueString.replaceAll("%[st]", ""); // Blank %f but not if followed by digit or a-f as it may be a hex sequence valueString = valueString.replaceAll("%f(?![0-9a-f])", ""); // Require a scheme otherwise: try { URI uri = new URI(valueString); return uri.getScheme() != null; } catch (URISyntaxException use) { return false; } } } }
923e09f68a7653c897ac5cd76e107302c45003f8
24,737
java
Java
src/main/java/com/ibm/ioc/TypeUtils.java
IBM/java-ioc
503cbece61a84cd0b4013a70b1d42a31937499ff
[ "Apache-2.0" ]
4
2020-07-29T05:45:39.000Z
2021-10-18T17:52:59.000Z
src/main/java/com/ibm/ioc/TypeUtils.java
IBM/java-ioc
503cbece61a84cd0b4013a70b1d42a31937499ff
[ "Apache-2.0" ]
null
null
null
src/main/java/com/ibm/ioc/TypeUtils.java
IBM/java-ioc
503cbece61a84cd0b4013a70b1d42a31937499ff
[ "Apache-2.0" ]
1
2020-09-20T05:04:49.000Z
2020-09-20T05:04:49.000Z
32.463255
117
0.650766
1,000,594
/* * Copyright (c) IBM Corporation 2020. All Rights Reserved. * Project name: java-ioc * This project is licensed under the Apache License 2.0, see LICENSE. */ package com.ibm.ioc; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.math.BigInteger; import java.time.LocalDateTime; import java.time.LocalTime; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.gson.FieldNamingPolicy; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonSyntaxException; import com.ibm.ioc.impl.NamingHelper; import com.ibm.ioc.parsers.BigIntegerParser; import com.ibm.ioc.parsers.IntegerParser; import com.ibm.ioc.parsers.LocalDateTimeParser; import com.ibm.ioc.parsers.LocalTimeParser; import com.ibm.ioc.parsers.LongParser; // Utilities used for reflection and other class related activities public final class TypeUtils { private static final Logger _logger = LoggerFactory.getLogger(TypeUtils.class); public static final String DISALLOW_INVALID_VALUES_TEST_PROPERTY = "configuration.test.disallow-invalid-values"; public static final Gson gson = new GsonBuilder() .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) .registerTypeAdapter(int.class, IntegerParser.getGsonTypeAdapter()) .registerTypeAdapter(Integer.class, IntegerParser.getGsonTypeAdapter()) .registerTypeAdapter(long.class, LongParser.getGsonTypeAdapter()) .registerTypeAdapter(Long.class, LongParser.getGsonTypeAdapter()) .registerTypeAdapter(LocalTime.class, LocalTimeParser.getGsonTypeAdapter()) .registerTypeAdapter(LocalDateTime.class, LocalDateTimeParser.getGsonTypeAdapter()) .registerTypeAdapter(BigInteger.class, BigIntegerParser.getGsonTypeAdapter()) .create(); /** * Class collects primitive class information used to cast, print and parse value of primitive types */ public static class PrimitiveTypeInfo { private final String name; private final Class<?> primitiveClass; private final Class<?> wrapperClass; private final PrimitiveTypeInfo widensTo; @SuppressWarnings("FieldMayBeFinal") private Method parseMethod; @SuppressWarnings("FieldMayBeFinal") private Method printMethod; private PrimitiveTypeInfo(final Class<?> wrapperClass, final PrimitiveTypeInfo widensTo) { this.wrapperClass = wrapperClass; this.widensTo = widensTo; try { this.primitiveClass = (Class<?>) this.wrapperClass.getDeclaredField("TYPE").get(null); this.name = this.primitiveClass.getName(); if (this.primitiveClass != void.class) { if (this.primitiveClass == char.class) { this.parseMethod = TypeUtils.class.getDeclaredMethod("parseChar", String.class); } else { this.parseMethod = this.wrapperClass.getDeclaredMethod( NamingHelper.convertNameIntoJavaMethod(this.name, "parse", null), String.class); this.printMethod = this.wrapperClass.getDeclaredMethod("toString", this.primitiveClass); } } } catch (final NoSuchFieldException | NoSuchMethodException e) { throw new IllegalStateException("Incorrect type information", e); } catch (final IllegalAccessException e) { throw new IllegalStateException(e); } } /** * Primitive name a type is known (int, boolean etc) * * @return */ public String getName() { return this.name; } /** * Corresponding primitive type * * @return */ public Class<?> getPrimitiveClass() { return this.primitiveClass; } /** * Corresponding wrapper class * * @return */ public Class<?> getWrapperClass() { return this.wrapperClass; } /** * Method to be used to parse it from a string * * @return Static method */ public Method getParseMethod() { return this.parseMethod; } /** * Method to convert an object of primitive type into string * * @return */ public Method getPrintMethod() { return this.printMethod; } /** * Verifies whether primitive type is assignable. It is assignable if there is widening to in 1 or more steps int * {@literal --> float short --> double ( short --> int --> float --> double)} * * @param other the other type * @return true if assignable */ public boolean isAssignableFrom(final PrimitiveTypeInfo other) { // Find a long widening path. for (PrimitiveTypeInfo t = other; t != null; t = t.widensTo) { if (t == this) { return true; } } return false; } /** * If one is assignable to another * * @param other * @return */ public boolean isCastableFrom(final PrimitiveTypeInfo other) { // Return true if: // - there is a "widensTo" path from other to this, or vice-versa, // or // - there is a "widensTo" path from other and this to a // common-type // (i.e. the "widensTo" paths from this and other "meet" somewhere) // char is castable to short, because char --> int and short --> int if (isAssignableFrom(other) || other.isAssignableFrom(this)) { return true; } // No linear path to/from other... // If this and other have a widening-path to the same type, then // we can cast from this to other (and vice-versa)... for (PrimitiveTypeInfo t = this.widensTo; t != null; t = t.widensTo) { if (t.isAssignableFrom(other)) { return true; } } return false; } /** * Convinience: object of primitive type converted to a java literal as this primitive * * @param value to be converted * @return java string */ public String printAsJavaLiteral(final Object value) { if (value.getClass().isAssignableFrom(this.wrapperClass)) { return value.toString(); } throw new RuntimeException("Invalid object type " + value.getClass() + "to generate Java " + this.wrapperClass.getName() + " value"); } /** * Convinience: string representation to a java literal as this primitive * * @param value * @return */ public String printAsJavaLiteral(final String value) { try { return printAsJavaLiteral(getParseMethod().invoke(null, value)); } catch (final InvocationTargetException ex) { throw new IllegalStateException("Can't parse value:" + value + " to " + this.wrapperClass.getName() + " type", ex); } catch (final IllegalAccessException ex) { throw new IllegalStateException("Should not happen!", ex); } } } public static final PrimitiveTypeInfo DOUBLE = new PrimitiveTypeInfo(Double.class, null); public static final PrimitiveTypeInfo FLOAT = new PrimitiveTypeInfo(Float.class, DOUBLE) { @Override public String printAsJavaLiteral(final Object value) { if (value.getClass().isAssignableFrom(Float.class)) { return value.toString() + 'f'; } throw new IllegalStateException("Invalid object type " + value.getClass() + "to generate Java float value"); } }; public static final PrimitiveTypeInfo LONG = new PrimitiveTypeInfo(Long.class, FLOAT) { @Override public String printAsJavaLiteral(final Object value) { if (value.getClass().isAssignableFrom(Long.class)) { return value.toString() + 'l'; } throw new IllegalStateException("Invalid object type " + value.getClass() + "to generate Java long value"); } }; public static final PrimitiveTypeInfo INT = new PrimitiveTypeInfo(Integer.class, LONG); public static final PrimitiveTypeInfo SHORT = new PrimitiveTypeInfo(Short.class, INT); public static final PrimitiveTypeInfo CHAR = new PrimitiveTypeInfo(Character.class, INT) { @Override public String printAsJavaLiteral(final Object value) { if (value.getClass().isAssignableFrom(Character.class)) { return "'" + ((Character) value).charValue() + "'"; } throw new IllegalStateException("Invalid object type " + value.getClass() + "to generate Java char value"); } }; public static final PrimitiveTypeInfo BYTE = new PrimitiveTypeInfo(Byte.class, SHORT); public static final PrimitiveTypeInfo BOOLEAN = new PrimitiveTypeInfo(Boolean.class, null); public static final PrimitiveTypeInfo VOID = new PrimitiveTypeInfo(Void.class, null); private static final Map<String, PrimitiveTypeInfo> pnameMap = new HashMap<>(); private static final Map<Class<?>, PrimitiveTypeInfo> wclassMap = new HashMap<>(); static { final PrimitiveTypeInfo[] t = {BOOLEAN, BYTE, CHAR, SHORT, INT, LONG, FLOAT, DOUBLE, VOID}; int i; for (i = 0; i < t.length; i++) { pnameMap.put(t[i].getName(), t[i]); wclassMap.put(t[i].getWrapperClass(), t[i]); } } private TypeUtils() {} /** * PrimitiveInfo by name (int, long), throws if not a correct name * * @param name * @return */ public static PrimitiveTypeInfo getByPrimitiveName(final String name) { final PrimitiveTypeInfo t = findByPrimitiveName(name); if (t == null) { throw new IllegalArgumentException("Not a primitive type: " + name); } return t; } /** * PrimitiveInfo by name (int, long) * * @param name * @return null if not a primitive name */ public static PrimitiveTypeInfo findByPrimitiveName(final String name) { return pnameMap.get(name); } /** * PrimitiveInfo by class (int.class, long.class), throws if not a correct name * * @param pclass * @return */ public static PrimitiveTypeInfo getByPrimitiveClass(final Class<?> pclass) { return getByPrimitiveName(pclass.getName()); } /** * PrimitiveInfo by class (int.class, long.class) * * @param pclass * @return null if invalid class */ public static PrimitiveTypeInfo findByPrimitiveClass(final Class<?> pclass) { return findByPrimitiveName(pclass.getName()); } /** * PrimitiveInfo by wrapper name (Integer, Long) * * @param name * @return null if doesn't exist */ public static PrimitiveTypeInfo findByWrapperName(final String name) { try { return findByWrapperClass(Class.forName(name)); } catch (final ClassNotFoundException e) { return null; } } /** * PrimitiveInfo by wrapper name (Integer, Long), throws if doesn't exist * * @param name * @return */ public static PrimitiveTypeInfo getByWrapperName(final String name) { final PrimitiveTypeInfo t = findByWrapperName(name); if (t == null) { throw new IllegalArgumentException("Not a primitive wrapper class: " + name); } return t; } /** * PrimitiveInfo by wrapper class (Integer.class, Long.class) * * @return */ public static PrimitiveTypeInfo getByWrapperClass(final Class<?> wclass) { final PrimitiveTypeInfo t = findByWrapperClass(wclass); if (t == null) { throw new IllegalArgumentException("Not a primitive wrapper class: " + wclass); } return t; } public static PrimitiveTypeInfo findByWrapperClass(final Class<?> wclass) { return wclassMap.get(wclass); } /** * Checks whether class is primitive * * @param pclass * @return */ public static boolean isPrimitive(final Class<?> pclass) { return findByPrimitiveClass(pclass) != null; } /** * Checks whether name is of a primitive type * * @return */ public static boolean isPrimitive(final String name) { return findByPrimitiveName(name) != null; } /** * Checks whether type 'to' is assignable 'from' including primitives * * @param to * @param from * @return */ public static boolean isAssignableFrom(final Class<?> to, final Class<?> from) { Class<?> primitiveCandidateTo = findPrimitiveFor(to); if (primitiveCandidateTo == null) { primitiveCandidateTo = to; } Class<?> primitiveCandidateFrom = findPrimitiveFor(from); if (primitiveCandidateFrom == null) { primitiveCandidateFrom = from; } // Choose how to compare, as primitives or as regulat types if (primitiveCandidateTo.isPrimitive() && primitiveCandidateFrom.isPrimitive()) { return getByPrimitiveClass(primitiveCandidateTo).isAssignableFrom( getByPrimitiveClass(primitiveCandidateFrom)); } return getNonPrimitiveFor(to).isAssignableFrom( getNonPrimitiveFor(from)); } /** * Wrapper class from a primitive type * * @param pclass primitive type * @return corresponding wrapper */ public static Class<?> getWrapperFor(final Class<?> pclass) { return getByPrimitiveClass(pclass).getWrapperClass(); } /** * Returns a non primitive type corresponding clazz * * @param clazz * @return return itself if not a primitive, a wrapper otherwise */ public static Class<?> getNonPrimitiveFor(final Class<?> clazz) { if (!clazz.isPrimitive()) { return clazz; } return getWrapperFor(clazz); } /** * Primitive type for a given wrapper class * * @param wclass * @return */ public static Class<?> getPrimitiveFor(final Class<?> wclass) { return getByWrapperClass(wclass).getPrimitiveClass(); } /** * Primitive type for a given wrapper class, null if it is not primitive * * @return */ public static Class<?> findPrimitiveFor(final Class<?> clazz) { if (clazz.isPrimitive()) { return clazz; } final PrimitiveTypeInfo info = findByWrapperClass(clazz); if (info != null) { return info.getPrimitiveClass(); } return null; } /** * Character requires a special parsing * * @param str string top parse from * @return character */ public static char parseChar(final String str) { if (str.length() == 0) { return '\0'; } else if (str.length() > 1) { throw new IllegalArgumentException("String too long to convert to char: " + str); } else { return str.charAt(0); } } /** * Convinienece method to create list of types * * @param args * @return */ public static String listOfClassesToStr(final Class<?>[] args) { final StringBuilder res = new StringBuilder(); for (int i = 0; i < args.length; i++) { if (i > 0) { res.append(", "); } res.append(args[i].getName()); } return res.toString(); } /** * Tries to find the first signature that could be invoked without run-time error This is not ideal but seems to be * quite adequate * * @param clazz Class upon which a method is looked * @param methodName Method name * @param parameterTypes argument types * @param includeStatic include or not static methdods in search * @return Method object if found null otherwise */ public static Method getMatchingMethod( final Class<?> clazz, final String methodName, final Class<?>[] parameterTypes, final boolean includeStatic) { final Method[] allMethods = clazz.getMethods(); for (final Method method : allMethods) { if (!method.getName().equals(methodName)) { continue; } if (!includeStatic && Modifier.isStatic(method.getModifiers())) { continue; } // Check wheather each parameter is assignable if (parameterTypes.length != method.getParameterTypes().length) { continue; } int i; for (i = 0; i < parameterTypes.length; i++) { if (!isAssignableFrom(method.getParameterTypes()[i], parameterTypes[i])) { break; } } if (i == parameterTypes.length) { return method; } } return null; } public static <T> List<T> createListOfType() { return new ArrayList<>(); } @SuppressWarnings("unchecked") /** * Creates and populates list from initializers, return null if conversion fails. * * @param type to be converted to * @param initialzers list of string with values * @return ;ist of specified type * @throws IllegalArgumentException */ public static <T> List<T> createListOfType(final Class<T> type, final List<String> initialzers) throws IllegalArgumentException { final List<T> list = new ArrayList<>(initialzers.size()); for (final String s : initialzers) { final Object obj = createObjectFromString(type, s); if (obj == null) { throw new IllegalArgumentException( String.format("Failed to convert %s to type %s, list initialziers %s", s, type, initialzers)); } list.add((T) obj); } return list; } @SuppressWarnings({"unchecked"}) public static Object createObjectFromString(final Type type, final String stringValue) { if (type.equals(String.class)) { return stringValue; } if (stringValue == null || stringValue.isEmpty()) { return null; } final Class<?> rawType = getRawType(type); final Class<?> wrapperType = getNonPrimitiveFor(rawType); Object convertedObject = null; Method conversionMethod; final String[] stringConversionSuspects = new String[] {"valueOf", "fromString", "decode"}; final List<String> caseCandidates; if (rawType.isEnum()) { caseCandidates = Arrays.asList(stringValue, stringValue.toUpperCase(), stringValue.toLowerCase(), NamingHelper.convertNameIntoJava(stringValue, null, null, true)); } else { caseCandidates = Arrays.asList(stringValue); } for (final String conversionSuspect : stringConversionSuspects) { for (final String val : caseCandidates) { try { conversionMethod = wrapperType.getMethod(conversionSuspect, String.class); if (conversionMethod != null && Modifier.isStatic(conversionMethod.getModifiers()) && isAssignableFrom(rawType, conversionMethod.getReturnType())) { convertedObject = conversionMethod.invoke(null, val); } } catch (final Exception ignore) { // Ignore } if (convertedObject != null) { break; } } if (convertedObject != null) { break; } } if (convertedObject == null) { // Try to find a helper parser class for a given type final String fullClassName = wrapperType.getName(); final String[] splitClassName = fullClassName.split("\\."); final String helperParserClassName = "com.ibm.ioc.parsers." + splitClassName[splitClassName.length - 1] + "Parser"; try { final Class<?> parser = Class.forName(helperParserClassName); conversionMethod = parser.getDeclaredMethod("parse", String.class); if (conversionMethod != null && Modifier.isStatic(conversionMethod.getModifiers()) && isAssignableFrom(rawType, conversionMethod.getReturnType())) { convertedObject = conversionMethod.invoke(null, stringValue); } } catch (final Exception ignore) { convertedObject = null; } } // If still null, try converting from json if (convertedObject == null) { try { convertedObject = gson.fromJson(stringValue, type); } catch (final JsonSyntaxException e) { // Ignore } catch (final RuntimeException e) { _logger.error("Gson threw a runtime exception other than JsonSyntaxException - BAD GSON", e); } } // If still null, and expected type is a List, try converting from a complex list type if (convertedObject == null && type instanceof ParameterizedType) { final ParameterizedType parameterizedType = (ParameterizedType) type; final Type listGenericType = parameterizedType.getActualTypeArguments()[0]; // Skip List<String> because that should already be evaluated directly from gson if (parameterizedType.getRawType() == List.class && listGenericType != String.class) { try { class InnerClass { @SuppressWarnings("unused") public List<String> stringList; } final Type listType; try { listType = InnerClass.class.getField("stringList").getGenericType(); } catch (NoSuchFieldException | SecurityException e) { throw new RuntimeException(e); } final List<String> stringList = gson.fromJson(stringValue, listType); @SuppressWarnings("rawtypes") final List list = createListOfType(); boolean validList = true; for (final String listItemStr : stringList) { final Object obj = createObjectFromString(listGenericType, listItemStr); if (obj == null) { validList = false; break; } list.add(obj); } if (validList) { convertedObject = list; } } catch (final JsonSyntaxException e) { // Ignore } } } // Finally just try a constructor // This is purposely the last try because we prefer to try other things first (see above) if (convertedObject == null) { // Try if constructor exists try { final Constructor<?> constructor = wrapperType.getConstructor(String.class); if (constructor != null) { constructor.setAccessible(true); convertedObject = constructor.newInstance(stringValue); } } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ignore) { // Ignore } } if (convertedObject == null && wrapperType.isAssignableFrom(String.class)) { convertedObject = stringValue; } // If this is a bindings test where strict default properties are checked // and the string value couldn't be converted to the expected object type, OR // the expected object type is a boolean but the string value is not "true" or "false", // then throw an IllegalArgumentException if (Boolean.valueOf(System.getProperty(DISALLOW_INVALID_VALUES_TEST_PROPERTY)) && (convertedObject == null || (Boolean.class.equals(wrapperType) && !isValidBoolean(stringValue)))) { throw new IllegalArgumentException( new IllegalConfigurationContentException("Could not convert \"" + stringValue + "\" to " + type)); } return convertedObject; } private static boolean isValidBoolean(final String string) { final String lowerCase = string.toLowerCase(); return Boolean.toString(true).equals(lowerCase) || Boolean.toString(false).equals(lowerCase); } public static Class<?> getRawType(final Type type) { return (Class<?>) ((type instanceof ParameterizedType) ? ((ParameterizedType) type).getRawType() : type); } /** * Returns a generic type of a given type and the generic class. A type could be implementing multiple interfaces, * each genericised with different types. This is why the generic class is required to determine the generic type. * * Examples: * * type = {@literal List<Integer>}, genericClass = List. Returns Integer. * * type = IntegerList (extends {@literal List<Integer>}), genericClass = List. Returns Integer. * * @param type * @param genericClass * @return */ public static Type[] getGenericTypes( final Type type, final Class<?> genericClass) { final Class<?> rawType = getRawType(type); if (genericClass.isAssignableFrom(getRawType(type))) { // If the type is a GenericClass<B,C>, return B,C if (type instanceof ParameterizedType) { return ((ParameterizedType) type).getActualTypeArguments(); } else { // If the type is a Something extends GenericClass<B,C>, return B,C final Type[] types = rawType.getGenericInterfaces(); for (final Type t : types) { final Type[] genericTypes = getGenericTypes(t, genericClass); if (genericTypes.length > 0) { return genericTypes; } } } } return new Type[0]; } }
923e0aa323d76e2d6e4029c8a6aa0840108f9357
3,822
java
Java
swift-base/swift-base-io/src/main/java/com/fr/swift/cube/io/impl/fineio/output/ByteArrayFineIoWriter.java
rofinily/intelli-swift-core
9d293d42f54041cf18f996f3004d09bd9f27b1a7
[ "Apache-2.0" ]
null
null
null
swift-base/swift-base-io/src/main/java/com/fr/swift/cube/io/impl/fineio/output/ByteArrayFineIoWriter.java
rofinily/intelli-swift-core
9d293d42f54041cf18f996f3004d09bd9f27b1a7
[ "Apache-2.0" ]
null
null
null
swift-base/swift-base-io/src/main/java/com/fr/swift/cube/io/impl/fineio/output/ByteArrayFineIoWriter.java
rofinily/intelli-swift-core
9d293d42f54041cf18f996f3004d09bd9f27b1a7
[ "Apache-2.0" ]
null
null
null
32.117647
138
0.664574
1,000,595
package com.fr.swift.cube.io.impl.fineio.output; import com.fr.swift.cube.io.impl.fineio.input.LongFineIoReader; import com.fr.swift.cube.io.input.LongReader; import com.fr.swift.cube.io.output.ByteArrayWriter; import com.fr.swift.cube.io.output.ByteWriter; import com.fr.swift.cube.io.output.IntWriter; import com.fr.swift.cube.io.output.LongWriter; import com.fr.swift.util.Crasher; import com.fr.swift.util.IoUtil; import java.net.URI; /** * @author anchore */ public class ByteArrayFineIoWriter implements ByteArrayWriter { private ByteWriter contentWriter; private LongWriter positionWriter; private IntWriter lengthWriter; private LongWriter lastPosWriter; private long curPos; private ByteArrayFineIoWriter(ByteWriter contentWriter, LongWriter positionWriter, IntWriter lengthWriter, LongWriter lastPosWriter) { this.contentWriter = contentWriter; this.positionWriter = positionWriter; this.lengthWriter = lengthWriter; this.lastPosWriter = lastPosWriter; } public static ByteArrayWriter build(URI location, boolean isOverwrite) { ByteArrayFineIoWriter bafw = getByteArrayFineIoWriter(location, isOverwrite); if (!isOverwrite) { bafw.curPos = getLastPosition(location); } return bafw; } private static ByteArrayFineIoWriter getByteArrayFineIoWriter(URI location, boolean isOverwrite) { // 获得内容部分的byte类型Writer URI contentLocation = URI.create(location.getPath() + "/" + CONTENT); ByteWriter contentWriter = ByteFineIoWriter.build(contentLocation, isOverwrite); // 获得位置部分的long类型Writer URI positionLocation = URI.create(location.getPath() + "/" + POSITION); LongWriter positionWriter = LongFineIoWriter.build(positionLocation, isOverwrite); // 获得长度部分的int类型Writer URI lengthLocation = URI.create(location.getPath() + "/" + LENGTH); IntWriter lengthWriter = IntFineIoWriter.build(lengthLocation, isOverwrite); // 获得最后位置部分的long类型Writer URI lastPosLocation = URI.create(location.getPath() + "/" + LAST_POSITION); LongWriter lastPosWriter = LongFineIoWriter.build(lastPosLocation, true); return new ByteArrayFineIoWriter(contentWriter, positionWriter, lengthWriter, lastPosWriter); } /** * last position是用于edit的场景 * over write场景不用它 * * @param location 位置 * @return 上次写的位置 */ private static long getLastPosition(URI location) { try { URI lastPosLocation = URI.create(location.getPath() + "/" + LAST_POSITION); LongReader lastPosReader = LongFineIoReader.build(lastPosLocation); return lastPosReader.isReadable() ? lastPosReader.get(0) : 0; } catch (Exception e) { return Crasher.crash("cannot get last position", e); } } @Override public void flush() { contentWriter.flush(); positionWriter.flush(); lengthWriter.flush(); lastPosWriter.put(0, curPos); lastPosWriter.flush(); } @Override public void release() { lastPosWriter.put(0, curPos); IoUtil.release(lastPosWriter, contentWriter, positionWriter, lengthWriter); contentWriter = null; positionWriter = null; lengthWriter = null; lastPosWriter = null; } @Override public void put(long pos, byte[] val) { if (val == null) { val = NULL_VALUE; } int len = val.length; positionWriter.put(pos, curPos); lengthWriter.put(pos, len); for (int i = 0; i < len; i++) { contentWriter.put(curPos + i, val[i]); } curPos += len; } @Override public void resetContentPosition() { curPos = 0; } }
923e0af1e9e5f11982f061d3162bb7374a811f6a
235
java
Java
examples/src/main/java/net/jbock/examples/AllFlagsArguments.java
AlexRogalskiy/jbock
cb2c78a7bc2164bbf763e7f28e8b84b4530cfef0
[ "MIT" ]
null
null
null
examples/src/main/java/net/jbock/examples/AllFlagsArguments.java
AlexRogalskiy/jbock
cb2c78a7bc2164bbf763e7f28e8b84b4530cfef0
[ "MIT" ]
1
2021-11-16T02:34:18.000Z
2021-11-16T02:34:28.000Z
examples/src/main/java/net/jbock/examples/AllFlagsArguments.java
AlexRogalskiy/jbock
cb2c78a7bc2164bbf763e7f28e8b84b4530cfef0
[ "MIT" ]
null
null
null
15.666667
34
0.744681
1,000,596
package net.jbock.examples; import net.jbock.Command; import net.jbock.Option; @Command abstract class AllFlagsArguments { @Option("smallFlag") abstract boolean smallFlag(); @Option("bigFlag") abstract Boolean bigFlag(); }
923e0b7b9c104c6d4ad26ce1126dc65ed215e17e
1,548
java
Java
modules/core/src/main/java/org/mapton/core/actions/ClearBackgroundImageAction.java
trixon/netbeans-mapton
fe97a40e99053c014d35b8d3e0db291e3623385f
[ "Apache-2.0" ]
null
null
null
modules/core/src/main/java/org/mapton/core/actions/ClearBackgroundImageAction.java
trixon/netbeans-mapton
fe97a40e99053c014d35b8d3e0db291e3623385f
[ "Apache-2.0" ]
1
2018-05-05T13:47:23.000Z
2018-05-05T13:47:23.000Z
modules/core/src/main/java/org/mapton/core/actions/ClearBackgroundImageAction.java
trixon/netbeans-mapton
fe97a40e99053c014d35b8d3e0db291e3623385f
[ "Apache-2.0" ]
null
null
null
32.93617
92
0.752584
1,000,597
/* * Copyright 2022 Patrik Karlström. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mapton.core.actions; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import org.mapton.api.Mapton; import org.mapton.core.api.BaseAction; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.awt.ActionRegistration; import org.openide.util.NbBundle; @ActionID( category = "Mapton", id = "org.mapton.core.actions.ClearBackgroundImageAction" ) @ActionRegistration( displayName = "#CTL_ClearBackgroundImageAction" ) @ActionReference(path = "Shortcuts", name = "DS-J") @NbBundle.Messages("CTL_ClearBackgroundImageAction=Clear background image") public final class ClearBackgroundImageAction extends BaseAction implements ActionListener { public static String getName() { return Bundle.CTL_ClearBackgroundImageAction(); } @Override public void actionPerformed(ActionEvent e) { Mapton.clearBackgroundImage(); } }
923e0c0eaf46aabc1046b9243f944ab34a103f5b
3,735
java
Java
afero-sdk-core/src/main/java/io/afero/sdk/conclave/CompressedInputStream.java
marnberg/AferoJavaSDK
731c40dadf40a3eb0b05180c264b816ed69bed86
[ "MIT" ]
null
null
null
afero-sdk-core/src/main/java/io/afero/sdk/conclave/CompressedInputStream.java
marnberg/AferoJavaSDK
731c40dadf40a3eb0b05180c264b816ed69bed86
[ "MIT" ]
2
2021-07-09T22:03:33.000Z
2021-07-15T20:41:16.000Z
afero-sdk-core/src/main/java/io/afero/sdk/conclave/CompressedInputStream.java
marnberg/AferoJavaSDK
731c40dadf40a3eb0b05180c264b816ed69bed86
[ "MIT" ]
2
2021-07-06T17:33:35.000Z
2021-08-12T20:57:00.000Z
27.873134
70
0.52423
1,000,598
/* * Copyright (c) 2014-2017 Afero, Inc. All rights reserved. */ package io.afero.sdk.conclave; import java.io.EOFException; import java.io.FilterInputStream; import java.io.IOException; import java.io.InputStream; import java.util.zip.DataFormatException; import java.util.zip.Inflater; public class CompressedInputStream extends FilterInputStream { /** * Buffer of compressed data read from the stream */ private byte[] inBuf = null; /** * Length of data in the input data */ private int inLength = 0; /** * Buffer of uncompressed data */ private byte[] outBuf = null; /** * Offset and length of uncompressed data */ private int outOffs = 0; private int outLength = 0; /** * Inflater for decompressing */ private Inflater inflater = null; public CompressedInputStream(InputStream is) throws IOException { super(is); inflater = new Inflater(); } private void readAndDecompress() throws IOException { inLength = in.available(); outLength = inLength; // Make sure we've got enough space to read the block if ((inBuf == null) || (inLength > inBuf.length)) { inBuf = new byte[inLength]; } if ((outBuf == null) || (outLength > outBuf.length)) { outBuf = new byte[outLength]; } // Read until we're got the entire compressed buffer. // read(...) will not necessarily block until all // requested data has been read, so we loop until // we're done. int inOffs = 0; while (inOffs < inLength) { int inCount = in.read(inBuf, inOffs, inLength - inOffs); if (inCount == -1) { throw new EOFException(); } inOffs += inCount; } inflater.setInput(inBuf, 0, inLength); try { inflater.inflate(outBuf); } catch (DataFormatException dfe) { throw new IOException( "Data format exception - " + dfe.getMessage()); } // Reset the inflator so we can re-use it for the // next block inflater.reset(); outOffs = 0; } public int read() throws IOException { if (outOffs >= outLength) { try { readAndDecompress(); } catch (EOFException eof) { return -1; } } return outBuf[outOffs++] & 0xff; } public int read(byte[] b, int off, int len) throws IOException { int count = 0; while (count < len) { if (outOffs >= outLength) { try { // If we've read at least one decompressed // byte and further decompression would // require blocking, return the count. if ((count > 0) && (in.available() == 0)) return count; else readAndDecompress(); } catch (EOFException eof) { if (count == 0) count = -1; return count; } } int toCopy = Math.min(outLength - outOffs, len - count); System.arraycopy(outBuf, outOffs, b, off + count, toCopy); outOffs += toCopy; count += toCopy; } return count; } public int available() throws IOException { // This isn't precise, but should be an adequate // lower bound on the actual amount of available data return (outLength - outOffs) + in.available(); } }
923e0c5d9d95aafecf091bd50458f60aaff2cbdd
6,258
java
Java
src/GUI/GUI.java
kylemarino22/equationSolver
2ffa1fe60a3a705c260d269dfa40f7029fbe6cd7
[ "MIT" ]
2
2018-04-23T20:51:23.000Z
2019-12-05T02:11:18.000Z
src/GUI/GUI.java
kylemarino22/equationSolver
2ffa1fe60a3a705c260d269dfa40f7029fbe6cd7
[ "MIT" ]
null
null
null
src/GUI/GUI.java
kylemarino22/equationSolver
2ffa1fe60a3a705c260d269dfa40f7029fbe6cd7
[ "MIT" ]
null
null
null
38.392638
110
0.654043
1,000,599
package GUI; import GUI.Components.CheckBox; import GUI.Components.TextBox; import GUI.GraphicsUtils.*; import GUI.Components.Button; import GUI.Components.TextField; import com.sun.corba.se.impl.orbutil.graph.Graph; import java.awt.image.BufferedImage; import java.awt.*; import static GUI.Events.EventManager.setNewEquation; public class GUI { private static final int MARGIN_BOTTOM = 100; private static final int MARGIN_RIGHT = 300; private static int scr_height; private static int scr_width; private static ImageLoader IL; private static TextField equationInputField; private static Button enterButton; private static TextBox settingText; private static TextBox xRangeText; private static TextField minXRange; private static TextField maxXRange; private static TextBox yRangeText; private static TextField minYRange; private static TextField maxYRange; private static CheckBox gridToggle; private static TextBox gridToggleText; public static void setup(int width, int height) { scr_height = height; scr_width = width; IL = new ImageLoader(scr_width - MARGIN_RIGHT, scr_height - MARGIN_BOTTOM); CheckBox.loadCheckImage("res/check.png"); equationInputField = new TextField(0,scr_height-MARGIN_BOTTOM, MARGIN_BOTTOM, scr_width-MARGIN_RIGHT); equationInputField.setDefaultText("Enter Equation"); enterButton = new Button(scr_width-MARGIN_RIGHT-120, scr_height-67, 35, 100 ); enterButton.setText("Enter"); enterButton.setDefaultColor(new Color (92, 191, 95)); enterButton.setHighlightColor(new Color (110,191,110)); enterButton.setRoundCorners(10); enterButton.setFontAttributes(15, Font.PLAIN); enterButton.setShadowSize(1); equationInputField.addSubmitButton(enterButton); enterButton.func = () -> { ImageLoader.planeXmin = Double.parseDouble(minXRange.text); ImageLoader.planeXmax = Double.parseDouble(maxXRange.text); ImageLoader.planeYmin = Double.parseDouble(minYRange.text); ImageLoader.planeYmax = Double.parseDouble(maxYRange.text); setNewEquation(equationInputField.text); }; settingText = new TextBox(scr_width-MARGIN_RIGHT, 30, 30, MARGIN_RIGHT); settingText.setText("Settings"); settingText.setFontAttributes(15,Font.PLAIN); xRangeText = new TextBox(scr_width-MARGIN_RIGHT, 60, 20, MARGIN_RIGHT); xRangeText.setText("Real-Axis: to "); xRangeText.setFontAttributes(10,Font.PLAIN); minXRange = new TextField(scr_width - 170, 60, 20, 40); minXRange.setDefaultText("-4"); minXRange.setShadowSize(1); minXRange.setFontAttributes(10,Font.PLAIN); maxXRange = new TextField(scr_width - 110, 60, 20, 40); maxXRange.setDefaultText("4"); maxXRange.setShadowSize(1); maxXRange.setFontAttributes(10,Font.PLAIN); yRangeText = new TextBox(scr_width- MARGIN_RIGHT, 90, 20, MARGIN_RIGHT-30); yRangeText.setText("Imaginary-Axis: to "); yRangeText.setFontAttributes(10,Font.PLAIN); minYRange = new TextField(scr_width - 170, 90, 20, 40); minYRange.setDefaultText("-4"); minYRange.setShadowSize(1); minYRange.setFontAttributes(10,Font.PLAIN); maxYRange = new TextField(scr_width - 110, 90, 20, 40); maxYRange.setDefaultText("4"); maxYRange.setShadowSize(1); maxYRange.setFontAttributes(10,Font.PLAIN); gridToggleText = new TextBox(scr_width-MARGIN_RIGHT+63, 130, 15, 100); gridToggleText.setText("Grid:"); gridToggleText.setFontAttributes(10,Font.PLAIN); gridToggle = new CheckBox(scr_width - 162, 130, 15, 15); gridToggle.setRoundCorners(5); gridToggle.setCheckImageInset(2); gridToggle.setDefaultColor(new Color (45, 177, 207)); gridToggle.setHighlightColor(new Color (45, 177, 207,255/5)); gridToggle.setCheckColor(Color.white); } public static void render(Graphics2D g) throws NullCanvasException { g.setBackground(Color.decode("#F5F5F5")); g.setColor(new Color(0,0,0)); g.fillRect(0,0,scr_width,scr_height); BufferedImage canvas; try { canvas = IL.updateImage(); g.drawImage(canvas,0,0, null); } catch (NullPointerException e) { } g.setColor(new Color(255,255,255)); //white g.fillRect(scr_width-MARGIN_RIGHT,0, MARGIN_RIGHT, scr_height); equationInputField.draw(g); enterButton.draw(g); settingText.draw(g); xRangeText.draw(g); minXRange.draw(g); maxXRange.draw(g); yRangeText.draw(g); minYRange.draw(g); maxYRange.draw(g); gridToggleText.draw(g); gridToggle.draw(g); if (gridToggle.isChecked()) { drawGridLines(g); } g.setColor(Color.decode("#B9B9B9")); // g.setStroke(new BasicStroke(1)); g.drawLine(0,scr_height-MARGIN_BOTTOM,scr_width-MARGIN_RIGHT, scr_height-MARGIN_BOTTOM); g.drawLine(scr_width-MARGIN_RIGHT,0,scr_width-MARGIN_RIGHT, scr_height); } private static void drawGridLines (Graphics2D g) { int imgWidth = scr_width-MARGIN_RIGHT; int imgHeight = scr_height-MARGIN_BOTTOM; g.setStroke(new BasicStroke(1)); g.setColor(new Color(255,255,255,150)); for (int i = 0; imgWidth/2 + i*imgWidth/10 < imgWidth; i++) { g.drawLine(imgWidth/2 + i*imgWidth/10,0,imgWidth/2 + i*imgWidth/10,imgHeight); } for (int i = 1; imgWidth/2 - i*imgWidth/10 > 0; i++) { g.drawLine(imgWidth/2 - i*imgWidth/10,0,imgWidth/2 - i*imgWidth/10,imgHeight); } for (int i = 0; imgHeight/2 + i*imgHeight/10 < imgHeight; i++) { g.drawLine(0,imgHeight/2 + i*imgHeight/10,imgWidth, imgHeight/2 + i*imgHeight/10); } for (int i = 1; imgHeight/2 - i*imgHeight/10 > 0; i++) { g.drawLine(0,imgHeight/2 - i*imgHeight/10,imgWidth, imgHeight/2 - i*imgHeight/10); } } }
923e0c77236d948f58cfd9f050e19be09a59db33
3,453
java
Java
src/main/java/duelistmod/cards/ComicHand.java
ascriptmaster/StS-DuelistMod
251c29117779f0e75c3424263e669b720f35ed1a
[ "Unlicense" ]
3
2019-06-20T08:52:04.000Z
2020-06-17T19:32:05.000Z
src/main/java/duelistmod/cards/ComicHand.java
ascriptmaster/StS-DuelistMod
251c29117779f0e75c3424263e669b720f35ed1a
[ "Unlicense" ]
7
2019-04-22T12:26:08.000Z
2021-01-18T02:45:58.000Z
src/main/java/duelistmod/cards/ComicHand.java
ascriptmaster/StS-DuelistMod
251c29117779f0e75c3424263e669b720f35ed1a
[ "Unlicense" ]
2
2019-12-06T14:30:34.000Z
2020-03-29T15:43:02.000Z
29.767241
97
0.703446
1,000,600
package duelistmod.cards; import com.megacrit.cardcrawl.actions.AbstractGameAction.AttackEffect; import com.megacrit.cardcrawl.cards.AbstractCard; import com.megacrit.cardcrawl.characters.AbstractPlayer; import com.megacrit.cardcrawl.core.CardCrawlGame; import com.megacrit.cardcrawl.localization.CardStrings; import com.megacrit.cardcrawl.monsters.AbstractMonster; import duelistmod.DuelistMod; import duelistmod.abstracts.DuelistCard; import duelistmod.patches.AbstractCardEnum; import duelistmod.variables.*; public class ComicHand extends DuelistCard { // TEXT DECLARATION public static final String ID = DuelistMod.makeID("ComicHand"); private static final CardStrings cardStrings = CardCrawlGame.languagePack.getCardStrings(ID); public static final String IMG = DuelistMod.makePath(Strings.COMIC_HAND); public static final String NAME = cardStrings.NAME; public static final String DESCRIPTION = cardStrings.DESCRIPTION; public static final String UPGRADE_DESCRIPTION = cardStrings.UPGRADE_DESCRIPTION; // /TEXT DECLARATION/ // STAT DECLARATION private static final CardRarity RARITY = CardRarity.UNCOMMON; private static final CardTarget TARGET = CardTarget.SELF; private static final CardType TYPE = CardType.ATTACK; public static final CardColor COLOR = AbstractCardEnum.DUELIST_SPELLS; private static final AttackEffect AFX = AttackEffect.SLASH_HORIZONTAL; private static final int COST = 1; // /STAT DECLARATION/ public ComicHand() { super(ID, NAME, IMG, COST, DESCRIPTION, TYPE, COLOR, RARITY, TARGET); this.tags.add(Tags.SPELL); this.tags.add(Tags.ALL); this.tags.add(Tags.TOON_POOL); this.tags.add(Tags.TOON_DONT_TRIG); this.misc = 0; this.originalName = this.name; this.damage = this.baseDamage = 12; this.upgradeDmg = 6; } // Actions the card should do. @Override public void use(AbstractPlayer p, AbstractMonster m) { int tokens = xCostTribute(Tags.TOON_POOL); for (int i = 0; i < tokens; i++) { DuelistCard tempCard = (DuelistCard) returnTrulyRandomFromSet(Tags.MONSTER); summon(player(), 1, tempCard); AbstractMonster randomM = getRandomMonster(); if (randomM != null) { attack(randomM, AFX, this.damage); } } } // Which card to return when making a copy of this card. @Override public AbstractCard makeCopy() { return new ComicHand(); } // Upgraded stats. @Override public void upgrade() { if (!this.upgraded) { this.upgradeName(); this.upgradeDamage(this.upgradeDmg); this.rawDescription = UPGRADE_DESCRIPTION; this.initializeDescription(); } } @Override public void onTribute(DuelistCard tributingCard) { // TODO Auto-generated method stub } @Override public void onResummon(int summons) { // TODO Auto-generated method stub } @Override public void summonThis(int summons, DuelistCard c, int var) { // TODO Auto-generated method stub } @Override public void summonThis(int summons, DuelistCard c, int var, AbstractMonster m) { // TODO Auto-generated method stub } @Override public String getID() { return ID; } @Override public void optionSelected(AbstractPlayer arg0, AbstractMonster arg1, int arg2) { // TODO Auto-generated method stub } }
923e0cb5b6ae8f2aa8861ef9d3b0a753ccba1669
946
java
Java
dubbo-user/user-api/src/main/java/com/funi/distributedcomputer/dubbo/user/constants/ResponseCodeEnum.java
zengshunyao/dubbo-parent
749ec62107166457fa04bc2cc8c725015dd6f0b4
[ "Apache-2.0" ]
null
null
null
dubbo-user/user-api/src/main/java/com/funi/distributedcomputer/dubbo/user/constants/ResponseCodeEnum.java
zengshunyao/dubbo-parent
749ec62107166457fa04bc2cc8c725015dd6f0b4
[ "Apache-2.0" ]
2
2020-05-15T21:54:50.000Z
2021-01-21T00:32:27.000Z
dubbo-user/user-api/src/main/java/com/funi/distributedcomputer/dubbo/user/constants/ResponseCodeEnum.java
zengshunyao/dubbo-parent
749ec62107166457fa04bc2cc8c725015dd6f0b4
[ "Apache-2.0" ]
null
null
null
24.25641
58
0.628964
1,000,601
package com.funi.distributedcomputer.dubbo.user.constants; public enum ResponseCodeEnum { /** * 公共系统返回码 (第四位是0) */ SYS_SUCCESS("000000", "成功"), SYS_PARAM_NOT_RIGHT("001001", "请求数据校验失败"), QUERY_DATA_NOT_EXIST("001002", "查询数据不存在"), STATUS_NOT_RIGHT("001003", "数据状态校验不通过"), REQUEST_DATA_NOT_EXIST("001004", "请求提交的数据不存在"), USER_NOT_LOGIN("001006", "用户未登录"), USER_OR_PASSWORD_ERROR("001007", "用户不存在或帐号密码错误"), ACCESS_LIMITER("001008", "访问被限制"), DATA_SAVE_ERROR("001009", "数据保存失败"), SYSTEM_BUSY("001099", "系统繁忙,请稍后重试"); private final String code; private final String msg; ResponseCodeEnum(String code, String msg) { this.code = code; this.msg = msg; } public String getCode() { return code; } public String getMsg() { return msg; } public String getMsg(String detailDesc) { return msg + " : " + detailDesc; } }
923e0d276c35f5d98d526f5bcd905a1bd121ad31
4,137
java
Java
Libs_jPOI/src/anywheresoftware/b4j/objects/PoiSheetWrapper.java
AnywhereSoftware/B4J
5bf4943476306587a86a98e59f659a7ed7f79306
[ "Apache-2.0" ]
26
2020-03-10T00:52:00.000Z
2022-03-19T02:16:02.000Z
Libs_jPOI/src/anywheresoftware/b4j/objects/PoiSheetWrapper.java
AnywhereSoftware/B4J
5bf4943476306587a86a98e59f659a7ed7f79306
[ "Apache-2.0" ]
null
null
null
Libs_jPOI/src/anywheresoftware/b4j/objects/PoiSheetWrapper.java
AnywhereSoftware/B4J
5bf4943476306587a86a98e59f659a7ed7f79306
[ "Apache-2.0" ]
5
2020-03-10T18:45:33.000Z
2022-03-27T08:54:01.000Z
32.069767
114
0.726372
1,000,602
/* * Copyright 2010 - 2020 Anywhere Software (www.b4x.com) * * 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 anywheresoftware.b4j.objects; import org.apache.poi.ss.usermodel.ClientAnchor; import org.apache.poi.ss.usermodel.CreationHelper; import org.apache.poi.ss.usermodel.Drawing; import org.apache.poi.ss.usermodel.Picture; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.util.CellRangeAddress; import anywheresoftware.b4a.AbsObjectWrapper; import anywheresoftware.b4a.BA.ShortName; import anywheresoftware.b4a.objects.collections.List; @ShortName("PoiSheet") public class PoiSheetWrapper extends AbsObjectWrapper<Sheet>{ /** * Gets or sets whether the sheet is in right to left mode. */ public boolean getRightToLeft() { return getObject().isRightToLeft(); } public void setRightToLeft(boolean b) { getObject().setRightToLeft(b); } /** * Returns a List with PoiRow items representing the sheet rows. *Note that empty rows will be excluded from the list. */ public List getRows() { List l1 = new List(); l1.Initialize(); for (Row r : getObject()) { l1.Add(r); } return l1; } /** * Gets or sets the sheet name. */ public String getName() { return getObject().getSheetName(); } public void setName(String s) { getObject().getWorkbook().setSheetName(getIndex(), s); } /** * Returns the sheet index. */ public int getIndex() { return getObject().getWorkbook().getSheetIndex(getObject()); } /** * Creates a new row with the specified index. First row index is 0. */ public PoiRowWrapper CreateRow(int RowNumber) { return (PoiRowWrapper) AbsObjectWrapper.ConvertToWrapper(new PoiRowWrapper(), getObject().createRow(RowNumber)); } /** * Returns the row with the specified index. Returns an uninitialized PoiRow if the row is empty. */ public PoiRowWrapper GetRow(int RowNumber) { return (PoiRowWrapper) AbsObjectWrapper.ConvertToWrapper(new PoiRowWrapper(), getObject().getRow(RowNumber)); } /** * Gets the index of the last row on the sheet. */ public int getLastRowNumber() { return getObject().getLastRowNum(); } /** * Gets the index of the first row on the sheet. */ public int getFirstRowNumber() { return getObject().getFirstRowNum(); } /** * Merges the cells. */ public void AddMergedRegion(int FirstColumn, int FirstRow, int LastColumn , int LastRow) { getObject().addMergedRegion(new CellRangeAddress(FirstRow, LastRow, FirstColumn, LastColumn)); } /** * Gets the column width measured in 1 / 256 of a character width. */ public int GetColumnWidth(int ColumnIndex) { return getObject().getColumnWidth(ColumnIndex); } /** * Sets the column width measured in 1 / 256 of a character width. */ public void SetColumnWidth(int ColumnIndex, int Width) { getObject().setColumnWidth(ColumnIndex, Width); } /** * Puts an image, previously added with PoiWorkbook.AddImage, on the sheet. *ImageIndex - The value returned from PoiWorkbook.AddImage. *FirstRow, FirstColumn, LastRow, LastColumn - The image cells. */ public void SetImage (int ImageIndex, int FirstColumn, int FirstRow, int LastColumn , int LastRow) { Drawing drawing = getObject().createDrawingPatriarch(); CreationHelper helper = getObject().getWorkbook().getCreationHelper(); ClientAnchor anchor = helper.createClientAnchor(); anchor.setCol1(FirstColumn); anchor.setRow1(FirstRow); anchor.setCol2(LastColumn); anchor.setRow2(LastRow); Picture pict = drawing.createPicture(anchor, ImageIndex); pict.resize(1); } }
923e0d6248f416196a40b49b014a58f3b01323d9
7,068
java
Java
kattisJava/Solutions/src/Week3/A/MasteringMastermind.java
naturalnumber/kattis
bd2e1f3422edc3cb3b5653bc5af59238ca87acd1
[ "MIT" ]
null
null
null
kattisJava/Solutions/src/Week3/A/MasteringMastermind.java
naturalnumber/kattis
bd2e1f3422edc3cb3b5653bc5af59238ca87acd1
[ "MIT" ]
null
null
null
kattisJava/Solutions/src/Week3/A/MasteringMastermind.java
naturalnumber/kattis
bd2e1f3422edc3cb3b5653bc5af59238ca87acd1
[ "MIT" ]
null
null
null
26.772727
104
0.514148
1,000,603
package Week3.A; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import javax.swing.JFileChooser; import javax.swing.filechooser.FileNameExtensionFilter; public class MasteringMastermind { private static final String PATH = "./Solutions/src/"; public static void main (String[] args) { MyKattioI io = new MyKattioByWordsI(args.length > 0, PATH); try { int n = io.getInt(); //System.err.println(io.getNext()); //int n = 4; String code = io.nextToken(); String guess = io.nextToken(); int r = 0; int s = 0; int[][] counts = new int[2][26]; char c, g; int ci, gi; for (int i = 0; i < n; i++) { c = code.charAt(i); g = guess.charAt(i); if (c == g) r++; else { counts[0][c-'A']++; counts[1][g-'A']++; } } for (int i = 0; i < 26; i++) { s += Math.min(counts[0][i], counts[1][i]); } io.println(r+" "+s); io.flush(); } catch (Exception e) { e.printStackTrace(); } io.close(); System.exit(0); } public static class MyKattioByWordsI extends MyKattioI { public MyKattioByWordsI() { } public MyKattioByWordsI(InputStream i) { super(i); } public MyKattioByWordsI(OutputStream o) { super(o); } public MyKattioByWordsI(InputStream i, OutputStream o) { super(i, o); } public MyKattioByWordsI(boolean testing) { super(testing); } public MyKattioByWordsI(boolean testing, OutputStream o) { super(testing, o); } public MyKattioByWordsI(boolean testing, String path) { super(testing, path); } public MyKattioByWordsI(boolean testing, String path, OutputStream o) { super(testing, path, o); } public String getWord() { return nextToken(); } protected String line; protected StringTokenizer st; protected String peekToken() { if (token == null) try { while (st == null || !st.hasMoreTokens()) { line = r.readLine(); if (line == null) return null; st = new StringTokenizer(line); } token = st.nextToken(); } catch (IOException e) { e.printStackTrace(); } return token; } } public static class MyKattioByLinesI extends MyKattioI { public MyKattioByLinesI() {} public MyKattioByLinesI(InputStream i) { super(i); } public MyKattioByLinesI(OutputStream o) { super(o); } public MyKattioByLinesI(InputStream i, OutputStream o) { super(i, o); } public MyKattioByLinesI(boolean testing) { super(testing); } public MyKattioByLinesI(boolean testing, OutputStream o) { super(testing, o); } public MyKattioByLinesI(boolean testing, String path) { super(testing, path); } public MyKattioByLinesI(boolean testing, String path, OutputStream o) { super(testing, path, o); } public String[] getWords() { String s = nextToken(); return (s != null) ? s.split(" ") : null; } protected String peekToken() { if (token == null) try { token = r.readLine(); } catch (IOException e) { e.printStackTrace(); } return token; } } public static abstract class MyKattioI extends PrintWriter { public static String path = "./Solutions/src"; protected BufferedReader r; protected String token; public MyKattioI() { this(System.in, System.out); } public MyKattioI(InputStream i) { this(i, System.out); } public MyKattioI(OutputStream o) { this(System.in, o); } public MyKattioI(InputStream i, OutputStream o) { super(new BufferedOutputStream(o)); r = new BufferedReader(new InputStreamReader(i)); } public MyKattioI(boolean testing) { this(testing, System.out); } public MyKattioI(boolean testing, OutputStream o) { super(new BufferedOutputStream(o)); r = new BufferedReader(new InputStreamReader((testing) ? getFileInputStream() : System.in)); } public MyKattioI(boolean testing, String path) { this(testing, path, System.out); } public MyKattioI(boolean testing, String path, OutputStream o) { super(new BufferedOutputStream(o)); this.path = path; r = new BufferedReader(new InputStreamReader((testing) ? getFileInputStream() : System.in)); } private static FileInputStream getFileInputStream() { boolean check = true; FileInputStream fileIn = null; while (check) try { JFileChooser chooser = new JFileChooser(path); chooser.setFileFilter(new FileNameExtensionFilter("Text files", "txt")); int n = chooser.showOpenDialog(null); if (n == JFileChooser.APPROVE_OPTION) { fileIn = new FileInputStream(chooser.getSelectedFile()); check = false; } if (n == JFileChooser.CANCEL_OPTION) System.exit(1); } catch (Exception e) { e.printStackTrace(); } return fileIn; } @Override public void close() { super.close(); try { r.close(); } catch (Exception e) {} } public boolean hasMore() { return peekToken() != null; } public int getInt() { return Integer.parseInt(nextToken()); } public double getDouble() { return Double.parseDouble(nextToken()); } public long getLong() { return Long.parseLong(nextToken()); } public String getNext() { return nextToken(); } protected String nextToken() { String ans = peekToken(); token = null; return ans; } // Abstract methods protected abstract String peekToken(); } }
923e0ed490a9a078bec3fa192b4d9ca52223a0d9
12,454
java
Java
officefloor/core/officecompiler/src/main/impl/net/officefloor/compile/impl/structure/GovernanceNodeImpl.java
officefloor/OfficeFloor
16c73ac87019d27de6df16c54c976a295db184ea
[ "Apache-2.0" ]
17
2019-09-30T08:23:01.000Z
2021-12-20T04:51:03.000Z
officefloor/core/officecompiler/src/main/impl/net/officefloor/compile/impl/structure/GovernanceNodeImpl.java
officefloor/OfficeFloor
16c73ac87019d27de6df16c54c976a295db184ea
[ "Apache-2.0" ]
880
2019-07-08T04:31:14.000Z
2022-03-16T20:16:03.000Z
officefloor/core/officecompiler/src/main/impl/net/officefloor/compile/impl/structure/GovernanceNodeImpl.java
officefloor/OfficeFloor
16c73ac87019d27de6df16c54c976a295db184ea
[ "Apache-2.0" ]
3
2019-09-30T08:22:37.000Z
2021-10-13T10:05:24.000Z
32.015424
113
0.736711
1,000,604
/*- * #%L * OfficeCompiler * %% * Copyright (C) 2005 - 2020 Daniel Sagenschneider * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ package net.officefloor.compile.impl.structure; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import net.officefloor.compile.governance.GovernanceLoader; import net.officefloor.compile.governance.GovernanceType; import net.officefloor.compile.impl.util.CompileUtil; import net.officefloor.compile.impl.util.LinkUtil; import net.officefloor.compile.internal.structure.AutoWire; import net.officefloor.compile.internal.structure.AutoWireLink; import net.officefloor.compile.internal.structure.AutoWirer; import net.officefloor.compile.internal.structure.CompileContext; import net.officefloor.compile.internal.structure.GovernanceNode; import net.officefloor.compile.internal.structure.LinkTeamNode; import net.officefloor.compile.internal.structure.ManagedObjectExtensionNode; import net.officefloor.compile.internal.structure.ManagedObjectNode; import net.officefloor.compile.internal.structure.Node; import net.officefloor.compile.internal.structure.NodeContext; import net.officefloor.compile.internal.structure.OfficeNode; import net.officefloor.compile.internal.structure.OfficeObjectNode; import net.officefloor.compile.internal.structure.OfficeTeamNode; import net.officefloor.compile.properties.PropertyList; import net.officefloor.compile.spi.governance.source.GovernanceSource; import net.officefloor.compile.spi.office.GovernerableManagedObject; import net.officefloor.compile.spi.office.OfficeGovernance; import net.officefloor.frame.api.build.GovernanceBuilder; import net.officefloor.frame.api.build.OfficeBuilder; import net.officefloor.frame.api.governance.Governance; import net.officefloor.frame.api.manage.Office; /** * Implementation of the {@link GovernanceNode}. * * @author Daniel Sagenschneider */ public class GovernanceNodeImpl implements GovernanceNode { /** * Name of this {@link OfficeGovernance}. */ private final String governanceName; /** * {@link PropertyList} to source the {@link Governance}. */ private final PropertyList properties; /** * {@link OfficeNode} of the {@link Office} containing this {@link Governance}. */ private final OfficeNode officeNode; /** * {@link NodeContext}. */ private final NodeContext context; /** * Initialised state. */ private InitialisedState state; /** * Initialised state. */ private static class InitialisedState { /** * Class name of the {@link GovernanceSource}. */ private final String governanceSourceClassName; /** * {@link GovernanceSource} instance to use. Should this be specified it * overrides the {@link Class}. */ private final GovernanceSource<?, ?> governanceSource; /** * Instantiate. * * @param governanceSourceClassName Class name of the {@link GovernanceSource}. * @param governanceSource {@link GovernanceSource} instance to use. * Should this be specified it overrides the * {@link Class}. */ public InitialisedState(String governanceSourceClassName, GovernanceSource<?, ?> governanceSource) { this.governanceSourceClassName = governanceSourceClassName; this.governanceSource = governanceSource; } } /** * {@link OfficeObjectNode} instances being governed by this {@link Governance}. */ private final List<OfficeObjectNode> governedOfficeObjects = new LinkedList<>(); /** * {@link ManagedObjectNode} instances being governed by this * {@link Governance}. */ private final List<ManagedObjectNode> governedManagedObjects = new LinkedList<>(); /** * Flags whether to auto-wire the {@link GovernerableManagedObject} instances. */ private boolean isAutoWireExtensions = false; /** * {@link GovernanceSource} used to source this {@link GovernanceNode}. */ private GovernanceSource<?, ?> usedGovernanceSource = null; /** * Initiate. * * @param governanceName Name of this {@link OfficeGovernance}. * @param officeNode {@link OfficeNode} of the {@link Office} containing * this {@link Governance}. * @param context {@link NodeContext}. */ public GovernanceNodeImpl(String governanceName, OfficeNode officeNode, NodeContext context) { this.governanceName = governanceName; this.officeNode = officeNode; this.context = context; // Create additional objects this.properties = this.context.createPropertyList(); } /* * ========================== Node ============================== */ @Override public String getNodeName() { return this.governanceName; } @Override public String getNodeType() { return TYPE; } @Override public String getLocation() { return null; } @Override public Node getParentNode() { return this.officeNode; } @Override public Node[] getChildNodes() { return NodeUtil.getChildNodes(); } @Override public boolean isInitialised() { return (this.state != null); } @Override public void initialise(String governanceSourceClassName, GovernanceSource<?, ?> governanceSource) { this.state = NodeUtil.initialise(this, this.context, this.state, () -> new InitialisedState(governanceSourceClassName, governanceSource)); } /* * ======================== GovernanceNode ====================== */ @Override public GovernanceType<?, ?> loadGovernanceType(boolean isLoadingType) { // Obtain the goverannce source GovernanceSource<?, ?> governanceSource = this.state.governanceSource; if (governanceSource == null) { // Obtain the governance source class Class<? extends GovernanceSource<?, ?>> governanceSourceClass = this.context .getGovernanceSourceClass(this.state.governanceSourceClassName, this); if (governanceSourceClass == null) { return null; // must obtain source class } // Obtain the governance source governanceSource = CompileUtil.newInstance(governanceSourceClass, GovernanceSource.class, this, this.context.getCompilerIssues()); if (governanceSource == null) { return null; // must obtain source } } // Keep track of used governance source this.usedGovernanceSource = governanceSource; // Load and return the governance type GovernanceLoader loader = this.context.getGovernanceLoader(this, isLoadingType); return loader.loadGovernanceType(governanceSource, this.properties); } @Override @SuppressWarnings("rawtypes") public boolean sourceGovernance(CompileContext compileContext) { // Obtain the governance type GovernanceType govType = compileContext.getOrLoadGovernanceType(this); if (govType == null) { return false; // must obtain governance type } // As here, successful return true; } @Override public boolean isAutoWireGovernance() { return this.isAutoWireExtensions; } @Override public void autoWireExtensions(AutoWirer<ManagedObjectExtensionNode> autoWirer, CompileContext compileContext) { // Do no auto wire if already extensions if ((this.governedOfficeObjects.size() > 0) || (this.governedManagedObjects.size() > 0)) { return; } // Build the governance type GovernanceType<?, ?> governanceType = compileContext.getOrLoadGovernanceType(this); if (governanceType == null) { return; // must load type } // Load the auto-wire extensions AutoWireLink<GovernanceNode, ManagedObjectExtensionNode>[] links = autoWirer.getAutoWireLinks(this, new AutoWire(governanceType.getExtensionType())); for (AutoWireLink<GovernanceNode, ManagedObjectExtensionNode> link : links) { ManagedObjectNode managedObjectNode = (ManagedObjectNode) link.getTargetNode(this.officeNode); managedObjectNode.addGovernance(this, this.officeNode); this.governedManagedObjects.add(managedObjectNode); } } @Override public void autoWireTeam(AutoWirer<LinkTeamNode> autoWirer, CompileContext compileContext) { // Ignore if already specified team if (this.linkedTeamNode != null) { return; } // Create the listing of source auto-wires Set<AutoWire> autoWires = new HashSet<>(); this.governedOfficeObjects.stream() .sorted((a, b) -> CompileUtil.sortCompare(a.getOfficeObjectName(), b.getOfficeObjectName())) .forEachOrdered((object) -> LinkUtil.loadAllObjectAutoWires(object, autoWires, compileContext, this.context.getCompilerIssues())); this.governedManagedObjects.stream() .sorted((a, b) -> CompileUtil.sortCompare(a.getGovernerableManagedObjectName(), b.getGovernerableManagedObjectName())) .forEachOrdered((managedObject) -> LinkUtil.loadAllObjectAutoWires(managedObject, autoWires, compileContext, this.context.getCompilerIssues())); AutoWire[] sourceAutoWires = autoWires.stream().toArray(AutoWire[]::new); // Attempt to auto-wire this governance AutoWireLink<GovernanceNode, LinkTeamNode>[] links = autoWirer.findAutoWireLinks(this, sourceAutoWires); if (links.length == 1) { LinkUtil.linkTeamNode(this, links[0].getTargetNode(this.officeNode), this.context.getCompilerIssues(), (link) -> this.linkTeamNode(link)); } } @Override @SuppressWarnings({ "unchecked", "rawtypes" }) public void buildGovernance(OfficeBuilder officeBuilder, CompileContext compileContext) { // Obtain the governance type GovernanceType govType = compileContext.getOrLoadGovernanceType(this); if (govType == null) { return; // must obtain governance type } // Register as possible MBean String qualifiedName = this.officeNode.getQualifiedName(this.governanceName); compileContext.registerPossibleMBean(GovernanceSource.class, qualifiedName, this.usedGovernanceSource); // Build the governance GovernanceBuilder govBuilder = officeBuilder.addGovernance(this.governanceName, govType.getExtensionType(), govType.getGovernanceFactory()); // Obtain the office team responsible for this governance OfficeTeamNode officeTeam = LinkUtil.findTarget(this, OfficeTeamNode.class, this.context.getCompilerIssues()); if (officeTeam != null) { // Build the team responsible for the governance govBuilder.setResponsibleTeam(officeTeam.getOfficeTeamName()); } } /* * ======================== OfficeGovernance ====================== */ @Override public String getOfficeGovernanceName() { return this.governanceName; } @Override public void addProperty(String name, String value) { this.properties.addProperty(name).setValue(value); } @Override public void governManagedObject(GovernerableManagedObject managedObject) { // Register governance with the managed object if (managedObject instanceof ManagedObjectNode) { // Register governance with the managed object node ManagedObjectNode managedObjectNode = (ManagedObjectNode) managedObject; managedObjectNode.addGovernance(this, this.officeNode); this.governedManagedObjects.add(managedObjectNode); } else if (managedObject instanceof OfficeObjectNode) { // Register governance with the office object node OfficeObjectNode officeObjectNode = (OfficeObjectNode) managedObject; officeObjectNode.addGovernance(this); this.governedOfficeObjects.add(officeObjectNode); } else { // Unknown governable managed object node this.context.getCompilerIssues().addIssue(this, "Unknown " + GovernerableManagedObject.class.getSimpleName() + " node"); } } @Override public void enableAutoWireExtensions() { this.isAutoWireExtensions = true; } /* * ========================== LinkTeamNode ======================== */ /** * Linked {@link LinkTeamNode}. */ private LinkTeamNode linkedTeamNode = null; @Override public boolean linkTeamNode(LinkTeamNode node) { return LinkUtil.linkTeamNode(this, node, this.context.getCompilerIssues(), (link) -> this.linkedTeamNode = link); } @Override public LinkTeamNode getLinkedTeamNode() { return this.linkedTeamNode; } }
923e0f7734b11bdf78dbe710ed19a61e8755d047
964
java
Java
projectmanager-server/src/main/java/com/springboot/bo/ParentTaskVO.java
UpasakGanguly/FSD-SBA-FINAL-PROJECT
7ab8e8361495da3966648f9369a654f516226ef2
[ "MIT" ]
null
null
null
projectmanager-server/src/main/java/com/springboot/bo/ParentTaskVO.java
UpasakGanguly/FSD-SBA-FINAL-PROJECT
7ab8e8361495da3966648f9369a654f516226ef2
[ "MIT" ]
1
2019-01-23T03:06:45.000Z
2019-01-23T03:06:45.000Z
projectmanager-server/src/main/java/com/springboot/bo/ParentTaskVO.java
UpasakGanguly/FSD-SBA-FINAL-PROJECT
7ab8e8361495da3966648f9369a654f516226ef2
[ "MIT" ]
null
null
null
18.538462
56
0.661826
1,000,605
package com.springboot.bo; /** * @author 555194 * */ public class ParentTaskVO { private Long parentTaskId; private String parentTaskName; private String projectId; /** * @return the parentTaskId */ public Long getParentTaskId() { return parentTaskId; } /** * @param parentTaskId the parentTaskId to set */ public void setParentTaskId(Long parentTaskId) { this.parentTaskId = parentTaskId; } /** * @return the parentTaskName */ public String getParentTaskName() { return parentTaskName; } /** * @param parentTaskName the parentTaskName to set */ public void setParentTaskName(String parentTaskName) { this.parentTaskName = parentTaskName; } /** * @return the projectId */ public String getProjectId() { return projectId; } /** * @param projectId the projectId to set */ public void setProjectId(String projectId) { this.projectId = projectId; } }
923e1033e986223976264e58731855254d83fbb9
242
java
Java
platform-admin/src/main/java/com/platform/dao/SysSmsLogDao.java
SJshenjian/platform
c5c0f72179dc7cadc569bff3e37027c91fc3c975
[ "Apache-2.0" ]
1
2019-03-04T00:13:39.000Z
2019-03-04T00:13:39.000Z
platform-admin/src/main/java/com/platform/dao/SysSmsLogDao.java
SJshenjian/platform
c5c0f72179dc7cadc569bff3e37027c91fc3c975
[ "Apache-2.0" ]
null
null
null
platform-admin/src/main/java/com/platform/dao/SysSmsLogDao.java
SJshenjian/platform
c5c0f72179dc7cadc569bff3e37027c91fc3c975
[ "Apache-2.0" ]
null
null
null
16.466667
64
0.732794
1,000,606
package com.platform.dao; import com.platform.entity.SysSmsLogEntity; /** * 发送短信日志Dao * * @author Jian Shen * @email nnheo@example.com * @date 2017-12-16 23:38:05 */ public interface SysSmsLogDao extends BaseDao<SysSmsLogEntity> { }
923e11c1d6486f92b3d9e788f3e6beb6757efdac
7,741
java
Java
src/main/java/com/practice/reverseEngineering/entity/TAlarmEvent.java
Higmin/practise
0db798654a2747c0e3b3507df433926221d6e3d9
[ "Apache-2.0" ]
30
2019-06-25T08:59:04.000Z
2022-01-07T03:36:43.000Z
src/main/java/com/practice/reverseEngineering/entity/TAlarmEvent.java
Higmin/practise
0db798654a2747c0e3b3507df433926221d6e3d9
[ "Apache-2.0" ]
null
null
null
src/main/java/com/practice/reverseEngineering/entity/TAlarmEvent.java
Higmin/practise
0db798654a2747c0e3b3507df433926221d6e3d9
[ "Apache-2.0" ]
11
2020-04-14T09:34:35.000Z
2022-02-24T09:03:42.000Z
35.509174
154
0.610128
1,000,607
package com.practice.reverseEngineering.entity; import java.util.Date; public class TAlarmEvent { private Integer id; private String type; private Date alarmTime; private String alarmContent; private String alarmKey; private String alarmValue; private Integer floorNumber; private Integer roomNumber; private String prisonSite; private String adapterNumber; private String adapterDirection; private String ftpName; private String cameraNumber; private String remark; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getType() { return type; } public void setType(String type) { this.type = type == null ? null : type.trim(); } public Date getAlarmTime() { return alarmTime; } public void setAlarmTime(Date alarmTime) { this.alarmTime = alarmTime; } public String getAlarmContent() { return alarmContent; } public void setAlarmContent(String alarmContent) { this.alarmContent = alarmContent == null ? null : alarmContent.trim(); } public String getAlarmKey() { return alarmKey; } public void setAlarmKey(String alarmKey) { this.alarmKey = alarmKey == null ? null : alarmKey.trim(); } public String getAlarmValue() { return alarmValue; } public void setAlarmValue(String alarmValue) { this.alarmValue = alarmValue == null ? null : alarmValue.trim(); } public Integer getFloorNumber() { return floorNumber; } public void setFloorNumber(Integer floorNumber) { this.floorNumber = floorNumber; } public Integer getRoomNumber() { return roomNumber; } public void setRoomNumber(Integer roomNumber) { this.roomNumber = roomNumber; } public String getPrisonSite() { return prisonSite; } public void setPrisonSite(String prisonSite) { this.prisonSite = prisonSite == null ? null : prisonSite.trim(); } public String getAdapterNumber() { return adapterNumber; } public void setAdapterNumber(String adapterNumber) { this.adapterNumber = adapterNumber == null ? null : adapterNumber.trim(); } public String getAdapterDirection() { return adapterDirection; } public void setAdapterDirection(String adapterDirection) { this.adapterDirection = adapterDirection == null ? null : adapterDirection.trim(); } public String getFtpName() { return ftpName; } public void setFtpName(String ftpName) { this.ftpName = ftpName == null ? null : ftpName.trim(); } public String getCameraNumber() { return cameraNumber; } public void setCameraNumber(String cameraNumber) { this.cameraNumber = cameraNumber == null ? null : cameraNumber.trim(); } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark == null ? null : remark.trim(); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); sb.append(", type=").append(type); sb.append(", alarmTime=").append(alarmTime); sb.append(", alarmContent=").append(alarmContent); sb.append(", alarmKey=").append(alarmKey); sb.append(", alarmValue=").append(alarmValue); sb.append(", floorNumber=").append(floorNumber); sb.append(", roomNumber=").append(roomNumber); sb.append(", prisonSite=").append(prisonSite); sb.append(", adapterNumber=").append(adapterNumber); sb.append(", adapterDirection=").append(adapterDirection); sb.append(", ftpName=").append(ftpName); sb.append(", cameraNumber=").append(cameraNumber); sb.append(", remark=").append(remark); sb.append("]"); return sb.toString(); } @Override public boolean equals(Object that) { if (this == that) { return true; } if (that == null) { return false; } if (getClass() != that.getClass()) { return false; } TAlarmEvent other = (TAlarmEvent) that; return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType())) && (this.getAlarmTime() == null ? other.getAlarmTime() == null : this.getAlarmTime().equals(other.getAlarmTime())) && (this.getAlarmContent() == null ? other.getAlarmContent() == null : this.getAlarmContent().equals(other.getAlarmContent())) && (this.getAlarmKey() == null ? other.getAlarmKey() == null : this.getAlarmKey().equals(other.getAlarmKey())) && (this.getAlarmValue() == null ? other.getAlarmValue() == null : this.getAlarmValue().equals(other.getAlarmValue())) && (this.getFloorNumber() == null ? other.getFloorNumber() == null : this.getFloorNumber().equals(other.getFloorNumber())) && (this.getRoomNumber() == null ? other.getRoomNumber() == null : this.getRoomNumber().equals(other.getRoomNumber())) && (this.getPrisonSite() == null ? other.getPrisonSite() == null : this.getPrisonSite().equals(other.getPrisonSite())) && (this.getAdapterNumber() == null ? other.getAdapterNumber() == null : this.getAdapterNumber().equals(other.getAdapterNumber())) && (this.getAdapterDirection() == null ? other.getAdapterDirection() == null : this.getAdapterDirection().equals(other.getAdapterDirection())) && (this.getFtpName() == null ? other.getFtpName() == null : this.getFtpName().equals(other.getFtpName())) && (this.getCameraNumber() == null ? other.getCameraNumber() == null : this.getCameraNumber().equals(other.getCameraNumber())) && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark())); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getType() == null) ? 0 : getType().hashCode()); result = prime * result + ((getAlarmTime() == null) ? 0 : getAlarmTime().hashCode()); result = prime * result + ((getAlarmContent() == null) ? 0 : getAlarmContent().hashCode()); result = prime * result + ((getAlarmKey() == null) ? 0 : getAlarmKey().hashCode()); result = prime * result + ((getAlarmValue() == null) ? 0 : getAlarmValue().hashCode()); result = prime * result + ((getFloorNumber() == null) ? 0 : getFloorNumber().hashCode()); result = prime * result + ((getRoomNumber() == null) ? 0 : getRoomNumber().hashCode()); result = prime * result + ((getPrisonSite() == null) ? 0 : getPrisonSite().hashCode()); result = prime * result + ((getAdapterNumber() == null) ? 0 : getAdapterNumber().hashCode()); result = prime * result + ((getAdapterDirection() == null) ? 0 : getAdapterDirection().hashCode()); result = prime * result + ((getFtpName() == null) ? 0 : getFtpName().hashCode()); result = prime * result + ((getCameraNumber() == null) ? 0 : getCameraNumber().hashCode()); result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode()); return result; } }
923e137124a93aff4a813264e8288c9af4f54c98
3,312
java
Java
connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java
2b2e/Geyser
1cffa3378f20a40a01ee727df434b4b05f9ce5cf
[ "MIT" ]
3,426
2019-07-08T18:15:08.000Z
2022-03-31T18:01:43.000Z
connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java
IkeVoodoo/Geyser
0b35449fb71861362c31d4f8195a6d66774a690a
[ "MIT" ]
2,337
2019-07-20T22:40:35.000Z
2022-03-31T19:49:09.000Z
connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java
IkeVoodoo/Geyser
0b35449fb71861362c31d4f8195a6d66774a690a
[ "MIT" ]
909
2019-07-08T18:33:07.000Z
2022-03-29T17:00:16.000Z
46
135
0.700483
1,000,608
/* * Copyright (c) 2019-2021 GeyserMC. http://geysermc.org * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * @author GeyserMC * @link https://github.com/GeyserMC/Geyser */ package org.geysermc.connector.entity.living.animal.tameable; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.living.animal.AnimalEntity; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import java.util.UUID; public class TameableEntity extends AnimalEntity { public TameableEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { super(entityId, geyserId, entityType, position, motion, rotation); } @Override public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { if (entityMetadata.getId() == 17) { byte xd = (byte) entityMetadata.getValue(); metadata.getFlags().setFlag(EntityFlag.SITTING, (xd & 0x01) == 0x01); metadata.getFlags().setFlag(EntityFlag.ANGRY, (xd & 0x02) == 0x02); metadata.getFlags().setFlag(EntityFlag.TAMED, (xd & 0x04) == 0x04); } // Note: Must be set for wolf collar color to work if (entityMetadata.getId() == 18) { if (entityMetadata.getValue() != null) { // Owner UUID of entity Entity entity = session.getEntityCache().getPlayerEntity((UUID) entityMetadata.getValue()); // Used as both a check since the player isn't in the entity cache and a normal fallback if (entity == null) { entity = session.getPlayerEntity(); } // Translate to entity ID metadata.put(EntityData.OWNER_EID, entity.getGeyserId()); } else { metadata.put(EntityData.OWNER_EID, 0L); // Reset } } super.updateBedrockMetadata(entityMetadata, session); } }
923e13d25df90f2adb5f2694f0e15fcba5a9ab67
4,745
java
Java
easy-pay-domain/src/main/java/com/panli/pay/service/domain/enums/ConstantDefine.java
hummer-team/plus-epay
949b3337c7519ee4e8366db9d6864ba312a8dbfa
[ "MIT" ]
null
null
null
easy-pay-domain/src/main/java/com/panli/pay/service/domain/enums/ConstantDefine.java
hummer-team/plus-epay
949b3337c7519ee4e8366db9d6864ba312a8dbfa
[ "MIT" ]
null
null
null
easy-pay-domain/src/main/java/com/panli/pay/service/domain/enums/ConstantDefine.java
hummer-team/plus-epay
949b3337c7519ee4e8366db9d6864ba312a8dbfa
[ "MIT" ]
null
null
null
51.597826
118
0.75732
1,000,609
/* * Copyright (c) 2021 LiGuo <hzdkv@example.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.panli.pay.service.domain.enums; public class ConstantDefine { public static final String ALI_CHANNEL_PREFIX = "ali"; public static final String WX_CHANNEL_PREFIX = "wx"; //----------------------------ali--------------------------------------- public static final String ALI_REFUND_CHANNEL = "aliPay.Channel.Refund"; public static final String ALI_PAY_QUERY_CHANNEL = "aliPay.Channel.Query"; public static final String ALI_PAY_REFUND_QUERY_CHANNEL = "aliPay.Channel.Refund.Query"; public static final String ALI_PAY_BAR_CODE_CHANNEL = "aliBarCode.Channel.Pay"; public static final String ALI_PAY_PC_CHANNEL = "aliPc.Channel.Pay"; public static final String ALI_PAY_APP_CHANNEL = "aliApp.Channel.Pay"; public static final String ALI_PAY_WAP_CHANNEL = "aliWap.Channel.Pay"; public static final String ALI_NOTIFY_CHANNEL = "aliNotify"; //---------------------------------wx------------------------------------------- public static final String WX_BARCODE_PAY_QUERY_CHANNEL = "wxBarCode.Channel.Query"; public static final String WX_BARCODE_PAYMENT_CHANNEL = "wxBarCode.Channel.Pay"; public static final String WX_BAR_CODE_REFUND_CHANNEL = "wxBarCode.Channel.Refund"; public static final String WX_BAR_CODE_REFUND_QUERY_CHANNEL = "wxBarCode.Channel.Refund.Query"; public static final String WX_V2_CANCEL_PAYMENT = "wxBarCode.Channel.Cancel"; public static final String WX_BARCODE_PAYMENT_CHANNEL_SERVICE_MCH = "wxServiceMchBarCode.Channel.Pay"; public static final String WX_BARCODE_PAYMENT_CHANNEL_SERVICE_MCH_CHANNEL = "wxServiceMchBarCode.Channel.Channel"; public static final String WX_BARCODE_PAYMENT_QUERY_SERVICE_MCH = "wxServiceMchBarCode.Channel.Query"; public static final String WX_FZ_REQUEST = "wxServiceMchFz.Channel.Request"; public static final String WX_FZ_QUERY = "wxServiceMchFz.Channel.Query"; public static final String WX_FZ_REFUND = "wxServiceMchFz.Channel.Refund"; public static final String WX_ADVANCE_PAYMENT_CHANNEL = "wxJsapi.Channel.Pay"; public static final String WX_ADVANCE_PAYMENT_APP_CHANNEL = "wxJsapiApp.Channel.Pay"; public static final String WX_ADVANCE_PAYMENT_H5_CHANNEL = "wxJsapiH5.Channel.Pay"; public static final String WX_V3_REFUND_CHANNEL = "wxJsapi.Channel.Refund"; public static final String WX_ADVANCE_PAYMENT_QUERY_CHANNEL = "wxJsapi.Channel.Query"; public static final String WX_V3_REFUND_QUERY_CHANNEL = "wxJsapi.Channel.Refund.Query"; public static final String YUG_BEAN_PAYMENT_CHANNEL = "yugBean.Channel.Pay"; public static final String YUG_BEAN_PAYMENT_REFUND_CHANNEL = "yugBean.Channel.Refund"; public static final String YUG_BEAN_PAYMENT_QUERY_CHANNEL = "yugBean.Channel.Query"; public static final String DEFAULT_REFUND_TEMPLATE = "DefaultRefundTemplate"; public static final String DEFAULT_CANCEL_TEMPLATE = "DefaultCancelTemplate"; public static final String DEFAULT_PAYMENT_TEMPLATE = "DefaultPayment"; public static final String DEFAULT_QUERY_TEMPLATE = "DefaultPaymentQuery"; public static final String DEFAULT_PROFIT_SHARING_REQUEST_TEMPLATE = "DefaultProfitSharingTemplate"; /** * is sharing ? */ public static final String SERVICE_MERCHANT_BAR_CODE_PAY_QUERY_TEMPLATE = "FLOW.wxServiceMchBarCode.Query"; public static final String YUG_BEAN_REFUND_TEMPLATE = "YUG.yugBean.Refund"; public static final String WX_NOTIFY_CHANNEL = "WxNotify"; public static final String WX_V2_NOTIFY_CHANNEL = "WxV2Notify"; private ConstantDefine() { } }
923e14bf07a27cfe2c25fc51e7c90803c0b93980
2,245
java
Java
weather-common/src/main/java/org/ccccye/weather/common/dto/he/Now.java
ccccye123/weather
68916657c2185f0c8a3cb64c3bab5db622e60ad2
[ "MIT" ]
2
2020-05-21T06:21:32.000Z
2020-09-12T08:13:22.000Z
weather-common/src/main/java/org/ccccye/weather/common/dto/he/Now.java
ccccye123/weather
68916657c2185f0c8a3cb64c3bab5db622e60ad2
[ "MIT" ]
1
2022-03-01T02:48:09.000Z
2022-03-01T02:48:09.000Z
weather-common/src/main/java/org/ccccye/weather/common/dto/he/Now.java
ccccye123/weather
68916657c2185f0c8a3cb64c3bab5db622e60ad2
[ "MIT" ]
1
2021-07-02T09:57:35.000Z
2021-07-02T09:57:35.000Z
17.96
48
0.579955
1,000,610
package org.ccccye.weather.common.dto.he; public class Now { private String cloud; private String cond_code; private String cond_txt; private String fl; private String hum; private String pcpn; private String pres; private String tmp; private String vis; private String wind_deg; private String wind_dir; private String wind_sc; private String wind_spd; public Now() { } public String getCloud() { return cloud; } public void setCloud(String cloud) { this.cloud = cloud; } public String getCond_code() { return cond_code; } public void setCond_code(String cond_code) { this.cond_code = cond_code; } public String getCond_txt() { return cond_txt; } public void setCond_txt(String cond_txt) { this.cond_txt = cond_txt; } public String getFl() { return fl; } public void setFl(String fl) { this.fl = fl; } public String getHum() { return hum; } public void setHum(String hum) { this.hum = hum; } public String getPcpn() { return pcpn; } public void setPcpn(String pcpn) { this.pcpn = pcpn; } public String getPres() { return pres; } public void setPres(String pres) { this.pres = pres; } public String getTmp() { return tmp; } public void setTmp(String tmp) { this.tmp = tmp; } public String getVis() { return vis; } public void setVis(String vis) { this.vis = vis; } public String getWind_deg() { return wind_deg; } public void setWind_deg(String wind_deg) { this.wind_deg = wind_deg; } public String getWind_dir() { return wind_dir; } public void setWind_dir(String wind_dir) { this.wind_dir = wind_dir; } public String getWind_sc() { return wind_sc; } public void setWind_sc(String wind_sc) { this.wind_sc = wind_sc; } public String getWind_spd() { return wind_spd; } public void setWind_spd(String wind_spd) { this.wind_spd = wind_spd; } }
923e152cdc5912754b182f92b2447e22dfce2624
396
java
Java
Java/15_Collection_framework/src/sec05/comparator/DescendingComparator.java
seungbin-kim/TIL
b6e98c57bf0b6b6c8b10451e47217379f9ab006d
[ "MIT" ]
null
null
null
Java/15_Collection_framework/src/sec05/comparator/DescendingComparator.java
seungbin-kim/TIL
b6e98c57bf0b6b6c8b10451e47217379f9ab006d
[ "MIT" ]
null
null
null
Java/15_Collection_framework/src/sec05/comparator/DescendingComparator.java
seungbin-kim/TIL
b6e98c57bf0b6b6c8b10451e47217379f9ab006d
[ "MIT" ]
null
null
null
23.294118
64
0.636364
1,000,611
package io.wisoft.java_seminar.chap15.sec05.comparator; import java.util.Comparator; public class DescendingComparator implements Comparator<Fruit> { @Override public int compare(Fruit o1, Fruit o2) { if (o1.price < o2.price) { return 1; // 가격이 적을 경우 뒤에 오게 한다. } else if (o1.price == o2.price) { return 0; } else { return -1; // 가격이 클 경우 앞에 오게 한다. } } }
923e162a504c1ccceb74f76a052db3f3c42bb6a2
2,071
java
Java
bootable/src/main/java/com/joindata/inf/boot/mechanism/Jetty2Log4j2Bridge.java
bizwell/Pangu
fbc6ced0b39c718b2a2048a133b1a55deb04e48c
[ "Apache-2.0" ]
7
2018-02-28T05:46:38.000Z
2021-12-09T08:50:40.000Z
bootable/src/main/java/com/joindata/inf/boot/mechanism/Jetty2Log4j2Bridge.java
Rayeee/Pangu
c1bf7f30414e78b26ba96e2ec270a068e6ed3c8f
[ "Apache-2.0" ]
null
null
null
bootable/src/main/java/com/joindata/inf/boot/mechanism/Jetty2Log4j2Bridge.java
Rayeee/Pangu
c1bf7f30414e78b26ba96e2ec270a068e6ed3c8f
[ "Apache-2.0" ]
7
2018-02-28T05:36:07.000Z
2021-07-05T09:45:43.000Z
21.625
61
0.601156
1,000,612
package com.joindata.inf.boot.mechanism; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.eclipse.jetty.util.log.AbstractLogger; import org.eclipse.jetty.util.log.Logger; /** * 将 Jetty 的日志转换到 Log4j2 中 * * @author <a href="mailto:hzdkv@example.com">宋翔</a> * @date 2016年12月8日 下午4:16:00 */ public class Jetty2Log4j2Bridge extends AbstractLogger { private org.apache.logging.log4j.Logger logger; private String name; public Jetty2Log4j2Bridge(String name) { this.name = name; logger = LogManager.getLogger(name); } @Override protected Logger newLogger(String fullname) { return new Jetty2Log4j2Bridge(fullname); } public String getName() { return name; } public void warn(String msg, Object... args) { logger.warn(msg, args); } public void warn(Throwable thrown) { logger.catching(Level.WARN, thrown); } public void warn(String msg, Throwable thrown) { logger.warn(msg, thrown); } public void info(String msg, Object... args) { logger.info(msg, args); } public void info(Throwable thrown) { logger.catching(Level.INFO, thrown); } public void info(String msg, Throwable thrown) { logger.info(msg, thrown); } public boolean isDebugEnabled() { return logger.isDebugEnabled(); } public void setDebugEnabled(boolean enabled) { warn("setDebugEnabled not implemented", null, null); } public void debug(String msg, Object... args) { logger.debug(msg, args); } public void debug(Throwable thrown) { logger.catching(Level.DEBUG, thrown); } public void debug(String msg, Throwable thrown) { logger.debug(msg, thrown); } public void ignore(Throwable ignored) { logger.catching(Level.TRACE, ignored); } }
923e1632135bd9a8217bbd7d256d79999825e96b
2,101
java
Java
src/main/java/com/krepples/transitive/services/impl/DependencyServiceImpl.java
btylke/transitive
324fe02b52a86992ef2a64b56dac913939b914f5
[ "BSD-3-Clause" ]
null
null
null
src/main/java/com/krepples/transitive/services/impl/DependencyServiceImpl.java
btylke/transitive
324fe02b52a86992ef2a64b56dac913939b914f5
[ "BSD-3-Clause" ]
null
null
null
src/main/java/com/krepples/transitive/services/impl/DependencyServiceImpl.java
btylke/transitive
324fe02b52a86992ef2a64b56dac913939b914f5
[ "BSD-3-Clause" ]
null
null
null
30.449275
137
0.752023
1,000,613
package com.krepples.transitive.services.impl; import com.krepples.transitive.db.model.Dependency; import com.krepples.transitive.db.repositories.DependencyRepository; import com.krepples.transitive.services.DependencyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import javax.persistence.EntityNotFoundException; @Service public class DependencyServiceImpl implements DependencyService { @Autowired private DependencyRepository repository; @Transactional @Override public Dependency findByNameAndVersion(String name, String version) { return repository.findByNameAndVersion(name, version); } public String getDependencyTree(Dependency dependency) { return repository.getDependencyTree(dependency.getId()); } @Transactional @Override public Dependency create(String name, String version, Dependency parent) { // This dependency may exist, look it up to see if it exists Dependency child = findByNameAndVersion(name, version); if (child == null) { child = new Dependency(name, version); child = repository.save(child); } setParent(parent, child); return child; } @Transactional @Override public Dependency create(String name, String version, String parentName, String parentVersion) { Dependency dependency = findByNameAndVersion(parentName, parentVersion); if ((!StringUtils.isEmpty(parentName) || !StringUtils.isEmpty(parentVersion)) && dependency == null) { throw new EntityNotFoundException("Cannot locate dependency with name: '" + parentName + "' and version: '" + parentVersion + "'"); } return create(name, version, dependency); } @Transactional @Override public void setParent(Dependency parent, Dependency child) { // for top level parents, this will be null if (parent != null) { parent.getChildDependencies().add(child); parent = repository.save(parent); } } }
923e16d37b81dfc5588832ca22ff7854b0f53de2
175
java
Java
ticket-api/domain/src/main/java/com/hexagonaldemo/ticketapi/account/port/AccountPort.java
Oruchan-Asar/Modular-Architecture-Hexagonal-Demo-Project
7fa94a170bc0a622af09ad60c5ce43d2689d430c
[ "MIT" ]
308
2021-01-13T10:57:35.000Z
2022-03-31T06:15:23.000Z
ticket-api/domain/src/main/java/com/hexagonaldemo/ticketapi/account/port/AccountPort.java
Oruchan-Asar/Modular-Architecture-Hexagonal-Demo-Project
7fa94a170bc0a622af09ad60c5ce43d2689d430c
[ "MIT" ]
8
2021-01-13T16:12:12.000Z
2021-07-19T17:01:28.000Z
ticket-api/domain/src/main/java/com/hexagonaldemo/ticketapi/account/port/AccountPort.java
Oruchan-Asar/Modular-Architecture-Hexagonal-Demo-Project
7fa94a170bc0a622af09ad60c5ce43d2689d430c
[ "MIT" ]
54
2021-01-13T12:30:15.000Z
2022-03-27T20:12:31.000Z
19.444444
57
0.8
1,000,614
package com.hexagonaldemo.ticketapi.account.port; import com.hexagonaldemo.ticketapi.account.model.Account; public interface AccountPort { Account retrieve(Long id); }
923e18f29401e2b93adb6a121df105dad1fdc265
350
java
Java
src/com/ertanayanlar/erserver/commands/PingCommand.java
OguzErtanAyanlar/ErServer
882b5ffa8ed4a3859db6452e5dd964b82d267b3e
[ "BSD-3-Clause" ]
1
2019-09-19T11:04:20.000Z
2019-09-19T11:04:20.000Z
src/com/ertanayanlar/erserver/commands/PingCommand.java
OguzErtanAyanlar/ErServer
882b5ffa8ed4a3859db6452e5dd964b82d267b3e
[ "BSD-3-Clause" ]
null
null
null
src/com/ertanayanlar/erserver/commands/PingCommand.java
OguzErtanAyanlar/ErServer
882b5ffa8ed4a3859db6452e5dd964b82d267b3e
[ "BSD-3-Clause" ]
null
null
null
23.333333
81
0.674286
1,000,615
package com.ertanayanlar.erserver.commands; import com.ertanayanlar.erserver.core.model.Command; public class PingCommand extends Command { public PingCommand() { super("ping", "Sends back pong ! as a message", false, true, true, true); } @Override public void run() { sendMessageToCommandCaller("PONG !"); } }
923e18ff828d574d6666dd621e30b64ad0e42adc
3,359
java
Java
com.rockwellcollins.atc.agree.analysis/src/com/rockwellcollins/atc/agree/analysis/TypeTable.java
philip-alldredge/AGREE
8a0cd05fd920318f67c9ddc3b574153acacab891
[ "BSD-3-Clause" ]
null
null
null
com.rockwellcollins.atc.agree.analysis/src/com/rockwellcollins/atc/agree/analysis/TypeTable.java
philip-alldredge/AGREE
8a0cd05fd920318f67c9ddc3b574153acacab891
[ "BSD-3-Clause" ]
null
null
null
com.rockwellcollins.atc.agree.analysis/src/com/rockwellcollins/atc/agree/analysis/TypeTable.java
philip-alldredge/AGREE
8a0cd05fd920318f67c9ddc3b574153acacab891
[ "BSD-3-Clause" ]
null
null
null
31.990476
105
0.733849
1,000,616
package com.rockwellcollins.atc.agree.analysis; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import com.rockwellcollins.atc.agree.AgreeTypeSystem; import jkind.lustre.ArrayType; import jkind.lustre.EnumType; import jkind.lustre.NamedType; import jkind.lustre.RecordType; import jkind.lustre.Type; public class TypeTable { private final Map<String, Type> typeNameToLustreType; public TypeTable() { typeNameToLustreType = new HashMap<>(); } public Type updateLustreTypeMap(AgreeTypeSystem.TypeDef agreeType) { Type lustreType = typeNameToLustreType.get(AgreeTypeSystem.nameOfTypeDef(agreeType)); if (lustreType == null) { lustreType = getLustreType(agreeType); if (lustreType != null) { typeNameToLustreType.put(AgreeTypeSystem.nameOfTypeDef(agreeType), lustreType); } } return lustreType; } public Type getLustreType(AgreeTypeSystem.TypeDef agreeType) { if (agreeType == AgreeTypeSystem.Prim.IntTypeDef) { return NamedType.INT; } else if (agreeType == AgreeTypeSystem.Prim.RealTypeDef) { return NamedType.REAL; } else if (agreeType == AgreeTypeSystem.Prim.BoolTypeDef) { return NamedType.BOOL; } else if (agreeType instanceof AgreeTypeSystem.RangeIntTypeDef) { return NamedType.INT; } else if (agreeType instanceof AgreeTypeSystem.RangeRealTypeDef) { return NamedType.REAL; } else if (agreeType instanceof AgreeTypeSystem.RecordTypeDef) { String name = ((AgreeTypeSystem.RecordTypeDef) agreeType).name.replace("::", "__").replace(".", "__"); Map<String, AgreeTypeSystem.TypeDef> agreeFields = ((AgreeTypeSystem.RecordTypeDef) agreeType).fields; Map<String, Type> lustreFields = new HashMap<>(); for (Entry<String, AgreeTypeSystem.TypeDef> entry : agreeFields.entrySet()) { String key = entry.getKey(); Type lt = updateLustreTypeMap(entry.getValue()); if (lt != null) { lustreFields.put(key, lt); } } RecordType lustreRecType = new RecordType(name, lustreFields); return lustreRecType; } else if (agreeType instanceof AgreeTypeSystem.EnumTypeDef) { String name = ((AgreeTypeSystem.EnumTypeDef) agreeType).name.replace("::", "__").replace(".", "__"); List<String> enumValues = new ArrayList<String>(); for (String raw : ((AgreeTypeSystem.EnumTypeDef) agreeType).values) { String enumValue = raw.replace("::", "__").replace(".", "__"); enumValues.add(enumValue); } EnumType lustreEnumType = new EnumType(name, enumValues); return lustreEnumType; } else if (agreeType instanceof AgreeTypeSystem.ArrayTypeDef) { AgreeTypeSystem.TypeDef agreeBaseType = ((AgreeTypeSystem.ArrayTypeDef) agreeType).stemType; int dimension = ((AgreeTypeSystem.ArrayTypeDef) agreeType).size; Type lustreBaseType = updateLustreTypeMap(agreeBaseType); if (lustreBaseType != null) { ArrayType lustreArrayType = new ArrayType(lustreBaseType, dimension); return lustreArrayType; } } // Jkind does not reason over this. return null; } public List<Type> getLustreTypes() { List<Type> typeList = new ArrayList<>(typeNameToLustreType.values()); typeList.removeIf(type -> ((type instanceof NamedType) && ((NamedType) type).isBuiltin()) || (type instanceof jkind.lustre.ArrayType)); return new ArrayList<>(typeList); } }
923e19dfc9086d9fab9315606a3b3855183e1b44
1,471
java
Java
app/src/main/java/com/ariefzuhri/movee/core/data/source/remote/network/ApiResponse.java
ariefzuhri/Movee
9b94447e81001c2ae33ce45cc1f80f885e3406e0
[ "MIT" ]
1
2021-11-12T02:27:26.000Z
2021-11-12T02:27:26.000Z
app/src/main/java/com/ariefzuhri/movee/core/data/source/remote/network/ApiResponse.java
ariefzuhri/Movee
9b94447e81001c2ae33ce45cc1f80f885e3406e0
[ "MIT" ]
null
null
null
app/src/main/java/com/ariefzuhri/movee/core/data/source/remote/network/ApiResponse.java
ariefzuhri/Movee
9b94447e81001c2ae33ce45cc1f80f885e3406e0
[ "MIT" ]
1
2021-08-14T19:20:06.000Z
2021-08-14T19:20:06.000Z
30.645833
100
0.698165
1,000,617
package com.ariefzuhri.movee.core.data.source.remote.network; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import static com.ariefzuhri.movee.core.data.source.remote.network.StatusResponse.EMPTY; import static com.ariefzuhri.movee.core.data.source.remote.network.StatusResponse.ERROR; import static com.ariefzuhri.movee.core.data.source.remote.network.StatusResponse.SUCCESS; @SuppressWarnings("unused") public class ApiResponse<T> { @NonNull public final StatusResponse status; @Nullable public final String message; @Nullable public final T body; public ApiResponse(@NonNull StatusResponse status, @Nullable T body, @Nullable String message) { this.status = status; this.body = body; this.message = message; } @NotNull @Contract(value = "_ -> new", pure = true) public static <T> ApiResponse<T> success(@Nullable T body) { return new ApiResponse<>(SUCCESS, body, null); } @NotNull @Contract(value = "_, _ -> new", pure = true) public static <T> ApiResponse<T> empty(String msg, @Nullable T body) { return new ApiResponse<>(EMPTY, body, msg); } @NotNull @Contract(value = "_, _ -> new", pure = true) public static <T> ApiResponse<T> error(String msg, @Nullable T body) { return new ApiResponse<>(ERROR, body, msg); } }
923e1aeeec8d5be1bcf62bdcc857bc31e93a5e5a
1,610
java
Java
src/main/java/com/gmail/imshhui/medium/CombinationSumIV.java
xbest/leetcode
7e836f6edc85d0a7e37c390d8e48005655e3662b
[ "MIT" ]
null
null
null
src/main/java/com/gmail/imshhui/medium/CombinationSumIV.java
xbest/leetcode
7e836f6edc85d0a7e37c390d8e48005655e3662b
[ "MIT" ]
null
null
null
src/main/java/com/gmail/imshhui/medium/CombinationSumIV.java
xbest/leetcode
7e836f6edc85d0a7e37c390d8e48005655e3662b
[ "MIT" ]
null
null
null
25.555556
154
0.564596
1,000,618
package com.gmail.imshhui.medium; import java.util.Arrays; /** * Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target. * * Example: * * nums = [1, 2, 3] * target = 4 * * The possible combination ways are: * (1, 1, 1, 1) * (1, 1, 2) * (1, 2, 1) * (1, 3) * (2, 1, 1) * (2, 2) * (3, 1) * * Note that different sequences are counted as different combinations. * * Therefore the output is 7. * * * Follow up: * What if negative numbers are allowed in the given array? * How does it change the problem? * What limitation we need to add to the question to allow negative numbers? * * Credits: * Special thanks to @pbrother for adding this problem and creating all test cases. * * @see <a href="https://leetcode.com/problems/combination-sum-iv/">377. Combination Sum IV</a> * User: liyulin * Date: 2019/11/6 */ public class CombinationSumIV { private int[] dp; public int combinationSum4(int[] nums, int target) { dp = new int[target + 1]; Arrays.fill(dp, -1); dp[0] = 1; return backtrace(nums, target); } private int backtrace(int[] nums, int target) { if (dp[target] != -1) { return dp[target]; } int res = 0; for (int i = 0; i < nums.length; i++) { if (target >= nums[i]) { res = res + backtrace(nums, target - nums[i]); } } dp[target] = res; return res; } }
923e1b260be8ce012e7fe016cbd2aadf35ea01a0
3,382
java
Java
primefaces/src/main/java/org/primefaces/component/chart/renderer/OhlcRenderer.java
N-Hidaya/primefaces-1
d1d42b6fe2bc39f94918d357334a2b2f01c18b62
[ "MIT" ]
1,773
2015-01-04T12:18:31.000Z
2022-03-25T04:42:06.000Z
primefaces/src/main/java/org/primefaces/component/chart/renderer/OhlcRenderer.java
N-Hidaya/primefaces-1
d1d42b6fe2bc39f94918d357334a2b2f01c18b62
[ "MIT" ]
7,130
2015-01-13T12:12:27.000Z
2022-03-31T19:09:59.000Z
primefaces/src/main/java/org/primefaces/component/chart/renderer/OhlcRenderer.java
N-Hidaya/primefaces-1
d1d42b6fe2bc39f94918d357334a2b2f01c18b62
[ "MIT" ]
1,076
2015-01-13T18:40:26.000Z
2022-03-31T22:43:17.000Z
35.6
88
0.652277
1,000,619
/* * The MIT License * * Copyright (c) 2009-2021 PrimeTek * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package org.primefaces.component.chart.renderer; import java.io.IOException; import java.util.Iterator; import java.util.List; import javax.faces.context.FacesContext; import javax.faces.context.ResponseWriter; import org.primefaces.component.chart.Chart; import org.primefaces.model.chart.OhlcChartModel; import org.primefaces.model.chart.OhlcChartSeries; public class OhlcRenderer extends CartesianPlotRenderer { @Override protected void encodeData(FacesContext context, Chart chart) throws IOException { ResponseWriter writer = context.getResponseWriter(); OhlcChartModel model = (OhlcChartModel) chart.getModel(); List<OhlcChartSeries> data = model.getData(); writer.write(",data:[["); for (Iterator<OhlcChartSeries> it = data.iterator(); it.hasNext(); ) { OhlcChartSeries s = it.next(); writer.write("["); writer.write(escapeChartData(s.getValue())); writer.write(","); writer.write(escapeChartData(s.getOpen())); writer.write(","); writer.write(escapeChartData(s.getHigh())); writer.write(","); writer.write(escapeChartData(s.getLow())); writer.write(","); writer.write(escapeChartData(s.getClose())); writer.write("]"); if (it.hasNext()) { writer.write(","); } } writer.write("]]"); } @Override protected void encodeOptions(FacesContext context, Chart chart) throws IOException { super.encodeOptions(context, chart); ResponseWriter writer = context.getResponseWriter(); OhlcChartModel model = (OhlcChartModel) chart.getModel(); if (model.isCandleStick()) { writer.write(",candleStick:true"); } if (model.isZoom()) { writer.write(",zoom:true"); } if (model.isAnimate()) { writer.write(",animate:true"); } if (model.isShowDatatip()) { writer.write(",datatip:true"); if (model.getDatatipFormat() != null) { writer.write(",datatipFormat:\"" + model.getDatatipFormat() + "\""); } } } }
923e1b41639b491285e23c44ff18aeb098a5b55e
1,783
java
Java
ace-demo/ace-tool-demo/src/test/java/cn/wbw/test/TestListIpSort.java
LafeBelife/cloud-platform
b7e278c766f48678691ecfcf7636395b2a0bdcbf
[ "Apache-2.0" ]
null
null
null
ace-demo/ace-tool-demo/src/test/java/cn/wbw/test/TestListIpSort.java
LafeBelife/cloud-platform
b7e278c766f48678691ecfcf7636395b2a0bdcbf
[ "Apache-2.0" ]
3
2021-07-02T18:49:18.000Z
2022-03-31T21:49:33.000Z
ace-demo/ace-tool-demo/src/test/java/cn/wbw/test/TestListIpSort.java
LafeBelife/cloud-platform
b7e278c766f48678691ecfcf7636395b2a0bdcbf
[ "Apache-2.0" ]
null
null
null
34.960784
125
0.540101
1,000,620
package cn.wbw.test; import java.util.Arrays; import java.util.List; import java.util.StringTokenizer; import java.util.stream.Collectors; /** * ip地址排序 * * @author wbw * @date 2019/12/29 15:13 */ public class TestListIpSort { public static void main(String[] args) { String ips = "192.168.137.5\t192.168.130.3\t192.168.9.16\t192.168.9.15\t192.168.9.14\t192.168.9.11\t192.168.9.10\n" + "192.168.9.6\t192.168.9.5\t192.168.9.4\t192.168.9.2\t192.168.9.1\t192.168.9.8\t192.168.9.9\n" + "192.168.9.17\t192.168.9.18\t192.168.9.19\t192.168.9.20\t192.168.137.3\t\t\n" + "192.168.6.42\t192.168.6.38\t192.168.6.13\t192.168.248.2\t192.168.130.12\t192.168.9.12\t\n" + "192.168.9.7\t192.168.6.142\t192.168.6.106\t192.168.6.54\t192.168.6.50\t192.168.6.46\t\n"; ips = ips.replaceAll("\n", "\t").replaceAll("\t+", "\t"); List<String> list = Arrays.stream(ips.split("\t")).collect(Collectors.toList()); list.stream().sorted((e1, e2) -> { StringTokenizer token = new StringTokenizer(e1, "."); StringTokenizer token2 = new StringTokenizer(e2, "."); while (token.hasMoreTokens() && token2.hasMoreTokens()) { int parseInt = Integer.parseInt(token.nextToken()); int parseInt2 = Integer.parseInt(token2.nextToken()); if (parseInt > parseInt2) { return 1; } if (parseInt < parseInt2) { return -1; } } if (token.hasMoreElements()) { // e1还有值,则e2已遍历完 return 1; } else { return -1; } }).forEach(e -> System.out.print(e + "\t")); } }
923e1d248c6f5970d892207ac3e11c909d96fe27
1,217
java
Java
ihmc-common-walking-control-modules/src/main/java/us/ihmc/commonWalkingControlModules/bipedSupportPolygons/RectangularContactableBody.java
dbdxnuliba/IHMC-
a8e89934e75cc7026bc3e082397d989a26c7549e
[ "Apache-2.0" ]
170
2016-02-01T18:58:50.000Z
2022-03-17T05:28:01.000Z
ihmc-common-walking-control-modules/src/main/java/us/ihmc/commonWalkingControlModules/bipedSupportPolygons/RectangularContactableBody.java
ihmcrobotics/ihmc-open-robotics-software
129b261de850e85e1dc78a12e9c075f53c6019a0
[ "Apache-2.0" ]
162
2016-01-29T17:04:29.000Z
2022-02-10T16:25:37.000Z
ihmc-common-walking-control-modules/src/main/java/us/ihmc/commonWalkingControlModules/bipedSupportPolygons/RectangularContactableBody.java
ihmcrobotics/ihmc-open-robotics-software
129b261de850e85e1dc78a12e9c075f53c6019a0
[ "Apache-2.0" ]
83
2016-01-28T22:49:01.000Z
2022-03-28T03:11:24.000Z
40.566667
145
0.780608
1,000,621
package us.ihmc.commonWalkingControlModules.bipedSupportPolygons; import java.util.ArrayList; import java.util.List; import us.ihmc.euclid.referenceFrame.ReferenceFrame; import us.ihmc.euclid.tuple2D.Point2D; import us.ihmc.mecano.multiBodySystem.interfaces.RigidBodyBasics; import us.ihmc.commons.MathTools; public class RectangularContactableBody extends ListOfPointsContactablePlaneBody { public RectangularContactableBody(RigidBodyBasics rigidBody, ReferenceFrame soleFrame, double forward, double back, double left, double right) { super(rigidBody, soleFrame, createContactPoints(forward, back, left, right)); MathTools.checkIntervalContains(forward, back, Double.POSITIVE_INFINITY); MathTools.checkIntervalContains(left, right, Double.POSITIVE_INFINITY); } private static List<Point2D> createContactPoints(double forward, double back, double left, double right) { ArrayList<Point2D> contactPoints = new ArrayList<Point2D>(); contactPoints.add(new Point2D(forward, left)); contactPoints.add(new Point2D(back, left)); contactPoints.add(new Point2D(back, right)); contactPoints.add(new Point2D(forward, right)); return contactPoints; } }
923e1e383808df49f71bf7cb5c3d495817e9a536
3,234
java
Java
src/main/java/org/openxmlformats/schemas/xpackage/x2006/digitalSignature/impl/CTRelationshipReferenceImpl.java
pjfanning/poi-ooxml-lite-build
34af44251cb99fcdf8de2f844af686da8870e7db
[ "Apache-2.0" ]
null
null
null
src/main/java/org/openxmlformats/schemas/xpackage/x2006/digitalSignature/impl/CTRelationshipReferenceImpl.java
pjfanning/poi-ooxml-lite-build
34af44251cb99fcdf8de2f844af686da8870e7db
[ "Apache-2.0" ]
null
null
null
src/main/java/org/openxmlformats/schemas/xpackage/x2006/digitalSignature/impl/CTRelationshipReferenceImpl.java
pjfanning/poi-ooxml-lite-build
34af44251cb99fcdf8de2f844af686da8870e7db
[ "Apache-2.0" ]
null
null
null
35.152174
195
0.660173
1,000,622
/* * XML Type: CT_RelationshipReference * Namespace: http://schemas.openxmlformats.org/package/2006/digital-signature * Java type: org.openxmlformats.schemas.xpackage.x2006.digitalSignature.CTRelationshipReference * * Automatically generated - do not modify. */ package org.openxmlformats.schemas.xpackage.x2006.digitalSignature.impl; import javax.xml.namespace.QName; import org.apache.xmlbeans.QNameSet; /** * An XML CT_RelationshipReference(@http://schemas.openxmlformats.org/package/2006/digital-signature). * * This is an atomic type that is a restriction of org.openxmlformats.schemas.xpackage.x2006.digitalSignature.CTRelationshipReference. */ public class CTRelationshipReferenceImpl extends org.apache.xmlbeans.impl.values.JavaStringHolderEx implements org.openxmlformats.schemas.xpackage.x2006.digitalSignature.CTRelationshipReference { private static final long serialVersionUID = 1L; public CTRelationshipReferenceImpl(org.apache.xmlbeans.SchemaType sType) { super(sType, true); } protected CTRelationshipReferenceImpl(org.apache.xmlbeans.SchemaType sType, boolean b) { super(sType, b); } private static final QName[] PROPERTY_QNAME = { new QName("", "SourceId"), }; /** * Gets the "SourceId" attribute */ @Override public java.lang.String getSourceId() { synchronized (monitor()) { check_orphaned(); org.apache.xmlbeans.SimpleValue target = null; target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(PROPERTY_QNAME[0]); return (target == null) ? null : target.getStringValue(); } } /** * Gets (as xml) the "SourceId" attribute */ @Override public org.apache.xmlbeans.XmlString xgetSourceId() { synchronized (monitor()) { check_orphaned(); org.apache.xmlbeans.XmlString target = null; target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(PROPERTY_QNAME[0]); return target; } } /** * Sets the "SourceId" attribute */ @Override public void setSourceId(java.lang.String sourceId) { synchronized (monitor()) { check_orphaned(); org.apache.xmlbeans.SimpleValue target = null; target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(PROPERTY_QNAME[0]); if (target == null) { target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(PROPERTY_QNAME[0]); } target.setStringValue(sourceId); } } /** * Sets (as xml) the "SourceId" attribute */ @Override public void xsetSourceId(org.apache.xmlbeans.XmlString sourceId) { synchronized (monitor()) { check_orphaned(); org.apache.xmlbeans.XmlString target = null; target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(PROPERTY_QNAME[0]); if (target == null) { target = (org.apache.xmlbeans.XmlString)get_store().add_attribute_user(PROPERTY_QNAME[0]); } target.set(sourceId); } } }
923e1f43c63189ab760be2efe282ccda4e883691
66
java
Java
InnerAbstractCalssesInterfaces/src/com/company/CanFly.java
hanssenstijn/udemyJava
b4ba5c681cac21cebacab6295625529dcffe14e5
[ "MIT" ]
null
null
null
InnerAbstractCalssesInterfaces/src/com/company/CanFly.java
hanssenstijn/udemyJava
b4ba5c681cac21cebacab6295625529dcffe14e5
[ "MIT" ]
null
null
null
InnerAbstractCalssesInterfaces/src/com/company/CanFly.java
hanssenstijn/udemyJava
b4ba5c681cac21cebacab6295625529dcffe14e5
[ "MIT" ]
null
null
null
11
25
0.681818
1,000,623
package com.company; public interface CanFly { void fly(); }
923e1f94a9101efb410b989c7e72712cb6ffaa9c
159
java
Java
com/lee/ultrascan/C0796R.java
kelu124/pyS3
86eb139d971921418d6a62af79f2868f9c7704d5
[ "MIT" ]
1
2021-04-09T06:03:36.000Z
2021-04-09T06:03:36.000Z
com/lee/ultrascan/C0796R.java
kelu124/pyS3
86eb139d971921418d6a62af79f2868f9c7704d5
[ "MIT" ]
null
null
null
com/lee/ultrascan/C0796R.java
kelu124/pyS3
86eb139d971921418d6a62af79f2868f9c7704d5
[ "MIT" ]
null
null
null
17.666667
57
0.691824
1,000,624
package com.lee.ultrascan; public final class C0796R { public static final class xml { public static final int preferences = 2131165184; } }
923e209fcfa9f544e907262d9dce2e1866a5f0d3
3,087
java
Java
app/src/main/java/shitamatsuge/haifuri/CharaViews/MikanView.java
ShitamatsugeFactory/KokoWalk
16bf1b0ed514357a38cf9c42d3f84e60ebe5e334
[ "MIT" ]
4
2017-01-01T07:33:51.000Z
2017-01-04T02:18:31.000Z
app/src/main/java/shitamatsuge/haifuri/CharaViews/MikanView.java
ShitamatsugeFactory/KokoWalk
16bf1b0ed514357a38cf9c42d3f84e60ebe5e334
[ "MIT" ]
3
2017-01-03T10:56:00.000Z
2017-02-13T12:53:40.000Z
app/src/main/java/shitamatsuge/haifuri/CharaViews/MikanView.java
ShitamatsugeFactory/KokoWalk
16bf1b0ed514357a38cf9c42d3f84e60ebe5e334
[ "MIT" ]
null
null
null
37.646341
95
0.628442
1,000,625
package shitamatsuge.haifuri.CharaViews; import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.FrameLayout; import shitamatsuge.haifuri.R; /** * Created by user1 on 2016/05/29. */ public class MikanView extends CharaView { private String TAG = "CharaView"; public MikanView(Context context, AttributeSet attrs) { super(context, attrs); View view = LayoutInflater.from(context).inflate(R.layout.mikan, this); mBase = (FrameLayout)findViewById(R.id.parent); mNormal = new FrameLayout[2]; mWalk = new FrameLayout[6]; mTouchUpper = new FrameLayout[2]; mTouchDowner = new FrameLayout[2]; mRandomAction = new FrameLayout[2]; mNormal[0] = (FrameLayout)findViewById(R.id.normal); mNormal[1] = (FrameLayout)findViewById(R.id.normal_r); mWalk[0] = (FrameLayout)findViewById(R.id.walk0); mWalk[1] = (FrameLayout)findViewById(R.id.walk1); mWalk[2] = (FrameLayout)findViewById(R.id.walk2); mWalk[3] = (FrameLayout)findViewById(R.id.walk0_r); mWalk[4] = (FrameLayout)findViewById(R.id.walk1_r); mWalk[5] = (FrameLayout)findViewById(R.id.walk2_r); mTouchUpper[0] = (FrameLayout)findViewById(R.id.upper); mTouchUpper[1] = (FrameLayout)findViewById(R.id.upper_r); mTouchDowner[0] = (FrameLayout)findViewById(R.id.downer); mTouchDowner[1] = (FrameLayout)findViewById(R.id.downer_r); mRandomAction[0] = (FrameLayout)findViewById(R.id.random); mRandomAction[1] = (FrameLayout)findViewById(R.id.random_r); ((FrameLayout)findViewById(R.id.touch_up)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { upperAnimation(1200); } }); ((FrameLayout)findViewById(R.id.touch_down)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { downerAnimation(800); } }); } @Override protected void setRandomActionImage() { int r = (int)(Math.random() * 3); switch (r) { case 0: mRandomAction[0].setBackgroundResource(R.drawable.mikan_katsu); mRandomAction[1].setBackgroundResource(R.drawable.mikan_katsu_r); break; case 1: mRandomAction[0].setBackgroundResource(R.drawable.mikan_keki); mRandomAction[1].setBackgroundResource(R.drawable.mikan_keki_r); break; case 2: mRandomAction[0].setBackgroundResource(R.drawable.mikan_sasimi); mRandomAction[1].setBackgroundResource(R.drawable.mikan_sasimi_r); break; default: mRandomAction[0].setBackgroundResource(R.drawable.mikan_keki); mRandomAction[1].setBackgroundResource(R.drawable.mikan_keki_r); break; } }}
923e20aa5e447ec658650ee7c94c2106924fede9
1,107
java
Java
src/com/google/javascript/jscomp/DummyCompileMetricsRecorder.java
nawawi/closure-compiler
88f2cf49e04b133a4fa1228e46f79a4b70a8e36d
[ "Apache-2.0" ]
6,240
2015-01-01T00:20:53.000Z
2022-03-31T10:33:32.000Z
src/com/google/javascript/jscomp/DummyCompileMetricsRecorder.java
nawawi/closure-compiler
88f2cf49e04b133a4fa1228e46f79a4b70a8e36d
[ "Apache-2.0" ]
3,139
2015-01-03T02:13:16.000Z
2022-03-31T16:44:22.000Z
src/com/google/javascript/jscomp/DummyCompileMetricsRecorder.java
nawawi/closure-compiler
88f2cf49e04b133a4fa1228e46f79a4b70a8e36d
[ "Apache-2.0" ]
1,272
2015-01-07T01:22:20.000Z
2022-03-28T07:23:29.000Z
32.558824
85
0.763324
1,000,626
/* * Copyright 2021 The Closure Compiler Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.javascript.jscomp; /** A do-nothing metrics recorder that `AbstractCompilerRunner` uses by default. */ public class DummyCompileMetricsRecorder implements CompileMetricsRecorderInterface { @Override public void recordActionStart() {} @Override public void recordActionName(String actionName) {} @Override public void recordStartState(AbstractCompiler compiler) {} @Override public void recordResultMetrics(AbstractCompiler compiler, Result result) {} }
923e21541fde2d0b8066fdc16e819abb74e9b6fc
463
java
Java
src/main/java/prj/sslfacade/Tasks.java
kashifrazzaqui/sslfacade
28a7b169bd5a0f4c4baa7c48bcaec3c78cfc4378
[ "MIT" ]
16
2015-06-22T15:44:13.000Z
2020-05-04T17:49:27.000Z
src/main/java/prj/sslfacade/Tasks.java
kashifrazzaqui/sslfacade
28a7b169bd5a0f4c4baa7c48bcaec3c78cfc4378
[ "MIT" ]
6
2015-04-27T15:23:49.000Z
2019-09-18T09:01:45.000Z
src/main/java/prj/sslfacade/Tasks.java
kashifrazzaqui/sslfacade
28a7b169bd5a0f4c4baa7c48bcaec3c78cfc4378
[ "MIT" ]
6
2015-04-27T08:06:04.000Z
2019-12-29T06:42:00.000Z
16.535714
46
0.62203
1,000,627
package prj.sslfacade; import javax.net.ssl.SSLException; public class Tasks implements ITasks { private final Worker _worker; private final Handshaker _hs; public Tasks(Worker worker, Handshaker hs) { _worker = worker; _hs = hs; } @Override public Runnable next() { return _worker.getDelegatedTask(); } @Override public void done() throws SSLException { _hs.carryOn(); } }
923e21ba7a4225114b9fdcf6f20c5083c1766a36
3,895
java
Java
2.JavaCore/src/zh/codegym/task/task20/task2002/Solution.java
wangrunlin/CodeGymTasks
c6c3f93fbbe7b5a71c05bebf4b6068de81621533
[ "MIT" ]
null
null
null
2.JavaCore/src/zh/codegym/task/task20/task2002/Solution.java
wangrunlin/CodeGymTasks
c6c3f93fbbe7b5a71c05bebf4b6068de81621533
[ "MIT" ]
null
null
null
2.JavaCore/src/zh/codegym/task/task20/task2002/Solution.java
wangrunlin/CodeGymTasks
c6c3f93fbbe7b5a71c05bebf4b6068de81621533
[ "MIT" ]
null
null
null
34.776786
91
0.552246
1,000,628
package zh.codegym.task.task20.task2002; import java.io.*; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Objects; /* 读取并写入文件CodeGym */ public class Solution { public static void main(String[] args) { // 你可以在 TMP 目录中找到 your_file_name.tmp,或者按照文件的实际位置调整 outputStream/inputStream try { File yourFile = File.createTempFile("你的文件名", null); OutputStream outputStream = new FileOutputStream(yourFile); InputStream inputStream = new FileInputStream(yourFile); CodeGym codeGym = new CodeGym(); // 在此初始化 codeGym 对象的 users 字段 User user = new User(); user.setFirstName("Wang"); user.setLastName("Runlin"); user.setMale(true); user.setBirthDate(new Date(System.currentTimeMillis())); user.setCountry(User.Country.OTHER); codeGym.users.add(user); codeGym.save(outputStream); outputStream.flush(); CodeGym loadedObject = new CodeGym(); loadedObject.load(inputStream); // 在此检查 codeGym 对象是否等于 loadedObject 对象 outputStream.close(); inputStream.close(); } catch (IOException e) { //e.printStackTrace(); System.out.println("糟糕,我的生活出现问题了"); } catch (Exception e) { //e.printStackTrace(); System.out.println("糟糕,save/load 方法出现问题"); } } public static class CodeGym { public List<User> users = new ArrayList<>(); public void save(OutputStream outputStream) throws Exception { PrintWriter pw = new PrintWriter(outputStream); users.forEach(user -> { pw.println(user.getFirstName()); pw.println(user.getLastName()); pw.println(user.getBirthDate().getTime()); pw.println(user.isMale()); pw.println(user.getCountry().getDisplayName()); }); pw.close(); } public void load(InputStream inputStream) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); String firstName; String lastName; String birthDate; String isMale; String country; while ((firstName = reader.readLine()) != null && (lastName = reader.readLine()) != null && (birthDate = reader.readLine()) != null && (isMale = reader.readLine()) != null && (country = reader.readLine()) != null) { User user = new User(); user.setFirstName(firstName); user.setLastName(lastName); user.setBirthDate(new Date(Long.parseLong(birthDate))); user.setMale(Boolean.parseBoolean(isMale)); if (User.Country.UNITED_STATES.getDisplayName().equals(country)) { user.setCountry(User.Country.UNITED_STATES); } else if (User.Country.UNITED_KINGDOM.getDisplayName().equals(country)) { user.setCountry(User.Country.UNITED_KINGDOM); } else if (User.Country.OTHER.getDisplayName().equals(country)) { user.setCountry(User.Country.OTHER); } users.add(user); } reader.close(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; CodeGym codeGym = (CodeGym) o; return Objects.equals(users, codeGym.users); } @Override public int hashCode() { return users != null ? users.hashCode() : 0; } } }
923e21df64c47f51222a360dac7a48a3e16ec192
2,071
java
Java
plugins/uep/src/main/java/com/zte/apm/plugin/uep/UepTraceMetadataProvider.java
gcxtx/Agent
ea0e3de1997169d92d687cba469ac8b12cbaa1bb
[ "Apache-2.0" ]
1
2021-05-06T06:25:16.000Z
2021-05-06T06:25:16.000Z
plugins/uep/src/main/java/com/zte/apm/plugin/uep/UepTraceMetadataProvider.java
gcxtx/Agent
ea0e3de1997169d92d687cba469ac8b12cbaa1bb
[ "Apache-2.0" ]
null
null
null
plugins/uep/src/main/java/com/zte/apm/plugin/uep/UepTraceMetadataProvider.java
gcxtx/Agent
ea0e3de1997169d92d687cba469ac8b12cbaa1bb
[ "Apache-2.0" ]
null
null
null
44.06383
148
0.780299
1,000,629
/** * Copyright 2014 NAVER Corp. * 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.zte.apm.plugin.uep; import com.navercorp.pinpoint.common.trace.TraceMetadataProvider; import com.navercorp.pinpoint.common.trace.TraceMetadataSetupContext; /** * @author Jongho Moon * */ public class UepTraceMetadataProvider implements TraceMetadataProvider { /* (non-Javadoc) * @see com.navercorp.pinpoint.common.trace.TraceMetadataProvider#setup(com.navercorp.pinpoint.common.trace.TraceMetadataSetupContext) */ @Override public void setup(TraceMetadataSetupContext context) { // context.addServiceType(SamplePluginConstants.MY_SERVICE_TYPE, AnnotationKeyMatchers.exact(SamplePluginConstants.ANNOTATION_KEY_MY_VALUE)); // context.addAnnotationKey(SamplePluginConstants.ANNOTATION_KEY_MY_VALUE); // // context.addServiceType(SamplePluginConstants.MY_RPC_SERVER_SERVICE_TYPE); // context.addServiceType(SamplePluginConstants.MY_RPC_CLIENT_SERVICE_TYPE); // context.addAnnotationKey(SamplePluginConstants.MY_RPC_PROCEDURE_ANNOTATION_KEY); // context.addAnnotationKey(SamplePluginConstants.MY_RPC_ARGUMENT_ANNOTATION_KEY); // context.addAnnotationKey(SamplePluginConstants.MY_RPC_RESULT_ANNOTATION_KEY); context.addServiceType(UepPluginConstants.UEP_SERVER); context.addServiceType(UepPluginConstants.UEP_CLIENT); context.addServiceType(UepPluginConstants.MINOS_SERVER); context.addAnnotationKey(UepPluginConstants.UEP_EMB_RESULT_ANNOTATION_KEY); } }
923e23820428ac0cfbd953869190716bbc211e68
1,655
java
Java
src/main/java/javafxlibrary/matchers/InstanceOfMatcher.java
psaikkonen/JavaFXLibrary
a14e7b613aeda58d81a44643580910893342e4f7
[ "ECL-2.0", "Apache-2.0" ]
22
2018-03-23T08:37:56.000Z
2021-12-14T09:59:42.000Z
src/main/java/javafxlibrary/matchers/InstanceOfMatcher.java
psaikkonen/JavaFXLibrary
a14e7b613aeda58d81a44643580910893342e4f7
[ "ECL-2.0", "Apache-2.0" ]
46
2018-06-06T05:46:09.000Z
2021-09-08T19:55:47.000Z
src/main/java/javafxlibrary/matchers/InstanceOfMatcher.java
psaikkonen/JavaFXLibrary
a14e7b613aeda58d81a44643580910893342e4f7
[ "ECL-2.0", "Apache-2.0" ]
11
2018-08-23T10:35:02.000Z
2021-05-25T04:04:28.000Z
31.226415
78
0.673112
1,000,630
/* * Copyright 2017-2018 Eficode Oy * Copyright 2018- Robot Framework Foundation * * 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 javafxlibrary.matchers; import org.hamcrest.core.IsInstanceOf; import javafx.scene.Node; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; public class InstanceOfMatcher extends BaseMatcher<Node> { private final IsInstanceOf matcher; private final Class<?> type; private Object last = null; public InstanceOfMatcher(Class<?> type) { this.type = type; this.matcher = new IsInstanceOf(type); } public InstanceOfMatcher(String name) throws ClassNotFoundException { this.type = Class.forName(name); this.matcher = new IsInstanceOf(this.type); } @Override public void describeTo(Description description) { if (last != null) { description.appendText("Expected type " + type + " but got " + last); } } @Override public boolean matches(Object item) { this.last = item; return matcher.matches(item); } }
923e23a3ad5e515292cc945c561cf8ab0d14e1ea
228
java
Java
src/main/java/com/bayor/froporec/annotation/client/immutable/data1_allrecordsannotated/Student.java
mohamed-ashraf-bayor/froporec-annotation-client
f9f915c85c74409557dfe74aaad822c59cc55b0b
[ "MIT" ]
null
null
null
src/main/java/com/bayor/froporec/annotation/client/immutable/data1_allrecordsannotated/Student.java
mohamed-ashraf-bayor/froporec-annotation-client
f9f915c85c74409557dfe74aaad822c59cc55b0b
[ "MIT" ]
null
null
null
src/main/java/com/bayor/froporec/annotation/client/immutable/data1_allrecordsannotated/Student.java
mohamed-ashraf-bayor/froporec-annotation-client
f9f915c85c74409557dfe74aaad822c59cc55b0b
[ "MIT" ]
null
null
null
32.571429
88
0.824561
1,000,631
package com.bayor.froporec.annotation.client.immutable.data1_allrecordsannotated; import org.froporec.annotations.Immutable; @Immutable public record Student(int mark, String grade, School school, String lastname, int age) { }
923e2403361f7ab3dc6d8ad79e70e4b41830b588
4,184
java
Java
src/main/java/brickhouse/udf/httputil/HttpUDF.java
owenmorpheus/brickhouse
fd227e940406596ff650545acaac34dd4ecd04ed
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
src/main/java/brickhouse/udf/httputil/HttpUDF.java
owenmorpheus/brickhouse
fd227e940406596ff650545acaac34dd4ecd04ed
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
src/main/java/brickhouse/udf/httputil/HttpUDF.java
owenmorpheus/brickhouse
fd227e940406596ff650545acaac34dd4ecd04ed
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
34.578512
125
0.578872
1,000,632
package brickhouse.udf.httputil; import com.alibaba.fastjson.JSONObject; import org.apache.hadoop.hive.ql.exec.UDF; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.ConnectException; import java.net.URL; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.util.Random; /** * @author zhangtianyu02 * @create 2022/02/11 */ public class HttpUDF extends UDF { public static HttpsURLConnection conn = null; public String evaluate(String input) throws InterruptedException, NoSuchAlgorithmException, KeyManagementException { String[] split = input.split(","); String bossid=""; String jobid=""; String conclusion=""; String status=""; StringBuffer output=new StringBuffer(""); for(String x:split){ bossid = x.split(":")[0]; jobid =x.split(":")[1]; String url="https://sandbox.weizhipin.com/api/abSandbox/common/getCaseConclusion?userId="+bossid+"&jepId="+jobid; String json = httpsGet(url); JSONObject object = JSONObject.parseObject(json); if((int)object.get("code")==200){ JSONObject obj2=JSONObject.parseObject(object.get("data").toString()); conclusion= obj2.get("conclusion").toString(); status = obj2.get("status").toString(); } output.append(conclusion); output.append(":"); output.append(status); output.append(":"); output.append(bossid); output.append(":"); output.append(jobid); output.append(","); } String substring = output.substring(0, output.length() - 1); return substring; // Random r = new Random(); // int i1 = r.nextInt(5); //// Thread.currentThread().sleep(10*i1); // String url="https://sandbox.weizhipin.com/api/abSandbox/common/getCaseConclusion?userId="+bossid+"&jepId="+jobid; // String json = httpsGet(url); // JSONObject object = JSONObject.parseObject(json); // String conclusion=""; // String status=""; // if((int)object.get("code")==200){ // JSONObject obj2=JSONObject.parseObject(object.get("data").toString()); // conclusion= obj2.get("conclusion").toString(); // status = obj2.get("status").toString(); // } // return conclusion+","+status; } public static String httpsGet(String url){ String str_return = ""; conn = null; try { SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom()); URL console = new URL(url); conn = (HttpsURLConnection) console.openConnection(); conn.setSSLSocketFactory(sc.getSocketFactory()); conn.setHostnameVerifier(new TrustAnyHostnameVerifier()); conn.connect(); InputStream is = conn.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is, ("ISO-8859-1"))); String ret = ""; while (ret != null) { ret = br.readLine(); if (ret != null && !ret.trim().equals("")) { str_return = str_return + new String(ret.getBytes("ISO-8859-1"), "utf-8"); } } } catch (ConnectException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (KeyManagementException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } finally { conn.disconnect(); } return str_return; } }
923e2451a48887de8819a8451b5001de67055867
1,802
java
Java
src/gfsh/StartGatewaySender.java
ldom22/GGGUI
cc59e471639f8b4fc8d1283c99441989351bf829
[ "Apache-2.0" ]
1
2022-01-05T10:38:13.000Z
2022-01-05T10:38:13.000Z
src/gfsh/StartGatewaySender.java
ldom22/GGGUI
cc59e471639f8b4fc8d1283c99441989351bf829
[ "Apache-2.0" ]
null
null
null
src/gfsh/StartGatewaySender.java
ldom22/GGGUI
cc59e471639f8b4fc8d1283c99441989351bf829
[ "Apache-2.0" ]
null
null
null
43.95122
102
0.370699
1,000,633
/****************************************************************************************************/ /* */ /* File: StartGatewaySender.java */ /* Description: StartGatewaySender command implementation */ /* Created: 2021-2022 in Mexico */ /* License type: Apache */ /* */ /* Author: Luis Olea */ /* */ /****************************************************************************************************/ public class StartGatewaySender extends Command { public StartGatewaySender() { name = "start gateway-sender"; description = "Start the Gateway Sender on a member or members"; parameters = new Parameter[3]; parameters[0] = new Parameter(); parameters[0].name = "id"; parameters[0].description = "ID of the Gateway Sender"; parameters[0].required = true; parameters[1] = new Parameter(); parameters[1].name = "group"; parameters[1].description = "Group(s) of members on which to start the Gateway Sender"; parameters[1].required = false; parameters[2] = new Parameter(); parameters[2].name = "member"; parameters[2].description = "Name/Id of the member on which to start the Gateway Sender"; parameters[2].required = false; } }
923e251989cb49faeff37e76cdc7b62f12520e85
524
java
Java
src/ex/ex04_105021060.java
csie-asia-Java-Programming-1/week04-20161017-Simon40
5745c2ec0aec8322dc739c674f593554261c707f
[ "MIT" ]
null
null
null
src/ex/ex04_105021060.java
csie-asia-Java-Programming-1/week04-20161017-Simon40
5745c2ec0aec8322dc739c674f593554261c707f
[ "MIT" ]
null
null
null
src/ex/ex04_105021060.java
csie-asia-Java-Programming-1/week04-20161017-Simon40
5745c2ec0aec8322dc739c674f593554261c707f
[ "MIT" ]
null
null
null
17.466667
41
0.528626
1,000,634
package ex; /* * Topic: 讓使用者輸入 一個正整數 n 及一個字元符號, 然後顯示出下列圖形 (例 n = 4,字元符號= @) @@@@ @@@ @@ @ * Date: 2016/10/17 * Author: 105021060 陳俊仁 */ import java.util.Scanner; public class ex04_105021060 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scn=new Scanner(System.in); int a=scn.nextInt(); for(int x=0;a>x;x++){ for(int y=a;x+1<=y;y--){ System.out.print("@"); } System.out.println(" "); } } }
923e26d23c73496a736535f315ded779b4f0d0bc
490
java
Java
src/main/java/tfar/fastbenchminusreplacement/mixin/CraftingInventoryAccessor.java
Tfarcenim/FastBenchMinusReplacement
9031c086c552eaaaa1edeb314935faa72a3a829b
[ "Unlicense" ]
1
2021-09-04T14:57:34.000Z
2021-09-04T14:57:34.000Z
src/main/java/tfar/fastbenchminusreplacement/mixin/CraftingInventoryAccessor.java
Tfarcenim/FastBenchMinusReplacement
9031c086c552eaaaa1edeb314935faa72a3a829b
[ "Unlicense" ]
6
2020-07-12T15:19:04.000Z
2021-05-16T09:53:56.000Z
src/main/java/tfar/fastbenchminusreplacement/mixin/CraftingInventoryAccessor.java
Tfarcenim/FastBenchMinusReplacement
9031c086c552eaaaa1edeb314935faa72a3a829b
[ "Unlicense" ]
null
null
null
25.789474
51
0.834694
1,000,635
package tfar.fastbenchminusreplacement.mixin; import net.minecraft.inventory.CraftingInventory; import net.minecraft.inventory.container.Container; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; @Mixin(CraftingInventory.class) public interface CraftingInventoryAccessor { @Accessor NonNullList<ItemStack> getStackList(); @Accessor Container getEventHandler(); }
923e27017e487d91fbc787bca383d59c00df51b0
2,731
java
Java
app/src/main/java/space/galactictavern/app/ui/widgets/CommLinkWidget.java
fusion44/galactic-tavern-android
18e3efc1cd5139c2e5871a2458882b14a32329d3
[ "Apache-2.0" ]
1
2017-03-26T15:37:42.000Z
2017-03-26T15:37:42.000Z
app/src/main/java/space/galactictavern/app/ui/widgets/CommLinkWidget.java
fusion44/galactic-tavern-android
18e3efc1cd5139c2e5871a2458882b14a32329d3
[ "Apache-2.0" ]
null
null
null
app/src/main/java/space/galactictavern/app/ui/widgets/CommLinkWidget.java
fusion44/galactic-tavern-android
18e3efc1cd5139c2e5871a2458882b14a32329d3
[ "Apache-2.0" ]
null
null
null
40.761194
110
0.733797
1,000,636
package space.galactictavern.app.ui.widgets; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.widget.RemoteViews; import space.galactictavern.app.R; import space.galactictavern.app.ui.commlinks.CommLinkReaderActivity; import timber.log.Timber; /** * Implementation of App Widget functionality. * <p> * This widget will display the comm links currently in database. */ public class CommLinkWidget extends AppWidgetProvider { static void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) { CharSequence widgetText = context.getString(R.string.widget_header_text); // See documentation https://developer.android.com/guide/topics/appwidgets/ Intent intent = new Intent(context, CommLinkRemoteViewsService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME))); RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget_comm_link); rv.setTextViewText(R.id.widgetHeader, widgetText); rv.setRemoteAdapter(R.id.widgetCommLinkList, intent); // launch Activity intent Intent activityIntent = new Intent(context, CommLinkReaderActivity.class); activityIntent.setAction(CommLinkReaderActivity.ACTION_COMM_LINK_WIDGET_CLICK); activityIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME))); // Why again? Typo in Android docs? PendingIntent pi = PendingIntent.getActivity(context, 0, activityIntent, PendingIntent.FLAG_UPDATE_CURRENT); rv.setPendingIntentTemplate(R.id.widgetCommLinkList, pi); // Instruct the widget manager to update the widget appWidgetManager.updateAppWidget(appWidgetId, rv); } @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { Timber.d("Update comm link widgets"); // There may be multiple widgets active, so update all of them for (int appWidgetId : appWidgetIds) { updateAppWidget(context, appWidgetManager, appWidgetId); } } @Override public void onEnabled(Context context) { // Enter relevant functionality for when the first widget is created } @Override public void onDisabled(Context context) { // Enter relevant functionality for when the last widget is disabled } }
923e2701cc233a6a790a4a5639ea5f0392d972aa
1,809
java
Java
integration/src/main/java/org/apache/mahout/utils/vectors/io/VectorWriter.java
UnimibSoftEngCourse1819/laboratorio-4-esercizio-sonarqube-mahout-claudiom4sir
6267e5d8f6b13136f0c8151ea7e514b9733266ff
[ "Apache-2.0" ]
2,073
2015-01-01T15:35:21.000Z
2022-03-31T06:18:06.000Z
integration/src/main/java/org/apache/mahout/utils/vectors/io/VectorWriter.java
UnimibSoftEngCourse1819/laboratorio-4-esercizio-sonarqube-mahout-claudiom4sir
6267e5d8f6b13136f0c8151ea7e514b9733266ff
[ "Apache-2.0" ]
224
2015-01-01T16:36:19.000Z
2021-01-27T23:22:45.000Z
integration/src/main/java/org/apache/mahout/utils/vectors/io/VectorWriter.java
UnimibSoftEngCourse1819/laboratorio-4-esercizio-sonarqube-mahout-claudiom4sir
6267e5d8f6b13136f0c8151ea7e514b9733266ff
[ "Apache-2.0" ]
1,109
2015-01-01T23:32:26.000Z
2022-03-28T07:27:17.000Z
34.132075
75
0.728579
1,000,637
/** * 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.mahout.utils.vectors.io; import java.io.Closeable; import java.io.IOException; import org.apache.mahout.math.Vector; public interface VectorWriter extends Closeable { /** * Write all values in the Iterable to the output * @param iterable The {@link Iterable} to loop over * @return the number of docs written * @throws IOException if there was a problem writing * */ long write(Iterable<Vector> iterable) throws IOException; /** * Write out a vector * * @param vector The {@link org.apache.mahout.math.Vector} to write * @throws IOException */ void write(Vector vector) throws IOException; /** * Write the first {@code maxDocs} to the output. * @param iterable The {@link Iterable} to loop over * @param maxDocs the maximum number of docs to write * @return The number of docs written * @throws IOException if there was a problem writing */ long write(Iterable<Vector> iterable, long maxDocs) throws IOException; }
923e281045d7051e2a3c7e6a8a5cd18052bbcf70
493
java
Java
oneplatform-services/cms-service/src/main/java/com/oneplatform/cms/dao/mapper/ArticleEntityMapper.java
ruanlinjing/oneplatform
06c8b5ef15d0f33652ca8072fdbaadfbed68ecb1
[ "Apache-2.0" ]
1
2020-03-18T14:26:30.000Z
2020-03-18T14:26:30.000Z
oneplatform-services/cms-service/src/main/java/com/oneplatform/cms/dao/mapper/ArticleEntityMapper.java
ruanlinjing/oneplatform
06c8b5ef15d0f33652ca8072fdbaadfbed68ecb1
[ "Apache-2.0" ]
null
null
null
oneplatform-services/cms-service/src/main/java/com/oneplatform/cms/dao/mapper/ArticleEntityMapper.java
ruanlinjing/oneplatform
06c8b5ef15d0f33652ca8072fdbaadfbed68ecb1
[ "Apache-2.0" ]
null
null
null
29
80
0.817444
1,000,638
package com.oneplatform.cms.dao.mapper; import java.util.List; import com.jeesuite.mybatis.core.BaseMapper; import com.jeesuite.mybatis.plugin.pagination.annotation.Pageable; import com.oneplatform.cms.dao.entity.ArticleEntity; import com.oneplatform.cms.dto.param.ArticleQueryParam; /** * generated by www.jeesuite.com */ public interface ArticleEntityMapper extends BaseMapper<ArticleEntity,Integer> { @Pageable List<ArticleEntity> findListByQueryParam(ArticleQueryParam param); }
923e287fdcccea5e01685af10ecdda1dffc82b64
850
java
Java
jdbc_Driver_part5/src/com/lara/Manager6.java
mkp1104/localEclipseWorkspaceJava
3523a0400ac95c0495c2714b8fb17c05f03d8dba
[ "MIT" ]
null
null
null
jdbc_Driver_part5/src/com/lara/Manager6.java
mkp1104/localEclipseWorkspaceJava
3523a0400ac95c0495c2714b8fb17c05f03d8dba
[ "MIT" ]
null
null
null
jdbc_Driver_part5/src/com/lara/Manager6.java
mkp1104/localEclipseWorkspaceJava
3523a0400ac95c0495c2714b8fb17c05f03d8dba
[ "MIT" ]
null
null
null
21.794872
54
0.558824
1,000,639
package com.lara; import java.sql.Connection; import java.sql.Statement; import java.sql.SQLException; public class Manager6 { public static void main(String arg[]) { Connection con=null; Statement st=null; try { con=DBUtil.getConnection(); st=con.createStatement(); StringBuffer sb=new StringBuffer(); sb.append("create or replace procedure p3 "); sb.append("as begin "); sb.append("insert into tab3 values(1,'abc');"); sb.append("delete from emp;"); sb.append("end;"); st.execute(sb.toString()); System.out.println(sb); System.out.println("done"); } catch(SQLException ex) { System.out.println(ex); } finally { DBUtil.closeAll(null, st, con); } } }
923e28e9013701e742c30c01cc2a3bc072de9067
3,072
java
Java
shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/UpdatableRALStatementAssert.java
chaitr91/shardingsphere
59e8cab321bb9e8f91fe65d56a08c80a11d2a362
[ "Apache-2.0" ]
5,788
2020-04-17T14:09:07.000Z
2022-03-31T08:12:53.000Z
shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/UpdatableRALStatementAssert.java
chaitr91/shardingsphere
59e8cab321bb9e8f91fe65d56a08c80a11d2a362
[ "Apache-2.0" ]
6,488
2020-04-17T14:21:54.000Z
2022-03-31T21:36:33.000Z
shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/UpdatableRALStatementAssert.java
chaitr91/shardingsphere
59e8cab321bb9e8f91fe65d56a08c80a11d2a362
[ "Apache-2.0" ]
2,504
2020-04-17T14:09:46.000Z
2022-03-31T12:21:31.000Z
56.888889
174
0.805339
1,000,640
/* * 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.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl; import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.apache.shardingsphere.distsql.parser.statement.ral.UpdatableRALStatement; import org.apache.shardingsphere.scaling.distsql.statement.CheckoutScalingStatement; import org.apache.shardingsphere.scaling.distsql.statement.StopScalingSourceWritingStatement; import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext; import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.update.CheckoutScalingStatementAssert; import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.update.StopScalingSourceWritingStatementAssert; import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase; import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.scaling.CheckoutScalingStatementTestCase; import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.scaling.StopScalingSourceWritingStatementTestCase; /** * Updatable RAL statement assert. */ @NoArgsConstructor(access = AccessLevel.PRIVATE) public final class UpdatableRALStatementAssert { /** * Assert updatable RAL statement is correct with expected parser result. * * @param assertContext assert context * @param actual actual updatable RAL statement * @param expected expected updatable RAL statement test case */ public static void assertIs(final SQLCaseAssertContext assertContext, final UpdatableRALStatement actual, final SQLParserTestCase expected) { // TODO add more test case if (actual instanceof StopScalingSourceWritingStatement) { StopScalingSourceWritingStatementAssert.assertIs(assertContext, (StopScalingSourceWritingStatement) actual, (StopScalingSourceWritingStatementTestCase) expected); } else if (actual instanceof CheckoutScalingStatement) { CheckoutScalingStatementAssert.assertIs(assertContext, (CheckoutScalingStatement) actual, (CheckoutScalingStatementTestCase) expected); } } }
923e28fc02d407fe665fc3ae2752ff840c784af2
7,423
java
Java
src/main/java/org/joda/money/format/AmountPrinterParser.java
hegazy/joda-money
892ab01c7f63cfff267ba1fbc5ef097a7c01ce45
[ "Apache-2.0" ]
489
2015-01-01T12:33:06.000Z
2022-03-17T22:01:13.000Z
src/main/java/org/joda/money/format/AmountPrinterParser.java
hegazy/joda-money
892ab01c7f63cfff267ba1fbc5ef097a7c01ce45
[ "Apache-2.0" ]
53
2015-03-30T08:05:49.000Z
2022-03-28T21:29:27.000Z
src/main/java/org/joda/money/format/AmountPrinterParser.java
hegazy/joda-money
892ab01c7f63cfff267ba1fbc5ef097a7c01ce45
[ "Apache-2.0" ]
110
2015-01-17T00:33:59.000Z
2022-03-12T13:17:15.000Z
40.342391
109
0.542503
1,000,641
/* * Copyright 2009-present, Stephen Colebourne * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.joda.money.format; import java.io.IOException; import java.io.Serializable; import java.math.BigDecimal; import org.joda.money.BigMoney; /** * Prints and parses the amount part of the money. * <p> * This class is immutable and thread-safe. */ final class AmountPrinterParser implements MoneyPrinter, MoneyParser, Serializable { /** Serialization version. */ private static final long serialVersionUID = 1L; /** The style to use. */ private final MoneyAmountStyle style; /** * Constructor. * @param style the style, not null */ AmountPrinterParser(MoneyAmountStyle style) { this.style = style; } //----------------------------------------------------------------------- @Override public void print(MoneyPrintContext context, Appendable appendable, BigMoney money) throws IOException { MoneyAmountStyle activeStyle = style.localize(context.getLocale()); if (money.isNegative()) { money = money.negated(); if (!activeStyle.isAbsValue()) { appendable.append(activeStyle.getNegativeSignCharacter()); } } String str = money.getAmount().toPlainString(); char zeroChar = activeStyle.getZeroCharacter(); if (zeroChar != '0') { int diff = zeroChar - '0'; StringBuilder zeroConvert = new StringBuilder(str); for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); if (ch >= '0' && ch <= '9') { zeroConvert.setCharAt(i, (char) (ch + diff)); } } str = zeroConvert.toString(); } final int decPoint = str.indexOf('.'); final int afterDecPoint = decPoint + 1; if (activeStyle.getGroupingStyle() == GroupingStyle.NONE) { if (decPoint < 0) { appendable.append(str); if (activeStyle.isForcedDecimalPoint()) { appendable.append(activeStyle.getDecimalPointCharacter()); } } else { appendable.append(str.subSequence(0, decPoint)) .append(activeStyle.getDecimalPointCharacter()).append(str.substring(afterDecPoint)); } } else { int groupingSize = activeStyle.getGroupingSize(); int extendedGroupingSize = activeStyle.getExtendedGroupingSize(); extendedGroupingSize = extendedGroupingSize == 0 ? groupingSize : extendedGroupingSize; char groupingChar = activeStyle.getGroupingCharacter(); int pre = (decPoint < 0 ? str.length() : decPoint); int post = (decPoint < 0 ? 0 : str.length() - decPoint - 1); appendable.append(str.charAt(0)); for (int i = 1; i < pre; i++) { if (isPreGroupingPoint(pre - i, groupingSize, extendedGroupingSize)) { appendable.append(groupingChar); } appendable.append(str.charAt(i)); } if (decPoint >= 0 || activeStyle.isForcedDecimalPoint()) { appendable.append(activeStyle.getDecimalPointCharacter()); } if (activeStyle.getGroupingStyle() == GroupingStyle.BEFORE_DECIMAL_POINT) { if (decPoint >= 0) { appendable.append(str.substring(afterDecPoint)); } } else { for (int i = 0; i < post; i++) { appendable.append(str.charAt(i + afterDecPoint)); if (isPostGroupingPoint(i, post, groupingSize, extendedGroupingSize)) { appendable.append(groupingChar); } } } } } private boolean isPreGroupingPoint(int remaining, int groupingSize, int extendedGroupingSize) { if (remaining >= groupingSize + extendedGroupingSize) { return (remaining - groupingSize) % extendedGroupingSize == 0; } return remaining % groupingSize == 0; } private boolean isPostGroupingPoint(int i, int post, int groupingSize, int extendedGroupingSize) { boolean atEnd = (i + 1) >= post; if (i > groupingSize) { return (i - groupingSize) % extendedGroupingSize == (extendedGroupingSize - 1) && !atEnd; } return i % groupingSize == (groupingSize - 1) && !atEnd; } @Override public void parse(MoneyParseContext context) { final int len = context.getTextLength(); final MoneyAmountStyle activeStyle = style.localize(context.getLocale()); char[] buf = new char[len - context.getIndex()]; int bufPos = 0; boolean dpSeen = false; int pos = context.getIndex(); if (pos < len) { char ch = context.getText().charAt(pos++); if (ch == activeStyle.getNegativeSignCharacter()) { buf[bufPos++] = '-'; } else if (ch == activeStyle.getPositiveSignCharacter()) { buf[bufPos++] = '+'; } else if (ch >= activeStyle.getZeroCharacter() && ch < activeStyle.getZeroCharacter() + 10) { buf[bufPos++] = (char) ('0' + ch - activeStyle.getZeroCharacter()); } else if (ch == activeStyle.getDecimalPointCharacter()) { buf[bufPos++] = '.'; dpSeen = true; } else { context.setError(); return; } } boolean lastWasGroup = false; for ( ; pos < len; pos++) { char ch = context.getText().charAt(pos); if (ch >= activeStyle.getZeroCharacter() && ch < activeStyle.getZeroCharacter() + 10) { buf[bufPos++] = (char) ('0' + ch - activeStyle.getZeroCharacter()); lastWasGroup = false; } else if (ch == activeStyle.getDecimalPointCharacter() && dpSeen == false) { buf[bufPos++] = '.'; dpSeen = true; lastWasGroup = false; } else if (ch == activeStyle.getGroupingCharacter() && lastWasGroup == false) { lastWasGroup = true; } else { break; } } if (lastWasGroup) { pos--; } try { context.setAmount(new BigDecimal(buf, 0, bufPos)); context.setIndex(pos); } catch (NumberFormatException ex) { context.setError(); } } @Override public String toString() { return "${amount}"; } }
923e29d553b19edefc5932a327341c87b20b2fe4
921
java
Java
ootb-jfx-common/src/main/java/org/fenxui/ootb/jfx/widget/util/CurrencyNumberParseStrategy.java
benfarnold/fenxui
882b1b11c102a2e03694c609a869314287ba18d0
[ "Apache-2.0" ]
null
null
null
ootb-jfx-common/src/main/java/org/fenxui/ootb/jfx/widget/util/CurrencyNumberParseStrategy.java
benfarnold/fenxui
882b1b11c102a2e03694c609a869314287ba18d0
[ "Apache-2.0" ]
1
2019-01-23T02:10:16.000Z
2019-01-23T02:10:16.000Z
ootb-jfx-common/src/main/java/org/fenxui/ootb/jfx/widget/util/CurrencyNumberParseStrategy.java
benfarnold/fenxui
882b1b11c102a2e03694c609a869314287ba18d0
[ "Apache-2.0" ]
null
null
null
28.78125
115
0.777416
1,000,642
package org.fenxui.ootb.jfx.widget.util; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Currency; import java.util.Locale; public class CurrencyNumberParseStrategy extends AbstractLocaleNumberParseStrategy implements NumberParseStrategy { public CurrencyNumberParseStrategy(Locale locale) { super(locale, (DecimalFormat) NumberFormat.getCurrencyInstance(locale), true); Currency currency = getFormatter().getCurrency(); symbol = currency.getSymbol(); } public CurrencyNumberParseStrategy() { this(Locale.getDefault()); } @Override public boolean validateTrailing(DecimalFormat formatter, String text, int decimalSeparatorIndex) { if (decimalSeparatorIndex != -1) { int trailingLength = text.substring(decimalSeparatorIndex + 1).length(); if (trailingLength > formatter.getCurrency().getDefaultFractionDigits()) { return false; } } return true; } }
923e2ba09923c5072bddcd5e79f76270c04888bf
3,472
java
Java
src/main/java/com/ssrs/controller/StudentController.java
chenxiangzZ/Quella
9cab78939a07e49bda7e9984e6723f71c091ac9b
[ "Apache-2.0" ]
null
null
null
src/main/java/com/ssrs/controller/StudentController.java
chenxiangzZ/Quella
9cab78939a07e49bda7e9984e6723f71c091ac9b
[ "Apache-2.0" ]
3
2020-03-04T22:43:39.000Z
2021-09-20T20:52:18.000Z
src/main/java/com/ssrs/controller/StudentController.java
chenxiangzZ/Quella
9cab78939a07e49bda7e9984e6723f71c091ac9b
[ "Apache-2.0" ]
null
null
null
32.148148
149
0.698733
1,000,643
package com.ssrs.controller; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.plugins.Page; import com.ssrs.core.manager.PageManager; import com.ssrs.model.Student; import com.ssrs.service.IStudentService; import com.ssrs.util.commom.APPUtil; import com.ssrs.util.commom.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; /** * <p> * 学生信息表 前端控制器 * </p> * * @author ssrs * @since 2019-09-20 */ @Controller @RequestMapping("/student") public class StudentController { @Autowired private IStudentService studentService; /** * 接收 /student/index GET 请求 * 跳转到 /webapp/WEB-INF/ftl/student/index.ftl 页面 * @return * */ @RequestMapping(value = "index" ,method = RequestMethod.GET) public String index(){ return "student/index"; //第1个 } /** * 接收 /student/goAdd GET 请求 * 跳转到 /webapp/WEB-INF/ftl/student/add.ftl 页面 * @return */ @RequestMapping(value = "goAdd" ,method = RequestMethod.GET) public String goAdd(){ return "student/add"; // add 第一个 } /** * 接收 /student/add POST 请求 * 加上 @ResponseBody 就代表返回JSON数据 * 不加 就是返回视图页面 * @return */ @RequestMapping(value = "add" ,method = RequestMethod.POST) @ResponseBody public Object add(Student student){ boolean b = studentService.insert(student); //如果添加成功,就放回{status:200,message:'添加成功'}的JSON格式类型数据给前台 否则就返回{status:101,message:'添加失败'} return b? APPUtil.resultMapType(APPUtil.INSERT_SUCCESS_TYPE):APPUtil.resultMapType(APPUtil.INSERT_ERROR_TYPE); } //index时,表格渲染加载此处 @RequestMapping(value = "getStudentPage" ,method = RequestMethod.POST) @ResponseBody public Object getStudentPage(int page,int limit,String search){ boolean isSearch = false; if (StringUtils.isNotBlank(search)){ isSearch = true; } //简单分页查询 page当前页 limit 分页大小 Page<Student> studentPage = studentService.selectPage(new Page<>(page, limit),new EntityWrapper<Student>().like(isSearch,"stu_name",search)); return PageManager.buildPage(studentPage); //返回的是一个Map,(Code、MSG、Count、Data) } @RequestMapping(value = "goUpdate" ,method = RequestMethod.GET) public String goUpdate(long id, Model model){ Student student = studentService.selectById(id); model.addAttribute("stu",student); //底层原理:使用request.setAttribute()方法 System.out.println("student:"+student); return "student/update"; //返回视图 } @RequestMapping(value = "update" ,method = RequestMethod.POST) @ResponseBody public Object update(Student student){ boolean b = studentService.updateById(student); return b?APPUtil.resultMapType(APPUtil.UPDATE_SUCCESS_TYPE):APPUtil.resultMapType(APPUtil.UPDATE_ERROR_TYPE); } @RequestMapping(value = "del" ,method = RequestMethod.POST) @ResponseBody public Object update(long id){ boolean b = studentService.deleteById(id); return b?APPUtil.resultMapType(APPUtil.DELEATE_SUCCESS_TYPE):APPUtil.resultMapType(APPUtil.DELEATE_ERROR_TYPE); } }
923e2c768a333defc37f5a1d828596cc71a5972c
289
java
Java
myglide/src/main/java/com/example/myglide/callback/JobCallback.java
rain9155/P2P
99fe4050b730f1e49bcae7ee90ad64ca6832ab99
[ "Apache-2.0" ]
38
2019-07-14T08:48:30.000Z
2022-03-27T02:39:58.000Z
myglide/src/main/java/com/example/myglide/callback/JobCallback.java
CNLih/P2P
99fe4050b730f1e49bcae7ee90ad64ca6832ab99
[ "Apache-2.0" ]
2
2020-05-25T02:26:46.000Z
2021-06-18T18:57:13.000Z
myglide/src/main/java/com/example/myglide/callback/JobCallback.java
CNLih/P2P
99fe4050b730f1e49bcae7ee90ad64ca6832ab99
[ "Apache-2.0" ]
14
2019-07-14T10:00:35.000Z
2022-01-27T05:47:47.000Z
18.0625
69
0.743945
1,000,644
package com.example.myglide.callback; import android.graphics.Bitmap; import com.example.myglide.cache.Key; /** * Created by 陈健宇 at 2019/11/7 */ public interface JobCallback { void onJobComplete(Key key, Bitmap bitmap, boolean isSkipMemory); void onJobCancelled(Key key); }
923e2d427347614741b3d2130c31a153dd345adb
1,543
java
Java
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/UserDto.java
wq243750083/demo
38262e06b2d9178bd07899a6b55dcb54d20f5281
[ "Apache-2.0" ]
19,233
2018-12-22T10:38:33.000Z
2022-03-31T15:05:18.000Z
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/UserDto.java
wangyanming131/eladmin
5e272b0830b1986544c54168f1383d599ba56c56
[ "Apache-2.0" ]
627
2018-12-24T03:33:30.000Z
2022-03-16T02:19:48.000Z
eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/UserDto.java
wangyanming131/eladmin
5e272b0830b1986544c54168f1383d599ba56c56
[ "Apache-2.0" ]
7,257
2018-12-24T05:47:21.000Z
2022-03-30T06:09:31.000Z
22.691176
76
0.727803
1,000,645
/* * Copyright 2019-2020 Zheng Jie * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package me.zhengjie.modules.system.service.dto; import com.alibaba.fastjson.annotation.JSONField; import lombok.Getter; import lombok.Setter; import me.zhengjie.base.BaseDTO; import java.io.Serializable; import java.util.Date; import java.util.Set; /** * @author Zheng Jie * @date 2018-11-23 */ @Getter @Setter public class UserDto extends BaseDTO implements Serializable { private Long id; private Set<RoleSmallDto> roles; private Set<JobSmallDto> jobs; private DeptSmallDto dept; private Long deptId; private String username; private String nickName; private String email; private String phone; private String gender; private String avatarName; private String avatarPath; @JSONField(serialize = false) private String password; private Boolean enabled; @JSONField(serialize = false) private Boolean isAdmin = false; private Date pwdResetTime; }
923e2d6e7c73e838b0ab0e543cf90b50fdb2b6a5
1,793
java
Java
src/test/java/com/comsysto/ui/testing/advanced/pages/TimeSavingPage.java
comsysto/ui-testing-example
2da3ae99960523e7fdc73abe80ffada3f6ea6af8
[ "MIT" ]
null
null
null
src/test/java/com/comsysto/ui/testing/advanced/pages/TimeSavingPage.java
comsysto/ui-testing-example
2da3ae99960523e7fdc73abe80ffada3f6ea6af8
[ "MIT" ]
null
null
null
src/test/java/com/comsysto/ui/testing/advanced/pages/TimeSavingPage.java
comsysto/ui-testing-example
2da3ae99960523e7fdc73abe80ffada3f6ea6af8
[ "MIT" ]
1
2020-09-24T09:24:16.000Z
2020-09-24T09:24:16.000Z
32.6
113
0.672616
1,000,646
package com.comsysto.ui.testing.advanced.pages; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.testng.Assert; public class TimeSavingPage { private final WebDriver webDriver; private final String baseUrl; public TimeSavingPage(WebDriver webDriver, String baseUrl) { this.webDriver = webDriver; this.baseUrl = baseUrl; } public TimeSavingPage open() { webDriver.get(baseUrl); return this; } public TimeSavingPage openWithSlowmotion(int seconds) { webDriver.get(baseUrl + "?slowmotion=" + seconds); return this; } public TimeSavingPage enterTimePerUser(int timePerUser) { final WebElement element = webDriver.findElement(By.xpath("//input[@data-description='time-per-user']")); element.clear(); element.sendKeys(String.valueOf(timePerUser)); return this; } public TimeSavingPage enterAmountUsers(int amountUsers) { final WebElement element = webDriver.findElement(By.xpath("//input[@data-description='amount-users']")); element.clear(); element.sendKeys(String.valueOf(amountUsers)); return this; } public TimeSavingPage clickCalculate() { webDriver.findElement(By.xpath("//input[@data-description='calculate']")).click(); return this; } public TimeSavingPage assertResult(int secondsPerDay, int secondsPerYear) { final String result = webDriver.findElement(By.xpath("//*[@data-description='results']")).getText(); Assert.assertEquals(result, "Wow!\nYou save the world " + secondsPerDay + " seconds each day!\n" + "That's " + secondsPerYear + " seconds a year!"); return this; } }
923e2d9204a3d073d408e669fae571146ec65b34
247
java
Java
src/main/java/br/com/cartorio/models/Sexo.java
iranalyf/IntranetCartorio
590274e38940f8e919aa6a7eaf39d8201f0d2adf
[ "Apache-2.0" ]
null
null
null
src/main/java/br/com/cartorio/models/Sexo.java
iranalyf/IntranetCartorio
590274e38940f8e919aa6a7eaf39d8201f0d2adf
[ "Apache-2.0" ]
null
null
null
src/main/java/br/com/cartorio/models/Sexo.java
iranalyf/IntranetCartorio
590274e38940f8e919aa6a7eaf39d8201f0d2adf
[ "Apache-2.0" ]
null
null
null
13.722222
46
0.712551
1,000,647
package br.com.cartorio.models; public enum Sexo { MASCULINO("Masculino"), FEMININO("Feminino"); private String descricao; Sexo(String descricao) { this.descricao = descricao; } public String getDescricao() { return descricao; } }
923e2da83603fb25eb0f894ccc5d45183c9bb29a
1,164
java
Java
src/main/java/tree/ReturnStatementNode.java
zachtjones/Java-Compiler
0a4fe5760181ff91b660cd718b36e99d878adc4e
[ "Apache-2.0" ]
6
2018-05-01T17:10:40.000Z
2021-05-24T00:53:45.000Z
src/main/java/tree/ReturnStatementNode.java
zachtjones/Java-Compiler
0a4fe5760181ff91b660cd718b36e99d878adc4e
[ "Apache-2.0" ]
39
2018-09-11T02:36:57.000Z
2019-05-27T05:01:56.000Z
src/main/java/tree/ReturnStatementNode.java
zachtjones/Java-Compiler
0a4fe5760181ff91b660cd718b36e99d878adc4e
[ "Apache-2.0" ]
1
2020-10-31T10:09:00.000Z
2020-10-31T10:09:00.000Z
31.459459
96
0.762887
1,000,648
package tree; import helper.ClassLookup; import helper.CompileException; import intermediate.InterFunction; import intermediate.ReturnRegStatement; import intermediate.ReturnVoidStatement; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class ReturnStatementNode extends NodeImpl implements StatementNode { // could be null @Nullable private final Expression expression; public ReturnStatementNode(String fileName, int line, @Nullable Expression expression) { super(fileName, line); this.expression = expression; } @Override public void resolveImports(@NotNull ClassLookup c) throws CompileException { if (expression != null) expression.resolveImports(c); } @Override public void compile(@NotNull SymbolTable s, @NotNull InterFunction f) throws CompileException { // compile in the expression if (expression != null) { expression.compile(s, f); f.addStatement(new ReturnRegStatement(f.allocator.getLast(), getFileName(), getLine())); } else { // just compile in the return statement. f.addStatement(new ReturnVoidStatement(getFileName(), getLine())); } } }
923e2df18e8d83bc66511a683e2251a54fc1b341
1,303
java
Java
proFL-plugin-2.0.3/org/netbeans/lib/cvsclient/command/checkout/ModuleListInformation.java
ycj123/Research-Project
08296e0075ba0c13204944b1bc1a96a7b8d2f023
[ "MIT" ]
null
null
null
proFL-plugin-2.0.3/org/netbeans/lib/cvsclient/command/checkout/ModuleListInformation.java
ycj123/Research-Project
08296e0075ba0c13204944b1bc1a96a7b8d2f023
[ "MIT" ]
null
null
null
proFL-plugin-2.0.3/org/netbeans/lib/cvsclient/command/checkout/ModuleListInformation.java
ycj123/Research-Project
08296e0075ba0c13204944b1bc1a96a7b8d2f023
[ "MIT" ]
null
null
null
21.716667
60
0.618573
1,000,649
// // Decompiled by Procyon v0.5.36 // package org.netbeans.lib.cvsclient.command.checkout; import java.io.File; import org.netbeans.lib.cvsclient.command.FileInfoContainer; public class ModuleListInformation extends FileInfoContainer { private String moduleName; private String moduleStatus; private final StringBuffer paths; private String type; public ModuleListInformation() { this.paths = new StringBuffer(); } public String getModuleName() { return this.moduleName; } public void setModuleName(final String moduleName) { this.moduleName = moduleName; } public String getModuleStatus() { return this.moduleStatus; } public void setModuleStatus(final String moduleStatus) { this.moduleStatus = moduleStatus; } public String getPaths() { return this.paths.toString(); } public void addPath(final String str) { if (this.paths.length() > 0) { this.paths.append(' '); } this.paths.append(str); } public File getFile() { return null; } public String getType() { return this.type; } public void setType(final String type) { this.type = type; } }
923e2e230ce59ee018313cbde6041e3cb277efc0
519
java
Java
cmsc123/mp03/framework/ds/LinkList.java
Kriztoper/cmsc123mp03
1b6b098a782e3bbfc419b392937e66268341127e
[ "MIT" ]
null
null
null
cmsc123/mp03/framework/ds/LinkList.java
Kriztoper/cmsc123mp03
1b6b098a782e3bbfc419b392937e66268341127e
[ "MIT" ]
null
null
null
cmsc123/mp03/framework/ds/LinkList.java
Kriztoper/cmsc123mp03
1b6b098a782e3bbfc419b392937e66268341127e
[ "MIT" ]
null
null
null
16.21875
41
0.518304
1,000,650
package cmsc123.mp03.framework.ds; public class LinkList<E> { public Link<E> first; private int size; public LinkList(Link<E> first) { setSize(first == null ? 0 : 1); this.first = first; } public Link<E> getFirst() { return first; } public void setFirst(Link<E> first) { this.first = first; } public int getSize() { return size; } public void setSize(int size) { this.size = size; } }
923e2e45c7eaf169705e8ceb783ec46ae07645df
1,058
java
Java
src/java/generator/Visualizer.java
Katharsas/Neroxis-Map-Generator
54968ec5b122a7177ba4e294529a963a63e7baa0
[ "MIT" ]
null
null
null
src/java/generator/Visualizer.java
Katharsas/Neroxis-Map-Generator
54968ec5b122a7177ba4e294529a963a63e7baa0
[ "MIT" ]
null
null
null
src/java/generator/Visualizer.java
Katharsas/Neroxis-Map-Generator
54968ec5b122a7177ba4e294529a963a63e7baa0
[ "MIT" ]
null
null
null
27.128205
101
0.601134
1,000,651
package generator; import map.SCMap; import javax.swing.*; import java.awt.*; import java.util.ArrayList; //Yes, that's swing. Get over it. public strictfp class Visualizer extends JPanel { private final JFrame frame; private final ArrayList<SCMap> maps; public Visualizer() { frame = new JFrame("NeroxisGen"); maps = new ArrayList<>(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setUndecorated(true); frame.setResizable(false); frame.add(this); frame.setVisible(true); } public void addMap(SCMap map) { maps.add(map); frame.setBounds(0, 0, maps.size() * (map.getSize() / 2 + 16), map.getSize() / 2 + 16); frame.repaint(); } protected void paintComponent(Graphics graphics) { Graphics2D g = (Graphics2D) graphics; for (int i = 0; i < maps.size(); i++) { g.drawImage(maps.get(i).getPreview(), i * (maps.get(i).getSize() / 2 + 16) + 8, 8, null); g.setColor(Color.BLUE); } } }
923e2e4dbf255862fd421d240c0d008ab3d7d25e
701
java
Java
src/main/java/org/apiman/client/domain/role/Role.java
ravi-choudhari/apiman-client
a955d73fd4bc3d0b46bebde10f85e66c328db8fc
[ "Apache-2.0" ]
1
2019-03-23T19:18:58.000Z
2019-03-23T19:18:58.000Z
src/main/java/org/apiman/client/domain/role/Role.java
ravi-choudhari/apiman-client
a955d73fd4bc3d0b46bebde10f85e66c328db8fc
[ "Apache-2.0" ]
5
2020-03-04T21:46:03.000Z
2021-12-09T19:55:21.000Z
src/main/java/org/apiman/client/domain/role/Role.java
ravi-choudhari/apiman-client
a955d73fd4bc3d0b46bebde10f85e66c328db8fc
[ "Apache-2.0" ]
null
null
null
23.366667
60
0.764622
1,000,652
package org.apiman.client.domain.role; import java.io.Serializable; import java.util.Date; import java.util.Set; import org.apiman.client.domain.permissions.PermissionType; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.ToString; @Data @NoArgsConstructor @AllArgsConstructor @ToString @EqualsAndHashCode public class Role implements Serializable { private String id; private String name; private String description; private String createdBy; private Date createdOn; private Boolean autoGrant = Boolean.FALSE; private Set<PermissionType> permissions; }
923e2efd64d5f85071468cf0642efae26f629781
2,480
java
Java
src/main/java/thaumicenergistics/network/packets/PacketAssemblerGUIUpdate.java
Chaoschaot232/ThaumicEnergistics
c445b4ec8893222c68e0b8a93dee9b4e7909f58b
[ "MIT" ]
null
null
null
src/main/java/thaumicenergistics/network/packets/PacketAssemblerGUIUpdate.java
Chaoschaot232/ThaumicEnergistics
c445b4ec8893222c68e0b8a93dee9b4e7909f58b
[ "MIT" ]
null
null
null
src/main/java/thaumicenergistics/network/packets/PacketAssemblerGUIUpdate.java
Chaoschaot232/ThaumicEnergistics
c445b4ec8893222c68e0b8a93dee9b4e7909f58b
[ "MIT" ]
null
null
null
35.428571
96
0.672984
1,000,653
package thaumicenergistics.network.packets; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.common.network.ByteBufUtils; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import thaumicenergistics.tile.TileArcaneAssembler; import java.util.HashMap; /** * @author Alex811 */ public class PacketAssemblerGUIUpdate implements IMessage { public HashMap<String, Boolean> aspectExists = new HashMap<>(); public boolean hasEnoughVis; public BlockPos TEPos; public PacketAssemblerGUIUpdate() { } public PacketAssemblerGUIUpdate(TileArcaneAssembler TE) { this.aspectExists = TE.getAspectExists(); this.hasEnoughVis = TE.getHasEnoughVis(); this.TEPos = TE.getPos(); } @Override public void fromBytes(ByteBuf buf) { this.TEPos = new BlockPos(buf.readInt(), buf.readInt(), buf.readInt()); this.hasEnoughVis = buf.readBoolean(); int size = buf.readInt(); for (int i = 0; i < size; i++) this.aspectExists.put(ByteBufUtils.readUTF8String(buf), buf.readBoolean()); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(this.TEPos.getX()); buf.writeInt(this.TEPos.getY()); buf.writeInt(this.TEPos.getZ()); buf.writeBoolean(this.hasEnoughVis); buf.writeInt(this.aspectExists.size()); this.aspectExists.forEach((k, v) -> { ByteBufUtils.writeUTF8String(buf, k); buf.writeBoolean(v); }); } public static class Handler implements IMessageHandler<PacketAssemblerGUIUpdate, IMessage> { @Override public IMessage onMessage(PacketAssemblerGUIUpdate message, MessageContext ctx) { Minecraft.getMinecraft().addScheduledTask(() -> { TileEntity TE = Minecraft.getMinecraft().world.getTileEntity(message.TEPos); if(TE instanceof TileArcaneAssembler){ TileArcaneAssembler AATE = ((TileArcaneAssembler) TE); AATE.setAspectExists(message.aspectExists); AATE.setHasEnoughVis(message.hasEnoughVis); } }); return null; } } }
923e2f4dbfd2d94943b04841dc8e53f9c169ea42
132
java
Java
register/register-zookeeper/src/main/java/net/jahhan/zookeeper/ChildNodeListener.java
nince-wyj/jahhan
9ee33e3b6380fdf516b0b88ceae43f3c67e87c15
[ "Apache-2.0" ]
11
2017-11-24T09:16:41.000Z
2020-08-10T14:37:12.000Z
register/register-zookeeper/src/main/java/net/jahhan/zookeeper/ChildNodeListener.java
nince-wyj/jahhan
9ee33e3b6380fdf516b0b88ceae43f3c67e87c15
[ "Apache-2.0" ]
31
2020-03-04T21:53:37.000Z
2022-02-01T00:57:24.000Z
register/register-zookeeper/src/main/java/net/jahhan/zookeeper/ChildNodeListener.java
nince-wyj/jahhan
9ee33e3b6380fdf516b0b88ceae43f3c67e87c15
[ "Apache-2.0" ]
8
2016-12-24T23:15:44.000Z
2020-08-27T06:36:15.000Z
16.5
59
0.787879
1,000,654
package net.jahhan.zookeeper; public interface ChildNodeListener { void childChanged(String path, String type, String value); }
923e2fc6b8e809994d167cf326efab9a8003baf9
9,378
java
Java
src/main/java/com/amazonservices/mws/merchantfulfillment/_2015_06_01/model/ShippingServiceOptions.java
ChunMengLu/amazon-mws
8d1ed211c4be0d37c189709954c6c6f4a711ca6a
[ "Apache-2.0" ]
1
2021-04-16T09:10:24.000Z
2021-04-16T09:10:24.000Z
src/main/java/com/amazonservices/mws/merchantfulfillment/_2015_06_01/model/ShippingServiceOptions.java
ChunMengLu/amazon-mws
8d1ed211c4be0d37c189709954c6c6f4a711ca6a
[ "Apache-2.0" ]
null
null
null
src/main/java/com/amazonservices/mws/merchantfulfillment/_2015_06_01/model/ShippingServiceOptions.java
ChunMengLu/amazon-mws
8d1ed211c4be0d37c189709954c6c6f4a711ca6a
[ "Apache-2.0" ]
2
2020-10-13T06:54:04.000Z
2021-06-02T10:50:46.000Z
28.944444
151
0.625187
1,000,656
/******************************************************************************* * Copyright 2009-2020 Amazon Services. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * * You may not use this file except in compliance with the License. * You may obtain a copy of the License at: http://aws.amazon.com/apache2.0 * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. ******************************************************************************* * Shipping Service Options * API Version: 2015-06-01 * Library Version: 2020-02-06 * Generated: Mon Mar 02 20:07:22 UTC 2020 */ package com.amazonservices.mws.merchantfulfillment._2015_06_01.model; import com.amazonservices.mws.client.AbstractMwsObject; import com.amazonservices.mws.client.MwsReader; import com.amazonservices.mws.client.MwsWriter; /** * ShippingServiceOptions complex type. * * XML schema: * * <pre> * &lt;complexType name="ShippingServiceOptions"&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element name="DeliveryExperience" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt; * &lt;element name="DeclaredValue" type="{https://mws.amazonservices.com/MerchantFulfillment/2015-06-01}CurrencyAmount" minOccurs="0"/&gt; * &lt;element name="CarrierWillPickUp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/&gt; * &lt;element name="CarrierWillPickUpOption" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt; * &lt;element name="LabelFormat" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> */ public class ShippingServiceOptions extends AbstractMwsObject { private String deliveryExperience; private CurrencyAmount declaredValue; private Boolean carrierWillPickUp; private String carrierWillPickUpOption; private String labelFormat; /** * Get the value of DeliveryExperience. * * @return The value of DeliveryExperience. */ public String getDeliveryExperience() { return deliveryExperience; } /** * Set the value of DeliveryExperience. * * @param deliveryExperience * The new value to set. */ public void setDeliveryExperience(String deliveryExperience) { this.deliveryExperience = deliveryExperience; } /** * Check to see if DeliveryExperience is set. * * @return true if DeliveryExperience is set. */ public boolean isSetDeliveryExperience() { return deliveryExperience != null; } /** * Set the value of DeliveryExperience, return this. * * @param deliveryExperience * The new value to set. * * @return This instance. */ public ShippingServiceOptions withDeliveryExperience(String deliveryExperience) { this.deliveryExperience = deliveryExperience; return this; } /** * Get the value of DeclaredValue. * * @return The value of DeclaredValue. */ public CurrencyAmount getDeclaredValue() { return declaredValue; } /** * Set the value of DeclaredValue. * * @param declaredValue * The new value to set. */ public void setDeclaredValue(CurrencyAmount declaredValue) { this.declaredValue = declaredValue; } /** * Check to see if DeclaredValue is set. * * @return true if DeclaredValue is set. */ public boolean isSetDeclaredValue() { return declaredValue != null; } /** * Set the value of DeclaredValue, return this. * * @param declaredValue * The new value to set. * * @return This instance. */ public ShippingServiceOptions withDeclaredValue(CurrencyAmount declaredValue) { this.declaredValue = declaredValue; return this; } /** * Check the value of CarrierWillPickUp. * * @return true if CarrierWillPickUp is set to true. */ public boolean isCarrierWillPickUp() { return carrierWillPickUp!=null && carrierWillPickUp.booleanValue(); } /** * Get the value of CarrierWillPickUp. * * @return The value of CarrierWillPickUp. */ public Boolean getCarrierWillPickUp() { return carrierWillPickUp; } /** * Set the value of CarrierWillPickUp. * * @param carrierWillPickUp * The new value to set. */ public void setCarrierWillPickUp(Boolean carrierWillPickUp) { this.carrierWillPickUp = carrierWillPickUp; } /** * Check to see if CarrierWillPickUp is set. * * @return true if CarrierWillPickUp is set. */ public boolean isSetCarrierWillPickUp() { return carrierWillPickUp != null; } /** * Set the value of CarrierWillPickUp, return this. * * @param carrierWillPickUp * The new value to set. * * @return This instance. */ public ShippingServiceOptions withCarrierWillPickUp(Boolean carrierWillPickUp) { this.carrierWillPickUp = carrierWillPickUp; return this; } /** * Get the value of CarrierWillPickUpOption. * * @return The value of CarrierWillPickUpOption. */ public String getCarrierWillPickUpOption() { return carrierWillPickUpOption; } /** * Set the value of CarrierWillPickUpOption. * * @param carrierWillPickUpOption * The new value to set. */ public void setCarrierWillPickUpOption(String carrierWillPickUpOption) { this.carrierWillPickUpOption = carrierWillPickUpOption; } /** * Check to see if CarrierWillPickUpOption is set. * * @return true if CarrierWillPickUpOption is set. */ public boolean isSetCarrierWillPickUpOption() { return carrierWillPickUpOption != null; } /** * Set the value of CarrierWillPickUpOption, return this. * * @param carrierWillPickUpOption * The new value to set. * * @return This instance. */ public ShippingServiceOptions withCarrierWillPickUpOption(String carrierWillPickUpOption) { this.carrierWillPickUpOption = carrierWillPickUpOption; return this; } /** * Get the value of LabelFormat. * * @return The value of LabelFormat. */ public String getLabelFormat() { return labelFormat; } /** * Set the value of LabelFormat. * * @param labelFormat * The new value to set. */ public void setLabelFormat(String labelFormat) { this.labelFormat = labelFormat; } /** * Check to see if LabelFormat is set. * * @return true if LabelFormat is set. */ public boolean isSetLabelFormat() { return labelFormat != null; } /** * Set the value of LabelFormat, return this. * * @param labelFormat * The new value to set. * * @return This instance. */ public ShippingServiceOptions withLabelFormat(String labelFormat) { this.labelFormat = labelFormat; return this; } /** * Read members from a MwsReader. * * @param r * The reader to read from. */ @Override public void readFragmentFrom(MwsReader r) { deliveryExperience = r.read("DeliveryExperience", String.class); declaredValue = r.read("DeclaredValue", CurrencyAmount.class); carrierWillPickUp = r.read("CarrierWillPickUp", Boolean.class); carrierWillPickUpOption = r.read("CarrierWillPickUpOption", String.class); labelFormat = r.read("LabelFormat", String.class); } /** * Write members to a MwsWriter. * * @param w * The writer to write to. */ @Override public void writeFragmentTo(MwsWriter w) { w.write("DeliveryExperience", deliveryExperience); w.write("DeclaredValue", declaredValue); w.write("CarrierWillPickUp", carrierWillPickUp); w.write("CarrierWillPickUpOption", carrierWillPickUpOption); w.write("LabelFormat", labelFormat); } /** * Write tag, xmlns and members to a MwsWriter. * * @param w * The Writer to write to. */ @Override public void writeTo(MwsWriter w) { w.write("https://mws.amazonservices.com/MerchantFulfillment/2015-06-01", "ShippingServiceOptions",this); } /** Legacy Value constructor. */ public ShippingServiceOptions(String deliveryExperience,CurrencyAmount declaredValue,boolean carrierWillPickUp) { this.deliveryExperience = deliveryExperience; this.declaredValue = declaredValue; this.carrierWillPickUp = carrierWillPickUp; } /** Default constructor. */ public ShippingServiceOptions() { super(); } }
923e30373c040696423aa9d7a6435a0c4ea5ede8
6,937
java
Java
src/main/java/com/evolveum/polygon/connector/msgraphapi/MSGraphConfiguration.java
artinsolutions/connector-microsoft-graph-api
1b696a72367835a89c96e92f66e842207bd10bfc
[ "Apache-2.0" ]
1
2019-11-25T15:06:28.000Z
2019-11-25T15:06:28.000Z
src/main/java/com/evolveum/polygon/connector/msgraphapi/MSGraphConfiguration.java
artinsolutions/connector-microsoft-graph-api
1b696a72367835a89c96e92f66e842207bd10bfc
[ "Apache-2.0" ]
null
null
null
src/main/java/com/evolveum/polygon/connector/msgraphapi/MSGraphConfiguration.java
artinsolutions/connector-microsoft-graph-api
1b696a72367835a89c96e92f66e842207bd10bfc
[ "Apache-2.0" ]
null
null
null
37.096257
238
0.703474
1,000,657
package com.evolveum.polygon.connector.msgraphapi; import org.identityconnectors.common.StringUtil; import org.identityconnectors.common.logging.Log; import org.identityconnectors.common.security.GuardedString; import org.identityconnectors.framework.common.exceptions.ConfigurationException; import org.identityconnectors.framework.spi.AbstractConfiguration; import org.identityconnectors.framework.spi.ConfigurationProperty; import org.identityconnectors.framework.spi.StatefulConfiguration; import java.net.InetSocketAddress; public class MSGraphConfiguration extends AbstractConfiguration implements StatefulConfiguration { private static final Log LOG = Log.getLog(MSGraphConfiguration.class); private String clientId; private GuardedString clientSecret = null; private String tenantId = null; private String proxyHost; private String proxyPort; // invites private boolean inviteGuests; private boolean sendInviteMail; private String inviteRedirectUrl; private String inviteMessage; @ConfigurationProperty(order = 10, displayMessageKey = "ClientId", helpMessageKey = "The Application ID that the 'Application Registration Portal' (apps.dev.microsoft.com) assigned to your app.", required = true) public String getClientId() { return clientId; } public void setClientId(String clientId) { this.clientId = clientId; } @ConfigurationProperty(order = 20, displayMessageKey = "ClientSecret", helpMessageKey = "The Application Secret that you generated for your app in the app registration portal.", required = true, confidential = true) public GuardedString getClientSecret() { return clientSecret; } public void setClientSecret(GuardedString clientSecret) { this.clientSecret = clientSecret; } @ConfigurationProperty(order = 30, displayMessageKey = "TenantId", helpMessageKey = "Allows only users with work/school accounts from a particular Azure Active Directory tenant" + " to sign into the application. Either the friendly domain name of the Azure AD tenant or the " + "tenant's guid identifier can be used. Example: '8eaef023-2b34-4da1-9baa-8bc8c9d6a490' or 'contoso.onmicrosoft.com'", required = true) public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } @ConfigurationProperty(order = 40, displayMessageKey = "ProxyHost", helpMessageKey = "Hostname of the HTTPS proxy to use to connect to cloud services. If used, ProxyPort needs to be configured as well.") public String getProxyHost() { return proxyHost; } public void setProxyHost(String proxyHost) throws ConfigurationException { this.proxyHost = proxyHost; } @ConfigurationProperty(order = 50, displayMessageKey = "ProxyPort", helpMessageKey = "Port number of the HTTPS proxy to use to connect to cloud services. For this setting to take any effect, ProxyHost needs to be configured as well.") public String getProxyPort() { return proxyPort; } public void setProxyPort(String proxyPort) { this.proxyPort = proxyPort; } @ConfigurationProperty(order = 60, displayMessageKey = "InviteGuests", helpMessageKey = "Whether to allow creation of guest accounts by inviting users from outside the tenant (based on e-mail address only)") public boolean isInviteGuests() { return inviteGuests; } public void setInviteGuests(boolean inviteGuests) { this.inviteGuests = inviteGuests; } @ConfigurationProperty(order = 70, displayMessageKey = "SendInviteMail", helpMessageKey = "Whether to send an email invitation to guest users.") public boolean isSendInviteMail() { return sendInviteMail; } public void setSendInviteMail(boolean sendInviteMail) { this.sendInviteMail = sendInviteMail; } @ConfigurationProperty(order = 80, displayMessageKey = "InviteRedirectURL", helpMessageKey = "Specify a URL that an invited user should be redirected to once he claims his invitation. Mandatory if 'InviteGuests' is true") public String getInviteRedirectUrl() { return inviteRedirectUrl; } public void setInviteRedirectUrl(String inviteRedirectUrl) { this.inviteRedirectUrl = inviteRedirectUrl; } @ConfigurationProperty(order = 90, displayMessageKey = "InviteMessage", helpMessageKey = "Custom message to send in an invite. Requires 'InviteRedirectURL'") public String getInviteMessage() { return inviteMessage; } public void setInviteMessage(String inviteMessage) { this.inviteMessage = inviteMessage; } @Override public void validate() { LOG.info("Processing trough configuration validation procedure."); if (StringUtil.isBlank(clientId)) { throw new ConfigurationException("Client Id cannot be empty."); } if ("".equals(clientSecret)) { throw new ConfigurationException("Client Secret cannot be empty."); } if (StringUtil.isBlank(tenantId)) { throw new ConfigurationException("Tenant Id cannot be empty."); } if (!StringUtil.isBlank(proxyHost)) { if (StringUtil.isBlank(proxyPort)) throw new ConfigurationException("Proxy host is configured, but proxy port is not"); final Integer proxyPortNo; try { proxyPortNo = Integer.parseInt(proxyPort); } catch (NumberFormatException nfe) { throw new ConfigurationException("Proxy port is not a valid number", nfe); } if (proxyPortNo <= 0) throw new ConfigurationException("Proxy port value must be positive"); } if (inviteGuests) { if (StringUtil.isBlank(inviteRedirectUrl)) throw new ConfigurationException("InviteRedirectUrl is mandatory when InviteGuests is enabled"); } else { if (StringUtil.isNotBlank(inviteRedirectUrl)) throw new ConfigurationException("InviteRedirectUrl is configured, but InviteGuests is disabled"); if (StringUtil.isNotBlank(inviteMessage)) throw new ConfigurationException("InviteMessage is configured, but InviteGuests is disabled"); } LOG.info("Configuration valid"); } @Override public void release() { LOG.info("The release of configuration resources is being performed"); this.clientId = null; this.clientSecret.dispose(); this.tenantId = null; } public boolean hasProxy() { return !(StringUtil.isBlank(proxyHost) || StringUtil.isBlank(proxyPort)); } public InetSocketAddress getProxyAddress() { return new InetSocketAddress(this.proxyHost, Integer.parseInt(this.proxyPort)); } }
923e309ad03e4a011b50d2170f169bbe959c37fe
1,873
java
Java
src/main/java/de/uni_mannheim/informatik/dws/searchjoin/data/MatchableTableRowFactory.java
EDAO-Project/SearchJoin
e479e2225c2c33e3e3cba11818a8afb8f0a87746
[ "Apache-2.0" ]
5
2017-09-16T16:35:38.000Z
2019-05-09T11:14:11.000Z
src/main/java/de/uni_mannheim/informatik/dws/searchjoin/data/MatchableTableRowFactory.java
EDAO-Project/SearchJoin
e479e2225c2c33e3e3cba11818a8afb8f0a87746
[ "Apache-2.0" ]
null
null
null
src/main/java/de/uni_mannheim/informatik/dws/searchjoin/data/MatchableTableRowFactory.java
EDAO-Project/SearchJoin
e479e2225c2c33e3e3cba11818a8afb8f0a87746
[ "Apache-2.0" ]
1
2020-11-09T14:04:59.000Z
2020-11-09T14:04:59.000Z
37.38
210
0.752809
1,000,658
/* * Copyright (c) 2017 Data and Web Science Group, University of Mannheim, Germany (http://dws.informatik.uni-mannheim.de/) * * 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 de.uni_mannheim.informatik.dws.searchjoin.data; import java.util.Collections; import java.util.LinkedList; import java.util.List; import org.apache.commons.lang3.StringUtils; import de.uni_mannheim.informatik.dws.winter.model.FusibleFactory; import de.uni_mannheim.informatik.dws.winter.model.RecordGroup; import de.uni_mannheim.informatik.dws.winter.utils.query.Q; /** * @author Oliver Lehmberg (envkt@example.com) * */ public class MatchableTableRowFactory implements FusibleFactory<MatchableTableRow, MatchableTableColumn> { /* (non-Javadoc) * @see de.uni_mannheim.informatik.dws.winter.model.FusableFactory#createInstanceForFusion(de.uni_mannheim.informatik.dws.winter.model.RecordGroup) */ @Override public MatchableTableRow createInstanceForFusion(RecordGroup<MatchableTableRow, MatchableTableColumn> cluster) { List<String> ids = new LinkedList<>(); for (MatchableTableRow m : cluster.getRecords()) { ids.add(m.getIdentifier()); } Collections.sort(ids); String mergedId = StringUtils.join(ids, '+'); return new MatchableTableRow(mergedId, Q.firstOrDefault(cluster.getRecords()).getSchema()); } }
923e309eac8d786c11b4ba55ccfe76c33de5e7f3
3,421
java
Java
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/DataFlowInfo.java
gong/incubator-inlong
ff27e05739f28b79f1ac2eda189db511f4b634a6
[ "Apache-2.0" ]
315
2020-01-03T10:17:09.000Z
2021-04-07T10:50:20.000Z
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/DataFlowInfo.java
gong/incubator-inlong
ff27e05739f28b79f1ac2eda189db511f4b634a6
[ "Apache-2.0" ]
2,372
2021-04-17T10:21:15.000Z
2022-03-31T13:10:46.000Z
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/DataFlowInfo.java
gong/incubator-inlong
ff27e05739f28b79f1ac2eda189db511f4b634a6
[ "Apache-2.0" ]
293
2020-01-03T10:26:25.000Z
2021-04-09T02:01:41.000Z
32.273585
93
0.691318
1,000,659
/* * 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.inlong.sort.protocol; import static com.google.common.base.Preconditions.checkNotNull; import java.io.Serializable; import java.util.HashMap; import java.util.Map; import java.util.Objects; import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator; import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonInclude; import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonInclude.Include; import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty; import org.apache.inlong.sort.protocol.sink.SinkInfo; import org.apache.inlong.sort.protocol.source.SourceInfo; /** * Data flow protocol. */ public class DataFlowInfo implements Serializable { private static final long serialVersionUID = 6549803844655330833L; private final long id; private final SourceInfo sourceInfo; private final SinkInfo sinkInfo; @JsonInclude(Include.NON_NULL) private final Map<String, Object> properties; @JsonCreator public DataFlowInfo( @JsonProperty("id") long id, @JsonProperty("source_info") SourceInfo sourceInfo, @JsonProperty("sink_info") SinkInfo sinkInfo, @JsonProperty("properties") Map<String, Object> properties) { this.id = id; this.sourceInfo = checkNotNull(sourceInfo); this.sinkInfo = checkNotNull(sinkInfo); this.properties = properties == null ? new HashMap<>() : properties; } public DataFlowInfo(long id, SourceInfo sourceInfo, SinkInfo sinkInfo) { this.id = id; this.sourceInfo = sourceInfo; this.sinkInfo = sinkInfo; this.properties = new HashMap<>(); } @JsonProperty("id") public long getId() { return id; } @JsonProperty("source_info") public SourceInfo getSourceInfo() { return sourceInfo; } @JsonProperty("sink_info") public SinkInfo getSinkInfo() { return sinkInfo; } @JsonProperty("properties") public Map<String, Object> getProperties() { return properties; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } DataFlowInfo other = (DataFlowInfo) o; return Objects.equals(id, other.id) && Objects.equals(sourceInfo, other.sourceInfo) && Objects.equals(sinkInfo, other.sinkInfo) && Objects.equals(properties, other.properties); } }
923e31965903fb856d94499db47edfcc19daacc6
708
java
Java
valor-spi/src/main/java/jp/co/cyberagent/valor/spi/serde/QuerySerializerWrapper.java
CyberAgent/valor
c8a4301cc6fcfaa59d5dda3072a32c3c4ddb6a65
[ "Apache-2.0" ]
null
null
null
valor-spi/src/main/java/jp/co/cyberagent/valor/spi/serde/QuerySerializerWrapper.java
CyberAgent/valor
c8a4301cc6fcfaa59d5dda3072a32c3c4ddb6a65
[ "Apache-2.0" ]
null
null
null
valor-spi/src/main/java/jp/co/cyberagent/valor/spi/serde/QuerySerializerWrapper.java
CyberAgent/valor
c8a4301cc6fcfaa59d5dda3072a32c3c4ddb6a65
[ "Apache-2.0" ]
1
2022-03-23T08:32:00.000Z
2022-03-23T08:32:00.000Z
29.5
79
0.793785
1,000,660
package jp.co.cyberagent.valor.spi.serde; import java.util.Collection; import java.util.List; import jp.co.cyberagent.valor.spi.plan.model.PrimitivePredicate; import jp.co.cyberagent.valor.spi.schema.FieldLayout; import jp.co.cyberagent.valor.spi.storage.StorageScan; public abstract class QuerySerializerWrapper implements QuerySerializer { protected final QuerySerializer wrapped; protected QuerySerializerWrapper(QuerySerializer serializer) { this.wrapped = serializer; } @Override public List<StorageScan> serailize( Collection<String> attribute, Collection<PrimitivePredicate> conjunction, List<FieldLayout> layouts) { throw new UnsupportedOperationException(); } }
923e31ad7ffc298513423532f0a2e80939dfed1e
5,474
java
Java
Skizzle/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/PlayerPackets1_14.java
14ms/Minecraft-Disclosed-Source-Modifications
d3729ab0fb20c36da1732b2070d1cb5d1409ffbc
[ "Unlicense" ]
3
2022-02-28T17:34:51.000Z
2022-03-06T21:55:16.000Z
Skizzle/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/PlayerPackets1_14.java
14ms/Minecraft-Disclosed-Source-Modifications
d3729ab0fb20c36da1732b2070d1cb5d1409ffbc
[ "Unlicense" ]
2
2022-02-25T20:10:14.000Z
2022-03-03T14:25:03.000Z
Skizzle/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/PlayerPackets1_14.java
14ms/Minecraft-Disclosed-Source-Modifications
d3729ab0fb20c36da1732b2070d1cb5d1409ffbc
[ "Unlicense" ]
null
null
null
41.78626
131
0.57563
1,000,661
/* * Decompiled with CFR 0.150. */ package nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.packets; import nl.matsv.viabackwards.api.rewriters.Rewriter; import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.Protocol1_13_2To1_14; import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.minecraft.Position; import us.myles.ViaVersion.api.remapper.PacketHandler; import us.myles.ViaVersion.api.remapper.PacketRemapper; import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13; import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14; public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> { public PlayerPackets1_14(Protocol1_13_2To1_14 protocol) { super(protocol); } @Override protected void registerPackets() { ((Protocol1_13_2To1_14)this.protocol).registerOutgoing(ClientboundPackets1_14.SERVER_DIFFICULTY, new PacketRemapper(){ @Override public void registerMap() { this.map(Type.UNSIGNED_BYTE); this.map(Type.BOOLEAN, Type.NOTHING); } }); ((Protocol1_13_2To1_14)this.protocol).registerOutgoing(ClientboundPackets1_14.OPEN_SIGN_EDITOR, new PacketRemapper(){ @Override public void registerMap() { this.map(Type.POSITION1_14, Type.POSITION); } }); ((Protocol1_13_2To1_14)this.protocol).registerIncoming(ServerboundPackets1_13.QUERY_BLOCK_NBT, new PacketRemapper(){ @Override public void registerMap() { this.map(Type.VAR_INT); this.map(Type.POSITION, Type.POSITION1_14); } }); ((Protocol1_13_2To1_14)this.protocol).registerIncoming(ServerboundPackets1_13.PLAYER_DIGGING, new PacketRemapper(){ @Override public void registerMap() { this.map(Type.VAR_INT); this.map(Type.POSITION, Type.POSITION1_14); this.map(Type.BYTE); } }); ((Protocol1_13_2To1_14)this.protocol).registerIncoming(ServerboundPackets1_13.RECIPE_BOOK_DATA, new PacketRemapper(){ @Override public void registerMap() { this.map(Type.VAR_INT); this.handler(new PacketHandler(){ @Override public void handle(PacketWrapper wrapper) throws Exception { int type = wrapper.get(Type.VAR_INT, 0); if (type == 0) { wrapper.passthrough(Type.STRING); } else if (type == 1) { wrapper.passthrough(Type.BOOLEAN); wrapper.passthrough(Type.BOOLEAN); wrapper.passthrough(Type.BOOLEAN); wrapper.passthrough(Type.BOOLEAN); wrapper.write(Type.BOOLEAN, false); wrapper.write(Type.BOOLEAN, false); wrapper.write(Type.BOOLEAN, false); wrapper.write(Type.BOOLEAN, false); } } }); } }); ((Protocol1_13_2To1_14)this.protocol).registerIncoming(ServerboundPackets1_13.UPDATE_COMMAND_BLOCK, new PacketRemapper(){ @Override public void registerMap() { this.map(Type.POSITION, Type.POSITION1_14); } }); ((Protocol1_13_2To1_14)this.protocol).registerIncoming(ServerboundPackets1_13.UPDATE_STRUCTURE_BLOCK, new PacketRemapper(){ @Override public void registerMap() { this.map(Type.POSITION, Type.POSITION1_14); } }); ((Protocol1_13_2To1_14)this.protocol).registerIncoming(ServerboundPackets1_13.UPDATE_SIGN, new PacketRemapper(){ @Override public void registerMap() { this.map(Type.POSITION, Type.POSITION1_14); } }); ((Protocol1_13_2To1_14)this.protocol).registerIncoming(ServerboundPackets1_13.PLAYER_BLOCK_PLACEMENT, new PacketRemapper(){ @Override public void registerMap() { this.handler(new PacketHandler(){ @Override public void handle(PacketWrapper wrapper) throws Exception { Position position = wrapper.read(Type.POSITION); int face = wrapper.read(Type.VAR_INT); int hand = wrapper.read(Type.VAR_INT); float x = wrapper.read(Type.FLOAT).floatValue(); float y = wrapper.read(Type.FLOAT).floatValue(); float z = wrapper.read(Type.FLOAT).floatValue(); wrapper.write(Type.VAR_INT, hand); wrapper.write(Type.POSITION1_14, position); wrapper.write(Type.VAR_INT, face); wrapper.write(Type.FLOAT, Float.valueOf(x)); wrapper.write(Type.FLOAT, Float.valueOf(y)); wrapper.write(Type.FLOAT, Float.valueOf(z)); wrapper.write(Type.BOOLEAN, false); } }); } }); } }
923e31dce0200da4ec8055a08e6b6619601a33ff
1,060
java
Java
webservice/src/main/java/com/excilys/cdb/config/RESTWebAppInitializer.java
vgambier/computer-database
a4d5259ce96b8bad835c9db3a5ab4a29b9ebe0b6
[ "Apache-2.0" ]
null
null
null
webservice/src/main/java/com/excilys/cdb/config/RESTWebAppInitializer.java
vgambier/computer-database
a4d5259ce96b8bad835c9db3a5ab4a29b9ebe0b6
[ "Apache-2.0" ]
null
null
null
webservice/src/main/java/com/excilys/cdb/config/RESTWebAppInitializer.java
vgambier/computer-database
a4d5259ce96b8bad835c9db3a5ab4a29b9ebe0b6
[ "Apache-2.0" ]
null
null
null
36.551724
100
0.772642
1,000,662
package com.excilys.cdb.config; import javax.servlet.ServletContext; import javax.servlet.ServletRegistration; import org.springframework.web.WebApplicationInitializer; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.servlet.DispatcherServlet; /** * @author Victor Gambier * * Configures the DispatcherServlet used in Spring MVC */ public class RESTWebAppInitializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext servletContext) { // Load Spring web application configuration AnnotationConfigWebApplicationContext ac = new AnnotationConfigWebApplicationContext(); ac.register(RESTWebConfig.class); // Create and register the DispatcherServlet DispatcherServlet servlet = new DispatcherServlet(ac); ServletRegistration.Dynamic registration = servletContext.addServlet("dispatcher", servlet); registration.setLoadOnStartup(1); registration.addMapping("/"); } }
923e32b74109b2412ac4f3d9deb061a02ede5865
658
java
Java
JavaProgram/src/ListDemo.java
wolfdale/Spaghetti-code
9e395345e1420b9db021b21131601191a869db1d
[ "MIT" ]
1
2018-05-18T16:07:11.000Z
2018-05-18T16:07:11.000Z
JavaProgram/src/ListDemo.java
wolfdale/Spaghetti-code
9e395345e1420b9db021b21131601191a869db1d
[ "MIT" ]
5
2015-12-03T16:12:38.000Z
2020-05-05T14:07:00.000Z
JavaProgram/src/ListDemo.java
wolfdale/Spaghetti-code
9e395345e1420b9db021b21131601191a869db1d
[ "MIT" ]
null
null
null
14.954545
48
0.586626
1,000,663
//LInked List import java.util.*; class ListDemo{ public static void main(String[] args){ String[] things = {"a","b","c"}; List<String> list1 = new LinkedList<String>(); for(String x : things) { list1.add(x); } String[] things_1 = {"e","f","g"}; List<String> list2 = new LinkedList<String>(); for(String x : things_1) { list2.add(x); } list1.addAll(list2); printer(list1); printer(list2); list2 = null; try{ printer(list2); } catch (NullPointerException e) { System.out.println(e); } } static void printer(List<String> lis) { for(String x : lis) { System.out.println(x); } } }
923e33b204a839341ef1045477da128e550249d7
1,786
java
Java
src/main/java/com/helger/fatturapa/FatturaPA120Marshaller.java
phax/ph-fatturapa
1104a64395f9d1e15255f69f15e12dbb72e10976
[ "Apache-2.0" ]
2
2020-12-07T14:29:14.000Z
2020-12-28T18:11:33.000Z
src/main/java/com/helger/fatturapa/FatturaPA120Marshaller.java
phax/ph-fatturapa
1104a64395f9d1e15255f69f15e12dbb72e10976
[ "Apache-2.0" ]
null
null
null
src/main/java/com/helger/fatturapa/FatturaPA120Marshaller.java
phax/ph-fatturapa
1104a64395f9d1e15255f69f15e12dbb72e10976
[ "Apache-2.0" ]
2
2021-11-19T18:11:28.000Z
2021-12-17T15:40:53.000Z
34.346154
99
0.763718
1,000,664
/* * Copyright (C) 2020-2021 Philip Helger (www.helger.com) * philip[at]helger[dot]com * * 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.helger.fatturapa; import javax.annotation.concurrent.NotThreadSafe; import com.helger.commons.collection.impl.ICommonsList; import com.helger.commons.io.resource.ClassPathResource; import com.helger.fatturapa.v120.FPA120FatturaElettronicaType; import com.helger.fatturapa.v120.ObjectFactory; import com.helger.jaxb.GenericJAXBMarshaller; /** * This is the reader and writer for fatturaPA 1.2 documents. This class may be * derived to override protected methods from {@link GenericJAXBMarshaller}. * * @author Philip Helger */ @NotThreadSafe public class FatturaPA120Marshaller extends GenericJAXBMarshaller <FPA120FatturaElettronicaType> { private static final ICommonsList <ClassPathResource> XSDS = CFatturaPA.getAllXSDFatturaPA120 (); public FatturaPA120Marshaller () { this (true); } public FatturaPA120Marshaller (final boolean bValidationEnabled) { super (FPA120FatturaElettronicaType.class, bValidationEnabled ? XSDS : null, o -> new ObjectFactory ().createFatturaElettronica (o)); setNamespaceContext (FatturaPA120NamespaceContext.getInstance ()); } }
923e34776bc405c7b6a8a325cce364cb66fb12bb
6,404
java
Java
source/src/main/java/com/julive/push/platform/mi/MIPushMessageReceiver.java
13120241790/Push_v3
bba36bbd8f9273945001614b4b62f8881d1a6b8a
[ "Apache-2.0" ]
null
null
null
source/src/main/java/com/julive/push/platform/mi/MIPushMessageReceiver.java
13120241790/Push_v3
bba36bbd8f9273945001614b4b62f8881d1a6b8a
[ "Apache-2.0" ]
null
null
null
source/src/main/java/com/julive/push/platform/mi/MIPushMessageReceiver.java
13120241790/Push_v3
bba36bbd8f9273945001614b4b62f8881d1a6b8a
[ "Apache-2.0" ]
1
2021-01-29T05:56:59.000Z
2021-01-29T05:56:59.000Z
43.564626
164
0.652405
1,000,665
package com.julive.push.platform.mi; import android.content.Context; import android.text.TextUtils; import android.util.Log; import com.julive.push.common.PushUtils; import com.julive.push.core.PushMessage; import com.julive.push.core.PushListenerProxy; import com.julive.push.core.PushType; import com.xiaomi.mipush.sdk.ErrorCode; import com.xiaomi.mipush.sdk.MiPushClient; import com.xiaomi.mipush.sdk.MiPushCommandMessage; import com.xiaomi.mipush.sdk.MiPushMessage; import com.xiaomi.mipush.sdk.PushMessageReceiver; import java.util.List; import static com.julive.push.common.PushConst.PUSH_LOG_ARRIVED; import static com.julive.push.common.PushConst.PUSH_LOG_CLICK; import static com.julive.push.common.PushConst.PUSH_TAG; public class MIPushMessageReceiver extends PushMessageReceiver { public static final String TAG = MIPushMessageReceiver.class.getSimpleName(); private String mRegId; private long mResultCode = -1; private String mReason; private String mCommand; private String mMessage; private String mTopic; private String mAlias; private String mUserAccount; private String mStartTime; private String mEndTime; //消息透传 @Override public void onReceivePassThroughMessage(Context context, MiPushMessage message) { mMessage = message.getContent(); Log.e("PushMessage", "onTransparentMessage : " + message.toString()); PushMessage pushMessage = new PushMessage(message.getTitle(), message.getDescription(), PushType.XIAOMI, message.getExtra().toString(), message.getExtra()); PushListenerProxy.onTransparentMessage(pushMessage); if (!TextUtils.isEmpty(message.getTopic())) { mTopic = message.getTopic(); } else if (!TextUtils.isEmpty(message.getAlias())) { mAlias = message.getAlias(); } else if (!TextUtils.isEmpty(message.getUserAccount())) { mUserAccount = message.getUserAccount(); } } //通知栏 @Override public void onNotificationMessageClicked(Context context, MiPushMessage message) { Log.e(PUSH_TAG, PUSH_LOG_CLICK + PushType.XIAOMI.getName()); Log.e("PushMessage", " click message string : " + message.toString()); mMessage = message.getContent(); PushMessage msg = new PushMessage(message.getTitle(), message.getDescription(), PushType.XIAOMI, message.getExtra().toString(), message.getExtra()); PushListenerProxy.onNotificationReceived(msg); PushUtils.onNotificationMessageOpened(context, msg); if (!TextUtils.isEmpty(message.getTopic())) { mTopic = message.getTopic(); } else if (!TextUtils.isEmpty(message.getAlias())) { mAlias = message.getAlias(); } else if (!TextUtils.isEmpty(message.getUserAccount())) { mUserAccount = message.getUserAccount(); } } //通知栏 @Override public void onNotificationMessageArrived(Context context, MiPushMessage message) { Log.e(PUSH_TAG, PUSH_LOG_ARRIVED + PushType.XIAOMI.getName()); Log.e("PushMessage", "arrived message string : " + message.toString()); mMessage = message.getContent(); PushMessage msg = new PushMessage(message.getTitle(), message.getDescription(), PushType.XIAOMI, message.getExtra().toString(), message.getExtra()); PushListenerProxy.onNotificationReceived(msg); PushUtils.onNotificationMessageArrived(context, msg); if (!TextUtils.isEmpty(message.getTopic())) { mTopic = message.getTopic(); } else if (!TextUtils.isEmpty(message.getAlias())) { mAlias = message.getAlias(); } else if (!TextUtils.isEmpty(message.getUserAccount())) { mUserAccount = message.getUserAccount(); } } @Override public void onCommandResult(Context context, MiPushCommandMessage message) { String command = message.getCommand(); List<String> arguments = message.getCommandArguments(); String cmdArg1 = ((arguments != null && arguments.size() > 0) ? arguments.get(0) : null); String cmdArg2 = ((arguments != null && arguments.size() > 1) ? arguments.get(1) : null); if (MiPushClient.COMMAND_REGISTER.equals(command)) { if (message.getResultCode() == ErrorCode.SUCCESS) { mRegId = cmdArg1; if (!TextUtils.isEmpty(mRegId)) { Log.e(PUSH_TAG, "register successful mi register id: " + mRegId); PushListenerProxy.onRegister(mRegId, PushType.XIAOMI); } } } else if (MiPushClient.COMMAND_SET_ALIAS.equals(command)) { if (message.getResultCode() == ErrorCode.SUCCESS) { mAlias = cmdArg1; } } else if (MiPushClient.COMMAND_UNSET_ALIAS.equals(command)) { if (message.getResultCode() == ErrorCode.SUCCESS) { mAlias = cmdArg1; } } else if (MiPushClient.COMMAND_SUBSCRIBE_TOPIC.equals(command)) { if (message.getResultCode() == ErrorCode.SUCCESS) { mTopic = cmdArg1; } } else if (MiPushClient.COMMAND_UNSUBSCRIBE_TOPIC.equals(command)) { if (message.getResultCode() == ErrorCode.SUCCESS) { mTopic = cmdArg1; } } else if (MiPushClient.COMMAND_SET_ACCEPT_TIME.equals(command)) { if (message.getResultCode() == ErrorCode.SUCCESS) { mStartTime = cmdArg1; mEndTime = cmdArg2; } } Log.e(TAG, "onCommandResult error :" + message.getResultCode()); } @Override public void onReceiveRegisterResult(Context context, MiPushCommandMessage message) { String command = message.getCommand(); List<String> arguments = message.getCommandArguments(); String cmdArg1 = ((arguments != null && arguments.size() > 0) ? arguments.get(0) : null); String cmdArg2 = ((arguments != null && arguments.size() > 1) ? arguments.get(1) : null); if (MiPushClient.COMMAND_REGISTER.equals(command)) { if (message.getResultCode() == ErrorCode.SUCCESS) { mRegId = cmdArg1; Log.e(TAG, "onReceiveRegisterResult regId :" + mRegId); } } Log.e(TAG, "onReceiveRegisterResult error :" + message.getResultCode()); } }
923e347d859121accda72dee57823974deadca83
341
java
Java
java/java-tests/testData/inspection/textBlockBackwardMigration/beforeMultipleStringLiterals.java
dunno99/intellij-community
aa656a5d874b947271b896b2105e4370827b9149
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
java/java-tests/testData/inspection/textBlockBackwardMigration/beforeMultipleStringLiterals.java
dunno99/intellij-community
aa656a5d874b947271b896b2105e4370827b9149
[ "Apache-2.0" ]
2
2022-02-19T09:45:05.000Z
2022-02-27T20:32:55.000Z
java/java-tests/testData/inspection/textBlockBackwardMigration/beforeMultipleStringLiterals.java
dunno99/intellij-community
aa656a5d874b947271b896b2105e4370827b9149
[ "Apache-2.0" ]
2
2020-03-15T08:57:37.000Z
2020-04-07T04:48:14.000Z
21.3125
51
0.513196
1,000,666
// "Replace with regular string literal" "true" class TextBlockMigration { String multipleLiterals() { return """<caret> public static void print(Object o) { System.out.println(o); } public static void main(String[] args) { print("test"); } """; } }
923e34d22ac57da5d9d50d543ea614194b01cc84
1,828
java
Java
src/Services/Hotels/src/main/java/com/etravelagency/hotels/data/SeedDataLoader.java
zayscue/eTravelAgency
a76f1f5b01caf8b5939af0411d00605a41d747ad
[ "MIT" ]
null
null
null
src/Services/Hotels/src/main/java/com/etravelagency/hotels/data/SeedDataLoader.java
zayscue/eTravelAgency
a76f1f5b01caf8b5939af0411d00605a41d747ad
[ "MIT" ]
null
null
null
src/Services/Hotels/src/main/java/com/etravelagency/hotels/data/SeedDataLoader.java
zayscue/eTravelAgency
a76f1f5b01caf8b5939af0411d00605a41d747ad
[ "MIT" ]
null
null
null
32.070175
87
0.531729
1,000,667
package com.etravelagency.hotels.data; import java.util.Arrays; import java.util.List; import com.etravelagency.hotels.models.Hotel; import com.etravelagency.hotels.models.Room; import com.etravelagency.hotels.models.RoomType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.stereotype.Component; @Component public class SeedDataLoader implements ApplicationRunner { private static final List<Hotel> PRECONFIGURED_HOTELS = Arrays.asList(new Hotel[] { new Hotel("Marriott at Research Triangle Park", "4700 Guardian Drive", "Durham", "North Carolina", "27703", "919-941-6200", "Marriott", Arrays.asList(new String[] { "High Speed Internet", "Cable TV", "Continental Breakfast", "Gym", "Indoor Pool", "Room Service" }), Arrays.asList(new RoomType[] { new RoomType("1 King Bed, Deluxe Guest Room", 190.00, 1, Arrays.asList(new Room[] { new Room("114", false, 1, 1) }) ) }) ) }); private HotelRepository hotels; @Autowired public SeedDataLoader(HotelRepository hotels) { this.hotels = hotels; } public void run(ApplicationArguments args) { if(hotels.count() == 0) { hotels.saveAll(PRECONFIGURED_HOTELS); } } }
923e34e974b584ff133a230da9a4a2f20110da32
11,520
java
Java
src/TermServer/src/main/java/de/fhdo/terminologie/ws/search/ListCodeSystems.java
FHDortmund/Termserver
716982054eec5dddabbdfdccaec25593e2544312
[ "Apache-2.0" ]
6
2015-09-01T10:44:20.000Z
2021-04-14T15:50:57.000Z
src/TermServer/src/main/java/de/fhdo/terminologie/ws/search/ListCodeSystems.java
FHDortmund/Termserver
716982054eec5dddabbdfdccaec25593e2544312
[ "Apache-2.0" ]
19
2015-01-07T09:28:54.000Z
2020-02-26T11:50:23.000Z
src/TermServer/src/main/java/de/fhdo/terminologie/ws/search/ListCodeSystems.java
FHDortmund/Termserver
716982054eec5dddabbdfdccaec25593e2544312
[ "Apache-2.0" ]
4
2015-03-01T15:03:00.000Z
2017-07-30T12:56:16.000Z
41.485612
143
0.626376
1,000,668
/* * CTS2 based Terminology Server and Terminology Browser * Copyright (C) 2014 FH Dortmund: Peter Haas, Robert Muetzner * * 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 de.fhdo.terminologie.ws.search; import de.fhdo.terminologie.Definitions; import de.fhdo.terminologie.db.HibernateUtil; import de.fhdo.terminologie.db.hibernate.CodeSystem; import de.fhdo.terminologie.db.hibernate.CodeSystemVersion; import de.fhdo.terminologie.helper.HQLParameterHelper; import de.fhdo.terminologie.ws.authorization.Authorization; import de.fhdo.terminologie.ws.authorization.types.AuthenticateInfos; import de.fhdo.terminologie.ws.search.types.ListCodeSystemsRequestType; import de.fhdo.terminologie.ws.search.types.ListCodeSystemsResponseType; import de.fhdo.terminologie.ws.types.ReturnType; import java.util.Iterator; /** * * @author Robert Mützner (anpch@example.com) */ public class ListCodeSystems { private static org.apache.log4j.Logger logger = de.fhdo.logging.Logger4j.getInstance().getLogger(); /** * Listet Vokabulare des Terminologieservers auf * * @param parameter Die Parameter des Webservices * @return Ergebnis des Webservices, alle gefundenen Vokabulare mit angegebenen Filtern */ public ListCodeSystemsResponseType ListCodeSystems(ListCodeSystemsRequestType parameter, String ipAddress) { if (logger.isInfoEnabled()) logger.info("====== ListCodeSystems gestartet ======"); // Return-Informationen anlegen ListCodeSystemsResponseType response = new ListCodeSystemsResponseType(); response.setReturnInfos(new ReturnType()); // Parameter prüfen if(validateParameter(parameter, response) == false) { return response; // Fehler bei den Parametern } // Login-Informationen auswerten (gilt für jeden Webservice) boolean loggedIn = false; boolean isAdmin = false; AuthenticateInfos loginInfoType = null; if (parameter != null && parameter.getLoginToken()!= null) { loginInfoType = Authorization.authenticate(ipAddress, parameter.getLoginToken()); loggedIn = loginInfoType.isLoggedIn(); if(loggedIn) isAdmin = loginInfoType.isIsAdmin(); } if(logger.isDebugEnabled()) logger.debug("Benutzer ist eingeloggt: " + loggedIn); try { java.util.List<CodeSystem> list = null; // Hibernate-Block, Session öffnen org.hibernate.Session hb_session = HibernateUtil.getSessionFactory().openSession(); //hb_session.getTransaction().begin(); try // 2. try-catch-Block zum Abfangen von Hibernate-Fehlern { // HQL erstellen String hql = "select distinct cs from CodeSystem cs"; hql += " join fetch cs.codeSystemVersions csv"; if(loggedIn) { hql += " left outer join csv.licencedUsers lu"; } // Parameter dem Helper hinzufügen // bitte immer den Helper verwenden oder manuell Parameter per Query.setString() hinzufügen, // sonst sind SQL-Injections möglich HQLParameterHelper parameterHelper = new HQLParameterHelper(); if(parameter != null && parameter.getCodeSystem() != null) { // Hier alle Parameter aus der Cross-Reference einfügen // addParameter(String Prefix, String DBField, Object Value) parameterHelper.addParameter("cs.", "name", parameter.getCodeSystem().getName()); parameterHelper.addParameter("cs.", "description", parameter.getCodeSystem().getDescription()); parameterHelper.addParameter("cs.", "insertTimestamp", parameter.getCodeSystem().getInsertTimestamp()); // z.B. '2011-09-26T15:40:00' if(parameter.getCodeSystem().getCodeSystemVersions() != null && parameter.getCodeSystem().getCodeSystemVersions().size() > 0) { CodeSystemVersion csv = (CodeSystemVersion) parameter.getCodeSystem().getCodeSystemVersions().toArray()[0]; parameterHelper.addParameter("csv.", "description", csv.getDescription()); parameterHelper.addParameter("csv.", "expiredDate", csv.getExpirationDate()); parameterHelper.addParameter("csv.", "insertTimestamp", csv.getInsertTimestamp()); parameterHelper.addParameter("csv.", "description", csv.getLicenceHolder()); parameterHelper.addParameter("csv.", "name", csv.getName()); parameterHelper.addParameter("csv.", "oid", csv.getOid()); parameterHelper.addParameter("csv.", "preferredLanguageCd", csv.getPreferredLanguageCd()); parameterHelper.addParameter("csv.", "releaseDate", csv.getReleaseDate()); parameterHelper.addParameter("csv.", "source", csv.getSource()); parameterHelper.addParameter("csv.", "underLicence", csv.getUnderLicence()); parameterHelper.addParameter("csv.", "validityRange", csv.getValidityRange()); if(loggedIn) // nur möglich, wenn eingeloggt parameterHelper.addParameter("csv.", "status", csv.getStatus()); } } // hier: immer nur aktive Vokabulare abrufen if(isAdmin == false) parameterHelper.addParameter("csv.", "status", Definitions.STATUS_CODES.ACTIVE.getCode()); if(loggedIn == false) { // ohne Login keine Vokabulare mit Lizenzen abrufen parameterHelper.addParameter("csv.", "underLicence", 0); } // Parameter hinzufügen (immer mit AND verbunden) String where = parameterHelper.getWhere(""); hql += where; if(loggedIn) { // jetzt auf eine gültige Lizenz prüfen // muss manuell hinzugefügt werden (für Helper zu komplex, wg. OR) logger.debug("WHERE: "+ where); if(where.length() > 2) hql += " AND "; else hql += " WHERE "; /*hql += " (csv.underLicence = 0 OR "; hql += " (lu.validFrom < '" + HQLParameterHelper.getSQLDateStr(new java.util.Date()) + "'"; hql += " AND lu.validTo > '" + HQLParameterHelper.getSQLDateStr(new java.util.Date()) + "'"; hql += " AND lu.id.codeSystemVersionId=csv.versionId"; hql += " AND lu.id.userId=" + loginInfoType.getUserId(); hql += " ))";*/ hql += " (csv.underLicence = 0 OR "; hql += " "; hql += " ("; hql += " ("; hql += " ("; hql += " lu.validFrom is NULL OR "; hql += " lu.validFrom < '" + HQLParameterHelper.getSQLDateStr(new java.util.Date()) + "'"; hql += " )"; hql += " AND"; hql += " ("; hql += " lu.validTo is NULL OR "; hql += " lu.validTo > '" + HQLParameterHelper.getSQLDateStr(new java.util.Date()) + "'"; hql += " )"; // hql += " AND lu.validTo > '" + HQLParameterHelper.getSQLDateStr(new java.util.Date()) + "'"; hql += " )"; hql += " AND lu.id.codeSystemVersionId=csv.versionId"; hql += " AND lu.id.userId=" + loginInfoType.getUserId(); hql += " ))"; } hql += " ORDER BY cs.name, csv.name"; // Query erstellen org.hibernate.Query q = hb_session.createQuery(hql); // Die Parameter können erst hier gesetzt werden (übernimmt Helper) parameterHelper.applyParameter(q); logger.debug("Query: " + q.getQueryString()); // Datenbank-Aufruf durchführen list = (java.util.List<CodeSystem>) q.list(); // Hibernate-Block wird in 'finally' geschlossen, erst danach // Auswertung der Daten // Achtung: hiernach können keine Tabellen/Daten mehr nachgeladen werden } catch(Exception e) { //hb_session.getTransaction().rollback(); // Fehlermeldung an den Aufrufer weiterleiten response.getReturnInfos().setOverallErrorCategory(ReturnType.OverallErrorCategory.ERROR); response.getReturnInfos().setStatus(ReturnType.Status.FAILURE); response.getReturnInfos().setMessage("Fehler bei 'ListCodeSystems', Hibernate: " + e.getLocalizedMessage()); logger.error("Fehler bei 'ListCodeSystems', Hibernate: " + e.getLocalizedMessage()); } finally { hb_session.close(); } // Ergebnis auswerten // Später wird die Klassenstruktur von Jaxb in die XML-Struktur umgewandelt // dafür müssen nichtbenötigte Beziehungen gelöscht werden (auf null setzen) if(list != null) { Iterator<CodeSystem> iterator = list.iterator(); while(iterator.hasNext()) { CodeSystem cs = iterator.next(); //logger.debug("CS: " + cs.getName()); if(cs.getCodeSystemVersions() != null) { Iterator<CodeSystemVersion> iteratorVV = cs.getCodeSystemVersions().iterator(); while(iteratorVV.hasNext()) { CodeSystemVersion csv = iteratorVV.next(); //logger.debug("CSV: " + csv.getName()); //logger.debug("ValidityRange: " + csv.getValidityRange()); // Nicht anzuzeigende Beziehungen null setzen csv.setLicenceTypes(null); csv.setLicencedUsers(null); csv.setCodeSystemVersionEntityMemberships(null); csv.setCodeSystem(null); } } cs.setDomainValues(null); // Keine zugehörigen Domänen zurückgeben cs.setMetadataParameters(null); // bereinigte Liste der Antwort beifügen response.setCodeSystem(list); response.getReturnInfos().setCount(list.size()); } // Status an den Aufrufer weitergeben response.getReturnInfos().setOverallErrorCategory(ReturnType.OverallErrorCategory.INFO); response.getReturnInfos().setStatus(ReturnType.Status.OK); response.getReturnInfos().setMessage("CodeSysteme erfolgreich gelesen"); } } catch(Exception e) { // Fehlermeldung an den Aufrufer weiterleiten response.getReturnInfos().setOverallErrorCategory(ReturnType.OverallErrorCategory.ERROR); response.getReturnInfos().setStatus(ReturnType.Status.FAILURE); response.getReturnInfos().setMessage("Fehler bei 'ListCodeSystems': " + e.getLocalizedMessage()); logger.error("Fehler bei 'ListCodeSystems': " + e.getLocalizedMessage()); } return response; } private boolean validateParameter(ListCodeSystemsRequestType Request, ListCodeSystemsResponseType Response) { // hier muss nichts geprüft werden, da man bei der Suche auch // alle Angaben leer lassen kann return true; } }
923e355ae29d5cca9895cd5f1179874017cb6bee
2,860
java
Java
src/main/java/com/circleci/continuousfooddelivery/api/MenuApiController.java
CircleCI-Public/sample-java-cfd
d065c0839e12584d67a49b4957027e5dfb21e751
[ "MIT" ]
null
null
null
src/main/java/com/circleci/continuousfooddelivery/api/MenuApiController.java
CircleCI-Public/sample-java-cfd
d065c0839e12584d67a49b4957027e5dfb21e751
[ "MIT" ]
null
null
null
src/main/java/com/circleci/continuousfooddelivery/api/MenuApiController.java
CircleCI-Public/sample-java-cfd
d065c0839e12584d67a49b4957027e5dfb21e751
[ "MIT" ]
null
null
null
34.878049
151
0.743357
1,000,669
package com.circleci.continuousfooddelivery.api; import com.circleci.continuousfooddelivery.jpa.MenuItemJpa; import com.circleci.continuousfooddelivery.repositories.MenuRepo; import com.circleci.continuousfooddelivery.model.Menu; import com.circleci.continuousfooddelivery.model.MenuItem; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.context.request.NativeWebRequest; import javax.persistence.EntityNotFoundException; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2022-01-31T03:17:46.722516300-05:00[America/New_York]") @RestController @RequestMapping("${openapi.continousFoodDelievery.base-path:/CFD/1.0.0}") public class MenuApiController implements MenuApi { @Autowired private MenuRepo repository; private final NativeWebRequest request; @Autowired private ModelMapper modelMapper; @org.springframework.beans.factory.annotation.Autowired public MenuApiController(NativeWebRequest request) { this.request = request; } @Override public Optional<NativeWebRequest> getRequest() { return Optional.ofNullable(request); } @Override public ResponseEntity<Void> addMenuItem(MenuItem menuItem) { if (menuItem != null) { repository.save(modelMapper.map(menuItem, MenuItemJpa.class)); return new ResponseEntity<>(HttpStatus.CREATED); } return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } @Override public ResponseEntity<Menu> listMenu(Integer limit) { if (repository.count() == 0) { return new ResponseEntity<>(HttpStatus.NO_CONTENT); } Page<MenuItemJpa> page = repository.findAll(limit != null ? Pageable.ofSize(limit) : Pageable.unpaged()); List<MenuItem> items = page.stream().map(this::convertToDto).collect(Collectors.toList()); return ResponseEntity.ok(new Menu(items)); } @Override public ResponseEntity<MenuItem> showMenuItemById(Integer itemId) { if (repository.existsById(itemId)) { MenuItemJpa item = repository.getById(itemId); return ResponseEntity.ok(convertToDto(item)); } return new ResponseEntity<>(HttpStatus.NOT_FOUND); } private MenuItem convertToDto(MenuItemJpa menuItemJpa) { return modelMapper.map(menuItemJpa, MenuItem.class); } }