blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a8a45aff7ee6c58ecc59250d03861749a63c9a44 | 78eefc3c6e830a126cd14bf4111476062b8ba631 | /src/rars/riscv/instructions/FMULD.java | 4781d9e75d9ce79b50cfc235c9c2ad64e83a11c6 | [
"MIT"
] | permissive | TheThirdOne/rars | ffb9514465ea7d59cf473ecb7e2395a037866d07 | a529a70b5cd1bd699f98f5749d34a9eba8232890 | refs/heads/master | 2023-09-01T20:12:26.864849 | 2023-07-04T19:11:36 | 2023-07-04T19:11:36 | 92,457,409 | 983 | 214 | NOASSERTION | 2023-09-13T06:20:57 | 2017-05-26T00:57:20 | Java | UTF-8 | Java | false | false | 415 | java | package rars.riscv.instructions;
import jsoftfloat.Environment;
import jsoftfloat.types.Float64;
public class FMULD extends Double {
public FMULD() {
super("fmul.d", "Floating MULtiply (64 bit): assigns f1 to f2 * f3", "0001001");
}
@Override
public Float64 compute(Float64 f1, Float64 f2, Environment e) {
return jsoftfloat.operations.Arithmetic.multiplication(f1,f2,e);
}
}
| [
"benjaminrlanders@gmail.com"
] | benjaminrlanders@gmail.com |
2a5279dd23ab03cb8cd9d220da9ab794d95c6c48 | 23d8cfa2522499ddad37d4cac5bf5e8c88645cf8 | /platforms/android/app/src/main/java/com/obdx/meezan/THSCard/util/PaymentExecutor.java | db03d369b68f5259185b2f0ba14e959753d23883 | [] | no_license | yahya960/Card-Digitization | 58746470be5f88525c991deef2b4303ae166ecad | 8fca30a54a82fd629a4fbc633ffff976c6f9e636 | refs/heads/main | 2023-09-06T03:47:15.727144 | 2021-10-28T11:30:08 | 2021-10-28T11:30:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,374 | java | /*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.obdx.meezan.THSCard.util;
import android.os.Handler;
import android.os.Looper;
import androidx.annotation.NonNull;
/**
* PaymentExecutor thread executor implementation
*/
public class PaymentExecutor {
private final Handler mainThreadHandler = new Handler(Looper.getMainLooper());
public void execute(@NonNull Runnable command) {
mainThreadHandler.post(command);
}
public void execute(@NonNull Runnable command, long delayMs) {
mainThreadHandler.postDelayed(command, delayMs);
}
public void cancel(@NonNull Runnable command) {
mainThreadHandler.removeCallbacks(command);
}
public void cancelAllPendingOps() {
mainThreadHandler.removeCallbacksAndMessages(null);
}
}
| [
"muhammad.yahya@techlogix.com"
] | muhammad.yahya@techlogix.com |
03dfd9ac3966d78a7ec21c96d70f0ec1f92691b8 | 555e03a1387f5ae659e20c0f28093d93c276ec56 | /CreditCustomer_houduan/credit-server/src/test/java/com/yuminsoft/testClass.java | 057e9960ccb5065441fc5c5a87f08a8123004833 | [] | no_license | JacksonHSY/credit | 3a4aa63b8744742effcb696f79bb27a5aabae5f7 | 53bc34c389d4330798cc2dc046f7d2881078e54b | refs/heads/master | 2020-04-08T14:55:29.372751 | 2018-12-04T08:47:52 | 2018-12-04T08:47:52 | 159,457,670 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,811 | java | package com.yuminsoft;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.ymkj.base.core.biz.api.message.Response;
import com.ymkj.bms.biz.api.service.zdqq.apply.ILoanInfoInputExecuter;
import com.ymkj.cms.biz.api.service.app.IZDQQExecuter;
import com.ymkj.cms.biz.api.vo.request.app.Req_VO_700001;
import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.ymkj.credit.common.constants.Constants;
import com.ymkj.credit.common.entity.ApplyLoanInfo;
import com.ymkj.credit.common.entity.ApplyPicInfo;
import com.ymkj.credit.mapper.ApplyPicInfoMapper;
import com.ymkj.credit.service.ApplyInfoService;
import com.ymkj.credit.service.ApplyLoanInfoService;
import com.ymkj.credit.service.LoanOrderService;
import com.ymkj.credit.service.SignLcbService;
import com.ymkj.credit.service.SignService;
import com.ymkj.credit.web.api.model.Result;
import com.ymkj.credit.web.api.model.base.Model_002025;
import com.ymkj.credit.web.api.model.base.Model_004009;
import com.ymkj.credit.web.api.model.base.Model_004011;
import com.ymkj.credit.web.api.model.base.Model_005001;
import com.ymkj.credit.web.api.model.base.Model_005002;
import com.ymkj.credit.web.api.model.base.Model_005003;
import com.ymkj.credit.web.api.model.base.Model_005005;
import com.ymkj.credit.web.api.model.base.Model_005013;
import com.ymkj.credit.web.api.model.base.Model_005014;
import com.ymkj.credit.web.api.model.base.Model_005015;
import com.ymkj.credit.web.api.model.base.Model_006001;
import com.ymkj.credit.web.api.model.base.Model_006002;
import com.ymkj.dms.api.enums.EnumConstants.applyMaintainFlag;
import com.ymkj.rule.biz.api.message.MapResponse;
import com.ymkj.rule.biz.api.message.RuleEngineRequest;
import com.ymkj.rule.biz.api.service.IRuleEngineExecuter;
import com.ymkj.rule.biz.api.vo.zdqq.ZDQQApplyRuleExecVo;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath*:spring/spring-context.xml"})
@ActiveProfiles("dev")
public class testClass {
@Autowired
public SignService signService;
@Autowired
public ApplyInfoService apply;
@Autowired
ApplyPicInfoMapper applypicinfomapper;
@Autowired
public IZDQQExecuter iZdqqExecuter;
private Gson gson = new Gson();
@Autowired
ILoanInfoInputExecuter iloanInfoInputExecuter;
@Autowired
IRuleEngineExecuter iRuleEngineExecuter;
@Autowired
LoanOrderService loanOrderService;
@Autowired
SignLcbService signLcbService;
@Test
public void clientSinature(){
Model_002025 model = new Model_002025();
model.setLoanNo("20161115170000166690");
signService.clientSinature(model);
}
/**
* 查询是否可以借款
*/
@Test
public void checkLoan(){
Model_005001 model = new Model_005001();
model.setIdCard("12315412315");
apply.checkLoan(model);
}
/**
* 查询借款申请
*/
@Test
public void checkCreditInfo(){
Model_005003 info = new Model_005003();
info.setIdCard("110101198208048158");
info.setFieldKey("applyInfo");
apply.checkCreditInfo(info);
}
@Test
public void queryNodeInfo(){
Model_005005 model = new Model_005005();
model.setIdCard("110101198208048158");
model.setFieldKey(Constants.PERSIONINFO);
model.setLoanNo("201807262B8565");
Result r = apply.queryNodeInfo(model);
System.out.println(gson.toJson(r));
}
/**
*运营平台
* */
@Test
public void testinit(){
Req_VO_700001 req = new Req_VO_700001();
req.setSysCode("zdqq");
req.setNodeCode(Constants.APPLYINFO);
Response response = iZdqqExecuter.initField(req);
System.out.println("数据"+gson.toJson(response.getData()));
}
/**
* 录单
*
* */
@Test
public void testLUdan(){
//录单获取借款编号接口
/*Model_005002 model = new Model_005002();
com.alibaba.fastjson.JSONObject ApplyInfoVo = new com.alibaba.fastjson.JSONObject();
ApplyInfoVo.put("applyLmt", "10000");
ApplyInfoVo.put("applyTerm", "00003");
ApplyInfoVo.put("branchManagerCode", "110");
ApplyInfoVo.put("creditApplication", "00006");
ApplyInfoVo.put("monthMaxRepay", "2000");
model.setIdCard("320321199008186511");
model.setFieldValue(ApplyInfoVo.toJSONString());
apply.CreditInfo(model);*/
/*Model_005003 model = new Model_005003();//查询基本信息接口调试
model.setIdCard("310110198005245419");
model.setLoanNo("20180731185CF3");
com.alibaba.fastjson.JSONObject ApplyInfoVo = new com.alibaba.fastjson.JSONObject();
ApplyInfoVo.put("idNo", model.getIdCard());
ApplyInfoVo.put("loanNo", model.getLoanNo());
Response<com.alibaba.fastjson.JSONObject> response = iloanInfoInputExecuter.queryApplyInfo(ApplyInfoVo);
String loanNoObj =response.getData()==null?"":String.valueOf(response.getData());*/
/*Model_005014 model = new Model_005014();//推送录单接口调试
model.setLoanNo("2018073149A7ED");
apply.pushToBms(model);*/
/*Model_005013 model = new Model_005013();//图片删除
model.setFileId("19110982");
apply.deletePicture(model);*/
/*String loanNo = "20180810F8EC15";//分布查询接口
String idNo = "110101198208048361";
com.alibaba.fastjson.JSONObject ApplyInfoVo = new com.alibaba.fastjson.JSONObject();
ApplyInfoVo.put("loanNo", loanNo);
ApplyInfoVo.put("idNo", idNo);
Response<com.alibaba.fastjson.JSONObject> response = iloanInfoInputExecuter.queyBaseInformation(ApplyInfoVo);
String loanNoObj =response.getData()==null?"":String.valueOf(response.getData());*/
String loanNo = "20180810F8EC15";//进度查询
String idNo = "110101198208048361";
Model_004009 model = new Model_004009();
model.setCustomerId("87");
apply.selectByProcess(model);
}
@Test
public void rrr(){
for (int i = 0; i < 20; i++) {
IdCardGenerator id = new IdCardGenerator();
com.alibaba.fastjson.JSONObject ApplyInfoVo = new com.alibaba.fastjson.JSONObject();
String idCard = id.getRandomID();
ApplyInfoVo.put("idNo", idCard);
ApplyInfoVo.put("applyInfoValue","{\"applyLmt\":\"800000\",\"applyTerm\":\"24\",\"branchManagerCode\":\"hwt\",\"creditApplication\":\"00001\",\"loanNo\":\"\",\"monthMaxRepay\":\"5000\"}");
ApplyInfoVo.put("loanNo", "");
Response<com.alibaba.fastjson.JSONObject> response = iloanInfoInputExecuter.saveApplyInfo(ApplyInfoVo);
//借款编号由录单给到
if(response.isSuccess()){
String loanNo =net.sf.json.JSONObject.fromObject(response.getData()).getString("loanNo");
String str = "{\"baseInfo\":{\"applyInfo\":{\"applyLmt\":\"800000\",\"applyTerm\":\"24\",\"branchManagerCode\":\"hwt\",\"creditApplication\":\"00001\",\"loanNo\":\""+loanNo+"\",\"monthMaxRepay\":\"5000\"},\"loanNo\":\""+loanNo+"\",\"persionInfo\":{\"age\":\"12\",\"cellphone\":\"13142563789\",\"cellphoneSec\":\"13412534678\",\"email\":\"123456@qq.com\",\"gender\":\"M\",\"home\":\"530000,530500,530524\",\"homeAddress\":\"多次发出\",\"homePhone1\":\"010-1234567\",\"homeSameRegistered\":\"1\",\"homeText\":\"云南省,保山市,昌宁县\",\"idIssuerAddress\":\"对方尴尬\",\"idNo\":\""+idCard+"\",\"issuer\":\"530000,530500,530524\",\"issuerText\":\"云南省,保山市,昌宁县\",\"maritalStatus\":\"00002\",\"name\":\"刘祥一"+i+"\",\"qqNum\":\"12555\",\"qualification\":\"00002\",\"wechatNum\":\"12355\"},\"empItemInfo\":{\"corp\":\"220000,220800,220882\",\"corpAddress\":\"和 vv 成分丰富\",\"corpDepapment\":\"的方法\",\"corpName\":\"今年年内\",\"corpPayWay\":\"00002\",\"corpPayday\":\"12\",\"corpPhone\":\"010-1234567\",\"corpPhoneSec\":\"010-3214567\",\"corpPost\":\"00006\",\"corpStandFrom\":\"2015-08\",\"corpStructure\":\"00001\",\"corpText\":\"吉林省,白城市,大安市\",\"corpType\":\"00005\",\"monthAmt\":\"123\",\"occupation\":\"00006\",\"payBank\":\"中国银行\",\"priEnterpriseType\":\"00003\",\"registerFunds\":\"1234\",\"setupDate\":\"1995-08\",\"sharesScale\":\"12\",\"takeHomePay\":\"1234\",\"totalMonthSalary\":\"123\"},\"mateInfo\":{\"contactCellphone\":\"15314286780\",\"contactCorpPhone\":\"010-33565432\",\"contactEmpName\":\"哥哥哥哥\",\"contactIdNo\":\"320324199012543201\",\"contactName\":\"法国环境\",\"ifForeignPenple\":\"1\",\"ifKnowLoan\":\"1\",\"sequenceNum\":\"0\",\"unabridged\":\"Y\"},\"creditAccountInfo\":{\"creditName\":\"12346\",\"creditPassword\":\"12345\",\"verificationCode\":\"12546\",\"unabridged\":\"Y\"},\"educationInfo\":{\"area\":\"520000,520400\",\"areaText\":\"贵州省,安顺市\",\"educationExperience\":\"00001\",\"graduationDate\":\"2018-08-10\",\"qualification\":\"00002\",\"schoolName\":\"错过后悔\",\"chsiAccount\":\"1234\",\"chsiPassword\":\"123\",\"certificateNumber\":\"1524\",\"unabridged\":\"Y\"},\"merchantLoanInfo\":{\"IsOpenLoan\":\"0\",\"borrowLimit\":\"20000\",\"buyerCreditLevel\":\"A\",\"buyerCreditType\":\"A\",\"consumptionSum\":\"451\",\"costLimit\":\"450\",\"isOpenCost\":\"1\",\"memberName\":\"今天\",\"naughtyValue\":\"450\",\"sesameCreditValue\":\"450\",\"unabridged\":\"Y\"},\"assetsInfo\":{\"eatateSameRegistered\":\"1\",\"estate\":\"640000,640400,640423\",\"estateAddress\":\"今天\",\"estateBuyDate\":\"2018-08-10\",\"estateLoan\":\"ING\",\"estateLoanAmt\":\"1334\",\"estateLoanIssueDate\":\"2018-08\",\"estateText\":\"宁夏回族自治区,固原市,隆德县\",\"estateType\":\"00001\",\"isCommon\":\"1\",\"monthPaymentAmt\":\"1313\",\"unabridged\":\"Y\"},\"carInfo\":{\"carBuyDate\":\"2018-08\",\"carBuyPrice\":\"2508\",\"carLoanIssueDate\":\"2018-08\",\"carLoanOrg\":\"今天早上\",\"carLoanStatus\":\"ING\",\"monthPaymentAmt\":\"3161\",\"plateNum\":\"宁A12345\",\"tciCompany\":\"玩\",\"unabridged\":\"Y\"},\"providentInfo\":{\"accumulationFundAccount\":\"1234\",\"accumulationFundPassword\":\"11222\",\"unabridged\":\"Y\"},\"insuranceInfo\":{\"socialInsuranceAccount\":\"124884\",\"socialInsurancePassword\":\"1344\",\"unabridged\":\"Y\"},\"cardLoanInfo\":{\"unabridged\":\"N\"},\"residenceInfo\":{\"unabridged\":\"N\"},\"policyInfo\":[{\"insuranceCompany\":\"00019\",\"insuranceDate\":\"2018-08\",\"paymentMethod\":\"Y\",\"sequenceNum\":\"0\",\"tab\":\"0\",\"paymentMoney\":\"123\",\"policyAccount\":\"123\",\"policyPassword\":\"23\",\"unabridged\":\"Y\"},{\"insuranceCompany\":\"00018\",\"insuranceDate\":\"2018-08\",\"paymentMethod\":\"Y\",\"sequenceNum\":\"0\",\"tab\":\"0\",\"paymentMoney\":\"123\",\"policyAccount\":\"123\",\"policyPassword\":\"23\",\"unabridged\":\"Y\"},{\"insuranceCompany\":\"00017\",\"insuranceDate\":\"2018-08\",\"paymentMethod\":\"Y\",\"sequenceNum\":\"0\",\"tab\":\"0\",\"paymentMoney\":\"123\",\"policyAccount\":\"123\",\"policyPassword\":\"23\",\"unabridged\":\"Y\"}],\"contactPersonInfo\":[{\"contactCellphone\":\"13122321091\",\"contactCorpPhone\":\"010-3214567\",\"contactEmpName\":\"韩版包包\",\"contactName\":\"江河湖海\",\"contactRelation\":\"00001\",\"ifKnowLoan\":\"1\",\"sequenceNum\":\"0\",\"unabridged\":\"Y\"},{\"contactCellphone\":\"12345678911\",\"contactCorpPhone\":\"010-2314567\",\"contactEmpName\":\"沟沟壑壑\",\"contactName\":\"风风光光\",\"contactRelation\":\"00002\",\"ifKnowLoan\":\"1\",\"sequenceNum\":\"1\",\"unabridged\":\"Y\"},{\"contactCellphone\":\"12546789013\",\"contactCorpPhone\":\"010-1325617\",\"contactEmpName\":\"你爸爸\",\"contactName\":\"其实方法\",\"contactRelation\":\"00002\",\"ifKnowLoan\":\"1\",\"sequenceNum\":\"2\",\"unabridged\":\"Y\"},{\"contactCellphone\":\"13485796314\",\"contactCorpPhone\":\"010-65678432\",\"contactEmpName\":\"反反复复\",\"contactName\":\"黑板报\",\"contactRelation\":\"00003\",\"ifKnowLoan\":\"1\",\"sequenceNum\":\"3\",\"unabridged\":\"Y\"}]}}";
//开始推送录单
Response<com.alibaba.fastjson.JSONObject> response1 = iloanInfoInputExecuter.saveBaseInformation(JSONObject.parseObject(str));
System.out.println(String.valueOf(response1.getData()));
}
}
}
@Test
public void insert(){
ApplyPicInfo pic = new ApplyPicInfo();
pic.setFieldKey("444");
pic.setPicId("111");
pic.setStatus("1");
pic.setPicUrl("wertwert");
pic.setImgName("sdfsdf");
applypicinfomapper.insert(pic);
}
@Test
public void gz(){
//ruleAppSevice.validate(name, idCardNo);
ZDQQApplyRuleExecVo vo = new ZDQQApplyRuleExecVo();
vo.setIdNo("110101198208048158");
vo.setExecuteType(Constants.RULE_NODE_SQ);
RuleEngineRequest rr = new RuleEngineRequest();
rr.setData(vo);
rr.setBizType(Constants.ZDQQAPPLY);
rr.setSysCode(Constants.ZDQQ_SYS_CODE);
com.ymkj.rule.biz.api.message.Response ruleResponse = iRuleEngineExecuter.executeRuleEngine(rr);
//MapResponse map = (MapResponse) ruleResponse;
Map<String, Object> map = ((MapResponse) ruleResponse).getMap();
System.out.println(map.get("action"));
}
@Test
public void code(){
Model_004011 model = new Model_004011();
model.setOperatorCode("hwt");
loanOrderService.queryOperator(model);
}
@Test
public void ruleCheck(){
//apply.ruleCheck("2018080899B7FF");
}
//-Dglobal.config.path="D:\yumin_object\tomcat7.0\CreditCustomer_houduan\credit-server\src\main\resources\resource"
/**
* 验证码校验
*/
@Test
public void verification(){
Model_006001 model = new Model_006001();
model.setCellPhone("13122301151");
signLcbService.VerificationCode(model);
}
/**
* 注册登录
*/
@Test
public void RegisterLogin(){
Model_006002 model = new Model_006002();
model.setCellPhone("13122301091");
model.setValidateCode("1234");
signLcbService.RegisterLogin(model);
}
@Test
public void isCheckLoan(){
//apply.isCheckLoan("320321199105163210");
}
//-Dglobal.config.path="D:\yumin_object\tomcat7.0\CreditCustomer_houduan\credit-server\src\main\resources\resource"
}
| [
"huangsy@yuminsoft.com"
] | huangsy@yuminsoft.com |
71ed628fdc6ec0f902e2f863420de448f917f9bd | 888ea10f52f23717ab7ad1444a5d0e85bfce8bcb | /common/src/test/java/natalia/dymnikova/util/sequence/SequenceTest.java | 1bd61beced7c47688a3887197e7fb14254b2e01d | [
"MIT"
] | permissive | NataliaDymnikova/akka.scheduler | 56a88afe868673c1e9130b45b7e9f586dc1834b1 | c857eadf0ecad2b0e5051d4625abd13f8f8bebee | refs/heads/master | 2021-01-10T15:52:44.717006 | 2016-05-06T16:30:08 | 2016-05-06T16:30:08 | 49,160,571 | 1 | 1 | null | 2016-01-06T22:13:55 | 2016-01-06T20:46:16 | Java | UTF-8 | Java | false | false | 2,059 | java | // Copyright (c) 2016 Natalia Dymnikova
// Available via the MIT license
//
// 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 natalia.dymnikova.util.sequence;
import org.junit.Test;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
public class SequenceTest {
@Test
public void shouldReturnFirstElement() throws Exception {
final Element last = Sequence.sequence(10, 98, 10).findFirst().get();
assertThat(
last,
is(new Element(10, 20))
);
}
@Test
public void shouldReturnLastElement() throws Exception {
final Element last = Sequence.sequence(10, 98, 10).reduce((a, b) -> b).get();
assertThat(
last,
is(new Element(90, 98))
);
}
@Test
public void shouldReturnSingleElement() throws Exception {
final Element last = Sequence.sequence(10, 18, 10).reduce((a, b) -> b).get();
assertThat(
last,
is(new Element(10, 18))
);
}
}
| [
"natalia.dymnikova@gmail.com"
] | natalia.dymnikova@gmail.com |
79d4d1c1ee26f72b49a56cd729a77562ef5eedc6 | 6c78507cefba02131426935aa7e00fce4a5f9eb2 | /src/WSDidattica/src/java/nu/mine/egoless/didattica/ws/WSDidatticaException.java | aa83870c00b61836a5a4e4cddd37690c13ce6417 | [] | no_license | egoless/pqs | 1a1b048bfe194d40ac0d6f9e72b0c33a9675cf50 | 1733d0b0c6e4b02d19f234dd8c50ad122dcd0fce | refs/heads/master | 2021-01-02T09:31:57.205973 | 2012-06-26T18:35:40 | 2012-06-26T18:35:40 | 4,742,809 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 777 | java | /*
* Nome file:WSDidatticaException.java
* Data creazione: 08 marzo 2007, 10.54
* Info svn: $Id: WSDidatticaException.java 164 2007-03-10 12:59:59Z eric $
*/
package nu.mine.egoless.didattica.ws;
import java.lang.Exception;
/**
* Eccezione creata ad hoc per segnalare all'APP-DIDATTICA quali problemi sono
* occorsi a livello del WSDidattica
*/
public class WSDidatticaException extends Exception {
/**
* Crea una nuova istanza dell'Eccezione
*/
public WSDidatticaException() {
}
/**
* Constructs an instance of <code>WSDidatticaException</code> with
* the specified detail message.
* @param msg the detail message.
*/
public WSDidatticaException(String msg) {
super(msg);
}
}
| [
"edymtt@netscape.net"
] | edymtt@netscape.net |
f9aef4ec7593f06382cc2e5e9aefddd110a90006 | 9058d5155b67af4a2b9f6baef9ef33e9c1ba7abf | /U5-A5/Diferentes_Versiones/app/src/main/java/francisco/paniagua/diferentes_versiones/MainActivity.java | 9fd28ea56b0ed680b9dc09b7bf3547d6dabb1f2b | [] | no_license | FranciscoPaniagua/Programacion-Mobil | e94e6f42e8d7cae0fcbad358fe46ee5d918f6c61 | 933603b1c4a8c4db0063942a597db026736837a0 | refs/heads/master | 2021-09-30T23:40:36.474558 | 2018-11-26T02:04:06 | 2018-11-26T02:04:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,725 | java | package francisco.paniagua.diferentes_versiones;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
//Copiar este código
TextView texto=(TextView) findViewById(R.id.txtTexto);
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
texto.setText("dispositivo Lollipop");
}else if(Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP_MR1){
texto.setText("dispositivo Lollipop target 22");
}
return true;
}
}
| [
"perry.john6262@yahoo.com.mx"
] | perry.john6262@yahoo.com.mx |
c99b0a0fc483c7a70155e53d18efa46d5738849a | 6505a589029e750dd94774d55ca71d0886da26bd | /src/ssn/ws/jaxws/GetEventsHistoryByUser.java | 7d9c994faee53813bf223d53973c59022663460d | [] | no_license | bergacat1/SSN_WS | 3db258661e6f8ee6ca36c4e026efd4cbf0fb7ad1 | a03ce15d53ab26855a7016fd594cdbb7a0efeb9a | refs/heads/master | 2016-08-11T21:36:22.023560 | 2016-01-18T19:00:38 | 2016-01-18T19:00:38 | 47,343,463 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 841 | java |
package ssn.ws.jaxws;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* This class was generated by Apache CXF 2.7.11.redhat-3
* Sat Jan 09 18:29:29 CET 2016
* Generated source version: 2.7.11.redhat-3
*/
@XmlRootElement(name = "getEventsHistoryByUser", namespace = "http://ws.ssn/")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "getEventsHistoryByUser", namespace = "http://ws.ssn/")
public class GetEventsHistoryByUser {
@XmlElement(name = "iduser")
private int iduser;
public int getIduser() {
return this.iduser;
}
public void setIduser(int newIduser) {
this.iduser = newIduser;
}
}
| [
"albertbergagatius@gmail.com"
] | albertbergagatius@gmail.com |
c9cf201994268a406aacaf8ce051fefedb57daa6 | 82919e8b8cb5e6582023e4ca22b4144109cae7b5 | /Web/src/main/java/org/voovan/http/server/WebSocketDispatcher.java | 8d81756d6feb4b9c56775a4c25985049e6e93e12 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | from000/Voovan | a779e7ed03eb987653333f5d608e79ca184044e3 | 0358169ee5a057b90504f3beaf501d626ea30498 | refs/heads/master | 2022-01-29T18:31:37.452262 | 2019-03-23T12:20:52 | 2019-03-23T12:20:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,173 | java | package org.voovan.http.server;
import org.voovan.Global;
import org.voovan.http.HttpSessionParam;
import org.voovan.http.HttpRequestType;
import org.voovan.http.server.context.WebServerConfig;
import org.voovan.http.server.exception.RouterNotFound;
import org.voovan.http.websocket.WebSocketFrame;
import org.voovan.http.websocket.WebSocketRouter;
import org.voovan.http.websocket.WebSocketSession;
import org.voovan.http.websocket.WebSocketType;
import org.voovan.http.websocket.exception.WebSocketFilterException;
import org.voovan.network.IoSession;
import org.voovan.network.exception.SendMessageException;
import org.voovan.tools.TEnv;
import org.voovan.tools.TObject;
import org.voovan.tools.log.Logger;
import org.voovan.tools.reflect.annotation.NotSerialization;
import java.nio.ByteBuffer;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
/**
*
* 根据 WebSocket 请求分派到处理路由
*
* @author helyho
*
* Voovan Framework.
* WebSite: https://github.com/helyho/Voovan
* Licence: Apache v2 License
*/
public class WebSocketDispatcher {
private WebServerConfig webConfig;
private SessionManager sessionManager;
@NotSerialization
private Map<IoSession, WebSocketSession> webSocketSessions;
/**
* [Key] = Route path ,[Value] = WebSocketBizHandler对象
*/
private Map<String, WebSocketRouter> routers;
public enum WebSocketEvent {
OPEN, RECIVED, SENT, CLOSE, PING, PONG
}
/**
* 构造函数
* @param webConfig WEB 配置对象
* @param sessionManager session 管理器
*/
public WebSocketDispatcher(WebServerConfig webConfig, SessionManager sessionManager) {
this.webConfig = webConfig;
this.sessionManager = sessionManager;
webSocketSessions = new ConcurrentHashMap<IoSession, WebSocketSession>();
routers = new TreeMap<String, WebSocketRouter>(new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
if(o1.length() > o2.length()){
return -1;
} else if(o1.length() < o2.length()){
return 1;
} else if(o1.equals(o2)){
return 0;
} else{
return 1;
}
}
});
}
/**
* 获取 WebSocket 的路由配置
* @return 路由配置信息
*/
public Map<String, WebSocketRouter> getRouters(){
return routers;
}
/**
* 增加一个路由规则
*
* @param routeRegexPath 匹配路径
* @param handler WebSocketRouter 对象
*/
public void addRouteHandler(String routeRegexPath, WebSocketRouter handler) {
routeRegexPath = HttpDispatcher.fixRoutePath(routeRegexPath);
routers.put(routeRegexPath, handler);
}
/**
* 获取路由处理对象和注册路由
* @param request 请求对象
* @return 路由信息对象 [ 匹配到的已注册路由, WebSocketRouter对象 ]
*/
public List<Object> findRouter(HttpRequest request){
String requestPath = request.protocol().getPath();
for (Map.Entry<String,WebSocketRouter> routeEntry : routers.entrySet()) {
String routePath = routeEntry.getKey();
if(HttpDispatcher.matchPath(requestPath, routePath, webConfig.isMatchRouteIgnoreCase())){
//[ 匹配到的已注册路由, HttpRouter对象 ]
return TObject.asList(routePath, routeEntry.getValue());}
}
return null;
}
/**
* 路由处理函数
*
* @param event WebSocket 事件
* @param session socket连接会话
* @param request HTTP 请求对象
* @param byteBuffer 对象, 保存 WebSocket 数据
* @return WebSocket 帧对象
*/
public WebSocketFrame process(WebSocketEvent event, IoSession session, HttpRequest request, ByteBuffer byteBuffer) {
//[ 匹配到的已注册路由, WebSocketRouter对象 ]
List<Object> routerInfo = findRouter(request);
if (routerInfo != null) {
// String routePath = (String)routerInfo.get(0);
WebSocketRouter webSocketRouter = (WebSocketRouter)routerInfo.get(1);
WebSocketSession webSocketSession = disposeSession(request, webSocketRouter);
// 获取路径变量
ByteBuffer responseMessage = null;
try {
Object result = byteBuffer;
//WebSocket 事件处理
if (event == WebSocketEvent.OPEN) {
result = webSocketRouter.onOpen(webSocketSession);
//封包
responseMessage = (ByteBuffer) webSocketRouter.filterEncoder(webSocketSession, result);
} else if (event == WebSocketEvent.RECIVED) {
//解包
result = webSocketRouter.filterDecoder(webSocketSession, result);
//触发 onRecive 事件
result = webSocketRouter.onRecived(webSocketSession, result);
//封包
responseMessage = (ByteBuffer) webSocketRouter.filterEncoder(webSocketSession, result);
}
//将返回消息包装称WebSocketFrame
if (responseMessage != null) {
return WebSocketFrame.newInstance(true, WebSocketFrame.Opcode.TEXT, false, responseMessage);
}
if (event == WebSocketEvent.SENT) {
//封包
result = webSocketRouter.filterDecoder(webSocketSession, byteBuffer);
webSocketRouter.onSent(webSocketSession, result);
} else if (event == WebSocketEvent.CLOSE) {
webSocketRouter.onClose(webSocketSession);
//清理 webSocketSessions 中的 WebSocketSession
webSocketSessions.remove(session);
} else if (event == WebSocketEvent.PING) {
return WebSocketFrame.newInstance(true, WebSocketFrame.Opcode.PONG, false, byteBuffer);
} else if (event == WebSocketEvent.PONG) {
final IoSession poneSession = session;
if(poneSession.isConnected()) {
Global.getThreadPool().execute(new Runnable() {
@Override
public void run() {
TEnv.sleep(poneSession.socketContext().getReadTimeout() / 3);
try {
poneSession.syncSend(WebSocketFrame.newInstance(true, WebSocketFrame.Opcode.PING, false, null));
} catch (SendMessageException e) {
poneSession.close();
Logger.error("Send WebSocket ping error", e);
}
}
});
}
}
} catch (WebSocketFilterException e) {
Logger.error(e);
}
}
// 没有找寻到匹配的路由处理器
else {
new RouterNotFound("Not avaliable router!").printStackTrace();
}
return null;
}
/**
* 处理 WebSocketSession
* @param request Http 请求对象
* @param webSocketRouter websocket 路由处理
* @return WebSocketSession对象
*/
public WebSocketSession disposeSession(HttpRequest request, WebSocketRouter webSocketRouter){
request.setSessionManager(sessionManager);
HttpSession httpSession = request.getSession();
IoSession socketSession = request.getSocketSession();
//如果 session 不存在,创建新的 session
if (!webSocketSessions.containsKey(socketSession)) {
// 构建 session
WebSocketSession webSocketSession =
new WebSocketSession(httpSession.getSocketSession(), webSocketRouter, WebSocketType.SERVER);
webSocketSessions.put(socketSession, webSocketSession);
return webSocketSession;
} else {
return webSocketSessions.get(socketSession);
}
}
/**
* 触发 WebSocket Open 事件
* @param session socket 会话对象
* @param request http 请求对象
* @return WebSocketFrame WebSocket 帧
*/
public WebSocketFrame fireOpenEvent(IoSession session, HttpRequest request){
//触发 onOpen 事件
return process(WebSocketEvent.OPEN, session, request, null);
}
/**
* 触发 WebSocket Received 事件
* @param session socket 会话对象
* @param request http 请求对象
* @param byteBuffer ping的报文数据
* @return WebSocketFrame WebSocket 帧
*/
public WebSocketFrame fireReceivedEvent(IoSession session, HttpRequest request, ByteBuffer byteBuffer){
return process(WebSocketEvent.RECIVED, session, request, byteBuffer);
}
/**
* 触发 WebSocket Sent 事件
* @param session socket 会话对象
* @param request http 请求对象
* @param byteBuffer ByteBuffer 对象
*/
public void fireSentEvent(IoSession session, HttpRequest request, ByteBuffer byteBuffer){
process(WebSocketEvent.SENT, session, request, byteBuffer);
}
/**
* 出发 Close 事件
* @param session HTTP-Session 对象
*/
public void fireCloseEvent(IoSession session){
//检查是否是WebSocket
if (HttpRequestType.WEBSOCKET.equals(WebServerHandler.getAttribute(session, HttpSessionParam.TYPE))) {
// 触发一个 WebSocket Close 事件
process(WebSocketEvent.CLOSE, session, (HttpRequest) WebServerHandler.getAttribute(session, HttpSessionParam.HTTP_REQUEST), null);
}
}
/**
* 触发 WebSocket Ping 事件
* @param session socket 会话对象
* @param request http 请求对象
* @param byteBuffer ping的报文数据
* @return WebSocketFrame WebSocket 帧
*/
public WebSocketFrame firePingEvent(IoSession session, HttpRequest request, ByteBuffer byteBuffer){
return process(WebSocketEvent.PING, session, request, byteBuffer);
}
/**
* 触发 WebSocket Pone 事件
* @param session socket 会话对象
* @param request http 请求对象
* @param byteBuffer ByteBuffer 对象
*/
public void firePoneEvent(IoSession session, HttpRequest request, ByteBuffer byteBuffer){
process(WebSocketEvent.PONG, session, request, byteBuffer);
}
}
| [
"helyho@gmail.com"
] | helyho@gmail.com |
70545ee5eefa849829294bd69836538d704d8832 | e64c2201c1cf2adf9197c77aab2676670de9bf4c | /src/main/java/com/zxb/Concurrency/Executors/RejectedExecutionHandlerImpl.java | 413b0049e7647c4617f35d8d9974ab849b24e416 | [] | no_license | zengxianbing/JavaStudy | 45016f3910606988403f16bd1b5f0e60d52de7b2 | 9a4593cf4b6f79ada4677bdd87a045ff04ee721a | refs/heads/master | 2020-04-06T04:29:17.203382 | 2016-07-04T01:11:47 | 2016-07-04T01:11:47 | 62,491,476 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 565 | java | package com.zxb.Concurrency.Executors;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;
/**
* Title: <br>
* <p>
* Description: <br>
* <p>
* Created by zengxianbing on 2016/4/19.
*
* @author <a href=mailto:zengxianbing163@163.com>曾宪兵</a>
*/
public class RejectedExecutionHandlerImpl implements RejectedExecutionHandler {
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
System.out.println(r.toString()+" is rejected");
}
}
| [
"1121466030@qq.com"
] | 1121466030@qq.com |
fa8944d5a3cf4aa964e9160af77b89cfaaa69d79 | ef5295e64ceea1d2b231501c7b542032a0450b8d | /src/main/java/aula20201112/modeloOOMercadoPersistente/produto/ProdutoRepository.java | 9cfc24a8512a77d5a459ce15fb0b27ed51ec0898 | [] | no_license | beatrizferraz/esoft4s2020 | 43422677cab5387658827cad812cf97926a789c1 | 494a12eff266ce5c539e19d33f00edbd1b7f2d61 | refs/heads/master | 2023-01-23T06:11:37.886021 | 2020-12-04T06:53:23 | 2020-12-04T06:53:23 | 286,868,982 | 0 | 0 | null | 2020-11-18T00:36:23 | 2020-08-11T23:26:39 | Java | UTF-8 | Java | false | false | 203 | java | package aula20201112.modeloOOMercadoPersistente.produto;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ProdutoRepository extends JpaRepository<Produto, String>{
}
| [
"aczavads@gmail.com"
] | aczavads@gmail.com |
a20a0f1746d7142b05bae6bec144e596f5f38c2d | c4a8bf860a78db78834b601f619fc902978b830f | /TDT4250.assignment.program/src/Program/util/ProgramValidator.java | 9505a5d153eb3f1f32f1440e9f6ae4bb83b8b2f5 | [] | no_license | HenrikLarsen/TDT4250-A3 | de3960e6a844ecd794cce1f0e13fe5b6b35bbc06 | 90e9140a06ea48133b9992e6d8cb674f51f780c0 | refs/heads/master | 2020-08-14T01:41:28.506460 | 2019-10-18T11:13:47 | 2019-10-18T11:13:47 | 215,074,282 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,299 | java | /**
*/
package Program.util;
import Program.*;
import java.util.Map;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.util.EObjectValidator;
/**
* <!-- begin-user-doc -->
* The <b>Validator</b> for the model.
* <!-- end-user-doc -->
* @see Program.ProgramPackage
* @generated
*/
public class ProgramValidator extends EObjectValidator {
/**
* The cached model package
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final ProgramValidator INSTANCE = new ProgramValidator();
/**
* A constant for the {@link org.eclipse.emf.common.util.Diagnostic#getSource() source} of diagnostic {@link org.eclipse.emf.common.util.Diagnostic#getCode() codes} from this package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.emf.common.util.Diagnostic#getSource()
* @see org.eclipse.emf.common.util.Diagnostic#getCode()
* @generated
*/
public static final String DIAGNOSTIC_SOURCE = "Program";
/**
* A constant with a fixed name that can be used as the base value for additional hand written constants.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 0;
/**
* A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ProgramValidator() {
super();
}
/**
* Returns the package of this validator switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EPackage getEPackage() {
return ProgramPackage.eINSTANCE;
}
/**
* Calls <code>validateXXX</code> for the corresponding classifier of the model.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) {
switch (classifierID) {
case ProgramPackage.PROGRAM:
return validateProgram((Program)value, diagnostics, context);
case ProgramPackage.SPECIALIZATION:
return validateSpecialization((Specialization)value, diagnostics, context);
case ProgramPackage.SEMESTER:
return validateSemester((Semester)value, diagnostics, context);
case ProgramPackage.SEMESTER_COURSE:
return validateSemesterCourse((SemesterCourse)value, diagnostics, context);
case ProgramPackage.COURSE:
return validateCourse((Course)value, diagnostics, context);
case ProgramPackage.DEPARTMENT:
return validateDepartment((Department)value, diagnostics, context);
case ProgramPackage.SEMESTER_STATUS:
return validateSemesterStatus((SemesterStatus)value, diagnostics, context);
case ProgramPackage.COURSE_STATUS:
return validateCourseStatus((CourseStatus)value, diagnostics, context);
default:
return true;
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateProgram(Program program, DiagnosticChain diagnostics, Map<Object, Object> context) {
return validate_EveryDefaultConstraint(program, diagnostics, context);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateSpecialization(Specialization specialization, DiagnosticChain diagnostics, Map<Object, Object> context) {
return validate_EveryDefaultConstraint(specialization, diagnostics, context);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateCourse(Course course, DiagnosticChain diagnostics, Map<Object, Object> context) {
if (!validate_NoCircularContainment(course, diagnostics, context)) return false;
boolean result = validate_EveryMultiplicityConforms(course, diagnostics, context);
if (result || diagnostics != null) result &= validate_EveryDataValueConforms(course, diagnostics, context);
if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(course, diagnostics, context);
if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(course, diagnostics, context);
if (result || diagnostics != null) result &= validate_EveryProxyResolves(course, diagnostics, context);
if (result || diagnostics != null) result &= validate_UniqueID(course, diagnostics, context);
if (result || diagnostics != null) result &= validate_EveryKeyUnique(course, diagnostics, context);
if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(course, diagnostics, context);
if (result || diagnostics != null) result &= validateCourse_minCredits(course, diagnostics, context);
if (result || diagnostics != null) result &= validateCourse_courseCodeFormat(course, diagnostics, context);
return result;
}
/**
* The cached validation expression for the minCredits constraint of '<em>Course</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static final String COURSE__MIN_CREDITS__EEXPRESSION = "self.credit->sum() >= 5.0";
/**
* Validates the minCredits constraint of '<em>Course</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateCourse_minCredits(Course course, DiagnosticChain diagnostics, Map<Object, Object> context) {
return
validate
(ProgramPackage.Literals.COURSE,
course,
diagnostics,
context,
"http://www.eclipse.org/acceleo/query/1.0",
"minCredits",
COURSE__MIN_CREDITS__EEXPRESSION,
Diagnostic.ERROR,
DIAGNOSTIC_SOURCE,
0);
}
/**
* Validates the courseCodeFormat constraint of '<em>Course</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean validateCourse_courseCodeFormat(Course course, DiagnosticChain diagnostics, Map<Object, Object> context) {
String pattern = "[A-Z]{2,3}[1-9]{4}";
if (!course.getCode().matches(pattern)) {
if (diagnostics != null) {
diagnostics.add
(createDiagnostic
(Diagnostic.ERROR,
DIAGNOSTIC_SOURCE,
0,
"_UI_GenericConstraint_diagnostic",
new Object[] { "courseCodeFormat", getObjectLabel(course, context) },
new Object[] { course },
context));
}
return false;
}
return true;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateDepartment(Department department, DiagnosticChain diagnostics, Map<Object, Object> context) {
return validate_EveryDefaultConstraint(department, diagnostics, context);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateSemesterStatus(SemesterStatus semesterStatus, DiagnosticChain diagnostics, Map<Object, Object> context) {
return true;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateSemester(Semester semester, DiagnosticChain diagnostics, Map<Object, Object> context) {
if (!validate_NoCircularContainment(semester, diagnostics, context)) return false;
boolean result = validate_EveryMultiplicityConforms(semester, diagnostics, context);
if (result || diagnostics != null) result &= validate_EveryDataValueConforms(semester, diagnostics, context);
if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(semester, diagnostics, context);
if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(semester, diagnostics, context);
if (result || diagnostics != null) result &= validate_EveryProxyResolves(semester, diagnostics, context);
if (result || diagnostics != null) result &= validate_UniqueID(semester, diagnostics, context);
if (result || diagnostics != null) result &= validate_EveryKeyUnique(semester, diagnostics, context);
if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(semester, diagnostics, context);
if (result || diagnostics != null) result &= validateSemester_min30Credits(semester, diagnostics, context);
return result;
}
/**
* The cached validation expression for the min30Credits constraint of '<em>Semester</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static final String SEMESTER__MIN30_CREDITS__EEXPRESSION = "self.semesterCourses.course.credit -> sum() >= 30.0";
/**
* Validates the min30Credits constraint of '<em>Semester</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateSemester_min30Credits(Semester semester, DiagnosticChain diagnostics, Map<Object, Object> context) {
return
validate
(ProgramPackage.Literals.SEMESTER,
semester,
diagnostics,
context,
"http://www.eclipse.org/acceleo/query/1.0",
"min30Credits",
SEMESTER__MIN30_CREDITS__EEXPRESSION,
Diagnostic.ERROR,
DIAGNOSTIC_SOURCE,
0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateSemesterCourse(SemesterCourse semesterCourse, DiagnosticChain diagnostics, Map<Object, Object> context) {
return validate_EveryDefaultConstraint(semesterCourse, diagnostics, context);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateCourseStatus(CourseStatus courseStatus, DiagnosticChain diagnostics, Map<Object, Object> context) {
return true;
}
/**
* Returns the resource locator that will be used to fetch messages for this validator's diagnostics.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ResourceLocator getResourceLocator() {
// TODO
// Specialize this to return a resource locator for messages specific to this validator.
// Ensure that you remove @generated or mark it @generated NOT
return super.getResourceLocator();
}
} //ProgramValidator
| [
"s315317@stud.hioa.no"
] | s315317@stud.hioa.no |
6b3eab7383d5fdf7e1c284f17fdfcf0b046f3a30 | 7a30b457f0c2b7fc278eb3e1e98be08d363c6af7 | /defaultSample/src/main/java/jhipster/reactive/web/rest/UserResource.java | 77323a800159b5abfe2b744371fdfc86344d00cd | [] | no_license | juliensadaoui/webflux-jhipster | dc3cc76fed7c8a261f9fc984c3ffdb448e278e46 | 2eba126fe877897837da07775af18c95f9606a30 | refs/heads/master | 2020-12-03T01:58:01.998434 | 2017-06-30T07:55:36 | 2017-06-30T07:55:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,876 | java | package jhipster.reactive.web.rest;
import jhipster.reactive.config.Constants;
import com.codahale.metrics.annotation.Timed;
import jhipster.reactive.domain.User;
import jhipster.reactive.repository.UserRepository;
import jhipster.reactive.security.AuthoritiesConstants;
import jhipster.reactive.service.MailService;
import jhipster.reactive.service.UserService;
import jhipster.reactive.service.dto.UserDTO;
import jhipster.reactive.web.rest.vm.ManagedUserVM;
import jhipster.reactive.web.rest.util.HeaderUtil;
import jhipster.reactive.web.rest.util.PaginationUtil;
import io.github.jhipster.web.util.ResponseUtil;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.annotation.Secured;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
/**
* REST controller for managing users.
*
* <p>This class accesses the User entity, and needs to fetch its collection of authorities.</p>
* <p>
* For a normal use-case, it would be better to have an eager relationship between User and Authority,
* and send everything to the client side: there would be no View Model and DTO, a lot less code, and an outer-join
* which would be good for performance.
* </p>
* <p>
* We use a View Model and a DTO for 3 reasons:
* <ul>
* <li>We want to keep a lazy association between the user and the authorities, because people will
* quite often do relationships with the user, and we don't want them to get the authorities all
* the time for nothing (for performance reasons). This is the #1 goal: we should not impact our users'
* application because of this use-case.</li>
* <li> Not having an outer join causes n+1 requests to the database. This is not a real issue as
* we have by default a second-level cache. This means on the first HTTP call we do the n+1 requests,
* but then all authorities come from the cache, so in fact it's much better than doing an outer join
* (which will get lots of data from the database, for each HTTP call).</li>
* <li> As this manages users, for security reasons, we'd rather have a DTO layer.</li>
* </ul>
* <p>Another option would be to have a specific JPA entity graph to handle this case.</p>
*/
@RestController
@RequestMapping("/api")
public class UserResource {
private final Logger log = LoggerFactory.getLogger(UserResource.class);
private static final String ENTITY_NAME = "userManagement";
private final UserRepository userRepository;
private final MailService mailService;
private final UserService userService;
public UserResource(UserRepository userRepository, MailService mailService,
UserService userService) {
this.userRepository = userRepository;
this.mailService = mailService;
this.userService = userService;
}
/**
* POST /users : Creates a new user.
* <p>
* Creates a new user if the login and email are not already used, and sends an
* mail with an activation link.
* The user needs to be activated on creation.
* </p>
*
* @param managedUserVM the user to create
* @return the ResponseEntity with status 201 (Created) and with body the new user, or with status 400 (Bad Request) if the login or email is already in use
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/users")
@Timed
@Secured(AuthoritiesConstants.ADMIN)
public ResponseEntity createUser(@Valid @RequestBody ManagedUserVM managedUserVM) throws URISyntaxException {
log.debug("REST request to save User : {}", managedUserVM);
if (managedUserVM.getId() != null) {
return ResponseEntity.badRequest()
.headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "idexists", "A new user cannot already have an ID"))
.body(null);
// Lowercase the user login before comparing with database
} else if (userRepository.findOneByLogin(managedUserVM.getLogin().toLowerCase()).isPresent()) {
return ResponseEntity.badRequest()
.headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "userexists", "Login already in use"))
.body(null);
} else if (userRepository.findOneByEmail(managedUserVM.getEmail()).isPresent()) {
return ResponseEntity.badRequest()
.headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "emailexists", "Email already in use"))
.body(null);
} else {
User newUser = userService.createUser(managedUserVM);
mailService.sendCreationEmail(newUser);
return ResponseEntity.created(new URI("/api/users/" + newUser.getLogin()))
.headers(HeaderUtil.createAlert( "A user is created with identifier " + newUser.getLogin(), newUser.getLogin()))
.body(newUser);
}
}
/**
* PUT /users : Updates an existing User.
*
* @param managedUserVM the user to update
* @return the ResponseEntity with status 200 (OK) and with body the updated user,
* or with status 400 (Bad Request) if the login or email is already in use,
* or with status 500 (Internal Server Error) if the user couldn't be updated
*/
@PutMapping("/users")
@Timed
@Secured(AuthoritiesConstants.ADMIN)
public ResponseEntity<UserDTO> updateUser(@Valid @RequestBody ManagedUserVM managedUserVM) {
log.debug("REST request to update User : {}", managedUserVM);
Optional<User> existingUser = userRepository.findOneByEmail(managedUserVM.getEmail());
if (existingUser.isPresent() && (!existingUser.get().getId().equals(managedUserVM.getId()))) {
return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "emailexists", "Email already in use")).body(null);
}
existingUser = userRepository.findOneByLogin(managedUserVM.getLogin().toLowerCase());
if (existingUser.isPresent() && (!existingUser.get().getId().equals(managedUserVM.getId()))) {
return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "userexists", "Login already in use")).body(null);
}
Optional<UserDTO> updatedUser = userService.updateUser(managedUserVM);
return ResponseUtil.wrapOrNotFound(updatedUser,
HeaderUtil.createAlert("A user is updated with identifier " + managedUserVM.getLogin(), managedUserVM.getLogin()));
}
/**
* GET /users : get all users.
*
* @param pageable the pagination information
* @return the ResponseEntity with status 200 (OK) and with body all users
*/
@GetMapping("/users")
@Timed
public ResponseEntity<List<UserDTO>> getAllUsers(@ApiParam Pageable pageable) {
final Page<UserDTO> page = userService.getAllManagedUsers(pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/users");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
/**
* @return a string list of the all of the roles
*/
@GetMapping("/users/authorities")
@Timed
@Secured(AuthoritiesConstants.ADMIN)
public List<String> getAuthorities() {
return userService.getAuthorities();
}
/**
* GET /users/:login : get the "login" user.
*
* @param login the login of the user to find
* @return the ResponseEntity with status 200 (OK) and with body the "login" user, or with status 404 (Not Found)
*/
@GetMapping("/users/{login:" + Constants.LOGIN_REGEX + "}")
@Timed
public ResponseEntity<UserDTO> getUser(@PathVariable String login) {
log.debug("REST request to get User : {}", login);
return ResponseUtil.wrapOrNotFound(
userService.getUserWithAuthoritiesByLogin(login)
.map(UserDTO::new));
}
/**
* DELETE /users/:login : delete the "login" User.
*
* @param login the login of the user to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/users/{login:" + Constants.LOGIN_REGEX + "}")
@Timed
@Secured(AuthoritiesConstants.ADMIN)
public ResponseEntity<Void> deleteUser(@PathVariable String login) {
log.debug("REST request to delete User: {}", login);
userService.deleteUser(login);
return ResponseEntity.ok().headers(HeaderUtil.createAlert( "A user is deleted with identifier " + login, login)).build();
}
}
| [
"julien.margarido@gmail.com"
] | julien.margarido@gmail.com |
0ba36c072be7fb36682f9c8bc8a89c17ded75e76 | 0f5e788411b74934febdcfe21811e7c0ee4a6307 | /src/com/Person.java | 09c75859184b5a2bec7823c90abd162eac35ccc4 | [] | no_license | qyqianyou/rep2 | 90357f49b44efd9d1254c755dbb0b8553ed2a626 | cbd965dcb38549cd13aceb1ea66931dcb0b4151c | refs/heads/master | 2022-12-01T11:04:08.048092 | 2020-08-16T02:18:23 | 2020-08-16T02:18:23 | 287,701,088 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 81 | java | package com;
public class Person {
private int age;
private String email;
}
| [
"lubianxiaolang@163.com"
] | lubianxiaolang@163.com |
f64be5b249c01efc13a7f6fb8e2a0f79c4d0b8c3 | 7230397ff76798f4e2e5ea4ad2227a1c02fe3a80 | /src/main/java/com/sapient/test/validator/ValidationRule.java | 3e2329badad860d8d1dfd0a978c8f464fdf60f22 | [] | no_license | tddfan/credit-card-system-server | f3b2b6d0df0e6c53d5466112f1d6971dfc4c3004 | 709297c88a501d8526611ef4fba7665e6517cee6 | refs/heads/master | 2020-03-28T00:32:00.899849 | 2018-09-06T20:42:17 | 2018-09-06T20:42:17 | 147,426,359 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 182 | java | package com.sapient.test.validator;
import com.sapient.test.entity.ValidationResultItem;
public interface ValidationRule<T> {
public ValidationResultItem validate(T entity);
}
| [
"sanjay.gemini@gmail.com"
] | sanjay.gemini@gmail.com |
b036f8ac7e8cdf46345a4eabe11b038e5093e534 | c4e33542d65b2d55e98b4a177876f50c0c3b13b9 | /Practice1Project/src/com/anil/practice/StrPgm1.java | 4dba130841f0285a30a5741dcdc0f67d077aa897 | [] | no_license | anilfelix/GeneralPractice | 7dbc20ba4731025b9c47fb4cae5a485cd4c63572 | 0f85af2776aeb2c882a9418c956d6322901dca19 | refs/heads/master | 2021-01-01T05:49:37.506969 | 2015-09-06T08:41:28 | 2015-09-06T08:41:28 | 41,995,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 674 | java | package com.anil.practice;
/**
* Created by This1 on 25/08/2015.
*/
public class StrPgm1 {
public static void main(String[] args) {
String s1 = "this is string 1 ";
System.out.println(s1);
String s2 = new String("this is string 2");
System.out.println(s2);
String s3 = "Shirt Size";
String s4 = ": M";
String s5 = s3 + s4 + " of bro " + "1234";
System.out.println(s5);
char[] c1 = {'H', 'e', 'l', 'l', 'o'};
String sc1 = new String(c1);
System.out.println(sc1);
char[] c2 = sc1.toCharArray();
for(char x : c2)
System.out.print(x);
}
}
| [
"anil2anil@gmail.com"
] | anil2anil@gmail.com |
cf84dfde73b9bf85129281168c83d334f161a751 | 62257eb8aca473ec5d0b2a0bfe22f12e00e5c5a8 | /Exam-6-final-jdbc-uml/UML..UML/AbdullahEvedence/Inventory/src/inventory/Main.java | 58513f8f1ebd1321aaeca908d47ff807cb3847b5 | [] | no_license | springapidev/uml | e29bacdbf67748adfa5eadba2cabbaebca4e369a | 6f59f1c34dd35428f032faa006b9733138960c0a | refs/heads/master | 2021-10-01T00:09:13.491179 | 2018-11-26T06:50:51 | 2018-11-26T06:50:51 | 112,941,252 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 299 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package inventory;
/**
*
* @author Administrator
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
}
}
| [
"springapidev@gmail.com"
] | springapidev@gmail.com |
df3e8d9d616ed82d86efae6219359b10498ee262 | 6ba82508e5a0ab0ed6214a8e76200c6b11c5f227 | /src/system/leapmotion/gesture/TwoFingerGesture.java | 39f2ac9e6434ddc7c5c046164a3f665501ffecfd | [] | no_license | AndyTsangChun/UoB_LeapVisualizationSystem | 3c0aadaf3c12f2a1c07e41a88bc7ac2f28c73704 | c5c3db25c3df2532201538812c6a7838984c7c29 | refs/heads/master | 2020-04-06T04:14:40.229018 | 2017-02-24T10:15:27 | 2017-02-24T10:15:27 | 83,026,020 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,804 | java | package system.leapmotion.gesture;
import system.controller.GestureController;
import system.leapmotion.gesture.util.CustomGestureType;
import system.model.StaticGesture;
import system.res.SystemTextureManager;
import ui.awt.res.LVSStringInfo;
/** ************************************************************
* This is a object class extend from custom gesture.
* The two finger gesture requires major hand only where index
* and middle finger is extended.
*
* @author Andy Tsang
* @version 1.2
* ***********************************************************/
public class TwoFingerGesture extends StaticGesture {
public TwoFingerGesture(GestureController gestureController) {
super(CustomGestureType.TWO_FINGER_GESTURE, gestureController, SystemTextureManager.TWO_FINGER_GESTURE_IMAGE, LVSStringInfo.OP_ZOOM);
super.setRecogniseThreshold(10);
}
@Override
public boolean checkFinger() {
boolean[] extended = super.getGestureController().getSystemController().getLeapMotionFrameController().getStyleHandIsExtended();
boolean check_hand = false;
// Check is all fingers is not extended
check_hand = !extended[0] && extended[1] && extended[2] && !extended[3] && !extended[4];
return check_hand;
}
@Override
public boolean checkPost() {
return true;
}
@Override
public void performAction() {
if (super.printTest() && super.isEnable()) {
System.out.println(super.getGestureName());
}
if (super.checkRecogniseThreshold() && super.isEnable()) {
//super.getGestureController().getSystemController().getCursorController().moveMouse(super.getFrame());
//super.getGestureController().getSystemController().getCursorController().scrollMouse(super.getFrame());
super.getGestureController().getSystemController().getVTKCameraController().zoom();
}
}
}
| [
"atc1992andy@gmail.com"
] | atc1992andy@gmail.com |
9d697b351feca861c84938f721c43b4bf0b6fb1d | eae576961cbe7d20fbce29e9853454bc2aeaad26 | /src/br/com/linkcom/sgm/beans/RequisitoNorma.java | 2039454e33222c3038490d991959dfcd30f19394 | [] | no_license | ardolazarini/geplanes | 81d8ab79f86c2dc27c8204fca1a45a799188f3c4 | c1ea5fc1c848dd03875616a9b6cf078cec429254 | refs/heads/master | 2020-12-25T22:48:34.361010 | 2012-02-13T20:07:53 | 2012-02-13T20:07:53 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 3,872 | java | /*
Copyright 2007,2008,2009,2010 da Linkcom Informática Ltda
Este arquivo é parte do programa GEPLANES.
O GEPLANES é software livre; você pode redistribuí-lo e/ou
modificá-lo sob os termos da Licença Pública Geral GNU, conforme
publicada pela Free Software Foundation; tanto a versão 2 da
Licença como (a seu critério) qualquer versão mais nova.
Este programa é distribuído na expectativa de ser útil, mas SEM
QUALQUER GARANTIA; sem mesmo a garantia implícita de
COMERCIALIZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR.
Consulte a Licença Pública Geral GNU para obter mais detalhes.
Você deve ter recebido uma cópia da Licença Pública Geral GNU
junto com este programa; se não, escreva para a Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307, USA.
*/
package br.com.linkcom.sgm.beans;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Transient;
import br.com.linkcom.neo.bean.annotation.DescriptionProperty;
import br.com.linkcom.neo.bean.annotation.DisplayName;
import br.com.linkcom.neo.validation.annotation.MaxLength;
import br.com.linkcom.neo.validation.annotation.Required;
@Entity
@SequenceGenerator(name = "sq_requisitonorma", sequenceName = "sq_requisitonorma")
public class RequisitoNorma implements Comparable<RequisitoNorma> {
private Integer id;
private Norma norma;
private String descricao;
private String indice;
//=========================Get e Set==================================//
@Id
@GeneratedValue(strategy=GenerationType.AUTO, generator="sq_requisitonorma")
public Integer getId() {
return id;
}
@Required
@ManyToOne(fetch=FetchType.LAZY)
public Norma getNorma() {
return norma;
}
@MaxLength(500)
@DisplayName("Descrição")
@Required
public String getDescricao() {
return descricao;
}
@MaxLength(20)
@DisplayName("Índice")
@Required
public String getIndice() {
return indice;
}
public void setId(Integer id) {
this.id = id;
}
public void setNorma(Norma norma) {
this.norma = norma;
}
public void setDescricao(String descricao) {
this.descricao = descricao;
}
public void setIndice(String indice) {
this.indice = indice;
}
@Transient
@DescriptionProperty
public String getDescricaoCompleta() {
return indice + " " + (descricao != null && descricao.length() > 80 ? descricao.substring(0, 80) + "..." : descricao);
}
public int compareTo(RequisitoNorma that) {
if (this.getIndice() != null && that.getIndice() != null) {
String[] thisFields = this.getIndice().split("\\.");
String[] thatFields = that.getIndice().split("\\.");
Integer thisField;
Integer thatField;
int count = thisFields.length < thatFields.length ? thisFields.length : thatFields.length;
for (int i = 0; i < count; i++) {
try {
thisField = Integer.parseInt(thisFields[i]);
}
catch (NumberFormatException e) {
thisField = (int) thisFields[i].charAt(0);
}
try {
thatField = Integer.parseInt(thatFields[i]);
}
catch (NumberFormatException e) {
thatField = (int) thatFields[i].charAt(0);
}
if (thisField.compareTo(thatField) != 0) {
return thisField.compareTo(thatField);
}
}
// Caso os pedaços comparados sejam iguais, o menor número é o que tiver menor quantidade de pedaços.
// Ex: 1 < 1.1
return thisFields.length < thatFields.length ? -1 : 1;
}
return 0;
}
}
| [
"publicosoftware@gmail.com"
] | publicosoftware@gmail.com |
940a795112ccbebbb06f3169171c6d4a8576d1cd | e80af7e7c2e3a1585211c66828d7b683fe6527e4 | /src/innerClassUse/DotNew.java | 093a631a5910c799c8e372b2b365a5f634bbaacb | [] | no_license | kangkang94/JVM | 9806a22cdc09eb289db3c198cc8d8d451eb192b2 | eb5af2c18dd04dda976298ba09bbb484dacb17ec | refs/heads/master | 2021-01-19T00:21:24.818355 | 2017-09-29T01:51:08 | 2017-09-29T01:51:08 | 87,160,835 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 448 | java | package innerClassUse;
/**
* Created by kang on 17/4/18.
*/
public class DotNew {
public class Inner{
public Inner(int i){
System.out.println(i);
}
}
//产生内部类
public Inner getInner(){
return new Inner(1);
}
public static void main(String[] args) {
DotNew dotNew = new DotNew();
DotNew.Inner inner = dotNew.new Inner(2);
dotNew.getInner();
}
}
| [
"k1063178819@gmail.com"
] | k1063178819@gmail.com |
c248c9b1b065a82fda2378546e9d4a0532a0e7bd | c4343ca206aca18e59249c654566b53700d0c252 | /src/com/vikisolutions/www/EnumerationsDocumentType.java | 2cccff97d6ea21add33427c55926dc058e47797e | [] | no_license | go2irfankhan/VikiSalesforce | 961389a42ede1c430d6301894cc61e2ee2cb67d8 | 612333d2959a8dbb4daa8287aa943108eacbebd0 | refs/heads/master | 2021-01-25T10:15:14.157756 | 2015-08-04T11:49:34 | 2015-08-04T11:49:34 | 40,128,140 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,142 | java |
/**
* EnumerationsDocumentType.java
*
* This file was auto-generated from WSDL
* by the Apache Axis2 version: 1.6.2 Built on : Apr 17, 2012 (05:34:40 IST)
*/
package com.vikisolutions.www;
/**
* EnumerationsDocumentType bean class
*/
@SuppressWarnings({"unchecked","unused"})
public class EnumerationsDocumentType
implements org.apache.axis2.databinding.ADBBean{
public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
"http://www.vikisolutions.com/",
"EnumerationsDocumentType",
"ns1");
/**
* field for EnumerationsDocumentType
*/
protected java.lang.String localEnumerationsDocumentType ;
private static java.util.HashMap _table_ = new java.util.HashMap();
// Constructor
protected EnumerationsDocumentType(java.lang.String value, boolean isRegisterValue) {
localEnumerationsDocumentType = value;
if (isRegisterValue){
_table_.put(localEnumerationsDocumentType, this);
}
}
public static final java.lang.String _Proof =
org.apache.axis2.databinding.utils.ConverterUtil.convertToString("Proof");
public static final java.lang.String _Reference =
org.apache.axis2.databinding.utils.ConverterUtil.convertToString("Reference");
public static final EnumerationsDocumentType Proof =
new EnumerationsDocumentType(_Proof,true);
public static final EnumerationsDocumentType Reference =
new EnumerationsDocumentType(_Reference,true);
public java.lang.String getValue() { return localEnumerationsDocumentType;}
public boolean equals(java.lang.Object obj) {return (obj == this);}
public int hashCode() { return toString().hashCode();}
public java.lang.String toString() {
return localEnumerationsDocumentType.toString();
}
/**
*
* @param parentQName
* @param factory
* @return org.apache.axiom.om.OMElement
*/
public org.apache.axiom.om.OMElement getOMElement (
final javax.xml.namespace.QName parentQName,
final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{
org.apache.axiom.om.OMDataSource dataSource =
new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME);
return factory.createOMElement(dataSource,MY_QNAME);
}
public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
serialize(parentQName,xmlWriter,false);
}
public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter,
boolean serializeType)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
//We can safely assume an element has only one type associated with it
java.lang.String namespace = parentQName.getNamespaceURI();
java.lang.String _localName = parentQName.getLocalPart();
writeStartElement(null, namespace, _localName, xmlWriter);
// add the type details if this is used in a simple type
if (serializeType){
java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.vikisolutions.com/");
if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
namespacePrefix+":EnumerationsDocumentType",
xmlWriter);
} else {
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
"EnumerationsDocumentType",
xmlWriter);
}
}
if (localEnumerationsDocumentType==null){
throw new org.apache.axis2.databinding.ADBException("EnumerationsDocumentType cannot be null !!");
}else{
xmlWriter.writeCharacters(localEnumerationsDocumentType);
}
xmlWriter.writeEndElement();
}
private static java.lang.String generatePrefix(java.lang.String namespace) {
if(namespace.equals("http://www.vikisolutions.com/")){
return "ns1";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
/**
* Utility method to write an element start tag.
*/
private void writeStartElement(java.lang.String prefix, java.lang.String namespace, java.lang.String localPart,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(namespace, localPart);
} else {
if (namespace.length() == 0) {
prefix = "";
} else if (prefix == null) {
prefix = generatePrefix(namespace);
}
xmlWriter.writeStartElement(prefix, localPart, namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
}
/**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
xmlWriter.writeAttribute(namespace,attName,attValue);
}
/**
* Util method to write an attribute without the ns prefix
*/
private void writeAttribute(java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace,attName,attValue);
}
}
/**
* Util method to write an attribute without the ns prefix
*/
private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName,
javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String attributeNamespace = qname.getNamespaceURI();
java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
}
java.lang.String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue = attributePrefix + ":" + qname.getLocalPart();
} else {
attributeValue = qname.getLocalPart();
}
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attributeValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attributeValue);
}
}
/**
* method to handle Qnames
*/
private void writeQName(javax.xml.namespace.QName qname,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
}
if (prefix.trim().length() > 0){
xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} else {
// i.e this is the default namespace
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
} else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
}
private void writeQNames(javax.xml.namespace.QName[] qnames,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
// namespace data after writing the charactor data
java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
java.lang.String namespaceURI = null;
java.lang.String prefix = null;
for (int i = 0; i < qnames.length; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || (prefix.length() == 0)) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
}
if (prefix.trim().length() > 0){
stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
}
}
/**
* Register a namespace prefix
*/
private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = generatePrefix(namespace);
javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
while (true) {
java.lang.String uri = nsContext.getNamespaceURI(prefix);
if (uri == null || uri.length() == 0) {
break;
}
prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
}
/**
* databinding method to get an XML representation of this object
*
*/
public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)
throws org.apache.axis2.databinding.ADBException{
//We can safely assume an element has only one type associated with it
return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(MY_QNAME,
new java.lang.Object[]{
org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT,
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localEnumerationsDocumentType)
},
null);
}
/**
* Factory class that keeps the parse method
*/
public static class Factory{
public static EnumerationsDocumentType fromValue(java.lang.String value)
throws java.lang.IllegalArgumentException {
EnumerationsDocumentType enumeration = (EnumerationsDocumentType)
_table_.get(value);
if ((enumeration == null) && !((value == null) || (value.equals("")))) {
throw new java.lang.IllegalArgumentException();
}
return enumeration;
}
public static EnumerationsDocumentType fromString(java.lang.String value,java.lang.String namespaceURI)
throws java.lang.IllegalArgumentException {
try {
return fromValue(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(value));
} catch (java.lang.Exception e) {
throw new java.lang.IllegalArgumentException();
}
}
public static EnumerationsDocumentType fromString(javax.xml.stream.XMLStreamReader xmlStreamReader,
java.lang.String content) {
if (content.indexOf(":") > -1){
java.lang.String prefix = content.substring(0,content.indexOf(":"));
java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix);
return EnumerationsDocumentType.Factory.fromString(content,namespaceUri);
} else {
return EnumerationsDocumentType.Factory.fromString(content,"");
}
}
/**
* static method to create the object
* Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
* If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
* Postcondition: If this object is an element, the reader is positioned at its end element
* If this object is a complex type, the reader is positioned at the end element of its outer element
*/
public static EnumerationsDocumentType parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
EnumerationsDocumentType object = null;
// initialize a hash map to keep values
java.util.Map attributeMap = new java.util.HashMap();
java.util.List extraAttributeList = new java.util.ArrayList<org.apache.axiom.om.OMAttribute>();
int event;
java.lang.String nillableValue = null;
java.lang.String prefix ="";
java.lang.String namespaceuri ="";
try {
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
// Note all attributes that were handled. Used to differ normal attributes
// from anyAttributes.
java.util.Vector handledAttributes = new java.util.Vector();
while(!reader.isEndElement()) {
if (reader.isStartElement() || reader.hasText()){
nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
if ("true".equals(nillableValue) || "1".equals(nillableValue)){
throw new org.apache.axis2.databinding.ADBException("The element: "+"EnumerationsDocumentType" +" cannot be null");
}
java.lang.String content = reader.getElementText();
if (content.indexOf(":") > 0) {
// this seems to be a Qname so find the namespace and send
prefix = content.substring(0, content.indexOf(":"));
namespaceuri = reader.getNamespaceURI(prefix);
object = EnumerationsDocumentType.Factory.fromString(content,namespaceuri);
} else {
// this seems to be not a qname send and empty namespace incase of it is
// check is done in fromString method
object = EnumerationsDocumentType.Factory.fromString(content,"");
}
} else {
reader.next();
}
} // end of while loop
} catch (javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
}
return object;
}
}//end of factory class
}
| [
"irfank@appcino.com"
] | irfank@appcino.com |
a9a405f35e7131d34a019cf91bcc39fcbd54efbd | eb225ababb916153c3aa97b03252ad104095b48b | /src/test/java/com/SmartCredit/HomePage_SmartCredit_page.java | a1b40dbde6742e5f44d00be021229f01cb8edac8 | [] | no_license | Durga-rao-123/POM-With-BDD-Cucumber- | 32a264ce0fde599ce0b3f4338da1231d18ba5ca1 | da0ada8a07a02cbfe34d25cf246f0ee98566d542 | refs/heads/master | 2022-12-29T07:26:38.234176 | 2020-05-29T10:25:05 | 2020-05-29T10:25:05 | 267,766,625 | 0 | 0 | null | 2020-10-13T22:25:01 | 2020-05-29T04:42:02 | Java | UTF-8 | Java | false | false | 561 | java | package com.SmartCredit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class HomePage_SmartCredit_page
{
WebDriver driver;
@FindBy(xpath = "//span[contains(text(),'Add a New Client')]")
WebElement clickOnAddNewClient;
public HomePage_SmartCredit_page(WebDriver driver)
{
this.driver = driver;
PageFactory.initElements(driver, this);
}
public void clickon_AddnewClient()
{
clickOnAddNewClient.click();
}
}
| [
"m_ratnam@creditrepaircloud.com"
] | m_ratnam@creditrepaircloud.com |
8d447916303135e0f1263e83faf0fba460e1c466 | bc527be4081720b0414d779959dee2f8373e0580 | /app/src/main/java/com/jingchengsoft/dzjplatform/other/GlideEngine.java | e4d080273545534a04b83cbd1a5a73ba773e913d | [] | no_license | guangpu/dzjplatform | 79ba7e55cbc3e9158b7610151538bfd35ba2e91a | 3149e8da183ffed385973ac8025c758ab7099e6b | refs/heads/master | 2022-04-15T23:53:20.712508 | 2020-04-03T09:14:36 | 2020-04-03T09:14:36 | 245,933,661 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,874 | java | package com.jingchengsoft.dzjplatform.other;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import com.bumptech.glide.Glide;
import com.huantansheng.easyphotos.engine.ImageEngine;
import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade;
/**
* @author MaybeSix
* @date 2019/9/6
* @desc TODO.
*/
public class GlideEngine implements ImageEngine {
//单例
private static GlideEngine instance = null;
//单例模式,私有构造方法
private GlideEngine() {
}
//获取单例
public static GlideEngine getInstance() {
if (null == instance) {
synchronized (GlideEngine.class) {
if (null == instance) {
instance = new GlideEngine();
}
}
}
return instance;
}
/**
* 加载图片到ImageView
*
* @param context 上下文
* @param uri 图片路径
* @param imageView 加载到的ImageView
*/
@Override
public void loadPhoto(@NonNull Context context, @NonNull Uri uri, @NonNull ImageView imageView) {
Glide.with(context).load(uri).transition(withCrossFade()).into(imageView);
}
/**
* 加载gif动图图片到ImageView,gif动图不动
*
* @param context 上下文
* @param gifUri gif动图路径
* @param imageView 加载到的ImageView
* <p>
* 备注:不支持动图显示的情况下可以不写
*/
@Override
public void loadGifAsBitmap(@NonNull Context context, @NonNull Uri gifUri, @NonNull ImageView imageView) {
Glide.with(context).asBitmap().load(gifUri).into(imageView);
}
/**
* 加载gif动图到ImageView,gif动图动
*
* @param context 上下文
* @param gifUri gif动图路径
* @param imageView 加载动图的ImageView
* <p>
* 备注:不支持动图显示的情况下可以不写
*/
@Override
public void loadGif(@NonNull Context context, @NonNull Uri gifUri, @NonNull ImageView imageView) {
Glide.with(context).asGif().load(gifUri).transition(withCrossFade()).into(imageView);
}
/**
* 获取图片加载框架中的缓存Bitmap
*
* @param context 上下文
* @param uri 图片路径
* @param width 图片宽度
* @param height 图片高度
* @return Bitmap
* @throws Exception 异常直接抛出,EasyPhotos内部处理
*/
@Override
public Bitmap getCacheBitmap(@NonNull Context context, @NonNull Uri uri, int width, int height) throws Exception {
return Glide.with(context).asBitmap().load(uri).submit(width, height).get();
}
}
| [
"guangpu@outlook.com"
] | guangpu@outlook.com |
1c03ed0c2c67dbd7cf95d9aee153fdc6b7af0c4f | d59381d990eec206e7b001979714bac2d3da415e | /app/src/main/java/com/cb/basic/base/api/BaseApi.java | 036eaf27ca0df84c7576da6d93051f1becb84276 | [] | no_license | thatCbin/Basic | 56af101f0a6bf2937385a0b5e8609eeb55b75476 | 105c35016198dd2ae6eecb666153d5467aa703b1 | refs/heads/master | 2020-12-02T15:09:15.821595 | 2020-03-17T10:11:44 | 2020-03-17T10:11:44 | 231,044,780 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,211 | java | package com.cb.basic.base.api;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.converter.scalars.ScalarsConverterFactory;
/**
* create date on 2019/12/31
*
* @author Cbin
* describe 封装基础的Retrofit
*/
public abstract class BaseApi {
/**
* 初始化Retrofit
*/
public Retrofit initRetrofit(String baseUrl) {
Retrofit.Builder builder = new Retrofit.Builder();
//支持返回Call<String>
builder.addConverterFactory(ScalarsConverterFactory.create());
//支持直接格式化json返回Bean对象
builder.addConverterFactory(GsonConverterFactory.create());
//支持RxJava
builder.addCallAdapterFactory(RxJava2CallAdapterFactory.create());
builder.baseUrl(baseUrl);
OkHttpClient client = setClient();
if (client != null) {
builder.client(client);
}
return builder.build();
}
/**
* 设置OkHttpClient,添加拦截器等
*
* @return 可以返回为null
*/
protected abstract OkHttpClient setClient();
}
| [
"1172816325@qq.com"
] | 1172816325@qq.com |
11bd1101a320ad275a3613f4d49988c6c70f07bc | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/5/5_3b6597eb4e921fc94856206f0ed786702f02fc25/StackingET/5_3b6597eb4e921fc94856206f0ed786702f02fc25_StackingET_s.java | 2d1f35222609764df669b47048f78e2ffab2862f | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 1,792 | java | package techniques;
import java.util.List;
import org.encog.ensemble.EnsembleAggregator;
import org.encog.ensemble.EnsembleMLMethodFactory;
import org.encog.ensemble.EnsembleTrainFactory;
import org.encog.ensemble.bagging.Bagging;
import org.encog.ensemble.stacking.Stacking;
import org.encog.ml.data.MLData;
import helpers.DataLoader;
import helpers.ChainParams;
public class StackingET extends EvaluationTechnique {
private int dataSetSize;
public StackingET(List<Integer> sizes, int dataSetSize, ChainParams fullLabel, EnsembleMLMethodFactory mlMethod, EnsembleTrainFactory trainFactory, EnsembleAggregator aggregator) {
this.sizes = sizes;
this.dataSetSize = dataSetSize;
this.label = fullLabel;
this.mlMethod = mlMethod;
this.trainFactory = trainFactory;
this.aggregator = aggregator;
}
@Override
public void init(DataLoader dataLoader, int fold) {
ensemble = new Stacking(sizes.get(currentSizeIndex),dataSetSize,mlMethod,trainFactory,aggregator);
setTrainingSet(dataLoader.getTrainingSet(fold));
setSelectionSet(dataLoader.getTestSet(fold));
ensemble.setTrainingData(trainingSet);
}
@Override
public void trainStep() {
((Bagging) ensemble).trainStep();
}
@Override
public MLData compute(MLData input) {
return ensemble.compute(input);
}
@Override
public void step(boolean verbose) {
if (currentSizeIndex < sizes.size() -1) {
for (int i = sizes.get(currentSizeIndex++); i < sizes.get(currentSizeIndex); i++) {
ensemble.addNewMember();
ensemble.trainMember(i, trainToError, selectionError, selectionSet, verbose);
}
ensemble.getAggregator().train();
} else {
this.hasStepsLeft = false;
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
527e0f48feedfbb144509fdee973493005aec290 | 7fbbb883c19586b3894716b384eaadff1b439fd1 | /xsbweb/src/com/xsbweb/service/impl/LoginRegisterServiceImpl.java | cfae220e14147f4c73bb3fecdd334159b07d5f48 | [] | no_license | cike863/testgit | d782e8042b43fc2c8df953c224393db3f7abf967 | c1410f23d975d663823c41b63903c33b5e3b9118 | refs/heads/master | 2021-01-10T13:43:16.440276 | 2016-03-29T08:37:54 | 2016-03-29T08:37:54 | 54,363,422 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,575 | java | package com.xsbweb.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import com.xsbweb.common.bean.DataBaseConstant;
import com.xsbweb.controller.app.AppLoginRegistController;
import com.xsbweb.mapper.CustomerMapper;
import com.xsbweb.mapper.StaffMapper;
import com.xsbweb.service.LoginRegisterService;
import com.xsbweb.util.MultipleDataSource;
import com.xsbweb.util.XsbBusinessUtil;
import com.xsbweb.vo.Customer;
import com.xsbweb.vo.Staff;
import com.xsbweb.vo.extend.*;
public class LoginRegisterServiceImpl implements LoginRegisterService {
private Logger log = Logger.getLogger(LoginRegisterServiceImpl.class);
@Autowired
private CustomerMapper customerMapper;
@Autowired
private StaffMapper staffMapper;
/**
* 用来校验登录信息
* @return 用户ID
* @throws Exception
*/
@Override
public CustomerVO validateLogin(CustomerVO customerVO) throws Exception {
MultipleDataSource.setDataSourceKey(DataBaseConstant.OLTP);
Map<String, Object> param = new HashMap<String, Object>();
param.put("customerUname", customerVO.getCustomerUname());
param.put("customerPassword", customerVO.getCustomerPassword());
param.put("ip", customerVO.getIp());
param.put("loginMethod", customerVO.getLoginMethod());
param.put("prcFlag", null);
//param.put("failedCounts", null);
param.put("customerId", null);
customerMapper.validateLogin(param);
CustomerVO cVO = new CustomerVO();
cVO.setCustomerId((String)param.get("customerId"));
cVO.setPrcFlag((Integer)param.get("prcFlag"));
return cVO;
}
/**
* 根据用户名ID获取用户信息
* @return
* @throws Exception
*/
@Override
public CustomerVO getCustomerById(String customerId) throws Exception {
MultipleDataSource.setDataSourceKey(DataBaseConstant.OLTP);
List<CustomerVO> customerVOList = customerMapper.getCustomerById(customerId);
if(customerVOList == null || customerVOList.isEmpty()){
return null;
}
return customerVOList.get(0);
}
/**
* 用来校验注册信息
* @return 用户ID
* @throws Exception
*/
@Override
public Integer validateRegister(CustomerVO customerVO) throws Exception {
MultipleDataSource.setDataSourceKey(DataBaseConstant.OLTP);
Map<String, Object> param = new HashMap<String, Object>();
param.put("customerPhoneNo", customerVO.getCustomerPhoneNo());
param.put("customerEmail", customerVO.getCustomerEmail());
param.put("prcFlag", null);
customerMapper.validateRegister(param);
return (Integer)param.get("prcFlag");
}
@Override
public Integer register(CustomerVO customerVO) throws Exception {
MultipleDataSource.setDataSourceKey(DataBaseConstant.OLTP);
Map<String, Object> param = XsbBusinessUtil.initCustomerParam(customerVO);
customerMapper.addCustomer(param);
return (Integer)param.get("prcFlag");
}
@Override
public Integer updateCustomerInfo(CustomerVO customerVO) throws Exception {
MultipleDataSource.setDataSourceKey(DataBaseConstant.OLTP);
Map<String, Object> param = XsbBusinessUtil.initCustomerParam(customerVO);
customerMapper.addCustomer(param);
return (Integer)param.get("prcFlag");
}
@Override
public Integer updatePassword(CustomerVO customerVO) throws Exception {
// TODO Auto-generated method stub
MultipleDataSource.setDataSourceKey(DataBaseConstant.OLTP);
Map<String, Object> param = XsbBusinessUtil.initCustomerParam(customerVO);
customerMapper.addCustomer(param);
return (Integer)param.get("prcFlag");
}
@Override
public String getCustomerIdByPhoneOrMail(String customerLabel)
throws Exception {
MultipleDataSource.setDataSourceKey(DataBaseConstant.OLTP);
Map<String, Object> param = new HashMap<String, Object>();
param.put("customerLabel", customerLabel);
param.put("customerId", null);
customerMapper.getCustomerIdByPhoneOrMail(param);
return (String)param.get("customerId");
}
@Override
public List<String> getRoleEnumByCustomerId(String customerId)
throws Exception {
MultipleDataSource.setDataSourceKey(DataBaseConstant.OLTP);
Map<String, Object> param = new HashMap<String, Object>();
param.put("customerId", customerId);
param.put("prcFlag", null);
List<String> list = customerMapper.getRoleEnumByCustomerId(param);
return list;
}
@Override
public List<CustomerVO> getCustomerListByIds(CustomerVO customerVO) throws Exception {
MultipleDataSource.setDataSourceKey(DataBaseConstant.OLTP);
return customerMapper.getCustomerListByIds(customerVO);
}
}
| [
"cike863@sina.cn"
] | cike863@sina.cn |
bf1055f426b682c35138a49b5587df35e1cdf36b | 0617762d785c80fb9095dbe7032ade446eab31c5 | /app/src/main/java/com/swarmy/swarmy/DevicesLoader.java | a3ec50a7b38d100ab0d5f77ab64e3976776bca99 | [] | no_license | zalsader/swarmy-android | e80a841d47c2baa45a4ad9422c4cbeac489d8575 | a5d7bdcb001c8743193024b80dd9916c030251f0 | refs/heads/master | 2021-05-04T02:08:32.417099 | 2016-12-20T09:41:04 | 2016-12-20T09:41:04 | 71,285,052 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,528 | java | package com.swarmy.swarmy;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.annotation.WorkerThread;
import android.support.v4.content.LocalBroadcastManager;
import com.google.common.collect.ImmutableList;
import java.util.ArrayList;
import java.util.List;
import io.particle.android.sdk.cloud.BroadcastContract;
import io.particle.android.sdk.cloud.ParallelDeviceFetcherAccessHack;
import io.particle.android.sdk.cloud.ParticleCloud;
import io.particle.android.sdk.cloud.ParticleCloud.PartialDeviceListResultException;
import io.particle.android.sdk.cloud.ParticleCloudException;
import io.particle.android.sdk.cloud.ParticleDevice;
import io.particle.android.sdk.utils.BetterAsyncTaskLoader;
import static io.particle.android.sdk.utils.Py.list;
import static io.particle.android.sdk.utils.Py.truthy;
public class DevicesLoader extends BetterAsyncTaskLoader<DevicesLoader.DevicesLoadResult> {
public static class DevicesLoadResult {
public final List<ParticleDevice> devices;
public final boolean isPartialResult;
// FIXME: naming. also, two booleans in a constructor, in a row.... no. just no.
public final boolean unableToLoadAnyDevices;
public DevicesLoadResult(List<ParticleDevice> devices, boolean isPartialResult,
boolean unableToLoadAnyDevices) {
this.devices = devices;
this.isPartialResult = isPartialResult;
this.unableToLoadAnyDevices = unableToLoadAnyDevices;
}
}
private final ParticleCloud cloud;
private final LocalBroadcastManager broadcastManager;
private final DevicesUpdatedReceiver devicesUpdatedReceiver;
private volatile DevicesLoadResult latestResult = new DevicesLoadResult(
new ArrayList<ParticleDevice>(), false, false);
private volatile boolean useLongTimeoutsOnNextLoad = false;
public DevicesLoader(Context context) {
super(context);
cloud = ParticleCloud.get(context);
broadcastManager = LocalBroadcastManager.getInstance(context);
devicesUpdatedReceiver = new DevicesUpdatedReceiver();
}
public void setUseLongTimeoutsOnNextLoad(boolean useLongTimeoutsOnNextLoad) {
this.useLongTimeoutsOnNextLoad = useLongTimeoutsOnNextLoad;
}
@Override
protected void onStartLoading() {
super.onStartLoading();
broadcastManager.registerReceiver(devicesUpdatedReceiver, devicesUpdatedReceiver.getFilter());
}
@Override
protected void onStopLoading() {
super.onStopLoading();
broadcastManager.unregisterReceiver(devicesUpdatedReceiver);
}
@Override
public boolean hasContent() {
return truthy(latestResult.devices);
}
@Override
public DevicesLoadResult getLoadedContent() {
return latestResult;
}
@Override
@WorkerThread
public DevicesLoadResult loadInBackground() {
boolean useLongTimeouts = useLongTimeoutsOnNextLoad;
useLongTimeoutsOnNextLoad = false;
List<ParticleDevice> devices = list();
boolean isPartialList = false;
boolean unableToLoadAnyDevices = false;
try {
devices = ParallelDeviceFetcherAccessHack.getDevicesParallel(cloud, useLongTimeouts);
} catch (ParticleCloudException e) {
// FIXME: think more about error handling here
// getting a PCE here means we couldn't even get the device list, so just return
// whatever we have.
unableToLoadAnyDevices = true;
devices = latestResult.devices;
} catch (PartialDeviceListResultException ex) {
ex.printStackTrace();
devices = ParallelDeviceFetcherAccessHack.getDeviceList(ex);
isPartialList = true;
}
DevicesLoadResult resultToReturn = new DevicesLoadResult(
ImmutableList.copyOf(devices), isPartialList, unableToLoadAnyDevices);
if (!unableToLoadAnyDevices) {
latestResult = resultToReturn;
}
return resultToReturn;
}
private class DevicesUpdatedReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
forceLoad();
}
IntentFilter getFilter() {
return new IntentFilter(BroadcastContract.BROADCAST_DEVICES_UPDATED);
}
}
}
| [
"zalsader@hotmail.com"
] | zalsader@hotmail.com |
b406b0ac3fe0d0d5ef545f5cb276b6e4352a93db | 3d13fae219904183daa81ec7097a1e348b74859c | /Android-Movie-Catalogue-Submission-3/app/src/main/java/com/premankoding/mcd3/viewmodel/MovieViewModel.java | ccf3302d4e0b5d4987b24c9af6d0dfda50f8bf6b | [] | no_license | shandysiswandi/Learning-Dicoding | 906d9edff4f992c4d1623e188a4357009934e9c5 | 3d86cb0a45402d9d25eda036e369c4e17b82ee20 | refs/heads/master | 2022-10-22T01:02:47.897355 | 2020-06-11T07:22:41 | 2020-06-11T07:22:41 | 271,473,265 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,364 | java | package com.premankoding.mcd3.viewmodel;
import androidx.annotation.NonNull;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.premankoding.mcd3.model.MovieModelFrame;
import com.premankoding.mcd3.service.APIClient;
import com.premankoding.mcd3.service.Config;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class MovieViewModel extends ViewModel {
private MutableLiveData<MovieModelFrame> movieResult;
public void setMovieResult(){
if (movieResult != null){
return;
}
movieResult = new MutableLiveData<>();
APIClient apiClient = Config.getApiClient();
apiClient.getMovie().enqueue(new Callback<MovieModelFrame>() {
@Override
public void onResponse(@NonNull Call<MovieModelFrame> call, @NonNull Response<MovieModelFrame> response) {
if(response.isSuccessful()){
movieResult.setValue(response.body());
}
}
@Override
public void onFailure(@NonNull Call<MovieModelFrame> call, @NonNull Throwable t) {
movieResult.setValue(null);
}
});
}
public LiveData<MovieModelFrame> getMovieResult() {
return movieResult;
}
}
| [
"shandysiswandi@gmail.com"
] | shandysiswandi@gmail.com |
dd629533ecca3af8f6a00cf8a02c7f1c20c892b5 | da3789801a0ef838f5a92c3170073b4a793f043a | /src/main/java/com/aerospace/service/ils/AbstractProtocolConnector.java | c792dccf1bee0fe460d34388849f0ca86d91860f | [] | no_license | reachrama/coupon-service | 7b99eb14671c3a74d181cac956f6ec25f2cf0fec | 39f076379093a6f253adaa033f916d4e4fefabd4 | refs/heads/master | 2023-01-18T19:27:20.770827 | 2020-11-16T21:28:22 | 2020-11-16T21:28:22 | 266,461,739 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 651 | java | package com.aerospace.service.ils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import com.aerospace.service.sip.ILSConfiguration;
public abstract class AbstractProtocolConnector {
private final ILSConfiguration ilsConfiguration;
@Autowired
public AbstractProtocolConnector(ILSConfiguration ilsConfiguration) {
this.ilsConfiguration = ilsConfiguration;
}
public abstract boolean supports(String s);
public abstract String lookupItem(String itemIdentifier);
public String getHost() {
return ilsConfiguration.getUrl().get("nypl");
}
}
| [
"reachramanujam79@gmail.com"
] | reachramanujam79@gmail.com |
97c5a26d8470837fee5aa4350f923a49724b1ed1 | 902679402b7c37a9ec5972fb592f95f1daabcf02 | /src/main/java/py/com/econtreras/ecommerceadmin/entity/Devolution.java | 6b5ea919c2c7fbdd363c7e7546ecccabe4ce57a2 | [] | no_license | e-contreras/ecommerce-admin | d1d534a99addfb8978ca9226ab5d19519c85e0a0 | e4e344c2fcb96b6c9b612a1e0bab03d5470d01fe | refs/heads/master | 2023-01-10T16:49:43.731414 | 2019-10-27T15:37:54 | 2019-10-27T15:37:54 | 216,665,752 | 0 | 0 | null | 2023-01-04T12:36:42 | 2019-10-21T21:08:03 | JavaScript | UTF-8 | Java | false | false | 1,483 | java | package py.com.econtreras.ecommerceadmin.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import lombok.Data;
@Data
@Entity
@Table(name = "devoluciones", catalog = "econtreras", schema = "")
public class Devolution implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id", nullable = false)
private Integer id;
@Basic(optional = false)
@Column(name = "fec_alta", nullable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date creationDate;
@Basic(optional = false)
@Lob
@Column(name = "comentarios", nullable = false, length = 65535)
private String comment;
@Basic(optional = false)
@Column(name = "concepto", nullable = false, length = 100)
private String concept;
@JoinColumn(name = "mercaderia", referencedColumnName = "id", nullable = false)
@ManyToOne(optional = false)
private Product product;
}
| [
"enriquev.rodriguez@gmail.com"
] | enriquev.rodriguez@gmail.com |
98520a451c30ad851579b76d3398581e582ef943 | d0a34993629b8a89a062c284d3f7e50d499aafc5 | /spring-cloud-blog/blog-main/src/main/java/com/wenxianm/utils/RandomUtil.java | e38718184d929e2be6abb563e307ba8e00a526ad | [] | no_license | caiwenxian/bolg-java | bea90b3bcd1dc6a944ea413e78c0a3731a564654 | 2263dfff57572ceca79916903ef2a0ee17c24546 | refs/heads/master | 2022-12-21T04:50:52.496421 | 2021-04-30T08:30:55 | 2021-04-30T08:30:55 | 118,109,762 | 0 | 0 | null | 2022-12-16T10:43:53 | 2018-01-19T10:10:32 | Java | UTF-8 | Java | false | false | 316 | java | package com.wenxianm.utils;
import java.util.UUID;
/**
* 随机码获取工具
*
* @Author: [caiwenxian]
* @Date: [2018-01-19 09:43]
* @Version: [1.0.0]
*/
public class RandomUtil {
static public String getUid() {
return System.currentTimeMillis() + "-" + UUID.randomUUID().toString();
}
}
| [
"caiwenxian44838@tanzhou.cn"
] | caiwenxian44838@tanzhou.cn |
181e66b087a32bfb9d93bbf82334149263135e2c | 2e3cd3d66c2c13fd599d40360d0a54a075f381bc | /SpringAnnotations/src/casaortiz/jorge/annotations/UsoAnnotations.java | 5589e1f3b4b8bea9f6c2bc1aba7b30e644070c4e | [] | no_license | jorgeortizc06/curso_spring | df0d57595da6eee63fb53ebe49a6487c52315aad | c1a24294e44e6cae79cc1af4b22a501690c0ee75 | refs/heads/main | 2023-01-09T10:19:51.613244 | 2020-11-15T02:29:04 | 2020-11-15T02:29:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,117 | java | package casaortiz.jorge.annotations;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class UsoAnnotations {
public static void main(String[] args) {
// TODO Auto-generated method stub
//1. leer el xml de configuracion en sistemas antiguos. Actualmente uso una clase
//ClassPathXmlApplicationContext contexto = new ClassPathXmlApplicationContext("applicationContext.xml");
//leer el class de configuracion
AnnotationConfigApplicationContext contexto = new AnnotationConfigApplicationContext(EmpleadoConfig.class);
//2. Pedir un Bean al contenedor
/*Empleados Juan = contexto.getBean("comercialExperimentado", Empleados.class);
System.out.println(Juan.getTareas());
System.out.println(Juan.getInformes());*/
//aqui uso la llamada del @Bean
Empleados empleado = contexto.getBean("directorFinanciero", Empleados.class);
System.out.println(empleado.getTareas());
System.out.println(empleado.getInformes());
//3. Cerrar el contexto
contexto.close();
}
}
| [
"jorgeortizc05@gmail.com"
] | jorgeortizc05@gmail.com |
5fb21a7c3593be952b93c10176169462519adb27 | 3d643e50e304d3ffd3f697905e441556be377cfc | /android/versioned-abis/expoview-abi35_0_0/src/main/java/abi35_0_0/expo/modules/medialibrary/DeleteAlbums.java | ace96b51a63a1d12903061da18e7f21cd91b1896 | [
"BSD-3-Clause",
"MIT",
"Apache-2.0"
] | permissive | Qdigital/expo | 326c5c1c0167295c173f2388f078a2f1e73835c9 | 8865a523d754b2332ffb512096da4998c18c9822 | refs/heads/master | 2023-07-07T18:37:39.814195 | 2020-02-18T23:28:20 | 2020-02-18T23:28:20 | 241,549,344 | 1 | 0 | MIT | 2023-07-06T14:55:15 | 2020-02-19T06:28:39 | null | UTF-8 | Java | false | false | 972 | java | package abi35_0_0.expo.modules.medialibrary;
import android.content.Context;
import android.os.AsyncTask;
import android.provider.MediaStore.Images.Media;
import java.util.List;
import abi35_0_0.org.unimodules.core.Promise;
import static abi35_0_0.expo.modules.medialibrary.MediaLibraryUtils.deleteAssets;
import static abi35_0_0.expo.modules.medialibrary.MediaLibraryUtils.getInPart;
class DeleteAlbums extends AsyncTask<Void, Void, Void>{
Context mContext;
String mAlbumIds[];
Promise mPromise;
public DeleteAlbums(Context context, List<String> albumIds, Promise promise) {
mContext = context;
mPromise = promise;
mAlbumIds = albumIds.toArray(new String[0]);
}
@Override
protected Void doInBackground(Void... voids) {
final String selection = Media.BUCKET_ID + " IN (" + getInPart(mAlbumIds) + " )";
final String selectionArgs[] = mAlbumIds;
deleteAssets(mContext, selection, selectionArgs, mPromise);
return null;
}
}
| [
"samelson.e@gmail.com"
] | samelson.e@gmail.com |
4b71f6a93abe2bd231cab7380bb07c4b6ebf1535 | 59e1310552bfdaa33a0d3bddf388184890e9c0e8 | /deeplearning4j-scaleout/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/learning/impl/elements/SkipGramWithB.java | d34678182f96a619c9ca41ca15c4052aa87e723e | [
"Apache-2.0"
] | permissive | fabiana001/deeplearning4j | f725b36ba384c07731b12b1e3c437bb5c58622f6 | 34147e0f5299b8084cc3deabb80790d5363be39a | refs/heads/master | 2021-01-21T02:27:15.745155 | 2016-09-18T15:50:39 | 2016-09-18T15:50:39 | 63,870,440 | 0 | 0 | null | 2016-07-21T13:11:05 | 2016-07-21T13:11:04 | null | UTF-8 | Java | false | false | 1,773 | java | package org.deeplearning4j.models.embeddings.learning.impl.elements;
import lombok.NonNull;
import org.deeplearning4j.models.sequencevectors.sequence.Sequence;
import org.deeplearning4j.models.sequencevectors.sequence.SequenceElement;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
/**
* Created by Andrea on 11/05/16.
*/
public class SkipGramWithB<T extends SequenceElement> extends SkipGram<T> {
@Override
public String getCodeName() {
return "SkipGramWithB";
}
@Override
public double learnSequence(@NonNull Sequence<T> sequence, @NonNull AtomicLong nextRandom,
@NonNull double learningRate) {
Sequence<T> tempSequence = sequence;
if (sampling > 0) tempSequence = super.applySubsampling(sequence, nextRandom);
double score = 0;
for(int i = 0; i < tempSequence.getElements().size(); i++) {
nextRandom.set(nextRandom.get() * 25214903917L + 11);
score = skipGram(i, tempSequence.getElements(), (int) nextRandom.get() % window, nextRandom, learningRate);
}
return score;
}
private double skipGram(int i, List<T> sentence, int b, AtomicLong nextRandom, double alpha) {
final T word = sentence.get(i);
if(word == null || sentence.isEmpty())
return 0;
double score = 0;
int end = window - b;
for(int a = b; a < end; a++) {
if(a != window) {
int c = a - window + i;
if(c >= 0 && c < sentence.size()) {
T lastWord = sentence.get(c);
score = super.iterateSample(word,lastWord,nextRandom,alpha);
}
}
}
return score;
}
}
| [
"andreadelfante94@gmail.com"
] | andreadelfante94@gmail.com |
7416e612db27deff1b16c4dae249b3794b628059 | 30064f967c3d9316e5104067ae3d5c00b2a947d4 | /designpattern/state/src/main/java/me/personal/progress/state/Context.java | eb1ffd605d33183b685144a27e4e9be2b35f43f7 | [] | no_license | zy475459736/progress | 3980300ab08f99c07815d8bad6a83b0d4f43b88f | 7b502e9c8f4b80552f097d4a4926bc934b83f1e2 | refs/heads/master | 2020-03-23T01:37:05.465393 | 2019-01-20T15:33:32 | 2019-01-20T15:33:32 | 140,927,273 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 897 | java | package me.personal.progress.state;
import me.personal.progress.state.impl.ConcreteStateA;
import me.personal.progress.state.impl.ConcreteStateB;
/**
* Created by zhongyi on 2018/8/23.
*/
class Context {
private State state; //维持一个对抽象状态对象的引用
private int value; //其他属性值,该属性值的变化可能会导致对象状态发生变化
//设置状态对象
public void setState(State state) {
this.state = state;
}
public void request() {
//其他代码
state.handle(); //调用状态对象的业务方法
//其他代码
}
public void changeState() {
//判断属性值,根据属性值进行状态转换
if (value == 0) {
this.state=new ConcreteStateA();
}
else if (value == 1) {
this.setState(new ConcreteStateB());
}
}
} | [
"yzhong@seu.edu.cn"
] | yzhong@seu.edu.cn |
d922ce5b2f8afba5f8e92e21657461e93b901ca9 | 8823c96d433605e7c13679b027a697e6a647cf9c | /src/main/java/com/lzhlyle/leetcode/week/no76/MinimumWindowSubstring_TwoPoints.java | 5868ca8075afd8098c817f8a4c375652253d3bfb | [
"MIT"
] | permissive | lzhlyle/leetcode | 62278bf6e949f802da335e8de2d420440f578c2f | 8f053128ed7917c231fd24cfe82552d9c599dc16 | refs/heads/master | 2022-07-14T02:28:11.082595 | 2020-11-16T14:28:20 | 2020-11-16T14:28:20 | 215,598,819 | 2 | 0 | MIT | 2022-06-17T02:55:41 | 2019-10-16T16:52:05 | Java | UTF-8 | Java | false | false | 1,289 | java | package com.lzhlyle.leetcode.week.no76;
public class MinimumWindowSubstring_TwoPoints {
// two points
// O(n+m)
public String minWindow(String s, String t) {
char[] sarr = s.toCharArray(), tarr = t.toCharArray();
int slen = sarr.length, tlen = tarr.length;
int[] need = new int[256], hire = new int[256];
for (char c : tarr) need[c] = ++hire[c];
int expected = tlen;
int l = 0, r = l, len = 0, minL = l, minLen = slen + 1; // minLen: unreachable value
while (l < slen - tlen + 1 && r < slen) {
if (len < r - l + 1) {
int hiring = sarr[r];
if (need[hiring] > 0 && hire[hiring] > 0) expected--;
hire[hiring]--;
} else {
int leaving = sarr[l - 1];
hire[leaving]++;
if (need[leaving] > 0 && hire[leaving] > 0) expected++;
}
len = r - l + 1;
if (expected > 0) r++;
else {
if (len < minLen) {
minLen = len;
minL = l;
}
l++;
}
}
return minLen == slen + 1 ? "" : new String(sarr, minL, minLen);
}
}
| [
"lzhlyle@msn.cn"
] | lzhlyle@msn.cn |
52b7105c5eb37705d5b280a7ca8f9bf2cc596819 | ea40a7c459246fc49b11f9a295158f343faf6cfd | /xc-framework-model/src/main/java/com/xuecheng/framework/domain/media/response/CheckChunkResult.java | a54fe6a2e449ada40f9862bfcdb6cdca56da4870 | [] | no_license | cdtswdk/xuecheng | f38c97eff54a36272b2854a299398ae4847bf17a | b474d9aeda343c915971d18a9d9c3ee4f91b09a4 | refs/heads/master | 2023-01-08T09:00:46.395425 | 2020-11-04T10:21:29 | 2020-11-04T10:21:29 | 300,299,407 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 691 | java | package com.xuecheng.framework.domain.media.response;
import com.xuecheng.framework.model.response.ResponseResult;
import com.xuecheng.framework.model.response.ResultCode;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* Created by admin on 2018/3/5.
*/
@Data
@ToString
@NoArgsConstructor
public class CheckChunkResult extends ResponseResult {
public CheckChunkResult(ResultCode resultCode, boolean fileExist) {
super(resultCode);
this.fileExist = fileExist;
}
@ApiModelProperty(value = "文件分块存在标记", example = "true", required = true)
boolean fileExist;
}
| [
"1445676933@qq.com"
] | 1445676933@qq.com |
62fef1ed142b1df46855af2f34456a5832b86eb9 | 8aa8e01308fbc56db78b0e211b28ebac2679a643 | /Productive/src/backend/PushRequest.java | 9cc61e7262d423de3c6fe55777fc908336f8afb3 | [] | no_license | ahouts/ProDuctive-client | 253e668a75d05c33d7929c7dc9476dbf3421a569 | a07a48134120c872581757c1681672fdf4f5e4e9 | refs/heads/master | 2021-08-22T08:56:50.282021 | 2017-11-29T20:39:41 | 2017-11-29T20:39:41 | 105,924,135 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 121 | java | package backend;
public class PushRequest {
public PushRequest() {
// TODO Auto-generated constructor stub
}
}
| [
"joejdion@gmail.com"
] | joejdion@gmail.com |
3032d8ae507314784174974c77d010fef9ddce2e | 05da80d8560178c935cd27adb010d16de116a4b5 | /ProvaC_Telecamere/MySolution/telecamera/TelecameraDiAlarme.java | 7de95f0a21ada1a3d59da8d1d2b070b2cc3426ed | [] | no_license | formidablae/unibg_triennale_esame_informatica_II_a | 2e0d985eb7b48814c1d0de2c33e408901ed505f0 | 1733be097fc22e94610f2322a21431b241e86bc2 | refs/heads/main | 2023-08-25T17:35:59.887428 | 2021-10-01T09:49:34 | 2021-10-01T09:49:34 | 412,410,879 | 9 | 0 | null | null | null | null | UTF-8 | Java | false | false | 778 | java | package telecamera;
public class TelecameraDiAlarme extends Telecamera
{
// CAMPI
int numeroTelefono;
private int lunghezzaCampoNumeroTelefono;
// COSTRUTTORI
public TelecameraDiAlarme() // DONE
{
super();
numeroTelefono = 0;
lunghezzaCampoNumeroTelefono = 0;
}
public TelecameraDiAlarme(String laDescrizione, double laPosizione) // DONE
{
super(laDescrizione, laPosizione);
numeroTelefono = 0;
lunghezzaCampoNumeroTelefono = 0;
}
public TelecameraDiAlarme(String laDescrizione, double laPosizione, int numeroDiTelefono) // DONE
{
super(laDescrizione, laPosizione);
numeroTelefono = numeroDiTelefono;
lunghezzaCampoNumeroTelefono = (String.valueOf(numeroDiTelefono)).length();
}
// METODI
// METODI STATICI
}
| [
"81068781+formidablae@users.noreply.github.com"
] | 81068781+formidablae@users.noreply.github.com |
35ee09b326df8461526a5b0f718bfe2bf6ae1e3b | 8d7d41b71085ff2e88fa6a7a014f002deade8d7e | /src/test/java/be/vbgn/gradle/buildaspects/project/project/VariantProjectFactoryImplTest.java | 8510f716d8334ae4402fcf0dd11c10dc3b04e0dd | [] | no_license | vierbergenlars/build-aspects-gradle-plugin | b821c61c9a9456fe6005e0c2a174b6dd086e5694 | c0b8bca05339624c1986d671c12dd23ccaed22f6 | refs/heads/master | 2022-09-12T14:08:23.452939 | 2022-08-29T07:21:23 | 2022-08-29T07:21:23 | 220,013,625 | 1 | 0 | null | 2022-08-29T07:21:24 | 2019-11-06T14:18:29 | Java | UTF-8 | Java | false | false | 5,634 | java | package be.vbgn.gradle.buildaspects.project.project;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import be.vbgn.gradle.buildaspects.TestUtil;
import be.vbgn.gradle.buildaspects.settings.project.VariantProjectDescriptor;
import be.vbgn.gradle.buildaspects.variant.Variant;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
import org.gradle.api.Project;
import org.gradle.api.initialization.ProjectDescriptor;
import org.gradle.testfixtures.ProjectBuilder;
import org.junit.Test;
import org.mockito.Mockito;
public class VariantProjectFactoryImplTest {
private ProjectDescriptor createProjectDescriptor(String path) {
ProjectDescriptor projectDescriptor = Mockito.mock(ProjectDescriptor.class, Mockito.RETURNS_SMART_NULLS);
Mockito.when(projectDescriptor.getPath()).thenReturn(path);
return projectDescriptor;
}
private VariantProjectDescriptor createVariantProjectDescriptor(String path, Variant variant) {
VariantProjectDescriptor variantProjectDescriptor = Mockito
.mock(VariantProjectDescriptor.class, Mockito.RETURNS_SMART_NULLS);
ProjectDescriptor projectDescriptor = createProjectDescriptor(path);
Mockito.when(variantProjectDescriptor.getProjectDescriptor()).thenReturn(projectDescriptor);
ProjectDescriptor parentProjectDescriptor = createProjectDescriptor(path.substring(0, path.lastIndexOf(':')));
Mockito.when(variantProjectDescriptor.getParentProjectDescriptor())
.thenReturn(parentProjectDescriptor);
Mockito.when(variantProjectDescriptor.getVariant()).thenReturn(variant);
return variantProjectDescriptor;
}
@Test
public void createVariantProject() {
Set<VariantProjectDescriptor> variantProjectDescriptors = new HashSet<>();
variantProjectDescriptors.add(createVariantProjectDescriptor(":projectA:projectA-c",
TestUtil.createVariant(Collections.singletonMap("systemVersion", "1.0"))));
variantProjectDescriptors.add(createVariantProjectDescriptor(":projectA:projectA-d",
TestUtil.createVariant(Collections.singletonMap("systemVersion", "2.0"))));
VariantProjectFactory variantProjectFactory = new VariantProjectFactoryImpl(variantProjectDescriptors);
Project rootProject = ProjectBuilder.builder()
.withName(":")
.build();
Project projectA = ProjectBuilder.builder()
.withName("projectA")
.withParent(rootProject)
.build();
Project projectAC = ProjectBuilder.builder()
.withName("projectA-c")
.withParent(projectA)
.build();
Optional<VariantProject> variantProject = variantProjectFactory.createVariantProject(projectAC);
assertTrue(variantProject.isPresent());
assertEquals(projectAC, variantProject.get().getProject());
assertEquals(TestUtil.createVariant(Collections.singletonMap("systemVersion", "1.0")),
variantProject.get().getVariant());
Optional<VariantProject> variantProject1 = variantProjectFactory.createVariantProject(projectA);
assertFalse(variantProject1.isPresent());
}
@Test
public void createVariantProjectsForParent() {
Set<VariantProjectDescriptor> variantProjectDescriptors = new HashSet<>();
variantProjectDescriptors.add(createVariantProjectDescriptor(":projectA:projectA-c",
TestUtil.createVariant(Collections.singletonMap("systemVersion", "1.0"))));
variantProjectDescriptors.add(createVariantProjectDescriptor(":projectA:projectA-d",
TestUtil.createVariant(Collections.singletonMap("systemVersion", "2.0"))));
variantProjectDescriptors.add(createVariantProjectDescriptor(":projectB:projectB-c",
TestUtil.createVariant(Collections.singletonMap("systemVersion", "1.0"))));
VariantProjectFactory variantProjectFactory = new VariantProjectFactoryImpl(variantProjectDescriptors);
Project rootProject = ProjectBuilder.builder()
.withName(":")
.build();
Project projectA = ProjectBuilder.builder()
.withName("projectA")
.withParent(rootProject)
.build();
Project projectAC = ProjectBuilder.builder()
.withName("projectA-c")
.withParent(projectA)
.build();
Project projectAD = ProjectBuilder.builder()
.withName("projectA-d")
.withParent(projectA)
.build();
Set<VariantProject> variantProjects = variantProjectFactory.createVariantProjectsForParent(projectA);
assertEquals(new HashSet<>(Arrays.asList(
new VariantProjectImpl(projectAC,
TestUtil.createVariant(Collections.singletonMap("systemVersion", "1.0"))),
new VariantProjectImpl(projectAD,
TestUtil.createVariant(Collections.singletonMap("systemVersion", "2.0")))
)), variantProjects);
Set<VariantProject> variantProjects1 = variantProjectFactory.createVariantProjectsForParent(projectAC);
assertTrue(variantProjects1.isEmpty());
Set<VariantProject> variantProjects2 = variantProjectFactory
.createVariantProjectsForParent(rootProject);
assertTrue(variantProjects2.isEmpty());
}
}
| [
"lars@vbgn.be"
] | lars@vbgn.be |
4faf1a22fe9e6f621733bbc1ce2a181955353ef7 | 5effb75ea4d76ac1ea4a91f79931f6fce157c2ba | /mobile-app-ws/src/main/java/com/project/app/ws/ui/model/request/UserLoginRequestModel.java | 9826f2157e094c6817f9386d773c5681fef06b3e | [] | no_license | koknikolee/MasterSpring | d8ebffe359b90890a18c9b98e9d6caa940b1af8c | b19c4ef6da5793ae3da5f9d107bda53dfafe4ee3 | refs/heads/master | 2023-02-20T09:13:21.272621 | 2020-09-29T12:01:59 | 2020-09-29T12:01:59 | 299,389,429 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 378 | java | package com.project.app.ws.ui.model.request;
public class UserLoginRequestModel {
private String email;
private String password;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| [
"MacBook@Markos-MBP.sne.local"
] | MacBook@Markos-MBP.sne.local |
18e595c339601c91f68d10ec0876e0f721c04fb2 | e21d3ae8e47b113a7c27524afd4525cc23130b71 | /IWXXM-JAVA/aero/aixm/VORTimeSlicePropertyType.java | ebfcbf67664d2364ac66316e31c2613ead4bc5eb | [] | no_license | blchoy/iwxxm-java | dad020c19a9edb61ab3bc6b04def5579f6cbedca | 7c1b6fb1d0b0e9935a10b8e870b159c86a4ef1bb | refs/heads/master | 2023-05-25T12:14:10.205518 | 2023-05-22T08:40:56 | 2023-05-22T08:40:56 | 97,662,463 | 2 | 1 | null | 2021-11-17T03:40:50 | 2017-07-19T02:09:41 | Java | UTF-8 | Java | false | false | 2,629 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0-SNAPSHOT
// See <a href="https://jaxb.java.net/">https://jaxb.java.net/</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2023.05.22 at 02:50:00 PM HKT
//
package aero.aixm;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for VORTimeSlicePropertyType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="VORTimeSlicePropertyType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://www.aixm.aero/schema/5.1.1}VORTimeSlice"/>
* </sequence>
* <attGroup ref="{http://www.opengis.net/gml/3.2}OwnershipAttributeGroup"/>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "VORTimeSlicePropertyType", propOrder = {
"vorTimeSlice"
})
public class VORTimeSlicePropertyType {
@XmlElement(name = "VORTimeSlice", required = true)
protected VORTimeSliceType vorTimeSlice;
@XmlAttribute(name = "owns")
protected Boolean owns;
/**
* Gets the value of the vorTimeSlice property.
*
* @return
* possible object is
* {@link VORTimeSliceType }
*
*/
public VORTimeSliceType getVORTimeSlice() {
return vorTimeSlice;
}
/**
* Sets the value of the vorTimeSlice property.
*
* @param value
* allowed object is
* {@link VORTimeSliceType }
*
*/
public void setVORTimeSlice(VORTimeSliceType value) {
this.vorTimeSlice = value;
}
/**
* Gets the value of the owns property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public boolean isOwns() {
if (owns == null) {
return false;
} else {
return owns;
}
}
/**
* Sets the value of the owns property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setOwns(Boolean value) {
this.owns = value;
}
}
| [
"blchoy.hko@gmail.com"
] | blchoy.hko@gmail.com |
24252219de7471942274dd041cc961730bc852ef | 9f323e4839c0021e623fd43e8a0d098d9b80c463 | /apihelper-system/src/main/java/com/ning/modules/system/domain/Project.java | d0d724879011562624c3784d10f7bcc019eec664 | [] | no_license | rookie30/APIHelper-server | eeb8b2b3f9282209c20de4748e6470d2d1e2bab9 | 1656098b487ba05dd4b6c71acd9082b9b1312319 | refs/heads/main | 2023-04-10T20:26:19.519396 | 2021-04-20T06:18:01 | 2021-04-20T06:18:01 | 330,133,561 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,653 | java | package com.ning.modules.system.domain;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.sql.Update;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;
@Data
@Entity
@Table(name = "sys_project")
@EntityListeners(AuditingEntityListener.class)
public class Project implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@NotNull(groups = Update.class)
@Column(name = "project_id")
private Long id;
@NotBlank(message = "项目名称不能为空")
@ApiModelProperty(value = "项目名称")
@Column(name = "name")
private String projectName;
@ApiModelProperty(value = "项目简介")
private String introduce;
@Column(name = "create_time")
@ApiModelProperty(value = "创建时间")
private Date createTime;
@Column(name = "update_time")
@LastModifiedDate
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@Column(name = "create_by")
@ApiModelProperty(value = "创建者")
private String createBy;
@JSONField(serialize = false)
@ManyToMany(mappedBy = "projects")
@ApiModelProperty(value = "用户", hidden = true)
private Set<User> users;
}
| [
"824781389@qq.com"
] | 824781389@qq.com |
504dc5c676918319ea75b340715f0abfe153a27f | 487ed51c196b1ac3ecb54622fdf4dc3d228e3859 | /app/src/main/java/fullerton/edu/autowaiter/DeliverOrder.java | af0ffaaa82917e4ddc7904016315b6db8ea263a1 | [] | no_license | jolivian/AutoWaiter | edae3626a4e69c8c7fb8af6c10ebc95bdf53e1cd | 4af6ca3da78a6f7fd4bd847188c7997e0aa7750f | refs/heads/master | 2020-03-10T03:27:48.651922 | 2018-04-11T23:24:59 | 2018-04-11T23:24:59 | 129,165,063 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 839 | java | package fullerton.edu.autowaiter;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class DeliverOrder extends AppCompatActivity {
Button returner;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_deliver_order);
initialize();
returner.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
Intent myIntent = new Intent(DeliverOrder.this, MainActivity.class);
DeliverOrder.this.startActivity(myIntent);
}
});
}
private void initialize() {
returner = findViewById(R.id.bReturn);
}
}
| [
"35378871+jolivian@users.noreply.github.com"
] | 35378871+jolivian@users.noreply.github.com |
578afbdeddd3fd3eed7c93197e820735c1443aad | 9a6673e21635aefe3dc4ba80fbe3869f43bb3010 | /app/src/main/java/com/luckyseven/safeph/Listeners/IExposureListener.java | 6878c98d4e1be2aa55b62650dd3b34f5487ba329 | [] | no_license | jtejido/safeph-android | 213358d95ffacfc73b42f2cc760b4e3b28e531c2 | 103e5b581073490d2b906e1db155205047549f67 | refs/heads/master | 2022-12-02T19:26:46.141114 | 2020-08-17T19:59:35 | 2020-08-17T19:59:35 | 288,035,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 421 | java | package com.luckyseven.safeph.Listeners;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.nearby.exposurenotification.TemporaryExposureKey;
import java.util.List;
public interface IExposureListener {
void onStarted();
void onStopped();
void onApiException(ApiException apiException, int requestCode);
void onExposureKeysRetrieved(List<TemporaryExposureKey> keys);
}
| [
"jtbibliomania@gmail.com"
] | jtbibliomania@gmail.com |
94e131c632e486bc1d49055eb80a2b106f78c5ac | b496085457958a7ea0f33ae561596afa4cfd9048 | /src/MergeArray.java | a55aff1bdd6b25d66e3267952b930ef5ff39860b | [] | no_license | shivangichhabra/RandomAlgorithmProblems | 4dd7ec7dab1cd7a90a83ba3c49b9713c224e8df2 | 2097623cdf2f1ec17aaae8564a7b0bf6a407fd06 | refs/heads/master | 2020-04-05T10:39:43.915204 | 2018-08-09T00:18:58 | 2018-08-09T00:18:58 | 81,522,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,302 | java | /**
* Created by shivangi on 3/20/17.
*/
public class MergeArray {
/*
O(n+m) space
o(n) time
*/
public int[] method1(int[]a, int b[]){
int c[] = new int[a.length+b.length];
int j=0, k=0;
for(int i=0; i<c.length; i++){
if(j<a.length && k<b.length){
if(a[j] <= b[k]){
c[i] = a[j];
j++;
}
else {
c[i] = b[k];
k++;
}
}
else if(j<a.length){
c[i] = a[j];
j++;
}
else{
c[i] = b[k];
k++;
}
}
return c;
}
/*
Returning two array sorted in order can merge them
at end of a to start of b
*/
public void method2(int[] a, int[] b) {
for (int i = b.length - 1; i >= 0; i--)
{
int j, last = a[a.length - 1];
for (j = a.length - 2; j >= 0 && a[j] > b[i]; j--)
a[j + 1] = a[j];
if (j != a.length - 2 || last > b[i])
{
a[j + 1] = b[i];
b[i] = last;
}
}
}
/*
Can use this method to merge in the same array provided extra space exist at the end
*/
public void method3(int[] a, int[] b){
int i = a.length;
int j = b.length;
while(i>0 && j>0){
if(a[i-1] > b[j-1]) {
a[i + j - 1] = a[i - 1];
i--;
}else {
a[i + j - 1] = b[j - 1];
j--;
}
}
while( j > 0){
a[i+j-1] = b[j-1];
j--;
}
}
public static void main(String args[]){
MergeArray ma = new MergeArray();
int a[] = {1,3,5,7,9,11};
int b[] = {12,14,16,18};
int[] c = ma.method1(a,b);
for(int i=0; i<c.length; i++){
System.out.print(c[i] + " ");
}
System.out.println("\n");
ma.method2(a,b);
for(int i=0; i<a.length; i++){
System.out.print(a[i] + " ");
}
for(int i=0; i<b.length; i++){
System.out.print(b[i] + " ");
}
}
}
| [
"keepintouch.shivangi26@gmail.com"
] | keepintouch.shivangi26@gmail.com |
392d96726efff6cc29b0c42b7375cfa5335f6cb8 | bcacc9be9bd8074d84b0dd4f7539aa00156a7305 | /core-persistence/src/main/java/org/csr/core/persistence/business/dao/OrganizationParameterDao.java | 5dc3b7a358ae5d93166002dac0ee2c4e8ec71bce | [] | no_license | cj0829/core | 8b308fd5de65a5469b67e625f1a39510d0061432 | d57ca9db284b7b25e9a2f5692efeed8d0734cf20 | refs/heads/master | 2020-05-09T23:49:53.148415 | 2019-04-15T15:19:52 | 2019-04-15T15:19:52 | 86,766,356 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 957 | java | package org.csr.core.persistence.business.dao;
import java.util.List;
import org.csr.core.persistence.BaseDao;
import org.csr.core.persistence.business.domain.OrganizationParameter;
/**
* ClassName:OrganizationParameterDao.java <br/>
* System Name: 用户管理系统 <br/>
* Date: 2014-2-28上午10:08:55 <br/>
* @author caijin <br/>
* @version 1.0 <br/>
* @since JDK 1.7
*
* 功能描述: <br/>
* 公用方法描述: <br/>
*/
public interface OrganizationParameterDao extends BaseDao<OrganizationParameter,Long> {
/**
* @description:根据机构Id查询机构参数表信息
* @param: root:机构Id
* @return: List
* @author:wangxiujuan
*/
public List<OrganizationParameter> findByOrgId(Long orgId);
/**
*
* deleteForRoot: 描述方法的作用 <br/>
* @author caijin
* @param root
* @since JDK 1.7
*/
public void deleteForOrgId(Long orgId);
}
| [
"39317096@qq.com"
] | 39317096@qq.com |
798f4ff7358b069573a2ec20e0b1b22225dc38fe | dc049c6c1d7b4e40a20c769c30ef80cc42f947da | /src/test/java/com/mimeo/audit/dao/TestDaoTest.java | 06f2b17b0e2cbbd7ed53ca2a697671f83ec69736 | [] | no_license | cheesunchen/demo | 579420f3aa64015f9bb3b09fb0aebc812548dce9 | 71a4064a17e47b89d5a97ab7692dbc9be11d0428 | refs/heads/master | 2021-06-27T11:40:09.422167 | 2020-12-04T07:51:28 | 2020-12-04T07:51:28 | 177,755,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 632 | java | package com.mimeo.audit.dao;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.assertEquals;
@RunWith(SpringRunner.class)
@SpringBootTest
public class TestDaoTest {
@Autowired
private TestDao testDao;
@Test
@Rollback
public void selectMobile() {
String str = testDao.selectMobile();
assertEquals("111", str);
}
} | [
"chenchuxiang@yijiupi.com"
] | chenchuxiang@yijiupi.com |
d17264419d59bec88a050497d3d7e9a3bc639715 | 94ce05661c7a79c2986be4f1ffc8696c74ccf7ea | /app/src/main/java/com/xuliwen/dm/responsibilitychain/ConcreteRequest2.java | 01df38b01b6108517857408cb3d3473d8fb7e4ba | [] | no_license | guangmomo/DesignModle | 468879c087378994fb96666687b205ffbb8702ed | 5579bd7a8b90e98592a0e587ba176f669bc13ab5 | refs/heads/master | 2020-03-28T20:32:08.011066 | 2017-11-22T06:57:55 | 2017-11-22T06:57:55 | 94,613,256 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 285 | java | package com.xuliwen.dm.responsibilitychain;
/**
* Created by xlw on 2017/5/10.
*/
public class ConcreteRequest2 extends AbstractRequest{
public ConcreteRequest2(Object object) {
super(object);
}
@Override
public int getLevel() {
return 2;
}
}
| [
"1853959636@qq.com"
] | 1853959636@qq.com |
530dc8ce107801c881ffb8f4a569023d673ee8cd | c3b5b2171098b6e38d950a896afdf59862116f84 | /src/main/java/com/webstore/app/service/dto/UserDTO.java | f16b4fa30ad2d234eb2b2be43849bb925dd09573 | [] | no_license | nazar9501/Jhipster-angular-webstore | 5171d0b6d9f18d1e6bc7af26c14be5196cbc8f3a | dd44f84d2c404412d6d6e3c7e32c0dd16d96416b | refs/heads/master | 2020-04-18T16:07:28.258459 | 2019-01-26T12:22:10 | 2019-01-26T12:22:10 | 167,627,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,614 | java | package com.webstore.app.service.dto;
import com.webstore.app.config.Constants;
import com.webstore.app.domain.Authority;
import com.webstore.app.domain.User;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.*;
import java.time.Instant;
import java.util.Set;
import java.util.stream.Collectors;
/**
* A DTO representing a user, with his authorities.
*/
public class UserDTO {
private Long id;
@NotBlank
@Pattern(regexp = Constants.LOGIN_REGEX)
@Size(min = 1, max = 50)
private String login;
@Size(max = 50)
private String firstName;
@Size(max = 50)
private String lastName;
@Email
@Size(min = 5, max = 254)
private String email;
@Size(max = 256)
private String imageUrl;
private boolean activated = false;
@Size(min = 2, max = 6)
private String langKey;
private String createdBy;
private Instant createdDate;
private String lastModifiedBy;
private Instant lastModifiedDate;
private Set<String> authorities;
public UserDTO() {
// Empty constructor needed for Jackson.
}
public UserDTO(User user) {
this.id = user.getId();
this.login = user.getLogin();
this.firstName = user.getFirstName();
this.lastName = user.getLastName();
this.email = user.getEmail();
this.activated = user.getActivated();
this.imageUrl = user.getImageUrl();
this.langKey = user.getLangKey();
this.createdBy = user.getCreatedBy();
this.createdDate = user.getCreatedDate();
this.lastModifiedBy = user.getLastModifiedBy();
this.lastModifiedDate = user.getLastModifiedDate();
this.authorities = user.getAuthorities().stream()
.map(Authority::getName)
.collect(Collectors.toSet());
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public boolean isActivated() {
return activated;
}
public void setActivated(boolean activated) {
this.activated = activated;
}
public String getLangKey() {
return langKey;
}
public void setLangKey(String langKey) {
this.langKey = langKey;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Instant getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Instant createdDate) {
this.createdDate = createdDate;
}
public String getLastModifiedBy() {
return lastModifiedBy;
}
public void setLastModifiedBy(String lastModifiedBy) {
this.lastModifiedBy = lastModifiedBy;
}
public Instant getLastModifiedDate() {
return lastModifiedDate;
}
public void setLastModifiedDate(Instant lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
public Set<String> getAuthorities() {
return authorities;
}
public void setAuthorities(Set<String> authorities) {
this.authorities = authorities;
}
@Override
public String toString() {
return "UserDTO{" +
"login='" + login + '\'' +
", firstName='" + firstName + '\'' +
", lastName='" + lastName + '\'' +
", email='" + email + '\'' +
", imageUrl='" + imageUrl + '\'' +
", activated=" + activated +
", langKey='" + langKey + '\'' +
", createdBy=" + createdBy +
", createdDate=" + createdDate +
", lastModifiedBy='" + lastModifiedBy + '\'' +
", lastModifiedDate=" + lastModifiedDate +
", authorities=" + authorities +
"}";
}
}
| [
"lvivnazar95@gmail.com"
] | lvivnazar95@gmail.com |
a48859552182af8b0759ffafbc05b2d29f9ee42f | f028c8dcde5175c0c91a3cb7b53d964eac551e7f | /src/zad2/Test.java | 8a5b7a020d5ab9318b0d3038421011209fb31a83 | [] | no_license | Nikadoo/GUI-homework | 6f73d98e88fe8db7b0238670adf8d8695bbc9738 | ef193de1947d463a458e0f9e53d6b0fa1d08d3de | refs/heads/master | 2023-01-13T11:30:50.312457 | 2020-11-17T22:44:08 | 2020-11-17T22:44:08 | 313,760,356 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 597 | java | /**
*
* @author Ługowska Dominika S17226
*
*/
package zad2;
public class Test {
public static void main(String[] args) {
Pacjent[] pacjenci = { new ChoryNaGlowe("Janek"),
new ChoryNaNoge("Edzio"),
new ChoryNaDyspepsje("Marian")
};
for (Pacjent p : pacjenci) {
System.out.println("Pacjent: " + p.nazwisko() + '\n' +
"Chory na: " + p.choroba() + '\n' +
"Zastosowano: " + p.leczenie() +"\n\n"
);
}
}
}
| [
"domlugowska@gmail.com"
] | domlugowska@gmail.com |
cf2dc87e216aaa5ff0e4a7dc206bc3a51a2eac71 | 8c2150d1fe5ca118bc65b618a421ac53d77e8962 | /SWB4/swb/SWBPortlet-shared/src/org/semanticwb/portal/portlet/WBPortletContainer.java | 51318161834dc13ed321cf5da8860c5e8bc90fe7 | [] | no_license | haxdai/SemanticWebBuilder | b3d7b7d872e014a52bf493f613d145eb1e87b2e6 | dad201959b3429adaf46caa2990cc5ca6bd448e7 | refs/heads/master | 2021-01-20T10:49:55.948762 | 2017-01-26T18:01:17 | 2017-01-26T18:01:17 | 62,407,043 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,619 | java | /*
* SemanticWebBuilder es una plataforma para el desarrollo de portales y aplicaciones de integración,
* colaboración y conocimiento, que gracias al uso de tecnología semántica puede generar contextos de
* información alrededor de algún tema de interés o bien integrar información y aplicaciones de diferentes
* fuentes, donde a la información se le asigna un significado, de forma que pueda ser interpretada y
* procesada por personas y/o sistemas, es una creación original del Fondo de Información y Documentación
* para la Industria INFOTEC, cuyo registro se encuentra actualmente en trámite.
*
* INFOTEC pone a su disposición la herramienta SemanticWebBuilder a través de su licenciamiento abierto al público (‘open source’),
* en virtud del cual, usted podrá usarlo en las mismas condiciones con que INFOTEC lo ha diseñado y puesto a su disposición;
* aprender de él; distribuirlo a terceros; acceder a su código fuente y modificarlo, y combinarlo o enlazarlo con otro software,
* todo ello de conformidad con los términos y condiciones de la LICENCIA ABIERTA AL PÚBLICO que otorga INFOTEC para la utilización
* del SemanticWebBuilder 4.0.
*
* INFOTEC no otorga garantía sobre SemanticWebBuilder, de ninguna especie y naturaleza, ni implícita ni explícita,
* siendo usted completamente responsable de la utilización que le dé y asumiendo la totalidad de los riesgos que puedan derivar
* de la misma.
*
* Si usted tiene cualquier duda o comentario sobre SemanticWebBuilder, INFOTEC pone a su disposición la siguiente
* dirección electrónica:
* http://www.semanticwebbuilder.org
*/
package org.semanticwb.portal.portlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.portlet.Portlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.semanticwb.portal.api.SWBActionResponse;
import org.semanticwb.portal.api.SWBParamRequest;
/**
*
* @author Javier Solis Gonzalez
*/
public interface WBPortletContainer
{
final static String ATT_PORTLET_DEFINITION = "com.infotec.wb.portlet.PortletDefinition";
final static String ATT_PORTLET = "com.infotec.wb.portlet.Portlet";
final static String ATT_METHOD = "com.infotec.wb.portlet.Method";
final static String ATT_PORTLET_REQUEST = "javax.portlet.request";
final static String ATT_PORTLET_RESPONSE = "javax.portlet.response";
final static String ATT_PORTLET_CONFIG = "javax.portlet.config";
final static Integer VAL_METHOD_RENDER = new Integer(0);
final static Integer VAL_METHOD_ACTION = new Integer(1);
final static Integer VAL_METHOD_LOAD = new Integer(2);
final static Integer VAL_METHOD_INIT = new Integer(3);
public Portlet loadPortlet(WBPortletDefinition def, HttpServletRequest request);
public WBPortletDefinition getPortletDefinition(String site, String id);
public void removePortletDefinition(String site, String id);
public void addPortletDefinition(WBPortletDefinition def);
public void log(Throwable e);
public void log(String msg);
public void log(String msg, Throwable e);
public void invoke_render(HttpServletRequest request,
HttpServletResponse response, SWBParamRequest params,
WBPortletDefinition def) throws ServletException, IOException;
public void invoke_action(HttpServletRequest request,
SWBActionResponse params, WBPortletDefinition def)
throws ServletException, IOException;
}
| [
"softjei@gmail.com"
] | softjei@gmail.com |
a2854ae43b82c8e65333999c2c5a2546a77cba66 | 5d7f1ae962a2c51ee9fc666545c4b0e701d7902e | /src/chat/model/Chatbot.java | 60703a6bfe0d69d1ae8619393b541924f316e64e | [] | no_license | MaTtAtTx/Chatbot | b07d1bb246a25d3ea14f21050513e6cc402c4ca9 | 79209fbece0188fc8d40784a2b5787743126e61e | refs/heads/master | 2021-09-10T12:52:09.223242 | 2018-03-26T14:51:41 | 2018-03-26T14:51:41 | 107,289,396 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,868 | java | package chat.model;
import java.util.List;
import java.time.LocalTime;
import java.util.ArrayList;
/**
* The Chatbot subclass for the chatbot project.
*
* @author Matthew Johnsen
* @version 11/21/17 1.2
*/
public class Chatbot
{
private List<Movie> movieList;
private List<String> shoppingList;
private List<String> cuteAnimalMemes;
private String [] verbs;
private String [] topics;
private String [] followUps;
private String [] questions;
private String username;
private String content;
private String intro;
private LocalTime currentTime;
public Chatbot(String username)
{
this.movieList = new ArrayList<Movie>();
this.shoppingList = new ArrayList<String>();
this.cuteAnimalMemes = new ArrayList<String>();
this.verbs = new String [4];
this.topics = new String [7];
this.followUps = new String [5];
this.questions = new String [10];
this.username = username;
this.content = "";
this.intro = "";
this.currentTime = LocalTime.now();
buildMovieList();
buildShoppingList();
buildCuteAnimals();
buildVerbs();
buildTopics();
buildFollowUps();
buildQuestions();
}
private void buildMovieList()
{
movieList.add(new Movie("Angels and Demons"));
movieList.add(new Movie("The Hunger Games"));
movieList.add(new Movie("Harry Potter"));
movieList.add(new Movie("Pirates of the Carribbean"));
movieList.add(new Movie("Inception"));
movieList.add(new Movie("National Treasure"));
}
private void buildShoppingList()
{
shoppingList.add("protein");
shoppingList.add("veggies");
shoppingList.add("snacks");
shoppingList.add("fruits");
shoppingList.add("candy");
shoppingList.add("eggs");
shoppingList.add("hot peppers");
shoppingList.add("onions");
shoppingList.add("bagel");
shoppingList.add("crunchy peanut butter");
shoppingList.add("hot sauce");
shoppingList.add("juice");
}
private void buildCuteAnimals()
{
cuteAnimalMemes.add("pupper");
cuteAnimalMemes.add("otter");
cuteAnimalMemes.add("FLOOFER");
cuteAnimalMemes.add("kittie");
}
private void buildVerbs()
{
verbs[0] = "like";
verbs[1] = "dislike";
verbs[2] = "ambivalent about";
verbs[3] = "am thinking about";
}
private void buildTopics()
{
topics[0] = "programming";
topics[1] = "school";
topics[2] = "sports";
topics[3] = "food";
topics[4] = "TV shows";
topics[5] = "books";
topics[6] = "computers";
}
private void buildFollowUps()
{
followUps[0] = "I really like dogs. Do you?";
followUps[1] = "I really like cats. Do you?";
followUps[2] = "I really like ice cream. What's your favorite flavor of ice cream?";
followUps[3] = "I like going to restaurants. What's your favorite restaurant?";
followUps[4] = "I love boating. Have you ever been boating before?";
}
private void buildQuestions()
{
questions[0] = "What is your name?";
questions[1] = "How are you today?";
questions[2] = "What are you going to do this weekend?";
questions[3] = "What is your favorite thing to do in you free time?";
questions[4] = "What is your favorite subject in school?";
questions[5] = "What is your favorite color?";
questions[6] = "What is your favorite restaurant?";
questions[7] = "Do you have a car?";
questions[8] = "How old are you?";
questions[9] = "What country do you live in?";
}
public String processConversation(String input)
{
String chatbotResponse = "";
chatbotResponse += currentTime.getHour() + ":" + currentTime.getMinute() + " \n";
chatbotResponse += "You said:" + "\n" + input + "\n";
chatbotResponse += buildChatbotResponse();
return chatbotResponse;
}
private String buildChatbotResponse()
{
String response = "I ";
int random2 = ((int) (Math.random() * 2)) % 2;
int random = (int) (Math.random() * verbs.length);
response += verbs[random];
random = (int) (Math.random() * topics.length);
response += " " + topics[random] + ".\n";
random = (int) (Math.random() * questions.length);
if (random2 == 0)
{
response += questions[random];
}
else
{
response += questions[random] + "\n";
}
if (random2 == 0)
{
random = (int) (Math.random() * movieList.size());
response += "\n" + movieList.get(random).getTitle() + " is a great movie!\n";
}
int followup = (int) (Math.random() * 5);
switch (followup)
{
case 0:
response += followUps[0] + "\n";
break;
case 3:
response += followUps[1] + "\n";
case 2:
response += followUps[2] + "\n";
break;
default:
response += followUps[4] + "\n";
response += followUps[3] + "\n";
break;
}
return response;
}
public boolean lengthChecker(String input)
{
boolean validLength = false;
if (input != null && input.length() > 2)
{
validLength = true;
}
return validLength;
}
public boolean htmlTagChecker(String input)
{
boolean containsHTML = false;
if (input == null || !input.contains("<"))
{
return containsHTML;
}
int firstOpen = input.indexOf("<");
int firstClose = input.indexOf(">",firstOpen);
int secondOpen = -9;
int secondClose = -9;
String tagText = "";
//Check bad tags
if(input.contains("<>") || input.indexOf("< >") > -1)
{
containsHTML = false;
}
//Check singleton
if(input.toUpperCase().contains("<P>") || input.toLowerCase().contains("<br>"))
{
containsHTML = true;
}
//Check others
else if (firstClose > firstOpen)
{
//Others
tagText = input.substring(firstOpen + 1, firstClose).toLowerCase();
secondOpen = input.toLowerCase().indexOf("</" + tagText, firstClose);
}
return containsHTML;
}
public boolean userNameChecker(String input)
{
boolean userNameCheck = false;
if (input != null && input.length() > 0 && input.startsWith("@"))
{
if (input.indexOf("@") == input.lastIndexOf("@"))
{
userNameCheck = true;
}
}
return userNameCheck;
}
public boolean contentChecker(String contentCheck)
{
boolean checkContent = false;
if (contentCheck.contains(content))
{
checkContent = true;
}
return checkContent;
}
public boolean cuteAnimalMemeChecker(String input)
{
boolean animalCheck = false;
for (int index = 0; index < cuteAnimalMemes.size(); index += 1)
{
if (input.contains(cuteAnimalMemes.get(index)))
{
animalCheck = true;
}
}
return animalCheck;
}
public boolean shoppingListChecker(String shoppingItem)
{
boolean shoppingListCheck = false;
for (int index = 0; index < shoppingList.size(); index += 1)
{
if (shoppingItem.contains(shoppingList.get(index)))
{
shoppingListCheck = true;
}
}
return shoppingListCheck;
}
public boolean movieTitleChecker(String title)
{
return false;
}
public boolean movieGenreChecker(String genre)
{
return false;
}
public boolean quitChecker(String exitString)
{
if (exitString != null && exitString.equalsIgnoreCase("quit"))
{
return true;
}
return false;
}
public boolean keyboardMashChecker(String sample)
{
return false;
}
public List<Movie> getMovieList()
{
return movieList;
}
public List<String> getShoppingList()
{
return shoppingList;
}
public List<String> getCuteAnimalMemes()
{
return cuteAnimalMemes;
}
public String [] getQuestions()
{
return questions;
}
public String[] getVerbs()
{
return verbs;
}
public String[] getTopics()
{
return topics;
}
public String[] getFollowUps()
{
return followUps;
}
public String getUsername()
{
return username;
}
public String getContent()
{
return content;
}
public String getIntro()
{
return intro;
}
public LocalTime getCurrentTime()
{
return currentTime;
}
public void setUsername(String username)
{
this.username = username;
}
public void setContent(String content)
{
this.content = content;
}
}
| [
"31513806+mattitude17@users.noreply.github.com"
] | 31513806+mattitude17@users.noreply.github.com |
fb17ff51a8e7b54ea7242de8b8283f1d45354329 | 08ab891e5cae800aa0f61b8cd928dacf37969301 | /ndkrtspserver/src/main/java/com/peng/jni/AudioConfig.java | de6de72949c745c23a37baa7c19e6f4311ce011f | [] | no_license | ps993390891/PengSheng | 88d69ff6756edbd46cceae3d1fd1b82df12c4301 | c6968af658db164157fb840d46754660e884f449 | refs/heads/master | 2020-12-04T19:16:17.443787 | 2020-03-16T09:31:54 | 2020-03-16T09:31:54 | 231,878,733 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,023 | java | package com.peng.jni;
public class AudioConfig {
/*音频源*/
private final int audioSource;
/*采样率*/
private final int sampleRateInHz;
/*声道*/
private final int channelConfig;
// private final int channelConfigOut;
/*编码制式和采样大小*/
private final int audioFormat;
public AudioConfig(AudioConfigBuilder builder) {
this.audioSource = builder.audioSource;
this.sampleRateInHz = builder.sampleRateInHz;
this.channelConfig = builder.channelConfig;
// this.channelConfigOut = builder.channelConfigOut;
this.audioFormat = builder.audioFormat;
}
public int getAudioSource() {
return audioSource;
}
public int getSampleRateInHz() {
return sampleRateInHz;
}
public int getChannelConfig() {
return channelConfig;
}
// public int getChannelConfigOut() {
// return channelConfigOut;
// }
public int getAudioFormat() {
return audioFormat;
}
}
| [
"993390891@qq.com"
] | 993390891@qq.com |
b50b478f09b17d6a2c0eb5a2cd43ba6bb2a70c68 | 3e448fda9dae0752e579d68d3b034eeb8b112789 | /src/com/aeothod/properties/PropertiesAppUtils.java | 29ca7495445ee71dc96b5113e09184046d425b74 | [] | no_license | AeoliaQAQ/commonJavafx | bd00b9b30f297c7f801b288c723d28190c51f1b7 | b150b80c5b6ba85b521dfa9cb7712d47292d7b43 | refs/heads/master | 2020-05-20T18:46:02.591901 | 2019-05-09T03:01:44 | 2019-05-09T03:01:44 | 185,712,413 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 494 | java | package com.aeothod.properties;
import com.aeothod.utils.AbstractPropertiesUtils;
public class PropertiesAppUtils extends AbstractPropertiesUtils {
private static PropertiesAppUtils utils;
public static PropertiesAppUtils getInstance() {
if (null == utils) {
utils = new PropertiesAppUtils();
utils.init();
}
return utils;
}
@Override
protected String setPath() {
return "config/application.properties";
}
}
| [
"aeolia_wu@163.com"
] | aeolia_wu@163.com |
6c2b5e9e22a6fde6ce12f4ee18bcba6ecff7c160 | 2170936ca30aadf6ed492b98afa0f780331f34dd | /src/leetcode/LeetCoce1487.java | c807b7eeff4753907a56feaf1cc94334fab08ff8 | [] | no_license | Staunchjun/JZoffer_ | f1da0205abeb97f268bc883ca00051cafecefcb1 | b668634b9ba7c5da7270f734b000cc013696158a | refs/heads/master | 2021-09-23T18:52:25.718049 | 2021-09-21T15:25:20 | 2021-09-21T15:25:20 | 89,563,052 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,624 | java | package leetcode;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
public class LeetCoce1487 {
public static void main(String[] args) {
LeetCoce1487 leetCoce148 = new LeetCoce1487();
String[] t1 = {"pes", "fifa", "gta", "pes(2019)"};
String[] t2 = {"gta", "gta(1)", "gta", "avalon"};
String[] t3 = {"onepiece", "onepiece(1)", "onepiece(2)", "onepiece(3)"};
String[] t4 = {"wano", "wano", "wano", "wano"};
String[] t5 = {"kaido", "kaido(1)", "kaido", "kaido(1)"};
// System.out.println(Arrays.deepToString(leetCoce148.getFolderNames(t1)));
// System.out.println(Arrays.deepToString(leetCoce148.getFolderNames(t2)));
// System.out.println(Arrays.deepToString(leetCoce148.getFolderNames(t3)));
// System.out.println(Arrays.deepToString(leetCoce148.getFolderNames(t4)));
System.out.println(Arrays.deepToString(leetCoce148.getFolderNames(t5)));
}
private String[] getFolderNames(String[] names) {
final String suffix = "(%d)";
HashMap<String, Integer> set = new HashMap<>();
for (int i = 0; i < names.length; i++) {
String name = names[i];
if (set.containsKey(name)) {
int count = set.get(name);
while (set.containsKey(name.concat(String.format(suffix, count)))) {
count++;
}
set.put(name.concat(String.format(suffix, count)), 1);
set.put(name, set.get(name) + 1);
names[i] = name.concat(String.format(suffix, count));
} else {
set.put(name, 1);
}
}
return names;
}
/**
* 超时了
* 想想优化的方法吧
* 这里面的do while其实是可以优化的,能不能不do while
* 或者do while的次数少一点
*
* @param names
* @return
*/
private String[] getFolderNames1(String[] names) {
final String suffix = "(%d)";
HashSet<String> set = new HashSet<>();
for (int i = 0; i < names.length; i++) {
String name = names[i];
if (set.contains(name)) {
int count = 1;
String uniqueName;
do {
uniqueName = name.concat(String.format(suffix, count));
count++;
} while (set.contains(uniqueName));
set.add(uniqueName);
names[i] = uniqueName;
} else {
set.add(name);
}
}
return names;
}
}
| [
"541084008@qq.com"
] | 541084008@qq.com |
f2fea6c937faa553d627b190e7dd638ff96e1e2b | 7361d361ef69c1cc3ee2b747bd427bbb6ba6e9a7 | /src/com/javarush/test/level04/lesson13/task03/Solution.java | 4227a7044023b4ee0fb96d1f28f8ca4d14612e74 | [] | no_license | gegorov/JavaRushHomeWork | cafc8a59b8f0787ae2a80682030d92e696056d72 | f3bee11ce7464093ccc535046ad80130b718ed99 | refs/heads/master | 2021-01-12T02:47:45.535870 | 2017-01-23T14:22:00 | 2017-01-23T14:22:00 | 78,105,787 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 627 | java | package com.javarush.test.level04.lesson13.task03;
import java.io.*;
/* Рисуем треугольник
Используя цикл for вывести на экран прямоугольный треугольник из восьмёрок со сторонами 10 и 10.
Пример:
8
88
888
...
*/
public class Solution
{
public static void main(String[] args) throws Exception
{
//напишите тут ваш код
for(int i = 0; i < 10; i++)
{
for(int j = 0; j <= i; j++)
System.out.print(8);
System.out.println("");
}
}
}
| [
"gegorov@yahoo.com"
] | gegorov@yahoo.com |
7cec8e639fd019f88144a62c7c0319abe0c2f49d | 1f3cdd68a7c24460e4b33f59fc6701e2c4599e9b | /app/src/main/java/cn/com/xibeiuniversity/xibeiuniversity/activity/DetailImageActivity.java | b635e4927056535acb126a6f6bb5fc3108a5504a | [] | no_license | sun529417168/XiBeiUniversity | 7c3e5336d646c68e3115c2f6ff4bee8e1e904cf2 | 7e8f21a56fed59b5b018eadc975997a0d4ccfb11 | refs/heads/master | 2021-01-19T13:08:44.937372 | 2017-04-21T07:05:36 | 2017-04-21T07:05:36 | 83,405,504 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,641 | java | package cn.com.xibeiuniversity.xibeiuniversity.activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import java.io.BufferedInputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import cn.com.xibeiuniversity.xibeiuniversity.R;
import cn.com.xibeiuniversity.xibeiuniversity.base.BaseActivity;
/**
* 文件名:DetailImageActivity
* 描 述:查看图片类
* 作 者:stt
* 时 间:2017.01.09
* 版 本:V1.0.0
*/
public class DetailImageActivity extends BaseActivity implements ViewPager.OnPageChangeListener {
/**
* ViewPager
*/
private ViewPager viewPager;
/**
* 装点点的ImageView数组
*/
private ImageView[] tips;
/**
* 装ImageView数组
*/
private ImageView[] mImageViews;
private ImageView mImageViewObj;
private ArrayList<Bitmap> list = new ArrayList<Bitmap>();
private ArrayList listPath = new ArrayList();
private int imageType = -1;
private Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
switch (msg.what) {
// 正在下载
case 1:
ImageView imageView = (ImageView) msg.obj;
Bitmap bitmap = msg.getData().getParcelable("bitmap");
imageView.setImageBitmap(bitmap);
break;
default:
break;
}
}
;
};
@Override
protected void setView() {
setContentView(R.layout.activity_detail_image);
}
@Override
protected void setDate(Bundle savedInstanceState) {
imageType = getIntent().getIntExtra("type", 0);
if (imageType == 1) {
listPath = getIntent().getStringArrayListExtra("listPath");
} else {
listPath = getIntent().getStringArrayListExtra("listPath");
for (int i = 0; i < listPath.size(); i++) {
BitmapFactory.Options option = new BitmapFactory.Options();
option.inSampleSize = 2;
Bitmap bitmap = BitmapFactory.decodeFile((String) listPath.get(i), option);
list.add(bitmap);
}
}
}
public void getBitmap(final String url, ImageView imageView) {
Bitmap bm = null;
try {
URL iconUrl = new URL(url);
URLConnection conn = iconUrl.openConnection();
HttpURLConnection http = (HttpURLConnection) conn;
int length = http.getContentLength();
conn.connect();
// 获得图像的字符流
InputStream is = conn.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is, length);
bm = BitmapFactory.decodeStream(bis);
bis.close();
is.close();// 关闭流
Message msg = mHandler.obtainMessage();
msg.what = 1;
msg.obj = imageView;
Bundle data = new Bundle();
data.putParcelable("bitmap", bm);
msg.setData(data);
mHandler.sendMessage(msg);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void init() {
ViewGroup group = (ViewGroup) findViewById(R.id.activity_detailImage_viewGroup);
viewPager = (ViewPager) findViewById(R.id.activity_detailImage_viewPager);
// 将点点加入到ViewGroup中
tips = new ImageView[listPath.size()];
for (int i = 0; i < tips.length; i++) {
ImageView imageView = new ImageView(this);
imageView.setLayoutParams(new ViewGroup.LayoutParams(10, 10));
tips[i] = imageView;
if (i == 0) {
tips[i].setBackgroundResource(R.mipmap.item_yuan_yes);
} else {
tips[i].setBackgroundResource(R.mipmap.item_yuan_no);
}
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
new ViewGroup.LayoutParams(ViewPager.LayoutParams.WRAP_CONTENT,
ViewPager.LayoutParams.WRAP_CONTENT));
layoutParams.leftMargin = 5;
layoutParams.rightMargin = 5;
group.addView(imageView, layoutParams);
}
if (imageType == 1) {
mImageViews = new ImageView[listPath.size()];
for (int i = 0; i < listPath.size(); i++) {
final ImageView imageView = new ImageView(this);
mImageViews[i] = imageView;
final int finalI = i;
new Thread(new Runnable() {
@Override
public void run() {
getBitmap((String) listPath.get(finalI), imageView);
}
}).start();
}
} else {
// 将图片装载到数组中
mImageViews = new ImageView[list.size()];
for (int i = 0; i < mImageViews.length; i++) {
ImageView imageView = new ImageView(this);
mImageViews[i] = imageView;
imageView.setImageBitmap(list.get(i));
}
}
// 设置Adapter
viewPager.setAdapter(new MyAdapter());
// 设置监听,主要是设置点点的背景
viewPager.addOnPageChangeListener(this);
// 设置ViewPager的默认项, 设置为长度的100倍,这样子开始就能往左滑动
// viewPager.setCurrentItem((mImageViews.length) * 100);
}
/**
* 文件名:MyAdapter
* 描 述:图片滑动的适配器
* 作 者:stt
* 时 间:2016.12.06
* 版 本:V1.0.0
*/
public class MyAdapter extends PagerAdapter {
@Override
public int getCount() {
return mImageViews.length;
}
@Override
public boolean isViewFromObject(View arg0, Object arg1) {
return arg0 == arg1;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView(mImageViews[position]);
}
/**
* 载入图片进去,用当前的position 除以 图片数组长度取余数是关键
*/
@Override
public Object instantiateItem(ViewGroup container, int position) {
container.addView(mImageViews[position], 0);
return mImageViews[position];
}
}
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
setImageBackground(position % mImageViews.length);
}
@Override
public void onPageScrollStateChanged(int state) {
}
/**
* 设置选中的tip的背景
*
* @param selectItems
*/
private void setImageBackground(int selectItems) {
for (int i = 0; i < tips.length; i++) {
if (i == selectItems) {
tips[i].setBackgroundResource(R.mipmap.item_yuan_yes);
} else {
tips[i].setBackgroundResource(R.mipmap.item_yuan_no);
}
}
}
}
| [
"529417168@qq.com"
] | 529417168@qq.com |
5d9b55f537ba433ee8ed9cfc1125d670304519eb | 36626dd49b4a2be1540d579f5302b92c289fe808 | /refactoring.upc.edu.pe/src/test/java/refactoring/upc/edu/pe/test/MainTest.java | 96e3ff0050bc69cf3bb3fb05f7a0d8359b746966 | [] | no_license | Furtherron/RefactoringVideoStore | 028fc64c60d6e3dda099e2a278d32185b4727af7 | fce9d42b99b6a8d74a332347fc843356611818c3 | refs/heads/master | 2020-09-04T01:36:03.051782 | 2019-11-04T03:54:34 | 2019-11-04T03:54:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,275 | java | package refactoring.upc.edu.pe.test;
import static org.junit.Assert.*;
import org.junit.Test;
import refactoring.upc.edu.pe.Customer;
import refactoring.upc.edu.pe.Movie;
import refactoring.upc.edu.pe.Rental;
public class MainTest {
@Test
public void testCustomer() {
Customer c = new Customer("Jamie");
assertNotNull(c);
}
@Test
public void testStatement() throws Exception {
Movie m1 = new Movie("Interstella", Movie.REGULAR);
Movie m2 = new Movie("Arrival", Movie.NEW_RELEASE);
Movie m3 = new Movie("Moana", Movie.CHILDRENS);
Movie m4 = new Movie("LaLaLand", Movie.NEW_RELEASE);
Customer c = new Customer("Jamie");
c.addRental(new Rental(m1, 3));
c.addRental(new Rental(m2, 4));
c.addRental(new Rental(m3, 5));
c.addRental(new Rental(m4, 6));
String statementResult = c.statement();
System.out.println(statementResult);
assertEquals("Rental Record for Jamie\n" +
"\tInterstella\t3.5\n" +
"\tArrival\t12.0\n" +
"\tMoana\t4.5\n" +
"\tLaLaLand\t18.0\n" +
"You owed 38.0\n" +
"You earned 6 frequent renter points\n", statementResult);
}
}
| [
"antony_epis@hotmail.com"
] | antony_epis@hotmail.com |
de1f261f1073f6fa1c4548d54201839231b221d5 | 41a846e632e3cab3b5264f7b2e06eb6c883320a8 | /ShopApp/src/cn/cote/yzm/GeetestConfig.java | 55aa0a86bb10a8f7f0d8e611b0b00079ec672c21 | [] | no_license | CoTeNull/TrainingDemo | 53c063c0af58c1025ee5843a52f8b772c1bc1f32 | 7a6ddbe63213f4650ab4bac7223eccaa9df82260 | refs/heads/master | 2020-03-24T16:20:44.951754 | 2019-01-14T00:54:51 | 2019-01-14T00:54:51 | 142,821,281 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 618 | java | package cn.cote.yzm;
import javax.swing.text.StyledEditorKit.BoldAction;
/**
* GeetestWeb配置文件
*
*
*/
public class GeetestConfig {
// 填入自己的captcha_id和private_key
private static final String geetest_id = "df4785a3168a694fc82d2a5f3e52caf7";
private static final String geetest_key = "c6cf0fb514cf175ba18d6ffeb844d8ec";
private static final boolean newfailback = true;
public static final String getGeetest_id() {
return geetest_id;
}
public static final String getGeetest_key() {
return geetest_key;
}
public static final boolean isnewfailback() {
return newfailback;
}
}
| [
"895449345@qq.com"
] | 895449345@qq.com |
1d526627f9183785ca080923810e1eb502577647 | 83630e9a3642cd42afd06e0818a7078fd8a2e633 | /ed08/src/test/java/com/fatec/ed08/REQ01MantemLivrosTest.java | 9bdf154670f5374508cb4e9e046c75faf9ae8d26 | [] | no_license | rogrlj/TestesDeSoftware | 78e827ce5c3dc609e6094be06f78cbc6a80219b3 | a1c068a91b41c4fede692cf70fde511d752601c2 | refs/heads/master | 2023-08-22T22:04:22.773096 | 2021-10-16T00:01:15 | 2021-10-16T00:01:15 | 417,668,690 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,716 | java | package com.fatec.ed08;
import static org.assertj.core.api.Assertions.not;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
class REQ01MantemLivrosTest {
private WebDriver driver;
private Map<String, Object> vars;
JavascriptExecutor js;
@BeforeEach
public void setUp() {
System.setProperty("webdriver.chrome.driver", "browserDriver/chromedriver.exe");
driver = new ChromeDriver();
js = (JavascriptExecutor) driver;
vars = new HashMap<String, Object>();
}
@AfterEach
public void tearDown() {
driver.quit();
}
@Test
public void REQ01CT01_cadastrar_livro_com_sucesso() {
//dado que o livro não esta cadastrado
driver.get("https://ts-scel-web.herokuapp.com/login");
driver.findElement(By.name("username")).click();
driver.findElement(By.name("username")).sendKeys("jose");
driver.findElement(By.name("password")).click();
driver.findElement(By.name("password")).sendKeys("123");
driver.findElement(By.cssSelector("button")).click();
driver.findElement(By.linkText("Livros")).click();
espera();
// quando o usuario cadastrar um livro
driver.findElement(By.id("isbn")).click();
driver.findElement(By.id("isbn")).sendKeys("1910");
driver.findElement(By.id("autor")).click();
driver.findElement(By.id("autor")).sendKeys("Takehiko Inoue");
driver.findElement(By.id("titulo")).click();
driver.findElement(By.id("titulo")).sendKeys("Vagabond");
driver.findElement(By.cssSelector(".btn:nth-child(1)")).click();
driver.findElement(By.cssSelector("body")).click();
// entao apresenta as informacoes do livro
assertEquals(driver.findElement(By.id("paginaConsulta")).getText(), is("Lista de livros"));
driver.findElement(By.cssSelector("tr:nth-child(2) > td:nth-child(3)")).click();
assertEquals(driver.findElement(By.cssSelector("tr:nth-child(2) > td:nth-child(3)")).getText(), is("Vagabond"));
driver.findElement(By.cssSelector("tr:nth-child(2) .delete")).click();
}
@Test
public void REQ01CT02_altera_autor_e_titulo_de_livro_ja_cadastrado() {
//dado que o livro não esta cadastrado
driver.get("https://ts-scel-web.herokuapp.com/login");
driver.findElement(By.name("username")).click();
driver.findElement(By.name("username")).sendKeys("jose");
driver.findElement(By.name("password")).click();
driver.findElement(By.name("password")).sendKeys("123");
driver.findElement(By.cssSelector("button")).click();
driver.findElement(By.linkText("Livros")).click();
driver.findElement(By.id("isbn")).click();
driver.findElement(By.id("isbn")).sendKeys("1910");
driver.findElement(By.id("autor")).click();
driver.findElement(By.id("autor")).sendKeys("Takehiko Inoue");
driver.findElement(By.id("titulo")).click();
driver.findElement(By.id("titulo")).sendKeys("Vagabond");
driver.findElement(By.cssSelector(".btn:nth-child(1)")).click();
driver.findElement(By.cssSelector("body")).click();
// quando o usuario altera o autor e o titulo do livro
driver.findElement(By.linkText("Livros")).click();
driver.findElement(By.linkText("Lista de Livros")).click();
driver.findElement(By.cssSelector("tr:nth-child(2) .btn-primary")).click();
driver.findElement(By.id("autor")).click();
driver.findElement(By.id("autor")).click();
driver.findElement(By.id("autor")).click();
{
WebElement element = driver.findElement(By.id("autor"));
Actions builder = new Actions(driver);
builder.doubleClick(element).perform();
}
driver.findElement(By.id("autor")).click();
driver.findElement(By.id("autor")).click();
driver.findElement(By.id("autor")).sendKeys("Kazuo Koike");
driver.findElement(By.id("titulo")).click();
driver.findElement(By.cssSelector(".row:nth-child(4) > .form-group:nth-child(1)")).click();
driver.findElement(By.id("titulo")).sendKeys("Lobo Solitario");
driver.findElement(By.cssSelector(".btn")).click();
driver.findElement(By.cssSelector("body")).click();
// entao o sistema apresenta as informações do livro com o titulo e autor alterado
assertEquals(driver.findElement(By.id("paginaConsulta")).getText(), is("Lista de livros"));
driver.findElement(By.cssSelector("tr:nth-child(2) > td:nth-child(3)")).click();
assertEquals(driver.findElement(By.cssSelector("tr:nth-child(2) > td:nth-child(3)")).getText(), is("Lobo Solitario"));
driver.findElement(By.cssSelector("tr:nth-child(2) .delete")).click();
}
@Test
public void rEQ01CT03() {
//dado que o livro ja esta cadastrado
driver.get("https://ts-scel-web.herokuapp.com/login");
driver.findElement(By.name("username")).click();
driver.findElement(By.name("username")).sendKeys("jose");
driver.findElement(By.name("password")).click();
driver.findElement(By.name("password")).sendKeys("123");
driver.findElement(By.cssSelector("button")).click();
driver.findElement(By.linkText("Livros")).click();
driver.findElement(By.id("isbn")).click();
driver.findElement(By.id("isbn")).sendKeys("1910");
driver.findElement(By.id("autor")).click();
driver.findElement(By.id("autor")).sendKeys("Takehiko Inoue");
driver.findElement(By.id("titulo")).click();
driver.findElement(By.id("titulo")).sendKeys("Vagabond");
driver.findElement(By.cssSelector(".btn:nth-child(1)")).click();
driver.findElement(By.cssSelector("body")).click();
// quando o usuario excluir o livro
driver.findElement(By.linkText("Livros")).click();
driver.findElement(By.linkText("Lista de Livros")).click();
driver.findElement(By.cssSelector("tr:nth-child(2) .delete")).click();
driver.findElement(By.id("paginaConsulta")).click();
// entao o sistema apresenta as informações do livro sem o livro excluido
assertEquals(driver.findElement(By.id("paginaConsulta")).getText(), is("Lista de livros"));
driver.findElement(By.cssSelector("html")).click();
assertEquals(driver.findElement(By.cssSelector("html")).getText(), is(not("Lobo Solitario")));
}
public void espera() {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
| [
"rogrlj@hotmail.com"
] | rogrlj@hotmail.com |
35b035e309b3c397259a460c9000a2d156d86bbe | bcd77a91efd9179e61fa63dd9aa9882c77db9b9c | /chap08/src/exercise_js/Exercise8_6.java | 933dc8dda03b503e157e6ad9aa38c1276360700b | [] | no_license | wowwow19/Java | f6904df0f1c9c49bb0e71e455a75cb101094f3f7 | 0d99ee952c26d2c2fbae9ff4ef6b563788f08075 | refs/heads/main | 2023-03-08T13:02:38.366688 | 2021-02-18T13:27:14 | 2021-02-18T13:27:14 | 328,982,054 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | package exercise_js;
public class Exercise8_6 {
public static void main(String[] args) {
try {
method1(); // 3 4(X) 5
} catch(Exception e) {
System.out.println(5);
}
}
static void method1() {
try {
method2();
System.out.println(1);
} catch(ArithmeticException e) {
System.out.println(2);
} finally {
System.out.println(3);
}
System.out.println(4);
}
static void method2() {
throw new NullPointerException();
}
}
| [
"wowwow19@naver.com"
] | wowwow19@naver.com |
2e9af2558d362c3527264d6e2edc1e1e809c6c3d | 2d867531592c7a0ecd1267fc62e5e49ef3118355 | /java-study/news/src/com/zl/service/impl/NewsServiceImpl.java | ff26d1cc8dd43ec12500f12a1d2f1a135b75313c | [] | no_license | AMORHLS/java-baseStudy | b06b9eefe80c9c8ece056d56b2196c94973288b4 | c224abb8ad1d7d932ef1eeac5210289d0d1b83fa | refs/heads/master | 2021-04-06T08:40:50.921309 | 2018-03-14T03:07:23 | 2018-03-14T03:07:23 | 125,147,008 | 0 | 1 | null | null | null | null | GB18030 | Java | false | false | 924 | java | package com.zl.service.impl;
import java.util.List;
import com.zl.dao.NewsDao;
import com.zl.dao.impl.NewsDaoImpl;
import com.zl.pojo.News;
import com.zl.service.NewsService;
public class NewsServiceImpl implements NewsService {
private NewsDao newsDao;
public NewsServiceImpl() {
newsDao = new NewsDaoImpl();
}
public List<News> getNewsList() {
return newsDao.queryNews();
}
public boolean addNews(News news) {
return newsDao.addNews(news);
}
// 根据ID查询特定新闻信息
public News getNewsById(int id) {
return newsDao.getNewsById(id);
}
//获取新闻总数据
public int getTotalCount(){
return newsDao.getTotalCount();
}
//分页获取新闻数据
public List<News> getPageNewsList(int pageNo,int pageSize){
return newsDao.getPageNewsList(pageNo, pageSize);
}
// 删除新闻标题根据id
public boolean deleteNews(News news){
return newsDao.deleteNews(news);
}
}
| [
"314073805@qq.com"
] | 314073805@qq.com |
337cd58ffacdb8fc196b308ef1cdb6ee8a41bb71 | fbf2aa1bc8d4413e75a7dec52b70ff78857fd40b | /src/main/java/pl/sda/javastart/day6/Pensioner.java | 0f97d6f9df1d367743ed9ff139e799664f337e28 | [] | no_license | sylwiaswieczkowska/javastart | d6aada32028a6a9f9586d55c72b2648fa6753eac | 06640d4b31d3575ea8138fcedc159ba46aec2602 | refs/heads/master | 2020-04-19T18:06:18.408798 | 2019-11-13T12:18:59 | 2019-11-13T12:18:59 | 162,012,467 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 692 | java | package pl.sda.javastart.day6;
import java.math.BigDecimal;
public class Pensioner extends Person {
private BigDecimal pension;
public Pensioner(String firstName, String lastName, Integer identity, Integer age, BigDecimal pension) {
super(firstName, lastName, identity, age);
this.pension = pension;
}
public void introductionInner(){
super.intoduction();
System.out.println("Ale też emerycik");
}
@Override
public BigDecimal showIncome() {
return pension;
}
public BigDecimal getPension() {
return pension;
}
public void setPension(BigDecimal pension) {
this.pension = pension;
}
}
| [
"sylwia_candle@yahoo.pl"
] | sylwia_candle@yahoo.pl |
590852f3d4fdb109654e19c2bde7c058b5e97a71 | de69630707aee806715e913a2d03ec7e8f2c0a2c | /rabbit-feign-ucenter/src/main/java/com/rabbit/feign/ucenter/server/SysAppServer.java | 3f4c1b1b035e466706ab3f3b38b55960aba249d5 | [] | no_license | li930615/rabbit-feign-cloud | e1e96dc99f91b413d4259d802d9b11aed38b2202 | 74a8d633c024e5eb14870c64078f607320c1cc1c | refs/heads/master | 2020-04-23T10:20:56.997863 | 2019-02-28T01:06:45 | 2019-02-28T01:06:45 | 168,166,467 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 674 | java | package com.rabbit.feign.ucenter.server;
import com.rabbit.feign.ucenter.model.entity.SysApp;
import com.rabbit.feign.ucenter.server.fallback.SysAppServerFallbackImpl;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 〈一句话功能简述〉
*
* @author 我的姓名
* @date 2019/2/17 17:11
**/
@FeignClient(name = "rabbit-ucenter-server", fallback = SysAppServerFallbackImpl.class)
public interface SysAppServer {
@GetMapping(value = {"/ucenter/app/getByCode"})
SysApp getByCode(@RequestParam("code") String code);
}
| [
"39086192+li930615@user.noreply.github.com"
] | 39086192+li930615@user.noreply.github.com |
e3f61d3e38385b6bb5ae6eb590cfc9bd1d88de5f | 548a1b731709a376e079e1f0417cc401cce70aaf | /src/main/java/debug/Company.java | 654c38ae611e6645393f099f8debce74e67090d5 | [] | no_license | egydGIT/javaBackend | 0e96c6b2bab639ccdb4631b481b69a2205d3963c | be22a7148e10fb6da019a74e916dcd353fb53e70 | refs/heads/master | 2023-06-25T00:41:32.443210 | 2021-07-11T12:33:10 | 2021-07-11T12:33:10 | 309,369,092 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,315 | java | package debug;
import java.util.ArrayList;
import java.util.List;
public class Company {
// Employee employee = new Employee();
private List<Employee> employees; // employees nevű lista deklaráció
public Company(List<Employee> employees) { // Konstruktor, paraméterben kapott listát
this.employees = employees; // értékül adja a fent deklarált listának
}
public void addEmployee(Employee employee) { // addE metódus, ami a param-ben átadott nevet
employees.add(employee); // add met-sal hozzáadja a listához
}
public Employee findEmployeeByName(String name) { // Metódus, ami adott nevet keres a listában
for (Employee employee : employees) { // For-each ciklus, deklarál egy Emloyee tipusú változót,
// ami végigiterál a lista minden elemén
if (employee.getName().equals(name)) { // For-e c változójára meghívom getName met-t Visszaad: nevet
// majd ezt a nevet összehasonlítom az equals met-sal
// a findEBN met paraméterében megadott névvel.
return employee; // Visszatér a f-e c változója. Visszat.érték: true, false
}
}
return null; // ??
}
public List<String> listEmployeeNames() { // Metódus, ami kiírja a listában lévő neveket
List<String> names = new ArrayList<>(); // 2. lista deklaráció, amibe elmentem az első lista neveit
for (Employee employee : employees) { // for-e ciklus, ami végig lépked az emloyye listán
names.add(employee.getName()); // 2. listához add metódussal hozzáadom
// employee vált. getName met-sal lekért aktuális értékét
}
return names; // miután lezajlott a f-e ciklus, téjen vissza a 2. listával
}
}
| [
"egyd.eszter@gmail.com"
] | egyd.eszter@gmail.com |
637c9e835a9908466f0b1d398d31a8eef1f22f0b | 893f4c6ff2b7c585bb86b2134b9d1fb79fc0fdec | /app/src/main/java/com/kangsoo/pharmacy/activity/NavigationDrawerAdapter.java | f4cc83e49b7e867f556e2d46b83ceb62a42b6561 | [] | no_license | kangsoo/com-kangsoo-pharmacy | 9da8e705c9ed67a1319eabcd31824338b5711849 | fab5879aeb80c1cef9ea797537bbc5b891eb0ef4 | refs/heads/master | 2020-04-29T01:39:26.361304 | 2015-05-25T13:25:05 | 2015-05-25T13:25:49 | 35,393,402 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,481 | java | package com.kangsoo.pharmacy.activity;
import android.content.Context;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.kangsoo.pharmacy.R;
import com.kangsoo.pharmacy.model.User;
import java.util.ArrayList;
import java.util.List;
import static com.kangsoo.pharmacy.activity.NavigationDrawerObject.TYPE_ITEM_MENU;
import static com.kangsoo.pharmacy.activity.NavigationDrawerObject.TYPE_ITEM_ORG;
import static com.kangsoo.pharmacy.activity.NavigationDrawerObject.TYPE_SEPERATOR;
import static com.kangsoo.pharmacy.activity.NavigationDrawerObject.TYPE_SUBHEADER;
public class NavigationDrawerAdapter extends BaseAdapter {
private final Context context;
private final LayoutInflater inflater;
private User org = null;
private List<NavigationDrawerObject> data;
public NavigationDrawerAdapter(Context context, User org) {
this.org = org;
this.context = context;
this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
createData();
}
private void createData() {
//orgs.remove(0);
String[] names = new String[]{
context.getString(R.string.home),
context.getString(R.string.order),
context.getString(R.string.account),
context.getString(R.string.bookmarks)
};
String[] icons = context.getResources().getStringArray(R.array.navigation_drawer_icon_list);
data = new ArrayList<>();
int amount = names.length + 1 + 2;
for (int i = 0; i < amount; i++) {
if (i < names.length)
data.add(new NavigationDrawerObject(names[i], icons[i], TYPE_ITEM_MENU));
else if (i == names.length)
data.add(new NavigationDrawerObject(TYPE_SEPERATOR));
else if (i == names.length + 1)
data.add(new NavigationDrawerObject("Organizations", TYPE_SUBHEADER));
else
data.add(new NavigationDrawerObject(org.getName(), TYPE_ITEM_ORG, org));
}
}
public void setOrgs(User org) {
this.org = org;
notifyDataSetChanged();
}
@Override
public int getCount() {
return data.size();
}
@Override
public NavigationDrawerObject getItem(int position) {
return data.get(position);
}
@Override
public long getItemId(int position) {
return data.get(position).getType();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
final NavigationDrawerObject obj = data.get(position);
if (convertView == null || obj.getType() != ((ViewHolder) convertView.getTag()).type) {
viewHolder = new ViewHolder();
switch (obj.getType()) {
case TYPE_ITEM_MENU:
convertView = inflater.inflate(R.layout.navigation_drawer_list_item_text, parent, false);
viewHolder.name = (TextView) convertView.findViewById(R.id.navigation_drawer_item_name);
viewHolder.iconString = (TextView) convertView.findViewById(R.id.navigation_drawer_item_text_icon);
break;
case TYPE_ITEM_ORG:
convertView = inflater.inflate(R.layout.navigation_drawer_list_item_image, parent, false);
viewHolder.name = (TextView) convertView.findViewById(R.id.navigation_drawer_item_name);
viewHolder.iconDrawable = (ImageView) convertView.findViewById(R.id
.navigation_drawer_item_drawable_icon);
break;
case TYPE_SUBHEADER:
convertView = inflater.inflate(R.layout.navigation_drawer_list_subheader, parent, false);
viewHolder.name = (TextView) convertView.findViewById(R.id.navigation_drawer_item_name);
convertView.setEnabled(false);
convertView.setOnClickListener(null);
break;
default:
convertView = inflater.inflate(R.layout.navigation_drawer_list_seperator, parent, false);
convertView.setEnabled(false);
convertView.setOnClickListener(null);
break;
}
viewHolder.type = obj.getType();
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
switch (obj.getType()) {
case TYPE_ITEM_MENU:
Typeface font = Typeface.createFromAsset(context.getAssets(), "octicons.ttf");
viewHolder.iconString.setTypeface(font);
viewHolder.iconString.setText(obj.getIconString());
viewHolder.name.setText(obj.getTitle());
break;
case TYPE_ITEM_ORG:
viewHolder.name.setText(obj.getTitle());
break;
case TYPE_SUBHEADER:
viewHolder.name.setText(obj.getTitle());
break;
}
return convertView;
}
private class ViewHolder {
int type;
TextView name;
TextView iconString;
ImageView iconDrawable;
}
}
| [
"boningskim@hotmail.com"
] | boningskim@hotmail.com |
4a158ebdc70a7118e8d0894954dd018ee1b1012c | 71577d1a4a9862124cda867b41fba68eb06515b4 | /ServerProject001/src/com/info/model/Project.java | 00508b0b6964c1160f74e073756d18ce2326b8e1 | [] | no_license | monzilnepali/ProjectManagementTool | ab71990288bb12f144c21e53a19b4eb206dc69a4 | da8b0a209f98620cb3a3f3a2045598d9c2bc69f3 | refs/heads/master | 2020-03-16T10:00:39.901862 | 2018-08-12T17:09:17 | 2018-08-12T17:09:17 | 132,627,551 | 1 | 0 | null | 2018-06-29T08:42:42 | 2018-05-08T15:18:20 | Java | UTF-8 | Java | false | false | 1,777 | java | package com.info.model;
import java.io.File;
import java.io.Serializable;
import java.util.List;
@SuppressWarnings("serial")
public class Project implements Serializable {
private int projectId;
private String projectTitle;
private String categories;
private String projectDesc;
private List<String> TeamMember;
private String projectCreationDate;
private List<File> fileList;
private String projectImage;
private int roleId;
public int getProjectId() {
return projectId;
}
public void setProjectId(int projectId) {
this.projectId = projectId;
}
public String getprojectTitle() {
return projectTitle;
}
public void setprojectTitle(String projectTitle) {
this.projectTitle = projectTitle;
}
public String getProjectDesc() {
return projectDesc;
}
public void setProjectDesc(String projectDesc) {
this.projectDesc = projectDesc;
}
public List<String> getTeamMember() {
return TeamMember;
}
public void setTeamMember(List<String> teamMember) {
TeamMember = teamMember;
}
public String getCategories() {
return categories;
}
public void setCategories(String categories) {
this.categories = categories;
}
public String getProjectCreationDate() {
return projectCreationDate;
}
public void setProjectCreationDate(String projectCreationDate) {
this.projectCreationDate = projectCreationDate;
}
public int getRoleId() {
return roleId;
}
public void setRoleId(int roleId) {
this.roleId = roleId;
}
public List<File> getFileList() {
return fileList;
}
public void setFileList(List<File> fileList) {
this.fileList = fileList;
}
public String getProjectImage() {
return projectImage;
}
public void setProjectImage(String projectImage) {
this.projectImage = projectImage;
}
}
| [
"manjilnepali98@gmail.com"
] | manjilnepali98@gmail.com |
a50c09d094b4868fe4fa73fc157adc29fbf6853e | 185c7cfdd132aeda18564f44968404f7a6558488 | /src/main/java/za/ac/cput/domain/staff/StaffDemography.java | 16bdd6ef40c6909e725ec0440b45496ea69ca7df | [] | no_license | examsAccount/domain | f7757db75604e1717533d8cf816ced27812a28c6 | 7a7ca008a140e2a6e0e87261b6badd82a1d7be32 | refs/heads/master | 2021-07-15T23:21:59.113542 | 2019-09-21T07:46:48 | 2019-09-21T07:46:48 | 209,937,154 | 0 | 0 | null | 2020-10-13T16:11:30 | 2019-09-21T06:33:13 | Java | UTF-8 | Java | false | false | 1,576 | java | package za.ac.cput.domain.staff;
import java.util.Date;
import java.util.Objects;
public class StaffDemography {
private String staffNum,genderId,raceId,staffTitle;
private Date dateOfBirth;
private StaffDemography(){}
public StaffDemography(String staffNum, String genderId, String raceId, String staffTitle, Date dateOfBirth) {
this.staffNum = staffNum;
this.genderId = genderId;
this.raceId = raceId;
this.staffTitle = staffTitle;
this.dateOfBirth = dateOfBirth;
}
public String getStaffNum() {
return staffNum;
}
public String getGenderId() {
return genderId;
}
public String getRaceId() {
return raceId;
}
public String getStaffTitle() {
return staffTitle;
}
public Date getDateOfBirth() {
return dateOfBirth;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
StaffDemography that = (StaffDemography) o;
return staffNum.equals(that.staffNum);
}
@Override
public int hashCode() {
return Objects.hash(staffNum);
}
@Override
public String toString() {
return "StaffDemography{" +
"staffNum='" + staffNum + '\'' +
", genderId='" + genderId + '\'' +
", raceId='" + raceId + '\'' +
", staffTitle='" + staffTitle + '\'' +
", dateOfBirth=" + dateOfBirth +
'}';
}
}
| [
"ncebagoniwe@gmail.com"
] | ncebagoniwe@gmail.com |
eb1e91f5544e631a777cbab0494f79a3feaf4bc2 | 6c64b11697c5420dee1005422c4bfc98d9c4a167 | /src/Test.java | 0163c624f1e85e5a1667a70352d588bdac6ffde0 | [] | no_license | marcFraysse/Shape-Comparison-and-Retrieval | ac6cdf4a54ab4cdc22f7d8d0ec08f79988bf1741 | 25ab00645fad62241fa51ee92baeecbe26b747e6 | refs/heads/master | 2020-06-28T18:39:12.674481 | 2016-12-11T19:24:16 | 2016-12-11T19:24:16 | 74,484,212 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 51 | java |
public class Test {
//this is a test class
}
| [
"fraysse.marc@gmail.com"
] | fraysse.marc@gmail.com |
b5fee387846afab334951ecb484341a2151e37f3 | d2b7f664fd190b2f8577228b49e2709eacc3a66d | /shop/src/main/java/de/shop/kundenverwaltung/service/KundeScheduler.java | 24ddf82d7b80e031eea1fd18bf68afeaf6929ccd | [] | no_license | homa1013/shop-repo | 800191e47c68aaa9487bb3ff71bdb59f5ade3dc1 | 4dc5e40b99f80d8f2cc1a111f1bd9ce76041b9be | refs/heads/master | 2020-06-01T03:32:56.638731 | 2013-10-25T09:41:46 | 2013-10-25T09:41:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,420 | java | package de.shop.kundenverwaltung.service;
import java.lang.invoke.MethodHandles;
import java.util.Collection;
import java.util.List;
import javax.ejb.Schedule;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import org.jboss.logging.Logger;
import de.shop.auth.domain.RolleType;
import de.shop.kundenverwaltung.domain.AbstractKunde;
import de.shop.util.interceptor.Log;
/**
* @author <a href="mailto:Juergen.Zimmermann@HS-Karlsruhe.de">Jürgen Zimmermann</a>
*/
@Stateless
@Log
public class KundeScheduler {
private static final Logger LOGGER = Logger.getLogger(MethodHandles.lookup().lookupClass());
@Inject
private transient EntityManager em;
@Inject
private KundeService ks;
@Schedule(dayOfMonth = "*", hour = "2", minute = "0", year = "*", persistent = false)
public void deleteKundeOhneBestellungen() {
final List<AbstractKunde> kunden =
em.createNamedQuery(AbstractKunde.FIND_KUNDEN_OHNE_BESTELLUNGEN, AbstractKunde.class)
.getResultList();
for (AbstractKunde k : kunden) {
final Collection<RolleType> rollen = k.getRollen();
if (rollen != null && rollen.contains(RolleType.ADMIN)) {
// Admin nicht loeschen
continue;
}
ks.deleteKunde(k);
LOGGER.infof("Kunde #%d wurde geloescht (ohne Bestellungen)", k.getId());
}
}
}
| [
"homa1013@hs-karlsruhe.de"
] | homa1013@hs-karlsruhe.de |
edf9d8aed6e181c194023473ea163d7ecd067823 | 4124ab932c4cabd071bd1ab53c9cefaa35a788e4 | /src/main/java/com/example/demo/XmlDataApplication.java | 92d218cc6020482d12251f1158062cba82bc6c21 | [] | no_license | connect2nelson/apacheCXFStubClient | 4d162357dfa283bd82e3053bb0860328e92a44ae | 9a57de68f01df00c377a08553ad57e22fc2f9751 | refs/heads/master | 2021-07-13T05:40:28.085309 | 2017-10-16T22:09:33 | 2017-10-16T22:09:33 | 107,187,426 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@ComponentScan
public class XmlDataApplication {
public static void main(String[] args) {
SpringApplication.run(XmlDataApplication.class, args);
}
}
| [
"nelson.csits@gmail.com"
] | nelson.csits@gmail.com |
9ae60e9621799f7251120f17d60db10a0ef5b54d | 0f8fd31b97a52292c66a8a7497c206b81f75e536 | /app/src/main/java/eu/laramartin/medsreminder/meds/MedsAdapter.java | 4390b4ea0dbb9ef72b1ba06f9fd95e11e3c22fff | [
"MIT"
] | permissive | laramartin/android_meds_reminder | 935e48cdae776f5658b891f9af63da685e49512b | 70ecbda399460854e3c2acd2f3354dcd7fade2dd | refs/heads/master | 2021-01-02T23:00:32.179392 | 2017-10-21T12:16:48 | 2017-10-21T12:16:48 | 99,438,071 | 4 | 0 | null | 2017-10-03T09:00:38 | 2017-08-05T17:35:23 | Java | UTF-8 | Java | false | false | 8,419 | java | /*
* PROJECT LICENSE
*
* This project was submitted by Lara Martín as part of the Nanodegree At Udacity.
*
* As part of Udacity Honor code, your submissions must be your own work, hence
* submitting this project as yours will cause you to break the Udacity Honor Code
* and the suspension of your account.
*
* Me, the author of the project, allow you to check the code as a reference, but if
* you submit it, it's your own responsibility if you get expelled.
*
* Copyright (c) 2017 Lara Martín
*
* Besides the above notice, the following license applies and this license notice
* must be included in all works derived from this project.
*
* MIT License
*
* 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 eu.laramartin.medsreminder.meds;
import android.content.Context;
import android.graphics.Paint;
import android.support.constraint.ConstraintLayout;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.firebase.analytics.FirebaseAnalytics;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import eu.laramartin.medsreminder.R;
import eu.laramartin.medsreminder.common.CalendarUtility;
import eu.laramartin.medsreminder.common.DialogsUtility;
import eu.laramartin.medsreminder.common.MedsUtility;
import eu.laramartin.medsreminder.firebase.AnalyticsUtility;
import eu.laramartin.medsreminder.model.Med;
import eu.laramartin.medsreminder.model.Report;
import static eu.laramartin.medsreminder.common.MedsUtility.getReportFromMed;
import static eu.laramartin.medsreminder.common.Utils.runVibration;
import static eu.laramartin.medsreminder.firebase.FirebaseUtility.writeReportOnDb;
public class MedsAdapter extends RecyclerView.Adapter<MedsAdapter.MedViewHolder> {
private List<Med> meds = new ArrayList<>();
private FirebaseAnalytics firebaseAnalytics;
public MedsAdapter(FirebaseAnalytics firebaseAnalytics) {
this.firebaseAnalytics = firebaseAnalytics;
}
public void add(Med med) {
meds.add(med);
notifyItemInserted(meds.size() - 1);
}
@Override
public MedViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
Context context = parent.getContext();
LayoutInflater inflater = LayoutInflater.from(context);
View view = inflater.inflate(R.layout.list_med_item, parent, false);
return new MedViewHolder(view);
}
@Override
public void onBindViewHolder(MedViewHolder holder, int position) {
holder.bind(meds.get(position));
}
@Override
public int getItemCount() {
if (meds != null) {
return meds.size();
}
return 0;
}
public void remove(Med med) {
for (int i = 0; i < meds.size(); i++) {
if (med.getKey().equals(meds.get(i).getKey())) {
meds.remove(i);
notifyItemRemoved(i);
break;
}
}
}
private String nextDate(Med med) {
Date date = CalendarUtility.getNextTake(med);
return CalendarUtility.getFormattedDate(date);
}
public class MedViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
@BindView(R.id.med_icon)
ImageView medIcon;
@BindView(R.id.med_name)
TextView medName;
@BindView(R.id.med_reminder_icon)
ImageView medReminder;
@BindView(R.id.med_time)
TextView medTime;
@BindView(R.id.med_days)
TextView medDays;
@BindView(R.id.med_notes)
TextView medNotes;
@BindView(R.id.meds_edit)
TextView medEdit;
@BindView(R.id.med_date)
TextView medDate;
@BindView(R.id.med_time_status)
TextView medTimeStatus;
@BindView(R.id.meds_constraint_layout_details)
ConstraintLayout medsLayoutDetails;
@BindView(R.id.icon_arrow_down)
ImageView arrowDownIcon;
@BindView(R.id.meds_take_label)
TextView takeMedLabel;
private MedsAdapterItem medsAdapterItem;
public MedViewHolder(final View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this);
medEdit.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG);
takeMedLabel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Report report = getReportFromMed(medsAdapterItem.getMed());
writeReportOnDb(report);
AnalyticsUtility.takeMed(firebaseAnalytics, medsAdapterItem.getMed());
Toast.makeText(itemView.getContext(), medName.getText() +
itemView.getContext().getString(R.string.meds_taken_feedback),
Toast.LENGTH_SHORT).show();
}
});
}
@Override
public void onClick(View view) {
medsAdapterItem.setExpanded(!medsAdapterItem.isExpanded());
setDetailsVisibility();
}
private void setDetailsVisibility() {
if (medsAdapterItem.isExpanded()) {
showDetails();
} else {
hideDetails();
}
}
private void showDetails() {
medsLayoutDetails.setVisibility(View.VISIBLE);
arrowDownIcon.setVisibility(View.INVISIBLE);
}
private void hideDetails() {
medsLayoutDetails.setVisibility(View.GONE);
arrowDownIcon.setVisibility(View.VISIBLE);
}
public void bind(Med med) {
MedsAdapterItem medsAdapterItem = new MedsAdapterItem();
medsAdapterItem.setMed(med);
this.medsAdapterItem = medsAdapterItem;
medIcon.setImageResource(MedsUtility.getMedIcon(med.getDosage()));
medName.setText(med.getName());
if (med.getReminderJobTags() != null && !med.getReminderJobTags().isEmpty()) {
medReminder.setVisibility(View.VISIBLE);
} else {
medReminder.setVisibility(View.INVISIBLE);
}
medDate.setText(nextDate(med));
medTime.setText(med.getTime());
// TODO: 31.08.17 Lara: handle different time status, hardcoded until feature is implemented
medTimeStatus.setText("On time");
medDays.setText(CalendarUtility.getFormattedDaysOfWeek(itemView.getContext(), med.getDays()));
if (med.getNotes() != null && !med.getNotes().isEmpty()) {
medNotes.setText(med.getNotes());
medNotes.setVisibility(View.VISIBLE);
} else {
medNotes.setVisibility(View.INVISIBLE);
}
setDetailsVisibility();
}
@Override
public boolean onLongClick(View view) {
DialogsUtility.showRemoveMedDialog(view.getContext(), medsAdapterItem);
runVibration(view);
return true;
}
}
}
| [
"lara.martin.carretero@gmail.com"
] | lara.martin.carretero@gmail.com |
e841ae49c86647dcbcc253212743b0dc918d9aad | 85f8f7b86b3c0679f8e92494f3c16968a86e9105 | /Data Structures/LinkedLists/Insert_a_node_at_the_head_of_a_LinkedList.java | 206eec9c6be0ee5d2d8d20894348b3e422f62ee1 | [] | no_license | jerrychlee/HackerRank | cc5d81ae520a9a31d402e4acb675071376423586 | 6de5d978b0c0bf8dd4e94de4e07c2dee84633696 | refs/heads/master | 2022-06-06T10:04:18.592315 | 2022-05-22T12:35:05 | 2022-05-22T12:35:05 | 109,255,473 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 391 | java | /*
Insert Node at the beginning of a linked list
head pointer input could be NULL as well for empty list
Node is defined as
class Node {
int data;
Node next;
}
*/
// This is a "method-only" submission.
// You only need to complete this method.
Node Insert(Node head,int x) {
Node p = new Node();
p.data = x;
p.next = head;
return p;
} | [
"jerrychlee@gmail.com"
] | jerrychlee@gmail.com |
4464f9958d9254ade9ef0941c468ccce50045e27 | dda94da853000e2adb0b8f1d09a7786b05a98dd8 | /src/Objects/Fruits/WormKiller.java | 348805d5b9dafbe3933f13f663afeb8498f01c06 | [] | no_license | KeyKia/FruitCollector | f8d175f1be5581d9081ed5eeafa92eb7d9f29953 | 97647371819e9094aa48cd8f93698a32eb5f94dd | refs/heads/master | 2021-01-15T18:00:44.126376 | 2017-08-26T12:12:03 | 2017-08-26T12:12:03 | 99,775,746 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 595 | java | package Objects.Fruits;
import Game.GameScene;
import javafx.scene.canvas.Canvas;
import javafx.scene.image.Image;
/**
* Created by jeem on 6/27/2017.
*/
public class WormKiller extends Fruits {
static private final Image img = new Image("file:Resources/images/worms/wormKiller.png");
public WormKiller() {
super(((int) (GameScene.UNIT * 30)), ( (100 * GameScene.UNIT / GameScene.SPEED_CONVERTER)), 0, img);
}
@Override
public void move(Canvas fruitCanvas, double width, double start) {
fruitCanvas.setLayoutY(fruitCanvas.getLayoutY() + speed);
}
}
| [
"arash.jeem@gmail.com"
] | arash.jeem@gmail.com |
ef0cadc6b306297a8328247c612a009257139372 | 0308489cc3414dc04ec6d2f1ff731a2bd1a6a7d7 | /01-QuestionOne/src/Classes/Animal.java | 710645e941990841408b6fd9e32a98e709a9c37f | [] | no_license | MichaelCoey/neueda-test-michaelcoey | bfd4b366e09ead05731731cbd9d6a29a29738f8e | 81463053038b5eb9c3a76d9fbef743f80d6a69fc | refs/heads/master | 2020-04-10T04:44:57.893698 | 2018-12-07T15:39:36 | 2018-12-07T15:39:36 | 160,807,961 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 271 | java | package Classes;
public class Animal {
private String name;
public Animal() {
super();
}
public Animal(String name) {
super();
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"michaelcoey@outlook.com"
] | michaelcoey@outlook.com |
33b718c31592ed3e3e6dab57d1c97b983824cde0 | 9d2a25381c5a44dd4bb537b847a1f7c066efbca5 | /src/test/java/org/parksy/java/examples/logging/LoggingTest.java | b702f3d07212e0c381dae7622cead7980c0fbb69 | [] | no_license | djparks/JavaSamples | 45fbfd8dc29caff7377c8fe4f1f382cedbf1222c | 76569a5f4e5aa3f81d3796f33c0d693088119b50 | refs/heads/master | 2022-07-26T13:00:21.265258 | 2022-07-20T19:47:34 | 2022-07-20T19:47:34 | 4,502,524 | 0 | 0 | null | 2022-07-20T19:47:35 | 2012-05-31T01:18:41 | Java | UTF-8 | Java | false | false | 606 | java | package org.parksy.java.examples.logging;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.MethodRule;
import org.junit.rules.TestWatchman;
import org.junit.runners.model.FrameworkMethod;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
public class LoggingTest {
@Rule
public MethodRule watchman = new TestWatchman() {
public void starting(FrameworkMethod method) {
// logger.info("{} being run...", method.getName());
}
};
// final Logger logger = LoggerFactory.getLogger(LoggingTest.class);
@Test
public void testA() {
}
@Test
public void testB() {
}
} | [
"djparks@usa.net"
] | djparks@usa.net |
011dbeb599dd9a6abee87fd6b0069df38a5273d1 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.mm/classes.jar/com/tencent/mm/plugin/finder/live/plugin/bz$p.java | 551d95538ea8c8652130bba949699e1a8b92f71f | [] | no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 904 | java | package com.tencent.mm.plugin.finder.live.plugin;
import com.tencent.mm.protocal.protobuf.bkd;
import com.tencent.mm.ui.base.w;
import kotlin.Metadata;
import kotlin.ah;
import kotlin.g.a.q;
import kotlin.g.b.ah.f;
import kotlin.g.b.u;
import kotlinx.coroutines.cb;
@Metadata(d1={""}, d2={"<anonymous>", "", "success", "", "errMsg", "", "<anonymous parameter 2>", "Lcom/tencent/mm/protocal/protobuf/FinderLiveModShopShelfResponse;"}, k=3, mv={1, 5, 1}, xi=48)
final class bz$p
extends u
implements q<Boolean, String, bkd, ah>
{
bz$p(cb paramcb, ah.f<w> paramf, q<? super Boolean, ? super Integer, ? super Integer, ah> paramq, int paramInt1, int paramInt2)
{
super(3);
}
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes2.jar
* Qualified Name: com.tencent.mm.plugin.finder.live.plugin.bz.p
* JD-Core Version: 0.7.0.1
*/ | [
"98632993+tsuzcx@users.noreply.github.com"
] | 98632993+tsuzcx@users.noreply.github.com |
3c62bdf791a3cee03f4373a4ebe2a0c78b88cd56 | 6829f722e1e776649feaa08dee1899fbee8b54a0 | /a6-nishita1207/src/a6/Crab.java | 95a5241749e265dd4ba8b69c39ca4e4e652f99f5 | [] | no_license | nishita1207/COMP401 | 5c6818fe4a6556dff7bc3003c9c8a4236747c959 | 8fa69877f7f5749fba10255f4bd6740f85f42401 | refs/heads/master | 2020-08-03T12:56:56.688251 | 2019-09-30T02:28:15 | 2019-09-30T02:28:15 | 211,752,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 144 | java |
package a6;
public class Crab extends IngredientDetail{
public Crab(){
super("crab", 37, 0.72, false, false, true);
}
} | [
"Yadav@Nishitas-MacBook.local"
] | Yadav@Nishitas-MacBook.local |
6ee2234da7e2365d0057f509e50b9cb0bc2014a8 | 79c9416fdf4fc3926ccf8ea3e3b22d7cc504c0d3 | /src/main/java/com/example/mybatis/repository/AutorMyBatisRepository.java | dfc7150ad24f36fd27e93b67766826102ac11adb | [] | no_license | MaxChanGonzales/EC2 | fbe72ee4ab1fdff8f130e3a01b2df495e9725fff | 7695e1e43034ced93861c884c0565b248c135419 | refs/heads/master | 2023-08-23T03:26:19.641525 | 2021-11-04T05:25:38 | 2021-11-04T05:25:38 | 424,412,062 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,143 | java | /*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
*/
package com.example.mybatis.repository;
import com.example.mybatis.entity.Autor;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
/**
*
* @author Max
*/
@Mapper
public interface AutorMyBatisRepository {
@Select("select * from autor")
public List<Autor> findAll();
@Select("select * from autor where idautor=#{id}")
public Autor readAutor(Integer id);
@Delete("DELETE FROM autor WHERE idautor = #{id}")
public int deleteById(Integer id);
@Insert("INSERT INTO autor(nombres, apellidos) VALUES (#{nombres}, #{apellidos})")
public int insert(Autor autor);
@Update("Update autor set nombres=#{nombres}, apellidos=#{apellidos} where idautor=#{idautor}")
public int update(Autor autor);
}
| [
"Max@DESKTOP-Q1D9088"
] | Max@DESKTOP-Q1D9088 |
a96d7984257efc7202cc31b7277d9b92febcb851 | b4b5ebed4f62f67c8b705b76db414b216352147f | /src/by/it/yatsevich/jd01_01/TaskC1.java | f2c5c79b161867a7f5cb7665ce0b130423a7fa0f | [] | no_license | emakovski/JD2020-09-07 | 05d2d1a6881d91380f8382a842c2fa4b2c888c16 | c597ba029c51b9bfe5ed45a4fabbc465ee7fb3f4 | refs/heads/master | 2023-01-05T11:44:25.143256 | 2020-10-30T14:09:01 | 2020-10-30T14:09:01 | 302,882,827 | 1 | 0 | null | 2020-10-10T11:07:42 | 2020-10-10T11:07:42 | null | UTF-8 | Java | false | false | 728 | java | package by.it.yatsevich.jd01_01;
import java.util.Scanner;
/* Нужно написать программу, которая вводит два числа с клавиатуры
и выводит их сумму на экран в виде
Ввод (это вы вводите с клавиатуры):
34 26
Вывод (это должна появится в консоли, обратите внимание на пробелы и слово Sum:
Sum = 60
*/
class TaskC1 {
public static void main(String[] args) {
Scanner sc1 = new Scanner(System.in);
int a = sc1.nextInt();
int b = sc1.nextInt();
int c = a+b;
System.out.println("Sum" + " " + "=" + " " + c);
}
}
| [
"gob1in@Mail.ru"
] | gob1in@Mail.ru |
84cf0767293f14a8af01c832a28633ec331f07bc | c63cd8f2d343c4a31099b45c09bf61ad4f7e50e1 | /343. Integer Break.java | 878fce13c1dfca7584308f655b46b964073f6a83 | [] | no_license | GarhomLee/LeetCode | b449652b57015cb7cc67ff53566522c304462a40 | d69323b73a1bc7cb19ea955964f90ae29e86fdd6 | refs/heads/master | 2022-05-17T16:58:15.333682 | 2022-04-08T21:06:30 | 2022-04-08T21:06:30 | 181,504,736 | 14 | 5 | null | null | null | null | UTF-8 | Java | false | false | 1,126 | java | https://leetcode.com/problems/integer-break/
// 根据数学性质可知,只有分成2和3的乘积才会最大。
// 解法一:iteration
// 1)n为2和3时需要作为特殊性情况单独讨论
// 2)在循环中,n == 4要和n == 2放在一起讨论,以免把n == 4的情况并入n == 3的情况
class Solution {
public int integerBreak(int n) {
if (n <= 2) return 1;
if (n == 3) return 2;
int product = 1;
while (n >= 2) {
if (n == 2 || n == 4) {
product *= 2;
n -= 2;
} else {
product *= 3;
n -= 3;
}
}
return product;
}
}
// 解法二:DP,内层只需要循环1,2,3这三个数
class Solution {
public int integerBreak(int n) {
int[] dp = new int[n + 1];
dp[1] = 1;
for (int i = 2; i <= n; i++) {
for (int j = 1; j < i && j < 4; j++) {
dp[i] = Math.max(dp[i], j * (Math.max(i - j, dp[i - j])));
}
}
return dp[n];
}
} | [
"garhomlee@gmail.com"
] | garhomlee@gmail.com |
162d27ab0e6cb4ed2ed1f9b1300e35c182677fc1 | fe8f78d10e26fa7db781e76eb6f418853ae00e5d | /smallrye-reactive-messaging-vertx-eventbus/src/test/java/io/smallrye/reactive/messaging/eventbus/EventbusTestBase.java | 9757f53a1ac105369c8b5f13ee0224e172f42cde | [
"Apache-2.0"
] | permissive | matzew/smallrye-reactive-messaging | 8a4f9d1e64d50e7070986d2504399f0109cfe2da | 993e322e5f43e3474b356b20d9397b2710c26277 | refs/heads/master | 2020-04-11T21:12:59.225985 | 2018-12-14T11:03:05 | 2018-12-14T11:03:05 | 162,098,656 | 0 | 0 | Apache-2.0 | 2018-12-17T08:30:18 | 2018-12-17T08:30:17 | null | UTF-8 | Java | false | false | 412 | java | package io.smallrye.reactive.messaging.eventbus;
import io.vertx.reactivex.core.Vertx;
import org.junit.After;
import org.junit.Before;
public class EventbusTestBase {
Vertx vertx;
protected EventBusUsage usage;
@Before
public void setup() {
vertx = Vertx.vertx();
usage = new EventBusUsage(vertx.eventBus().getDelegate());
}
@After
public void tearDown() {
vertx.close();
}
}
| [
"clement.escoffier@gmail.com"
] | clement.escoffier@gmail.com |
b6a2e2804e02e880b3ad575fd526d7afb6726857 | 50063a288925a99ec3181691328540733379e0e7 | /src/cn/zhangpeng/TestDemo.java | 2b8d28aa3eececa9bbb4fed0399140f1dd52bd7a | [] | no_license | stuzhangpeng/threadpool | e11dc74c04425b3af9a6e55656bc44e8bf08d8f6 | 97258a9574ad0ac2ca67b46392850bfd5e1fb148 | refs/heads/master | 2020-05-18T11:06:37.049855 | 2019-05-01T04:52:46 | 2019-05-01T04:52:46 | 184,370,146 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,129 | java | package cn.zhangpeng;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadPoolExecutor;
/**
* @Auther:zhangpeng
* @Date:2019/5/1
* @Description:cn.zhangpeng
* @Version:1.0
*/
public class TestDemo {
public static void main(String[] args) {
ThreadPoolExecutor threadPoolExecutor=null;
try {
//线程任务
ThreadTask task =new ThreadTask();
//测试自定义线程池
threadPoolExecutor = ThreadPoolDemo.getThreadPoolExecutor();
//线程未回收的情况下,执行任务超过maxpoolsize+阻塞队列capacity,触发拒绝策略报java.util.concurrent.RejectedExecutionException异常
//执行任务超过corepoolsize+阻塞队列capacity;线程数进行扩充,最大扩充到maxpoolsize
for (int i=0;i<10;i++){
Future submit = threadPoolExecutor.submit(task);
}
}catch (Exception e){
System.out.println(111);
e.printStackTrace();
}
finally {
//关闭线程池
threadPoolExecutor.shutdown();
}
}
}
| [
"dev2@qq.com"
] | dev2@qq.com |
79ff019a70da67f625ec029e11f9ca6ae0f719f3 | a3eacf1d95a204850e6a2913a4d2e01786bb4c35 | /src/main/java/com/github/vaerys/pogos/Events.java | 95e921f9f0835e88eb1a504aceebfc5e998b416a | [] | no_license | AndrielChaoti/DiscordSailv2 | 53e3a78492555958d0f6244b1dbaabbdbd352008 | 4a73090611909c86767a055675f6deb5a60d41f0 | refs/heads/master | 2021-01-19T20:44:11.139088 | 2018-03-18T04:50:13 | 2018-03-18T04:50:13 | 101,136,774 | 0 | 0 | null | 2017-08-23T04:12:49 | 2017-08-23T04:12:49 | null | UTF-8 | Java | false | false | 439 | java | package com.github.vaerys.pogos;
import com.github.vaerys.objects.TimedEvent;
import com.github.vaerys.templates.GlobalFile;
import java.util.ArrayList;
import java.util.List;
public class Events extends GlobalFile {
public static final String FILE_PATH = "Events.json";
List<TimedEvent> events = new ArrayList<>();
private double fileVersion = 1.0;
public List<TimedEvent> getEvents() {
return events;
}
}
| [
"thelegotechhead@yahoo.com.au"
] | thelegotechhead@yahoo.com.au |
cc52ce49a4bbe409a22267a1c6e40ca498d34866 | 1afdc3381e7947620f0cd24cf9c097f144f79843 | /Refactoring/src/exercise/refactoring/ComputerMove.java | 0f5d6393eff534bb7379f5dc7c411eae02ca16b4 | [] | no_license | compwron/refactoringExercise | c2532eab57914a64c33350105bf8e1f7252c9b7f | 10cd6066e76c2fce02ab49f5ff8da88ae732cdae | refs/heads/master | 2020-12-24T08:30:43.890630 | 2016-08-19T03:14:29 | 2016-08-19T03:14:29 | 11,492,944 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 52,248 | java | package exercise.refactoring;
public class ComputerMove {
private static final int lastPositionOnSecondToLastLine = 89;
private final MoveSequence moveNumber;
private final GamePosition nextComputerMove;
private final GameBoard gameBoard;
final MarksByAxis marksByAxis = new MarksByAxis();
public ComputerMove(MoveSequence moveNumber, RawPlayerMove rawPlayerMove, GameBoard gameBoard) {
this.gameBoard = gameBoard;
this.moveNumber = moveNumber;
this.nextComputerMove = makeComputerMove(rawPlayerMove);
}
private GamePosition makeComputerMove(RawPlayerMove rawPlayerMove) {
GamePosition position = new GamePosition();
if (moveNumber.isFirstMove()) {
return rawPlayerMove.firstComputerMove();
}
position = closeGapInSeries(gameBoard);
if (moveNumber.isMove(2) && position.isNotNone()) {
return position;
}
if (moveNumber.isOver(3)) {
position = blockSeriesOfFourOrMoreInCheckMode(GameBoardMark.ZERO_MARK_FOR_COMPUTER);
if (position.isNotNone()) {
return position;
}
position = blockSeriesOfFourOrMoreInCheckMode(GameBoardMark.X_MARK_FOR_PLAYER);
if (position.isNotNone()) {
return position;
}
}
position = responseTo3Or4InaRowOpportunityOnMainBoardInCheckMode(GameBoardMark.ZERO_MARK_FOR_COMPUTER);
if ((moveNumber.isOver(2) && position.isNotNone())) {
return position;
}
position.setPosition(tryToFindPositionGivingSeriesOf4OnTwoOrMoreAxes(GameBoardMark.ZERO_MARK_FOR_COMPUTER));
if ((moveNumber.isOver(5) && position.isNotNone())) {
return position;
}
setFlagsForLaterProcessing(GameBoardMark.X_MARK_FOR_PLAYER);
position.setPosition(tryToMake3WithGap_FromVert4IntersectingWithHoriz4(GameBoardMark.ZERO_MARK_FOR_COMPUTER));
if ((moveNumber.isOver(4) && position.isNotNone())) {
return position;
}
position = responseTo3Or4InaRowOpportunityOnMainBoardInCheckMode(GameBoardMark.X_MARK_FOR_PLAYER);
if ((moveNumber.isOver(2) && position.isNotNone())) {
return position;
}
position.setPosition(tryToFindPositionGivingSeriesOf4OnTwoOrMoreAxes(GameBoardMark.X_MARK_FOR_PLAYER));
if ((moveNumber.isOver(5) && position.isNotNone())) {
return position;
}
setFlagsForLaterProcessing(GameBoardMark.ZERO_MARK_FOR_COMPUTER);
position.setPosition(tryToMake3WithGap_FromVert4IntersectingWithHoriz4(GameBoardMark.X_MARK_FOR_PLAYER));
if ((moveNumber.isOver(4) && position.isNotNone())) {
return position;
}
gameBoard.setBoardTwoToDuplicateOfMainBoard();
position = checkSeries(GameBoardMark.ZERO_MARK_FOR_COMPUTER, 0);
if ((moveNumber.isOver(3) && position.isNotNone())) {
return position;
}
if (moveNumber.isOver(3)) {
position = checkSeries(GameBoardMark.X_MARK_FOR_PLAYER, 0);
if (position.isNotNone()) {
return position;
}
}
position.setPosition(check2o3c(GameBoardMark.ZERO_MARK_FOR_COMPUTER));
if ((moveNumber.isOver(2) && position.isNotNone())) {
return position;
}
position.setPosition(check2o3c(GameBoardMark.X_MARK_FOR_PLAYER));
if ((moveNumber.isOver(20) && position.isNotNone())) {
return position;
}
if (moveNumber.isOver(3)) {
position.setPosition(checkCross(GameBoardMark.X_MARK_FOR_PLAYER));
if (position.isNotNone()) {
return position;
}
}
if (moveNumber.isOver(3)) {
position.setPosition(checkCross(GameBoardMark.ZERO_MARK_FOR_COMPUTER));
if (position.isNotNone()) {
return position;
}
}
if (moveNumber.isOver(2)) {
position.setPosition(checkBox(GameBoardMark.X_MARK_FOR_PLAYER));
if (position.isNotNone()) {
return position;
}
}
if (moveNumber.isOver(2)) {
position = closeGapInSeries(gameBoard);
if (position.isNotNone()) {
return position;
}
}
position = createTwoAxesOrCreateOneAndBlockAnother();
if (position.isNotNone()) {
return position;
}
position = responseTo3Or4InaRowOpportunityOnMainBoardInCleanMode(GameBoardMark.ZERO_MARK_FOR_COMPUTER);
if (position.isNotNone()) {
return position;
}
position = responseTo3Or4InaRowOpportunityOnMainBoardInCleanMode(GameBoardMark.X_MARK_FOR_PLAYER);
if (position.isNotNone()) {
return position;
}
position.setPosition(findSpot(gameBoard));
return position;
}
private GamePosition createTwoAxesOrCreateOneAndBlockAnother() {
seto4cc(GameBoardMark.X_MARK_FOR_PLAYER);
for (int position = GameBoard.oneMoreThanSquaresPerSide; position < lastPositionOnSecondToLastLine; position++)
if (positionIsOccupiedOnStagingBoardAndDesirable(gameBoard, new StagingBoard(), position)) {
return new GamePosition(position);
}
return GamePosition.nonePosition();
}
private boolean positionIsOccupiedOnStagingBoardAndDesirable(GameBoard gameBoard, StagingBoard stagingBoard, int position) {
return stagingBoard.isOccupiedAtPosition(position) && gameBoard.positionIsDesirableForCreateTwoAxesOrCreateOneAndBlockAnother(position);
}
private GamePosition closeGapInSeries(GameBoard gameBoard) {
for (int upToSeven = 1; upToSeven < 7; upToSeven++) {
for (int upToNine = 1; upToNine < GameBoard.oneLessThanCountInRow; upToNine++) {
int position = upToSeven + GameBoard.SQUARES_PER_SIDE * upToNine;
int otherPosition = upToNine + upToSeven * GameBoard.SQUARES_PER_SIDE;
if (gameBoard.hasOccupiedUnoccupiedOccupiedPatternStartingAt(position)) {
return new GamePosition(position + 1);
}
if (gameBoard.hasOccupiedUnoccupiedOccupiedDiagonalPatternStartingAt(otherPosition)) {
return new GamePosition(otherPosition + GameBoard.SQUARES_PER_SIDE);
}
}
}
return GamePosition.nonePosition();
}
private GamePosition blockSeriesOfFourOrMoreInCheckMode(GameBoardMark playerMark) {
int zero = 0;
int upToSquaresPerSide, upToFive, upToSix;
GamePosition position = new GamePosition();
GamePosition position2 = new GamePosition();
for (upToSix = 0; upToSix < 6; upToSix++) {
for (upToSquaresPerSide = 0; upToSquaresPerSide < GameBoard.SQUARES_PER_SIDE; upToSquaresPerSide++) {
gameBoard.resetAllMarksAlongAxesForFirstHalfOfBoard(marksByAxis);
position = checkFor5AlongHorizAxis(playerMark, zero, upToSquaresPerSide, upToSix, position);
if (marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(0, 4), new MarksByAxisPositionPair(1, 1))) {
return position;
}
position = checkFor5AlongVertAxis(playerMark, zero, upToSquaresPerSide, upToSix, position);
if (marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(2, 4), new MarksByAxisPositionPair(3, 1))) {
return position;
}
}
for (upToSquaresPerSide = 0; upToSquaresPerSide < 6; upToSquaresPerSide++) {
gameBoard.resetAllMarksAlongAxesForFirstHalfOfBoard(marksByAxis);
for (upToFive = 0; upToFive < 5; upToFive++) {
position = checkFor5AlongDiagDownRightAxis(playerMark, zero, upToSquaresPerSide, upToFive, upToSix, position);
position2 = checkFor5AlongDiagUpRightAxis(playerMark, zero, upToSquaresPerSide, upToFive, upToSix, position2);
}
if (marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(0, 4), new MarksByAxisPositionPair(1, 1))) {
return position;
}
if (marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(2, 4), new MarksByAxisPositionPair(3, 1))) {
return position2;
}
}
}
return GamePosition.nonePosition();
}
private GamePosition responseTo3Or4InaRowOpportunityOnMainBoardInCheckMode(GameBoardMark playerMark) {
int j, k, l;
GamePosition place = new GamePosition();
int tempRowForChecks[] = new int[GameBoard.SQUARES_PER_SIDE];
for (k = 0; k < 4; k++) {
tempRowForChecks[k] = 0;
}
for (l = 0; l < 5; l++) {
for (j = 0; j < GameBoard.SQUARES_PER_SIDE; j++) {
clearMarksByAxisArray();
if (gameBoard.hasEmptyValueOnMainBoardAt(j * GameBoard.SQUARES_PER_SIDE + l) && gameBoard.hasEmptyValueOnMainBoardAt(j * GameBoard.SQUARES_PER_SIDE + l + 5)) {
place = checkForHoriz4InRow(playerMark, 0, j, l);
if (anyHoriz4MatchToMark(Mode.CHECK, place)) return place;
}
if (gameBoard.hasEmptyValueOnMainBoardAt(l * GameBoard.SQUARES_PER_SIDE + j) && gameBoard.hasEmptyValueOnMainBoardAt(l * GameBoard.SQUARES_PER_SIDE + j + 50)) {
place = checkForVert4InRow(playerMark, 0, j, l);
if (anyVert4MatchToMark(Mode.CHECK, place)) return place;
}
}
for (j = 0; j < 5; j++) {
clearMarksByAxisArray();
if (gameBoard.hasEmptyValueOnMainBoardAt(l * GameBoard.SQUARES_PER_SIDE + j) && gameBoard.hasEmptyValueOnMainBoardAt(l * GameBoard.SQUARES_PER_SIDE + j + 55)) {
place = checkForDiagDown4InRow(playerMark, 0, j, l);
if (anyDiagDown4MatchToMark(Mode.CHECK, place)) return place;
}
if (gameBoard.hasEmptyValueOnMainBoardAt(l * GameBoard.SQUARES_PER_SIDE + j + 50) && gameBoard.hasEmptyValueOnMainBoardAt(l * GameBoard.SQUARES_PER_SIDE + j + 5)) {
place = checkForDiagUp4InRow(playerMark, 0, j, l);
if (anyDiagUp4MatchToMark(Mode.CHECK, place)) return place;
}
}
}
if (Mode.CHECK.equals(Mode.COUNT)) {
return new GamePosition(tempRowForChecks[0] + tempRowForChecks[1] + tempRowForChecks[2] + tempRowForChecks[3]);
}
return GamePosition.nonePosition();
}
private int tryToFindPositionGivingSeriesOf4OnTwoOrMoreAxes(GameBoardMark playerMark) {
copyBoardToCheck(0);
for (int k = 0; k < GameBoard.TOTAL_SQUARES_PER_BOARD; k++) {
if (gameBoard.hasEmptyValueAt(1, k)) {
gameBoard.setValueAt(1, k, playerMark);
if (countNumberOfAxesAlongWhichSeriesOfFourOccur(playerMark, 1, Mode.CLEAN.rawMode) > 1) return k;
gameBoard.setPositionToEmpty(1, k);
}
}
return (GameBoard.oneMoreThanLastPositionOnBoard);
}
private int tryToMake3WithGap_FromVert4IntersectingWithHoriz4(GameBoardMark playerMark) {
int k;
int gameBoardLevelToCheck = GameBoard.indexOfMainBoard;
for (k = 0; k < GameBoard.TOTAL_SQUARES_PER_BOARD; k++)
gameBoard.setValueAt(1, k, gameBoard.getValueAt(gameBoardLevelToCheck, k));
for (k = 0; k < GameBoard.TOTAL_SQUARES_PER_BOARD; k++) {
if (gameBoard.hasEmptyValueAt(1, k)) {
gameBoard.setValueAt(1, k, playerMark);
if (responseTo3Or4InaRowOpportunity(playerMark, 1, Mode.CHECK).isNotNone() && countNumberOfAxesAlongWhichSeriesOfFourOccur(playerMark, 1, Mode.SAFE.rawMode) > 0) {
return k;
}
gameBoard.setPositionToEmpty(1, k);
}
}
return (GameBoard.oneMoreThanLastPositionOnBoard);
}
private int check2o3c(GameBoardMark playerMark) {
int k;
for (k = 0; k < GameBoard.TOTAL_SQUARES_PER_BOARD; k++) {
if (!gameBoard.hasEmptyValueOnMainBoardAt(k)) continue;
gameBoard.setValueAt(GameBoard.indexOfMainBoard, k, playerMark);
if (responseTo3Or4InaRowOpportunity(playerMark, GameBoard.indexOfMainBoard, Mode.COUNT).isOverOne()) {
return k;
}
gameBoard.setValueAt(GameBoard.indexOfMainBoard, k, GameBoardMark.EMPTY);
}
return GameBoard.oneMoreThanLastPositionOnBoard;
}
private int checkCross(GameBoardMark playerMark) {
int k, l, x;
for (k = 1; k < 7; k++) {
for (l = 1; l < 7; l++) {
x = k + 10 * l;
if (gameBoard.mainBoard()[x] == playerMark.index && gameBoard.mainBoard()[x + 2] == playerMark.index && gameBoard.mainBoard()[x + 20] == playerMark.index && gameBoard.mainBoard()[x + 22] == playerMark.index && gameBoard.mainBoard()[x + 11] == 0) return (x + 11);
}
}
return GameBoard.oneMoreThanLastPositionOnBoard;
}
private int checkBox(GameBoardMark playerMark) {
for (int k = 1; k < 8; k++) {
for (int l = 1; l < 8; l++) {
int cnt = 0;
int pos = -1;
for (int a = 0; a < 2; a++) {
for (int b = 0; b < 2; b++) {
int x = k + a + 10 * (l + b);
int c = gameBoard.mainBoard()[x];
if (c == playerMark.index) cnt++;
else if (c == 0) pos = x;
}
}
if (cnt == 3 && pos != -1) return pos;
}
}
return GameBoard.oneMoreThanLastPositionOnBoard;
}
private GamePosition responseTo3Or4InaRowOpportunityOnMainBoardInCleanMode(GameBoardMark playerMark) {
int alsoUpToFive, upToFour, upToFive;
GamePosition place = new GamePosition();
int tempRowForChecks[] = new int[GameBoard.SQUARES_PER_SIDE];
for (upToFour = 0; upToFour < 4; upToFour++) {
tempRowForChecks[upToFour] = 0;
}
for (upToFive = 0; upToFive < 5; upToFive++) {
for (alsoUpToFive = 0; alsoUpToFive < GameBoard.SQUARES_PER_SIDE; alsoUpToFive++) {
clearMarksByAxisArray();
if (gameBoard.hasEmptyValueOnMainBoardAt(alsoUpToFive * GameBoard.SQUARES_PER_SIDE + upToFive) && gameBoard.hasEmptyValueOnMainBoardAt(alsoUpToFive * GameBoard.SQUARES_PER_SIDE + upToFive + 5)) {
place = checkForHoriz4InRow(playerMark, 0, alsoUpToFive, upToFive);
if (anyHoriz4MatchToMark(Mode.CLEAN, place)) return place;
}
if (gameBoard.hasEmptyValueOnMainBoardAt(upToFive * GameBoard.SQUARES_PER_SIDE + alsoUpToFive) && gameBoard.hasEmptyValueOnMainBoardAt(upToFive * GameBoard.SQUARES_PER_SIDE + alsoUpToFive + 50)) {
place = checkForVert4InRow(playerMark, 0, alsoUpToFive, upToFive);
if (anyVert4MatchToMark(Mode.CLEAN, place)) return place;
}
}
for (alsoUpToFive = 0; alsoUpToFive < 5; alsoUpToFive++) {
clearMarksByAxisArray();
if (gameBoard.hasEmptyValueOnMainBoardAt(upToFive * GameBoard.SQUARES_PER_SIDE + alsoUpToFive) && gameBoard.hasEmptyValueOnMainBoardAt(upToFive * GameBoard.SQUARES_PER_SIDE + alsoUpToFive + 55)) {
place = checkForDiagDown4InRow(playerMark, 0, alsoUpToFive, upToFive);
if (anyDiagDown4MatchToMark(Mode.CLEAN, place)) return place;
}
if (gameBoard.hasEmptyValueOnMainBoardAt(upToFive * GameBoard.SQUARES_PER_SIDE + alsoUpToFive + 50) && gameBoard.hasEmptyValueOnMainBoardAt(upToFive * GameBoard.SQUARES_PER_SIDE + alsoUpToFive + 5)) {
place = checkForDiagUp4InRow(playerMark, 0, alsoUpToFive, upToFive);
if (anyDiagUp4MatchToMark(Mode.CLEAN, place)) return place;
}
}
}
return GamePosition.nonePosition();
}
private int findSpot(GameBoard gameBoard) {
int position;
int i;
i = GameBoardMark.EMPTY.index;
do {
position = (int) (Math.random() * GameBoard.TOTAL_SQUARES_PER_BOARD);
if (gameBoard.mainBoard()[position] != GameBoardMark.EMPTY.index) continue;
if (spotFinderCondition(gameBoard, position)) {
i = GameBoardMark.OCCUPIED.index;
}
} while (i == GameBoardMark.EMPTY.index);
return position;
}
private boolean spotFinderCondition(GameBoard gameBoard, int position) {
return (position > 0 && gameBoard.mainBoard()[position - 1] != GameBoardMark.EMPTY.index) || (position > GameBoard.SQUARES_PER_SIDE && (gameBoard.mainBoard()[position - 11] != GameBoardMark.EMPTY.index || gameBoard.mainBoard()[position - GameBoard.SQUARES_PER_SIDE] != GameBoardMark.EMPTY.index || gameBoard.mainBoard()[position - GameBoard.oneLessThanCountInRow] != GameBoardMark.EMPTY.index)) || (position < 99 && gameBoard.mainBoard()[position + 1] != GameBoardMark.EMPTY.index) || (position < 88 && (gameBoard.mainBoard()[position + GameBoard.oneLessThanCountInRow] != GameBoardMark.EMPTY.index || gameBoard.mainBoard()[position + GameBoard.SQUARES_PER_SIDE] != GameBoardMark.EMPTY.index || gameBoard.mainBoard()[position + 11] != GameBoardMark.EMPTY.index));
}
public GamePosition getNextComputerMove() {
return nextComputerMove;
}
public GamePosition checkForWinOpportunity(GameBoardMark playerMark, int boardNumber) {
GamePosition winner = blockSeriesOfFourOrMore(switchPlayers(playerMark), boardNumber, Mode.CHECK);
if (winner.isNotNone()) {
return winner;
}
GamePosition winnerCheck2 = responseTo3Or4InaRowOpportunity(switchPlayers(playerMark), boardNumber, Mode.CHECK);
if (winnerCheck2.isNotNone()) {
return winnerCheck2;
}
return GamePosition.nonePosition();
}
private boolean isNotNone(int response) {
return response != GameBoard.oneMoreThanLastPositionOnBoard;
}
public GamePosition checkSeries(GameBoardMark playerMark, int depth) {
int[] auxilliaryBoard = new int[GameBoard.TOTAL_SQUARES_PER_BOARD];
GamePosition winningPosition;
if (depth == GameBoard.MAX_DEPTH_FOR_TEMP_BOARD) return GamePosition.nonePosition();
setc4c(playerMark);
for (int k = 0; k < GameBoard.TOTAL_SQUARES_PER_BOARD; k++) {
if (StagingBoard.isEmptyAtPosition(k) || auxilliaryBoard[k] != GameBoardMark.EMPTY.index) continue;
copyStagingBoardIntoOddGroupOfBoardsAtDepth(depth);
auxilliaryBoard[k] = playerMark.index;
winningPosition = checkForWinOpportunity(switchPlayers(playerMark), 2);
if (winningPosition.isNone()) return GamePosition.nonePosition();
auxilliaryBoard[winningPosition.getRaw()] = switchPlayers(playerMark).index;
if (blockSeriesOfFourOrMore(playerMark, 2, Mode.CHECK).isNotNone()) {
return new GamePosition(k);
}
if (blockSeriesOfFourOrMore(switchPlayers(playerMark), 2, Mode.CHECK).isNotNone()) {
auxilliaryBoard[k] = GameBoardMark.EMPTY.index;
auxilliaryBoard[winningPosition.getRaw()] = GameBoardMark.EMPTY.index;
copyIntoStagingBoardFromOddBoardGroupAtDepth(depth);
continue;
}
if (checkSeries(playerMark, depth + 1) != GamePosition.nonePosition()) {
return new GamePosition(k);
}
auxilliaryBoard[k] = GameBoardMark.EMPTY.index;
auxilliaryBoard[winningPosition.getRaw()] = GameBoardMark.EMPTY.index;
copyIntoStagingBoardFromOddBoardGroupAtDepth(depth);
}
return GamePosition.nonePosition();
}
public GameBoardMark switchPlayers(GameBoardMark playerMark) {
return GameBoardMark.valueOf(3 - playerMark.index);
}
public int countNumberOfAxesAlongWhichSeriesOfFourOccur(GameBoardMark playerMark, int x, int type) {
int j, k, l;
int zbir = 0;
GameBoardMark flag, flag2;
flag = GameBoardMark.EMPTY;
for (j = 0; j < 10; j++) {
for (l = 0; l < 6; l++) {
marksByAxis.setPositionsToZero(0, 1, 2);
for (k = 0; k < 5; k++) {
marksByAxis.incrementValueAtPositionAndReturnValue(gameBoard.getValueAt(x, j * 10 + l + k).index);
}
if (getDOublt(playerMark)) {
if (type == Mode.SAFE.rawMode) {
flag2 = GameBoardMark.EMPTY;
for (k = 0; k < 5; k++) {
if (gameBoard.hasEmptyValueAt(x, j * 10 + l + k) && TemporaryChecksTable.tempTableForChecks[j * 10 + l + k] == GameBoardMark.OCCUPIED.index) {
flag2 = GameBoardMark.OCCUPIED;
}
}
if (flag2 == GameBoardMark.EMPTY) {
zbir++;
flag = GameBoardMark.OCCUPIED;
break;
}
} else {
zbir++;
flag = GameBoardMark.OCCUPIED;
break;
}
}
}
if (flag == GameBoardMark.OCCUPIED) break;
}
flag = GameBoardMark.EMPTY;
for (j = 0; j < 10; j++) {
for (l = 0; l < 6; l++) {
marksByAxis.setPositionsToZero(0, 1, 2);
for (k = 0; k < 5; k++)
marksByAxis.incrementValueAtPosition(gameBoard.getValueAt(x, l * 10 + j + k * 10));
if (getDOublt(playerMark)) {
if (type == Mode.SAFE.rawMode) {
flag2 = GameBoardMark.EMPTY;
for (k = 0; k < 5; k++)
if (gameBoard.hasEmptyValueAt(x, l * 10 + j + k * 10) && TemporaryChecksTable.tempTableForChecks[l * 10 + j + k * 10] == GameBoardMark.OCCUPIED.index) flag2 = GameBoardMark.OCCUPIED;
if (flag2 == GameBoardMark.EMPTY) {
zbir++;
flag = GameBoardMark.OCCUPIED;
break;
}
} else {
zbir++;
flag = GameBoardMark.OCCUPIED;
break;
}
}
}
if (flag == GameBoardMark.OCCUPIED) break;
}
flag = GameBoardMark.EMPTY;
for (l = 0; l < 6; l++) {
for (j = 0; j < 6; j++) {
for (k = 0; k < 3; k++)
/* za diag */
marksByAxis.setPositionsToZero(k);
for (k = 0; k < 5; k++)
/* diag\ */
marksByAxis.incrementValueAtPosition(gameBoard.getValueAt(x, l * 10 + j + k * 11));
if (getDOublt(playerMark)) {
if (type == Mode.SAFE.rawMode) {
flag2 = GameBoardMark.EMPTY;
for (k = 0; k < 5; k++) {
if (gameBoard.hasEmptyValueAt(x, l * 10 + j + k * 11) && TemporaryChecksTable.tempTableForChecks[l * 10 + j + k * 11] == GameBoardMark.OCCUPIED.index) {
flag2 = GameBoardMark.OCCUPIED;
}
}
if (flag2 == GameBoardMark.EMPTY) {
zbir++;
flag = GameBoardMark.OCCUPIED;
break;
}
} else {
zbir++;
flag = GameBoardMark.OCCUPIED;
break;
}
}
}
if (flag == GameBoardMark.OCCUPIED) break;
}
flag = GameBoardMark.EMPTY;
for (l = 0; l < 6; l++) {
for (j = 0; j < 6; j++) {
for (k = 0; k < 3; k++) {
marksByAxis.setPositionsToZero(k);
}
for (k = 0; k < 5; k++) {
marksByAxis.incrementValueAtPosition(gameBoard.getValueAt(x, l * 10 + j - k * GameBoard.oneLessThanCountInRow + 40));
}
if (getDOublt(playerMark)) {
if (type == Mode.SAFE.rawMode) {
flag2 = GameBoardMark.EMPTY;
for (k = 0; k < 5; k++) {
if (gameBoard.hasEmptyValueAt(x, l * 10 + j - k * GameBoard.oneLessThanCountInRow + 40) && TemporaryChecksTable.tempTableForChecks[l * 10 + j - k * GameBoard.oneLessThanCountInRow + 40] == GameBoardMark.OCCUPIED.index) {
flag2 = GameBoardMark.OCCUPIED;
}
}
if (flag2 == GameBoardMark.EMPTY) {
zbir++;
flag = GameBoardMark.OCCUPIED;
break;
}
} else {
zbir++;
flag = GameBoardMark.OCCUPIED;
break;
}
}
}
if (flag == GameBoardMark.OCCUPIED) break;
}
return zbir;
}
private boolean getDOublt(GameBoardMark playerMark) {
return marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(playerMark, 4), new MarksByAxisPositionPair(GameBoardMark.EMPTY, 1));
}
public void setc4c(GameBoardMark playerMark) {
int j, k, l;
int position, x = 2; // TODO make this Position object
for (j = 0; j < GameBoard.TOTAL_SQUARES_PER_BOARD; j++) {
StagingBoard.setValueAtPositionToEmpty(j);
}
int tempRowForChecks[] = new int[GameBoard.SQUARES_PER_SIDE];
for (j = 0; j < GameBoard.SQUARES_PER_SIDE; j++) {
for (k = 0; k < 6; k++) {
marksByAxis.setPositionsToZero(0, 1);
for (l = 0; l < 5; l++) {
position = gameBoard.getValueAt(x, j * GameBoard.SQUARES_PER_SIDE + k + l).index;
if (position == playerMark.index) marksByAxis.incrementValueAtPosition(GameBoardMark.ZERO_MARK_FOR_COMPUTER);
if (position == GameBoardMark.EMPTY.index) {
tempRowForChecks[marksByAxis.getValueAtPosition(1)] = j * GameBoard.SQUARES_PER_SIDE + k + l;
marksByAxis.incrementValueAtPositionAndReturnValue(1);
}
}
if (marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(0, 3), new MarksByAxisPositionPair(1, 2))) for (l = 0; l < 2; l++)
StagingBoard.setValueAtPositionToOccupied(tempRowForChecks[l]);
}
}
for (j = 0; j < GameBoard.SQUARES_PER_SIDE; j++) {
for (k = 0; k < 6; k++) {
marksByAxis.setPositionsToZero(0, 1);
for (l = 0; l < 5; l++) {
position = gameBoard.getValueAt(x, k * GameBoard.SQUARES_PER_SIDE + j + l * GameBoard.SQUARES_PER_SIDE).index;
if (position == playerMark.index) marksByAxis.incrementValueAtPositionAndReturnValue(0);
if (position == GameBoardMark.EMPTY.index) {
tempRowForChecks[marksByAxis.getValueAtPosition(1)] = k * GameBoard.SQUARES_PER_SIDE + j + l * GameBoard.SQUARES_PER_SIDE;
marksByAxis.incrementValueAtPositionAndReturnValue(1);
}
}
if (marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(0, 3), new MarksByAxisPositionPair(1, 2))) for (l = 0; l < 2; l++)
StagingBoard.setValueAtPositionToOccupied(tempRowForChecks[l]);
}
}
for (j = 0; j < 6; j++) {
for (k = 0; k < 6; k++) {
marksByAxis.setPositionsToZero(0, 1);
for (l = 0; l < 5; l++) {
position = gameBoard.getValueAt(x, j * GameBoard.SQUARES_PER_SIDE + k + l * 11).index;
if (position == playerMark.index) marksByAxis.incrementValueAtPositionAndReturnValue(0);
if (position == GameBoardMark.EMPTY.index) {
tempRowForChecks[marksByAxis.getValueAtPosition(1)] = j * GameBoard.SQUARES_PER_SIDE + k + l * 11;
marksByAxis.incrementValueAtPositionAndReturnValue(1);
}
}
if (marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(0, 3), new MarksByAxisPositionPair(1, 2))) for (l = 0; l < 2; l++)
StagingBoard.setValueAtPositionToOccupied(tempRowForChecks[l]);
}
}
for (j = 0; j < 6; j++) {
for (k = 0; k < 6; k++) {
marksByAxis.setPositionsToZero(0, 1);
for (l = 0; l < 5; l++) {
position = gameBoard.getValueAt(x, j * GameBoard.SQUARES_PER_SIDE + k - l * GameBoard.oneLessThanCountInRow + 40).index;
if (position == playerMark.index) marksByAxis.incrementValueAtPositionAndReturnValue(0);
if (position == GameBoardMark.EMPTY.index) {
setValueInTempRowForChecksToCalculatedValue(j, k, l, tempRowForChecks);
marksByAxis.incrementValueAtPositionAndReturnValue(1);
}
}
if (marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(0, 3), new MarksByAxisPositionPair(1, 2))) for (l = 0; l < 2; l++){
StagingBoard.setValueAtPositionToOccupied(tempRowForChecks[l]);
}
}
}
}
private void setValueInTempRowForChecksToCalculatedValue(int j, int k, int l, int[] tempRowForChecks) {
tempRowForChecks[marksByAxis.getValueAtPosition(1)] = j * GameBoard.SQUARES_PER_SIDE + k - l * GameBoard.oneLessThanCountInRow + 40;
}
public void seto4cc(GameBoardMark playerMark) {
int j, k, l;
int position;
for (j = 0; j < GameBoard.TOTAL_SQUARES_PER_BOARD; j++) {
StagingBoard.setValueAtPositionToEmpty(j);
}
int tempRowForChecks[] = new int[GameBoard.SQUARES_PER_SIDE];
for (j = 0; j < GameBoard.SQUARES_PER_SIDE; j++) {
for (k = 0; k < 5; k++) {
position = j * GameBoard.SQUARES_PER_SIDE + k;
if (gameBoard.hasEmptyValueAtPositionOnBoardTwoAndPositionWithDiff(position, 5)) {
marksByAxis.setPositionsToZero(0, 1);
for (l = 1; l < 5; l++) {
position = gameBoard.getValueAt(GameBoard.indexOfBoardTwo, j * GameBoard.SQUARES_PER_SIDE + k + l).index;
if (position == playerMark.index) marksByAxis.incrementValueAtPositionAndReturnValue(0);
if (position == GameBoardMark.EMPTY.index) {
tempRowForChecks[marksByAxis.getValueAtPosition(1)] = j * GameBoard.SQUARES_PER_SIDE + k + l;
marksByAxis.incrementValueAtPositionAndReturnValue(1);
}
}
if (marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(0, 2), new MarksByAxisPositionPair(1, 2))) for (l = 0; l < 2; l++)
StagingBoard.setValueAtPositionToOccupied(tempRowForChecks[l]);
}
}
}
for (j = 0; j < GameBoard.SQUARES_PER_SIDE; j++) {
for (k = 0; k < 5; k++) {
position = k * GameBoard.SQUARES_PER_SIDE + j;
if (gameBoard.hasEmptyValueAtPositionOnBoardTwoAndPositionWithDiff(position, 50)) {
marksByAxis.setPositionsToZero(0, 1);
for (l = 1; l < 5; l++) {
position = gameBoard.getValueAt(GameBoard.indexOfBoardTwo, k * GameBoard.SQUARES_PER_SIDE + j + l * GameBoard.SQUARES_PER_SIDE).index;
if (position == playerMark.index) marksByAxis.incrementValueAtPositionAndReturnValue(0);
if (position == GameBoardMark.EMPTY.index) {
tempRowForChecks[marksByAxis.getValueAtPosition(1)] = k * GameBoard.SQUARES_PER_SIDE + j + l * GameBoard.SQUARES_PER_SIDE;
marksByAxis.incrementValueAtPositionAndReturnValue(1);
}
}
if (marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(0, 2), new MarksByAxisPositionPair(1, 2))) for (l = 0; l < 2; l++)
StagingBoard.setValueAtPositionToOccupied(tempRowForChecks[l]);
}
}
}
newMethod(playerMark, tempRowForChecks, 1, 0, 50, 11);
newMethod(playerMark, tempRowForChecks, -1, 50, 0, GameBoard.oneLessThanCountInRow);
}
private void newMethod(GameBoardMark playerMark, int[] tempRowForChecks, int sign, int foo, int bar, int baz) {
for (int b1 = 0; b1 < 5; b1++) {
for (int b2 = 0; b2 < 5; b2++) {
int positionB = b1 * GameBoard.SQUARES_PER_SIDE + b2;
if (gameBoard.hasEmptyValueAt(GameBoard.indexOfBoardTwo, positionB + foo) && gameBoard.hasEmptyValueAt(GameBoard.indexOfBoardTwo, positionB + bar + 5)) {
marksByAxis.setPositionsToZero(0, 1);
for (int b3 = 1; b3 < 5; b3++) {
positionB = gameBoard.getValueAt(GameBoard.indexOfBoardTwo, b1 * GameBoard.SQUARES_PER_SIDE + b2 + sign * b3 * baz + foo).index;
if (positionB == playerMark.index) marksByAxis.incrementValueAtPositionAndReturnValue(0);
if (positionB == GameBoardMark.EMPTY.index) {
tempRowForChecks[marksByAxis.getValueAtPosition(1)] = b1 * GameBoard.SQUARES_PER_SIDE + b2 + sign * b3 * baz + foo;
marksByAxis.incrementValueAtPositionAndReturnValue(1);
}
}
if (marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(0, 2), new MarksByAxisPositionPair(1, 2))) for (int b4 = 0; b4 < 2; b4++)
StagingBoard.setValueAtPositionToOccupied(tempRowForChecks[b4]);
}
}
}
}
public GamePosition blockSeriesOfFourOrMore(GameBoardMark playerMark, int x, Mode type) {
int j, k, l;
GamePosition position = new GamePosition();
GamePosition position2 = new GamePosition();
int tempRowForChecks[] = new int[GameBoard.SQUARES_PER_SIDE];
for (l = 0; l < 6; l++) {
for (j = 0; j < GameBoard.SQUARES_PER_SIDE; j++) {
gameBoard.resetAllMarksAlongAxesForFirstHalfOfBoard(marksByAxis);
position = checkFor5AlongHorizAxis(playerMark, x, j, l, position);
if (marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(0, 3), new MarksByAxisPositionPair(1, 2))) {
if (type.equals(Mode.SETFLAGS)) {
TemporaryChecksTable.tempTableForChecks[tempRowForChecks[0]] = GameBoardMark.OCCUPIED.index;
TemporaryChecksTable.tempTableForChecks[tempRowForChecks[1]] = GameBoardMark.OCCUPIED.index;
}
if (type.equals(Mode.CLEAN)) return new GamePosition(tempRowForChecks[0]);
}
if (marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(0, 4), new MarksByAxisPositionPair(1, 1)) && type.equals(Mode.CHECK)) return position;
position = checkFor5AlongVertAxis(playerMark, x, j, l, position);
if (marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(2, 3), new MarksByAxisPositionPair(3, 2))) {
if (type.equals(Mode.SETFLAGS)) {
TemporaryChecksTable.tempTableForChecks[tempRowForChecks[0]] = GameBoardMark.OCCUPIED.index;
TemporaryChecksTable.tempTableForChecks[tempRowForChecks[1]] = GameBoardMark.OCCUPIED.index;
}
if (type.equals(Mode.CLEAN)) return new GamePosition(tempRowForChecks[0]);
}
if (marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(2, 4), new MarksByAxisPositionPair(3, 1)) && type.equals(Mode.CHECK)) return position;
}
for (j = 0; j < 6; j++) {
gameBoard.resetAllMarksAlongAxesForFirstHalfOfBoard(marksByAxis);
for (k = 0; k < 5; k++) {
position = checkFor5AlongDiagDownRightAxis(playerMark, x, j, k, l, position);
position2 = checkFor5AlongDiagUpRightAxis(playerMark, x, j, k, l, position2);
}
if (marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(0, 3), new MarksByAxisPositionPair(1, 2))) {
if (type.equals(Mode.SETFLAGS)) {
TemporaryChecksTable.tempTableForChecks[tempRowForChecks[0]] = GameBoardMark.OCCUPIED.index;
TemporaryChecksTable.tempTableForChecks[tempRowForChecks[1]] = GameBoardMark.OCCUPIED.index;
}
if (type.equals(Mode.CLEAN)) return new GamePosition(tempRowForChecks[0]);
}
if (marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(0, 4), new MarksByAxisPositionPair(1, 1)) && type.equals(Mode.CHECK)) return position;
if (marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(2, 3), new MarksByAxisPositionPair(3, 2))) {
if (type.equals(Mode.SETFLAGS)) {
TemporaryChecksTable.tempTableForChecks[tempRowForChecks[0]] = GameBoardMark.OCCUPIED.index;
TemporaryChecksTable.tempTableForChecks[tempRowForChecks[1]] = GameBoardMark.OCCUPIED.index;
}
if (type.equals(Mode.CLEAN)) return new GamePosition(tempRowForChecks[0]);
}
if (marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(2, 4), new MarksByAxisPositionPair(3, 1)) && type.equals(Mode.CHECK)) return position2;
}
}
return GamePosition.nonePosition();
}
public GamePosition checkFor5AlongDiagUpRightAxis(GameBoardMark playerMark, int x, int j, int k, int l, GamePosition position2) {
if (gameBoard.valueAtPositionMatches(x, l * GameBoard.SQUARES_PER_SIDE + j - k * GameBoard.oneLessThanCountInRow + 40, playerMark)) marksByAxis.incrementValueAtPositionAndReturnValue(2);
int tempRowForChecks[] = new int[GameBoard.SQUARES_PER_SIDE];
if (gameBoard.hasEmptyValueAt(x, l * GameBoard.SQUARES_PER_SIDE + j - k * GameBoard.oneLessThanCountInRow + 40)) {
position2 = new GamePosition(l * GameBoard.SQUARES_PER_SIDE + j - k * GameBoard.oneLessThanCountInRow + 40);
tempRowForChecks[marksByAxis.getValueAtPosition(3)] = position2.getRaw();
marksByAxis.incrementValueAtPosition(3);
}
return position2;
}
public GamePosition checkFor5AlongDiagDownRightAxis(GameBoardMark playerMark, int x, int j, int k, int l, GamePosition position) {
if (gameBoard.valueAtPositionMatches(x, l * GameBoard.SQUARES_PER_SIDE + j + k * 11, playerMark)) marksByAxis.incrementValueAtPositionAndReturnValue(0);
int tempRowForChecks[] = new int[GameBoard.SQUARES_PER_SIDE];
if (gameBoard.hasEmptyValueAt(x, l * GameBoard.SQUARES_PER_SIDE + j + k * 11)) {
position = new GamePosition(l * GameBoard.SQUARES_PER_SIDE + j + k * 11);
tempRowForChecks[marksByAxis.getValueAtPosition(1)] = position.getRaw();
marksByAxis.incrementValueAtPositionAndReturnValue(1);
}
return position;
}
public GamePosition checkFor5AlongVertAxis(GameBoardMark playerMark, int x, int j, int l, GamePosition position) {
int k;
int tempRowForChecks[] = new int[GameBoard.SQUARES_PER_SIDE];
for (k = 0; k < 5; k++) {
if (gameBoard.valueAtPositionMatches(x, l * GameBoard.SQUARES_PER_SIDE + j + k * GameBoard.SQUARES_PER_SIDE, playerMark)) marksByAxis.incrementValueAtPositionAndReturnValue(2);
else if (gameBoard.hasEmptyValueAt(x, l * GameBoard.SQUARES_PER_SIDE + j + k * GameBoard.SQUARES_PER_SIDE)) {
position = new GamePosition(GameBoard.SQUARES_PER_SIDE * l + j + k * GameBoard.SQUARES_PER_SIDE);
tempRowForChecks[marksByAxis.getValueAtPosition(3)] = position.getRaw();
marksByAxis.incrementValueAtPosition(3);
} else break;
}
return position;
}
public GamePosition checkFor5AlongHorizAxis(GameBoardMark playerMark, int x, int j, int l, GamePosition position) {
int k;
int tempRowForChecks[] = new int[GameBoard.SQUARES_PER_SIDE];
for (k = 0; k < 5; k++) {
if (gameBoard.valueAtPositionMatches(x, j * GameBoard.SQUARES_PER_SIDE + l + k, playerMark)) marksByAxis.incrementValueAtPositionAndReturnValue(0);
else if (gameBoard.hasEmptyValueAt(x, j * GameBoard.SQUARES_PER_SIDE + l + k)) {
position = new GamePosition(GameBoard.SQUARES_PER_SIDE * j + l + k);
tempRowForChecks[marksByAxis.getValueAtPosition(1)] = position.getRaw();
marksByAxis.incrementValueAtPositionAndReturnValue(1);
} else break;
}
return position;
}
public GamePosition responseTo3Or4InaRowOpportunity(GameBoardMark playerMark, int boardLevel, Mode type) {
int j, k, l;
GamePosition place = new GamePosition();
int tempRowForChecks[] = new int[GameBoard.SQUARES_PER_SIDE];
for (k = 0; k < 4; k++) {
tempRowForChecks[k] = 0;
}
for (l = 0; l < 5; l++) {
for (j = 0; j < GameBoard.SQUARES_PER_SIDE; j++) {
clearMarksByAxisArray();
if (gameBoard.hasEmptyValueAt(boardLevel, j * GameBoard.SQUARES_PER_SIDE + l) && gameBoard.hasEmptyValueAt(boardLevel, j * GameBoard.SQUARES_PER_SIDE + l + 5)) {
place = checkForHoriz4InRow(playerMark, boardLevel, j, l);
if (anyHoriz4MatchToMark(type, place)) return place;
}
if (gameBoard.hasEmptyValueAt(boardLevel, l * GameBoard.SQUARES_PER_SIDE + j) && gameBoard.hasEmptyValueAt(boardLevel, l * GameBoard.SQUARES_PER_SIDE + j + 50)) {
place = checkForVert4InRow(playerMark, boardLevel, j, l);
if (anyVert4MatchToMark(type, place)) return place;
}
}
for (j = 0; j < 5; j++) {
clearMarksByAxisArray();
if (gameBoard.hasEmptyValueAt(boardLevel, l * GameBoard.SQUARES_PER_SIDE + j) && gameBoard.hasEmptyValueAt(boardLevel, l * GameBoard.SQUARES_PER_SIDE + j + 55)) {
place = checkForDiagDown4InRow(playerMark, boardLevel, j, l);
if (anyDiagDown4MatchToMark(type, place)) return place;
}
if (gameBoard.hasEmptyValueAt(boardLevel, l * GameBoard.SQUARES_PER_SIDE + j + 50) && gameBoard.hasEmptyValueAt(boardLevel, l * GameBoard.SQUARES_PER_SIDE + j + 5)) {
place = checkForDiagUp4InRow(playerMark, boardLevel, j, l);
if (anyDiagUp4MatchToMark(type, place)) return place;
}
}
}
if (type.equals(Mode.COUNT)) {
return new GamePosition(tempRowForChecks[0] + tempRowForChecks[1] + tempRowForChecks[2] + tempRowForChecks[3]);
}
return GamePosition.nonePosition();
}
public GamePosition checkForHoriz4InRow(GameBoardMark playerMark, int boardLevel, int j, int l) { /* horiz */
int place = GameBoard.oneMoreThanLastPositionOnBoard;
int k;
for (k = 1; k < 5; k++) {
if (gameBoard.valueAtPositionMatches(boardLevel, j * GameBoard.SQUARES_PER_SIDE + l + k, playerMark)) marksByAxis.incrementValueAtPositionAndReturnValue(0);
else if (gameBoard.hasEmptyValueAt(boardLevel, j * GameBoard.SQUARES_PER_SIDE + l + k)) {
place = GameBoard.SQUARES_PER_SIDE * j + l + k;
marksByAxis.incrementValueAtPositionAndReturnValue(1);
} else break;
}
return new GamePosition(place);
}
public GamePosition checkForVert4InRow(GameBoardMark playerMark, int boardLevel, int j, int l) {
int place = GameBoard.oneMoreThanLastPositionOnBoard;
int k;
for (k = 1; k < 5; k++) {
if (gameBoard.valueAtPositionMatches(boardLevel, l * GameBoard.SQUARES_PER_SIDE + j + k * GameBoard.SQUARES_PER_SIDE, playerMark)) marksByAxis.incrementValueAtPositionAndReturnValue(2);
else if (gameBoard.hasEmptyValueAt(boardLevel, l * GameBoard.SQUARES_PER_SIDE + j + k * GameBoard.SQUARES_PER_SIDE)) {
place = GameBoard.SQUARES_PER_SIDE * l + j + k * GameBoard.SQUARES_PER_SIDE;
marksByAxis.incrementValueAtPosition(3);
} else break;
}
return new GamePosition(place);
}
public GamePosition checkForDiagDown4InRow(GameBoardMark playerMark, int boardLevel, int j, int l) {
GamePosition place = GamePosition.nonePosition();
int k;
for (k = 1; k < 5; k++) {
if (gameBoard.valueAtPositionMatches(boardLevel, l * GameBoard.SQUARES_PER_SIDE + j + k * 11, playerMark)) marksByAxis.incrementValueAtPositionAndReturnValue(0);
if (gameBoard.hasEmptyValueAt(boardLevel, l * GameBoard.SQUARES_PER_SIDE + j + k * 11)) {
place = new GamePosition(l * GameBoard.SQUARES_PER_SIDE + j + k * 11);
marksByAxis.incrementValueAtPositionAndReturnValue(1);
}
}
return place;
}
public GamePosition checkForDiagUp4InRow(GameBoardMark playerMark, int boardLevel, int j, int l) {
GamePosition place = GamePosition.nonePosition();
int k;
for (k = 1; k < 5; k++) {
if (gameBoard.valueAtPositionMatches(boardLevel, l * GameBoard.SQUARES_PER_SIDE + j - k * GameBoard.oneLessThanCountInRow + 50, playerMark)) marksByAxis.incrementValueAtPosition(2);
if (gameBoard.valueAtPositionMatches(boardLevel, l * GameBoard.SQUARES_PER_SIDE + j - k * GameBoard.oneLessThanCountInRow + 50, GameBoardMark.EMPTY)) {
place = new GamePosition(l * GameBoard.SQUARES_PER_SIDE + j - k * GameBoard.oneLessThanCountInRow + 50);
marksByAxis.incrementValueAtPosition(3);
}
}
return place;
}
public boolean anyDiagUp4MatchToMark(Mode type, GamePosition place) {
boolean match = false;
int tempRowForChecks[] = new int[GameBoard.SQUARES_PER_SIDE];
if (!type.equals(Mode.CLEAN) && marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(2, 3), new MarksByAxisPositionPair(3, 1))) {
tempRowForChecks[3] = 1;
if (type.equals(Mode.CHECK)) {
match = true;
}
if (type.equals(Mode.SETFLAGS)) TemporaryChecksTable.tempTableForChecks[place.getRaw()] = GameBoardMark.OCCUPIED.index;
}
if (type.equals(Mode.CLEAN) && marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(2, 2), new MarksByAxisPositionPair(3, 2))) {
match = true;
}
return match;
}
public boolean anyDiagDown4MatchToMark(Mode type, GamePosition place) {
boolean match = false;
int tempRowForChecks[] = new int[GameBoard.SQUARES_PER_SIDE];
if (!type.equals(Mode.CLEAN) && marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(0, 3), new MarksByAxisPositionPair(1, 1))) {
tempRowForChecks[2] = 1;
if (type.equals(Mode.CHECK)) {
match = true;
}
if (type.equals(Mode.SETFLAGS)) TemporaryChecksTable.tempTableForChecks[place.getRaw()] = GameBoardMark.OCCUPIED.index;
}
if (type.equals(Mode.CLEAN) && marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(0, 2), new MarksByAxisPositionPair(1, 2))) {
match = true;
}
return match;
}
public boolean anyVert4MatchToMark(Mode type, GamePosition place) {
boolean match = false;
int tempRowForChecks[] = new int[GameBoard.SQUARES_PER_SIDE];
if (!type.equals(Mode.CLEAN) && marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(2, 3), new MarksByAxisPositionPair(3, 1))) {
tempRowForChecks[1] = 1;
if (type.equals(Mode.CHECK)) {
match = true;
}
if (type.equals(Mode.SETFLAGS)) TemporaryChecksTable.tempTableForChecks[place.getRaw()] = GameBoardMark.OCCUPIED.index;
}
if (type.equals(Mode.CLEAN) && marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(2, 2), new MarksByAxisPositionPair(3, 2))) {
match = true;
}
return match;
}
public boolean anyHoriz4MatchToMark(Mode type, GamePosition gamePosition) {
int tempRowForChecks[] = new int[GameBoard.SQUARES_PER_SIDE];
if (!type.equals(Mode.CLEAN) && marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(0, 3), new MarksByAxisPositionPair(1, 1))) {
tempRowForChecks[0] = 1;
if (type.equals(Mode.CHECK)) {
return true;
}
if (type.equals(Mode.SETFLAGS)) TemporaryChecksTable.tempTableForChecks[gamePosition.getRaw()] = GameBoardMark.OCCUPIED.index;
}
if (type.equals(Mode.CLEAN) && marksByAxis.valueAtPositionPairsMatch(new MarksByAxisPositionPair(0, 2), new MarksByAxisPositionPair(1, 2))) {
return true;
}
return false;
}
public void setFlagsForLaterProcessing(GameBoardMark playerMark) {
int k;
for (k = 0; k < GameBoard.TOTAL_SQUARES_PER_BOARD; k++)
TemporaryChecksTable.tempTableForChecks[k] = GameBoardMark.EMPTY.index;
blockSeriesOfFourOrMore(playerMark, 0, Mode.SETFLAGS);
responseTo3Or4InaRowOpportunity(playerMark, 0, Mode.SETFLAGS);
}
public void copyIntoStagingBoardFromOddBoardGroupAtDepth(int depth) {
for (int k = 0; k < GameBoard.TOTAL_SQUARES_PER_BOARD; k++)
StagingBoard.setValueAt(k, TemporaryBoardHolder.getValueAt(depth, k));
}
public void copyStagingBoardIntoOddGroupOfBoardsAtDepth(int depth) {
for (int k = 0; k < GameBoard.TOTAL_SQUARES_PER_BOARD; k++) {
TemporaryBoardHolder.setValueAt(depth, k, StagingBoard.getValueAt(k));
}
}
void copyBoardToCheck(int indexForBoardToCheck) {
for (int j = 0; j < GameBoard.TOTAL_SQUARES_PER_BOARD; j++) {
gameBoard.setValueAt(1, j, gameBoard.getValueAt(indexForBoardToCheck, j));
}
}
void clearMarksByAxisArray() {
for (int k = 0; k < 4; k++) {
marksByAxis.setPositionsToZero(k);
}
}
}
| [
"wordymusic@gmail.com"
] | wordymusic@gmail.com |
498396835d319faf943813cd668f4e73cf9c71e7 | fa55027e10c36977b4a50946d663e15f8fe0faf7 | /src/org/wshuai/leetcode/AmbiguousCoordinates.java | f332da30aff8c65a77b98ad989dcfa37cb0c6f88 | [] | no_license | relentlesscoder/Leetcode | 773a207c15ea72f6027eade8565377f11a856672 | 6b3ecd82d01739f6adb1caf86a770fcff0d6a54b | refs/heads/master | 2021-07-05T13:35:37.312910 | 2020-06-21T12:48:54 | 2020-06-21T12:48:54 | 40,448,524 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,407 | java | package org.wshuai.leetcode;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Wei on 11/11/2019.
* #0816 https://leetcode.com/problems/ambiguous-coordinates/
*/
public class AmbiguousCoordinates {
// time O(n^3), space O(n^2)
public List<String> ambiguousCoordinates(String S) {
S = S.substring(1, S.length() - 1);
List<String> res = new ArrayList<>();
for(int i = 1; i < S.length(); i++){
String s1 = S.substring(0, i), s2 = S.substring(i);
List<String> l1 = parse(s1), l2 = parse(s2);
if(l1.size() > 0 && l2.size() > 0){
for(String v1 : l1){
for(String v2 : l2){
res.add("(" + v1 + ", " + v2 + ")");
}
}
}
}
return res;
}
private List<String> parse(String s){
int n = s.length();
List<String> result = new ArrayList<>();
// "0xxxx0" invalid unless a single "0"
if (s.charAt(0) == '0' && s.charAt(n - 1) == '0') {
if (n == 1) {
result.add("0");
}
return result;
}
// "0xxxxx" the only valid result is "0.xxxxx"
if (s.charAt(0) == '0') {
result.add("0." + s.substring(1));
return result;
}
// "xxxxx0" the only valid result is itself
if (s.charAt(n - 1) == '0') {
result.add(s);
return result;
}
// add itself
result.add(s);
// "xxxx" -> "x.xxx", "xx.xx", "xxx.x"
for (int i = 1; i < n; i++) {
result.add(s.substring(0, i) + '.' + s.substring(i));
}
return result;
}
}
| [
"relentless.code@gmail.com"
] | relentless.code@gmail.com |
c1173ba155a91ed2b7b30a164d6d7ea75bd70817 | 9a6aa71b4b22da732d57db26c3143f9ea0644800 | /hx-ktdb/src/main/java/com/gistone/service/impl/LmMarkerRelationPositionServiceImpl.java | 2bdcc0729d7498dd0c1f4c7a0cb9bd33f6cb36df | [] | no_license | zjw118/anhui | d9067b57bedda2b59d5bfe06fcf761ef6d5bec83 | ec93131a62f2c7709fc61acc53f199ea215ce4ec | refs/heads/master | 2022-12-09T20:58:42.925010 | 2019-12-13T02:41:19 | 2019-12-13T02:41:19 | 229,440,319 | 0 | 0 | null | 2022-12-06T00:45:24 | 2019-12-21T14:38:38 | Java | UTF-8 | Java | false | false | 589 | java | package com.gistone.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gistone.entity.LmMarkerRelationPosition;
import com.gistone.mapper.LmMarkerRelationPositionMapper;
import com.gistone.service.ILmMarkerRelationPositionService;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author xjc
* @since 2019-03-20
*/
@Service
public class LmMarkerRelationPositionServiceImpl extends ServiceImpl<LmMarkerRelationPositionMapper, LmMarkerRelationPosition> implements ILmMarkerRelationPositionService {
}
| [
"zf1017@foxmail.com"
] | zf1017@foxmail.com |
f0e9373ed5bd90edc8165486e071e1477f5854b6 | 9b3f15e6b10c92dbd539b8141e4f8ac54e4ac032 | /app/src/main/java/com/dexfun/yiku/HomeActivity.java | 1ea0a6cbb1e5c2c83e343a90b28a484415aa67f8 | [] | no_license | chenkexu/YiKu_New | a7175cbb70e8d1841e21e6e0f330772fee739649 | 006b17cc7b598a7d2571cf264204984bc236c355 | refs/heads/master | 2020-04-05T04:29:10.822466 | 2018-11-08T08:40:24 | 2018-11-08T08:40:24 | 156,553,433 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,407 | java | package com.dexfun.yiku;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.content.ContextCompat;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Toast;
import com.dexfun.yiku.activity.DetailActivity;
import com.dexfun.yiku.activity.ShoppingCartActivity;
import com.dexfun.yiku.base.BaseActivity;
import com.dexfun.yiku.entity.GetUserInfoEntity;
import com.dexfun.yiku.entity.MainDexEvent;
import com.dexfun.yiku.entity.OnDexEvent;
import com.dexfun.yiku.entity.VersionEntity;
import com.dexfun.yiku.fragment.ChooseMainFragment;
import com.dexfun.yiku.fragment.HomeFragment;
import com.dexfun.yiku.fragment.PersonalFragment;
import com.dexfun.yiku.fragment.WishListFragment;
import com.dexfun.yiku.service.impl.HttpServiceImpl;
import com.dexfun.yiku.utils.UiUtils;
import com.dexfun.yiku.widget.BaseDialog;
import com.tencent.stat.MtaSDkException;
import com.tencent.stat.StatService;
import com.yinglan.alphatabs.AlphaTabsIndicator;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import butterknife.BindView;
public class HomeActivity extends BaseActivity {
@BindView(R.id.bottomNavigationView)
AlphaTabsIndicator mBottomNavigationView;
private long exitTime = 0;
private Fragment mContentFragment = null;
private Fragment mPersonalFragment = null;
private Fragment mHomeFragment = null;
private Fragment mChooseFragment = null;
private ShoppingCartActivity mKnapsackFragment = null;
private Fragment mWishListFragment = null;
@Override
public int getLayoutId() {
return R.layout.activity_home;
}
@Override
public void initView(Bundle savedInstanceState) {
EventBus.getDefault().register(this);
if (Build.VERSION.SDK_INT >= 23) {
int phone = ContextCompat.checkSelfPermission(this, android.Manifest.permission.READ_PHONE_STATE);
int write = ContextCompat.checkSelfPermission(this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (phone != PackageManager.PERMISSION_GRANTED || write != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.WRITE_EXTERNAL_STORAGE, android.Manifest.permission.READ_EXTERNAL_STORAGE, android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS}, 1013);
} else {
try {
// 第三个参数必须为:com.tencent.stat.common.StatConstants.VERSION
StatService.startStatService(this, "AGNQ18V3YH1B",
com.tencent.stat.common.StatConstants.VERSION);
Log.d("MTA", "MTA初始化成功");
} catch (MtaSDkException e) {
// MTA初始化失败
Log.d("MTA", "MTA初始化失败" + e);
}
}
}
// if (SharedPreferencesUtil.getInstance().getBoolean(Constant.LocalKey.ZYW, true)) {
// startActivity(new Intent(this, ZYWActivity.class));
// SharedPreferencesUtil.getInstance().put(Constant.LocalKey.ZYW, false);
// }
mContentFragment = new Fragment();
mHomeFragment = new HomeFragment();
mChooseFragment = new ChooseMainFragment();
mKnapsackFragment = new ShoppingCartActivity();
mPersonalFragment = new PersonalFragment();
mWishListFragment = new WishListFragment();
switchContent(mHomeFragment);
mBottomNavigationView.setOnTabChangedListner(tabNum -> {
switch (tabNum) {
case 0:
UiUtils.setStatusBarLightMode(this);
switchContent(mHomeFragment);
break;
case 1:
UiUtils.setStatusBarLightMode(this);
switchContent(mChooseFragment);
break;
case 2:
UiUtils.setStatusBarLightMode(this);
switchContent(mWishListFragment);
break;
case 3:
UiUtils.setStatusBarLightMode(this);
switchContent(mKnapsackFragment);
break;
case 4:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
getWindow().setStatusBarColor(Color.parseColor("#1A1A1A"));
}
switchContent(mPersonalFragment);
break;
default:
}
});
}
@Override
public void getData(Bundle savedInstanceState) {
try {
String id = getIntent().getStringExtra("id");
if (!TextUtils.isEmpty(id)) {
startActivity(new Intent(this, DetailActivity.class).putExtra("id", Integer.parseInt(id)));
}
} catch (Exception e) {
e.printStackTrace();
}
// startActivity(new Intent(this, LoginActivity.class));
new HttpServiceImpl().checkTheLatestVersion(new HttpServiceImpl.OnObjectDataListener<VersionEntity>() {
@Override
public void onData(VersionEntity data) {
int anInt = Integer.parseInt(data.getData().getServerNewVersion().replace(".", ""));
int parseInt = Integer.parseInt(BuildConfig.VERSION_NAME.replace(".", ""));
System.out.println(anInt);
System.out.println(parseInt);
if (anInt > parseInt) {
new BaseDialog(HomeActivity.this, true)
.setCancel(false)
.setMessage(data.getData().getUpgradeInfo())
.setPositiveButton("更新", (dialogInterface, i) -> {
dialogInterface.cancel();
Intent it = new Intent(Intent.ACTION_VIEW, Uri.parse(data.getData().getUpdateUrl()));
startActivity(it);
finish();
})
.setNegativeButton("退出程序", (dialogInterface, i) -> {
dialogInterface.cancel();
finish();
})
.show();
}
}
});
new HttpServiceImpl().getUserInfo(new HttpServiceImpl.OnObjectDataListener<GetUserInfoEntity>() {
@Override
public void onData(GetUserInfoEntity data) {
if (data.getStatus() == 200) {
UserClass.getInstance().setUserid(String.valueOf(data.getData().getUserInfo().getUserId()));
}
}
});
}
@SuppressLint("MissingSuperCall")
@Override
protected void onSaveInstanceState(Bundle outState) {
// super.onSaveInstanceState(outState);
}
private void switchContent(Fragment to) {
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
if (mContentFragment != to) {
if (!to.isAdded()) {
transaction.hide(mContentFragment).add(R.id.frame, to).commitAllowingStateLoss();
} else {
transaction.hide(mContentFragment).show(to).commitAllowingStateLoss();
}
mContentFragment = to;
} else {
transaction.replace(R.id.frame, to).commitAllowingStateLoss();
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
if ((System.currentTimeMillis() - exitTime) > 2000) {
Toast.makeText(getApplicationContext(), "再按一次返回桌面", Toast.LENGTH_SHORT).show();
exitTime = System.currentTimeMillis();
} else {
MainClass.finishAllActivity();
// Intent intent = new Intent(Intent.ACTION_MAIN);
// intent.addCategory(Intent.CATEGORY_HOME);
// startActivity(intent);
}
// Intent intent = new Intent(Intent.ACTION_MAIN);
// intent.addCategory(Intent.CATEGORY_HOME);
// startActivity(intent);
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
protected void onRestart() {
EventBus.getDefault().post(new OnDexEvent(0));
super.onRestart();
}
//迷之代码 勿动!!!
//迷之代码 勿动!!!
//迷之代码 勿动!!!
@Subscribe
public void onEventMainThread(MainDexEvent event) {
switch (event.getType()) {
case 0:
mBottomNavigationView.setTabCurrenItem(0);
break;
case 1:
mBottomNavigationView.setTabCurrenItem(1);
// if (mChooseFragment != null) {
// new Thread(new Runnable() {
// @Override
// public void run() {
// do {
// if (mChooseFragment.getTabPx() != null) {
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// ChooseFragment.ck = true;
// mChooseFragment.getGridView().smoothScrollToPositionFromTop(2, 500);
// mChooseFragment.getTabPx().setScrollPosition(1, 0, true);
// mChooseFragment.getTabPx().getTabAt(1).select();
// }
// });
// }
// } while (mChooseFragment.getTabPx() == null);
// }
// }).start();
// }
break;
case 2:
// mBottomNavigationView.setTabCurrenItem(2);
mKnapsackFragment.getData(null, null);
break;
default:
}
}
@Override
protected void onDestroy() {
EventBus.getDefault().unregister(this);
super.onDestroy();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == 1013) {
if (Build.VERSION.SDK_INT >= 23) {
int phone = ContextCompat.checkSelfPermission(this, android.Manifest.permission.READ_PHONE_STATE);
int write = ContextCompat.checkSelfPermission(this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (phone != PackageManager.PERMISSION_GRANTED || write != PackageManager.PERMISSION_GRANTED) {
// ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.WRITE_EXTERNAL_STORAGE, android.Manifest.permission.READ_EXTERNAL_STORAGE, android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS}, 1013);
} else {
try {
StatService.startStatService(this, "AGNQ18V3YH1B",
com.tencent.stat.common.StatConstants.VERSION);
Log.d("MTA", "MTA初始化成功");
} catch (MtaSDkException e) {
Log.d("MTA", "MTA初始化失败" + e);
}
}
}
}
}
}
| [
"953571793@qq.com"
] | 953571793@qq.com |
4fef3f090588effd2c0ada4dd534d7e3c25a0d02 | f35f4008d60bf04e6e3236a60514693cae296d42 | /app/src/main/java/com/google/android/gms/fitness/request/z.java | 82f1997113d081c6e13441f11448ec04c24e2874 | [] | no_license | alsmwsk/golfmon | ef0c8e8c7ecaa13371deed40f7e20468b823b0e9 | 740132d47185bfe9ec9d6774efbde5404ea8cf6d | refs/heads/master | 2020-03-22T11:16:01.438894 | 2018-07-06T09:47:10 | 2018-07-06T09:47:10 | 139,959,669 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,665 | java | package com.google.android.gms.fitness.request;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.google.android.gms.common.internal.safeparcel.a;
import com.google.android.gms.common.internal.safeparcel.a.a;
import com.google.android.gms.common.internal.safeparcel.b;
public class z
implements Parcelable.Creator<y>
{
static void a(y paramy, Parcel paramParcel, int paramInt)
{
int i = b.H(paramParcel);
b.a(paramParcel, 1, paramy.getName(), false);
b.c(paramParcel, 1000, paramy.getVersionCode());
b.a(paramParcel, 2, paramy.getIdentifier(), false);
b.H(paramParcel, i);
}
public y bW(Parcel paramParcel)
{
String str1 = null;
int i = a.G(paramParcel);
int j = 0;
String str2 = null;
while (paramParcel.dataPosition() < i)
{
int k = a.F(paramParcel);
switch (a.aH(k))
{
default:
a.b(paramParcel, k);
break;
case 1:
str2 = a.o(paramParcel, k);
break;
case 1000:
j = a.g(paramParcel, k);
break;
case 2:
str1 = a.o(paramParcel, k);
}
}
if (paramParcel.dataPosition() != i) {
throw new a.a("Overread allowed size end=" + i, paramParcel);
}
return new y(j, str2, str1);
}
public y[] dr(int paramInt)
{
return new y[paramInt];
}
}
/* Location: C:\Users\TGKIM\Downloads\작업폴더\리버싱\androidReversetools\jd-gui-0.3.6.windows\com.appg.golfmon-1-dex2jar.jar
* Qualified Name: com.google.android.gms.fitness.request.z
* JD-Core Version: 0.7.0.1
*/ | [
"alsmwsk@naver.com"
] | alsmwsk@naver.com |
6b1884817598cbe0b9272225977af760d3754035 | 93c5b9273270f79ac3fd49e5ff0cc104d78ed50a | /starter/src/main/java/com/salmondx/cxf/client/core/utils/NamingUtilities.java | 3a3687ee5c16f258ad60badfdcb383886ce1b4a5 | [
"MIT"
] | permissive | jiraguha/spring-soap-client-starter | 92818d4faef4a657b133a5f8a8ff336297296b15 | f42b3cb86a879bbb435fbcad1eca5d34559334f6 | refs/heads/master | 2021-05-14T19:37:40.993083 | 2017-11-10T09:14:40 | 2017-11-10T09:16:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 284 | java | package com.salmondx.cxf.client.core.utils;
import org.apache.commons.lang3.StringUtils;
/**
* Created by Salmondx on 08/09/16.
*/
public class NamingUtilities {
public static String removeSetPrefix(String name) {
return StringUtils.removeStart(name, "set");
}
}
| [
"ggolda@alfabank.ru"
] | ggolda@alfabank.ru |
966cbff08b506d287a0c8070de9217e7278aaff6 | 4116230b16e2b74ca0efe9992e5db81b8f451bc0 | /.svn/pristine/96/966cbff08b506d287a0c8070de9217e7278aaff6.svn-base | 60d7b8f4f463ca26735a931d9587fd927908508a | [] | no_license | folksuperior/123 | 2e4d2fe79b870feca41d30993d14e59b3222a209 | 0844ba3373ec17bff8b7a9df1fb95724061fb2a7 | refs/heads/master | 2021-01-20T08:19:46.315561 | 2017-03-04T15:17:59 | 2017-03-04T15:17:59 | 83,903,761 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,591 | /**
*
*/
package cn.yin.jx.domain;
import java.util.HashSet;
import java.util.Set;
/**
* @Description:
* @author: 尹成功
* @version: 1.0
* @Company: http://java.itcast.cn
* @date: 2017年2月18日
*/
public class User extends BaseEntity{
//用户编号
private String id;
//部门编号
//用户与部门,是多对一的关系
private Dept dept;
//用户姓名
private String userName;
//密码
private String password;
//状态 0 禁用 1 启用
private Integer state;
//用户扩展信息
private UserInfo userInfo;
private Set<Role> roles = new HashSet();
public Set<Role> getRoles() {
return roles;
}
public void setRoles(Set<Role> roles) {
this.roles = roles;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Dept getDept() {
return dept;
}
public void setDept(Dept dept) {
this.dept = dept;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public UserInfo getUserInfo() {
return userInfo;
}
public void setUserInfo(UserInfo userInfo) {
this.userInfo = userInfo;
}
}
| [
"Administrator@Peter"
] | Administrator@Peter | |
ce3d2d2444792e9682ba86f5d7bbc2a7e014ad1c | 914de9bb4831eb9803330b267870ff0dcd838456 | /TalkingTagsClient/src/com/google/android/apps/talkingtags/model/Tag.java | bf1d2abcb1ca23347a7cc527d1199ba968fd430e | [] | no_license | audisuv/talking-tags-android-client | bbceb6a1afa94ca9a67b94b5cbd34a4274684521 | 2575ffc847dbb22b6d936ebadecd3c5cdb2fe7cf | refs/heads/master | 2016-08-12T02:58:08.349142 | 2015-05-30T12:34:02 | 2015-05-30T12:34:02 | 36,557,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 743 | java | // Copyright 2010 Google Inc. All Rights Reserved.
package com.google.android.apps.talkingtags.model;
import java.io.Serializable;
/**
* Represents a tag-instance.
* @author adamconnors@google.com (Adam Connors)
*/
public class Tag implements Serializable {
private static final long serialVersionUID = 1L;
public final String tagId;
public final String tagShortDescription;
public final String title;
public final String body;
public Tag(String tagId, String shortDesc, String title, String body) {
this.tagId = tagId;
this.tagShortDescription = shortDesc;
this.title = title;
this.body = body;
}
@Override
public String toString() {
return "Tag: " + tagId + ": " + title + "/" + body;
}
}
| [
"adamconnors@2f18c655-9d46-4c27-46c3-8d257dfb4d8a"
] | adamconnors@2f18c655-9d46-4c27-46c3-8d257dfb4d8a |
e3d4ce292143758130d1c985fea0d1ca2b556ed0 | 17107e38fb7527b220b1b51ed1dd81e3429c051e | /library/src/main/java/cn/trinea/android/common/util/JSONUtils.java | 8d7a1269af7d6196ffc964b735b9d5639505f6b7 | [] | no_license | dusensong/common-library | ea32004bbe57cc21fdc1fd13d3ff47c849d3a3d0 | 236da3878c60a12fd75789c04b72ff36aa0f75b0 | refs/heads/master | 2020-12-26T01:48:51.202453 | 2015-11-18T03:34:14 | 2015-11-18T03:34:14 | 36,588,270 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 26,655 | java | package cn.trinea.android.common.util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import wehax.util.StringUtils;
/**
* Json Utils
*
* @author <a href="http://www.trinea.cn" target="_blank">Trinea</a> 2012-5-12
*/
public class JSONUtils {
public static boolean isPrintException = true;
private JSONUtils() {
throw new AssertionError();
}
/**
* get Long from jsonObject
*
* @param jsonObject
* @param key
* @param defaultValue
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if key is null or empty, return defaultValue</li>
* <li>if {@link JSONObject#getLong(String)} exception, return defaultValue</li>
* <li>return {@link JSONObject#getLong(String)}</li>
* </ul>
*/
public static Long getLong(JSONObject jsonObject, String key, Long defaultValue) {
if (jsonObject == null || StringUtils.isEmpty(key)) {
return defaultValue;
}
try {
return jsonObject.getLong(key);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
}
/**
* get Long from jsonData
*
* @param jsonData
* @param key
* @param defaultValue
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if jsonData {@link JSONObject#JSONObject(String)} exception, return defaultValue</li>
* <li>return {@link JSONUtils#getLong(JSONObject, String, JSONObject)}</li>
* </ul>
*/
public static Long getLong(String jsonData, String key, Long defaultValue) {
if (StringUtils.isEmpty(jsonData)) {
return defaultValue;
}
try {
JSONObject jsonObject = new JSONObject(jsonData);
return getLong(jsonObject, key, defaultValue);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
}
/**
* @param jsonObject
* @param key
* @param defaultValue
* @return
* @see JSONUtils#getLong(JSONObject, String, Long)
*/
public static long getLong(JSONObject jsonObject, String key, long defaultValue) {
return getLong(jsonObject, key, (Long)defaultValue);
}
/**
* @param jsonData
* @param key
* @param defaultValue
* @return
* @see JSONUtils#getLong(String, String, Long)
*/
public static long getLong(String jsonData, String key, long defaultValue) {
return getLong(jsonData, key, (Long)defaultValue);
}
/**
* get Int from jsonObject
*
* @param jsonObject
* @param key
* @param defaultValue
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if key is null or empty, return defaultValue</li>
* <li>if {@link JSONObject#getInt(String)} exception, return defaultValue</li>
* <li>return {@link JSONObject#getInt(String)}</li>
* </ul>
*/
public static Integer getInt(JSONObject jsonObject, String key, Integer defaultValue) {
if (jsonObject == null || StringUtils.isEmpty(key)) {
return defaultValue;
}
try {
return jsonObject.getInt(key);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
}
/**
* get Int from jsonData
*
* @param jsonData
* @param key
* @param defaultValue
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if jsonData {@link JSONObject#JSONObject(String)} exception, return defaultValue</li>
* <li>return {@link JSONUtils#getInt(JSONObject, String, JSONObject)}</li>
* </ul>
*/
public static Integer getInt(String jsonData, String key, Integer defaultValue) {
if (StringUtils.isEmpty(jsonData)) {
return defaultValue;
}
try {
JSONObject jsonObject = new JSONObject(jsonData);
return getInt(jsonObject, key, defaultValue);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
}
/**
* @param jsonObject
* @param key
* @param defaultValue
* @return
* @see JSONUtils#getInt(JSONObject, String, Integer)
*/
public static int getInt(JSONObject jsonObject, String key, int defaultValue) {
return getInt(jsonObject, key, (Integer)defaultValue);
}
/**
* @param jsonObject
* @param key
* @param defaultValue
* @return
* @see JSONUtils#getInt(String, String, Integer)
*/
public static int getInt(String jsonData, String key, int defaultValue) {
return getInt(jsonData, key, (Integer)defaultValue);
}
/**
* get Double from jsonObject
*
* @param jsonObject
* @param key
* @param defaultValue
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if key is null or empty, return defaultValue</li>
* <li>if {@link JSONObject#getDouble(String)} exception, return defaultValue</li>
* <li>return {@link JSONObject#getDouble(String)}</li>
* </ul>
*/
public static Double getDouble(JSONObject jsonObject, String key, Double defaultValue) {
if (jsonObject == null || StringUtils.isEmpty(key)) {
return defaultValue;
}
try {
return jsonObject.getDouble(key);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
}
/**
* get Double from jsonData
*
* @param jsonData
* @param key
* @param defaultValue
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if jsonData {@link JSONObject#JSONObject(String)} exception, return defaultValue</li>
* <li>return {@link JSONUtils#getDouble(JSONObject, String, JSONObject)}</li>
* </ul>
*/
public static Double getDouble(String jsonData, String key, Double defaultValue) {
if (StringUtils.isEmpty(jsonData)) {
return defaultValue;
}
try {
JSONObject jsonObject = new JSONObject(jsonData);
return getDouble(jsonObject, key, defaultValue);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
}
/**
* @param jsonObject
* @param key
* @param defaultValue
* @return
* @see JSONUtils#getDouble(JSONObject, String, Double)
*/
public static double getDouble(JSONObject jsonObject, String key, double defaultValue) {
return getDouble(jsonObject, key, (Double)defaultValue);
}
/**
* @param jsonObject
* @param key
* @param defaultValue
* @return
* @see JSONUtils#getDouble(String, String, Double)
*/
public static double getDouble(String jsonData, String key, double defaultValue) {
return getDouble(jsonData, key, (Double)defaultValue);
}
/**
* get String from jsonObject
*
* @param jsonObject
* @param key
* @param defaultValue
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if key is null or empty, return defaultValue</li>
* <li>if {@link JSONObject#getString(String)} exception, return defaultValue</li>
* <li>return {@link JSONObject#getString(String)}</li>
* </ul>
*/
public static String getString(JSONObject jsonObject, String key, String defaultValue) {
if (jsonObject == null || StringUtils.isEmpty(key)) {
return defaultValue;
}
try {
return jsonObject.getString(key);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
}
/**
* get String from jsonData
*
* @param jsonData
* @param key
* @param defaultValue
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if jsonData {@link JSONObject#JSONObject(String)} exception, return defaultValue</li>
* <li>return {@link JSONUtils#getString(JSONObject, String, JSONObject)}</li>
* </ul>
*/
public static String getString(String jsonData, String key, String defaultValue) {
if (StringUtils.isEmpty(jsonData)) {
return defaultValue;
}
try {
JSONObject jsonObject = new JSONObject(jsonData);
return getString(jsonObject, key, defaultValue);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
}
/**
* get String from jsonObject
*
* @param jsonObject
* @param defaultValue
* @param keyArray
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if keyArray is null or empty, return defaultValue</li>
* <li>get {@link #getJSONObject(JSONObject, String, JSONObject)} by recursion, return it. if anyone is
* null, return directly</li>
* </ul>
*/
public static String getStringCascade(JSONObject jsonObject, String defaultValue, String... keyArray) {
if (jsonObject == null || ArrayUtils.isEmpty(keyArray)) {
return defaultValue;
}
String data = jsonObject.toString();
for (String key : keyArray) {
data = getStringCascade(data, key, defaultValue);
if (data == null) {
return defaultValue;
}
}
return data;
}
/**
* get String from jsonData
*
* @param jsonData
* @param defaultValue
* @param keyArray
* @return <ul>
* <li>if jsonData is null, return defaultValue</li>
* <li>if keyArray is null or empty, return defaultValue</li>
* <li>get {@link #getJSONObject(JSONObject, String, JSONObject)} by recursion, return it. if anyone is
* null, return directly</li>
* </ul>
*/
public static String getStringCascade(String jsonData, String defaultValue, String... keyArray) {
if (StringUtils.isEmpty(jsonData)) {
return defaultValue;
}
String data = jsonData;
for (String key : keyArray) {
data = getString(data, key, defaultValue);
if (data == null) {
return defaultValue;
}
}
return data;
}
/**
* get String array from jsonObject
*
* @param jsonObject
* @param key
* @param defaultValue
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if key is null or empty, return defaultValue</li>
* <li>if {@link JSONObject#getJSONArray(String)} exception, return defaultValue</li>
* <li>if {@link JSONArray#getString(int)} exception, return defaultValue</li>
* <li>return string array</li>
* </ul>
*/
public static String[] getStringArray(JSONObject jsonObject, String key, String[] defaultValue) {
if (jsonObject == null || StringUtils.isEmpty(key)) {
return defaultValue;
}
try {
JSONArray statusArray = jsonObject.getJSONArray(key);
if (statusArray != null) {
String[] value = new String[statusArray.length()];
for (int i = 0; i < statusArray.length(); i++) {
value[i] = statusArray.getString(i);
}
return value;
}
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
return defaultValue;
}
/**
* get String array from jsonData
*
* @param jsonData
* @param key
* @param defaultValue
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if jsonData {@link JSONObject#JSONObject(String)} exception, return defaultValue</li>
* <li>return {@link JSONUtils#getStringArray(JSONObject, String, JSONObject)}</li>
* </ul>
*/
public static String[] getStringArray(String jsonData, String key, String[] defaultValue) {
if (StringUtils.isEmpty(jsonData)) {
return defaultValue;
}
try {
JSONObject jsonObject = new JSONObject(jsonData);
return getStringArray(jsonObject, key, defaultValue);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
}
/**
* get String list from jsonObject
*
* @param jsonObject
* @param key
* @param defaultValue
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if key is null or empty, return defaultValue</li>
* <li>if {@link JSONObject#getJSONArray(String)} exception, return defaultValue</li>
* <li>if {@link JSONArray#getString(int)} exception, return defaultValue</li>
* <li>return string array</li>
* </ul>
*/
public static List<String> getStringList(JSONObject jsonObject, String key, List<String> defaultValue) {
if (jsonObject == null || StringUtils.isEmpty(key)) {
return defaultValue;
}
try {
JSONArray statusArray = jsonObject.getJSONArray(key);
if (statusArray != null) {
List<String> list = new ArrayList<String>();
for (int i = 0; i < statusArray.length(); i++) {
list.add(statusArray.getString(i));
}
return list;
}
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
return defaultValue;
}
/**
* get String list from jsonData
*
* @param jsonData
* @param key
* @param defaultValue
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if jsonData {@link JSONObject#JSONObject(String)} exception, return defaultValue</li>
* <li>return {@link JSONUtils#getStringList(JSONObject, String, List)}</li>
* </ul>
*/
public static List<String> getStringList(String jsonData, String key, List<String> defaultValue) {
if (StringUtils.isEmpty(jsonData)) {
return defaultValue;
}
try {
JSONObject jsonObject = new JSONObject(jsonData);
return getStringList(jsonObject, key, defaultValue);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
}
/**
* get JSONObject from jsonObject
*
* @param jsonObject
* @param key
* @param defaultValue
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if key is null or empty, return defaultValue</li>
* <li>if {@link JSONObject#getJSONObject(String)} exception, return defaultValue</li>
* <li>return {@link JSONObject#getJSONObject(String)}</li>
* </ul>
*/
public static JSONObject getJSONObject(JSONObject jsonObject, String key, JSONObject defaultValue) {
if (jsonObject == null || StringUtils.isEmpty(key)) {
return defaultValue;
}
try {
return jsonObject.getJSONObject(key);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
}
/**
* get JSONObject from jsonData
*
* @param jsonData
* @param key
* @param defaultValue
* @return <ul>
* <li>if jsonData is null, return defaultValue</li>
* <li>if jsonData {@link JSONObject#JSONObject(String)} exception, return defaultValue</li>
* <li>return {@link JSONUtils#getJSONObject(JSONObject, String, JSONObject)}</li>
* </ul>
*/
public static JSONObject getJSONObject(String jsonData, String key, JSONObject defaultValue) {
if (StringUtils.isEmpty(jsonData)) {
return defaultValue;
}
try {
JSONObject jsonObject = new JSONObject(jsonData);
return getJSONObject(jsonObject, key, defaultValue);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
}
/**
* get JSONObject from jsonObject
*
* @param jsonObject
* @param defaultValue
* @param keyArray
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if keyArray is null or empty, return defaultValue</li>
* <li>get {@link #getJSONObject(JSONObject, String, JSONObject)} by recursion, return it. if anyone is
* null, return directly</li>
* </ul>
*/
public static JSONObject getJSONObjectCascade(JSONObject jsonObject, JSONObject defaultValue, String... keyArray) {
if (jsonObject == null || ArrayUtils.isEmpty(keyArray)) {
return defaultValue;
}
JSONObject js = jsonObject;
for (String key : keyArray) {
js = getJSONObject(js, key, defaultValue);
if (js == null) {
return defaultValue;
}
}
return js;
}
/**
* get JSONObject from jsonData
*
* @param jsonData
* @param defaultValue
* @param keyArray
* @return <ul>
* <li>if jsonData is null, return defaultValue</li>
* <li>if keyArray is null or empty, return defaultValue</li>
* <li>get {@link #getJSONObject(JSONObject, String, JSONObject)} by recursion, return it. if anyone is
* null, return directly</li>
* </ul>
*/
public static JSONObject getJSONObjectCascade(String jsonData, JSONObject defaultValue, String... keyArray) {
if (StringUtils.isEmpty(jsonData)) {
return defaultValue;
}
try {
JSONObject jsonObject = new JSONObject(jsonData);
return getJSONObjectCascade(jsonObject, defaultValue, keyArray);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
}
/**
* get JSONArray from jsonObject
*
* @param jsonObject
* @param key
* @param defaultValue
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if key is null or empty, return defaultValue</li>
* <li>if {@link JSONObject#getJSONArray(String)} exception, return defaultValue</li>
* <li>return {@link JSONObject#getJSONArray(String)}</li>
* </ul>
*/
public static JSONArray getJSONArray(JSONObject jsonObject, String key, JSONArray defaultValue) {
if (jsonObject == null || StringUtils.isEmpty(key)) {
return defaultValue;
}
try {
return jsonObject.getJSONArray(key);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
}
/**
* get JSONArray from jsonData
*
* @param jsonData
* @param key
* @param defaultValue
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if jsonData {@link JSONObject#JSONObject(String)} exception, return defaultValue</li>
* <li>return {@link JSONUtils#getJSONArray(JSONObject, String, JSONObject)}</li>
* </ul>
*/
public static JSONArray getJSONArray(String jsonData, String key, JSONArray defaultValue) {
if (StringUtils.isEmpty(jsonData)) {
return defaultValue;
}
try {
JSONObject jsonObject = new JSONObject(jsonData);
return getJSONArray(jsonObject, key, defaultValue);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
}
/**
* get Boolean from jsonObject
*
* @param jsonObject
* @param key
* @param defaultValue
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if key is null or empty, return defaultValue</li>
* <li>return {@link JSONObject#getBoolean(String)}</li>
* </ul>
*/
public static boolean getBoolean(JSONObject jsonObject, String key, Boolean defaultValue) {
if (jsonObject == null || StringUtils.isEmpty(key)) {
return defaultValue;
}
try {
return jsonObject.getBoolean(key);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
}
/**
* get Boolean from jsonData
*
* @param jsonData
* @param key
* @param defaultValue
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if jsonData {@link JSONObject#JSONObject(String)} exception, return defaultValue</li>
* <li>return {@link JSONUtils#getBoolean(JSONObject, String, Boolean)}</li>
* </ul>
*/
public static boolean getBoolean(String jsonData, String key, Boolean defaultValue) {
if (StringUtils.isEmpty(jsonData)) {
return defaultValue;
}
try {
JSONObject jsonObject = new JSONObject(jsonData);
return getBoolean(jsonObject, key, defaultValue);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
}
/**
* get map from jsonObject.
*
* @param jsonObject key-value pairs json
* @param key
* @return <ul>
* <li>if jsonObject is null, return null</li>
* <li>return {@link JSONUtils#parseKeyAndValueToMap(String)}</li>
* </ul>
*/
public static Map<String, String> getMap(JSONObject jsonObject, String key) {
return JSONUtils.parseKeyAndValueToMap(JSONUtils.getString(jsonObject, key, null));
}
/**
* get map from jsonData.
*
* @param jsonData key-value pairs string
* @param key
* @return <ul>
* <li>if jsonData is null, return null</li>
* <li>if jsonData length is 0, return empty map</li>
* <li>if jsonData {@link JSONObject#JSONObject(String)} exception, return null</li>
* <li>return {@link JSONUtils#getMap(JSONObject, String)}</li>
* </ul>
*/
public static Map<String, String> getMap(String jsonData, String key) {
if (jsonData == null) {
return null;
}
if (jsonData.length() == 0) {
return new HashMap<String, String>();
}
try {
JSONObject jsonObject = new JSONObject(jsonData);
return getMap(jsonObject, key);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return null;
}
}
/**
* parse key-value pairs to map. ignore empty key, if getValue exception, put empty value
*
* @param sourceObj key-value pairs json
* @return <ul>
* <li>if sourceObj is null, return null</li>
* <li>else parse entry by {@link MapUtils#putMapNotEmptyKey(Map, String, String)} one by one</li>
* </ul>
*/
@SuppressWarnings("rawtypes")
public static Map<String, String> parseKeyAndValueToMap(JSONObject sourceObj) {
if (sourceObj == null) {
return null;
}
Map<String, String> keyAndValueMap = new HashMap<String, String>();
for (Iterator iter = sourceObj.keys(); iter.hasNext();) {
String key = (String)iter.next();
MapUtils.putMapNotEmptyKey(keyAndValueMap, key, getString(sourceObj, key, ""));
}
return keyAndValueMap;
}
/**
* parse key-value pairs to map. ignore empty key, if getValue exception, put empty value
*
* @param source key-value pairs json
* @return <ul>
* <li>if source is null or source's length is 0, return empty map</li>
* <li>if source {@link JSONObject#JSONObject(String)} exception, return null</li>
* <li>return {@link JSONUtils#parseKeyAndValueToMap(JSONObject)}</li>
* </ul>
*/
public static Map<String, String> parseKeyAndValueToMap(String source) {
if (StringUtils.isEmpty(source)) {
return null;
}
try {
JSONObject jsonObject = new JSONObject(source);
return parseKeyAndValueToMap(jsonObject);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return null;
}
}
}
| [
"58247052@qq.com"
] | 58247052@qq.com |
ba8bffa612c0574491e88bf3262acd38f6c34311 | 6facc6cc414ddaafa5f7bfe00d71a743b9dfe928 | /ece558project3_release/app/src/androidTest/java/com/example/hiral/myapplication/ApplicationTest.java | cb78e05d3d6f395f2009c5d0b180360472e3fe48 | [] | no_license | hrishikesh988/CoffeeMaker | 1bfee6be258e79912dae7df8a6964f9d70d17bad | 645bc52d758bd702663785f0262862134ab75b5b | refs/heads/master | 2021-06-08T17:43:01.766413 | 2016-12-02T06:06:29 | 2016-12-02T06:06:29 | 74,104,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 374 | java | package com.example.hiral.myapplication;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"hndeshmukh89@gmail.com"
] | hndeshmukh89@gmail.com |
674161e26c7010ca234f15ebe8583f29752bc2ea | 589dcd422402477ce80e9c349bd483c2d36b80cd | /trunk/adhoc-solr/src/main/java/org/apache/lucene/util/cache/Cache.java | 5261a53178b878fefaeb76c47cc879d561842e7f | [
"Apache-2.0",
"LicenseRef-scancode-unicode-mappings",
"BSD-3-Clause",
"CDDL-1.0",
"Python-2.0",
"MIT",
"ICU",
"CPL-1.0"
] | permissive | baojiawei1230/mdrill | e3d92f4f1f85b34f0839f8463e7e5353145a9c78 | edacdb4dc43ead6f14d83554c1f402aa1ffdec6a | refs/heads/master | 2021-06-10T17:42:11.076927 | 2021-03-15T16:43:06 | 2021-03-15T16:43:06 | 95,193,877 | 0 | 0 | Apache-2.0 | 2021-03-15T16:43:06 | 2017-06-23T07:15:00 | Java | UTF-8 | Java | false | false | 3,323 | java | package org.apache.lucene.util.cache;
/**
* 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.
*/
import java.io.Closeable;
/**
* Base class for cache implementations.
*/
public abstract class Cache<K,V> implements Closeable {
/**
* Simple Cache wrapper that synchronizes all
* calls that access the cache.
*/
static class SynchronizedCache<K,V> extends Cache<K,V> {
private Object mutex;
private Cache<K,V> cache;
SynchronizedCache(Cache<K,V> cache) {
this.cache = cache;
this.mutex = this;
}
SynchronizedCache(Cache<K,V> cache, Object mutex) {
this.cache = cache;
this.mutex = mutex;
}
@Override
public void put(K key, V value) {
synchronized(mutex) {cache.put(key, value);}
}
@Override
public V get(Object key) {
synchronized(mutex) {return cache.get(key);}
}
@Override
public boolean containsKey(Object key) {
synchronized(mutex) {return cache.containsKey(key);}
}
@Override
public void close() {
synchronized(mutex) {cache.close();}
}
@Override
Cache<K,V> getSynchronizedCache() {
return this;
}
@Override
public V remove(Object key) {
synchronized(mutex) {return cache.remove(key);}
}
@Override
public int size() {
synchronized(mutex) {return cache.size();}
}
}
/**
* Returns a thread-safe cache backed by the specified cache.
* In order to guarantee thread-safety, all access to the backed cache must
* be accomplished through the returned cache.
*/
public static <K,V> Cache<K,V> synchronizedCache(Cache<K,V> cache) {
return cache.getSynchronizedCache();
}
/**
* Called by {@link #synchronizedCache(Cache)}. This method
* returns a {@link SynchronizedCache} instance that wraps
* this instance by default and can be overridden to return
* e. g. subclasses of {@link SynchronizedCache} or this
* in case this cache is already synchronized.
*/
Cache<K,V> getSynchronizedCache() {
return new SynchronizedCache<K,V>(this);
}
/**
* Puts a (key, value)-pair into the cache.
*/
public abstract void put(K key, V value);
public abstract int size();
/**
* Returns the value for the given key.
*/
public abstract V get(Object key);
public abstract V remove(Object key);
/**
* Returns whether the given key is in this cache.
*/
public abstract boolean containsKey(Object key);
/**
* Closes the cache.
*/
public abstract void close();
}
| [
"myn@163.com"
] | myn@163.com |
0aa8e8c2d8254a9c43c7cf19b9376399b07c4edf | 2c039978fb2e427b0bab0453923a0b66a98d840c | /src/main/java/framework/annotation/Aspect.java | aabc7ba2111c7c4eff79e5cf1d2ce2f9e5f809d5 | [] | no_license | haizi1996/MVC-framework | 8a5411621e38c82cf80c059b67e7a9b13face56f | c630eac2c5fc08b8a4f844ea76fe5a856e11e795 | refs/heads/master | 2021-01-01T17:09:13.422634 | 2018-12-15T12:43:42 | 2018-12-15T12:43:42 | 98,013,802 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 480 | java | package framework.annotation;
import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Aspect {
Class<? extends Annotation>[] targetClass(); //目标类
/**
*代理类的第几层,数值越小离目标类越近
*/
int order() default 1;
} | [
"1051956253@qq.com"
] | 1051956253@qq.com |
fbd84b006ed8fe16d8e41d3f7b6fbffcc6638996 | 404475cfd3471e197b4a6637398a0ffcdc0c2904 | /app/src/main/java/com/yiaosi/aps/adapter/WorkbenchItemAdapter.java | 19289d903f85d67ca78279f0c625db2694069114 | [] | no_license | Lion2003/APSDemo | 826d0752323ec0e9c55b69f49c061d3c936d29f7 | b8c2f32140d48836d90dcc17eba4b185c35ac236 | refs/heads/master | 2021-01-01T20:31:19.390078 | 2017-12-27T16:13:19 | 2017-12-27T16:13:19 | 98,874,696 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,641 | java | package com.yiaosi.aps.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.yiaosi.aps.R;
import com.yiaosi.aps.entity.WorkbenchItem;
import java.util.List;
/**
* Created by Administrator on 2017-06-05.
*/
public class WorkbenchItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final int TITLE = 0;
private static final int ITEM1 = 1;
private static final int ITEM2 = 2;
private static final int ITEM3 = 3;
private Context context;
private List<WorkbenchItem> list;
private LayoutInflater mLayoutInflater;
private OnMyClickListener onMyClickListener;
public WorkbenchItemAdapter(Context context, List<WorkbenchItem> list) {
this.context = context;
this.list = list;
this.mLayoutInflater = LayoutInflater.from(context);
}
public interface OnMyClickListener {
void onClick(View view, int position, String pic, String isShow);
}
public void setOnMyClickListener(OnMyClickListener onMyClickListener) {
this.onMyClickListener = onMyClickListener;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if(viewType == TITLE) {
return new HeaderViewHolder(mLayoutInflater.inflate(R.layout.em_workbench_header, parent, false));
} else if(viewType == ITEM1) {
return new Item1ViewHolder(mLayoutInflater.inflate(R.layout.em_workbench_itemtype1, parent, false));
} else if(viewType == ITEM2) {
return new Item2ViewHolder(mLayoutInflater.inflate(R.layout.em_workbench_itemtype2, parent, false));
} else if(viewType == ITEM3) {
return new Item3ViewHolder(mLayoutInflater.inflate(R.layout.em_workbench_itemtype3, parent, false));
}
return null;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
if(holder instanceof HeaderViewHolder) {
((HeaderViewHolder)holder).item0.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onMyClickListener.onClick(v, 0, "", "-1");
}
});
((HeaderViewHolder)holder).item1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onMyClickListener.onClick(v, 1, "", "-1");
}
});
((HeaderViewHolder)holder).item2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onMyClickListener.onClick(v, 2, "", "-1");
}
});
((HeaderViewHolder)holder).item3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onMyClickListener.onClick(v, 3, "", "-1");
}
});
} else if( holder instanceof Item1ViewHolder) {
if(position == 1) {
((Item1ViewHolder)holder).title.setText("今日紧急未处理单");
} else if(position == getItemCount() - 2) {
((Item1ViewHolder)holder).title.setText("今日任务事项");
}
} else if(holder instanceof Item2ViewHolder) {
// ((RemindNoticeAdapter.ItemViewHolder)holder).relativeLayout.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// onMyClickListener.onClick(v);
// }
// });
((Item2ViewHolder)holder).linearLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onMyClickListener.onClick(v, 4, list.get(position - 2).getPic(), list.get(position - 2).getIsFinish());
}
});
((Item2ViewHolder)holder).customerName.setText("客户名称:" + list.get(position - 2).getCustomerName());
if(list.get(position - 2).getIsFinish().equals("1")) {
((Item2ViewHolder)holder).jindu.setText("已处理");
((Item2ViewHolder)holder).jindu.setTextColor(context.getResources().getColor(R.color.color_808080));
} else {
((Item2ViewHolder)holder).jindu.setText("未处理");
((Item2ViewHolder)holder).jindu.setTextColor(context.getResources().getColor(R.color.color_e24a4a));
}
Glide.with(context).load(list.get(position - 2).getPic()).into(((Item2ViewHolder)holder).img);
((Item2ViewHolder)holder).ewi_productOrderNum.setText(list.get(position - 2).getProductOrderNum());
((Item2ViewHolder)holder).ewi_clientDate.setText(list.get(position - 2).getCustomerDate());
((Item2ViewHolder)holder).ewi_styleNum.setText(list.get(position - 2).getStyleNum());
((Item2ViewHolder)holder).ewi_color.setText(list.get(position - 2).getColor());
((Item2ViewHolder)holder).ewi_number.setText("数量 " + list.get(position - 2).getNum());
} else if(holder instanceof Item3ViewHolder) {
}
}
@Override
public int getItemViewType(int position) {
if(position == 0) {
return TITLE;
} else if(position == 1 || position == getItemCount() - 2) {
return ITEM1;
} else if(position == getItemCount() - 1) {
return ITEM3;
} else {
return ITEM2;
}
}
@Override
public int getItemCount() {
return list.size() + 4;
}
public class HeaderViewHolder extends RecyclerView.ViewHolder {
private LinearLayout item0, item1, item2, item3;
public HeaderViewHolder(View itemView) {
super(itemView);
item0 = (LinearLayout) itemView.findViewById(R.id.ewh_item0);
item1 = (LinearLayout) itemView.findViewById(R.id.ewh_item1);
item2 = (LinearLayout) itemView.findViewById(R.id.ewh_item2);
item3 = (LinearLayout) itemView.findViewById(R.id.ewh_item3);
}
}
public class Item1ViewHolder extends RecyclerView.ViewHolder {
private TextView title;
public Item1ViewHolder(View itemView) {
super(itemView);
title = (TextView) itemView.findViewById(R.id.ewi_title);
}
}
public class Item2ViewHolder extends RecyclerView.ViewHolder {
private LinearLayout linearLayout;
private TextView customerName;
private ImageView img;
private TextView ewi_productOrderNum;
private TextView ewi_clientDate;
private TextView ewi_styleNum;
private TextView ewi_color;
private TextView ewi_number;
private TextView jindu;
public Item2ViewHolder(View itemView) {
super(itemView);
linearLayout = (LinearLayout) itemView.findViewById(R.id.ewi_LinearLayout);
customerName = (TextView) itemView.findViewById(R.id.ewi_tvClientName);
img = (ImageView) itemView.findViewById(R.id.ewi_pic);
jindu = (TextView) itemView.findViewById(R.id.jindu);
ewi_productOrderNum = (TextView) itemView.findViewById(R.id.ewi_productOrderNum);
ewi_clientDate = (TextView) itemView.findViewById(R.id.ewi_clientDate);
ewi_styleNum = (TextView) itemView.findViewById(R.id.ewi_styleNum);
ewi_color = (TextView) itemView.findViewById(R.id.ewi_color);
ewi_number = (TextView) itemView.findViewById(R.id.ewi_number);
}
}
public class Item3ViewHolder extends RecyclerView.ViewHolder {
private TextView tv1;
private TextView tv2;
private TextView tv3;
private TextView tv4;
private TextView tv5;
public Item3ViewHolder(View itemView) {
super(itemView);
tv1 = (TextView) itemView.findViewById(R.id.ewi_1);
tv2 = (TextView) itemView.findViewById(R.id.ewi_2);
tv3 = (TextView) itemView.findViewById(R.id.ewi_3);
tv4 = (TextView) itemView.findViewById(R.id.ewi_4);
tv5 = (TextView) itemView.findViewById(R.id.ewi_5);
}
}
}
| [
"519213534@qq.com"
] | 519213534@qq.com |
d541dc021c640ab948e0a61bef89522954505816 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/commonsguy--cw-omnibus/517cd987692133bae30ed58fb60a43998ccd4f2f/before/StringConcatActivity.java | ecba08bce6ec7c10e564537e02cf6f3a0ef913f2 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,245 | java | /***
Copyright (c) 2011 CommonsWare, LLC
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.
From _Tuning Android Applications_
https://commonsware.com/AndTuning
*/
package com.commonsware.android.traceview;
import android.view.View;
import android.widget.TextView;
public class StringConcatActivity extends BaseActivity {
StringConcatTask createTask(TextView msg, View v) {
return(new StringConcatTask(msg, v));
}
class StringConcatTask extends BaseTask {
StringConcatTask(TextView msg, View v) {
super(msg, v);
}
protected String doTest() {
String result="This is a string";
result+=" -- that varies --";
result+=" and also has ";
result+=String.valueOf(4);
result+=" hyphens in it";
return(result);
}
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
130ecda48d8afeda0e3fefe20cde0fd4203a1fa1 | 3f3d02cff5b43408b0cdac252b380aad0780e801 | /basemodule/src/main/java/com/moregood/base/BaseTabActivity.java | 9ba551b9be755849ec923bbe4e8b235ac1ad88dc | [] | no_license | xifengye/Modularization | 2fc0912465468315a895ec922be1064d9222a98a | 499aa22153880e7c5dd5fe3a4807d4fff289e672 | refs/heads/master | 2020-03-24T09:50:07.686848 | 2019-06-28T01:27:47 | 2019-06-28T01:27:47 | 142,638,970 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,651 | java | package com.moregood.base;
import android.support.v4.app.FragmentTabHost;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TabHost;
import android.widget.TextView;
import com.moregood.basemodule.R;
import com.moregood.bean.Tab;
import java.util.ArrayList;
import java.util.List;
/**
* Created by yexifeng on 2018/4/22.
*/
public abstract class BaseTabActivity extends BaseActivity {
private FragmentTabHost mTabHost;
private List<Tab> list = new ArrayList<>();
protected void initTab(Tab... tabs) {
for(Tab tab:tabs) {
list.add(tab);
}
mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);
mTabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);
for (Tab tab : list) {
TabHost.TabSpec tabSpec = mTabHost.newTabSpec(tab.getTag());
tabSpec.setIndicator(buildView(tab));
mTabHost.addTab(tabSpec, tab.getmFragment(), null);
}
mTabHost.getTabWidget().setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
if(list!=null && list.size()>0){
mTabHost.setCurrentTabByTag(list.get(0).getTag());
}
}
private View buildView(Tab tab) {
View view = LayoutInflater.from(this).inflate(R.layout.tab_indicator, null);
ImageView tabImg = (ImageView) view.findViewById(R.id.tab_img);
TextView text = (TextView) view.findViewById(R.id.tab_text);
tabImg.setImageResource(tab.getIcon());
text.setText(tab.getText());
return view;
}
}
| [
"yexifeng@xnsports.cn"
] | yexifeng@xnsports.cn |
228cbe8138d3fb5d34633101a9c1430575ec5d94 | 1836c081e466a6034f4b59866d22c0d18e204c3d | /SQLite/app/src/main/java/com/example/sqlite/DataHelper.java | dc63f01435c38b2f3061537069a0d5b5c55d4cd2 | [
"MIT"
] | permissive | shdx8/E31190672_Elyas_Agus_Suhadak_A | 042a3b6eb7c984d3b8f94b676fe9b04d1ebe8d22 | 71a93a029d885fbdeb43f1e1fe22d0b4e0dcea70 | refs/heads/main | 2023-06-15T23:55:21.853440 | 2021-07-11T16:48:38 | 2021-07-11T16:48:38 | 345,973,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,106 | java | package com.example.sqlite;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
public class DataHelper extends SQLiteOpenHelper {
private static final String DATABASE_NAME = "biodatadiri.db";
private static final int DATABASE_VERSION = 1;
public DataHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(SQLiteDatabase db) {
// TODO Auto-generated method stub
String sql = "create table biodata(no integer primary key, nama text null, tgl text null, jk text null, alamat text null);";
Log.d("Data", "onCreate: " + sql);
db.execSQL(sql);
sql = "INSERT INTO biodata (no, nama, tgl, jk, alamat) VALUES ('1', 'test', '2021-04-23', 'Laki-Laki','Probolinggo');";
db.execSQL(sql);
}
@Override
public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
// TODO Auto-generated method stub
}
} | [
"elyasagus.29@gmail.com"
] | elyasagus.29@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.