blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
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
689M
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
131 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
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
e840886b336a55ddb695e518334b675d03cd3644
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/serge-rider--dbeaver/49d1f794c97eefd4b42c097ce60692d7eac291ec/before/IDataSourceConnectionEditorSite.java
48aa3de526b45fc212e4726a04a76f435ddb1462
[]
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,596
java
/* * DBeaver - Universal Database Manager * Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License (version 2) * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jkiss.dbeaver.ui; import org.eclipse.jface.operation.IRunnableContext; import org.jkiss.code.NotNull; import org.jkiss.code.Nullable; import org.jkiss.dbeaver.model.DBPConnectionInfo; import org.jkiss.dbeaver.model.DBPDriver; import org.jkiss.dbeaver.model.runtime.DBRRunnableContext; import org.jkiss.dbeaver.model.struct.DBSDataSourceContainer; import org.jkiss.dbeaver.registry.DataSourceDescriptor; import org.jkiss.dbeaver.registry.DataSourceRegistry; /** * IDataSourceConnectionEditorSite */ public interface IDataSourceConnectionEditorSite { DBRRunnableContext getRunnableContext(); DataSourceRegistry getDataSourceRegistry(); boolean isNew(); DBPDriver getDriver(); @NotNull DataSourceDescriptor getActiveDataSource(); void updateButtons(); boolean openDriverEditor(); }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
6b9727cedcbe345c9381535fbe50ffdbda1a6900
245df73088d126177f823c3f7bcb33a6821e90d5
/app/src/main/java/com/skycaster/douban/util/ToastUtil.java
154361c6b8cbb8a5106b1c63a0008811f8bb348e
[ "Apache-2.0" ]
permissive
leoliao2008/douban
cfdcbfd9545a757127ad9b15792a1e7cb5a9e250
81fe2302cbd2147068177db5b1c9478187b1a869
refs/heads/master
2020-03-10T06:09:35.054518
2018-04-13T09:52:07
2018-04-13T09:52:07
129,233,222
0
0
null
null
null
null
UTF-8
Java
false
false
497
java
package com.skycaster.douban.util; import android.widget.Toast; import com.skycaster.douban.base.BaseApplication; /** * Created by 廖华凯 on 2018/4/10. */ public class ToastUtil { private static Toast toast; private ToastUtil(){}; public static void showToast(String msg){ if(toast==null){ toast=Toast.makeText(BaseApplication.getContext(),msg,Toast.LENGTH_SHORT); }else { toast.setText(msg); } toast.show(); } }
[ "leoliao2008@163.com" ]
leoliao2008@163.com
233cc4cf63821863c4aeb7324f5bbaa32af5c756
8ca0d3ada30e590b61d9967068ffa5853750d838
/src/test/java/com/example/bank/AppTest.java
9ec752fa6b099f04a99a36cd5e069e83dfa1e36a
[]
no_license
bindu-b/R-D
c162b2d69d4f3b3410124066fdf88ca9521f9111
2b021a8f2b6fa7e9978a0ea68ffa87222d9f29e3
refs/heads/master
2020-03-30T16:21:03.073879
2018-10-22T09:19:13
2018-10-22T09:19:13
151,404,782
0
0
null
null
null
null
UTF-8
Java
false
false
644
java
package com.example.bank; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
[ "bindu.umesh@capgemini.com" ]
bindu.umesh@capgemini.com
15fc2dfa35e184b029bd82980af142dc3827cbeb
15250e8067e074b816cf673759bc07e12dcfb175
/Item.java
070c84743bf2e4a82c7e648b908f2b2f52d75f85
[]
no_license
AlexMi-Ha/InfoGame2020
461757928a47d9f1ebd13674d6deb7e6e1acf3cb
2e48d0b5f1e7ba87bc59cfb76dd351d42b424bb2
refs/heads/master
2023-01-20T22:50:55.467344
2020-12-01T17:29:56
2020-12-01T17:29:56
311,033,645
2
0
null
null
null
null
UTF-8
Java
false
false
688
java
import greenfoot.*; /** * Superklasse für alle Items, die in den Räumen auf dem Boden liegen können * @author Alex * @version 17.5.2020 */ public abstract class Item extends Actor { /** * Konstruktor für die abstrakte Klasse Item. * Setzt ein gewolltes Bild. */ public Item() { setImage(loadTexture()); } /** * Gibt die gewollte Textur zurück. Wird automatisch beim erstellen des Items aufgerufen * @return GreenfootImage mit der Textur */ public abstract GreenfootImage loadTexture(); /** * Wird vom Spieler aufgerufen sobald er das Item berührt. */ public abstract void onPickUp(); }
[ "alex@hagl.de" ]
alex@hagl.de
9d39c0e414e4185f7cc064774b3f0a0f853d305a
bf664a1e3a74874a40d8538984717c99a0dd8110
/gulimall-order/src/main/java/com/atguigu/gulimall/order/controller/OrderOperateHistoryController.java
541b3dc8b9d997cff390cc00a902192fcb83ed52
[]
no_license
suxiuwei0809/gulimall
10ae232d7f433754b861ecd4c9fede4c7fc33186
5f9b0545e8688a148b3ab3c9df6eeadd3a6b2882
refs/heads/master
2023-09-02T13:47:57.861220
2021-10-30T07:19:58
2021-10-30T07:19:58
383,183,986
4
1
null
null
null
null
UTF-8
Java
false
false
2,493
java
package com.atguigu.gulimall.order.controller; import java.util.Arrays; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.atguigu.gulimall.order.entity.OrderOperateHistoryEntity; import com.atguigu.gulimall.order.service.OrderOperateHistoryService; import com.atguigu.common.utils.PageUtils; import com.atguigu.common.utils.R; /** * 订单操作历史记录 * * @author suxiuwei * @email suxiuwei0809@outlook.com * @date 2021-05-10 23:21:25 */ @RestController @RequestMapping("order/orderoperatehistory") public class OrderOperateHistoryController { @Autowired private OrderOperateHistoryService orderOperateHistoryService; /** * 列表 */ @RequestMapping("/list") //@RequiresPermissions("order:orderoperatehistory:list") public R list(@RequestParam Map<String, Object> params){ PageUtils page = orderOperateHistoryService.queryPage(params); return R.ok().put("page", page); } /** * 信息 */ @RequestMapping("/info/{id}") //@RequiresPermissions("order:orderoperatehistory:info") public R info(@PathVariable("id") Long id){ OrderOperateHistoryEntity orderOperateHistory = orderOperateHistoryService.getById(id); return R.ok().put("orderOperateHistory", orderOperateHistory); } /** * 保存 */ @RequestMapping("/save") //@RequiresPermissions("order:orderoperatehistory:save") public R save(@RequestBody OrderOperateHistoryEntity orderOperateHistory){ orderOperateHistoryService.save(orderOperateHistory); return R.ok(); } /** * 修改 */ @RequestMapping("/update") //@RequiresPermissions("order:orderoperatehistory:update") public R update(@RequestBody OrderOperateHistoryEntity orderOperateHistory){ orderOperateHistoryService.updateById(orderOperateHistory); return R.ok(); } /** * 删除 */ @RequestMapping("/delete") //@RequiresPermissions("order:orderoperatehistory:delete") public R delete(@RequestBody Long[] ids){ orderOperateHistoryService.removeByIds(Arrays.asList(ids)); return R.ok(); } }
[ "suxiuwei0809@outlook.com" ]
suxiuwei0809@outlook.com
69bc33414ff95245e6d8093616ec18e2e6eeb205
bc0f796ffaf7b83e4b2bc0096ebd260120ea2cb7
/src/main/java/com/els/back/controllers/TextController.java
778bd4dcc703e4264a5a0d2e813a61bc3352a961
[]
no_license
aminefradidhm/els-back-app
2005630727e8610baf4aab701edeea5e6c56d71f
99b4dd3045099530858a0f97e3a6328cb80b9bc8
refs/heads/master
2020-03-18T07:29:40.051654
2018-05-22T18:54:50
2018-05-22T18:54:50
134,455,985
0
0
null
null
null
null
UTF-8
Java
false
false
1,111
java
package com.els.back.controllers; import com.els.back.services.TextService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api") @CrossOrigin("*") public class TextController { @Autowired private TextService textService; private final Logger log = LoggerFactory.getLogger(TextController.class); /** * Returns the the number of punctuations inside a given text * @return */ @RequestMapping(value = "/numberPunctuations", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<String> getPunctuations(@RequestBody String message) { long numberOfPunctuations = textService.getPunctuationsNumber(message); return new ResponseEntity<>("{\"value\":" + String.valueOf(numberOfPunctuations) + "}", HttpStatus.OK); } }
[ "amine.fradi@dhm-it.com" ]
amine.fradi@dhm-it.com
e5fbee233b5298d6e8cef585e0e1829595e7f125
ba607c844ec3c354d36d61a6cb36c5e491171c17
/Moody/app/src/androidTest/java/com/cmput301w17t07/moody/FilterTest.java
679ced584b5b95f81f4417b9d9efb9bc00b21647
[]
no_license
CMPUT301W17T07/SURPRISE
1de305f804f5b2e9e4648ac0ed0b5fdd54b64b9a
46a13d5167f21a2d30ba1f6992811cbbaa8f1777
refs/heads/master
2021-01-22T04:14:54.552493
2017-04-03T21:51:17
2017-04-03T21:51:17
81,518,824
3
3
null
2017-04-03T07:33:56
2017-02-10T02:44:32
Java
UTF-8
Java
false
false
6,140
java
/* * Copyright 2017 CMPUT301W17T07 * * 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.cmput301w17t07.moody; import android.app.Activity; import android.test.ActivityInstrumentationTestCase2; import android.widget.EditText; import android.widget.ImageButton; import com.robotium.solo.Solo; import java.util.Date; /** * Created by xin on 2017/4/2. */ //To run this test make sure you opened the google Map and got your current location public class FilterTest extends ActivityInstrumentationTestCase2 { private Solo solo; public FilterTest() { super(com.cmput301w17t07.moody.CreateMoodActivity.class); } public void setUp() throws Exception { solo = new Solo(getInstrumentation(), getActivity()); } public void testStart() throws Exception { Activity activity = getActivity(); } public void testAddMoodFilter() { solo.assertCurrentActivity("Wrong Activity", CreateMoodActivity.class); solo.pressSpinnerItem(0, 0); assertTrue("mood spinner test anger", solo.isSpinnerTextSelected(0, "anger")); solo.pressSpinnerItem(0, 1); assertTrue("mood spinner test confusion", solo.isSpinnerTextSelected(0, "confusion")); solo.pressSpinnerItem(1, 1); assertTrue("mood spinner test anger", solo.isSpinnerTextSelected(1, "alone")); solo.pressSpinnerItem(1, 2); assertTrue("mood spinner test anger", solo.isSpinnerTextSelected(1, "with two people")); solo.enterText((EditText) solo.getView(R.id.Description), "filter"); solo.clickOnButton("Send"); solo.clickOnMenuItem("Search"); solo.clickOnButton(1); solo.pressSpinnerItem(1, 1); assertTrue("mood spinner test anger", solo.isSpinnerTextSelected(1, "confusion")); solo.clickOnButton(0); solo.clickInList(0); solo.waitForText("filter"); solo.waitForText("with two people"); solo.clickOnMenuItem("Search"); solo.clickOnButton(1); solo.pressSpinnerItem(2, 1); solo.clickOnButton(1); solo.clickInList(0); solo.waitForText("filter"); solo.waitForText("with two people"); solo.clickOnMenuItem("Search"); solo.clickOnButton(1); solo.enterText((EditText) solo.getView(R.id.filterMessageText), "filter"); solo.clickOnButton(2); solo.clickInList(0); solo.waitForText("filter"); solo.waitForText("with two people"); solo.clickOnMenuItem("Profile"); solo.clickInList(0); ImageButton imageButton = (ImageButton) solo.getView(R.id.deleteButton); solo.clickOnView(imageButton); } public void testTimeLine() { solo.assertCurrentActivity("Wrong Activity", CreateMoodActivity.class); solo.clickOnMenuItem("Home"); UserController userController = new UserController(); String username = userController.readUsername(getActivity()).toString(); if (UserController.checkUsername("testfilter")) { //checking to see if test user needs to be created or not UserController.createUser("testfilter"); // Creating the follow lists FollowController.createFollowLists("testfilter"); } //sending requests FollowController.sendPendingRequest(username, "testfilter", getActivity().getApplicationContext()); Mood newMood = new Mood("anger", "testfilter", "timeline", 0.0, 0.0, null, "alone", new Date(), ""); ElasticMoodController.AddMood addMood = new ElasticMoodController.AddMood(); addMood.execute(newMood); FollowController.acceptFollowRequest("testfilter", username, getActivity().getApplicationContext()); //go to pending requests page solo.clickOnMenuItem("Search"); solo.clickOnButton(1); solo.pressSpinnerItem(0, 1); solo.pressSpinnerItem(1, 0); solo.clickOnButton(1); solo.clickInList(0); //check to see the current activity is correct solo.waitForText("testfilter"); solo.waitForText("timeline"); // Check the user's follower list to determine appropriate action was taken FollowingList followingList = FollowController.getFollowingList(username); assertTrue(followingList.hasFollowing("testfilter")); followingList.deleteFollowing("testfilter"); //UPDATING THE SERVER ElasticSearchFollowController.DeleteFollowingList deleteFollowingList = new ElasticSearchFollowController.DeleteFollowingList(); ElasticSearchFollowController.AddFollowingList addFollowingList = new ElasticSearchFollowController.AddFollowingList(); // deleting old followerlist deleteFollowingList.execute(username); // adding updated one addFollowingList.execute(followingList); FollowerList followerList = FollowController.getFollowerList("testfilter"); followerList.deleteFollower(username); ElasticSearchFollowController.DeleteFollowerList deleteFollowerList = new ElasticSearchFollowController.DeleteFollowerList(); ElasticSearchFollowController.AddFollowerList addFollowerList = new ElasticSearchFollowController.AddFollowerList(); deleteFollowerList.execute("testfilter"); addFollowerList.execute(followerList); //delete the mood ElasticMoodController.DeleteMood deleteMood = new ElasticMoodController.DeleteMood(); deleteMood.execute(newMood.getId()); } }
[ "richardhuang1004@gmail.com" ]
richardhuang1004@gmail.com
cb4a136f2536328ee441fa9aa344226878636755
cad7cc37412ee3030c83dfc8445cac977b5e702f
/src/src/main/java/espe/edu/ec/adm_user/model/SegPerfil.java
315a9509a7320e358c6b316e6cb8c0d0272017c4
[]
no_license
SaintRec/seg_adm_ws
b2bd4055fc73bec468e7c0ef4e61364c36b4a6ee
f2ad001024a96f4911a3a636c72ab5e47a8aa383
refs/heads/master
2020-07-03T06:16:13.696921
2019-08-11T22:38:35
2019-08-11T22:38:35
201,816,276
0
0
null
null
null
null
UTF-8
Java
false
false
3,420
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package espe.edu.ec.adm_user.model; import java.io.Serializable; import java.util.List; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; /** * * @author Labs-DCCO */ @Entity @Table(name = "SEG_PERFIL") public class SegPerfil implements Serializable { private static final long serialVersionUID = 1L; // @SequenceGenerator(name = "SEQ_SEG_PERFIL", sequenceName = "SEQ_SEG_PERFIL", allocationSize = 1) @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_SEG_PERFIL") @Basic(optional = false) @NotNull @Column(name = "PER_ID") private Long perId; @Basic(optional = false) @NotNull @Size(min = 1, max = 60) @Column(name = "PER_NOMBRE") private String perNombre; //@OneToMany(cascade = CascadeType.ALL, mappedBy = "segPerfil") // @OneToMany(mappedBy = "segPerfil", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true) // private List<SegOpcPerfil> segOpcPerfilList; //@OneToMany(mappedBy = "SegPerfil") // @OneToMany(mappedBy = "segPerfil", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true) // private List<SegUsuPerfil> segUsuPerfilList; @JoinColumn(name = "SIS_ID", referencedColumnName = "SIS_ID") @ManyToOne(optional = false) private SegSistemas segSistemas; // public final static String PERFIL_VINCULACION_ADMINISTRADOR_VINCULACION = "ADMINISTRADOR DE VINCULACION"; // public final static String PERFIL_VINCULACION_COORDINADOR_VINCULACION = "COORDINADOR DE VINCULACION"; // public final static String PERFIL_VINCULACION_DIRECTOR_PROGRAMA = "DIRECTOR DE PROGRAMA"; // public final static String PERFIL_VINCULACION_DIRECTOR_PROYECTO = "DIRECTOR DE PROYECTO"; // public final static String PERFIL_VINCULACION_DIRECTOR_DEPARTAMENTO = "DIRECTOR DE DEPARTAMENTO"; // public final static String PERFIL_VINCULACION_EVALUADOR_UNIDAD_VINCULACION = "EVALUADOR UNIDAD VINCULACION"; // public final static String PERFIL_VINCULACION_EVALUADOR_VICERRECTORADO = "VICERRECTOR IITT"; // public final static String PERFIL_VINCULACION_EVALUADOR_FINAL_PROYECTO = "EVALUADOR FINAL DE PROYECTO"; // public final static String PERFIL_VINCULACION_EVALUADOR_FINAL_PROGRAMA = "EVALUADOR FINAL DE PROGRAMA"; public SegPerfil() { } public Long getPerId() { return perId; } public void setPerId(Long perId) { this.perId = perId; } public String getPerNombre() { return perNombre; } public void setPerNombre(String perNombre) { this.perNombre = perNombre; } public SegSistemas getSegSistemas() { return segSistemas; } public void setSegSistemas(SegSistemas segSistemas) { this.segSistemas = segSistemas; } }
[ "saintrecd@gmail.com" ]
saintrecd@gmail.com
823228b2ceba72b37ba12ee33d25a0c365e61047
025e98285be2fbefa919bde70f3614fdb0f2f6dc
/src/main/java/com/smalaca/ebook/domain/BookStorage.java
dc6e6d76feb0ea1b9dd955dd314b5db9f4334e0c
[]
no_license
smalaca/ebook-library
206c01d495f077a6e2bab8fc73bc593e05308c53
04cc8d673c64fdb5c17e1955977957ce2736932d
refs/heads/master
2021-05-05T06:47:29.260180
2018-02-11T14:58:30
2018-02-11T14:58:30
118,826,288
0
2
null
null
null
null
UTF-8
Java
false
false
194
java
package com.smalaca.ebook.domain; public interface BookStorage { void add(String title, String author); boolean exists(String title, String author); Book searchBy(String isbn); }
[ "ab13.krakow@gmail.com" ]
ab13.krakow@gmail.com
003c7a4ce07294cdedea1eb9c86d6a9ed9e4f036
4cdc04aad16506fdbf1d997609f9f60647974782
/org/telegram/messenger/volley/toolbox/ByteArrayPool.java
61b5647d64f744c28ad5e21c85eefc073a54af86
[]
no_license
lcastro12/TelegramAnalysis1
db9ccb2889758500c5cb9b58db2c55b692e68b74
f8c7579db27eeb70d1a2105d1dca59239389b60f
refs/heads/master
2020-03-15T19:14:56.203309
2018-05-07T00:09:46
2018-05-07T00:09:46
132,303,828
0
0
null
null
null
null
UTF-8
Java
false
false
2,031
java
package org.telegram.messenger.volley.toolbox; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.LinkedList; import java.util.List; public class ByteArrayPool { protected static final Comparator<byte[]> BUF_COMPARATOR = new C06741(); private List<byte[]> mBuffersByLastUse = new LinkedList(); private List<byte[]> mBuffersBySize = new ArrayList(64); private int mCurrentSize = 0; private final int mSizeLimit; static class C06741 implements Comparator<byte[]> { C06741() { } public int compare(byte[] lhs, byte[] rhs) { return lhs.length - rhs.length; } } public ByteArrayPool(int sizeLimit) { this.mSizeLimit = sizeLimit; } public synchronized byte[] getBuf(int len) { byte[] buf; for (int i = 0; i < this.mBuffersBySize.size(); i++) { buf = (byte[]) this.mBuffersBySize.get(i); if (buf.length >= len) { this.mCurrentSize -= buf.length; this.mBuffersBySize.remove(i); this.mBuffersByLastUse.remove(buf); break; } } buf = new byte[len]; return buf; } public synchronized void returnBuf(byte[] buf) { if (buf != null) { if (buf.length <= this.mSizeLimit) { this.mBuffersByLastUse.add(buf); int pos = Collections.binarySearch(this.mBuffersBySize, buf, BUF_COMPARATOR); if (pos < 0) { pos = (-pos) - 1; } this.mBuffersBySize.add(pos, buf); this.mCurrentSize += buf.length; trim(); } } } private synchronized void trim() { while (this.mCurrentSize > this.mSizeLimit) { byte[] buf = (byte[]) this.mBuffersByLastUse.remove(0); this.mBuffersBySize.remove(buf); this.mCurrentSize -= buf.length; } } }
[ "l.castro12@uniandes.edu.co" ]
l.castro12@uniandes.edu.co
08e84fafe72209afdafa1bf56e82face9fe1bbf9
50dcbaaea1f74f6bfee41472fd7ffc202336865f
/zuce/src/main/java/com/example/day19/view/IView.java
4ebd4011d2c662daaff9dc4eedc80c645bc82be5
[]
no_license
zhuenchen/weektest
561ca1b1d41256372335de0ef80872928141e63c
4fc8bdea5188d1237a1f27be7259c7041980cad5
refs/heads/master
2020-05-22T15:19:52.337939
2019-05-13T11:24:22
2019-05-13T11:24:22
186,405,835
0
0
null
null
null
null
UTF-8
Java
false
false
198
java
package com.example.day19.view; /** * @Author:竹恩晨 * @E-mail: * @Date:2019/5/10 14:19 * @Description:描述信息 */ public interface IView { void getResponse(String data); }
[ "48478875+zhuenchen@users.noreply.github.com" ]
48478875+zhuenchen@users.noreply.github.com
3fa9fdc6a57188c8e194c49aa6c2bc8a20ef5116
17e40f7d9aa87bbc7af822fb4d6c8f79feaad363
/src/src/com/netdist/driver/NetDiskFile.java
29c7045366bb4f1d15b9c6d82a15c996ce2d3936
[]
no_license
kangness/Graduation_Project
514cdc34b52dcde483fecc2530fe32730f1b954a
c2af50616422784799e51d348f43ceb8b50651cb
refs/heads/master
2021-01-21T07:35:11.818470
2013-05-14T16:36:54
2013-05-14T16:36:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,691
java
package com.netdist.driver; public class NetDiskFile { private String User; private String CreateDate; private String Name; private int Size; private String Permission; private String Group; private boolean Dirctory; public NetDiskFile(String Name,String User,String CreateDate,int Size,String Permission,boolean Dirctory){ this.Name = Name; this.User = User; this.CreateDate = CreateDate; this.Size = Size; this.Permission = Permission; this.Dirctory = Dirctory; } public NetDiskFile(String Name,String User,String CreateDate,String Size,String Permission,boolean Dirctory){ this.Name = Name; this.User = User; this.CreateDate = CreateDate; setSize(Size); this.Permission = Permission; this.Dirctory = Dirctory; } public NetDiskFile(){ } public String getName() { return Name; } public void setName(String name) { Name = name; } public String getUser() { return User; } public void setUser(String user) { User = user; } public String getCreateDate() { return CreateDate; } public void setCreateDate(String createDate) { CreateDate = createDate; } public void setGroup(String Group){ this.Group = Group; } public String getGroup(){ return this.Group; } public int getSize() { return Size; } public void setSize(int size) { Size = size; } public void setSize(String size) { try{ this.Size = Integer.valueOf(size); } catch (Exception ex) { System.out.println(ex.toString() + size); } } public String getPermission() { return Permission; } public void setPermission(String permission) { Permission = permission; } public boolean getDirctory(){ return this.Dirctory; } }
[ "510391707@qq.com" ]
510391707@qq.com
f8a892dca641b50591efd01921aedd45ce371c12
4b28f56056688db3f9a1854ea173f65429096f91
/Project/src/io/wabm/supermarket/controller/warehouse/PurchaseCommodityController.java
3a557b21052fbfeced41e78c7b6c9697551d6971
[]
no_license
WABM/Espresso
69f6642047e0e3f57d1b667abee96165a5f84f93
c9b95742055ed7ada5be12ad1edb6fe8a4d33b82
refs/heads/master
2021-01-11T03:28:51.657244
2017-01-02T13:45:49
2017-01-02T13:45:49
71,028,877
0
0
null
2016-10-24T07:34:08
2016-10-16T03:55:13
null
UTF-8
Java
false
false
3,760
java
package io.wabm.supermarket.controller.warehouse; import io.wabm.supermarket.misc.javafx.alert.SimpleErrorAlert; import io.wabm.supermarket.misc.javafx.alert.SimpleSuccessAlert; import io.wabm.supermarket.misc.pojo.Commodity; import io.wabm.supermarket.misc.util.ConsoleLog; import io.wabm.supermarket.misc.util.ValidCheckHelper; import io.wabm.supermarket.model.warehouse.PurchaseCommodityModel; import io.wabm.supermarket.protocol.StageSetableController; import javafx.application.Platform; import javafx.fxml.FXML; import javafx.scene.control.Alert; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.stage.Stage; /** * Created by MainasuK on 2016-11-28. */ public class PurchaseCommodityController implements StageSetableController { private PurchaseCommodityModel<Commodity> model; private Commodity commodity; private int orderDetailID = -1; @FXML Stage stage; @FXML Label idLabel; @FXML Label barCodeLabel; @FXML Label nameLabel; @FXML Label deliverySpecificationLabel; @FXML TextField rejectQuantityTextField; @FXML Button confirmButton; @FXML Button cancelButton; @FXML private void confirmButtonPressed() { ConsoleLog.print("Button pressed"); if (!isInputValid()) { return ; } int purchaseQuantity = Integer.parseInt(rejectQuantityTextField.getText()) * commodity.getDeliverySpecification(); model.purchase(commodity, purchaseQuantity, exception -> { if (null != exception) { new SimpleErrorAlert("数据库更新出现错误", "请检查输入字段并重试","").show(); } else { Platform.runLater(() -> { new SimpleSuccessAlert("采购成功", "已生成采购需求", "采购 " + purchaseQuantity + commodity.getUnit()).show(); stage.close(); }); } // end if return null; }); } @FXML private void cancelButtonPressed() { ConsoleLog.print("Button pressed"); stage.close(); } /** * Use JavaFX initialize. This method will be called after control init. */ @FXML public void initialize() { ConsoleLog.print("ModifyCommodityController init"); model = new PurchaseCommodityModel<>(); } private void resetControl(Commodity commodity) { idLabel.setText(commodity.getCommodityID()); barCodeLabel.setText(commodity.getBarcode()); nameLabel.setText(commodity.getName()); deliverySpecificationLabel.setText(commodity.getDeliverySpecification()+" "+commodity.getUnit()); } // MARK: Public config method public void setStage(Stage stage) { this.stage = stage; } public void set(Commodity commodity) { ConsoleLog.print("Set commodity: " + commodity.getName()); this.commodity = commodity; resetControl(commodity); } /** * Validates the user input in the text fields * * @return */ private boolean isInputValid() { ValidCheckHelper helper = new ValidCheckHelper(); String errorMessage = ""; errorMessage += helper.checkTypeAndLengthForIntegerNotZero(rejectQuantityTextField, "报废数量", 11); ConsoleLog.print(errorMessage); if (errorMessage.length() == 0) { return true; } else { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("无效数据"); alert.setHeaderText("请检查无效数据"); alert.setContentText(errorMessage); alert.show(); return false; } } }
[ "cirno.mainasuk@gmail.com" ]
cirno.mainasuk@gmail.com
7055bb50b8322a309e19d7ca08d474d5cd06dcc1
282e246e61c4840b9fa14fc5b716745dedaaba67
/src/main/java/hello/domain/Users.java
280ad7e6d4bb1418c59b3c033efe489db933a478
[]
no_license
auctor94/SpringBootCoursework
80e8f14fd00a1595401a6db1f805fddff05e650b
d667bb53c31e2c77fc16bb6a09976c87fd8026b5
refs/heads/master
2020-05-18T15:06:07.385756
2019-05-09T00:05:15
2019-05-09T00:05:15
184,488,268
0
0
null
null
null
null
UTF-8
Java
false
false
1,276
java
package hello.domain; import javax.persistence.*; import java.util.Collection; import java.util.List; import java.util.Set; @Entity @Table(name = "users") public class Users { @Id @GeneratedValue(strategy= GenerationType.AUTO) private Integer id_user; @Column(name="name") private String name; @Column(name="password") private String password; @Column(name="status") private String status; @OneToMany(mappedBy = "idUser") private Set<Review> reviewDetails; public Integer getIdUser() { return id_user; } public void setIdUser(Integer idUser) { this.id_user = idUser; } public Set<Review> getReviewDetails() { return reviewDetails; } public void setReviewDetails(Set<Review> reviewDetails) { this.reviewDetails = reviewDetails; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } }
[ "timashenka99@gmail.com" ]
timashenka99@gmail.com
53a555460374f61116e91be9426542d56a9bdb6b
5c4ec6ae7ed989ce6144925b04b6eac1a4da2cb1
/webSocket/src/main/java/com/noah/demo/controller/WebSocketServer.java
2319cbbd685664ea534f14422f9b6b26d7e55d46
[]
no_license
lidll/demo
e5b69044d4e87f5a5cbe8b73a747aa424dc1cc1c
17a15c0a85b597f6ce951caaf5274538142f6a1f
refs/heads/master
2022-08-13T03:01:45.391613
2022-07-21T08:48:02
2022-07-21T08:48:02
190,355,092
0
0
null
null
null
null
UTF-8
Java
false
false
5,742
java
package com.noah.demo.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.noah.demo.config.WS; import com.noah.demo.dto.TalkDTO; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import javax.websocket.*; import javax.websocket.server.PathParam; import javax.websocket.server.ServerEndpoint; import java.util.Map; import java.util.Set; /** * @ClassName WsController * @Description TODO * @Author noah * @Date 2019-10-18 09:52 * @Version 1.0 **/ @ServerEndpoint("/websocket/{userId}") @Component public class WebSocketServer { private static Logger log = LoggerFactory.getLogger(WebSocketServer.class); //静态变量,用来记录当前在线连接数。应该把它设计成线程安全的。 private static int onlineCount = 0; //旧:concurrent包的线程安全Set,用来存放每个客户端对应的MyWebSocket对象。 // private static CopyOnWriteArraySet<WebSocketServer> webSokcetSet = new CopyOnWriteArraySet<WebSocketServer>(); //与某个客户端的连接会话,需要通过它来给客户端发送数据 private Session session; //接收sid private String userId = ""; /** * * @Author yz * @Description 连接建立成功调用的方法 * @Date 2019-10-18 09:55 * @param session * @param userId * @return void */ @OnOpen public void onOpen(Session session, @PathParam("userId")String userId){ try { this.session = session; WS.socketMap.put(userId,this); addOnlineCount(); log.info("有新窗口开始监听:" + userId + ",当前在线人数为" + getOnlineCount()); this.userId = userId; sendMessage(JSON.toJSONString(TalkDTO.success())); } catch (Exception e) { log.info("webSocket IO异常"); } } /** * * @Author yz * @Description 连接关闭调用的方法 * @Date 2019-10-18 09:56 * @param * @return void */ @OnClose public void onClose(){ if (WS.socketMap.get(this.userId) != null) { WS.socketMap.remove(userId); } //在线人数减1 subOnlineCount(); log.info("有一连接关闭!当前在线人物为" + getOnlineCount()); } /** * * @Author yz * @Description 收到客户端消息后调用的方法 * @Date 2019-10-18 09:57 * @param message * @param session * @return void */ @OnMessage public void onMessage(String message,Session session){ log.info("转发端收到来自用户" +userId+ "的消息:" +message); if(StringUtils.isNotBlank(message)){ JSONArray list= JSONArray.parseArray(message); for (int i = 0; i < list.size(); i++) { try { //解析发送的报文 TalkDTO talkDTO = list.getJSONObject(i).toJavaObject(TalkDTO.class); talkDTO.setFromUserId(this.userId); //传送给对应用户的websocket if(StringUtils.isNotBlank(talkDTO.getToUserId())&&StringUtils.isNotBlank(talkDTO.getContentText())){ WebSocketServer socketx= WS.socketMap.get(talkDTO.getToUserId()); //需要进行转换,userId if(socketx!=null){ talkDTO.setCode(302); socketx.sendMessage(JSON.toJSONString(talkDTO)); //此处可以放置相关业务代码,例如存储到数据库 }else{ WebSocketServer webSocketServer = WS.socketMap.get(userId); webSocketServer.sendMessage(JSON.toJSONString(TalkDTO.error("对方未登录"))); } } }catch (Exception e){ e.printStackTrace(); } } } } /** * * @Author yz * @Description 发生错误时调用的方法 * @Date 2019-10-18 09:58 * @param session * @param error * @return void */ @OnError public void onError(Session session,Throwable error){ log.error("发生错误"); error.printStackTrace(); } /** * * @Author yz * @Description 服务器端主动推送 * @Date 2019-10-18 10:18 * @param message * @return void */ public void sendMessage(String message) throws Exception{ this.session.getBasicRemote().sendText(message); } /** * * @Author yz * @Description 群发消息 * @Date 2019-10-18 10:33 * @param message * @param userId * @return void */ public static void sendInfo(String message,@PathParam("userId") String userId) { try { log.info("推送消息到窗口"+userId +",推送内容"+message); Set<Map.Entry<String, WebSocketServer>> entries = WS.socketMap.entrySet(); for (Map.Entry<String, WebSocketServer> entry : entries) { if (entry.getKey().equals(userId)) { entry.getValue().sendMessage(message); } } } catch (Exception e) { e.printStackTrace(); } } public static synchronized int getOnlineCount() { return onlineCount; } public static synchronized void addOnlineCount() { WebSocketServer.onlineCount++; } public static synchronized void subOnlineCount() { WebSocketServer.onlineCount--; } }
[ "lifeidll@163.com" ]
lifeidll@163.com
e2ab83329e061f12d58a327390d0b5d7ba51a9cf
6424bde515bc27e8ce277c5cd912cc0cf3446ece
/ZadaniaSkryptJava/src/zadaniaskryptjava/StatementQueueHashMap.java
85af6b1aa24aee7462a06b22d5d2c9822e278c9a
[]
no_license
mateuszSuchorab/PWJJ
22b80136f540a128162cc1034e2f9cea51ae05bd
f06e8ca294030106d1b9dcdfe4f5b7bb0518b020
refs/heads/master
2021-09-03T14:11:02.315579
2018-01-09T17:40:45
2018-01-09T17:40:45
109,592,701
0
0
null
null
null
null
UTF-8
Java
false
false
664
java
package zadaniaskryptjava; import java.util.*; public class StatementQueueHashMap { HashMap<String, Integer> hashMap = new HashMap(); ArrayList<String> list = new ArrayList<String>(); public synchronized void send(String key, int value) { hashMap.put(key, value); list.add(key); } public synchronized HashMap<String, Integer> collect() { if (hashMap.size() == 0) { return null; } HashMap<String, Integer> exit = new HashMap();//(hashMap); exit.put(list.get(0), hashMap.get(list.get(0))); hashMap.remove(list.get(0)); list.remove(0); return exit; } }
[ "suchy1122@poczta.fm" ]
suchy1122@poczta.fm
f81b3e52194e99046782459a13b789d87bf14947
5fa40394963baf973cfd5a3770c1850be51efaae
/src/NHSensor/NHSensorSim/test/ReserveAdaptiveGridTraverseRectEventTest.java
2d516ed061aee85d8a13001e56eb4d1fc821c6d0
[]
no_license
yejuns/wsn_java
5c4d97cb6bc41b91ed16eafca5d14128ed45ed44
f071cc72411ecc2866bff3dfc356f38b0c817411
refs/heads/master
2020-05-14T13:54:14.690176
2018-01-28T02:51:44
2018-01-28T02:51:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,164
java
package NHSensor.NHSensorSim.test; import org.apache.log4j.PropertyConfigurator; import NHSensor.NHSensorSim.algorithm.GPSRAttachmentAlg; import NHSensor.NHSensorSim.core.Message; import NHSensor.NHSensorSim.core.NeighborAttachment; import NHSensor.NHSensorSim.core.SensorSim; import NHSensor.NHSensorSim.events.DrawShapeEvent; import NHSensor.NHSensorSim.events.ReserveAdaptiveGridTraverseRectEvent; import NHSensor.NHSensorSim.shape.Rect; import NHSensor.NHSensorSim.shapeTraverse.Direction; import NHSensor.NHSensorSim.ui.Animator; public class ReserveAdaptiveGridTraverseRectEventTest { /** * @param args */ public static void main(String[] args) { PropertyConfigurator.configure("config/log4j.properties"); SensorSim sensorSim = SensorSim.createSensorSim(3, 450, 450, 600); sensorSim.getSimulator().addHandleAndTraceEventListener(); sensorSim.addAlgorithm(GPSRAttachmentAlg.NAME); GPSRAttachmentAlg alg = (GPSRAttachmentAlg) sensorSim .getAlgorithm(GPSRAttachmentAlg.NAME); alg.setQuery(null); sensorSim.run(); alg.getParam().setANSWER_SIZE(30); NeighborAttachment root = (NeighborAttachment) alg.getNetwork() .get2LRTNode().getAttachment(alg.getName()); double width = 40; double height = 300; double minx = alg.getNetwork().getRect().getCentre().getX() - width / 2; double maxx = alg.getNetwork().getRect().getCentre().getX() + width / 2; double miny = alg.getNetwork().getRect().getCentre().getY() - height / 2; double maxy = alg.getNetwork().getRect().getCentre().getY() + height / 2; Rect rect = new Rect(minx, maxx, miny, maxy); DrawShapeEvent drawShapeEvent = new DrawShapeEvent(alg, rect); alg.run(drawShapeEvent); Message queryAndPatialAnswerMesage = new Message(alg.getParam() .getANSWER_SIZE() + alg.getParam().getQUERY_MESSAGE_SIZE(), null); ReserveAdaptiveGridTraverseRectEvent e = new ReserveAdaptiveGridTraverseRectEvent( root, rect, Direction.DOWN, queryAndPatialAnswerMesage, true, alg); alg.run(e); sensorSim.printStatistic(); Animator animator = new Animator(alg); animator.start(); } }
[ "lixinlu2000@163.com" ]
lixinlu2000@163.com
48f932bec5e829f161516c3e4a2b1b41cbc051ab
0aa7b936f1184b66dc99a6786f0c1ff055006531
/app/src/main/java/com/example/mymemo/MemoAdapter.java
52f7ee1af25e378556a5bcbd3b1479b3d0e36f57
[]
no_license
MaximMerenkov/MyMemo
732dea5bddd286935c7eb03f150fceabbebe23f1
3a39270a97b59857760cd8539ce88019ecc726b3
refs/heads/master
2020-08-26T20:36:51.768103
2019-10-27T20:17:08
2019-10-27T20:17:08
217,140,000
0
0
null
null
null
null
UTF-8
Java
false
false
4,014
java
package com.example.mymemo; import android.content.Context; import android.graphics.Color; import android.text.format.DateFormat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import androidx.core.content.ContextCompat; import java.util.ArrayList; public class MemoAdapter extends ArrayAdapter<Memo> { private ArrayList<Memo> items; private Context adapterContext; public MemoAdapter(Context context, ArrayList<Memo> items){ super(context,R.layout.list_item,items); adapterContext = context; this.items= items; } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; int red = ContextCompat.getColor(getContext(), R.color.system_red); int blue = ContextCompat.getColor(getContext(), R.color.system_blue); try { Memo memo = items.get(position); if (v == null) { LayoutInflater vi = (LayoutInflater) adapterContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.list_item, null); } TextView memoTitle = (TextView) v.findViewById(R.id.textMemoTitle); TextView memoPriority = (TextView) v.findViewById(R.id.textMemoPriority); TextView memoDate = (TextView) v.findViewById(R.id.textListDate); Button b = (Button) v.findViewById(R.id.buttonDeleteMemo); memoTitle.setText(memo.getMemoTitle()); memoPriority.setText(memo.getPriority()); memoDate.setText(DateFormat.format("MM/dd/yyyy", memo.getMemoDate().getTimeInMillis()).toString()); b.setVisibility(View.INVISIBLE); if(memo.getPriority().equalsIgnoreCase("Low")) { memoPriority.setTextColor(Color.BLACK); memoPriority.setText(memo.getPriority()); } if(memo.getPriority().equalsIgnoreCase("Medium")) { memoPriority.setTextColor(Color.BLUE); memoPriority.setText(memo.getPriority()); } if(memo.getPriority().equalsIgnoreCase("High")) { memoPriority.setTextColor(Color.RED); memoPriority.setText(memo.getPriority()); } } catch (Exception e) { e.printStackTrace(); e.getCause(); } return v; } public void showDelete(final int position, final View convertView, final Context context, final Memo memo){ View v = convertView; final Button b = (Button)v.findViewById(R.id.buttonDeleteMemo); if(b.getVisibility()==View.INVISIBLE){ b.setVisibility(View.VISIBLE); b.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v){ hideDelete(position, convertView, context); items.remove(memo); deleteOption(memo.getMemoId(), context); } }); } else{ hideDelete(position, convertView, context); } } private void deleteOption(int memoToDelete, Context context){ MemoDataSource db = new MemoDataSource(context); try{ db.open(); db.deleteMemo(memoToDelete); db.close(); } catch(Exception e){ Toast.makeText(adapterContext, "Delete memo Failed", Toast.LENGTH_LONG).show(); } this.notifyDataSetChanged(); } public void hideDelete(int position, View convertView, Context context){ View v = convertView; final Button b = (Button)v.findViewById(R.id.buttonDeleteMemo); b.setVisibility(View.INVISIBLE); b.setOnClickListener(null); } }
[ "maxmerenkov78@gmail.com" ]
maxmerenkov78@gmail.com
6eb949888c651cd2f04f0d41a28df7a468c27760
5dd10092976c50ed474d0600261e73f6886c5cbf
/src/JavaRevision_Package1/Java_17_06_Split.java
e74f298043b5f375874a7db26334d706f9a27e4b
[]
no_license
vprasanth6855/JavaNew
a3cb805d00aed9c6b487c1ad0d3e630419036edc
8abf96564009fdfdbde88c6a57ac9df084e977d7
refs/heads/master
2023-06-02T06:14:47.847450
2021-06-18T23:02:33
2021-06-18T23:02:33
378,280,396
0
0
null
null
null
null
UTF-8
Java
false
false
1,410
java
package JavaRevision_Package1; public class Java_17_06_Split { public static void main(String[] args) { String data = "Tom;25;male;1000;USA"; String dataVal[] = data.split(";"); System.out.println(dataVal[0]); // printing for (int i = 0; i < dataVal.length; i++) { System.out.println(dataVal[i]); } String test = "xXJavaXxXPythonxXRubyxXSelenium"; String val[] = test.split("xX"); for (int i = 0; i < val.length; i++) { System.out.println(val[i]); } String name = "Tom Peter Steve"; System.out.println(name.split(" ")[0]); System.out.println(name.split(" ")[1]); System.out.println(name.split(" ")[2]); for(int i=0; i<name.split(" ").length;i++){ System.out.println(name.split(" ")[i]); } //IMPORTANT String credentials = "admin;testpassword"; String username = credentials.split(";")[0]; String password = credentials.split(";")[1]; doLogin(username,password); System.out.println(credentials.indexOf("hello")); // will return -1 String mesg = "Welcome admin"; if(mesg.indexOf("admin")>0){ System.out.println("pass"); } else{ System.out.println("fail"); } String mesg1 = "Welcome null"; if(mesg1.indexOf("admin")>0){ System.out.println("pass"); } else{ System.out.println("fail"); } } public static void doLogin(String un, String pwd){ System.out.println("login to app with "+un+" and "+pwd); } }
[ "veenasmohan04@gmail.com" ]
veenasmohan04@gmail.com
35a55ed6f89b4d94337bbbe751af34807d586c18
6ba8d772cecc87760928345a0317870e0b45a263
/src/main/java/ru/revolut/testtask/controllers/BasicOperationsController.java
c4d844ae1749f2843c9db9fe0291a565fefabff8
[]
no_license
melges-morgen/ttrvlt
029bf540a2ac6a2af5f4218dc43e7c654b3aa8e5
7042e8622d55467c8f31f4f6163c80a774e30628
refs/heads/master
2021-06-21T00:29:42.677935
2017-08-15T08:35:05
2017-08-15T08:35:05
99,421,285
0
0
null
null
null
null
UTF-8
Java
false
false
2,861
java
package ru.revolut.testtask.controllers; import com.querydsl.jpa.impl.JPAQueryFactory; import ru.revolut.testtask.controllers.exceptions.EntityNotExistException; import ru.revolut.testtask.dbmodel.Account; import ru.revolut.testtask.dbmodel.QAccount; import ru.revolut.testtask.dbmodel.QTransaction; import ru.revolut.testtask.dbmodel.Transaction; import javax.persistence.EntityManager; import java.math.BigDecimal; import java.util.List; /** * TODO: Write class description * * @author morgmat */ public class BasicOperationsController { private final DatabaseController databaseController; public BasicOperationsController(DatabaseController databaseController) { this.databaseController = databaseController; } public Account getAccountById(Long id) { return databaseController.createEntityManager().find(Account.class, id); } public List<Transaction> getTransactionsOfAccount(Long accountId) { if(!isAccountExist(accountId)) { throw new EntityNotExistException(accountId); } JPAQueryFactory queryFactory = new JPAQueryFactory(databaseController.createEntityManager()); QTransaction transaction = QTransaction.transaction; QAccount account = QAccount.account; return queryFactory.selectFrom(transaction).from(transaction, account) .where(account.id.eq(accountId) .and(transaction.destination.eq(account).or(transaction.source.eq(account))) ).fetch(); } public Transaction getTransactionById(Long id) { return databaseController.createEntityManager().find(Transaction.class, id); } public Account createNewAccount(BigDecimal placement) { if(placement.compareTo(BigDecimal.ZERO) < 0) { throw new IllegalArgumentException("Initial placement can't be below zero"); } EntityManager entityManager = databaseController.createEntityManager(); entityManager.getTransaction().begin(); Account account = new Account(); account.setDebit(placement); if(placement.compareTo(BigDecimal.ZERO) > 0) { Transaction placementTransaction = new Transaction(null, account, placement, "Initial money placement"); entityManager.persist(account); entityManager.persist(placementTransaction); } else { entityManager.persist(account); } entityManager.getTransaction().commit(); entityManager.close(); return account; } public boolean isAccountExist(Long accountId) { EntityManager entityManager = databaseController.createEntityManager(); return entityManager.find(Account.class, accountId) != null; } }
[ "melges.morgen@gmail.com" ]
melges.morgen@gmail.com
83d09c226710bef5f346d23322626d19db0fe106
4ed13753f5bc20ec143dc25039280f80c3edddd8
/gosu-core-api/src/main/java/gw/lang/ir/builder/expression/IRCompositeExpressionBuilder.java
fed62ad83fb5308a269cf3b156df670e170dbb50
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause" ]
permissive
hmsck/gosu-lang
180a96aab69ff0184700e70876bb0cf10c8a938f
78c5f6c839597a81ac5ec75a46259cbb6ad40545
refs/heads/master
2021-02-13T06:53:30.208378
2019-10-31T23:15:13
2019-10-31T23:15:13
244,672,021
0
0
Apache-2.0
2020-03-03T15:27:47
2020-03-03T15:27:46
null
UTF-8
Java
false
false
1,141
java
/* * Copyright 2014 Guidewire Software, Inc. */ package gw.lang.ir.builder.expression; import gw.lang.ir.builder.IRExpressionBuilder; import gw.lang.ir.builder.IRBuilderContext; import gw.lang.ir.builder.IRStatementBuilder; import gw.lang.ir.IRExpression; import gw.lang.ir.IRElement; import gw.lang.ir.expression.IRCompositeExpression; import gw.lang.UnstableAPI; import java.util.List; import java.util.ArrayList; @UnstableAPI public class IRCompositeExpressionBuilder extends IRExpressionBuilder { private List<IRStatementBuilder> _statements; private IRExpressionBuilder _finalExpression; public IRCompositeExpressionBuilder(List<IRStatementBuilder> statements, IRExpressionBuilder finalExpression) { _statements = statements; _finalExpression = finalExpression; } @Override protected IRExpression buildImpl(IRBuilderContext context) { List<IRElement> elements = new ArrayList<IRElement>(); for (IRStatementBuilder statement : _statements) { elements.add(statement.build(context)); } elements.add(_finalExpression.build(context)); return new IRCompositeExpression(elements); } }
[ "lboasso@guidewire.com" ]
lboasso@guidewire.com
3bda85d92cbca3e596130eea1794409d4e2d5e16
49f392f3ec3f3b85615ecd5cab9e39ab140b6b0a
/src/cn/mldn/hr/service/front/IDetailsServiceFront.java
76f2d56da8faedfcfda41b7523e4a3997ddc39fb
[]
no_license
Wolf123007/hr
969734443d38f1a9f7e8cff8bef15f27d8b83948
2031d4ca4a0761d320dcc8089974fd289c2cd7fb
refs/heads/master
2021-01-13T16:47:39.151152
2017-06-20T14:29:05
2017-06-20T14:29:05
94,899,106
0
0
null
null
null
null
UTF-8
Java
false
false
328
java
package cn.mldn.hr.service.front; import java.util.Map; import cn.mldn.hr.vo.Details; public interface IDetailsServiceFront { public Map<String, Object> list(int cid, int currentPage, int lineSize, String column, String keyWord) throws Exception; public boolean updateScore(Details vo) throws Exception; }
[ "'wolf_hk@sina.com'" ]
'wolf_hk@sina.com'
fcaa0939b73c2d6f7d6a0a3593de6c2692d3a769
91ef81e1713c36fda6bb2e67c78b91c25deaebdc
/src/main/java/com/finsage/util/config/JsonInitializer.java
15b53389419c7b0d9066f7fdf0ea0e816109f918
[]
no_license
imomi329/SpringBoot-OrderingSystem
d84e6ac682f569e057d1d86a264d01ab60e3dad9
0a2d0df425db21f362b03cc4d3228db4bf13cd11
refs/heads/master
2021-09-10T15:02:27.336008
2018-03-28T06:39:59
2018-03-28T06:39:59
104,161,173
0
0
null
null
null
null
UTF-8
Java
false
false
1,846
java
package com.finsage.util.config; import java.util.ArrayList; import java.util.List; import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.support.config.FastJsonConfig; import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; /** * Fast Jason 初始化 * * @author yuan * @version v.0.1 * @date 2017.09.15 */ @Configuration public class JsonInitializer extends WebMvcConfigurerAdapter { /** * Fast Jason */ @Override public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { super.configureMessageConverters(converters); /* * 1. 需要先定義一個 convert 轉換消息的對象; 2. 添加 fastJson 的配置訊息。比如:是否要格式化回傳 json數據; * 3. 在 convert 中添加配置訊息; 4. 將 convert 添加到 converters 當中; */ // 1. 需要先定義一個 convert 轉換消息的對象; FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter(); // 2. 添加 fastJson 的配置訊息。比如:是否要格式化回傳 json數據; FastJsonConfig fastJsonConfig = new FastJsonConfig(); fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat); // 处理中文乱码问题 List<MediaType> fastMediaTypes = new ArrayList<>(); fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8); fastConverter.setSupportedMediaTypes(fastMediaTypes); // 3. 在 convert 中添加配置訊息; fastConverter.setFastJsonConfig(fastJsonConfig); // 4. 將 convert 添加到 converters 當中; converters.add(fastConverter); } }
[ "louis.chen@finsage.com.tw" ]
louis.chen@finsage.com.tw
6a3423b09f4084185a742c95b9aca562d97451d3
4aa90348abcb2119011728dc067afd501f275374
/app/src/main/java/com/tencent/mm/plugin/sns/model/b$a.java
95b10507b5c50dffa69b9880cbe9541321f39daa
[]
no_license
jambestwick/HackWechat
0d4ceb2d79ccddb45004ca667e9a6a984a80f0f6
6a34899c8bfd50d19e5a5ec36a58218598172a6b
refs/heads/master
2022-01-27T12:48:43.446804
2021-12-29T10:36:30
2021-12-29T10:36:30
249,366,791
0
0
null
2020-03-23T07:48:32
2020-03-23T07:48:32
null
UTF-8
Java
false
false
105
java
package com.tencent.mm.plugin.sns.model; public interface b$a { void dY(String str, String str2); }
[ "malin.myemail@163.com" ]
malin.myemail@163.com
16388df5572413817c0f2be7ecb12467b8ac59f9
8b886f72db79bf4db535a19010996cb68bed29ca
/src/main/java/org/dragonfei/web/LoginLogoutController.java
f2e47306820b066c3f1414a0cafafda307b4769c
[]
no_license
dragonfly123/ffzl
8f2b1256d34795959d4192bcb19460b1c61acdbc
9251d1570d2247da7f89063e542b3041bc375e32
refs/heads/master
2020-04-06T06:54:26.936900
2016-08-25T06:15:56
2016-08-25T06:15:56
53,193,495
4
0
null
null
null
null
UTF-8
Java
false
false
446
java
package org.dragonfei.web; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; /** * Created by longfei on 16-3-6. */ @Controller @RequestMapping("/home") public class LoginLogoutController { @RequestMapping(method = RequestMethod.GET,value = "/login.do") public String home(){ return "login"; } }
[ "18698572498@163.com" ]
18698572498@163.com
eb7ecbdfaf506f3fdfc20974b273d9ae68045b17
9ffe77b355f3adb6e554e6d008683c437f48eb95
/src/main/java/com/cybertek/repository/UserRepository.java
7c4f42a3441027fea0e677c519ad13453edcc214
[]
no_license
GeorgeR-1/ORM-e-commerce-app
fa37bcbdcba3db85034feb6680495330d9e50304
7dd380f9c2f23c49e05910b155cebb355ee5bee4
refs/heads/master
2023-03-16T19:16:27.624390
2021-03-12T12:39:18
2021-03-12T12:39:18
325,088,518
0
0
null
null
null
null
UTF-8
Java
false
false
390
java
package com.cybertek.repository; import com.cybertek.model.User; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.util.Optional; @Repository public interface UserRepository extends JpaRepository<User,Long> { Optional<User> findByUsername(String username); Optional<User> findByEmail(String email); }
[ "radac.george@yahoo.com" ]
radac.george@yahoo.com
2d3b62e4407791c6b1c231f01e9e05d2571bcee5
6a9d040d1dcdc08b42bd06676765b00e82a4906f
/src/com/sjxy/hotel/room/servlet/DelRoomTypeServlet.java
e5aed62ce944bdcc73259fa1e65c3fc439cbae60
[]
no_license
Wraxluz/Javawebtraining
cbb2c1a45cc3c31a0527ce9225bd0660b89fbd30
d7ac663947bb8bd72945473e39e8bbc8c8b70463
refs/heads/master
2022-10-16T06:29:20.768034
2020-06-11T05:21:33
2020-06-11T05:21:33
263,930,479
0
0
null
null
null
null
UTF-8
Java
false
false
1,565
java
package com.sjxy.hotel.room.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.sjxy.hotel.room.service.RoomService; import com.sjxy.hotel.room.service.impl.RoomServiceImpl; /** * Servlet implementation class DelRoomTypeServlet */ @WebServlet("/delRoomType.do") public class DelRoomTypeServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public DelRoomTypeServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=UTF-8"); RoomService roomService = new RoomServiceImpl(); String roomId = request.getParameter("roomId"); Integer roomId1 = Integer.valueOf(roomId); roomService.delete(roomId1); request.getRequestDispatcher("roomType.do").forward(request, response); } }
[ "1295862005@qq.com" ]
1295862005@qq.com
ce7379936aa3697936068ae57e392bee8e46ea2c
ca98045718e5965d767a2428fb5c3df8fd1f3511
/src/main/java/br/com/syspartenon/partenon/business/EstadoBC.java
bd66371db1d8b22f07af45087c884d5fc9378039
[]
no_license
guerralipe/partenon
b3c5c87fc816ce6dd5bb327983b2941ce0569721
878ba71c0793a25b8859265c1184a11e675d6c0e
refs/heads/master
2021-01-11T03:04:11.709114
2015-05-07T00:36:01
2015-05-07T00:36:01
70,857,256
0
0
null
null
null
null
UTF-8
Java
false
false
4,673
java
package br.com.syspartenon.partenon.business; import br.gov.frameworkdemoiselle.stereotype.BusinessController; import br.gov.frameworkdemoiselle.template.DelegateCrud; import br.com.syspartenon.partenon.domain.Estado; import br.com.syspartenon.partenon.persistence.EstadoDAO; import br.gov.frameworkdemoiselle.annotation.Startup; import br.gov.frameworkdemoiselle.transaction.Transactional; @BusinessController public class EstadoBC extends DelegateCrud<Estado, Integer, EstadoDAO> { @Startup @Transactional public void cargaInicialEstados(){ if(getDelegate().findAll().isEmpty()){ Estado e; e = new Estado(); e.setEstUf("RS"); e.setEstNome("Rio Grande do Sul"); getDelegate().insert(e); e = new Estado(); e.setEstUf("SC"); e.setEstNome("Santa Catarina"); getDelegate().insert(e); e = new Estado(); e.setEstUf("PR"); e.setEstNome("Paraná"); getDelegate().insert(e); e = new Estado(); e.setEstUf("SP"); e.setEstNome("São Paulo"); getDelegate().insert(e); e = new Estado(); e.setEstUf("MS"); e.setEstNome("Mato Grosso do Sul"); getDelegate().insert(e); e = new Estado(); e.setEstUf("MG"); e.setEstNome("Minas Gerais"); getDelegate().insert(e); e = new Estado(); e.setEstUf("GO"); e.setEstNome("Goias"); getDelegate().insert(e); e = new Estado(); e.setEstUf("MT"); e.setEstNome("Mato Grosso"); getDelegate().insert(e); e = new Estado(); e.setEstUf("RO"); e.setEstNome("Rondônia"); getDelegate().insert(e); e = new Estado(); e.setEstUf("AC"); e.setEstNome("Acre"); getDelegate().insert(e); e = new Estado(); e.setEstUf("AM"); e.setEstNome("Amazonas"); getDelegate().insert(e); e = new Estado(); e.setEstUf("AP"); e.setEstNome("Amapa"); getDelegate().insert(e); e = new Estado(); e.setEstUf("PA"); e.setEstNome("Pará"); getDelegate().insert(e); e = new Estado(); e.setEstUf("TO"); e.setEstNome("Tocantins"); getDelegate().insert(e); e = new Estado(); e.setEstUf("DF"); e.setEstNome("Distrito Federal"); getDelegate().insert(e); e = new Estado(); e.setEstUf("AL"); e.setEstNome("Alagoas"); getDelegate().insert(e); e = new Estado(); e.setEstUf("BA"); e.setEstNome("Bahia"); getDelegate().insert(e); e = new Estado(); e.setEstUf("CE"); e.setEstNome("Ceará"); getDelegate().insert(e); e = new Estado(); e.setEstUf("MA"); e.setEstNome("Maranhão"); getDelegate().insert(e); e = new Estado(); e.setEstUf("PB"); e.setEstNome("Paraíba"); getDelegate().insert(e); e = new Estado(); e.setEstUf("PE"); e.setEstNome("Pernambuco"); getDelegate().insert(e); e = new Estado(); e.setEstUf("PI"); e.setEstNome("Piauí"); getDelegate().insert(e); e = new Estado(); e.setEstUf("RN"); e.setEstNome("Rio Grande do Norte"); getDelegate().insert(e); e = new Estado(); e.setEstUf("SE"); e.setEstNome("Sergipe"); getDelegate().insert(e); e = new Estado(); e.setEstUf("ES"); e.setEstNome("Espirito Santo"); getDelegate().insert(e); e = new Estado(); e.setEstUf("RJ"); e.setEstNome("Rio de Janeiro"); getDelegate().insert(e); e = new Estado(); e.setEstUf("RR"); e.setEstNome("Roraima"); getDelegate().insert(e); } } }
[ "robsonperassoli@gmail.com" ]
robsonperassoli@gmail.com
45c77e0e1d2f282d98031fe51f698320ed0ab3b6
33f7b197f5285408f46da6bfe9ffcdd82293a81d
/src/main/java/com/example/demographql/service/datafetcher/AllBooksDataFetcher.java
bc5b62fe51504ab5521678c5a489ecd07a210d1f
[]
no_license
tvuchova/demo-graphql
e6c3564e31bfc51bf9165b9f5425d3e62d543260
7273e910dd1e51071e5e90a9ffaefabcbe2978bf
refs/heads/master
2022-11-21T18:40:20.555412
2020-07-30T11:17:53
2020-07-30T11:17:53
283,750,836
0
0
null
null
null
null
UTF-8
Java
false
false
772
java
package com.example.demographql.service.datafetcher; import com.example.demographql.model.Book; import com.example.demographql.repository.BookRepository; import graphql.schema.DataFetcher; import graphql.schema.DataFetchingEnvironment; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.List; @Component public class AllBooksDataFetcher implements DataFetcher<List<Book>> { private BookRepository bookRepository; @Autowired public AllBooksDataFetcher(BookRepository bookRepository) { this.bookRepository = bookRepository; } @Override public List<Book> get(DataFetchingEnvironment dataFetchingEnvironment) { return bookRepository.findAll(); } }
[ "tvuchova@gmail.com" ]
tvuchova@gmail.com
c7d929389b368aaeeea7ec8f0f8b1cf0ea0c2326
c0c03d51efc278215466968335f187e5197a7b6c
/src/Move Zeroes.java
201f155e1d1e31f3732469f570ad452251209a23
[]
no_license
XiaoLyu/LeetCode
6fea30ad5684a210c82a190e92034cb52129c45c
9a4ec3be01f5ce60fc48ecd9e73dc03ed3d561b3
refs/heads/master
2021-07-03T22:59:07.128025
2019-02-20T08:50:35
2019-02-20T08:50:35
116,881,195
0
1
null
null
null
null
UTF-8
Java
false
false
708
java
/* Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, given nums = [0, 1, 0, 3, 12], after calling your function, nums should be [1, 3, 12, 0, 0]. Note: You must do this in-place without making a copy of the array. Minimize the total number of operations. */ class Solution { public void moveZeroes(int[] nums) { int j = 0; for(int i = 0; i < nums.length; i++){ if(nums[i] != 0){ int temp = nums[i]; nums[i] = nums[j]; nums[j] = temp; j++; } } } } /* 还有别的解法, 复杂度 */
[ "noreply@github.com" ]
XiaoLyu.noreply@github.com
5c8f5bd7a5070949fb555145365bb5fa3eeb2c99
cbcaec2513dc5da633a90f18e1c85349afdd45a5
/DaggerTest/app/src/main/java/tdsoft/com/daggertest/ApplicationComponent.java
3ec3006987bad99ce826dbfa84095c66601e62c6
[]
no_license
tdsoft/Github-Tharndu
09acc083018d8f8bb97c270497d92afe357922ff
e71cfc963f4142f8f5c613d694a6b7598e07c09d
refs/heads/master
2023-02-12T04:54:45.804543
2018-03-15T03:54:46
2018-03-15T03:54:46
47,952,920
1
1
null
2023-02-01T23:56:26
2015-12-14T04:56:46
Java
UTF-8
Java
false
false
298
java
package tdsoft.com.daggertest; /** * Created by Admin on 7/18/2017. */ import javax.inject.Singleton; import dagger.Component; @Singleton @Component(modules = {AppModule.class}) public interface ApplicationComponent { void inject(App app); void inject(MainActivity mainActivity); }
[ "tharindu.damintha@gmail.com" ]
tharindu.damintha@gmail.com
10b142547c943f23671e12e2b0dfffc671c56e5d
995e655293513d0b9f93d62e28f74b436245ae74
/src/com/htc/b/a/m.java
21bad5a85ec14283a89e08d6599b52fa53b1c0ac
[]
no_license
JALsnipe/HTC-RE-YouTube-Live-Android
796e7c97898cac41f0f53120e79cde90d3f2fab1
f941b64ad6445c0a0db44318651dc76715291839
refs/heads/master
2021-01-17T09:46:50.725810
2015-01-09T23:32:14
2015-01-09T23:32:14
29,039,855
3
0
null
null
null
null
UTF-8
Java
false
false
1,054
java
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.htc.b.a; import android.os.Bundle; import android.os.Message; import android.os.Messenger; import android.os.RemoteException; import com.htc.gc.connectivity.a.a.j; import com.htc.gc.connectivity.a.a.n; // Referenced classes of package com.htc.b.a: // b class m implements Runnable { final b a; m(b b1) { a = b1; super(); } public void run() { Message message = Message.obtain(); message.what = 8700; Bundle bundle = new Bundle(); bundle.putSerializable("result", j.a); bundle.putSerializable("verify_password_status", n.c); message.setData(bundle); try { b.a(a).send(message); return; } catch (RemoteException remoteexception) { remoteexception.printStackTrace(); } } }
[ "josh.lieberman92@gmail.com" ]
josh.lieberman92@gmail.com
6e85da8a6c10e2152a141ac9c3c77886433be0be
8de92674c759c12ef6f990ca93ad681a45ff8ba6
/src/main/java/by/epam/receptionenrollee/dao/pool/StandardConnectionPool.java
2718d5f29b495c9bca44fcd2e3c41e7c3d126c96
[]
no_license
maruvuina/ReceptionEnrolleeProject
e4dfa83cd615f44ef3a9eb9b01471871a0532b1e
2344c02bbffcbc612313ac307c43fe0268f4460e
refs/heads/master
2023-05-11T22:32:31.676818
2022-09-10T18:43:36
2022-09-10T18:43:36
225,902,931
0
2
null
2023-05-01T21:19:35
2019-12-04T15:50:44
JavaScript
UTF-8
Java
false
false
1,679
java
package by.epam.receptionenrollee.dao.pool; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.sql.DataSource; import java.sql.Connection; import java.sql.SQLException; @Deprecated public class StandardConnectionPool { private static final Logger logger = LogManager.getLogger(StandardConnectionPool.class); private static final String DATASOURCE_NAME = "jdbc/reception_enrollee_system"; private static DataSource dataSource; static { try { Context initContext = new InitialContext(); Context envContext = (Context) initContext.lookup("java:/comp/env"); dataSource = (DataSource) envContext.lookup(DATASOURCE_NAME); } catch (NamingException e) { logger.log(Level.ERROR, "Get something wrong with connection pool: ", e); } } private StandardConnectionPool() {} public static Connection getConnection() { Connection connection = null; try { connection = dataSource.getConnection(); } catch (SQLException e) { logger.log(Level.ERROR, "Get something wrong with get connection: ", e); } return connection; } public static void closeConnection(Connection connection) { if (connection != null) { try { connection.close(); } catch (SQLException e) { logger.log(Level.ERROR, "Get something wrong with close connection: ", e); } } } }
[ "mmf.inna@gmail.com" ]
mmf.inna@gmail.com
0a4fd8ccc95e61491151b24ce358f7f619a37c82
dd0d2013b11d4814e12bcbcad981a431e187fcab
/CS112PuzzleProject/src/SkyscraperBtn.java
414c41f68dae4c56fd313cab7297036667b503c0
[]
no_license
Sirawesomeknight/CS112
6b2864f4eff3e1acaf20b80b8d0a30926960b2d1
425b3d9f167e127f0b2588adf62618ffb7625bd8
refs/heads/master
2021-05-20T21:21:20.965001
2020-04-02T10:14:11
2020-04-02T10:14:11
252,421,465
0
0
null
null
null
null
UTF-8
Java
false
false
1,007
java
import java.awt.*; public class SkyscraperBtn extends Spot { private int grid; public SkyscraperBtn(int num, Skyscraper skyscraper, int grid){ super(num); this.setBackground(Color.blue); this.setForeground(Color.green); this.setFont(new Font("Arial", Font.PLAIN, 40)); this.grid = grid; this.addActionListener(new SkyscraperBtnListener(this,selected,skyscraper)); } public void selectBtn(){ this.setBackground(Color.YELLOW); if(getBtnValue() == grid){ setBtnValue(1); }else { setBtnValue(getBtnValue() + 1); } this.setText(String.valueOf(getBtnValue())); setSelected(true); } public void unselectBtn(){ this.selected = false; this.setBackground(Color.blue); setBtnValue(0); this.setText(""); } public void setBtnValue(int value){ this.setText(String.valueOf(value)); super.setBtnValue(value); } }
[ "hulsizerjames@gmail.com" ]
hulsizerjames@gmail.com
e41551876668bb51f5e1b25905475e9e2df95fac
0310c06d2c2dfc07653e97a734ec276c82d7aec0
/src/main/java/fr/nathanael2611/openclassrooms/escapegame/code/core/util/GivenSizeList.java
8245c32c310d6c40415f853fe882f691db4467d1
[]
no_license
Nathanael2611/escape-game-code
18cf28ec390b99b181870a40da32d8d724a8fda7
85e9963910f4669744ae41162336dd5839a288f9
refs/heads/master
2020-08-06T06:26:24.701189
2019-11-21T10:27:35
2019-11-21T10:27:35
212,871,447
0
0
null
null
null
null
UTF-8
Java
false
false
1,606
java
package fr.nathanael2611.openclassrooms.escapegame.code.core.util; import java.util.AbstractList; import java.util.Arrays; import java.util.List; /** * This class was based on the NonNullList Minecraft class * @param <E> */ public class GivenSizeList<E> extends AbstractList<E> { private final List<E> delegate; private final E defaultElement; /** * Creates a new GivenSizeList with a given size, and filled with the object passed. */ public static <E> GivenSizeList<E> withSize(int size, E fill) { Object[] aobject = new Object[size]; Arrays.fill(aobject, fill); return new GivenSizeList<E>(Arrays.asList((E[])aobject), fill); } protected GivenSizeList(List<E> delegateIn, E listType) { this.delegate = delegateIn; this.defaultElement = listType; } public E get(int p_get_1_) { return this.delegate.get(p_get_1_); } public E set(int p_set_1_, E p_set_2_) { return this.delegate.set(p_set_1_, p_set_2_); } public void add(int p_add_1_, E p_add_2_) { this.delegate.add(p_add_1_, p_add_2_); } public E remove(int p_remove_1_) { return this.delegate.remove(p_remove_1_); } public int size() { return this.delegate.size(); } public void clear() { if (this.defaultElement == null) { super.clear(); } else { for (int i = 0; i < this.size(); ++i) { this.set(i, this.defaultElement); } } } }
[ "nathanael2611@gmail.com" ]
nathanael2611@gmail.com
1a11ca13e6ab3ee149471f0d9b966b7f91352ae7
498dd2daff74247c83a698135e4fe728de93585a
/clients/google-api-services-datacatalog/v1/2.0.0/com/google/api/services/datacatalog/v1/model/GoogleCloudDatacatalogV1GcsFilesetSpec.java
6a994b4e9bce61b89c4873fdd432a9b8dcb3c89e
[ "Apache-2.0" ]
permissive
googleapis/google-api-java-client-services
0e2d474988d9b692c2404d444c248ea57b1f453d
eb359dd2ad555431c5bc7deaeafca11af08eee43
refs/heads/main
2023-08-23T00:17:30.601626
2023-08-20T02:16:12
2023-08-20T02:16:12
147,399,159
545
390
Apache-2.0
2023-09-14T02:14:14
2018-09-04T19:11:33
null
UTF-8
Java
false
false
7,151
java
/* * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ /* * This code was generated by https://github.com/googleapis/google-api-java-client-services/ * Modify at your own risk. */ package com.google.api.services.datacatalog.v1.model; /** * Describes a Cloud Storage fileset entry. * * <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is * transmitted over HTTP when working with the Google Cloud Data Catalog API. For a detailed * explanation see: * <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a> * </p> * * @author Google, Inc. */ @SuppressWarnings("javadoc") public final class GoogleCloudDatacatalogV1GcsFilesetSpec extends com.google.api.client.json.GenericJson { /** * Required. Patterns to identify a set of files in Google Cloud Storage. For more information, * see [Wildcard Names] (https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames). * Note: Currently, bucket wildcards are not supported. Examples of valid `file_patterns`: * * `gs://bucket_name/dir`: matches all files in `bucket_name/dir` directory * * `gs://bucket_name/dir*`: matches all files in `bucket_name/dir` and all subdirectories * * `gs://bucket_name/file*`: matches files prefixed by `file` in `bucket_name` * * `gs://bucket_name/??.txt`: matches files with two characters followed by `.txt` in * `bucket_name` * `gs://bucket_name/[aeiou].txt`: matches files that contain a single vowel * character followed by `.txt` in `bucket_name` * `gs://bucket_name/[a-m].txt`: matches files * that contain `a`, `b`, ... or `m` followed by `.txt` in `bucket_name` * `gs://bucket_name/a/b`: * matches all files in `bucket_name` that match the `a/b` pattern, such as `a/c/b`, `a/d/b` * * `gs://another_bucket/a.txt`: matches `gs://another_bucket/a.txt` You can combine wildcards to * match complex sets of files, for example: `gs://bucket_name/[a-m]??.j*g` * The value may be {@code null}. */ @com.google.api.client.util.Key private java.util.List<java.lang.String> filePatterns; /** * Output only. Sample files contained in this fileset, not all files contained in this fileset * are represented here. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.util.List<GoogleCloudDatacatalogV1GcsFileSpec> sampleGcsFileSpecs; static { // hack to force ProGuard to consider GoogleCloudDatacatalogV1GcsFileSpec used, since otherwise it would be stripped out // see https://github.com/google/google-api-java-client/issues/543 com.google.api.client.util.Data.nullOf(GoogleCloudDatacatalogV1GcsFileSpec.class); } /** * Required. Patterns to identify a set of files in Google Cloud Storage. For more information, * see [Wildcard Names] (https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames). * Note: Currently, bucket wildcards are not supported. Examples of valid `file_patterns`: * * `gs://bucket_name/dir`: matches all files in `bucket_name/dir` directory * * `gs://bucket_name/dir*`: matches all files in `bucket_name/dir` and all subdirectories * * `gs://bucket_name/file*`: matches files prefixed by `file` in `bucket_name` * * `gs://bucket_name/??.txt`: matches files with two characters followed by `.txt` in * `bucket_name` * `gs://bucket_name/[aeiou].txt`: matches files that contain a single vowel * character followed by `.txt` in `bucket_name` * `gs://bucket_name/[a-m].txt`: matches files * that contain `a`, `b`, ... or `m` followed by `.txt` in `bucket_name` * `gs://bucket_name/a/b`: * matches all files in `bucket_name` that match the `a/b` pattern, such as `a/c/b`, `a/d/b` * * `gs://another_bucket/a.txt`: matches `gs://another_bucket/a.txt` You can combine wildcards to * match complex sets of files, for example: `gs://bucket_name/[a-m]??.j*g` * @return value or {@code null} for none */ public java.util.List<java.lang.String> getFilePatterns() { return filePatterns; } /** * Required. Patterns to identify a set of files in Google Cloud Storage. For more information, * see [Wildcard Names] (https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames). * Note: Currently, bucket wildcards are not supported. Examples of valid `file_patterns`: * * `gs://bucket_name/dir`: matches all files in `bucket_name/dir` directory * * `gs://bucket_name/dir*`: matches all files in `bucket_name/dir` and all subdirectories * * `gs://bucket_name/file*`: matches files prefixed by `file` in `bucket_name` * * `gs://bucket_name/??.txt`: matches files with two characters followed by `.txt` in * `bucket_name` * `gs://bucket_name/[aeiou].txt`: matches files that contain a single vowel * character followed by `.txt` in `bucket_name` * `gs://bucket_name/[a-m].txt`: matches files * that contain `a`, `b`, ... or `m` followed by `.txt` in `bucket_name` * `gs://bucket_name/a/b`: * matches all files in `bucket_name` that match the `a/b` pattern, such as `a/c/b`, `a/d/b` * * `gs://another_bucket/a.txt`: matches `gs://another_bucket/a.txt` You can combine wildcards to * match complex sets of files, for example: `gs://bucket_name/[a-m]??.j*g` * @param filePatterns filePatterns or {@code null} for none */ public GoogleCloudDatacatalogV1GcsFilesetSpec setFilePatterns(java.util.List<java.lang.String> filePatterns) { this.filePatterns = filePatterns; return this; } /** * Output only. Sample files contained in this fileset, not all files contained in this fileset * are represented here. * @return value or {@code null} for none */ public java.util.List<GoogleCloudDatacatalogV1GcsFileSpec> getSampleGcsFileSpecs() { return sampleGcsFileSpecs; } /** * Output only. Sample files contained in this fileset, not all files contained in this fileset * are represented here. * @param sampleGcsFileSpecs sampleGcsFileSpecs or {@code null} for none */ public GoogleCloudDatacatalogV1GcsFilesetSpec setSampleGcsFileSpecs(java.util.List<GoogleCloudDatacatalogV1GcsFileSpec> sampleGcsFileSpecs) { this.sampleGcsFileSpecs = sampleGcsFileSpecs; return this; } @Override public GoogleCloudDatacatalogV1GcsFilesetSpec set(String fieldName, Object value) { return (GoogleCloudDatacatalogV1GcsFilesetSpec) super.set(fieldName, value); } @Override public GoogleCloudDatacatalogV1GcsFilesetSpec clone() { return (GoogleCloudDatacatalogV1GcsFilesetSpec) super.clone(); } }
[ "noreply@github.com" ]
googleapis.noreply@github.com
b4f511766c80e433fcef3c4436a60158f5adc8ef
59d2c8af8bec05de3cd7a4a48bdb24e0f1ad26a3
/src/java/com/info/controller/DeleteCommentServlet.java
30f469aed557166eaa6dddfe9ec4df9e4d1cea1b
[]
no_license
rojinadeuja/GoIntern
4c564291104576f41e01ffe77848eed88751f61b
8e1d5dd6466f1d907a8893f1564d7cb1ccae845e
refs/heads/main
2022-12-27T12:05:13.773347
2020-10-12T23:06:27
2020-10-12T23:06:27
300,987,011
0
0
null
null
null
null
UTF-8
Java
false
false
2,984
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.info.controller; import com.info.dao.CommentDao; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author Roseenah */ @WebServlet(name = "DeleteCommentServlet", urlPatterns = {"/DeleteCommentServlet"}) public class DeleteCommentServlet extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { CommentDao sd=new CommentDao(); String ss =request.getParameter("cmntid"); String id =request.getParameter("id"); sd.deleteComment(ss); //out.println("The record of comment has been entered."); response.sendRedirect("fullpost.jsp?Id="+id); } catch(Exception e){ e.printStackTrace(); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
[ "rojinadeuja33g@gmail.com" ]
rojinadeuja33g@gmail.com
ed88f90d561a10a9c55a9fcc642bb584805b58f7
64266ad06b6f7e75981996000bdf1208717b0296
/src/com/hewie/leetcode/LeetCode888.java
510bba149f0f752ee3945cd0fc92399cce9c2d1c
[]
no_license
hewiezhangB/ideaTest
127f708098c08803c4f1870670e9a1ba0243ffb3
3b67dc5197012fcd0c0278575740c2349a838ea3
refs/heads/master
2023-07-09T23:47:37.466152
2021-08-09T07:08:26
2021-08-09T07:08:26
394,166,690
0
0
null
null
null
null
UTF-8
Java
false
false
703
java
package com.hewie.leetcode; import java.util.Arrays; import java.util.HashSet; import java.util.Set; public class LeetCode888 { public int[] fairCandySwap(int[] A, int[] B) { int sumA = Arrays.stream(A).sum(); int sumB = Arrays.stream(B).sum(); int delta = (sumA - sumB) / 2; Set<Integer> rec = new HashSet<Integer>(); for (int num : A) { rec.add(num); } int[] ans = new int[2]; for (int y : B) { int x = y + delta; if (rec.contains(x)) { ans[0] = x; ans[1] = y; break; } } return ans; } }
[ "l" ]
l
da39bd5f206319376ae0d0902b37b830051cf735
f16ffbf01d39de408a2c9751320cc1078b279668
/src/main/java/com/rad8329/simpleswingapp/gui/MainFrame.java
ed6a36772dd203bb5bfb1bac95be8169179a4777
[]
no_license
rad8329/SimpleSwingApp
1d7ca34fa5d00b758c2666175664445037408265
58cbd19bf457f9a9070876c4c5d3268191db3d31
refs/heads/master
2020-04-01T02:30:49.218559
2018-11-19T15:14:37
2018-11-19T15:14:37
152,782,062
1
0
null
null
null
null
UTF-8
Java
false
false
3,632
java
package com.rad8329.simpleswingapp.gui; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import javax.swing.JPanel; public class MainFrame extends javax.swing.JFrame { private static final long serialVersionUID = -498955594596889802L; public MainFrame() { initComponents(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setBackground(new java.awt.Color(240, 236, 232)); setResizable(false); LabelEncabezado.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/encabezado.png"))); // NOI18N LabelEncabezado.setAlignmentX(0.1F); LabelEncabezado.setFocusable(false); TabbedPanel.setBackground(new java.awt.Color(240, 236, 232)); TabbedPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); TabbedPanel.setToolTipText(""); TabbedPanel.setAlignmentX(0.0F); TabbedPanel.setFocusable(false); TabbedPanel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N TabbedPanel.setName("panelTabs"); // NOI18N com.rad8329.simpleswingapp.Aplicacion.get().getPaneles().forEach(panel -> { TabbedPanel.add(panel.getName(),panel); }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(TabbedPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 896, Short.MAX_VALUE) .addComponent(LabelEncabezado, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(LabelEncabezado) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(TabbedPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 585, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents public static void agregarPanel(JPanel panel) { TabbedPanel.add(panel.getName(), panel); TabbedPanel.setSelectedComponent(panel); } public static void removerPanel(int index, int focus) { try { TabbedPanel.remove(index); TabbedPanel.setSelectedComponent(TabbedPanel.getComponent(focus)); } catch (IndexOutOfBoundsException iobe) { // No hacemos nada } } // Variables declaration - do not modify//GEN-BEGIN:variables private final javax.swing.JLabel LabelEncabezado = new javax.swing.JLabel(); private static final javax.swing.JTabbedPane TabbedPanel = new javax.swing.JTabbedPane(); // End of variables declaration//GEN-END:variables }
[ "rad8329@gmail.com" ]
rad8329@gmail.com
13eb9b6c9a96271cd29386398a6f6137099c1a22
7b73756ba240202ea92f8f0c5c51c8343c0efa5f
/classes2/tfq.java
c598e3dd5d66d81ed829c9d0bd8d1e35a13868c4
[]
no_license
meeidol-luo/qooq
588a4ca6d8ad579b28dec66ec8084399fb0991ef
e723920ac555e99d5325b1d4024552383713c28d
refs/heads/master
2020-03-27T03:16:06.616300
2016-10-08T07:33:58
2016-10-08T07:33:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,596
java
import android.os.IBinder; import android.os.Parcel; import com.tencent.mobileqq.hotpatch.NotVerifyClass; import com.tencent.mobileqq.music.IQQPlayerCallback; public class tfq implements IQQPlayerCallback { private IBinder a; public tfq(IBinder paramIBinder) { boolean bool = NotVerifyClass.DO_VERIFY_CLASS; this.a = paramIBinder; } public String a() { return "com.tencent.mobileqq.music.IQQPlayerCallback"; } public void a(int paramInt) { Parcel localParcel = Parcel.obtain(); try { localParcel.writeInterfaceToken("com.tencent.mobileqq.music.IQQPlayerCallback"); localParcel.writeInt(paramInt); this.a.transact(1, localParcel, null, 1); return; } finally { localParcel.recycle(); } } /* Error */ public void a(com.tencent.mobileqq.music.SongInfo paramSongInfo) { // Byte code: // 0: invokestatic 32 android/os/Parcel:obtain ()Landroid/os/Parcel; // 3: astore_2 // 4: aload_2 // 5: ldc 25 // 7: invokevirtual 36 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V // 10: aload_1 // 11: ifnull +33 -> 44 // 14: aload_2 // 15: iconst_1 // 16: invokevirtual 39 android/os/Parcel:writeInt (I)V // 19: aload_1 // 20: aload_2 // 21: iconst_0 // 22: invokevirtual 55 com/tencent/mobileqq/music/SongInfo:writeToParcel (Landroid/os/Parcel;I)V // 25: aload_0 // 26: getfield 21 tfq:a Landroid/os/IBinder; // 29: iconst_2 // 30: aload_2 // 31: aconst_null // 32: iconst_1 // 33: invokeinterface 45 5 0 // 38: pop // 39: aload_2 // 40: invokevirtual 48 android/os/Parcel:recycle ()V // 43: return // 44: aload_2 // 45: iconst_0 // 46: invokevirtual 39 android/os/Parcel:writeInt (I)V // 49: goto -24 -> 25 // 52: astore_1 // 53: aload_2 // 54: invokevirtual 48 android/os/Parcel:recycle ()V // 57: aload_1 // 58: athrow // Local variable table: // start length slot name signature // 0 59 0 this tfq // 0 59 1 paramSongInfo com.tencent.mobileqq.music.SongInfo // 3 51 2 localParcel Parcel // Exception table: // from to target type // 4 10 52 finally // 14 25 52 finally // 25 39 52 finally // 44 49 52 finally } public IBinder asBinder() { return this.a; } } /* Location: E:\apk\QQ_91\classes2-dex2jar.jar!\tfq.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "1776098770@qq.com" ]
1776098770@qq.com
9f16ef96608236d753f8ec5374ae211a5d9d24b7
079e9dfe6de9f1300529ce17d7102c69ec683452
/Square of a number using function/Main.java
c0b1c77f1c13ae98f25f116661c106f00224d8a8
[]
no_license
getpankajgiri/Playground
9df553d991cf9c0ebe594fd9658115ac6f1041ac
27e44ad8d7b344d27cd9e8a8d339ede8fe69dfaa
refs/heads/master
2020-04-14T09:26:27.746180
2019-04-20T14:31:48
2019-04-20T14:31:48
163,760,010
0
0
null
null
null
null
UTF-8
Java
false
false
294
java
import java.util.Scanner; class Main { public static int square(int num) { num=num*num; return num; } public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int sod = square(n); System.out.println(sod); } }
[ "46302027+getpankajgiri@users.noreply.github.com" ]
46302027+getpankajgiri@users.noreply.github.com
2d34f6845425cf0bad8114af7fd88a8b2aad6a13
3cd8c667c9fb3f3899be66ba515028045249bce4
/aws/aws-sink/src/main/java/com/dtstack/flink/sql/sink/aws/table/AwsTableInfo.java
f02826679b7e8633adf8ac8fc372d89e0054e284
[ "Apache-2.0" ]
permissive
DTStack/flinkStreamSQL
9da042a952aad9da5bc309c99e0f80005f92e5fe
fd15f55eaebc7437fc9856d4d0855d54bdc0a1d3
refs/heads/1.10_release
2023-06-21T15:40:30.267612
2022-10-26T01:35:21
2022-10-26T01:35:21
148,428,318
2,073
980
Apache-2.0
2022-11-23T22:27:27
2018-09-12T05:51:37
Java
UTF-8
Java
false
false
4,090
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.dtstack.flink.sql.sink.aws.table; import com.dtstack.flink.sql.table.AbstractTargetTableInfo; import com.google.common.base.Preconditions; /** * @author tiezhu * date 2020/12/1 * company dtstack */ public class AwsTableInfo extends AbstractTargetTableInfo { private static final String CURRENT_TYPE = "aws"; private String accessKey; private String secretKey; private String hostname; private String bucketName; /** * 写入s3的objectName */ private String objectName; /** * 文件存储的类型,分为Standard【标准存储】和 Standard-ia【低频存储】 */ private String storageType; /** * 设置bucket的访问权限,有基本的两种,CannedAccessControlList和AccessControlList */ private String bucketAcl; private String userId; private String userDisplayName; private String ownerId; private String ownerDisplayName; public String getAccessKey() { return accessKey; } public void setAccessKey(String accessKey) { this.accessKey = accessKey; } public String getSecretKey() { return secretKey; } public void setSecretKey(String secretKey) { this.secretKey = secretKey; } public String getHostname() { return hostname; } public void setHostname(String hostname) { this.hostname = hostname; } public String getBucketName() { return bucketName; } public void setBucketName(String bucketName) { this.bucketName = bucketName; } public String getStorageType() { return storageType; } public void setStorageType(String storageType) { this.storageType = storageType; } public String getBucketAcl() { return bucketAcl; } public void setBucketAcl(String bucketAcl) { this.bucketAcl = bucketAcl; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getUserDisplayName() { return userDisplayName; } public void setUserDisplayName(String userDisplayName) { this.userDisplayName = userDisplayName; } public String getOwnerId() { return ownerId; } public void setOwnerId(String ownerId) { this.ownerId = ownerId; } public String getOwnerDisplayName() { return ownerDisplayName; } public void setOwnerDisplayName(String ownerDisplayName) { this.ownerDisplayName = ownerDisplayName; } public String getObjectName() { return objectName; } public void setObjectName(String objectName) { this.objectName = objectName; } @Override public boolean check() { Preconditions.checkNotNull(accessKey, "S3 field of AccessKey is required!"); Preconditions.checkNotNull(secretKey, "S3 field of SecretKey is required!"); Preconditions.checkNotNull(bucketName, "S3 field of BucketName is required!"); Preconditions.checkNotNull(objectName, "S3 field of ObjectName is required!"); return true; } @Override public String getType() { return CURRENT_TYPE; } }
[ "tiezhu@dtstack.com" ]
tiezhu@dtstack.com
72405b36bc22ce2af3ffae8fe108d005d773e36c
5171f4e2308563a9109f70650ef0928a7403423e
/src/main/java/de/tekup/ex/Service/TicketServiceImpl.java
624128abe9608022bac86edb139aba1535b84aeb
[]
no_license
Moatez-km/Italien-Restaurent
b69e2916b27153f15ad4f71f827a21725b49cd0c
a4d955f959da76519b0a4cc2a5f549b5236277af
refs/heads/master
2023-02-26T09:13:29.090499
2021-01-20T23:52:21
2021-01-20T23:52:21
331,463,623
1
0
null
null
null
null
UTF-8
Java
false
false
4,807
java
package de.tekup.ex.Service; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.NoSuchElementException; import java.util.Optional; import java.util.Set; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import de.tekup.ex.DTO.MetResponse; import de.tekup.ex.DTO.TicketRequest; import de.tekup.ex.DTO.TicketResponse; import de.tekup.ex.Models.Met; import de.tekup.ex.Models.Ticket; import de.tekup.ex.Repositories.MetRepository; import de.tekup.ex.Repositories.TicketRepository; @Service public class TicketServiceImpl implements TicketService{ private TicketRepository ticketRepo; private MetRepository metRepo; private ModelMapper mapper = new ModelMapper(); @Autowired public TicketServiceImpl(TicketRepository ticketRepo, MetRepository metRepo) { super(); this.ticketRepo = ticketRepo; this.metRepo = metRepo; } @Override public List<Ticket> getAllTickets() { return ticketRepo.findAll(); } @Override public Ticket getTicketById(int numero) { Optional<Ticket> opt = ticketRepo.findById(numero); Ticket ticket; if (opt.isPresent()) { ticket = opt.get(); } else { throw new NoSuchElementException("il n'y a pas un ticket avec le numero saisi"); } return ticket; } @Override public TicketResponse createTicket(TicketRequest ticket) { Ticket ticketRequest = mapper.map(ticket, Ticket.class); ticketRequest.setDate(LocalDateTime.of(LocalDateTime.now().getYear(),LocalDateTime.now().getMonth(), LocalDateTime.now().getDayOfMonth(), LocalDateTime.now().getHour(), LocalDateTime.now().getMinute())); ticketRepo.save(ticketRequest); return mapper.map(ticketRequest, TicketResponse.class); } @Override public TicketResponse modifyTicket(int numero, TicketRequest newTicket) { Ticket ticketRequest = mapper.map(newTicket, Ticket.class); Ticket thisTicket = this.getTicketById(numero); if (ticketRequest.getDate()!=null) { thisTicket.setDate(ticketRequest.getDate()); } if (ticketRequest.getNbCouvert()!=0) { thisTicket.setNbCouvert(ticketRequest.getNbCouvert()); } if (!(ticketRequest.getAddition()<0)) { thisTicket.setAddition(ticketRequest.getAddition()); } ticketRepo.save(thisTicket); return mapper.map(thisTicket, TicketResponse.class); } @Override public TicketResponse deleteTicketById(int numero) { Ticket ticket = this.getTicketById(numero); ticketRepo.deleteById(numero); return mapper.map(ticket,TicketResponse.class); } @Override public Ticket addMeal(int numero, Met met) { //adding the meal to the ticket Ticket ticket = this.getTicketById(numero); ticket.getMets().add(met); ticket.setAddition(ticket.getAddition()+met.getPrix()); //making the reference with the met entity met.getTickets().add(ticket); //saving the changes metRepo.save(met); return ticketRepo.save(ticket); } @Override public MetResponse getPlatByDate(LocalDateTime date) { List<Ticket> tickets = this.getAllTickets(); List<String> plats = new ArrayList<String>(); int occ = 0; //Gathering all the tickets with the demanded date for (Ticket ticket:tickets) { if (ticket.getDate()!=null) { if (ticket.getDate().equals(date)) { Set<Met> mets = ticket.getMets(); //filtring all the meals with type "plat" for (Met met:mets) { if ("plat".equals(met.getType().toLowerCase())) { plats.add(met.getNom()); //filling up a list with that type of meal } } } } } Optional<Met> opt = null; for (String plat : plats) { if (occ < Collections.frequency(plats, plat)) { occ = Collections.frequency(plats, plat); opt = metRepo.findById(plat); } } Met platRes; if (opt.isPresent()) { platRes = opt.get(); } else { throw new NoSuchElementException("il n'y a pas un plat avec le date mentionné"); } return mapper.map(platRes, MetResponse.class); } }
[ "moatez.kamounn@gmail.com" ]
moatez.kamounn@gmail.com
e46e01f7b5cfdc7438881fb56e7d5c202049b28a
bf8d8b0032982cbac8879691697c5361cf6f2e9a
/src/ZuoShen/class_03/Code_15_FindOneLessValueIndex.java
a1e58637104b98804b2c12b495753500c406d3ff
[]
no_license
ddisacoder/ForBishi
41b2819708c798f61c41ef9629582053eb3c1c80
63d8770deb754ee7585b64503d98c4418159c6d3
refs/heads/master
2020-07-15T19:53:20.015429
2019-10-06T11:17:56
2019-10-06T11:17:56
205,637,373
1
0
null
null
null
null
UTF-8
Java
false
false
978
java
package ZuoShen.class_03; public class Code_15_FindOneLessValueIndex { public static int getLessIndex(int[] arr) { if (arr == null || arr.length == 0) { return -1; // no exist } if (arr.length == 1 || arr[0] < arr[1]) { return 0; } if (arr[arr.length - 1] < arr[arr.length - 2]) { return arr.length - 1; } int left = 1; int right = arr.length - 2; int mid = 0; while (left < right) { mid = (left + right) / 2; if (arr[mid] > arr[mid - 1]) { right = mid - 1; } else if (arr[mid] > arr[mid + 1]) { left = mid + 1; } else { return mid; } } return left; } public static void printArray(int[] arr) { for (int i = 0; i != arr.length; i++) { System.out.print(arr[i] + " "); } System.out.println(); } public static void main(String[] args) { int[] arr = { 6, 5, 3, 4, 6, 7, 8 }; printArray(arr); int index = getLessIndex(arr); System.out.println("index: " + index + ", value: " + arr[index]); } }
[ "861573320@qq.com" ]
861573320@qq.com
fccb0666b0ea15a785bc58c2d92ba5cc8f4e2346
1f65cf0cf11f793437e62852991a3f37cb1b47bf
/src/java/com/soapsoft/Vista/ProduccionBean.java
6e06c7829a8424fb64ce0f7c0314255bae2bc33c
[]
no_license
HDCARDENAS2/SOAPSOFT_WEB
bdb76dffff3a363b41e6d42067e960dd03bea171
53f2bc2a43365e05da40bf4621991930f332f7c7
refs/heads/master
2021-05-06T18:48:31.683165
2017-12-05T00:46:35
2017-12-05T00:46:35
111,983,770
0
0
null
null
null
null
UTF-8
Java
false
false
3,861
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.soapsoft.Vista; import com.soapsoft.service.TbProduccion; import java.util.ArrayList; import java.util.List; import javax.faces.application.FacesMessage; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import javax.faces.context.FacesContext; /** * * @author JA */ @ManagedBean @SessionScoped public class ProduccionBean { public List<TbProduccion> lista_produccion; public TbProduccion o_Produccion; public String id_dpto_produccion ; public String v_descripcion; public String creadoPor="JA"; public String modificadoPor="JA"; /** * Creates a new instance of VentasBean */ public void init() { o_Produccion=new TbProduccion(); lista_produccion=new ArrayList<>(); lista_produccion = consultarTodosProduccion(); } public List<TbProduccion> getLista_produccion() { return lista_produccion; } public void setLista_produccion(List<TbProduccion> lista_produccion) { this.lista_produccion = lista_produccion; } public TbProduccion getO_produccion() { return o_Produccion; } public void setO_produccion(TbProduccion o_produccion) { this.o_Produccion = o_produccion; } public String getId_dpto_produccion() { return id_dpto_produccion; } public void setId_dpto_produccion(String id) { this.id_dpto_produccion = id; } public List<TbProduccion> getTb_o_produccion() { if (lista_produccion == null){ try { lista_produccion = consultarTodosProduccion(); } catch (Exception e) { e.printStackTrace(); } } return lista_produccion; } public String getCreadoPor() { return creadoPor; } public void setCreadoPor(String creadoPor) { this.creadoPor = creadoPor; } public String getModificadoPor() { return modificadoPor; } public void setModificadoPor(String modificadoPor) { this.modificadoPor = modificadoPor; } public String getV_descripcion() { return v_descripcion; } public void setV_descripcion(String v_descripcion) { this.v_descripcion = v_descripcion; } public void crear_produccion() { fnInsertar(id_dpto_produccion, creadoPor, v_descripcion); mensaje("Info","Se ha insertado con exito en produccion"); v_descripcion=""; lista_produccion=new ArrayList<>(); lista_produccion = consultarTodosProduccion(); } public void mensaje(String titulo,String mensaje){ FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(titulo, mensaje)); } private static String fnInsertar(java.lang.String id_dpto_produccion,java.lang.String creadoPor, java.lang.String descripcion) { com.soapsoft.service.SVRPRODUCCION_Service service = new com.soapsoft.service.SVRPRODUCCION_Service(); com.soapsoft.service.SVRPRODUCCION port = service.getSVRPRODUCCIONPort(); return port.fnInsertarPr(id_dpto_produccion, creadoPor, descripcion); } private static java.util.List<com.soapsoft.service.TbProduccion> consultarTodosProduccion() { com.soapsoft.service.SVRPRODUCCION_Service service = new com.soapsoft.service.SVRPRODUCCION_Service(); com.soapsoft.service.SVRPRODUCCION port = service.getSVRPRODUCCIONPort(); return port.fnConsultarPr(); } }
[ "PC@10.0.2.15" ]
PC@10.0.2.15
50194497dd2cb3724c08921347be8ce5f3f7f2a7
44e45cde827f7bba3f7573cf8a5b03eff245c29a
/SmartWeb/src/main/java/cn/huahai/tel/interceptor/VisitCountInterceptor.java
dff2ce7705c1a412a7c54b4b9317731d8fcc6c67
[]
no_license
jiagegege/gitTest
b938d727e67ef72da3fc894c3024ba70e291669d
53cad9c28aee0ec0c1bc1b38baf8a7e81927588b
refs/heads/master
2020-04-15T05:11:18.039845
2019-01-11T03:16:00
2019-01-11T03:16:00
164,412,111
0
0
null
null
null
null
UTF-8
Java
false
false
1,875
java
package cn.huahai.tel.interceptor; import java.text.SimpleDateFormat; import java.util.Date; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; import cn.huahai.tel.service.VisitCountServer; /** * 访问统计相关 * @author lijia * */ public class VisitCountInterceptor implements HandlerInterceptor { @Resource VisitCountServer vcs; /** * 准备用来做用户的访问统计 */ @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String ip = request.getHeader("x-forwarded-for"); if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)){ ip = request.getHeader("Proxy-Client-IP"); } if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)){ ip = request.getHeader("WL-Proxy-Client-IP"); } if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)){ ip = request.getRemoteAddr(); } System.out.println("ip:"+ip); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式 vcs.addVisitIpData(ip, df.format(new Date())); vcs.addVisitData(request.getRequestURI(), request.getQueryString()); return true; } @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { // TODO Auto-generated method stub } @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { // TODO Auto-generated method stub } }
[ "17722454573@163.com" ]
17722454573@163.com
da10b76422da4d609983f09617ff990553ba3de5
cb4d397ada2cec6d19b2fca54d5b16ae0f30e019
/JAVA/Work/JavaApplication/src/main/java/junittest/MyUnit.java
613c3fe1be0d30a9636e717d5786f43633e58fc4
[]
no_license
kshwang/workspace
6bb44b10b6a67c1868191c0e34e711bae8250f87
dc0ea483769e92b2c6f2c2621a60a2551105228a
refs/heads/master
2021-09-05T18:30:29.206170
2018-01-30T07:14:42
2018-01-30T07:14:42
111,064,803
0
0
null
null
null
null
UTF-8
Java
false
false
736
java
package junittest; import java.util.ArrayList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MyUnit { public String concate(String string, String string2) { return string+string2; } public boolean getBoolean() { return false; } public Object getSameObject() { return null; } public Object getObject() { return null; } public String[] getStringArray() { return new String[] {"one","two","three"}; } public double getExeception() throws ArithmeticException { throw new ArithmeticException("Not Implementes Exception"); } public ArrayList<String> getEmptyList(){ return new ArrayList<String>(); } }
[ "shl2020@naver.com" ]
shl2020@naver.com
f2fd1575fd2a09d20ef97518c1859e33d76fe29a
55aa216e191f6e396b8aaa84b1813b0337a4b0ed
/02_alumnos/AlumnosGUI/AlumnosGUI/src/com/tehenua/Todos.java
4eab22893ee0d21edbb61fd03f75cfd54380fcb5
[ "Apache-2.0" ]
permissive
TeHenua/ejercicios-ud5-gui
d40daad0c111bbbb497420686eecda08c9e7b1ef
e41af4da503b74af6a6c8104809109e81d804949
refs/heads/master
2020-05-24T16:01:24.620984
2017-03-19T16:59:03
2017-03-19T16:59:03
84,856,018
0
0
null
2017-03-13T17:34:55
2017-03-13T17:34:55
null
UTF-8
Java
false
false
5,081
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.tehenua; import java.util.ArrayList; /** * * @author TeHenua */ public class Todos extends javax.swing.JFrame { private NuevoAlumno nuevoAlumno; public void listarAlumnos(ArrayList<Alumno> alumnos){ String resultado =""; for (Alumno alumno : alumnos) { resultado +="Nombre: "+alumno.getNombre()+" Apellidos: "+ alumno.getApellidos()+" Teléfono: "+alumno.getTelefono()+ " Email: "+alumno.getEmail()+"\n"; } todosTextArea.setText(resultado); } public Todos() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); todosTextArea = new javax.swing.JTextArea(); jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jLabel1.setText("Todos los alumnos"); todosTextArea.setColumns(20); todosTextArea.setRows(5); jScrollPane1.setViewportView(todosTextArea); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(59, 59, 59) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 431, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(61, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(44, 44, 44) .addComponent(jLabel1) .addGap(18, 18, 18) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 268, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(48, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Todos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Todos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Todos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Todos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextArea todosTextArea; // End of variables declaration//GEN-END:variables /** * @return the nuevoAlumno */ public NuevoAlumno getNuevoAlumno() { return nuevoAlumno; } /** * @param nuevoAlumno the nuevoAlumno to set */ public void setNuevoAlumno(NuevoAlumno nuevoAlumno) { this.nuevoAlumno = nuevoAlumno; nuevoAlumno.setTodos(this); } }
[ "tehenua@gmail.com" ]
tehenua@gmail.com
ebbc8d7613f10ab999ed6192d67316424234637e
8c9034166fd6a8d1d62acd83c745b28c78680315
/src/ru/nsk/android/DatabaseHelper.java
fc2e1499937e78994a5df1fe82a6158ca7a5e019
[]
no_license
PavlikSvolochkov/WonderME
b9cf02a1877ad59c8d8fd97aa2dec5361c4f44b0
09d28a32bb01cd5b3d8b534cb0689e8372996c44
refs/heads/master
2016-09-06T04:14:41.771391
2014-06-05T10:23:47
2014-06-05T10:23:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
734
java
package ru.nsk.android; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class DatabaseHelper extends SQLiteOpenHelper { private static final String DATABASE_NAME = "database"; private static final String TABLE_NAME = "favorites"; public DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, 1); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL("CREATE TABLE " + TABLE_NAME + " (ID INTEGER PRIMARY KEY, title TEXT);"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME); onCreate(db); } }
[ "develop.iwork@gmail.com" ]
develop.iwork@gmail.com
493e421fd0456cf414b6f7a97abb4eca4babd469
399987e6b3b7bc85f23f516889ada36ca74e9182
/blackjack_java-master/BlackJack/model/Player.java
b1437a79945d1772060292bedf63f1fe3700c6d6
[]
no_license
ab223zm/OOAD-1
6ac1d5e7ba5815ce43827301267c984e6e303d0d
2ff6b5b0382b4dfab84626fd25639ac3ae38db05
refs/heads/master
2021-07-21T03:51:16.015887
2017-10-26T21:25:12
2017-10-26T21:25:12
108,378,894
0
0
null
2017-10-26T21:27:11
2017-10-26T07:49:35
Java
UTF-8
Java
false
false
1,390
java
package BlackJack.model; import java.util.List; import java.util.LinkedList; public class Player { private List<Card> m_hand; protected final int g_maxScore = 21; public Player() { m_hand = new LinkedList<Card>(); } public void DealCard(Card a_addToHand) { m_hand.add(a_addToHand); } public Iterable<Card> GetHand() { return m_hand; } public void ClearHand() { m_hand.clear(); } public void ShowHand() { for(Card c : m_hand) { c.Show(true); } } public int CalcScore() { // the number of scores is dependant on the number of scorable values // as it seems there is no way to do this check at compile time in java ?! // cardScores[13] = {...}; int cardScores[] = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 10 ,10 ,10, 11 }; assert (cardScores.length == Card.Value.Count.ordinal()) : "Card Scores array size does not match number of card values"; int score = 0; for(Card c : GetHand()) { if (c.GetValue() != Card.Value.Hidden) { score += cardScores[c.GetValue().ordinal()]; } } if (score > g_maxScore) { for(Card c : GetHand()) { if (c.GetValue() == Card.Value.Ace && score > g_maxScore) { score -= 10; } } } return score; } }
[ "noreply@github.com" ]
ab223zm.noreply@github.com
7431e3329ab7f5914f7f5796f2510169efb9660d
9b651826b90f9015bfedd31f1af11e7a3281184e
/pet-clinic-data/src/main/java/org/str1/str1petclinic/model/Specialty.java
9196d1a956afd16533179fc701dee6e1829517cf
[]
no_license
stoptherock1/str1-pet-clinic
ba1c5f433f31aaba94806a33e8ce56aeea4bd5d9
73b8375c06b33e81474653c539af19c43258527c
refs/heads/master
2021-07-14T12:54:34.749938
2021-07-10T15:29:33
2021-07-10T15:29:33
250,968,972
0
0
null
null
null
null
UTF-8
Java
false
false
289
java
package org.str1.str1petclinic.model; public class Specialty extends BaseEntity { private String description; public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
[ "stoptherock1@gmail.com" ]
stoptherock1@gmail.com
857049a7de3cc492cb8689203c00c25d8c5b61e6
9752c49c465f0b20d6ed413011cf7e76dade8d5c
/easyfile_project/src/logic/action/NewFileAction.java
23edf80aa824720c7a6db9441dd1c041e9f88bc4
[]
no_license
december/EasyFile
b62912823f74249491a0f60a364c9ce5cf06f3cc
9912aefa64d070f90ae9fbc0cfac3f0fb907dbbb
refs/heads/master
2016-09-06T13:49:01.002915
2014-12-11T16:44:59
2014-12-11T16:44:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,565
java
/** * 新建文件夹操作 */ package logic.action; import adapter.*; import org.apache.commons.net.ftp.FTPFile; import org.eclipse.jface.action.Action; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.MouseListener; import display.MainWindow; /** * 新建文件夹操作 * * @author Eternal_Answer * */ public class NewFileAction extends Action implements MouseListener { MainWindow window; /** * 构造函数 * * @param w * 父窗口 */ public NewFileAction(MainWindow w) { window = w; setText("New Directory"); setToolTipText(""); // setImageDescriptor(ImageDescriptor.createFromURL(EasyFileUtil.newURL( // "file:icons/manag.bmp" ))); } public void run() { InputDialog inputDialog = new InputDialog(window.getShell(), "新文件名", "", "新建文件夹", null); if (inputDialog.open() == InputDialog.OK) { System.out.println(FTPAdapter.getInstance().getCurrentFTPPath() + '/' + inputDialog.getValue()); FTPAdapter.getInstance().makeServerDirectory(FTPAdapter.getInstance().getCurrentFTPPath() + '/' + inputDialog.getValue()); window.gotoPath(window.getAddressText()); } } @Override public void mouseDoubleClick(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mouseDown(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mouseUp(MouseEvent arg0) { // TODO Auto-generated method stub } }
[ "luyunfeicx@163.com" ]
luyunfeicx@163.com
1b6e0c0948b58dd3afd322c6881e61d1870bc90e
fd5767656f2914279117d1632d16b9929cdbb1c6
/src/main/java/fr/midix/services/boireverre/model/Suggestions.java
c6763d43a9bcd149a0bd387c6a1d56e72829984e
[]
no_license
boireverre/rest-services
08d41828d62d23659956f4f202a4a25800874859
ceba4ff2d15c8ac68d64aa406208a2384ac75ede
refs/heads/master
2021-01-22T20:08:55.327073
2012-06-07T22:27:16
2012-06-07T22:27:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
519
java
package fr.midix.services.boireverre.model; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "Suggestions") public class Suggestions implements Serializable{ @Id @GeneratedValue private long id; private User user; private String message; public Suggestions() { } public Suggestions(User user, String message){ this.user = user; this.message = message; } }
[ "michel.dirix@inria.fr" ]
michel.dirix@inria.fr
189f2edd4f681c3beb06a35235d86411b5471836
038ee6b20cae51169a2ed4ed64a7b8e99b5cbaad
/schemaOrgGson/src/org/kyojo/schemaorg/m3n4/gson/core/container/AdditionalNameDeserializer.java
022eb6d0500a05a24ad053fdf23a63737141bb26
[ "Apache-2.0" ]
permissive
nagaikenshin/schemaOrg
3dec1626781913930da5585884e3484e0b525aea
4c9d6d098a2741c2dc2a814f1c708ee55c36e9a8
refs/heads/master
2021-06-25T04:52:49.995840
2019-05-12T06:22:37
2019-05-12T06:22:37
134,319,974
1
0
null
null
null
null
UTF-8
Java
false
false
1,073
java
package org.kyojo.schemaorg.m3n4.gson.core.container; import java.lang.reflect.Field; import java.lang.reflect.Type; import java.util.HashMap; import java.util.Map; import org.kyojo.gson.JsonDeserializationContext; import org.kyojo.gson.JsonDeserializer; import org.kyojo.gson.JsonElement; import org.kyojo.gson.JsonParseException; import org.kyojo.schemaorg.m3n4.core.impl.ADDITIONAL_NAME; import org.kyojo.schemaorg.m3n4.core.Container.AdditionalName; import org.kyojo.schemaorg.m3n4.gson.DeserializerTemplate; public class AdditionalNameDeserializer implements JsonDeserializer<AdditionalName> { public static Map<String, Field> fldMap = new HashMap<>(); @Override public AdditionalName deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException { if(jsonElement.isJsonPrimitive()) { return new ADDITIONAL_NAME(jsonElement.getAsString()); } return DeserializerTemplate.deserializeSub(jsonElement, type, context, new ADDITIONAL_NAME(), AdditionalName.class, ADDITIONAL_NAME.class, fldMap); } }
[ "nagai@nagaikenshin.com" ]
nagai@nagaikenshin.com
84d5fb97770cabe1c8f8a359d000c8ca00635c88
043ea81ef6bbfe3f4a4607604fe15725fcea1067
/app/controllers/SongController.java
72a0cd18b2c32662d36ebeb3d0e1f7d41975859a
[]
no_license
BHS551/primero
cb0504ebc3b9bd8f33277ab825b5538ee7577ded
58b1d73d3b4b681d250dd14c8cf5b9f6a46ce935
refs/heads/master
2021-05-08T00:58:54.826088
2017-12-03T02:59:40
2017-12-03T02:59:40
107,831,480
0
0
null
null
null
null
UTF-8
Java
false
false
2,009
java
package controllers; import play.data.Form; import play.data.FormFactory; import play.mvc.Controller; import java.util.List; import com.google.inject.Inject; import models.Song; import play.mvc.Result; import views.html.*; public class SongController extends Controller{ @Inject FormFactory formFactory; // Todas las canciones public Result index() { List<Song> songs = Song.find.all(); return ok(songIndex.render(songs)); } // Crear cancion public Result create() { Form<Song> songForm = formFactory.form(Song.class); return ok(songCreate.render(songForm)); } // Salvar cancion // Todas las canciones public Result save() { Song song = formFactory.form(Song.class).bindFromRequest().get(); song.save(); return redirect(routes.SongController.index()); } public Result edit(Integer id) { Song song = Song.find.byId(id); System.out.print(song.toString()); if(song == null) { return notFound("Song Not Found"); } Form<Song> songForm = formFactory.form(Song.class).fill(song) ; return ok(songEdit.render(songForm)); } public Result update() { Song song = formFactory.form(Song.class).bindFromRequest().get(); Song oldSong = Song.find.byId(song.id); if(oldSong == null) { return notFound("Song Not Found"); } oldSong.author = song.author; oldSong.length = song.length; oldSong.name = song.name; oldSong.update(); return redirect(routes.SongController.index()); } // detalles del libro public Result show(Integer id) { Song song = Song.find.byId(id); if(song == null) { return notFound("Song not found"); } return ok(songShow.render(song)); } public Result destroy(Integer id) { Song song = Song.find.byId(id); if(song == null){ return notFound("Song Not Found"); } song.delete(); return redirect(routes.SongController.index()); } public Result prueba() { return ok(prueba.render()); } }
[ "551brayham@gmail.com" ]
551brayham@gmail.com
7a8dc7cad4cb45570e310bf26adcfea841335ba6
0116632674798a293a6a35b4fa60aa66c178ad5f
/loncontoBoot/src/main/java/com/loncoto/loncontoBoot/metier/Intervention.java
39816c6097b72b0b5b252bb6cd2c433f24044e53
[]
no_license
otmanel31/loncotoBoot
3f9ead2eb1b6796abf2ec21215dc31d24b305c09
14e79e3308402245718e4354fe239af279e1af95
refs/heads/master
2021-05-11T13:35:43.624626
2018-03-12T17:14:57
2018-03-12T17:14:57
117,684,370
0
0
null
null
null
null
UTF-8
Java
false
false
1,345
java
package com.loncoto.loncontoBoot.metier; import java.time.LocalDateTime; import javax.annotation.Generated; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.OneToOne; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; @Entity @Getter @Setter @NoArgsConstructor @ToString(exclude= {"equipment","intervenant"}) public class Intervention { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private int id; private String singleInterventionNumber; private LocalDateTime interventionDate; private LocalDateTime dateOfCompletion; private String status; private String comment; @ManyToOne private Materiel equipment; @ManyToOne private Intervenant intervenant; public Intervention(int id, String singleInterventionNumber, LocalDateTime interventionDate, LocalDateTime dateOfCompletion, String status, String comment) { this.id = id; this.singleInterventionNumber = singleInterventionNumber; this.interventionDate = interventionDate; this.dateOfCompletion = dateOfCompletion; this.status = status; this.comment = comment; } }
[ "oelkenz@LFR021182.corp.capgemini.com" ]
oelkenz@LFR021182.corp.capgemini.com
d52790a75628693f711679ddedc48ef146f6e49a
96deacc07937cd9c29f255dbe8f7fc3827bf1251
/eap/eap.comps.codetable/src/main/java/eap/comps/codetable/CodeTable.java
4b9a2818f7f476eaf5e7b2ea440e884a206fd57b
[ "Apache-2.0" ]
permissive
shefansxyh/eap
54c4d0125c72afa425a7b8235e1ebadc43d8a440
fe914cdadb232ac887b5032491faa498428a696e
refs/heads/master
2020-05-26T10:20:58.475037
2014-04-07T15:02:50
2014-04-09T13:58:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
14,687
java
package eap.comps.codetable; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.util.CollectionUtils; import org.springframework.util.MultiValueMap; import eap.EapContext; import eap.Env; import eap.comps.codetable.collector.SqlCollector; /** * <p> Title: </p> * <p> Description: </p> * @作者 chiknin@gmail.com * @创建时间 * @版本 1.00 * @修改记录 * <pre> * 版本 修改人 修改时间 修改内容描述 * ---------------------------------------- * * ---------------------------------------- * </pre> */ public class CodeTable { private static final Logger logger = LoggerFactory.getLogger(CodeTable.class); /** 代码组别分隔符 */ public static final String CODE_GROUP_SEPARATOR = " |,;"; public static final String SELECT_OPTION_ITEM_LABLE = "codeName"; public static final String SELECT_OPTION_ITEM_VALUE = "codeValue"; /** ComboItem空选项值 */ public static final String COMBO_ITEM_EMPTY_HEADER_VALUE = ""; /** ComboItem空选项(text="请选择") */ public static final String[] COMBO_ITEM_CHOICE_HEADER = {COMBO_ITEM_EMPTY_HEADER_VALUE, "请选择"}; /** 代码集合缓存 */ private static Map<String, Object> cache = new ConcurrentHashMap<String,Object>(); // private static String cacheKeyPrefix = "$ct_"; private static boolean autoCollector = true; private static JdbcTemplate jdbcTemplate; private static String defaultUseCollector; private static Map<String, ICodeTableCollector> collectors; private static MultiValueMap<String, String> refreshSceneMap = CollectionUtils.toMultiValueMap(new HashMap<String, List<String>>()); // private static String sqlCollectorPropertiesPath; public void init() throws Exception { if (autoCollector) { refreshSceneMap.clear(); Env env = EapContext.getEnv(); String autoCollectors = env.getProperty("codeTable.autoCollectors", ""); String[] autoCollectorArray = StringUtils.split(autoCollectors, ","); if (autoCollectorArray.length > 0) { for (String autoCollector : autoCollectorArray) { if (collectors == null) { collectors = new HashMap<String, ICodeTableCollector>(); } if (!collectors.containsKey(autoCollector)) { SqlCollector collector = new SqlCollector(); collector.setJdbcTemplate(jdbcTemplate); collector.setCollectSql(env.getProperty(String.format("codeTable.%s.collectSql", autoCollector))); collector.setSingleCollectSql(env.getProperty(String.format("codeTable.%s.singleCollectSql", autoCollector))); String refreshScenes = env.getProperty(String.format("codeTable.%s.refresh", autoCollector), ""); String[] refreshSceneArray = StringUtils.split(refreshScenes, ","); if (refreshSceneArray.length > 0) { for (String refreshScene : refreshSceneArray) { refreshSceneMap.add(refreshScene, autoCollector); } } collectors.put(autoCollector, collector); } } } } loadAll(); } public static synchronized void refresh() { // synchronized (cache) { loadAll(); // } } public static synchronized void refresh(String codeType) { if (StringUtils.isBlank(codeType)) { return; } // synchronized (cache) { String collector = null; if (!collectors.containsKey(codeType) && StringUtils.isNotBlank(defaultUseCollector)) { collector = defaultUseCollector; } else { collector = codeType; } if (StringUtils.isNotBlank(collector)) { List<CodeTableVO> codeTableVOList = collectors.get(collector).collect(codeType); putToCache(codeTableVOList); } // } } public static void clear(String codeType) { if (StringUtils.isBlank(codeType)) { return; } cache.remove(getCacheKey(codeType)); } public static void clearByScene(String scene) { List<String> refreshCodeList = refreshSceneMap.get(scene); if (refreshCodeList != null && refreshCodeList.size() > 0) { for (String refreshCode : refreshCodeList) { clear(refreshCode); } } } /** * 根据代码类型获取代码列表 * 所有Code操作方法入口类 * @param codeType 代码类型 * @return 代码列表 */ public static List<CodeTableVO> getCodes(String codeType) { List<CodeTableVO> codeVOList = (List<CodeTableVO>) cache.get(getCacheKey(codeType)); if (codeVOList == null) { refresh(codeType); codeVOList = (List<CodeTableVO>) cache.get(getCacheKey(codeType)); } return codeVOList != null ? codeVOList : Collections.EMPTY_LIST; } /** * 根据代码类型和代码键获取代码 * @param codeType 代码类型 * @param key 代码键 * @return 代码 */ public static CodeTableVO getCode(String codeType, String key) { List<CodeTableVO> codeVOList = getCodes(codeType); if (codeVOList != null && codeVOList.size() > 0) { for (CodeTableVO codeVO : codeVOList) { if (codeVO.getCodeKey().equals(key)) { return codeVO; } } } return null; } /** * 根据代码类型和代码值获取代码 * @param codeType 代码类型 * @param value 代码值 * @return 代码 */ public static CodeTableVO getCodeByValue(String codeType, String value) { if (StringUtils.isBlank(value)) { return null; } List<CodeTableVO> codeVOList = getCodes(codeType); if (codeVOList != null && codeVOList.size() > 0) { for (CodeTableVO codeVO : codeVOList) { // if (codeVO.getCodeValue().equals(value)) { if (value.equals(codeVO.getCodeValue())) { return codeVO; } } } return null; } /** * 根据代码类型和代码值获取组 * @param codeType 代码类型 * @param value 代码值 * @return 代码 */ public static String getGroupByValue(String codeType, String value) { if (StringUtils.isBlank(value)) { return null; } List<CodeTableVO> codeVOList = getCodes(codeType); if (codeVOList != null && codeVOList.size() > 0) { for (CodeTableVO codeVO : codeVOList) { if (codeVO.getCodeValue().equals(value)) { return codeVO.getCodeGroup(); } } } return null; } /** * 根据代码类型获取代码列表, 并转化为Map类型,Map-key为代码键,Map-value为代码值 * @param codeType 代码类型 * @param groups 组别 * @return 代码列表转换后的Map */ public static Map<String, String> getCodesAsMap(String codeType, String... groups) { List<CodeTableVO> codeList = getCodes(codeType, groups); if (codeList != null && codeList.size() > 0) { Map<String, String> codeMap = new HashMap<String, String>(); for (CodeTableVO code : codeList) { codeMap.put(code.getCodeKey(), code.getCodeValue()); } return codeMap; } return null; } /** * 根据代码类型和代码组别列表获取代码列表 * @param codeType 代码类型 * @param groups 代码组别列表 * @return 代码列表 */ public static List<CodeTableVO> getCodes(String codeType, String... groups) { if (groups == null || groups.length == 0 || groups[0] == null) { return getCodes(codeType); } List<CodeTableVO> codeVOList = getCodes(codeType); if (codeVOList != null && codeVOList.size() > 0) { List<CodeTableVO> result = new ArrayList<CodeTableVO>(); for (CodeTableVO codeVO : codeVOList) { String[] codeGroups = StringUtils.split(codeVO.getCodeGroup(), CODE_GROUP_SEPARATOR); if (codeGroups == null || codeGroups.length == 0) { continue; } for (String group : groups) { int index = ArrayUtils.indexOf(codeGroups, group); if (index > -1) { result.add(codeVO); } } } return result; } return Collections.EMPTY_LIST; } /** * 根据代码类型和代码键获取代码值 * @param codeType 代码类型 * @param key 代码键 * @return 代码值 */ public static String getValue(String codeType, String key) { CodeTableVO codeVO = getCode(codeType, key); if (codeVO != null) { return codeVO.getCodeValue(); } return null; } /** * 根据代码类型和代码名称获取代码值 * @param codeType 代码类型 * @param name 代码名称 * @return 代码值 */ public static String getValueByName(String codeType, String name) { List<CodeTableVO> codeVOList = getCodes(codeType); if (codeVOList != null && codeVOList.size() > 0) { for (CodeTableVO code : codeVOList) { if (StringUtils.equals(name, code.getCodeName())) { return code.getCodeValue(); } } } return null; } /*** * 根据代码类型获取代码列表, 获取列表列表首个代码值 * @param codeType 代码类型 * @return 首个代码值 */ public static String getValueOfFirstCodes(String codeType) { List<CodeTableVO> codes = getCodes(codeType); if (codes != null && codes.size() > 0) { return codes.get(0).getCodeValue(); } return null; } /** * 根据代码类型和代码键获取代码名称 * @param codeType 代码类型 * @param key 代码键 * @return 代码名称 */ public static String getName(String codeType, String key) { CodeTableVO codeVO = getCode(codeType, key); if (codeVO != null) { return codeVO.getCodeName(); } return null; } public static List<String> getNames(String codeType){ List<CodeTableVO> voList = getCodes(codeType); List<String> codeNames = new ArrayList<String>(voList.size()); for(CodeTableVO vo : voList){ codeNames.add(vo.getCodeName()); } return codeNames; } public static String getName(String codeType, Object key) { if (key != null) { return getName(codeType, key.toString()); } return null; } /** * 根据代码类型和代码值获取代码名称 * @param codeType 代码类型 * @param value 代码值 * @return 代码名称 */ public static String getNameByValue(String codeType, String value) { CodeTableVO codeVO = getCodeByValue(codeType, value); if (codeVO != null) { return codeVO.getCodeName(); } return null; } /** * 根据代码类型或代码键获取代码值, 是否等于目标值,如果等于返回true, 否之false * @param codeType 代码类型 * @param key 代码键 * @param descValue 目标值 * @return true 或 false */ public static boolean eqValue(String codeType, String key, Object descValue) { String srcValue = getValue(codeType, key); if (StringUtils.isBlank(srcValue)) { return false; } if (descValue == null) { return false; } return srcValue.equals(descValue.toString()); } public static boolean neValue(String codeType, String key, Object descValue) { return !eqValue(codeType, key, descValue); } public static List<CodeTableVO> getComboItems(String codeType, String[] header, String... groups) { if (header == null || header.length != 2) { return getCodes(codeType, groups); } List<CodeTableVO> items = new ArrayList<CodeTableVO>(); // codes.size + 1 items.add(new CodeTableVO(codeType, header[0], header[1])); items.addAll(getCodes(codeType, groups)); return items; } public static List<CodeTableVO> getComboItemsIncludeChoiceHeader(String codeType, String... groups) { return getComboItems(codeType, COMBO_ITEM_CHOICE_HEADER, groups); } private static void loadAll() { cache.clear(); if (collectors != null && collectors.size() > 0) { Collection<ICodeTableCollector> ctcList = collectors.values(); for (ICodeTableCollector ctc : ctcList) { putToCache(ctc.collect()); } } logger.info("codetable all loaded"); } private static void putToCache(List<CodeTableVO> codeTableVOList) { if (codeTableVOList == null || codeTableVOList.size() == 0) { return; } Map<String, List<CodeTableVO>> container = new HashMap<String, List<CodeTableVO>>(); for (CodeTableVO codeTableVO : codeTableVOList) { String codeType = codeTableVO.getCodeType(); List<CodeTableVO> values = container.get(codeType); if (values == null) { values = new ArrayList<CodeTableVO>(); } values.add(codeTableVO); container.put(codeType, values); } for (Map.Entry<String, List<CodeTableVO>> entry : container.entrySet()) { cache.put(getCacheKey(entry.getKey()), entry.getValue()); } } private static String getCacheKey(String codeType) { // return cacheKeyPrefix + codeType; return codeType; } // public void setCacheKeyPrefix(String ckp) { // cacheKeyPrefix = ckp; // } public void setAutoCollector(boolean ac) { autoCollector = ac; } public void setJdbcTemplate(JdbcTemplate jt) { jdbcTemplate = jt; } public void setDefaultUseCollector(String duc) { defaultUseCollector = duc; } public void setCollectors(Map<String, ICodeTableCollector> cs) { collectors = cs; } // public void setSqlCollectorPropertiesPath(String path) { // sqlCollectorPropertiesPath = path; // if (StringUtils.isNotBlank(path)) { // if (collectors == null) { // collectors = new HashMap<String, ICodeTableCollector>(); // // } // } // } // public static void main(String[] args) { // ApplicationContext appCtx = new ClassPathXmlApplicationContext("classpath:AC.xml"); // // List<CodeTableVO> codes = CodeTable.getCodes("Sex"); // for (CodeTableVO code : codes) { // System.out.println( ToStringBuilder.reflectionToString(code) ); // } // // CodeTable.getCodes("Sex", "GroupA", "GroupB"); // // // System.out.println( CodeTable.getCode("Sex", "S1") ); // System.out.println( CodeTable.getCodeByValue("Sex", "1") ); // System.out.println( CodeTable.getCodesAsMap("Sex") ); // System.out.println( CodeTable.getCodesAsMap("Sex", "GroupA", "GroupB") ); // // // System.out.println( CodeTable.getName("Sex", "S1") ); // System.out.println( CodeTable.getNameByValue("Sex", "1") ); // // System.out.println( CodeTable.getValue("Sex", "S1") ); // // System.out.println( CodeTable.eqValue("Sex", "S1", "1") ); // System.out.println( CodeTable.neValue("Sex", "S1", "1") ); // } }
[ "chiknin@gmail.com" ]
chiknin@gmail.com
ee5261a249e84230bbe0915877f9a4ac36bd6405
2aad392a24a1d5e8750aa3a866d20f73f9635737
/app/src/main/java/e/hp/gll3ry/imageadapter.java
3aee0a077200094db2172199b8e0b3d7d5100b80
[]
no_license
anshulkhattar/Gallery
0ef0e123a9dce027638a7869b8874bfc0f348ace
7b47e08dd0fb66b3048dbbda9b8fad8c2c57c1cf
refs/heads/master
2020-03-13T05:16:40.703845
2018-04-25T09:09:59
2018-04-25T09:09:59
129,035,240
0
0
null
null
null
null
UTF-8
Java
false
false
1,669
java
package e.hp.gll3ry; import android.content.Context; import android.media.Image; import android.provider.MediaStore; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.GridView; import android.widget.ImageView; import static android.widget.ImageView.*; public class imageadapter extends BaseAdapter{ private Context context; public Integer[] images={ R.drawable.pic1, R.drawable.pic2, R.drawable.pic3, R.drawable.pic4, R.drawable.pic5, R.drawable.pic6, R.drawable.pic7, R.drawable.pic8, R.drawable.pic9, R.drawable.pic10, R.drawable.pic11, R.drawable.pic12, R.drawable.pic13, R.drawable.pic14, R.drawable.pic15, R.drawable.pic17, R.drawable.pic18, R.drawable.pic19, R.drawable.pic20 }; public imageadapter(Context a){context=a;} @Override public int getCount() { return images.length; } @Override public Object getItem(int position) { return images[position]; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView= new ImageView(context); imageView.setScaleType(ScaleType.CENTER_INSIDE); imageView.setImageResource(images[position]); imageView.setLayoutParams(new GridView.LayoutParams(240,240)); return imageView; } }
[ "anshul070300@gmail.com" ]
anshul070300@gmail.com
838a41209a5ef2701e1d2adb443a78e35ac19af3
276ea67c91d6614f0746a6cda05c01593b5d83b5
/app/src/main/java/ml/easycoins/easycoins/MainActivity.java
53e2984bbad315fe59ec358421238ccc514834a2
[]
no_license
yogannnn/Easycoins
b8f619848ef0877c37448281a4159bc4f552b5ed
1540c318fb8b999406f9c12075369f90fcedbabb
refs/heads/master
2021-10-19T04:43:45.001294
2019-02-18T01:20:20
2019-02-18T01:20:20
171,226,024
0
0
null
null
null
null
UTF-8
Java
false
false
4,634
java
package ml.easycoins.easycoins; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; import android.preference.PreferenceManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class MainActivity extends AppCompatActivity implements OnClickListener { Button btnGame; Button btnLast; Button btnBonus; Button btnAuto; Button btnPopoln; Button btnVivod; Button btnSet; Button btnUser; Button btnLogin; private static SharedPreferences sPref; String sid; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate (savedInstanceState); setContentView (R.layout.activity_main); setElements(); } protected void onResume() { super.onResume (); setElements(); } protected void onRestart() { super.onRestart (); setElements(); } private void setElements(){ sPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); sid = sPref.getString ("sid", ""); btnGame = (Button) findViewById (R.id.btnGame); btnGame.setOnClickListener (this); if (sid.length () < 32) { btnGame.setEnabled (false); btnGame.setTextColor (Color.GRAY); } btnLast = (Button) findViewById (R.id.btnLast); btnLast.setOnClickListener (this); btnBonus = (Button) findViewById (R.id.btnBonus); btnBonus.setOnClickListener (this); if (sid.length () < 32) { btnBonus.setEnabled (false); btnBonus.setTextColor (Color.GRAY); } btnAuto = (Button) findViewById (R.id.btnAuto); btnAuto.setOnClickListener (this); if (sid.length () < 32) { btnAuto.setEnabled (false); btnAuto.setTextColor (Color.GRAY); } btnPopoln = (Button) findViewById (R.id.btnPopoln); btnPopoln.setOnClickListener (this); if (sid.length () < 32) { btnPopoln.setEnabled (false); btnPopoln.setTextColor (Color.GRAY); } btnVivod = (Button) findViewById (R.id.btnVivod); btnVivod.setOnClickListener (this); if (sid.length () < 32) { btnVivod.setEnabled (false); btnVivod.setTextColor (Color.GRAY); } btnSet = (Button) findViewById (R.id.btnSet); btnSet.setOnClickListener (this); btnUser = (Button) findViewById (R.id.btnUser); btnUser.setOnClickListener (this); if (sid.length () < 32) { btnUser.setEnabled (false); btnUser.setTextColor (Color.GRAY); } btnLogin = (Button) findViewById (R.id.btnLogin); btnLogin.setOnClickListener (this); if (sid.length () < 32) { btnLogin.setText ("\uf2f6"); } else { btnLogin.setText ("\uf2f5"); } } @Override public void onClick(View v) { Intent intent; switch (v.getId ()) { case R.id.btnGame: intent = new Intent (this, Game.class); startActivity (intent); break; case R.id.btnLast: intent = new Intent (this, Last.class); startActivity (intent); break; case R.id.btnBonus: intent = new Intent (this, Bonus.class); startActivity (intent); break; case R.id.btnAuto: intent = new Intent (this, Auto.class); startActivity (intent); break; case R.id.btnPopoln: intent = new Intent (this, Popoln.class); startActivity (intent); break; case R.id.btnVivod: intent = new Intent (this, Vivod.class); startActivity (intent); break; case R.id.btnSet: intent = new Intent (this, Set.class); startActivity (intent); break; case R.id.btnUser: intent = new Intent (this, User.class); startActivity (intent); break; case R.id.btnLogin: intent = new Intent (this, Login.class); startActivity (intent); break; default: break; } } }
[ "yogannnn@gmail.com" ]
yogannnn@gmail.com
93eead8bd51d134303b044242b62336a2e694504
0e1bae24ca1a092c597a73c58d4dab23064bf888
/src/main/java/com/vivi7865/Network/Manager/api/Manager.java
c9d895a90d369a6d02ddad204f33e9b664090f47
[ "MIT" ]
permissive
Hyroli/NetworkManager
de3123dbf23536792288e4f8108ba2615b1f4532
247a03b868e27edead062d389d13d15c3bb7d582
refs/heads/master
2016-09-06T07:15:51.351567
2015-01-19T20:10:22
2015-01-19T20:10:22
29,087,507
0
0
null
null
null
null
UTF-8
Java
false
false
69
java
package com.vivi7865.Network.Manager.api; public class Manager { }
[ "me@vivi7865.com" ]
me@vivi7865.com
fb65fe40f57e0bc666a8c915a5a0de8fd4032240
a0e5af30fc51dce6edc54f959fb51c79a650f830
/mlutithead-pattern/src/main/java/one/suspension/Main.java
ee491acd18f875dca2853385e65743744cf65b68
[ "Apache-2.0" ]
permissive
chenwei182729/senior2021
a12996167a62696af49e40d97212db3ed401764c
82f9eaa9c5527202a434a0612099542aedae6a9c
refs/heads/main
2023-03-23T16:30:29.488593
2021-03-13T14:56:19
2021-03-13T14:56:19
327,779,257
0
0
null
null
null
null
UTF-8
Java
false
false
341
java
package one.suspension; /** * @author chenxinwei * @date 2020/12/29 18:32 **/ public class Main { public static void main(String[] args) { RequestQueue requestQueue = new RequestQueue(); new ClientThread(requestQueue,"Alice",3141592L).start(); new ServerThread(requestQueue,"Bobby",6535897L).start(); } }
[ "chenwei182729@163.com" ]
chenwei182729@163.com
c83ea3652693017e5c429c008824b7302de56fac
566d2b593ea11b940f230667ca3e1bd4ecd0875e
/shared-source/src/edu/ucsb/adl/LuceneGeospatialQueryConverter.java
18e56f55b37d210b4ba138423ab51ae1bf65a03c
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
NCAR/dls-repository-stack
a2fc4e9f2ebde2b4efce2316bc6f0099f64268c0
8e19d6a9a3390ce3e3e1031ea8d0f4c5db6eb7d3
refs/heads/master
2021-01-20T02:37:15.086260
2017-03-10T19:00:52
2017-03-10T19:00:52
72,246,023
2
1
NOASSERTION
2019-12-03T17:47:06
2016-10-28T22:03:11
Java
UTF-8
Java
false
false
21,762
java
/////////////////////////////////////////////////////////////////////////////// // // // ALEXANDRIA DIGITAL LIBRARY // // University of California at Santa Barbara // // // // ------------------------------------------------------------------------- // // // // Copyright (c) 2004 by the Regents of the University of California // // All rights reserved // // // // Redistribution and use in source and binary forms, with or without // // modification, are permitted provided that the following conditions are // // met: // // // // 1. Redistributions of source code must retain the above copyright // // notice, this list of conditions, and the following disclaimer. // // // // 2. Redistributions in binary form must reproduce the above copyright // // notice, this list of conditions, and the following disclaimer in // // the documentation and/or other materials provided with the // // distribution. // // // // 3. All advertising materials mentioning features or use of this // // software must display the following acknowledgement: This product // // includes software developed by the Alexandria Digital Library, // // University of California at Santa Barbara, and its contributors. // // // // 4. Neither the name of the University nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND ANY // // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE // // DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR // // ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL // // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS // // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN // // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // // /////////////////////////////////////////////////////////////////////////////// package edu.ucsb.adl; import java.text.DecimalFormat; import org.apache.lucene.index.Term; import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.Query; import org.apache.lucene.search.TermRangeQuery; import org.apache.lucene.search.TermQuery; /** * Converts a geospatial query to a <a target="_top" href="http://jakarta.apache.org/lucene/">Lucene</a> * query. <p> * * The conversion assumes that each Lucene document optionally has associated with it a <em>geographic * footprint</em> (a geographic region representing the document's area of relevance) in the form of a <em> * box</em> (defined below). A <em>geospatial query</em> takes a query region (also in the form of a box) and * a spatial predicate (e.g., "<code>overlaps</code>") and returns all documents that 1) have a geographic * footprint that 2) has the predicate relationship to the query region. <p> * * Formally, a <em>box</em> is a geographic region defined by north and south bounding coordinates (latitudes * expressed in degrees north of the equator and in the range [-90,90]) and east and west bounding * coordinates (longitudes expressed in degrees east of the Greenwich meridian and in the range [-180,180]). * The north bounding coordinate must be greater than or equal to the south. The west bounding coordinate may * be less than, equal to, or greater than the east; in the latter case, a box that crosses the * &plusmn;180&deg; meridian is described. As a special case, the set of all longitudes is described by a * west bounding coordinate of -180 and an east bounding coordinate of 180. <p> * * Boxes must be represented in Lucene as four indexed, <strong>non-tokenized</strong> fields holding the * four bounding coordinates. In addition, in order to emulate numeric comparisons using lexicographic * comparisons, before insertion into Lucene <strong>bounding coordinates must be encoded using the {@link * #encodeLatitude(double) encodeLatitude} and {@link #encodeLongitude(double) encodeLongitude} functions * </strong> supplied by this class. <p> * * Two limitations: first, this converter assumes that each Lucene document has at most one associated * geographic footprint. Second, this converter assumes that <em>no</em> document footprint crosses the * &plusmn;180&deg; meridian. However, query regions that cross the &plusmn;180&deg; meridian are allowed and * are handled correctly, as are all discontinuities involving that meridian and the poles. * * @author <a href="mailto:gjanee@alexandria.ucsb.edu">Greg Jan&eacute;e</a> <br> * <a href="http://www.alexandria.ucsb.edu/">Alexandria Digital Library Project</a> <p> * * */ public class LuceneGeospatialQueryConverter { private LuceneGeospatialQueryConverter() { } /** * Converts a geospatial query to a Lucene query. Assumes the fields containing the bounds are named * northCoord, southCoord, eastCoord, and westCoord. * * @param predicate The spatial predicate, which must be "<code>contains</code>", "<code>overlaps</code> * ", or "<code>within</code>". * @param north The north bounding coordinate of the query region. * @param south The south bounding coordinate of the query region. * @param east The east bounding coordinate of the query region. * @param west The west bounding coordinate of the query region. * @return Lucene Query * @exception NumberFormatException If unable to convert bounding coordinate String to double * @throws IllegalArgumentException If <code>predicate</code> is not one of the three supported spatial * predicates; if <code>north</code> or <code>south</code> are outside the range [-90,90]; if <code>north</code> * is less than <code>south</code>; or if <code>east</code> or <code>west</code> are outside the range * [-180,180]. */ public static Query convertQuery(String predicate, String north, String south, String east, String west) throws IllegalArgumentException, NumberFormatException { double northVal = 0d; double southVal = 0d; double eastVal = 0d; double westVal = 0d; try { northVal = Double.parseDouble(north); } catch (Exception e) { throw new NumberFormatException("Illegal north coordinate: " + e.getMessage()); } try { southVal = Double.parseDouble(south); } catch (Exception e) { throw new NumberFormatException("Illegal south coordinate: " + e.getMessage()); } try { eastVal = Double.parseDouble(east); } catch (Exception e) { throw new NumberFormatException("Illegal east coordinate: " + e.getMessage()); } try { westVal = Double.parseDouble(west); } catch (Exception e) { throw new NumberFormatException("Illegal west coordinate: " + e.getMessage()); } return convertQuery("northCoord", "southCoord", "eastCoord", "westCoord", predicate, northVal, southVal, eastVal, westVal); } /** * Converts a geospatial query to a Lucene query. * * @param northField The Lucene field holding north bounding coordinates. * @param southField The Lucene field holding south bounding coordinates. * @param eastField The Lucene field holding east bounding coordinates. * @param westField The Lucene field holding west bounding coordinates. * @param predicate The spatial predicate, which must be "<code>contains</code>", "<code>overlaps</code> * ", or "<code>within</code>". * @param north The north bounding coordinate of the query region. * @param south The south bounding coordinate of the query region. * @param east The east bounding coordinate of the query region. * @param west The west bounding coordinate of the query region. * @return Lucene Query * @throws IllegalArgumentException If <code>predicate</code> is not one of the three supported spatial * predicates; if <code>north</code> or <code>south</code> are outside the range [-90,90]; if <code>north</code> * is less than <code>south</code>; or if <code>east</code> or <code>west</code> are outside the range * [-180,180]. */ public static Query convertQuery( String northField, String southField, String eastField, String westField, String predicate, double north, double south, double east, double west) throws IllegalArgumentException { if (predicate == null || (!predicate.equals("within") && !predicate.equals("overlaps") && !predicate.equals("contains"))) { throw new IllegalArgumentException("Illegal or missing spatial predicate. Must be one of [within|contains|overlaps]."); } if (north < -90.0 || north > 90.0) { throw new IllegalArgumentException("North out of range. Must be a value from -90 to 90."); } if (south < -90.0 || south > 90.0) { throw new IllegalArgumentException("South out of range. Must be a value from -90 to 90."); } if (north < south) { throw new IllegalArgumentException("North cannot be less than south"); } if (east < -180.0 || east > 180.0) { throw new IllegalArgumentException("East out of range. Must be a value from -180 to 180."); } if (west < -180.0 || west > 180.0) { throw new IllegalArgumentException("Wast out of range. Must be a value from -180 to 180."); } if (north == -90.0) { if (predicate.equals("contains") || predicate.equals("overlaps")) { return EQ_lat(southField, -90.0); } else { // within return EQ_lat(northField, -90.0); } } else if (south == 90.0) { if (predicate.equals("contains") || predicate.equals("overlaps")) { return EQ_lat(northField, 90.0); } else { // within return EQ_lat(southField, 90.0); } } else { if (west > east) { if (west == 180.0) { west = -180.0; } else if (east == -180.0) { east = 180.0; } } if (west <= east) { if (predicate.equals("contains")) { Query q = AND(GE_lat(northField, north), LE_lat(southField, south)); if (west == east && (west == 180.0 || west == -180.0)) { q = AND(q, OR(EQ_lon(eastField, 180.0), EQ_lon(westField, -180.0))); } else { q = AND(q, AND(GE_lon(eastField, east), LE_lon(westField, west))); } return q; } else if (predicate.equals("within")) { Query ns = null; Query outerNs = null; if (north == 90.0) { outerNs = EQ_lat(southField, 90.0); } else { ns = LE_lat(northField, north); } if (south == -90.0) { outerNs = OR(outerNs, EQ_lat(northField, -90.0)); } else { ns = AND(ns, GE_lat(southField, south)); } Query ew = null; Query outerEw = null; if (west != -180.0 || east != 180.0) { if (east == 180.0 || east == -180.0) { outerEw = EQ_lon(eastField, -180.0); } else { ew = LE_lon(eastField, east); } if (west == 180.0 || west == -180.0) { outerEw = OR(outerEw, EQ_lon(westField, 180.0)); } else { ew = AND(ew, GE_lon(westField, west)); } ew = OR(ew, outerEw); } Query q; if (ew != null) { q = OR(AND(ns, ew), outerNs); } else { if (ns != null) { q = ns; } else { // constant true; all documents match q = GE_lat(northField, -90.0); } } return q; } else { // overlaps Query ns = null; Query outerNs = null; if (north == 90.0) { outerNs = EQ_lat(southField, 90.0); } else { ns = LE_lat(southField, north); } if (south == -90.0) { outerNs = OR(outerNs, EQ_lat(northField, -90.0)); } else { ns = AND(ns, GE_lat(northField, south)); } Query ew = null; Query outerEw = null; if (west != -180.0 || east != 180.0) { if (east == 180.0 || east == -180.0) { outerEw = EQ_lon(westField, -180.0); } else { ew = LE_lon(westField, east); } if (west == 180.0 || west == -180.0) { outerEw = OR(outerEw, EQ_lon(eastField, 180.0)); } else { ew = AND(ew, GE_lon(eastField, west)); } ew = OR(ew, outerEw); } Query q; if (ew != null) { q = OR(AND(ns, ew), outerNs); } else { if (ns != null) { q = ns; } else { // constant true; all documents match q = GE_lat(northField, -90.0); } } return q; } } else { if (predicate.equals("contains")) { return AND(GE_lat(northField, north), AND(LE_lat(southField, south), AND(EQ_lon(eastField, 180.0), EQ_lon(westField, -180.0)))); } else if (predicate.equals("within")) { Query ns = null; Query outerNs = null; if (north == 90.0) { outerNs = EQ_lat(southField, 90.0); } else { ns = LE_lat(northField, north); } if (south == -90.0) { outerNs = OR(outerNs, EQ_lat(northField, -90.0)); } else { ns = AND(ns, GE_lat(southField, south)); } return OR(AND(ns, OR(LE_lon(eastField, east), GE_lon(westField, west))), outerNs); } else { // overlaps Query ns = null; Query outerNs = null; if (north == 90.0) { outerNs = EQ_lat(southField, 90.0); } else { ns = LE_lat(southField, north); } if (south == -90.0) { outerNs = OR(outerNs, EQ_lat(northField, -90.0)); } else { ns = AND(ns, GE_lat(northField, south)); } return OR(AND(ns, OR(LE_lon(westField, east), GE_lon(eastField, west))), outerNs); } } } } private static Query EQ_lat(String field, double value) { return new TermQuery(new Term(field, encodeLatitude(value))); } private static Query GE_lat(String field, double value) { if (value == 90.0) { return EQ_lat(field, value); } else { return new TermRangeQuery (field, encodeLatitude(value),encodeLatitude(90.0),true,true); } } private static Query LE_lat(String field, double value) { if (value == -90.0) { return EQ_lat(field, value); } else { return new TermRangeQuery(field, encodeLatitude(-90.0),encodeLatitude(value),true,true); } } private static Query EQ_lon(String field, double value) { return new TermQuery(new Term(field, encodeLongitude(value))); } private static Query GE_lon(String field, double value) { if (value == 180.0) { return EQ_lon(field, value); } else { return new TermRangeQuery (field, encodeLongitude(value), encodeLongitude(180.0),true,true); } } private static Query LE_lon(String field, double value) { if (value == -180.0) { return EQ_lon(field, value); } else { return new TermRangeQuery (field,encodeLongitude(-180.0),encodeLongitude(value),true,true); } } private static Query AND(Query q1, Query q2) { if (q1 == null) return q2; if (q2 == null) return q1; if (q1 instanceof BooleanQuery && ((BooleanQuery) q1).getClauses()[0].isRequired()) { if (q2 instanceof BooleanQuery && ((BooleanQuery) q2).getClauses()[0].isRequired()) { BooleanClause[] clauses = ((BooleanQuery) q2).getClauses(); for (int i = 0; i < clauses.length; ++i) { ((BooleanQuery) q1).add(clauses[i]); } } else { ((BooleanQuery) q1).add(q2, BooleanClause.Occur.MUST); } return q1; } else { if (q2 instanceof BooleanQuery && ((BooleanQuery) q2).getClauses()[0].isRequired()) { ((BooleanQuery) q2).add(q1, BooleanClause.Occur.MUST); return q2; } else { BooleanQuery q = new BooleanQuery(); q.add(q1, BooleanClause.Occur.MUST); q.add(q2, BooleanClause.Occur.MUST); return q; } } } private static Query OR(Query q1, Query q2) { if (q1 == null) return q2; if (q2 == null) return q1; if (q1 instanceof BooleanQuery && !((BooleanQuery) q1).getClauses()[0].isRequired()) { if (q2 instanceof BooleanQuery && !((BooleanQuery) q2).getClauses()[0].isRequired()) { BooleanClause[] clauses = ((BooleanQuery) q2).getClauses(); for (int i = 0; i < clauses.length; ++i) { ((BooleanQuery) q1).add(clauses[i]); } } else { ((BooleanQuery) q1).add(q2, BooleanClause.Occur.SHOULD); } return q1; } else { if (q2 instanceof BooleanQuery && !((BooleanQuery) q2).getClauses()[0].isRequired()) { ((BooleanQuery) q2).add(q1, BooleanClause.Occur.SHOULD); return q2; } else { BooleanQuery q = new BooleanQuery(); q.add(q1, BooleanClause.Occur.SHOULD); q.add(q2, BooleanClause.Occur.SHOULD); return q; } } } private static DecimalFormat c_latitudeFormatter = new DecimalFormat("y000.0###"); /** * Encodes a latitude to a textual form that supports numeric ordering. * * @param latitude The latitude. * @return The encoded latitude. * @throws IllegalArgumentException If <code>latitude</code> is outside the range [-90,90]. */ public static String encodeLatitude(double latitude) throws IllegalArgumentException { if (latitude < -90.0 || latitude > 90.0) { throw new IllegalArgumentException("latitude out of range"); } synchronized (c_latitudeFormatter) { return c_latitudeFormatter.format(latitude + 90.0).replace('.', 'd'); } } /** * Encodes a latitude to a textual form that supports numeric ordering. * * @param latitude The latitude. * @return The encoded latitude. * @exception NumberFormatException If unable to convert latitude String to double * @throws IllegalArgumentException If <code>latitude</code> is outside the range [-90,90]. */ public static String encodeLatitude(String latitude) throws IllegalArgumentException, NumberFormatException { return encodeLatitude(Double.parseDouble(latitude)); } private static DecimalFormat c_longitudeFormatter = new DecimalFormat("x000.0###"); /** * Encodes a longitude to a textual form that supports numeric ordering. * * @param longitude The longitude. * @return The encoded longitude. * @throws IllegalArgumentException If <code>longitude</code> is outside the range [-180,180]. */ public static String encodeLongitude(double longitude) throws IllegalArgumentException { if (longitude < -180.0 || longitude > 180.0) { throw new IllegalArgumentException("longitude out of range"); } synchronized (c_longitudeFormatter) { return c_longitudeFormatter.format(longitude + 180.0).replace('.', 'd'); } } /** * Encodes a longitude to a textual form that supports numeric ordering. * * @param longitude The longitude. * @return The encoded longitude. * @exception NumberFormatException If unable to convert longitute String to double * @throws IllegalArgumentException If <code>longitude</code> is outside the range [-180,180]. */ public static String encodeLongitude(String longitude) throws IllegalArgumentException, NumberFormatException { return encodeLongitude(Double.parseDouble(longitude)); } /** * Test driver. * * @param args The command line arguments */ public static void main(String[] args) { if (args.length != 5) { System.err.println( "usage: java edu.ucsb.adl.LuceneGeospatialQueryConverter " + "predicate north south east west"); System.exit(1); } Query q = convertQuery("northCoord", "southCoord", "eastCoord", "westCoord", args[0], Double.valueOf(args[1]).doubleValue(), Double.valueOf(args[2]).doubleValue(), Double.valueOf(args[3]).doubleValue(), Double.valueOf(args[4]).doubleValue()); System.out.println(q.toString()); } }
[ "jweather@ucar.edu" ]
jweather@ucar.edu
413e83423c7bbe68236ca9b46457bfbd1dff327f
2a730e535c8d4601c1e5d3231003cd387f2abf72
/app/src/main/java/com/noahseidman/coinj/store/ValidHashStore.java
9f3e1a799c1126063c5da36783a711e245b2f2be
[]
no_license
nseidm1/DigiNodes
9776d43686013f72a95c216f31968cc09b513c9b
e3e0d28f84b35b7ec9f7b6962a54fc8d1d1b6322
refs/heads/master
2020-05-07T20:12:40.866290
2019-06-23T16:00:40
2019-06-23T16:00:40
180,848,532
0
0
null
null
null
null
UTF-8
Java
false
false
9,740
java
/** * Copyright 2014 Rimbit Developers. * Copyright 2014 Matthew Mitchell * * 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.noahseidman.coinj.store; import static com.google.common.base.Preconditions.checkNotNull; import com.noahseidman.coinj.core.AbstractBlockChain; import com.noahseidman.coinj.core.Sha256Hash; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.spongycastle.util.encoders.Hex; public class ValidHashStore { private static final Logger log = LoggerFactory.getLogger(ValidHashStore.class); private File filePath; private ArrayList<byte[]> validHashesArray = new ArrayList<byte[]>(); int index; boolean initialFind = true; private static String GENESIS_MINI_HASH = "00000a02cefbc063ba09034a6fbc123f7062b7ee0e4eed9128a1cadc7533e388"; public interface TrustedServersInterface { /** * Implement the retrieval of server URLs. * @param didFail True when the last server failed. If true then a different server should be given, or null if there are no more servers to try. * @return The URL of the next server, or null if there are no more servers to try. */ public URL getNext(boolean didFail); /** * Should return true if the server list has invalidated the previous returned server. */ public boolean invalidated(); /** * Marks the last returned server as failing or succeeding. */ public void markSuccess(boolean success); } private static URL SERVER; static { try { SERVER = new URL("http://69.141.235.64:4001/ext/getvalidhashes"); } catch (MalformedURLException ex) { // do nothing } } private TrustedServersInterface servers; public ValidHashStore(File filePath) throws IOException { // Use hardcoded server only this(filePath, new ValidHashStore.TrustedServersInterface() { @Override public URL getNext(boolean didFail) { return SERVER; } @Override public boolean invalidated() { return false; } @Override public void markSuccess(boolean success) { // Do nothing } }); } public ValidHashStore(File filePath, TrustedServersInterface servers) throws IOException { this.filePath = filePath; this.servers = servers; long len = filePath.length(); index = 0; if (len == 0) { // Add genesis hash and that is all BufferedOutputStream file = getOutputStream(); writeHash(Hex.decode(GENESIS_MINI_HASH), file); file.flush(); file.close(); return; } // Load valid hashes from file. FileInputStream file = new FileInputStream(filePath); byte[] data = new byte[(int)len]; file.read(data, 0, (int)len); byte[] b = new byte[32]; for (int x = 0; x < len; x += 32) { System.arraycopy(data, x, b, 0, 32); validHashesArray.add(b); b = new byte[32]; } file.close(); } private BufferedOutputStream getOutputStream() throws FileNotFoundException { return new BufferedOutputStream(new FileOutputStream(this.filePath)); } private void writeHash(byte[] hash, BufferedOutputStream file) throws IOException { validHashesArray.add(hash); file.write(hash, 0, 32); } private boolean isInValidHashes(byte[] cmpHash) { for (;index < validHashesArray.size(); index++) { if (Arrays.equals(validHashesArray.get(index), cmpHash)) { index++; initialFind = false; return true; } // Else if we are finding initial index continue, else fail. if (!initialFind) return false; } return false; } private byte[] getHashFromInputStream(InputStream is) throws IOException { byte[] hash = new byte[64]; int x = 0, res; while (x < 64 && (res = is.read()) != -1) hash[x++] = (byte) res; if (x != 64) return null; return hash; } private boolean downloadHashes(final URL server, final byte[] locator, final int locatorSize) { try { HttpURLConnection connection = (HttpURLConnection) server.openConnection(); connection.setUseCaches(false); connection.setInstanceFollowRedirects(false); connection.setConnectTimeout(30000); connection.setReadTimeout(30000); connection.setRequestMethod("POST"); //connection.setRequestProperty("Content-Type", "application/octet-stream"); connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestProperty("Accept-Encoding", ""); connection.setDoOutput(true); java.io.OutputStream os = connection.getOutputStream(); StringBuilder jsonData = new StringBuilder("{\n"); for(int i = 0; i < 1;++i) { jsonData.append("hash: \""); byte [] hash = new byte[32]; System.arraycopy(locator, i*32, hash, 0, 32); jsonData.append(new Sha256Hash(hash).toString()); jsonData.append("\"\n"); } jsonData.append("\n}"); //os.write(locator, 0, locatorSize); os.write(jsonData.toString().getBytes()); os.flush(); os.close(); try { connection.connect(); if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) { InputStream is = new BufferedInputStream(connection.getInputStream()); // We are going to replace the valid hashes with the new ones BufferedOutputStream file = getOutputStream(); validHashesArray.clear(); index = 0; initialFind = true; // Write new hashes. Ensure a limit of 2000 hashes. byte[] b; int x = 0; for (x = 0; (b = getHashFromInputStream(is)) != null && x < 2000; x++) writeHash(Hex.decode(new String(b)), file); file.flush(); file.close(); log.info("VerifyHashes: downloaded " + x + " block hashes"); return false; } } finally { connection.disconnect(); } } catch (IOException e) { log.warn("Got IO error when receiving valid block hashes from " + server.toString(), e); } return true; } public boolean isValidHash(Sha256Hash hash, AbstractBlockChain blockChain, boolean waitForServer) throws IOException { return true; /* // Get 16 bytes only byte[] cmpHash = new byte[32]; System.arraycopy(hash.getBytes(), 0, cmpHash, 0, 32); // First check the existing hashes if (!servers.invalidated() && isInValidHashes(cmpHash)) return true; // Nope. We need to ensure the valid hashes is synchronised with the server // Create POST data locator byte[] locator = new byte[3200]; BlockStore store = checkNotNull(blockChain).getBlockStore(); StoredBlock chainHead = blockChain.getChainHead(); StoredBlock cursor = chainHead; int offset = 0; for (int i = 100; cursor != null && i > 0; i--, offset += 32) { System.arraycopy(cursor.getHeader().getHash().getBytes(), 0, locator, offset, 32); try { cursor = cursor.getPrev(store); } catch (BlockStoreException e) { throw new RuntimeException(e); } } // Now download hashes from server. // But if waitForServer is true, first wait a while in case the server hasn't received or processed this block yet. // We assume the server is well connected and 30 seconds would therefore be more than enough in most cases. if (waitForServer) Utils.sleep(30000); URL server; boolean failed = false; do { if (failed) servers.markSuccess(false); server = servers.getNext(failed); if (server == null) throw new IOException("No more servers to try for valid block hashes."); } while (failed = downloadHashes(server, locator, offset)); servers.markSuccess(true); // Lastly check valid hashes again return isInValidHashes(cmpHash); */ } public void close(){ // Dummy method in case we add/remove it. } }
[ "noah@noahseidman.com" ]
noah@noahseidman.com
968ae4adf990fe3929409fae18afbaff6bf4fcc3
6ad5217e7d9901a5777c29d352e0252a6feba2f5
/LeetCode-Algorithms/src/com/zylear/problems/esay/algorithms771/JewelsAndStones.java
07597c3ebc0435bf8d8d13097e9b2cb7cf9a909b
[]
no_license
zyLear/LeetCode-algorithms-solved
aa0e8604047d13399445bf43aa21159d9925aedf
c28e72991fcd29074c3f46e0a1c9b7c548d52682
refs/heads/master
2023-06-25T12:05:17.152490
2023-06-24T12:26:30
2023-06-24T12:26:30
147,907,265
0
0
null
null
null
null
UTF-8
Java
false
false
1,947
java
package com.zylear.problems.esay.algorithms771; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * * Created by xiezongyu on 2018/9/8. */ /* You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the stones you have are also jewels. The letters in J are guaranteed distinct, and all characters in J and S are letters. Letters are case sensitive, so "a" is considered a different type of stone from "A". Example 1: Input: J = "aA", S = "aAAbbbb" Output: 3 Example 2: Input: J = "z", S = "ZZ" Output: 0 Note: S and J will consist of letters and have length at most 50. The characters in J are distinct. */ public class JewelsAndStones { public static String stringToString(String input) { if (input == null) { return "null"; } return input; } public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line; while ((line = in.readLine()) != null) { String J = stringToString(line); line = in.readLine(); String S = stringToString(line); int ret = new Solution().numJewelsInStones(J, S); String out = String.valueOf(ret); System.out.print(out); } } static class Solution { int numJewelsInStones(String J, String S) { int count = 0; for (int i = 0; i < S.length(); i++) { for (int j = 0; j < J.length(); j++) { if (J.charAt(j) == S.charAt(i)) { count++; } } } return count; } } }
[ "284449710@qq.com" ]
284449710@qq.com
ad625f733560e489e86541928fc4e9018f75523b
eedfc0308827d58537ba013222bb0baa06b5305d
/ztemplate/src/main/java/com/oranllc/template/activity/LoginActivity.java
c4af12502e7e01b6afe805f0374210dcdbc3d80a
[]
no_license
zhengxiaohui/XiaoHui
a679e10f039a3baff1d9ecf74fdb8268e7c1f7be
5b4f84c00d8e4aa71e2b5eb51f3df629d6302ff3
refs/heads/master
2021-01-12T05:18:00.694873
2018-03-09T06:27:02
2018-03-09T06:27:02
77,903,198
4
3
null
null
null
null
UTF-8
Java
false
false
565
java
package com.oranllc.template.activity; import android.view.View; import com.oranllc.template.R; /** * 创建人:郑晓辉 * 创建日期:2017/02/17 * 描述:登录 */ public class LoginActivity extends BaseActivity { @Override protected int inflateMainLayoutId() { return R.layout.activity_login; } @Override protected void initView(View view) { } @Override protected void setListener() { } @Override protected void initValue() { } @Override public void onClick(View v) { } }
[ "378180078@qq.com" ]
378180078@qq.com
6df7e5a3362ed450657cf112f7db5cb78672a1f8
b7e206810d2365e82fcac0f2b57210f06665e4c2
/interlok-core/src/main/java/com/adaptris/core/services/metadata/PayloadFromTemplateService.java
8ac0f625ac340b3b7321bae8aa50009b91384bf4
[ "Apache-2.0" ]
permissive
adaptris/interlok
33b829fb1979f6bbcb230a2f2592c48d0aecf680
5eeb78cfa620fb16a9827be862180118e777afc5
refs/heads/develop
2023-09-01T19:52:09.830345
2023-08-28T10:51:49
2023-08-28T11:08:15
44,253,783
28
11
Apache-2.0
2023-09-13T17:15:43
2015-10-14T14:37:52
Java
UTF-8
Java
false
false
8,003
java
/* * Copyright 2015 Adaptris Ltd. * * 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.adaptris.core.services.metadata; import java.util.Map; import java.util.regex.Matcher; import javax.validation.Valid; import javax.validation.constraints.NotNull; import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import com.adaptris.annotation.AdapterComponent; import com.adaptris.annotation.AdvancedConfig; import com.adaptris.annotation.AutoPopulated; import com.adaptris.annotation.ComponentProfile; import com.adaptris.annotation.DisplayOrder; import com.adaptris.annotation.InputFieldDefault; import com.adaptris.annotation.InputFieldHint; import com.adaptris.annotation.MarshallingCDATA; import com.adaptris.core.AdaptrisMessage; import com.adaptris.core.CoreException; import com.adaptris.core.ServiceException; import com.adaptris.core.ServiceImp; import com.adaptris.interlok.types.InterlokMessage; import com.adaptris.interlok.util.Args; import com.adaptris.util.KeyValuePair; import com.adaptris.util.KeyValuePairSet; import com.thoughtworks.xstream.annotations.XStreamAlias; /** * Replaces the payload with something built from a template and optional metadata keys. * <p> * Takes the template stored in {@link #setTemplate(String)} and replaces parts of the template * either by resolving the {@code %message} expression language or with values from various metadata * keys specified in {@link #setMetadataTokens(KeyValuePairSet)} to create a new payload. * </p> * <p> * Since under the covers it uses the JDK regular expression engine, take care when your replacement * may contain special regular expression characters (such as {@code \} and {@code $} * </p> * * @config payload-from-template * */ @XStreamAlias("payload-from-template") @AdapterComponent @ComponentProfile(summary = "Construct a new payload based on metadata and a template", tag = "service,metadata", since = "3.10.0") @DisplayOrder(order = {"template", "metadataTokens", "multiLineExpression", "quoteReplacement", "quiet"}) public class PayloadFromTemplateService extends ServiceImp { @NotNull @AutoPopulated @Valid private KeyValuePairSet metadataTokens; @MarshallingCDATA @InputFieldDefault(value = "") @InputFieldHint(expression = true, style="BLANKABLE") private String template = null; @AdvancedConfig(rare = true) @InputFieldDefault(value = "true") private Boolean quoteReplacement; @AdvancedConfig(rare = true) @InputFieldDefault(value = "false") private Boolean quiet; @AdvancedConfig @InputFieldDefault(value = "true") private Boolean multiLineExpression; public PayloadFromTemplateService() { setMetadataTokens(new KeyValuePairSet()); } @Override public void doService(AdaptrisMessage msg) throws ServiceException { String payload = msg.resolve(StringUtils.defaultIfEmpty(template, ""), multiLineExpression()); for (KeyValuePair kvp : getMetadataTokens().getKeyValuePairs()) { if (msg.getMetadataValue(kvp.getKey()) != null) { if (!quiet()) { log.trace("Replacing {} with {}", kvp.getValue(), msg.getMetadataValue(kvp.getKey())); } payload = payload.replaceAll(kvp.getValue(), munge(msg.getMetadataValue(kvp.getKey()))); } else { if (!quiet()) { log.trace("{} returns no value; no substitution", kvp.getKey()); } } } msg.setContent(payload, msg.getContentEncoding()); } private String munge(String s) { return quoteReplacement() ? Matcher.quoteReplacement(s) : s; } @Override protected void initService() throws CoreException {} @Override protected void closeService() {} @Override public void prepare() throws CoreException {} /** * @return the metadataTokens */ public KeyValuePairSet getMetadataTokens() { return metadataTokens; } /** * Set the metadata tokens that will be used to perform metadata substitution. * <p> * For the purposes of this service, the key to the key-value-pair is the * metadata key, and the value is the token that will be replaced within the * template * </p> * * @param metadataTokens the metadataTokens to set */ public void setMetadataTokens(KeyValuePairSet metadataTokens) { this.metadataTokens = Args.notNull(metadataTokens, "metadata-tokens"); } public <T extends PayloadFromTemplateService> T withMetadataTokens(KeyValuePairSet tokens) { setMetadataTokens(tokens); return (T) this; } public <T extends PayloadFromTemplateService> T withMetadataTokens(Map<String, String> tokens) { return withMetadataTokens(new KeyValuePairSet(tokens)); } /** * @return the template */ public String getTemplate() { return template; } /** * Set the template document that will be used as the template for generating a new document. * * @param s the template to set (supports metadata expansion via {@code %message{key}}). */ public void setTemplate(String s) { template = s; } public <T extends PayloadFromTemplateService> T withTemplate(String b) { setTemplate(b); return (T) this; } public Boolean getQuoteReplacement() { return quoteReplacement; } /** * If any metadata value contains special characters then ensure that they are escaped. * <p> * Set this flag to make sure that special characters are treated literally by the regular expression engine. * <p> * * @see Matcher#quoteReplacement(String) * @param b the value to set, defaults to true if not explicitly configured. */ public void setQuoteReplacement(Boolean b) { quoteReplacement = b; } public <T extends PayloadFromTemplateService> T withQuoteReplacement(Boolean b) { setQuoteReplacement(b); return (T) this; } protected boolean quoteReplacement() { return BooleanUtils.toBooleanDefaultIfNull(getQuoteReplacement(), true); } public Boolean getQuiet() { return quiet; } /** * Normally this service logs everything that is being replaced with can lead to excessive logging. * * @param quiet true or false, default false if not specified. */ public void setQuiet(Boolean quiet) { this.quiet = quiet; } public <T extends PayloadFromTemplateService> T withQuietMode(Boolean quiet) { setQuiet(quiet); return (T) this; } private boolean quiet() { return BooleanUtils.toBooleanDefaultIfNull(getQuiet(), false); } public Boolean getMultiLineExpression() { return multiLineExpression; } /** * Whether or not to handle expressions using {@code Pattern#DOTALL} mode for matching. * * <p> * The value here is passed to {@link InterlokMessage#resolve(String, boolean)}. True will allow you to do replacements on * multi-line templates; It defaults to true which means that multi-line templates along the lines of will be supported. * * <pre> * {@code * { * "key": "%message{metadataKey}", * "key2: "%message{anotherMetadatKey}", * } * } * </pre> * </p> * * @param b true/false, default is true if not specified. */ public void setMultiLineExpression(Boolean b) { multiLineExpression = b; } public <T extends PayloadFromTemplateService> T withMultiLineExpression(Boolean b) { setMultiLineExpression(b); return (T) this; } protected boolean multiLineExpression() { return BooleanUtils.toBooleanDefaultIfNull(getMultiLineExpression(), true); } }
[ "lewin.chan@adaptris.com" ]
lewin.chan@adaptris.com
49a3fd6763cb8b3c89a914e176af0bd2c5cf694d
6ebd29451a69ae1f18871639d6d837bf0c69faae
/src/main/java/model/EncryptData.java
27a7144dc797edd2f77e001c3eaed811a750447e
[]
no_license
sohaninfo/OpenstackAview
9b55c5e77d6184f3f8bc7365864a70c317e86976
b9721ee2a89207328ea7c05a24acb6011c58f1d9
refs/heads/master
2021-01-10T03:33:58.728635
2017-07-27T05:12:50
2017-07-27T05:12:50
54,900,584
0
0
null
null
null
null
UTF-8
Java
false
false
374
java
package model; import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonProperty; public class EncryptData implements Serializable{ /** * */ private static final long serialVersionUID = 1L; @JsonProperty("data") private String data; public String getData() { return data; } public void setData(String data) { this.data = data; } }
[ "sohaninfo@gmail.com" ]
sohaninfo@gmail.com
1c0d2adafcc3ca2af2d5e703daa9e031813ae1ff
a33d4173c19abaafe77b61ad257ca63036572cda
/src/CourseCode.java
356ff3030b153a378f22a7914684bcf546e94f43
[]
no_license
khani92/Schedule_Designing_Using_Greedy
ac68ded35a7be41f0759086821ff2868380543fd
70c1954782afc06375911b1ba107aa1689f97662
refs/heads/master
2021-01-10T08:26:49.097841
2015-11-17T02:54:09
2015-11-17T02:54:09
46,946,895
0
0
null
null
null
null
UTF-8
Java
false
false
604
java
/** * This is a wrapper class for Coursecode. This will hold the courseName and the * identifying number. * * @author Nikhil * */ public class CourseCode { private String courseName; private int codeNum; public CourseCode(String courseName, int codeNum) { super(); this.courseName = courseName; this.codeNum = codeNum; } public String getCourseName() { return courseName; } public void setCourseName(String courseName) { this.courseName = courseName; } public int getCodeNum() { return codeNum; } public void setCodeNum(int codeNum) { this.codeNum = codeNum; } }
[ "nikhil.khani92@gmail.com" ]
nikhil.khani92@gmail.com
4dcf711b407a6f0aa58b539cf67fdb55d9371500
ad25b723c49b1740a3e74e8b827418e367be63b9
/Polymorphism/PolymorphiscArray1.java
3c7d015d004c36c5c366c3c8c40d8ce448c85d01
[]
no_license
wasimsurjo/basicJavaProgramming
d1930d1e3ba017252ce830d55e3a814ba1e6e594
4fde7036d69b04d442b00bace48f7b2e3abf4d55
refs/heads/master
2022-12-04T12:33:16.724838
2020-09-03T14:05:58
2020-09-03T14:05:58
292,580,186
0
0
null
null
null
null
UTF-8
Java
false
false
670
java
class PolymorphicArray1{ public static void main (String[] args){ food wasim[]=new food[3]; //array of food type=polymorphic array wasim[0]=new kfc(); wasim[1]=new pizza(); wasim[2]=new food(); for (int x=0;x<3;++x){ wasim[x].eat(); } } } class food{ void eat(){ System.out.println("This Food is Great"); } } class kfc extends food{ void eat(){ System.out.println("This Chicken is Great"); } } class pizza extends food{ void eat(){ System.out.println("Bel Piatto!!!"); } }
[ "noreply@github.com" ]
wasimsurjo.noreply@github.com
8084d79498772ee88b1fdfb8afa2b4399dc5d2e0
aa3af064c819df574114815a4679de0ce043377d
/src/com/mindtree/mcse/mobilemall/web/validators/AccountValidator.java
12dac133acb522cbd66000f4be5da2d01e3dae95
[]
no_license
SiyuanZeng/MobileMall-Store
cc52488d70e5cbcb40d6b2fe27e8bc9ce528dd6e
c640b4d7b4b83178157b828450da1b7a58f6a741
refs/heads/master
2020-04-12T01:56:15.175953
2015-10-26T04:18:44
2015-10-26T04:18:44
68,260,837
0
0
null
null
null
null
UTF-8
Java
false
false
1,376
java
package com.mindtree.mcse.mobilemall.web.validators; import org.springframework.validation.Errors; import org.springframework.validation.ValidationUtils; import org.springframework.validation.Validator; import com.mindtree.mcse.mobilemall.domain.Account; public class AccountValidator implements Validator { @SuppressWarnings("rawtypes") public boolean supports(Class clazz) { return Account.class.isAssignableFrom(clazz); } public void validate(Object obj, Errors errors) { ValidationUtils.rejectIfEmpty(errors, "firstName", "FIRST_NAME_REQUIRED", "First name is required."); ValidationUtils.rejectIfEmpty(errors, "lastName", "LAST_NAME_REQUIRED", "Last name is required."); ValidationUtils.rejectIfEmpty(errors, "email", "EMAIL_REQUIRED", "Email address is required."); ValidationUtils.rejectIfEmpty(errors, "phone", "PHONE_REQUIRED", "Phone number is required."); ValidationUtils.rejectIfEmpty(errors, "address1", "ADDRESS_REQUIRED", "Address (1) is required."); ValidationUtils.rejectIfEmpty(errors, "city", "CITY_REQUIRED", "City is required."); ValidationUtils.rejectIfEmpty(errors, "state", "STATE_REQUIRED", "State is required."); ValidationUtils.rejectIfEmpty(errors, "zip", "ZIP_REQUIRED", "ZIP is required."); ValidationUtils.rejectIfEmpty(errors, "country", "COUNTRY_REQUIRED", "Country is required."); } }
[ "siyuanzeng@gmail.com" ]
siyuanzeng@gmail.com
facf8442a8f93b0c4e0acb7fed8f35fcc7b95ad7
d0fe14f936c9387b8ac64bc93be507c65aa4a6d5
/android/app/src/main/java/com/credihuber/MainActivity.java
fed3e487b940713afd3a09854659394bd34058fe
[]
no_license
azevedorafael/credihuber
842a9ebd5cbfb63fae3bd660261c8e8350c952c8
c6801efbc9e476136972d6c0d4d5b0543d3d5e78
refs/heads/master
2020-08-28T15:35:50.938010
2019-11-03T21:14:51
2019-11-03T21:14:51
217,741,981
0
0
null
null
null
null
UTF-8
Java
false
false
814
java
package com.credihuber; import com.facebook.react.ReactActivity; import com.facebook.react.ReactActivityDelegate; import com.facebook.react.ReactRootView; import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. This is used to schedule * rendering of the component. */ @Override protected String getMainComponentName() { return "credihuber"; } @Override protected ReactActivityDelegate createReactActivityDelegate() { return new ReactActivityDelegate(this, getMainComponentName()) { @Override protected ReactRootView createRootView() { return new RNGestureHandlerEnabledRootView(MainActivity.this); } }; } }
[ "rafaelsilva.fatec@gmail.com" ]
rafaelsilva.fatec@gmail.com
2ac64eca6bd89abb4fb7192199e75b085671e36f
0cca1a92a34260af09d92dcbc42d8f6c006f94aa
/src/main/java/com/rentalsforshare/controller/CategoryController.java
1eeea9da9bf146482eb8f4c4be10525290bc4892
[]
no_license
DuongVu089x/RentalsForShareServer
d38270f770cb1e7c6c41adef2921e9f34699f774
5ba37764b1a2faf074a1b7f38101516a759a28ca
refs/heads/master
2021-05-07T22:04:36.993365
2017-10-31T14:48:27
2017-10-31T14:48:36
109,001,181
0
0
null
null
null
null
UTF-8
Java
false
false
78
java
package com.rentalsforshare.controller; public class CategoryController { }
[ "duonganhvu089x@gmail.com" ]
duonganhvu089x@gmail.com
d3bc7de743c0d471f3b00671dcbd2e749094199c
48e835e6f176a8ac9ae3ca718e8922891f1e5a18
/benchmark/validation/tests/targets/security/KeyStoreTest.java
d19386dd1f3375db90cf22717f9b00a1eaa2a36c
[]
no_license
STAMP-project/dspot-experiments
f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5
121487e65cdce6988081b67f21bbc6731354a47f
refs/heads/master
2023-02-07T14:40:12.919811
2019-11-06T07:17:09
2019-11-06T07:17:09
75,710,758
14
19
null
2023-01-26T23:57:41
2016-12-06T08:27:42
null
UTF-8
Java
false
false
7,189
java
/** * Copyright (C) 2009 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 tests.targets.security; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.UnrecoverableEntryException; import java.security.cert.Certificate; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import junit.framework.TestCase; public abstract class KeyStoreTest extends TestCase { private final String algorithmName; private final byte[] keyStoreData; private final String keyStorePassword; public KeyStoreTest(String algorithmName, byte[] keyStoreData, String keyStorePassword) { this.algorithmName = algorithmName; this.keyStoreData = keyStoreData; this.keyStorePassword = keyStorePassword; } public void testKeyStoreLoad() { KeyStore keyStore = null; try { keyStore = KeyStore.getInstance(algorithmName); } catch (KeyStoreException e) { TestCase.fail(e.getMessage()); } try { keyStore.load(new ByteArrayInputStream(keyStoreData), keyStorePassword.toCharArray()); } catch (NoSuchAlgorithmException e) { TestCase.fail(e.getMessage()); } catch (CertificateException e) { TestCase.fail(e.getMessage()); } catch (IOException e) { TestCase.fail(e.getMessage()); } try { TestCase.assertTrue("keystore is empty", keyStore.aliases().hasMoreElements()); } catch (KeyStoreException e) { TestCase.fail(e.getMessage()); } } public void testKeyStoreCreate() { KeyStore keyStore = null; try { keyStore = KeyStore.getInstance(algorithmName); } catch (KeyStoreException e) { TestCase.fail(e.getMessage()); } try { keyStore.load(null, "the secret password".toCharArray()); } catch (NoSuchAlgorithmException e) { TestCase.fail(e.getMessage()); } catch (CertificateException e) { TestCase.fail(e.getMessage()); } catch (IOException e) { TestCase.fail(e.getMessage()); } CertificateFactory certificateFactory = null; try { certificateFactory = CertificateFactory.getInstance("X.509"); } catch (CertificateException e) { TestCase.fail(e.getMessage()); } Certificate certificate = null; try { certificate = certificateFactory.generateCertificate(new ByteArrayInputStream(encodedCertificate.getBytes())); } catch (CertificateException e) { TestCase.fail(e.getMessage()); } KeyPairGenerator generator = null; try { generator = KeyPairGenerator.getInstance(certificate.getPublicKey().getAlgorithm()); } catch (NoSuchAlgorithmException e) { TestCase.fail(e.getMessage()); } KeyPair keyPair = generator.generateKeyPair(); KeyStore.PrivateKeyEntry privateKeyEntry = new KeyStore.PrivateKeyEntry(keyPair.getPrivate(), new Certificate[]{ certificate }); try { keyStore.setEntry("aPrivateKey", privateKeyEntry, new KeyStore.PasswordProtection("the key password".toCharArray())); } catch (KeyStoreException e) { TestCase.fail(e.getMessage()); } try { TestCase.assertTrue(keyStore.containsAlias("aPrivateKey")); } catch (KeyStoreException e) { TestCase.fail(e.getMessage()); } try { KeyStore.PrivateKeyEntry entry = ((KeyStore.PrivateKeyEntry) (keyStore.getEntry("aPrivateKey", new KeyStore.PasswordProtection("the key password".toCharArray())))); PrivateKey privateKey = entry.getPrivateKey(); TestCase.assertEquals(keyPair.getPrivate(), privateKey); } catch (NoSuchAlgorithmException e) { TestCase.fail(e.getMessage()); } catch (UnrecoverableEntryException e) { TestCase.fail(e.getMessage()); } catch (KeyStoreException e) { TestCase.fail(e.getMessage()); } try { ByteArrayOutputStream stream = new ByteArrayOutputStream(); keyStore.store(stream, "the keystore password".toCharArray()); TestCase.assertTrue("keystore not written", ((stream.size()) > 0)); } catch (KeyStoreException e) { TestCase.fail(e.getMessage()); } catch (NoSuchAlgorithmException e) { TestCase.fail(e.getMessage()); } catch (CertificateException e) { TestCase.fail(e.getMessage()); } catch (IOException e) { TestCase.fail(e.getMessage()); } } private String encodedCertificate = "-----BEGIN CERTIFICATE-----\n" + ((((((((((((((((((((("MIID0jCCAzugAwIBAgIBAjANBgkqhkiG9w0BAQQFADCBmjELMAkGA1UEBhMCVUsx\n" + "EjAQBgNVBAgTCUhhbXBzaGlyZTETMBEGA1UEBxMKV2luY2hlc3RlcjETMBEGA1UE\n") + "ChMKSUJNIFVLIEx0ZDEMMAoGA1UECxMDSlRDMRYwFAYDVQQDEw1QYXVsIEggQWJi\n") + "b3R0MScwJQYJKoZIhvcNAQkBFhhQYXVsX0hfQWJib3R0QHVrLmlibS5jb20wHhcN\n") + "MDQwNjIyMjA1MDU1WhcNMDUwNjIyMjA1MDU1WjCBmDELMAkGA1UEBhMCVUsxEjAQ\n") + "BgNVBAgTCUhhbXBzaGlyZTETMBEGA1UEBxMKV2luY2hlc3RlcjETMBEGA1UEChMK\n") + "SUJNIFVrIEx0ZDEMMAoGA1UECxMDSkVUMRQwEgYDVQQDEwtQYXVsIEFiYm90dDEn\n") + "MCUGCSqGSIb3DQEJARYYUGF1bF9IX0FiYm90dEB1ay5pYm0uY29tMIGfMA0GCSqG\n") + "SIb3DQEBAQUAA4GNADCBiQKBgQDitZBQ5d18ecNJpcnuKTraHYtqsAugoc95/L5Q\n") + "28s3t1QAu2505qQR1MZaAkY7tDNyl1vPnZoym+Y06UswTrZoVYo/gPNeyWPMTsLA\n") + "wzQvk5/6yhtE9ciH7B0SqYw6uSiDTbUY/zQ6qed+TsQhjlbn3PUHRjnI2P8A04cg\n") + "LgYYGQIDAQABo4IBJjCCASIwCQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3Bl\n") + "blNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFPplRPs65hUfxUBs\n") + "6/Taq7nN8i1UMIHHBgNVHSMEgb8wgbyAFJOMtPAwlXdZLqE7DKU6xpL6FjFtoYGg\n") + "pIGdMIGaMQswCQYDVQQGEwJVSzESMBAGA1UECBMJSGFtcHNoaXJlMRMwEQYDVQQH\n") + "EwpXaW5jaGVzdGVyMRMwEQYDVQQKEwpJQk0gVUsgTHRkMQwwCgYDVQQLEwNKVEMx\n") + "FjAUBgNVBAMTDVBhdWwgSCBBYmJvdHQxJzAlBgkqhkiG9w0BCQEWGFBhdWxfSF9B\n") + "YmJvdHRAdWsuaWJtLmNvbYIBADANBgkqhkiG9w0BAQQFAAOBgQAnQ22Jw2HUrz7c\n") + "VaOap31mTikuQ/CQxpwPYiSyTJ4s99eEzn+2yAk9tIDIJpqoay/fj+OLgPUQKIAo\n") + "XpRVvmHlGE7UqMKebZtSZJQzs6VoeeKFhgHmqg8eVC2AsTc4ZswJmg4wCui5AH3a\n") + "oqG7PIM3LxZqXYQlZiPSZ6kCpDOWVg==\n") + "-----END CERTIFICATE-----\n"); }
[ "benjamin.danglot@inria.fr" ]
benjamin.danglot@inria.fr
2f1551a7ae1f264351a9e45cadd5a81b556cfe9a
1b7ebd3409dfca48ef6afc9986d47b744d7cfe84
/MyEclipse_2017_CI/Campus_part-time_job_system1/src/com/ServiceImpl/UserServiceImpl.java
1f9b947bb58cfe23bb8d735ab69e740e2da0a838
[]
no_license
hedingquan/javaForHdquan
dc1471702abb2212143cc180a7299c3746605e08
971d4877d3bcbfb8ad90644251e36400233d1bd0
refs/heads/master
2021-03-07T21:57:29.262416
2020-03-10T13:37:33
2020-03-10T13:37:33
246,299,378
1
0
null
null
null
null
UTF-8
Java
false
false
2,403
java
package com.ServiceImpl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.Service.UserService; import com.dao.UserDao; import com.pojo.Admin; import com.pojo.Buser; import com.pojo.Cuser; import com.pojo.User; @Service @Transactional public class UserServiceImpl implements UserService{ @Autowired UserDao userDao; @Override public Object user(String user_name) { // TODO Auto-generated method stub return userDao.user(user_name); } @Override public boolean AddCuser(Cuser user) { // TODO Auto-generated method stub return userDao.AddCuser(user); } @Override public boolean AddAdmin(Admin user) { // TODO Auto-generated method stub return userDao.AddAdmin(user); } @Override public boolean AddBuser(Buser user) { // TODO Auto-generated method stub return userDao.AddBuser(user); } @Override public boolean AddUser(Object user) { // TODO Auto-generated method stub return userDao.AddUser(user); } @Override public boolean UpdateUser(Object user) { // TODO Auto-generated method stub return userDao.UpdateUser(user); } @Override public boolean UpdateCuser(Cuser user) { // TODO Auto-generated method stub return userDao.UpdateCuser(user); } @Override public boolean UpdateAdmin(Admin user) { // TODO Auto-generated method stub return userDao.UpdateAdmin(user); } @Override public boolean UpdateBuser(Buser user) { // TODO Auto-generated method stub return userDao.UpdateBuser(user); } @Override public Cuser getCuser(String user_ID) { // TODO Auto-generated method stub return userDao.getCuser(user_ID); } @Override public Admin getAdmin(String user_ID) { // TODO Auto-generated method stub return userDao.getAdmin(user_ID); } @Override public Buser getBuser(String user_ID) { // TODO Auto-generated method stub return userDao.getBuser(user_ID); } @Override public boolean DeleteCuser(Cuser user) { // TODO Auto-generated method stub return userDao.DeleteCuser(user); } @Override public boolean DeleteAdmin(Admin user) { // TODO Auto-generated method stub return userDao.DeleteAdmin(user); } @Override public boolean DeleteBuser(Buser user) { // TODO Auto-generated method stub return userDao.DeleteBuser(user); } }
[ "hedingna123" ]
hedingna123
c62270054dc491b52c5854b197b3a35267683b6d
c64f27db2bdcfe43d4204a2c0d54a4596907716f
/JoyDivision_/src/HungarianAlgorithm.java
f500eb791bc6e82102e2b25ea9eb2c310ae82eb8
[]
no_license
sivanp/ImageJplugins
ad8cbc999b84f143184214a5736c6dbc8a702633
4b828f1fde5b9bb041cf78aa5f1825f8bafd08ad
refs/heads/master
2021-01-01T16:59:41.212053
2015-02-15T14:29:55
2015-02-15T14:29:55
30,828,808
0
0
null
null
null
null
UTF-8
Java
false
false
17,364
java
/* * Created on Apr 25, 2005 * * Munkres-Kuhn (Hungarian) Algorithm Clean Version: 0.11 * * Konstantinos A. Nedas * Department of Spatial Information Science & Engineering * University of Maine, Orono, ME 04469-5711, USA * kostas@spatial.maine.edu * http://www.spatial.maine.edu/~kostas * * This Java class implements the Hungarian algorithm [a.k.a Munkres' algorithm, * a.k.a. Kuhn algorithm, a.k.a. Assignment problem, a.k.a. Marriage problem, * a.k.a. Maximum Weighted Maximum Cardinality Bipartite Matching]. * * [It can be used as a method call from within any main (or other function).] * It takes 2 arguments: * a. A 2-D array (could be rectangular or square). * b. A string ("min" or "max") specifying whether you want the min or max assignment. * [It returns an assignment matrix[array.length][2] that contains the row and col of * the elements (in the original inputted array) that make up the optimum assignment.] * * [This version contains only scarce comments. If you want to understand the * inner workings of the algorithm, get the tutorial version of the algorithm * from the same website you got this one (http://www.spatial.maine.edu/~kostas/dev/soft/munkres.htm)] * * Any comments, corrections, or additions would be much appreciated. * Credit due to professor Bob Pilgrim for providing an online copy of the * pseudocode for this algorithm (http://216.249.163.93/bob.pilgrim/445/munkres.html) * * Feel free to redistribute this source code, as long as this header--with * the exception of sections in brackets--remains as part of the file. * * Requirements: JDK 1.5.0_01 or better. * [Created in Eclipse 3.1M6 (www.eclipse.org).] * */ import static java.lang.Math.*; import java.text.NumberFormat; import java.util.*; public class HungarianAlgorithm { //********************************// //METHODS FOR CONSOLE INPUT-OUTPUT// //********************************// public static int readInput(String prompt) //Reads input,returns double. { Scanner in = new Scanner(System.in); System.out.print(prompt); int input = in.nextInt(); return input; } public static void printTime(double time) //Formats time output. { String timeElapsed = ""; int days = (int)floor(time)/(24 * 3600); int hours = (int)floor(time%(24*3600))/(3600); int minutes = (int)floor((time%3600)/60); int seconds = (int)round(time%60); if (days > 0) timeElapsed = Integer.toString(days) + "d:"; if (hours > 0) timeElapsed = timeElapsed + Integer.toString(hours) + "h:"; if (minutes > 0) timeElapsed = timeElapsed + Integer.toString(minutes) + "m:"; timeElapsed = timeElapsed + Integer.toString(seconds) + "s"; System.out.print("\nTotal time required: " + timeElapsed + "\n\n"); } //*******************************************// //METHODS THAT PERFORM ARRAY-PROCESSING TASKS// //*******************************************// public static void generateRandomArray //Generates random 2-D array. (double[][] array, String randomMethod) { Random generator = new Random(); for (int i=0; i<array.length; i++) { for (int j=0; j<array[i].length; j++) { if (randomMethod.equals("random")) {array[i][j] = generator.nextDouble();} if (randomMethod.equals("gaussian")) { array[i][j] = generator.nextGaussian()/4; //range length to 1. if (array[i][j] > 0.5) {array[i][j] = 0.5;} //eliminate outliers. if (array[i][j] < -0.5) {array[i][j] = -0.5;} //eliminate outliers. array[i][j] = array[i][j] + 0.5; //make elements positive. } } } } public static double findLargest //Finds the largest element in a positive array. (double[][] array) //works for arrays where all values are >= 0. { double largest = 0; for (int i=0; i<array.length; i++) { for (int j=0; j<array[i].length; j++) { if (array[i][j] > largest) { largest = array[i][j]; } } } return largest; } public static double[][] transpose //Transposes a double[][] array. (double[][] array) { double[][] transposedArray = new double[array[0].length][array.length]; for (int i=0; i<transposedArray.length; i++) { for (int j=0; j<transposedArray[i].length; j++) {transposedArray[i][j] = array[j][i];} } return transposedArray; } public static double[][] copyOf //Copies all elements of an array to a new array. (double[][] original) { double[][] copy = new double[original.length][original[0].length]; for (int i=0; i<original.length; i++) { //Need to do it this way, otherwise it copies only memory location System.arraycopy(original[i], 0, copy[i], 0, original[i].length); } return copy; } //**********************************// //METHODS OF THE HUNGARIAN ALGORITHM// //**********************************// public static int[][] hgAlgorithm (double[][] array, String sumType) { double[][] cost = copyOf(array); //Create the cost matrix if (sumType.equalsIgnoreCase("max")) //Then array is weight array. Must change to cost. { double maxWeight = findLargest(cost); for (int i=0; i<cost.length; i++) //Generate cost by subtracting. { for (int j=0; j<cost[i].length; j++) { cost [i][j] = (maxWeight - cost [i][j]); } } } double maxCost = findLargest(cost); //Find largest cost matrix element (needed for step 6). int[][] mask = new int[cost.length][cost[0].length]; //The mask array. int[] rowCover = new int[cost.length]; //The row covering vector. int[] colCover = new int[cost[0].length]; //The column covering vector. int[] zero_RC = new int[2]; //Position of last zero from Step 4. int step = 1; boolean done = false; double[][] prevcost=cost; while (done == false) //main execution loop { // String rowprint=""; // for(int m=0;m<cost.length; m++){ // for(int n=0; n<cost[m].length;n++){ // NumberFormat nf = NumberFormat.getInstance(); // get instance // nf.setMaximumFractionDigits(2); // set decimal places // String s = nf.format(cost[m][n]); // rowprint+=s+" "; // } // rowprint+="\n"; // } // System.out.println("==cost===="); // System.out.println(rowprint); System.out.println("hungarian step "+step); switch (step) { case 1: step = hg_step1(step, cost); break; case 2: step = hg_step2(step, cost, mask, rowCover, colCover); break; case 3: step = hg_step3(step, mask, colCover); break; case 4: step = hg_step4(step, cost, mask, rowCover, colCover, zero_RC); break; case 5: step = hg_step5(step, mask, rowCover, colCover, zero_RC); break; case 6: step = hg_step6(step, cost, rowCover, colCover, maxCost); break; case 7: done=true; break; } }//end while int[][] assignment = new int[array.length][2]; //Create the returned array. for (int i=0; i<mask.length; i++) { for (int j=0; j<mask[i].length; j++) { if (mask[i][j] == 1) { assignment[i][0] = i; assignment[i][1] = j; } } } //If you want to return the min or max sum, in your own main method //instead of the assignment array, then use the following code: /* double sum = 0; for (int i=0; i<assignment.length; i++) { sum = sum + array[assignment[i][0]][assignment[i][1]]; } return sum; */ //Of course you must also change the header of the method to: //public static double hgAlgorithm (double[][] array, String sumType) return assignment; } public static int hg_step1(int step, double[][] cost) { //What STEP 1 does: //For each row of the cost matrix, find the smallest element //and subtract it from from every other element in its row. double minval; for (int i=0; i<cost.length; i++) { minval=cost[i][0]; for (int j=0; j<cost[i].length; j++) //1st inner loop finds min val in row. { if (minval>cost[i][j]) { minval=cost[i][j]; } } for (int j=0; j<cost[i].length; j++) //2nd inner loop subtracts it. { cost[i][j]=cost[i][j]-minval; } } step=2; return step; } public static int hg_step2(int step, double[][] cost, int[][] mask, int[]rowCover, int[] colCover) { //What STEP 2 does: //Marks uncovered zeros as starred and covers their row and column. for (int i=0; i<cost.length; i++) { for (int j=0; j<cost[i].length; j++) { if ((cost[i][j]==0) && (colCover[j]==0) && (rowCover[i]==0)) { mask[i][j]=1; colCover[j]=1; rowCover[i]=1; } } } clearCovers(rowCover, colCover); //Reset cover vectors. step=3; return step; } public static int hg_step3(int step, int[][] mask, int[] colCover) { //What STEP 3 does: //Cover columns of starred zeros. Check if all columns are covered. for (int i=0; i<mask.length; i++) //Cover columns of starred zeros. { for (int j=0; j<mask[i].length; j++) { if (mask[i][j] == 1) { colCover[j]=1; } } } int count=0; for (int j=0; j<colCover.length; j++) //Check if all columns are covered. { count=count+colCover[j]; } if (count>=mask.length) //Should be cost.length but ok, because mask has same dimensions. { step=7; } else { step=4; } return step; } public static int hg_step4(int step, double[][] cost, int[][] mask, int[] rowCover, int[] colCover, int[] zero_RC) { //What STEP 4 does: //Find an uncovered zero in cost and prime it (if none go to step 6). Check for star in same row: //if yes, cover the row and uncover the star's column. Repeat until no uncovered zeros are left //and go to step 6. If not, save location of primed zero and go to step 5. int[] row_col = new int[2]; //Holds row and col of uncovered zero. boolean done = false; while (done == false) { row_col = findUncoveredZero(row_col, cost, rowCover, colCover); if (row_col[0] == -1) { done = true; step = 6; } else { mask[row_col[0]][row_col[1]] = 2; //Prime the found uncovered zero. boolean starInRow = false; for (int j=0; j<mask[row_col[0]].length; j++) { if (mask[row_col[0]][j]==1) //If there is a star in the same row... { starInRow = true; row_col[1] = j; //remember its column. } } if (starInRow==true) { rowCover[row_col[0]] = 1; //Cover the star's row. colCover[row_col[1]] = 0; //Uncover its column. } else { zero_RC[0] = row_col[0]; //Save row of primed zero. zero_RC[1] = row_col[1]; //Save column of primed zero. done = true; step = 5; } } } return step; } public static int[] findUncoveredZero //Aux 1 for hg_step4. (int[] row_col, double[][] cost, int[] rowCover, int[] colCover) { row_col[0] = -1; //Just a check value. Not a real index. row_col[1] = 0; int i = 0; boolean done = false; while (done == false) { int j = 0; while (j < cost[i].length) { if (cost[i][j]==0 && rowCover[i]==0 && colCover[j]==0) { row_col[0] = i; row_col[1] = j; done = true; } j = j+1; }//end inner while i=i+1; if (i >= cost.length) { done = true; } }//end outer while return row_col; } public static int hg_step5(int step, int[][] mask, int[] rowCover, int[] colCover, int[] zero_RC) { //What STEP 5 does: //Construct series of alternating primes and stars. Start with prime from step 4. //Take star in the same column. Next take prime in the same row as the star. Finish //at a prime with no star in its column. Unstar all stars and star the primes of the //series. Erasy any other primes. Reset covers. Go to step 3. int count = 0; //Counts rows of the path matrix. int[][] path = new int[(mask[0].length*mask.length)][2]; //Path matrix (stores row and col). path[count][0] = zero_RC[0]; //Row of last prime. path[count][1] = zero_RC[1]; //Column of last prime. boolean done = false; while (done == false) { int r = findStarInCol(mask, path[count][1]); if (r>=0) { count = count+1; path[count][0] = r; //Row of starred zero. path[count][1] = path[count-1][1]; //Column of starred zero. } else { done = true; } if (done == false) { int c = findPrimeInRow(mask, path[count][0]); count = count+1; path[count][0] = path [count-1][0]; //Row of primed zero. path[count][1] = c; //Col of primed zero. } }//end while convertPath(mask, path, count); clearCovers(rowCover, colCover); erasePrimes(mask); step = 3; return step; } public static int findStarInCol //Aux 1 for hg_step5. (int[][] mask, int col) { int r=-1; //Again this is a check value. for (int i=0; i<mask.length; i++) { if (mask[i][col]==1) { r = i; } } return r; } public static int findPrimeInRow //Aux 2 for hg_step5. (int[][] mask, int row) { int c = -1; for (int j=0; j<mask[row].length; j++) { if (mask[row][j]==2) { c = j; } } return c; } public static void convertPath //Aux 3 for hg_step5. (int[][] mask, int[][] path, int count) { for (int i=0; i<=count; i++) { if (mask[(path[i][0])][(path[i][1])]==1) { mask[(path[i][0])][(path[i][1])] = 0; } else { mask[(path[i][0])][(path[i][1])] = 1; } } } public static void erasePrimes //Aux 4 for hg_step5. (int[][] mask) { for (int i=0; i<mask.length; i++) { for (int j=0; j<mask[i].length; j++) { if (mask[i][j]==2) { mask[i][j] = 0; } } } } public static void clearCovers //Aux 5 for hg_step5 (and not only). (int[] rowCover, int[] colCover) { for (int i=0; i<rowCover.length; i++) { rowCover[i] = 0; } for (int j=0; j<colCover.length; j++) { colCover[j] = 0; } } public static int hg_step6(int step, double[][] cost, int[] rowCover, int[] colCover, double maxCost) { //What STEP 6 does: //Find smallest uncovered value in cost: a. Add it to every element of covered rows //b. Subtract it from every element of uncovered columns. Go to step 4. double minval = findSmallest(cost, rowCover, colCover, maxCost); for (int i=0; i<rowCover.length; i++) { for (int j=0; j<colCover.length; j++) { if (rowCover[i]==1) { cost[i][j] = cost[i][j] + minval; } if (colCover[j]==0) { cost[i][j] = cost[i][j] - minval; } } } step = 4; return step; } public static double findSmallest //Aux 1 for hg_step6. (double[][] cost, int[] rowCover, int[] colCover, double maxCost) { double minval = maxCost; //There cannot be a larger cost than this. for (int i=0; i<cost.length; i++) //Now find the smallest uncovered value. { for (int j=0; j<cost[i].length; j++) { if (rowCover[i]==0 && colCover[j]==0 && (minval > cost[i][j])) { minval = cost[i][j]; } } } return minval; } //***********// //MAIN METHOD// //***********// public static void main(String[] args) { //Below enter "max" or "min" to find maximum sum or minimum sum assignment. String sumType = "max"; //Hard-coded example. //double[][] array = //{ // {1, 2, 3}, // {2, 4, 6}, // {3, 6, 9} //}; //<UNCOMMENT> BELOW AND COMMENT BLOCK ABOVE TO USE A RANDOMLY GENERATED MATRIX int numOfRows = readInput("How many rows for the matrix? "); int numOfCols = readInput("How many columns for the matrix? "); double[][] array = new double[numOfRows][numOfCols]; generateRandomArray(array, "random"); //All elements within [0,1]. //</UNCOMMENT> if (array.length > array[0].length) { System.out.println("Array transposed (because rows>columns).\n"); //Cols must be >= Rows. array = transpose(array); } //<COMMENT> TO AVOID PRINTING THE MATRIX FOR WHICH THE ASSIGNMENT IS CALCULATED System.out.println("\n(Printing out only 2 decimals)\n"); System.out.println("The matrix is:"); for (int i=0; i<array.length; i++) { for (int j=0; j<array[i].length; j++) {System.out.printf("%.2f\t", array[i][j]);} System.out.println(); } System.out.println(); //</COMMENT>*/ double startTime = System.nanoTime(); int[][] assignment = new int[array.length][2]; assignment = hgAlgorithm(array, sumType); //Call Hungarian algorithm. double endTime = System.nanoTime(); System.out.println("The winning assignment (" + sumType + " sum) is:\n"); double sum = 0; for (int i=0; i<assignment.length; i++) { //<COMMENT> to avoid printing the elements that make up the assignment System.out.printf("array(%d,%d) = %.2f\n", (assignment[i][0]+1), (assignment[i][1]+1), array[assignment[i][0]][assignment[i][1]]); sum = sum + array[assignment[i][0]][assignment[i][1]]; //</COMMENT> } System.out.printf("\nThe %s is: %.2f\n", sumType, sum); printTime((endTime - startTime)/1000000000.0); } }
[ "nirdick@gmail.com" ]
nirdick@gmail.com
5f0288d606c4ca002d96cef02b4dcd87c4d06b9b
60a6fb64d89e7385cf9e4bbc2c0e35afa1339ec5
/Amazon/src/main/java/driver/DriverInstance.java
1e9850d6fde1b1b937132a118e4304aed34cb67b
[]
no_license
samrataman/Amazon
623a5c3241ad0d43c2a19f0b0850a2434175f080
9408cb3a1504b30fd02771b18e4007c2e068a014
refs/heads/master
2022-07-06T11:40:38.715713
2020-04-20T11:17:55
2020-04-20T11:17:55
257,217,275
0
0
null
2022-06-29T18:05:11
2020-04-20T08:24:47
Java
UTF-8
Java
false
false
1,148
java
package driver; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.WebDriverWait; public class DriverInstance{ public static DriverInstance instance; WebDriver driver; WebDriverWait wait; @SuppressWarnings("deprecation") public DriverInstance(String browser){ if(browser.equals("Chrome")) { System.setProperty("webdriver.chrome.driver", "F:\\selenium_server\\Driver\\chromedriver_win32\\chromedriver.exe"); driver = new ChromeDriver(); } else if(browser.equals("firefox")) { System.setProperty("webdriver.firefoxDriver.driver", "F:\\selenium_server\\Driver\\geckodriver.exe"); driver = new FirefoxDriver(); } wait = new WebDriverWait(driver, 120); } public static void setInstance(String browser) { DriverInstance.instance = new DriverInstance(browser); } public static DriverInstance getInstance() { return instance; } public WebDriver getDriver(){ return driver; } public WebDriverWait getWait() { return wait; } }
[ "user@admin" ]
user@admin
fc300e385b670dd77bf5aa8c512cb81610182af8
ca1cb438f2629140095fa2806cdfbef94f149473
/src/main/java/com/zyin/zyinhud/command/CommandZyinHUDOptions.java
dd831466fcd432c6c32f32498328f8f187d9f217
[]
no_license
Seferan/zyinhud
767f2db3fc1a2a835fab8bce15777bbeaac9b723
6eab32fa09ea94006061cf39478a8839b83513df
refs/heads/master
2021-01-21T08:21:13.762844
2014-02-06T18:35:12
2014-02-06T18:35:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
662
java
package com.zyin.zyinhud.command; import net.minecraft.client.Minecraft; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import com.zyin.zyinhud.gui.GuiZyinHUDOptions; public class CommandZyinHUDOptions extends CommandBase { private static Minecraft mc = Minecraft.getMinecraft(); @Override public String getCommandName() { return "zyinhud"; } @Override public String getCommandUsage(ICommandSender iCommandSender) { return "commands.zyinhud.usage"; } @Override public void processCommand(ICommandSender iCommandSender, String[] parameters) { mc.displayGuiScreen(new GuiZyinHUDOptions(null)); } }
[ "bomber055@yahoo.com" ]
bomber055@yahoo.com
f0eb07d10863df07a65811387f31a6894e39c3a5
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Math/87/org/apache/commons/math/optimization/linear/UnboundedSolutionException_UnboundedSolutionException_36.java
a8ade293005f166d9a8b5d6cf1c6b3cfb6e6c3a0
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
292
java
org apach common math optim linear repres except thrown optim solut escap infin version revis date unbound solut except unboundedsolutionexcept optim except optimizationexcept simpl constructor messag unbound solut except unboundedsolutionexcept unbound solut
[ "hvdthong@gmail.com" ]
hvdthong@gmail.com
c686079e16d525f067187ca49f79a56b943ad9da
87162cead29a60dd9ac9003d42f2dec0bc761bf4
/Hola-Mundo-Spanish.java
8a6f8c635c596c7b761a6f81c7b113ade30cf494
[]
no_license
BrunaCarla23/Hello-Hacktober
2111c83f1552301a49c6355cbf97cb83aa046bb8
902f5b7fddc20619d960d7feccffe1c79eb7f158
refs/heads/master
2020-04-22T04:53:58.109434
2019-02-11T03:03:09
2019-02-11T03:03:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
111
java
public class HolaMundo { public static void main(String[] args) { System.out.println("Hola mundo"); } }
[ "noreply@github.com" ]
BrunaCarla23.noreply@github.com
cc26dd5dcbe6bd024d354a5d2aa976fe479dd531
f391f4ff06e6ec1da9faea903f5799ab494d147d
/src/main/java/com/sbs/common/converter/TimeConverter.java
64b9eebac3d975302bc7d8ca608aa74685815a1c
[]
no_license
hellnw/manager-sys
1a015e9899aab7069cefb532008fcf67d1cf8ecd
69e121fa0d06bfc68c52ce4eae7b5f1d53ab7a8b
refs/heads/master
2022-09-12T10:00:30.331395
2020-03-11T02:42:59
2020-03-11T02:42:59
246,251,698
0
0
null
null
null
null
UTF-8
Java
false
false
843
java
package com.sbs.common.converter; import com.sbs.common.utils.DateUtil; import com.wuwenze.poi.convert.WriteConverter; import com.wuwenze.poi.exception.ExcelKitWriteConverterException; import lombok.extern.slf4j.Slf4j; import java.text.ParseException; /** * Execl导出时间类型字段格式化 * */ @Slf4j public class TimeConverter implements WriteConverter { @Override public String convert(Object value) { if (value == null) return ""; else { try { return DateUtil.formatCSTTime(value.toString(), DateUtil.FULL_TIME_SPLIT_PATTERN); } catch (ParseException e) { String message = "时间转换异常"; log.error(message, e); throw new ExcelKitWriteConverterException(message); } } } }
[ "Hao-Shuai.Wei@aia.com" ]
Hao-Shuai.Wei@aia.com
4eb4017ec573373c12b1210a3f51cf31da8d2620
9ebf2ee4e3750258d7107ac5f1d56cf73b6ad71e
/src/com/moosecanoes/levelup/util/Utils.java
ebb5b1cd19320a173d84ad2e3de5ea6f6e46d0e8
[]
no_license
benjaminhallock/LevelUp
02bc6ca53ea31e952cdbbacc1f6b22066a445953
a419ab919bcb7651d039be59d2c4d2879f719273
refs/heads/master
2021-01-19T05:03:21.354124
2016-06-11T14:43:25
2016-06-11T14:43:25
60,539,244
0
0
null
null
null
null
UTF-8
Java
false
false
9,364
java
/* * Decompiled with CFR 0_114. * * Could not load the following classes: * org.bukkit.Bukkit * org.bukkit.Location * org.bukkit.Material * org.bukkit.OfflinePlayer * org.bukkit.Sound * org.bukkit.World * org.bukkit.block.Block * org.bukkit.block.BlockState * org.bukkit.block.Sign * org.bukkit.command.CommandSender * org.bukkit.enchantments.EnchantmentTarget * org.bukkit.entity.Player * org.bukkit.inventory.ItemStack * org.bukkit.inventory.meta.ItemMeta * org.bukkit.permissions.PermissionAttachmentInfo */ package com.moosecanoes.levelup.util; import com.moosecanoes.levelup.util.config.Settings; import com.moosecanoes.levelup.util.pairing.PairState; import java.text.DecimalFormat; import java.util.List; import java.util.Random; import java.util.Set; import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.OfflinePlayer; import org.bukkit.Sound; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.block.BlockState; import org.bukkit.block.Sign; import org.bukkit.command.CommandSender; import org.bukkit.enchantments.EnchantmentTarget; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.permissions.PermissionAttachmentInfo; public final class Utils { public static final String[] CONFIGS = new String[]{"messages.yml", "mobhunter.yml", "offers.yml", "signs.yml", "skulls.yml", "whitelist.yml"}; private static final DecimalFormat MONEY = new DecimalFormat("0.00"); public static String color(String s) { s = s.replaceAll("&([a-zA-Z0-9])", "\u00a7$1"); return s; } public static String color(String s, String codeRegex) { s = s.replaceAll(codeRegex + "([a-zA-Z0-9])", "\u00a7$1"); return s; } public static OfflinePlayer getPlayerFromString(String s) { if (Bukkit.getPlayer((String)s) != null) { return Bukkit.getPlayer((String)s); } if (Bukkit.getPlayerExact((String)s) != null) { return Bukkit.getPlayerExact((String)s); } return Bukkit.getOfflinePlayer((String)s); } public static boolean hasPlayedBefore(OfflinePlayer player) { for (OfflinePlayer p : Bukkit.getOfflinePlayers()) { if (!p.getUniqueId().equals(player.getUniqueId())) continue; return true; } for (Player p2 : Bukkit.getOnlinePlayers()) { if (!p2.getUniqueId().equals(player.getUniqueId())) continue; return true; } return false; } public static /* varargs */ boolean perms(CommandSender cs, String ... perms) { if (!Settings.isUsePerms()) { return true; } if (cs.hasPermission("hunter.admin")) { return true; } for (String s : perms) { if (!cs.hasPermission(s)) continue; return true; } return false; } public static boolean isNumeric(String s) { return s.matches("[0-9]+") || s.matches("[0-9]*[.][0-9]+") || s.matches("[0-9]+[.][0-9]*"); } public static Sound getGUINope() { try { return Sound.valueOf((String)"NOTE_SNARE_DRUM"); } catch (Exception e) { return Sound.valueOf((String)"BLOCK_NOTE_SNARE"); } } public static Sound getGUIDing() { try { return Sound.valueOf((String)"NOTE_PIANO"); } catch (Exception e) { return Sound.valueOf((String)"BLOCK_NOTE_HARP"); } } public static Sound getGUIDingaling() { try { return Sound.valueOf((String)"LEVEL_UP"); } catch (Exception e) { return Sound.valueOf((String)"ENTITY_PLAYER_LEVELUP"); } } public static String money(double n) { return MONEY.format(n); } public static String f(String x, String victim, double value) { String s = x.replace("VICTIM", victim); s = s.replace("VALUE", Utils.money(value)); return Utils.color(s); } public static String f(String x, String hunter, String victim, double value) { String s = x.replace("HUNTER", hunter); s = s.replace("VICTIM", victim); s = s.replace("VALUE", Utils.money(value)); return Utils.color(s); } public static String f(String x, String hunter, double value, int amount) { String s = x.replace("HUNTER", hunter); s = s.replace("VALUE", Utils.money(value)); s = s.replace("AMOUNT", "" + amount + ""); return Utils.color(s); } public static String f(String x, String hunter, String victim, double value, int amount) { String s = x.replace("HUNTER", hunter); s = s.replace("VICTIM", victim); s = s.replace("VALUE", Utils.money(value)); s = s.replace("AMOUNT", "" + amount + ""); return Utils.color(s); } public static boolean luckDrop(double dropRate) { Random random = new Random(); double x = random.nextInt(10000); return (x /= 100.0) < dropRate; } public static double getValue(ItemStack skull) { String loreString = (String)skull.getItemMeta().getLore().get(0); loreString = Utils.removeLoreFormat(loreString); double skullWorth = 0.0; if (!loreString.isEmpty()) { skullWorth = Double.parseDouble(loreString); } return skullWorth; } public static String removeLoreFormat(String s) { String crap = s.replaceAll("[0-9]*[,.]?[0-9]*", ""); String notCrap = s.replaceAll("[" + crap + "]", ""); while (notCrap.length() > 0 && !Character.isDigit(notCrap.charAt(0))) { notCrap = notCrap.substring(1); } while (notCrap.length() > 0 && !Character.isDigit(notCrap.charAt(notCrap.length() - 1))) { notCrap = notCrap.substring(0, notCrap.length() - 1); } return notCrap.replaceAll(",", "."); } public static boolean dropWith(PairState skullState) { boolean dropWithBalance = Settings.isDrop_withBalance(); boolean dropWithBounty = Settings.isDrop_withBounty(); if (dropWithBalance) { if (dropWithBounty) { return skullState != null && skullState != PairState.NEITHER; } return skullState == PairState.BALANCE; } if (dropWithBounty) { return skullState == PairState.BOUNTY; } return skullState == PairState.NEITHER; } public static String parseLocation(Location loc) { String tag = ""; tag = tag + loc.getWorld().getName() + "%"; tag = tag + loc.getX() + "%"; tag = tag + loc.getY() + "%"; tag = tag + loc.getZ(); tag = tag.replaceAll("(\\d+)\\.(\\d+)", "$1,$2"); return tag; } public static Location buildLocation(String tag) { String[] arr = tag.split("%", 4); arr[0] = arr[0].replaceAll(",", "."); arr[1] = arr[1].replaceAll(",", "."); arr[2] = arr[2].replaceAll(",", "."); arr[3] = arr[3].replaceAll(",", "."); double x = 0.0; double y = 0.0; double z = 0.0; if (Utils.isNumeric(arr[1])) { x = Double.parseDouble(arr[1]); } if (Utils.isNumeric(arr[2])) { y = Double.parseDouble(arr[2]); } if (Utils.isNumeric(arr[2])) { z = Double.parseDouble(arr[2]); } return new Location(Bukkit.getWorld((String)arr[0]), x, y, z); } public static double getSellRate(Player p) { double sellRate = Settings.getSellRate(); if (p != null) { for (PermissionAttachmentInfo perm : p.getEffectivePermissions()) { String num; if (!perm.getPermission().startsWith("hunter.sellrate.") || !Utils.isNumeric(num = perm.getPermission().replace("hunter.sellrate.", ""))) continue; sellRate = Double.parseDouble(num); } } return sellRate; } public static void updateSignAt(Player p, Location loc) { if (loc.getBlock().getState() instanceof Sign) { String top = Settings.getFmt_sign_top(); String title = Settings.getFmt_sign_title(); String value = Settings.getFmt_sign_value(); String bottom = Settings.getFmt_sign_bottom(); String rate = "" + Utils.getSellRate(p) + ""; value = Settings.isUsePercent() ? value + "%" : "$" + value; top = Utils.color(top.replace("VALUE", rate)); title = Utils.color(title.replace("VALUE", rate)); value = Utils.color(value.replace("VALUE", rate)); bottom = Utils.color(bottom.replace("VALUE", rate)); p.sendSignChange(loc, new String[]{top, title, value, bottom}); } } public static boolean testEnchantment(ItemStack item) { return item != null && (EnchantmentTarget.WEAPON.includes(item) || Settings.isEnch_allowBows() && EnchantmentTarget.BOW.includes(item) || Settings.isEnch_allowTools() && EnchantmentTarget.TOOL.includes(item) || Settings.isEnch_allowBooks() && item.getType() == Material.BOOK); } }
[ "ben@ben.com" ]
ben@ben.com
80ddfa73c22a0857f4e92ebc080f30c7fba66c96
abe6431c5a2dcc7f038135d29bee3cf0b4824eb2
/src/main/java/com/zt/ebook/response/bookResponse/BookChapterResponse.java
fccf4f6ff16bbfa4742cfa7ae9703e5f7c5883f4
[]
no_license
zlp-github/ebook
7822af78e6665e85070f00a7d9b7bd02102cca85
6b83fbaaa8109d602b89e0ecd4340b5594495904
refs/heads/master
2023-04-07T03:02:59.679328
2020-04-20T04:56:39
2020-04-20T04:56:39
248,119,905
0
0
null
2023-03-23T20:38:59
2020-03-18T02:27:31
Java
UTF-8
Java
false
false
286
java
package com.zt.ebook.response.bookResponse; import lombok.Data; import java.util.List; /** * Author: zlp * Date: 2020-03-20 21:19 * Description:张立朋,写点注释吧!! */ @Data public class BookChapterResponse { List<ContentResponse> bookChapterList; Long total; }
[ "zlp17709163350@163.com" ]
zlp17709163350@163.com
3148fbd8ac88f982d52dd9533eae12dade870375
90d04462c3149e3c27ed81d28d8040e9a63b7779
/src/busWidget/BusWidget_toSix.java
5c19b4feb35e69f7953050099b44dc6bdae47235
[]
no_license
SaebomBang/HandongServer
cb48a528fcf183ed500eb4a1b483216c55190ff4
a0177baac57b590daa78ad2526447af8b1205d50
refs/heads/master
2021-01-11T09:25:28.710096
2016-12-22T09:55:07
2016-12-22T09:55:07
77,108,073
1
1
null
null
null
null
UTF-8
Java
false
false
4,060
java
package busWidget; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.text.ParseException; import java.util.ArrayList; import java.util.List; import net.htmlparser.jericho.Element; import net.htmlparser.jericho.HTMLElementName; import net.htmlparser.jericho.Source; public class BusWidget_toSix { public URL Url; public HttpURLConnection con; public InputStream ret; public BusWidget_toSix() { } public InputStream Crawler(String Address) { try { Url = new URL(Address); } catch (Exception e) { System.err.println(e); } if (Address == null || Address.length() == 0) { System.err.println("address setup->setUrl(String str)"); return null; } else { try { con = (HttpURLConnection) Url.openConnection(); con.setDoOutput(true); ret = con.getInputStream(); } catch (Exception e) { System.err.println(e); return null; } } return ret; } public List<BusWidget> Parserer(InputStream input) throws ParseException { Source source = null; List<BusWidget> bus = new ArrayList<BusWidget>(); TimeSplit2Widget timesplit = new TimeSplit2Widget(); try { source = new Source(input); } catch (IOException e) { e.printStackTrace(); } source.fullSequentialParse(); List<Element> table = source.getAllElements(HTMLElementName.TABLE); Element form = null; String find = ""; for (Element e : table) { find = e.getAttributeValue("cellpadding"); if (find != null && find.equals("1")) { form = e; break; } } if (form == null) return null; List<Element> trs = form.getAllElements(HTMLElementName.TR); for (int i = 3; i < trs.size(); i++) { BusWidget b = new BusWidget(); String school = null, hwan = null, six = null; if ((trs.get(i).getChildElements().size() == 3) && (i == trs.size() - 1)) { school = trs.get(i).getChildElements().get(0).getContent() .toString(); hwan = trs.get(i).getChildElements().get(1).getContent() .toString(); six = trs.get(i).getChildElements().get(2).getContent() .toString(); if (timesplit.currentTime(school).equals("a") || timesplit.currentTime(hwan).equals("a") || timesplit.currentTime(six).equals("a")) { school = timesplit.spt(school); hwan = timesplit.spt(hwan); six = timesplit.spt(six); b.setSchool(school); b.setHwan(hwan); b.setSix(six); bus.add(b); } } // else if ((trs.get(i).getChildElements().size() == 4) && (i == trs.size() - 1)) { school = trs.get(i).getChildElements().get(0).getContent() .toString(); hwan = trs.get(i).getChildElements().get(1).getContent() .toString(); six = trs.get(i).getChildElements().get(2).getContent() .toString(); if (timesplit.currentTime(school).equals("a") || timesplit.currentTime(hwan).equals("a") || timesplit.currentTime(six).equals("a")) { school = timesplit.spt(school); hwan = timesplit.spt(hwan); six = timesplit.spt(six); b.setSchool(school); b.setHwan(hwan); b.setSix(six); bus.add(b); } } else if (trs.get(i).getChildElements().size() == 3) { } // normal bus else if (trs.get(i).getChildElements().size() == 5) { school = trs.get(i).getChildElements().get(0).getContent() .toString(); hwan = trs.get(i).getChildElements().get(1).getContent() .toString(); six = trs.get(i).getChildElements().get(2).getContent() .toString(); if (timesplit.currentTime(school).equals("a") || timesplit.currentTime(hwan).equals("a") || timesplit.currentTime(six).equals("a")) { school = timesplit.spt(school); hwan = timesplit.spt(hwan); six = timesplit.spt(six); b.setSchool(school); b.setHwan(hwan); b.setSix(six); bus.add(b); } } } return bus; } }
[ "saebom023@gmail.com" ]
saebom023@gmail.com
3d375608321294e0fe07d67b478f57156a627c0a
ccf2d23d613c46910a70b783cf80114082cd6e3f
/Competitive/TLE/src/December17/p5/Main.java
b9d002bba73aaedb0214d887e7b16949ad0bcdae
[]
no_license
Scowluga/DSA-Java
0688537b5c213d44a3b4d516bba61a7f0bad6bbc
45966545a35521f8c803fcbd3fe6f016360d0fce
refs/heads/master
2021-01-20T06:38:44.792081
2019-02-11T01:36:05
2019-02-11T01:36:05
86,529,882
1
0
null
null
null
null
UTF-8
Java
false
false
8,366
java
package December17.p5; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.math.BigInteger; import java.util.ArrayList; import java.util.List; /* Pascal's Tree 80/100 pts */ public class Main { static BigInteger[] factorials; public static void main(String[] args) throws IOException { FastReader reader = new FastReader(); // n'th row int N = reader.nextInt(); // mod m BigInteger M = t(reader.nextInt()); // index: N, value: factorial factorials = new BigInteger[N + 1]; List<BigInteger> out = new ArrayList<>(); out.add(BigInteger.ONE); out.add(t(N % M.intValue())); BigInteger n = t(N); for (int i = 2; i <= N / 2; i++ ) { // COMPUTING EACH VALUE TWICE n = n.multiply(t(N - i + 1)).divide(t(i)); BigInteger m = n.mod(M); out.add(m); } // output for (int i = 0; i < out.size(); i++) { System.out.println(out.get(i)); } if (N % 2 == 1) { System.out.println(out.get(out.size() - 1)); } for (int i = out.size() - 2; i >= 0; i--) { System.out.println(out.get(i)); } } static BigInteger t(Integer n) { return BigInteger.valueOf(n.intValue()); } public static class FastReader { private final int BUFFER_SIZE = 1 << 16; private final DataInputStream din; private final byte[] buffer; private int bufferPointer, bytesRead; public FastReader() { din = new DataInputStream(System.in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public FastReader(String file_name) throws IOException { din = new DataInputStream(new FileInputStream(file_name)); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public String readLine() throws IOException { byte[] buf = new byte[6400]; // line length int cnt = 0, c; while ((c = read()) != -1) { if (c == '\n') break; buf[cnt++] = (byte) c; } return new String(buf, 0, cnt); } public List<Integer> readLineAsIntegers() throws IOException { // int[] ret = new int[1024]; List<Integer> ret = new ArrayList<>(); int idx = 0; byte c = read(); while (c != -1) { if (c == '\n' || c == '\r') break; // next integer int i = 0; while (c <= ' ') { c = read(); } boolean negative = (c == '-'); if (negative) { c = read(); } do { i = i * 10 + (c - '0'); c = read(); } while (c >= '0' && c <= '9'); // ret[idx++] = (negative) ? -i : i; ret.add((negative) ? -i : i); } return ret; } public List<Long> readLineAsLongs() throws IOException { List<Long> ret = new ArrayList<>(); int idx = 0; byte c = read(); while (c != -1) { if (c == '\n' || c == '\r') break; // next integer long i = 0; while (c <= ' ') { c = read(); } boolean negative = (c == '-'); if (negative) { c = read(); } do { i = i * 10 + (c - '0'); c = read(); } while (c >= '0' && c <= '9'); ret.add((negative) ? -i : i); } return ret; } public List<Double> readLineAsDoubles() throws IOException { List<Double> ret = new ArrayList<>(); int idx = 0; byte c = read(); while (c != -1) { if (c == '\n' || c == '\r') break; // next integer double d = 0, div = 1; while (c <= ' ') { c = read(); } boolean negative = (c == '-'); if (negative) { c = read(); } do { d = d * 10 + (c - '0'); c = read(); } while (c >= '0' && c <= '9'); if (c == '.') { while ((c = read()) >= '0' && c <= '9') { d += (c - '0') / (div *= 10); } } ret.add((negative) ? -d : d); } return ret; } public int nextInt() throws IOException { int ret = 0; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); return (neg) ? -ret : ret; } public long nextLong() throws IOException { long ret = 0; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) { c = read(); } do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); return (neg) ? -ret : ret; } public double nextDouble() throws IOException { double ret = 0, div = 1; byte c = read(); while (c <= ' ') { c = read(); } boolean neg = (c == '-'); if (neg) { c = read(); } do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (c == '.') { while ((c = read()) >= '0' && c <= '9') { ret += (c - '0') / (div *= 10); } } return (neg) ? -ret : ret; } public String nextString() throws IOException { byte[] ret = new byte[1024]; int idx = 0; byte c = read(); while (c <= ' ') { c = read(); } do { ret[idx++] = c; c = read(); } while (c != -1 && c != ' ' && c != '\n' && c != '\r'); return new String(ret, 0, idx); } private byte read() throws IOException { if (bufferPointer == bytesRead) { // fill buffer bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); if (bytesRead == -1) { buffer[0] = -1; } } return buffer[bufferPointer++]; } public int[] readLineAsIntArray(int n) throws IOException { int[] ret = new int[n]; // int ret = new ArrayList<>(); int idx = 0; byte c = read(); while (c != -1) { if (c == '\n' || c == '\r') break; // next integer int i = 0; while (c <= ' ') { c = read(); } boolean negative = (c == '-'); if (negative) { c = read(); } do { i = i * 10 + (c - '0'); c = read(); } while (c >= '0' && c <= '9'); ret[idx++] = (negative) ? -i : i; if (idx >= n) { break; } // ret.add((negative) ? -i : i); } return ret; } public void close() throws IOException { if (din != null) { din.close(); } } } }
[ "david.scowluga@gmail.com" ]
david.scowluga@gmail.com
1d8c82bff810a0cfca9730b161ffe94c93e0e991
c68ce7aa2d02eca1114fdf716e30beca758e3039
/src/com/rain/controller/CommonController.java
002de7b3ab5072c002fabb6a2c2f4102cf121351
[]
no_license
liu961105/rainweb
a0c02c0a3f455077e3638d3daf8bdc5c47eb4991
346c2991eb1462f0a916f977f554909cb4984c6d
refs/heads/master
2020-09-06T11:36:53.690514
2020-01-14T02:57:25
2020-01-14T02:57:25
220,412,919
1
0
null
null
null
null
UTF-8
Java
false
false
1,202
java
package com.rain.controller; import com.rain.service.DataStatisticsService; import com.rain.service.RainService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import javax.annotation.Resource; @Controller public class CommonController { @Resource private DataStatisticsService dataStatisticsService; @Resource private RainService rainService; @RequestMapping(value="/{formName}") public String loginForm(@PathVariable String formName){ // 作为一个空方法,可以匹配任何无效输入,再跳转到404 return formName; // String blank = "blank"; // return blank; } @RequestMapping(value="/") public String index(){ String blank = "index"; return blank; } @RequestMapping(value="/welcome") public String welcome(Model model){ model.addAttribute("dataStatistics",dataStatisticsService.findOne()); //查询最新的公告 model.addAttribute("notice",rainService.getNewNotice()); String blank = "welcome"; return blank; } }
[ "1321205629@qq.com" ]
1321205629@qq.com
512a48abb0c4d7d9fe20ff560e52004d54a7d9d2
597b0daa76ba28adf45359b5aa09cef5886f0e29
/spring-websocket/src/main/java/org/springframework/web/socket/messaging/DefaultSimpUserRegistry.java
c1c8ae900c54615cf33b65f777787b39b35fb327
[ "Apache-2.0" ]
permissive
wjmwss-zz/spring
78e579e3ec4abc983aa80a4547fadc2b654ea959
e94eb5efb79fc4bc5336d0b571609c141d35d5cb
refs/heads/master
2023-02-21T09:26:25.768420
2021-01-23T19:04:30
2021-01-23T19:04:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,399
java
/* * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.web.socket.messaging; import org.springframework.context.ApplicationEvent; import org.springframework.context.event.SmartApplicationListener; import org.springframework.core.Ordered; import org.springframework.lang.Nullable; import org.springframework.messaging.Message; import org.springframework.messaging.simp.SimpMessageHeaderAccessor; import org.springframework.messaging.simp.user.*; import org.springframework.messaging.support.MessageHeaderAccessor; import org.springframework.util.Assert; import java.security.Principal; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; /** * A default implementation of {@link SimpUserRegistry} that relies on * {@link AbstractSubProtocolEvent} application context events to keep * track of connected users and their subscriptions. * * @author Rossen Stoyanchev * @since 4.2 */ public class DefaultSimpUserRegistry implements SimpUserRegistry, SmartApplicationListener { private int order = Ordered.LOWEST_PRECEDENCE; /* Primary lookup that holds all users and their sessions */ private final Map<String, LocalSimpUser> users = new ConcurrentHashMap<>(); /* Secondary lookup across all sessions by id */ private final Map<String, LocalSimpSession> sessions = new ConcurrentHashMap<>(); private final Object sessionLock = new Object(); /** * Specify the order value for this registry. * <p>Default is {@link Ordered#LOWEST_PRECEDENCE}. * @since 5.0.8 */ public void setOrder(int order) { this.order = order; } @Override public int getOrder() { return this.order; } // SmartApplicationListener methods @Override public boolean supportsEventType(Class<? extends ApplicationEvent> eventType) { return AbstractSubProtocolEvent.class.isAssignableFrom(eventType); } @Override public void onApplicationEvent(ApplicationEvent event) { AbstractSubProtocolEvent subProtocolEvent = (AbstractSubProtocolEvent) event; Message<?> message = subProtocolEvent.getMessage(); SimpMessageHeaderAccessor accessor = MessageHeaderAccessor.getAccessor(message, SimpMessageHeaderAccessor.class); Assert.state(accessor != null, "No SimpMessageHeaderAccessor"); String sessionId = accessor.getSessionId(); Assert.state(sessionId != null, "No session id"); if (event instanceof SessionSubscribeEvent) { LocalSimpSession session = this.sessions.get(sessionId); if (session != null) { String id = accessor.getSubscriptionId(); String destination = accessor.getDestination(); if (id != null && destination != null) { session.addSubscription(id, destination); } } } else if (event instanceof SessionConnectedEvent) { Principal user = subProtocolEvent.getUser(); if (user == null) { return; } String name = user.getName(); if (user instanceof DestinationUserNameProvider) { name = ((DestinationUserNameProvider) user).getDestinationUserName(); } synchronized (this.sessionLock) { LocalSimpUser simpUser = this.users.get(name); if (simpUser == null) { simpUser = new LocalSimpUser(name); this.users.put(name, simpUser); } LocalSimpSession session = new LocalSimpSession(sessionId, simpUser); simpUser.addSession(session); this.sessions.put(sessionId, session); } } else if (event instanceof SessionDisconnectEvent) { synchronized (this.sessionLock) { LocalSimpSession session = this.sessions.remove(sessionId); if (session != null) { LocalSimpUser user = session.getUser(); user.removeSession(sessionId); if (!user.hasSessions()) { this.users.remove(user.getName()); } } } } else if (event instanceof SessionUnsubscribeEvent) { LocalSimpSession session = this.sessions.get(sessionId); if (session != null) { String subscriptionId = accessor.getSubscriptionId(); if (subscriptionId != null) { session.removeSubscription(subscriptionId); } } } } @Override public boolean supportsSourceType(@Nullable Class<?> sourceType) { return true; } // SimpUserRegistry methods @Override @Nullable public SimpUser getUser(String userName) { return this.users.get(userName); } @Override public Set<SimpUser> getUsers() { return new HashSet<>(this.users.values()); } @Override public int getUserCount() { return this.users.size(); } @Override public Set<SimpSubscription> findSubscriptions(SimpSubscriptionMatcher matcher) { Set<SimpSubscription> result = new HashSet<>(); for (LocalSimpSession session : this.sessions.values()) { for (SimpSubscription subscription : session.subscriptions.values()) { if (matcher.match(subscription)) { result.add(subscription); } } } return result; } @Override public String toString() { return "users=" + this.users; } private static class LocalSimpUser implements SimpUser { private final String name; private final Map<String, SimpSession> userSessions = new ConcurrentHashMap<>(1); public LocalSimpUser(String userName) { Assert.notNull(userName, "User name must not be null"); this.name = userName; } @Override public String getName() { return this.name; } @Override public boolean hasSessions() { return !this.userSessions.isEmpty(); } @Override @Nullable public SimpSession getSession(@Nullable String sessionId) { return (sessionId != null ? this.userSessions.get(sessionId) : null); } @Override public Set<SimpSession> getSessions() { return new HashSet<>(this.userSessions.values()); } void addSession(SimpSession session) { this.userSessions.put(session.getId(), session); } void removeSession(String sessionId) { this.userSessions.remove(sessionId); } @Override public boolean equals(@Nullable Object other) { return (this == other || (other instanceof SimpUser && getName().equals(((SimpUser) other).getName()))); } @Override public int hashCode() { return getName().hashCode(); } @Override public String toString() { return "name=" + getName() + ", sessions=" + this.userSessions; } } private static class LocalSimpSession implements SimpSession { private final String id; private final LocalSimpUser user; private final Map<String, SimpSubscription> subscriptions = new ConcurrentHashMap<>(4); public LocalSimpSession(String id, LocalSimpUser user) { Assert.notNull(id, "Id must not be null"); Assert.notNull(user, "User must not be null"); this.id = id; this.user = user; } @Override public String getId() { return this.id; } @Override public LocalSimpUser getUser() { return this.user; } @Override public Set<SimpSubscription> getSubscriptions() { return new HashSet<>(this.subscriptions.values()); } void addSubscription(String id, String destination) { this.subscriptions.put(id, new LocalSimpSubscription(id, destination, this)); } void removeSubscription(String id) { this.subscriptions.remove(id); } @Override public boolean equals(@Nullable Object other) { return (this == other || (other instanceof SimpSubscription && getId().equals(((SimpSubscription) other).getId()))); } @Override public int hashCode() { return getId().hashCode(); } @Override public String toString() { return "id=" + getId() + ", subscriptions=" + this.subscriptions; } } private static class LocalSimpSubscription implements SimpSubscription { private final String id; private final LocalSimpSession session; private final String destination; public LocalSimpSubscription(String id, String destination, LocalSimpSession session) { Assert.notNull(id, "Id must not be null"); Assert.hasText(destination, "Destination must not be empty"); Assert.notNull(session, "Session must not be null"); this.id = id; this.destination = destination; this.session = session; } @Override public String getId() { return this.id; } @Override public LocalSimpSession getSession() { return this.session; } @Override public String getDestination() { return this.destination; } @Override public boolean equals(@Nullable Object other) { if (this == other) { return true; } if (!(other instanceof SimpSubscription)) { return false; } SimpSubscription otherSubscription = (SimpSubscription) other; return (getId().equals(otherSubscription.getId()) && getSession().getId().equals(otherSubscription.getSession().getId())); } @Override public int hashCode() { return getId().hashCode() * 31 + getSession().getId().hashCode(); } @Override public String toString() { return "destination=" + this.destination; } } }
[ "wjmcoo@outlook.com" ]
wjmcoo@outlook.com
36e1a830fe81d9e62190d821764a117eb4fbfda1
92f10c41bad09bee05acbcb952095c31ba41c57b
/app/src/main/java/io/github/alula/ohmygod/MainActivity8433.java
6cb105d0ec897c511b2e4637b599aea52ca78a45
[]
no_license
alula/10000-activities
bb25be9aead3d3d2ea9f9ef8d1da4c8dff1a7c62
f7e8de658c3684035e566788693726f250170d98
refs/heads/master
2022-07-30T05:54:54.783531
2022-01-29T19:53:04
2022-01-29T19:53:04
453,501,018
16
0
null
null
null
null
UTF-8
Java
false
false
339
java
package io.github.alula.ohmygod; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class MainActivity8433 extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
[ "6276139+alula@users.noreply.github.com" ]
6276139+alula@users.noreply.github.com
de6910b729210b8d2e4853ff95bc23f6a27f6fee
6bad724d81e9d69e00889a3a0620df2460315223
/src/logic/function/evaluable/predicate/Predicate.java
3aadfce8b96dcfb2db368e11bdefe64b20feb643
[]
no_license
Echogene/Tarka
75dcdaed6a9696251973716b3a3e59c336a93d55
e5a9c17adc30fcbff50ed208d95bfb185b757fdd
refs/heads/master
2020-06-04T15:42:05.024420
2017-04-16T18:48:42
2017-04-16T18:48:42
18,262,568
0
0
null
null
null
null
UTF-8
Java
false
false
255
java
package logic.function.evaluable.predicate; import logic.Nameable; import logic.function.evaluable.Evaluable; /** * @author Steven Weston */ public abstract class Predicate<T extends Nameable, F extends Predicate<T, F>> implements Evaluable<T, F> { }
[ "echogene.alpha@gmail.com" ]
echogene.alpha@gmail.com
17079c2f48d156ce6863c660ed37b9db8a8a9888
bf42524c39654a6663b919d61ed0210f569d3705
/src/main/java/top/jfunc/common/thread/conpro/Producer.java
941322e09570e8fcda98f3b8f97ed9035b8cae39
[]
no_license
xiongshiyan/utils
b7e8168d9ba0fbb77775d372db59cb8826f8d0d8
7d4426eb0dc17ead5d91355a23024cdc6f159f6b
refs/heads/master
2021-06-13T23:52:58.521049
2021-02-03T14:49:28
2021-02-03T14:49:28
144,668,589
0
1
null
null
null
null
UTF-8
Java
false
false
462
java
package top.jfunc.common.thread.conpro; import java.util.concurrent.BlockingQueue; /** * @author xiongshiyan * 通用的消费者 */ public class Producer { public static <T> void offer(BlockingQueue<T> blockingQueue , T t){ blockingQueue.offer(t); } public static <T> void offer(String pipelineName , T t){ BlockingQueue<T> blockingQueue = QueueHolder.getBlockingQueue(pipelineName); blockingQueue.offer(t); } }
[ "xxssyyyyssxx@126.com" ]
xxssyyyyssxx@126.com
a797151d17dffdb7c6dfe9e1aa5c92abef3e513b
07f93ef26cdaf3c885d6508f075bf4d07ba79d3f
/core/src/main/java/org/openstack4j/model/workflow/builder/ExecutionBuilder.java
7659b4cfcce4ec2cf6d58c047af8e93119cdc8e8
[ "Apache-2.0" ]
permissive
TANGKUO/openstack4j
11ab832af215f002d89cc564b64a51eada1eba85
8cfb08792bb47849a0d16c71404b5af2b66937c3
refs/heads/master
2021-01-21T21:25:57.570382
2017-06-19T05:18:50
2017-06-19T05:18:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
877
java
package org.openstack4j.model.workflow.builder; import org.openstack4j.common.Buildable.Builder; import org.openstack4j.model.workflow.Definition; import org.openstack4j.model.workflow.Execution; import java.util.Date; import java.util.List; /** * Builder for {@link Execution} model class. * * @author Renat Akhmerov */ public interface ExecutionBuilder<T extends ExecutionBuilder<T, M>, M extends Execution> extends Builder<T, M> { /** * @see Execution#getId() */ T id(String id); /** * @see Execution#getDescription() */ T description(String id); /** * @see Execution#getWorkflowName() */ T workflowName(String name); /** * @see Execution#getCreatedAt() */ T createdAt(Date createdAt); /** * @see Execution#getUpdatedAt() */ T updatedAt(Date updatedAt); /** * @see Execution#getTags() */ T tags(List<String> tags); }
[ "renat.akhmerov@gmail.com" ]
renat.akhmerov@gmail.com
5186a391462fb9c56879779e3d778d1227e10936
3ee0402073b51f44f82eb4da58c65f9ee291bd3b
/src/main/java/cn/studio/zps/blue/ljy/dao/UserDao.java
bdeb2bbf069555c8d0f90877fd2eeca62c566b82
[]
no_license
BlueVegetable/studio-eclipse-IDEA
501f44bf73b76935d40fb6602b186ec99bd693a6
fd98a6294a3613c263a0822da8d89582ac456b84
refs/heads/master
2020-03-26T23:26:17.053795
2018-08-22T05:19:26
2018-08-22T05:19:26
145,541,994
0
0
null
null
null
null
UTF-8
Java
false
false
326
java
package cn.studio.zps.blue.ljy.dao; import cn.studio.zps.blue.ljy.domain.User; /** * @author 蔡荣镔 * @version 1.0 */ public interface UserDao { /** * 通过用户id获取用户的基本信息 * @param userId 传入用户id * @return 用户的所有信息 */ User getUser(long userId); }
[ "2601042086@qq.com" ]
2601042086@qq.com
ed4df46d5a51401caaada8e9f725d8dd73879766
f699c8eb22c6e9999841f6763ef1429c55d42dfd
/src/main/java/com/jh/app/config/DefaultProfileUtil.java
62f0360d1e54fee3e52b73d7dcf3b5e521c1f91b
[]
no_license
osimosu/jhipster-modal-example
e15d4eeb363d0d6bef2cea2180e6aff11d2f4d07
e9b06bd5f3f15a6da3c8c350ff329328e2e5f72f
refs/heads/master
2021-06-18T04:09:44.312526
2017-06-07T10:36:13
2017-06-07T10:36:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,706
java
package com.jh.app.config; import io.github.jhipster.config.JHipsterConstants; import org.springframework.boot.SpringApplication; import org.springframework.core.env.Environment; import java.util.*; /** * Utility class to load a Spring profile to be used as default * when there is no <code>spring.profiles.active</code> set in the environment or as command line argument. * If the value is not available in <code>application.yml</code> then <code>dev</code> profile will be used as default. */ public final class DefaultProfileUtil { private static final String SPRING_PROFILE_DEFAULT = "spring.profiles.default"; private DefaultProfileUtil() { } /** * Set a default to use when no profile is configured. * * @param app the Spring application */ public static void addDefaultProfile(SpringApplication app) { Map<String, Object> defProperties = new HashMap<>(); /* * The default profile to use when no other profiles are defined * This cannot be set in the <code>application.yml</code> file. * See https://github.com/spring-projects/spring-boot/issues/1219 */ defProperties.put(SPRING_PROFILE_DEFAULT, JHipsterConstants.SPRING_PROFILE_DEVELOPMENT); app.setDefaultProperties(defProperties); } /** * Get the profiles that are applied else get default profiles. * * @param env spring environment * @return profiles */ public static String[] getActiveProfiles(Environment env) { String[] profiles = env.getActiveProfiles(); if (profiles.length == 0) { return env.getDefaultProfiles(); } return profiles; } }
[ "282245889@qq.com" ]
282245889@qq.com
49dd230d2d4bdf8fd2e667bf7b79f1776a3a5385
5dcd3b1aa9e04dcd30a45e97f5634ffd0cc6a92e
/oa/src/main/java/org/fkit/oa/holiday/service/impl/LeaveVServiceImpl.java
ae91fbffda9bea0ca213ed6721ff02385b60834e
[]
no_license
zigang007/GitTest
e234c9f08eeb2856e6bdbe7d916459638295774e
327af159e44eda172781cf842ead02e348e58e37
refs/heads/master
2020-03-27T10:06:17.108422
2018-08-28T05:36:13
2018-08-28T05:36:13
146,395,262
0
0
null
null
null
null
UTF-8
Java
false
false
3,010
java
package org.fkit.oa.holiday.service.impl; import java.util.ArrayList; import java.util.List; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; import javax.transaction.Transactional; import org.fkit.common.util.pager.PageModel; import org.fkit.oa.holiday.domain.Holiday; import org.fkit.oa.holiday.domain.Leave; import org.fkit.oa.holiday.domain.Leave_V; import org.fkit.oa.holiday.repository.HolidayRepository; import org.fkit.oa.holiday.repository.LeaveRepository; import org.fkit.oa.holiday.service.LeaveService; import org.fkit.oa.holiday.service.LeaveVService; import org.fkit.oa.identity.domain.User; import org.fkit.oa.identity.service.IdentityService; import org.fkit.oa.util.OaException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.jpa.domain.Specification; import org.springframework.stereotype.Service; @Service @Transactional public class LeaveVServiceImpl implements LeaveVService { @Autowired private LeaveRepository leaveRepository; @Autowired private IdentityService identityService; @Autowired private HolidayRepository holidayRepository; @Override public List<Leave_V> findForPageByUserId(String user_id,PageModel pageModel) { try { Page<Leave> holidayPager = leaveRepository.findAll(new Specification<Leave>() { @Override public Predicate toPredicate(Root<Leave> root, CriteriaQuery<?> query, CriteriaBuilder cb) { // 本集合用于封装查询条件 List<Predicate> predicates = new ArrayList<Predicate>(); return query.where(predicates.toArray(new Predicate[predicates.size()])).getRestriction(); } }, PageRequest.of(pageModel.getPageIndex() - 1, pageModel.getPageSize())); pageModel.setRecordCount(holidayPager.getTotalElements()); /** 取每个用户的延迟加载属性 */ List<Leave> leaves = holidayPager.getContent(); List<Leave_V> leavesV = new ArrayList<>(); for(Leave l:leaves) { Leave_V v = new Leave_V(); User u = identityService.getUserById(l.getUser_id()); v.setUser_name(u.getName()); Holiday h = holidayRepository.findByCode(l.getLeave_type()); v.setLeave_type(h.getName()); v.setLeave_cause(l.getLeave_cause()); v.setLeave_begin_time(l.getLeave_begin_time()); v.setLeave_end_time(l.getLeave_end_time()); v.setLeave_time(l.getLeave_time()); User u2 = identityService.getUserById(l.getApp_user()); v.setApp_user_name(u2.getName()); v.setLeave_status(l.getLeave_status()); v.setLeave_id(l.getLEAVE_ID()); v.setLeave_typeCode(h.getCode()); leavesV.add(v); } return leavesV; } catch (Exception e) { throw new OaException("查询假期信息异常了", e); } } }
[ "463446163@qq.com" ]
463446163@qq.com
46ceaad6a1c0b58893e2b83a59393983f3d78050
744d229a834b11580aeaa8db0cf3d851966d5228
/src/android/com/example/SwiftyCam.java
9968e6c38ce51b8e71642418720de1af4ae662b2
[]
no_license
andrewoodleyjr/cordova-swiftycam
69dc376ec06678a4330c96a75961d446db3880ac
5134eb959d4b84ed929087545292dab4c96d2b18
refs/heads/master
2021-08-08T07:47:58.868217
2017-11-09T22:47:42
2017-11-09T22:47:42
110,006,075
1
0
null
null
null
null
UTF-8
Java
false
false
1,222
java
/** */ package com.example; import org.apache.cordova.CallbackContext; import org.apache.cordova.CordovaInterface; import org.apache.cordova.CordovaPlugin; import org.apache.cordova.CordovaWebView; import org.apache.cordova.PluginResult; import org.apache.cordova.PluginResult.Status; import org.json.JSONObject; import org.json.JSONArray; import org.json.JSONException; import android.util.Log; import java.util.Date; public class SwiftyCam extends CordovaPlugin { private static final String TAG = "SwiftyCam"; public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); Log.d(TAG, "Initializing SwiftyCam"); } public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException { if(action.equals("echo")) { String phrase = args.getString(0); // Echo back the first argument Log.d(TAG, phrase); } else if(action.equals("getDate")) { // An example of returning data back to the web layer final PluginResult result = new PluginResult(PluginResult.Status.OK, (new Date()).toString()); callbackContext.sendPluginResult(result); } return true; } }
[ "hello@andrewoodleyjr.com" ]
hello@andrewoodleyjr.com
0061b22a10c9e1c6bbf1231a7db8dff8bb198222
592b5109b7ebd9d84c0c337e3ff287981815e7c5
/countergrabber/src/main/java/com/countergrabber/dao/CounterDAO.java
2e6c60295b3cba72488153dbf2fbcd713ca84c5d
[]
no_license
Dimittry/livecounter
b2ef18cbd719604d7107e005703eae5405f33f3b
9f2e62a7b727e88456a8b740284eb035590311e2
refs/heads/master
2021-01-19T12:05:23.226158
2017-05-29T14:55:22
2017-05-29T14:55:22
82,301,385
0
0
null
null
null
null
UTF-8
Java
false
false
159
java
package com.countergrabber.dao; import com.countergrabber.domain.Source; import java.util.List; public interface CounterDAO { List<Source> findAll(); }
[ "demar.07@gmail.com" ]
demar.07@gmail.com
dd6ff373f46421cc9f0211b3968a1d5afed2ff89
9a7ab9bde1e5a532ea9590b6e9acdedefa01efa8
/src/com/sd/sort/v2/Comparator.java
c94be9ba2d36e2e2b9f82202810dde80ea5f2f5c
[]
no_license
dnrlrl/j2_201311233
ace99c7320158ef3586cab30318d6db500e1c83b
ad8b5052429adeeac76687170de04851b5ee1fbd
refs/heads/master
2021-01-18T06:24:53.118530
2017-06-17T04:52:47
2017-06-17T04:52:47
84,283,238
0
0
null
null
null
null
UTF-8
Java
false
false
139
java
package com.sd.sort.v2; interface Comparator { public int compare(Object o1, Object o2); public boolean equals(Object o); }
[ "noreply@github.com" ]
dnrlrl.noreply@github.com
1ac18b1ae48d5e71dfd375345bcc34127c2946c5
1fc7fcd6c7bf89f4f466a95a5f495dc597ad3bad
/src/com/rg/phone_away/fragment/CustomTextView.java
eb68fd5600f8d66dc58890130818177a7189f02b
[]
no_license
kc10th/phoneaway
898f462a1afd5718786734c81efca8a488f7c267
21507c8aa31003be22b80eb6a41179ccb8bf6010
refs/heads/master
2020-04-24T02:53:18.521813
2014-10-07T16:30:24
2014-10-07T16:30:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,548
java
package com.rg.phone_away.fragment; import android.content.Context; import android.graphics.Paint; import android.util.AttributeSet; import android.widget.TextView; public class CustomTextView extends TextView { //Attributes private Paint testPaint; private float minTextSize; private float maxTextSize; public CustomTextView(Context context) { super(context); initialise(context); } public CustomTextView(Context context, AttributeSet attrs) { super(context, attrs); initialise(context); } private void initialise(Context context) { TextView textView = new TextView(context); testPaint = textView.getPaint(); //max size defaults to the intially specified text size unless it is too small maxTextSize = this.getTextSize(); if (maxTextSize < 11) { maxTextSize = 20; } minTextSize = 10; } /* Re size the font so the specified text fits in the text box * assuming the text box is the specified width. */ private void refitText(String text, int textWidth) { if (textWidth > 0) { int availableWidth = textWidth - this.getPaddingLeft() - this.getPaddingRight(); float trySize = maxTextSize; testPaint.setTextSize(trySize); while ((trySize > minTextSize) && (testPaint.measureText(text) * 2 > availableWidth)) { trySize -= 1; if (trySize <= minTextSize) { trySize = minTextSize; break; } testPaint.setTextSize(trySize); } this.setTextSize(trySize); } } @Override protected void onTextChanged(final CharSequence text, final int start, final int before, final int after) { refitText(text.toString(), this.getWidth()); } @Override protected void onSizeChanged (int w, int h, int oldw, int oldh) { if (w != oldw) { refitText(this.getText().toString(), w); } } //Getters and Setters public float getMinTextSize() { return minTextSize; } public void setMinTextSize(int minTextSize) { this.minTextSize = minTextSize; } public float getMaxTextSize() { return maxTextSize; } public void setMaxTextSize(int minTextSize) { this.maxTextSize = minTextSize; } }
[ "755785253@qq.com" ]
755785253@qq.com
bb8bb8609d937a864d3017ec3afe6b523c4b683f
a2fde538689b836f295d133961c85cf738396c0b
/app/src/main/java/com/sport/playsqorr/adapters/PlayAPickNewPlayerListAdapter.java
29aa7cc73d9d703a90b3823301b05309ecc9ad49
[]
no_license
KalyanOrigami/Playsqor-Android-ProRodeo
9241be0df9482367205a1e4ca2f8dbfcfd705425
eb8a9e49f1e19a82a8259101d239961c8ec30903
refs/heads/master
2023-06-29T22:23:46.359729
2021-07-23T19:31:21
2021-08-02T12:47:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
137,429
java
package com.sport.playsqorr.adapters; import android.annotation.SuppressLint; import android.content.Context; import android.content.res.ColorStateList; import android.graphics.Bitmap; import android.graphics.BitmapShader; import android.graphics.Canvas; import android.graphics.Paint; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.CheckBox; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.cardview.widget.CardView; import androidx.recyclerview.widget.RecyclerView; import com.sport.playsqorr.R; import com.sport.playsqorr.model.NewPlayerStatistics; import com.sport.playsqorr.model.StatsPlayerStatistics; import com.sport.playsqorr.pojos.Matchup; import com.sport.playsqorr.pojos.PlayerB; import com.sport.playsqorr.views.CustomLinearLayoutManager; import com.squareup.picasso.Picasso; import com.squareup.picasso.Transformation; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.TimeZone; //import static com.sport.playsqorr.views.MatchupScreen.initApiCall; public class PlayAPickNewPlayerListAdapter extends RecyclerView.Adapter<PlayAPickNewPlayerListAdapter.PlayerHolder> { Context mContext; // List<NewPlayerStatistics> mPlayersStatistics = new ArrayList<>(); List<StatsPlayerStatistics> stats_ps = new ArrayList<>(); boolean IsPurchased; private List<Matchup> matchups = new ArrayList<>(); private HashMap<String, String> new_pick_index = new HashMap<>(); private OnItemClick mCallback; PlayerB playerB; String values; private RecyclerView playerGridView; public PlayAPickNewPlayerListAdapter(List<Matchup> matchups, PlayerB playerB, List<NewPlayerStatistics> mPlayersStatistics, List<StatsPlayerStatistics> stats_ps, boolean IsPurchased, Context mContext, RecyclerView playerGridView, OnItemClick mCallback, String values) { // this.mPlayersStatistics = mPlayersStatistics; this.stats_ps = stats_ps; this.mContext = mContext; this.IsPurchased = IsPurchased; this.matchups = matchups; this.mCallback = mCallback; this.playerB = playerB; this.values = values; this.playerGridView = playerGridView; } @NonNull @Override public PlayerHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { LayoutInflater layoutInflater = LayoutInflater.from(viewGroup.getContext()); View listItem = layoutInflater.inflate(R.layout.playapick_single_player_card, viewGroup, false); PlayerHolder viewHolder = new PlayerHolder(listItem); return viewHolder; } @Override public void onBindViewHolder(@NonNull final PlayerHolder playerHolder, final int position) { //Filling the playA details if (matchups.get(position).getPlayerC() != null) { playerHolder.first_player_price.setVisibility(View.GONE); playerHolder.first_playerCard.setClickable(false); playerHolder.first_playerCard.setEnabled(false); Log.e("sssss--", "yes"); playerHolder.heads_s.setVisibility(View.VISIBLE); playerHolder.player_2.setText(matchups.get(position).getPlayerA().getFirstName()); playerHolder.player_3.setText(matchups.get(position).getPlayerB().getFirstName()); playerHolder.player_4.setText(matchups.get(position).getPlayerC().getFirstName()); } if (matchups.get(position).getPlayerstatus().equalsIgnoreCase("0")) { playerHolder.first_playerCard.setClickable(false); playerHolder.first_playerCard.setEnabled(false); playerHolder.first_player_price.setVisibility(View.GONE); playerHolder.first_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.white)); } // Log.e("ccccc", matchups.get(position).getPlayerC().getFirstName() + "---"); try { if (values.equalsIgnoreCase("1")) { // if (matchups.get(position).getPlayerA().getFirstName() != null && matchups.get(position).getPlayerA().getLastName() != null) { // playerHolder.first_player_Name.setText(matchups.get(position).getPlayerA().getFirstName() + " " + matchups.get(position).getPlayerA().getLastName()); // // } else if (matchups.get(position).getPlayerA().getFirstName() != null) { // // playerHolder.first_player_Name.setText(matchups.get(position).getPlayerA().getFirstName()); // } else if (matchups.get(position).getPlayerA().getLastName() != null) { // playerHolder.first_player_Name.setText(matchups.get(position).getPlayerA().getLastName()); // } // // if (matchups.get(position).getPlayerA().getPositonName() != null) { // playerHolder.first_player_position.setText(matchups.get(position).getPlayerA().getPositonName()); // } /* if (matchups.get(position).getPlayerA().getFirstName() != null && matchups.get(position).getPlayerA().getLastName() != null && !matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase(null)) { String Name_A = matchups.get(position).getPlayerA().getFirstName(); if (Name_A.contains("(")) { String[] separated = Name_A.split("\\("); String fn = separated[0]; // this will contain "Fruit" String vs = separated[1]; String separated_two = vs.replaceAll("\\)", ""); // String fn2 = separated_two[0]; // this will contain "Fruit" // String vs2 = separated_two[1]; Log.e("314-1---", "" + fn + "--" + vs + "===" + separated_two); if (matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase(null) || matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase("null")) { playerHolder.first_player_Name.setText(fn); } else { playerHolder.first_player_Name.setText(fn + " " + matchups.get(position).getPlayerA().getLastName()); } // playerHolder.second_player_position.setText(matchups.get(position).getPlayerB().getPositonName()); playerHolder.first_player_position.setText(separated_two); } else { Log.e("314--12--", "" + Name_A + "-else-" + matchups.get(position).getPlayerA().getLastName()); if (matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase(null) || matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase("null")) { playerHolder.first_player_Name.setText(Name_A); playerHolder.first_player_position.setText(matchups.get(position).getPlayerB().getPositonName()); } else { playerHolder.first_player_position.setText(matchups.get(position).getPlayerB().getPositonName()); playerHolder.first_player_Name.setText(Name_A + " " + matchups.get(position).getPlayerB().getLastName()); } playerHolder.first_player_position.setText(matchups.get(position).getPlayerA().getPositonName()); // playerHolder.second_player_position.setText(separated_two); } } else if (matchups.get(position).getPlayerA().getFirstName() != null) { String Name_A = matchups.get(position).getPlayerA().getFirstName(); if (Name_A.contains("(")) { String[] separated = Name_A.split("\\("); String fn = separated[0]; // this will contain "Fruit" String vs = separated[1]; String separated_two = vs.replaceAll("\\)", ""); // String fn2 = separated_two[0]; // this will contain "Fruit" // String vs2 = separated_two[1]; Log.e("314--21--", "" + fn + "--" + vs + "===" + separated_two); playerHolder.first_player_Name.setText(fn); // playerHolder.second_player_position.setText(matchups.get(position).getPlayerB().getPositonName()); playerHolder.first_player_position.setText(separated_two); } else { Log.e("314--22--", "" + Name_A + "-else-" + matchups.get(position).getPlayerA().getLastName()); playerHolder.first_player_Name.setText(Name_A); playerHolder.first_player_position.setText(matchups.get(position).getPlayerA().getPositonName()); // playerHolder.second_player_position.setText(separated_two); } } else { Log.e("314----", "0999999999999999"); playerHolder.first_player_Name.setText(matchups.get(position).getPlayerA().getLastName()); }*/ // hoh /* if (position == 0) { playerHolder.first_player_price.setBackgroundColor(mContext.getResources().getColor(R.color.p0)); playerHolder.second_player_price.setBackgroundColor(mContext.getResources().getColor(R.color.p0)); playerHolder.tvPlayPoints.setBackgroundColor(mContext.getResources().getColor(R.color.p0)); } if (position == 1) { playerHolder.first_player_price.setBackgroundColor(mContext.getResources().getColor(R.color.p1)); playerHolder.second_player_price.setBackgroundColor(mContext.getResources().getColor(R.color.p1)); playerHolder.tvPlayPoints.setBackgroundColor(mContext.getResources().getColor(R.color.p1)); } if (position == 2) { playerHolder.first_player_price.setBackgroundColor(mContext.getResources().getColor(R.color.p2)); playerHolder.second_player_price.setBackgroundColor(mContext.getResources().getColor(R.color.p2)); playerHolder.tvPlayPoints.setBackgroundColor(mContext.getResources().getColor(R.color.p2)); } if (position == 3) { playerHolder.first_player_price.setBackgroundColor(mContext.getResources().getColor(R.color.p3)); playerHolder.second_player_price.setBackgroundColor(mContext.getResources().getColor(R.color.p3)); playerHolder.tvPlayPoints.setBackgroundColor(mContext.getResources().getColor(R.color.p3)); playerHolder.first_player_price.setTextColor(mContext.getResources().getColor(R.color.black)); playerHolder.second_player_price.setTextColor(mContext.getResources().getColor(R.color.black)); playerHolder.tvPlayPoints.setTextColor(mContext.getResources().getColor(R.color.black)); } if (position == 4) { playerHolder.first_player_price.setBackgroundColor(mContext.getResources().getColor(R.color.p4)); playerHolder.second_player_price.setBackgroundColor(mContext.getResources().getColor(R.color.p4)); playerHolder.tvPlayPoints.setBackgroundColor(mContext.getResources().getColor(R.color.p4)); } if (position == 5) { playerHolder.first_player_price.setBackgroundColor(mContext.getResources().getColor(R.color.p5)); playerHolder.second_player_price.setBackgroundColor(mContext.getResources().getColor(R.color.p5)); playerHolder.tvPlayPoints.setBackgroundColor(mContext.getResources().getColor(R.color.p5)); } if (position == 6) { playerHolder.first_player_price.setBackgroundColor(mContext.getResources().getColor(R.color.p6)); playerHolder.second_player_price.setBackgroundColor(mContext.getResources().getColor(R.color.p6)); playerHolder.tvPlayPoints.setBackgroundColor(mContext.getResources().getColor(R.color.p6)); } if (position == 7) { playerHolder.first_player_price.setBackgroundColor(mContext.getResources().getColor(R.color.p7)); playerHolder.second_player_price.setBackgroundColor(mContext.getResources().getColor(R.color.p7)); playerHolder.tvPlayPoints.setBackgroundColor(mContext.getResources().getColor(R.color.p7)); } if (position == 8) { playerHolder.first_player_price.setBackgroundColor(mContext.getResources().getColor(R.color.p8)); playerHolder.second_player_price.setBackgroundColor(mContext.getResources().getColor(R.color.p8)); playerHolder.tvPlayPoints.setBackgroundColor(mContext.getResources().getColor(R.color.p8)); } */ if (matchups.get(position).getPlayerA().getPointSpread() != null) { playerHolder.first_player_price.setText(((matchups.get(position).getHandicap()) * (-1)) + ""); } if (matchups.get(position).getPlayerA().getUniformNumber() != null) { playerHolder.first_player_place.setText(" # " + ((matchups.get(position).getPlayerA().getUniformNumber())) + ""); } if (matchups.get(position).getPlayerA().getVenue() != null) { playerHolder.first_player_Match.setVisibility(View.VISIBLE); playerHolder.first_player_Match.setText(matchups.get(position).getPlayerA().getVenue()); } else { playerHolder.first_player_Match.setVisibility(View.INVISIBLE); } if (matchups.get(position).getPlayerA().getPlayerImage() != null) { Picasso.with(mContext).load(matchups.get(position).getPlayerA().getPlayerImage()) .placeholder(R.drawable.game_inactive_placeholder) // .transform(new Transformation() { // @Override // public Bitmap transform(Bitmap source) { // return transformImg(source, R.color.hint); // } // // @Override // public String key() { // return "circle"; // } // }) .into(playerHolder.first_player_img); } if (matchups.get(position).getPlayerA().getGameDate() != null) { String live = matchups.get(position).getPlayerA().getIsLive(); if (live.equalsIgnoreCase("true")) { playerHolder.first_player_Name.setTextColor(mContext.getResources().getColor(R.color.live)); playerHolder.first_platytime.setVisibility(View.VISIBLE); playerHolder.first_platytime.setText("Live"); playerHolder.first_platytime.setBackgroundColor(mContext.getResources().getColor(R.color.sqorr_red)); playerHolder.first_platytime.setTextColor(mContext.getResources().getColor(R.color.white)); playerHolder.first_player_Time.setVisibility(View.GONE); // playerHolder.play.setVisibility(View.VISIBLE); playerHolder.playerStatisticsView.setVisibility(View.VISIBLE); } else { playerHolder.first_platytime.setVisibility(View.GONE); playerHolder.first_player_Time.setVisibility(View.VISIBLE); // playerHolder.play.setVisibility(View.GONE); playerHolder.first_player_Time.setText(getTime(matchups.get(position).getPlayerA().getGameDate())); } } //Filling the PlayerB details if (matchups.get(position).getPlayerC() != null) { // if (matchups.get(position).getPlayerC() != null) { // } else if (matchups.get(position).getPlayerstatus_C().equalsIgnoreCase("0")) { playerHolder.second_playerCard.setVisibility(View.GONE); playerHolder.no_player.setVisibility(View.GONE); playerHolder.no_player_abc.setVisibility(View.VISIBLE); playerHolder.first_playerCard.setClickable(false); playerHolder.player_Name_b.setText(matchups.get(position).getPlayerB().getFirstName() + " " + matchups.get(position).getPlayerB().getLastName()); playerHolder.player_Name_c.setText(matchups.get(position).getPlayerC().getFirstName() + " " + matchups.get(position).getPlayerC().getLastName()); if (matchups.get(position).getPlayerC().getPlayerImage() != null) { Picasso.with(mContext).load(matchups.get(position).getPlayerC().getPlayerImage()) .placeholder(R.drawable.profile_placeholder) // .error(R.drawable.game_inactive_placeholder) // .transform(new Transformation() { // @Override // public Bitmap transform(Bitmap source) { // return transformImg(source, R.color.hint); // } // // @Override // public String key() { // return "circle"; // } // }) .into(playerHolder.player_img_c); } if (matchups.get(position).getPlayerB().getPlayerImage() != null) { Picasso.with(mContext).load(matchups.get(position).getPlayerB().getPlayerImage()) .placeholder(R.drawable.profile_placeholder) // .error(R.drawable.game_inactive_placeholder) // .transform(new Transformation() { // @Override // public Bitmap transform(Bitmap source) { // return transformImg(source, R.color.hint); // } // // @Override // public String key() { // return "circle"; // } // }) .into(playerHolder.player_img_b); } if (matchups.get(position).getPlayerB().getPositonName() != null) { playerHolder.player_position_b.setText(matchups.get(position).getPlayerB().getPositonName()); } if (matchups.get(position).getPlayerB().getPointSpread() != null) { playerHolder.player_price_b.setText(matchups.get(position).getHandicapAvsB() + ""); } if (matchups.get(position).getPlayerB().getVenue() != null) { playerHolder.player_Match_b.setVisibility(View.VISIBLE); playerHolder.player_Match_b.setText(matchups.get(position).getPlayerB().getVenue()); } else { playerHolder.player_Match_b.setVisibility(View.INVISIBLE); } if (matchups.get(position).getPlayerC().getPositonName() != null) { playerHolder.player_position_c.setText(matchups.get(position).getPlayerC().getPositonName()); } if (matchups.get(position).getPlayerC().getPointSpread() != null) { playerHolder.player_price_c.setText(matchups.get(position).getHandicapAvsC() + ""); } if (matchups.get(position).getPlayerC().getVenue() != null) { playerHolder.player_Match_c.setVisibility(View.VISIBLE); playerHolder.player_Match_c.setText(matchups.get(position).getPlayerC().getVenue()); } else { playerHolder.player_Match_c.setVisibility(View.INVISIBLE); } if (matchups.get(position).getPlayerB().getGameDate() != null) { // playerHolder.first_player_Time.setText(getTime(matchups.get(position).getPlayerA().getGameDate())); String live = matchups.get(position).getPlayerB().getIsLive(); if (live.equalsIgnoreCase("true")) { playerHolder.player_Name_b.setTextColor(mContext.getResources().getColor(R.color.live)); playerHolder.player_time_b.setVisibility(View.VISIBLE); playerHolder.player_time_b.setText("Live"); playerHolder.player_time_b.setBackgroundColor(mContext.getResources().getColor(R.color.sqorr_red)); playerHolder.player_time_b.setTextColor(mContext.getResources().getColor(R.color.white)); playerHolder.player_time_b.setVisibility(View.GONE); //playerHolder.play.setVisibility(View.VISIBLE); playerHolder.playerStatisticsView.setVisibility(View.VISIBLE); } else { playerHolder.player_time_b.setVisibility(View.GONE); playerHolder.player_time_b.setVisibility(View.VISIBLE); // playerHolder.play.setVisibility(View.GONE); playerHolder.player_time_b.setText(getTime(matchups.get(position).getPlayerB().getGameDate())); } } if (matchups.get(position).getPlayerC().getGameDate() != null) { // playerHolder.first_player_Time.setText(getTime(matchups.get(position).getPlayerA().getGameDate())); String live = matchups.get(position).getPlayerC().getIsLive(); if (live.equalsIgnoreCase("true")) { playerHolder.player_Name_c.setTextColor(mContext.getResources().getColor(R.color.live)); playerHolder.player_time_c.setVisibility(View.VISIBLE); playerHolder.player_time_c.setText("Live"); playerHolder.player_time_c.setBackgroundColor(mContext.getResources().getColor(R.color.sqorr_red)); playerHolder.player_time_c.setTextColor(mContext.getResources().getColor(R.color.white)); playerHolder.player_time_c.setVisibility(View.GONE); //playerHolder.play.setVisibility(View.VISIBLE); playerHolder.playerStatisticsView.setVisibility(View.VISIBLE); } else { playerHolder.player_time_c.setVisibility(View.GONE); playerHolder.player_time_c.setVisibility(View.VISIBLE); // playerHolder.play.setVisibility(View.GONE); playerHolder.player_time_c.setText(getTime(matchups.get(position).getPlayerC().getGameDate())); } } // } } else { if (matchups.get(position).getPlayerstatus().equalsIgnoreCase("0")) { playerHolder.second_playerCard.setVisibility(View.GONE); playerHolder.no_player_abc.setVisibility(View.GONE); playerHolder.no_player.setVisibility(View.VISIBLE); playerHolder.first_playerCard.setClickable(false); // playerHolder.first_playerCard.setEnabled(false); if (matchups.get(position).getPlayerA().getFirstName() != null && matchups.get(position).getPlayerA().getLastName() != null && !matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase(null)) { String Name_A = matchups.get(position).getPlayerA().getFirstName(); if (Name_A.contains("(")) { String[] separated = Name_A.split("\\("); String fn = separated[0]; // this will contain "Fruit" String vs = separated[1]; String separated_two = vs.replaceAll("\\)", ""); // String fn2 = separated_two[0]; // this will contain "Fruit" // String vs2 = separated_two[1]; Log.e("314-1---aa", "" + fn + "--" + vs + "===" + separated_two); if (matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase(null) || matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase("null")) { playerHolder.first_player_Name.setText(fn); } else { playerHolder.first_player_Name.setText(fn + " " + matchups.get(position).getPlayerA().getLastName()); } // playerHolder.second_player_position.setText(matchups.get(position).getPlayerB().getPositonName()); playerHolder.first_player_position.setText(separated_two); } else { Log.e("314--12--402aa", "" + Name_A + "-else-" + matchups.get(position).getPlayerA().getLastName()); if (matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase(null) || matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase("null")) { playerHolder.first_player_Name.setText(matchups.get(position).getPlayerA().getFirstName()); playerHolder.first_player_position.setText(matchups.get(position).getPlayerA().getPositonName()); } else { playerHolder.first_player_position.setText(matchups.get(position).getPlayerA().getPositonName()); playerHolder.first_player_Name.setText(matchups.get(position).getPlayerA().getFirstName() + " " + matchups.get(position).getPlayerA().getLastName()); } playerHolder.first_player_position.setText(matchups.get(position).getPlayerA().getPositonName()); // playerHolder.second_player_position.setText(separated_two); } } else if (matchups.get(position).getPlayerA().getFirstName() != null) { String Name_A = matchups.get(position).getPlayerA().getFirstName(); if (Name_A.contains("(")) { String[] separated = Name_A.split("\\("); String fn = separated[0]; // this will contain "Fruit" String vs = separated[1]; String separated_two = vs.replaceAll("\\)", ""); // String fn2 = separated_two[0]; // this will contain "Fruit" // String vs2 = separated_two[1]; Log.e("314--21- 426a-", "" + fn + "--" + vs + "===" + separated_two); playerHolder.first_player_Name.setText(fn); // playerHolder.second_player_position.setText(matchups.get(position).getPlayerB().getPositonName()); playerHolder.first_player_position.setText(separated_two); } else { Log.e("314--22-432 a-", "" + Name_A + "-else-" + matchups.get(position).getPlayerA().getLastName()); playerHolder.first_player_Name.setText(matchups.get(position).getPlayerA().getFirstName()); playerHolder.first_player_position.setText(matchups.get(position).getPlayerA().getPositonName()); // playerHolder.second_player_position.setText(separated_two); } } else { Log.e("314----", "0999999999999999"); playerHolder.first_player_Name.setText(matchups.get(position).getPlayerA().getLastName()); } // playerHolder.tvPlayPoints.setText(matchups.get(position).getPlayerA().getPointSpread() + " "); playerHolder.tvPlayPoints.setText(matchups.get(position).getHandicap() + " "); } else { // } else if (matchups.get(position).getPlayerC() == null) { playerHolder.second_playerCard.setVisibility(View.VISIBLE); playerHolder.first_playerCard.setClickable(true); playerHolder.no_player.setVisibility(View.GONE); playerHolder.no_player_abc.setVisibility(View.GONE); if (matchups.get(position).getPlayerA().getFirstName() != null && matchups.get(position).getPlayerA().getLastName() != null && !matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase(null)) { String Name_A = matchups.get(position).getPlayerA().getFirstName(); if (Name_A.contains("(")) { String[] separated = Name_A.split("\\("); String fn = separated[0]; // this will contain "Fruit" String vs = separated[1]; String separated_two = vs.replaceAll("\\)", ""); // String fn2 = separated_two[0]; // this will contain "Fruit" // String vs2 = separated_two[1]; Log.e("314-1---aa", "" + fn + "--" + vs + "===" + separated_two); if (matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase(null) || matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase("null")) { playerHolder.first_player_Name.setText(fn); } else { playerHolder.first_player_Name.setText(fn + " " + matchups.get(position).getPlayerA().getLastName()); } // playerHolder.second_player_position.setText(matchups.get(position).getPlayerB().getPositonName()); playerHolder.first_player_position.setText(separated_two); } else { Log.e("314--12--402aa", "" + Name_A + "-else-" + matchups.get(position).getPlayerA().getLastName()); if (matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase(null) || matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase("null")) { playerHolder.first_player_Name.setText(matchups.get(position).getPlayerA().getFirstName()); playerHolder.first_player_position.setText(matchups.get(position).getPlayerA().getPositonName()); } else { playerHolder.first_player_position.setText(matchups.get(position).getPlayerA().getPositonName()); playerHolder.first_player_Name.setText(matchups.get(position).getPlayerA().getFirstName() + " " + matchups.get(position).getPlayerA().getLastName()); } playerHolder.first_player_position.setText(matchups.get(position).getPlayerA().getPositonName()); // playerHolder.second_player_position.setText(separated_two); } } else if (matchups.get(position).getPlayerA().getFirstName() != null) { String Name_A = matchups.get(position).getPlayerA().getFirstName(); if (Name_A.contains("(")) { String[] separated = Name_A.split("\\("); String fn = separated[0]; // this will contain "Fruit" String vs = separated[1]; String separated_two = vs.replaceAll("\\)", ""); // String fn2 = separated_two[0]; // this will contain "Fruit" // String vs2 = separated_two[1]; Log.e("314--21- 426a-", "" + fn + "--" + vs + "===" + separated_two); playerHolder.first_player_Name.setText(fn); // playerHolder.second_player_position.setText(matchups.get(position).getPlayerB().getPositonName()); playerHolder.first_player_position.setText(separated_two); } else { Log.e("314--22-432 a-", "" + Name_A + "-else-" + matchups.get(position).getPlayerA().getLastName()); playerHolder.first_player_Name.setText(matchups.get(position).getPlayerA().getFirstName()); playerHolder.first_player_position.setText(matchups.get(position).getPlayerA().getPositonName()); // playerHolder.second_player_position.setText(separated_two); } } else { Log.e("314----", "0999999999999999"); playerHolder.first_player_Name.setText(matchups.get(position).getPlayerA().getLastName()); } if (matchups.get(position).getPlayerB().getFirstName() != null && matchups.get(position).getPlayerB().getLastName() != null && !matchups.get(position).getPlayerB().getLastName().equalsIgnoreCase(null)) { String Name_B = matchups.get(position).getPlayerB().getFirstName(); if (Name_B.contains("(")) { String[] separated = Name_B.split("\\("); String fn = separated[0]; // this will contain "Fruit" String vs = separated[1]; String separated_two = vs.replaceAll("\\)", ""); // String fn2 = separated_two[0]; // this will contain "Fruit" // String vs2 = separated_two[1]; Log.e("314-1--468B-", "" + fn + "--" + vs + "===" + separated_two); if (matchups.get(position).getPlayerB().getLastName().equalsIgnoreCase(null) || matchups.get(position).getPlayerB().getLastName().equalsIgnoreCase("null")) { playerHolder.second_player_Name.setText(fn); } else { playerHolder.second_player_Name.setText(fn + " " + matchups.get(position).getPlayerB().getLastName()); } // playerHolder.second_player_position.setText(matchups.get(position).getPlayerB().getPositonName()); playerHolder.second_player_position.setText(separated_two); } else { Log.e("314--12- 468b-", "" + Name_B + "-else-" + matchups.get(position).getPlayerB().getLastName()); if (matchups.get(position).getPlayerB().getLastName().equalsIgnoreCase(null) || matchups.get(position).getPlayerB().getLastName().equalsIgnoreCase("null")) { playerHolder.second_player_Name.setText(matchups.get(position).getPlayerB().getFirstName()); } else { playerHolder.second_player_Name.setText(matchups.get(position).getPlayerB().getFirstName() + " " + matchups.get(position).getPlayerB().getLastName()); } playerHolder.second_player_position.setText(matchups.get(position).getPlayerB().getPositonName()); // playerHolder.second_player_position.setText(separated_two); } } else if (matchups.get(position).getPlayerB().getFirstName() != null) { String Name_B = matchups.get(position).getPlayerB().getFirstName(); if (Name_B.contains("(")) { String[] separated = Name_B.split("\\("); String fn = separated[0]; // this will contain "Fruit" String vs = separated[1]; String separated_two = vs.replaceAll("\\)", ""); // String fn2 = separated_two[0]; // this will contain "Fruit" // String vs2 = separated_two[1]; Log.e("314--21-b-", "" + fn + "--" + vs + "===" + separated_two); playerHolder.second_player_Name.setText(fn); // playerHolder.second_player_position.setText(matchups.get(position).getPlayerB().getPositonName()); playerHolder.second_player_position.setText(separated_two); } else { Log.e("314--22b--", "" + Name_B + "-else-" + matchups.get(position).getPlayerB().getLastName()); playerHolder.second_player_Name.setText(Name_B); playerHolder.second_player_position.setText(matchups.get(position).getPlayerB().getPositonName()); // playerHolder.second_player_position.setText(separated_two); } } else { Log.e("314--b--", "0999999999999999"); playerHolder.second_player_Name.setText(matchups.get(position).getPlayerB().getLastName()); } playerHolder.second_player_price.setText((matchups.get(position).getHandicap()) * 1 + ""); if (matchups.get(position).getPlayerB().getVenue() != null) { playerHolder.second_player_Match.setVisibility(View.VISIBLE); playerHolder.second_player_Match.setText(matchups.get(position).getPlayerB().getVenue()); } else { playerHolder.second_player_Match.setVisibility(View.INVISIBLE); } if (matchups.get(position).getPlayerB().getGameDate() != null) { String live = matchups.get(position).getPlayerB().getIsLive(); if (live.equalsIgnoreCase("true")) { playerHolder.secondtime.setVisibility(View.VISIBLE); // playerHolder.play.setVisibility(View.VISIBLE); playerHolder.secondtime.setText("Live"); playerHolder.secondtime.setBackgroundColor(mContext.getResources().getColor(R.color.sqorr_red)); playerHolder.secondtime.setTextColor(mContext.getResources().getColor(R.color.white)); playerHolder.second_player_Time.setVisibility(View.GONE); playerHolder.playerStatisticsView.setVisibility(View.VISIBLE); } else { // playerHolder.play.setVisibility(View.GONE); playerHolder.second_player_Time.setVisibility(View.VISIBLE); playerHolder.second_player_Time.setText(getTime(matchups.get(position).getPlayerB().getGameDate())); } // playerHolder.second_player_Time.setText("Live"); } if (matchups.get(position).getPlayerB().getPlayerImage() != null) { Picasso.with(mContext).load(matchups.get(position).getPlayerB().getPlayerImage()) .placeholder(R.drawable.profile_placeholder) .error(R.drawable.profile_placeholder) // .transform(new Transformation() { // @Override // public Bitmap transform(Bitmap source) { // return transformImg(source, R.color.hint); // } // // @Override // public String key() { // return "circle"; // } // }) .into(playerHolder.second_player_img); } } } } else { if (matchups.get(position).getPlayerA().getIsLive().equalsIgnoreCase("true"))//|| matchups.get(position).getPlayerB().getIsLive().equalsIgnoreCase("true")) { // initApiCall(); System.out.println("outes"); System.out.println("fristnAME" + matchups.get(position).getPlayerA().getIsLive()); matchups.get(position).setDisplayStats(matchups.get(position).getDisplayStats()); // matchups.get(position).getPlayerA().setLastName(matchups.get(position).getPlayerA().getFirstName()); } // if (matchups.get(position).getPlayerB() != null) { if (matchups.get(position).getPlayerstatus().equalsIgnoreCase("1")) { if (matchups.get(position).getPlayerB().getIsLive().equalsIgnoreCase("true")) { // initApiCall(); System.out.println("outes"); System.out.println("fristnAME" + matchups.get(position).getPlayerA().getIsLive()); matchups.get(position).setDisplayStats(matchups.get(position).getDisplayStats()); // matchups.get(position).getPlayerB().setLastName(matchups.get(position).getPlayerB().getFirstName()); } } Log.d("fristname", matchups.get(position).getPlayerA() + matchups.get(position).getPlayerA().getFirstName() + matchups.get(position).getPlayerA().getPointSpread()); if (matchups.get(position).getPlayerA().getFirstName() != null && matchups.get(position).getPlayerA().getLastName() != null) { playerHolder.first_player_Name.setText(matchups.get(position).getPlayerA().getFirstName() + " " + matchups.get(position).getPlayerA().getLastName()); } else if (matchups.get(position).getPlayerA().getFirstName() != null) { playerHolder.first_player_Name.setText(matchups.get(position).getPlayerA().getFirstName()); } else if (matchups.get(position).getPlayerA().getLastName() != null) { playerHolder.first_player_Name.setText(matchups.get(position).getPlayerA().getLastName()); } if (matchups.get(position).getPlayerA().getPositonName() != null) { playerHolder.first_player_position.setText(matchups.get(position).getPlayerA().getPositonName()); } /* if (matchups.get(position).getPlayerA().getFirstName() != null && matchups.get(position).getPlayerA().getLastName() != null && !matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase(null)) { String Name_A = matchups.get(position).getPlayerA().getFirstName(); if (Name_A.contains("(")) { String[] separated = Name_A.split("\\("); String fn = separated[0]; // this will contain "Fruit" String vs = separated[1]; String separated_two = vs.replaceAll("\\)", ""); // String fn2 = separated_two[0]; // this will contain "Fruit" // String vs2 = separated_two[1]; Log.e("314-1---", "" + fn + "--" + vs + "===" + separated_two); if (matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase(null) || matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase("null")) { playerHolder.first_player_Name.setText(fn); } else { playerHolder.first_player_Name.setText(fn + " " + matchups.get(position).getPlayerA().getLastName()); } // playerHolder.second_player_position.setText(matchups.get(position).getPlayerB().getPositonName()); playerHolder.first_player_position.setText(separated_two); } else { Log.e("314--12--", "" + Name_A + "-else-" + matchups.get(position).getPlayerA().getLastName()); if (matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase(null) || matchups.get(position).getPlayerA().getLastName().equalsIgnoreCase("null")) { playerHolder.first_player_Name.setText(Name_A); } else { playerHolder.first_player_Name.setText(Name_A + " " + matchups.get(position).getPlayerA().getLastName()); } playerHolder.first_player_position.setText(matchups.get(position).getPlayerA().getPositonName()); // playerHolder.second_player_position.setText(separated_two); } } else if (matchups.get(position).getPlayerA().getFirstName() != null) { String Name_A = matchups.get(position).getPlayerA().getFirstName(); if (Name_A.contains("(")) { String[] separated = Name_A.split("\\("); String fn = separated[0]; // this will contain "Fruit" String vs = separated[1]; String separated_two = vs.replaceAll("\\)", ""); // String fn2 = separated_two[0]; // this will contain "Fruit" // String vs2 = separated_two[1]; Log.e("314--21--", "" + fn + "--" + vs + "===" + separated_two); playerHolder.first_player_Name.setText(fn); // playerHolder.second_player_position.setText(matchups.get(position).getPlayerB().getPositonName()); playerHolder.first_player_position.setText(separated_two); } else { Log.e("314--22--", "" + Name_A + "-else-" + matchups.get(position).getPlayerA().getLastName()); playerHolder.first_player_Name.setText(Name_A); playerHolder.first_player_position.setText(matchups.get(position).getPlayerA().getPositonName()); // playerHolder.second_player_position.setText(separated_two); } } else { Log.e("314----", "0999999999999999"); playerHolder.first_player_Name.setText(matchups.get(position).getPlayerA().getLastName()); }*/ if (matchups.get(position).getPlayerA().getPointSpread() != null) { playerHolder.first_player_price.setText(((matchups.get(position).getHandicap()) * (-1)) + ""); } if (matchups.get(position).getPlayerA().getVenue() != null) { playerHolder.first_player_Match.setVisibility(View.VISIBLE); playerHolder.first_player_Match.setText(matchups.get(position).getPlayerA().getVenue()); } else { playerHolder.first_player_Match.setVisibility(View.INVISIBLE); } if (matchups.get(position).getPlayerA().getPlayerImage() != null) { Picasso.with(mContext).load(matchups.get(position).getPlayerA().getPlayerImage()) .placeholder(R.drawable.game_inactive_placeholder) // .transform(new Transformation() { // @Override // public Bitmap transform(Bitmap source) { // return transformImg(source, R.color.hint); // } // // @Override // public String key() { // return "circle"; // } // }) .into(playerHolder.first_player_img); } /// if (matchups.get(position).getPlayerA().getGameDate() != null) { // playerHolder.first_player_Time.setText(getTime(matchups.get(position).getPlayerA().getGameDate())); String live = matchups.get(position).getPlayerA().getIsLive(); if (live.equalsIgnoreCase("true")) { playerHolder.first_player_Name.setTextColor(mContext.getResources().getColor(R.color.live)); playerHolder.first_platytime.setVisibility(View.VISIBLE); playerHolder.first_platytime.setText("Live"); playerHolder.first_platytime.setBackgroundColor(mContext.getResources().getColor(R.color.sqorr_red)); playerHolder.first_platytime.setTextColor(mContext.getResources().getColor(R.color.white)); playerHolder.first_player_Time.setVisibility(View.GONE); //playerHolder.play.setVisibility(View.VISIBLE); playerHolder.playerStatisticsView.setVisibility(View.VISIBLE); } else { playerHolder.first_platytime.setVisibility(View.GONE); playerHolder.first_player_Time.setVisibility(View.VISIBLE); // playerHolder.play.setVisibility(View.GONE); playerHolder.first_player_Time.setText(getTime(matchups.get(position).getPlayerA().getGameDate())); } } playerHolder.first_player_Time.setText(getTime(matchups.get(position).getPlayerA().getGameDate())); //Filling the PlayerB details // action this if (matchups.get(position).getPlayerC() != null) { { playerHolder.first_player_price.setVisibility(View.GONE); playerHolder.second_playerCard.setVisibility(View.GONE); playerHolder.no_player.setVisibility(View.GONE); playerHolder.no_player_abc.setVisibility(View.VISIBLE); playerHolder.first_playerCard.setClickable(false); playerHolder.player_Name_b.setText(matchups.get(position).getPlayerB().getFirstName() + " " + matchups.get(position).getPlayerB().getLastName()); playerHolder.player_Name_c.setText(matchups.get(position).getPlayerC().getFirstName() + " " + matchups.get(position).getPlayerC().getLastName()); if (matchups.get(position).getPlayerC().getPlayerImage() != null) { Picasso.with(mContext).load(matchups.get(position).getPlayerC().getPlayerImage()) .placeholder(R.drawable.game_inactive_placeholder) .error(R.drawable.game_inactive_placeholder) .transform(new Transformation() { @Override public Bitmap transform(Bitmap source) { return transformImg(source, R.color.hint); } @Override public String key() { return "circle"; } }) .into(playerHolder.player_img_c); } if (matchups.get(position).getPlayerB().getPlayerImage() != null) { Picasso.with(mContext).load(matchups.get(position).getPlayerB().getPlayerImage()) .placeholder(R.drawable.profile_placeholder) .error(R.drawable.profile_placeholder) // .transform(new Transformation() { // @Override // public Bitmap transform(Bitmap source) { // return transformImg(source, R.color.hint); // } // // @Override // public String key() { // return "circle"; // } // }) .into(playerHolder.player_img_b); } } } else { if (matchups.get(position).getPlayerstatus().equalsIgnoreCase("0")) { playerHolder.second_playerCard.setVisibility(View.GONE); playerHolder.no_player_abc.setVisibility(View.GONE); playerHolder.no_player.setVisibility(View.VISIBLE); playerHolder.first_playerCard.setClickable(false); playerHolder.tvPlayPoints.setText(matchups.get(position).getHandicap() + " "); // playerHolder.tvPlayPoints.setText(matchups.get(position).getPlayerA().getPointSpread() + " "); } else { playerHolder.second_playerCard.setVisibility(View.VISIBLE); playerHolder.no_player.setVisibility(View.GONE); playerHolder.no_player_abc.setVisibility(View.GONE); playerHolder.first_playerCard.setClickable(true); playerHolder.first_playerCard.setEnabled(true); playerHolder.second_player_Name.setText(matchups.get(position).getPlayerB().getFirstName() + " " + matchups.get(position).getPlayerB().getLastName()); playerHolder.second_player_position.setText(matchups.get(position).getPlayerB().getPositonName()); playerHolder.second_player_price.setText(matchups.get(position).getHandicap() * 1 + ""); if (matchups.get(position).getPlayerB().getVenue() != null) { playerHolder.second_player_Match.setVisibility(View.VISIBLE); playerHolder.second_player_Match.setText(matchups.get(position).getPlayerB().getVenue()); } else { playerHolder.second_player_Match.setVisibility(View.INVISIBLE); } if (matchups.get(position).getPlayerB().getGameDate() != null) { String live = matchups.get(position).getPlayerB().getIsLive(); if (live.equalsIgnoreCase("true")) { playerHolder.secondtime.setVisibility(View.VISIBLE); // playerHolder.play.setVisibility(View.VISIBLE); playerHolder.secondtime.setText("Live"); playerHolder.secondtime.setBackgroundColor(mContext.getResources().getColor(R.color.sqorr_red)); playerHolder.secondtime.setTextColor(mContext.getResources().getColor(R.color.white)); playerHolder.second_player_Time.setVisibility(View.GONE); playerHolder.playerStatisticsView.setVisibility(View.VISIBLE); } else { // playerHolder.play.setVisibility(View.GONE); playerHolder.second_player_Time.setVisibility(View.VISIBLE); playerHolder.second_player_Time.setText(getTime(matchups.get(position).getPlayerB().getGameDate())); } // playerHolder.second_player_Time.setText(getTime(matchups.get(position).getPlayerB().getGameDate())); } if (matchups.get(position).getPlayerB().getPlayerImage() != null) { Picasso.with(mContext).load(matchups.get(position).getPlayerB().getPlayerImage()) .placeholder(R.drawable.profile_placeholder) .error(R.drawable.profile_placeholder) // .transform(new Transformation() { // @Override // public Bitmap transform(Bitmap source) { // return transformImg(source, R.color.hint); // } // // @Override // public String key() { // return "circle"; // } // }) .into(playerHolder.second_player_img); } } } } } catch (Exception e) { Log.e("00--",e+""); } /* Checking IsPurchased or not, if purchase player cound't clickble else can clickble */ //if IsPurchased true /* Checking picindex and win index of player A and PLayer B DONE */ if (matchups.get(position).getPlayerstatus().equalsIgnoreCase("1")) { playerHolder.sq_cc_over.setVisibility(View.GONE); playerHolder.sq_cc.setVisibility(View.VISIBLE); } else { playerHolder.sq_cc_over.setVisibility(View.VISIBLE); playerHolder.sq_cc.setVisibility(View.GONE); } if (IsPurchased) { try { playerHolder.first_player_Name.setTextColor(mContext.getResources().getColor(R.color.hint)); playerHolder.second_player_Name.setTextColor(mContext.getResources().getColor(R.color.hint)); if (matchups.get(position).getIsFinished()) { /* if winindex=0,pickindex=0 playerA checked Green*/ if (matchups.get(position).getPickIndex() == 0 && matchups.get(position).getWinIndex() == 0) { playerHolder.win_loss_statusView_ly.setVisibility(View.VISIBLE); playerHolder.win_loss_statusView.setBackgroundColor(mContext.getResources().getColor(R.color.green)); playerHolder.statusTxt.setText("WIN"); // if (matchups.get(position).getPlayerB() != null) { if (matchups.get(position).getPlayerC() != null) { setTextViewDrawableColor(playerHolder.player_Name_b, mContext.getResources().getColor(R.color.text_color_new)); // playerHolder.player_img_b.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_win_bg)); playerHolder.player_img_b.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_green)); playerHolder.playerCheck_b.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_win)); // playerHolder.player_Name_b.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); playerHolder.player_Name_c.setTextColor(mContext.getResources().getColor(R.color.hint)); } else { if (matchups.get(position).getPlayerstatus().equalsIgnoreCase("1")) { // playerHolder.first_player_img.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_win_bg)); playerHolder.left_matchcard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_green)); playerHolder.first_playerCheck.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_win)); playerHolder.first_player_Name.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); playerHolder.second_player_Name.setTextColor(mContext.getResources().getColor(R.color.hint)); } else { setTextViewDrawableColor(playerHolder.overview_txt, mContext.getResources().getColor(R.color.text_color_new)); playerHolder.underView_txt.setTextColor(mContext.getResources().getColor(R.color.hint)); // playerHolder.overView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_win_bg)); playerHolder.over_playercard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_green)); playerHolder.overCheckbox.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_win)); } } } /* if winindex=1,pickindex=1 playerB checked Green*/ if (matchups.get(position).getPickIndex() == 1 && matchups.get(position).getWinIndex() == 1) { playerHolder.win_loss_statusView_ly.setVisibility(View.VISIBLE); playerHolder.win_loss_statusView.setBackgroundColor(mContext.getResources().getColor(R.color.green)); playerHolder.statusTxt.setText("WIN"); // if (matchups.get(position).getPlayerB() != null) { if (matchups.get(position).getPlayerC() != null) { // playerHolder.player_img_c.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_win_bg)); playerHolder.over_playercard_c.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_green)); playerHolder.playerCheck_c.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_win)); playerHolder.player_Name_b.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); // playerHolder.player_Name_b.setTextColor(mContext.getResources().getColor(R.color.hint)); setTextViewDrawableColor(playerHolder.player_Name_c, mContext.getResources().getColor(R.color.text_color_new)); } else { if (matchups.get(position).getPlayerstatus().equalsIgnoreCase("1")) { playerHolder.right_matchcard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_green)); // playerHolder.second_player_img.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_win_bg)); playerHolder.second_playerCheck.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_win)); playerHolder.second_player_Name.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); playerHolder.first_player_Name.setTextColor(mContext.getResources().getColor(R.color.hint)); } else { setTextViewDrawableColor(playerHolder.underView_txt, mContext.getResources().getColor(R.color.text_color_new)); // playerHolder.underView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_win_bg)); playerHolder.under_playercard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_green)); playerHolder.underCheckbox.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_win)); playerHolder.overview_txt.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); } } } /* if winindex=0,pickindex=1 or winindex=0,pickindex=-1 playerA checked gray*/ if ((matchups.get(position).getPickIndex() == 0 && matchups.get(position).getWinIndex() == 1)) { playerHolder.win_loss_statusView_ly.setVisibility(View.VISIBLE); playerHolder.win_loss_statusView.setBackgroundColor(mContext.getResources().getColor(R.color.text_color_new)); playerHolder.statusTxt.setText("LOST"); // if (matchups.get(position).getPlayerB() != null) { if (matchups.get(position).getPlayerC() != null) { setTextViewDrawableColor(playerHolder.player_Name_b, mContext.getResources().getColor(R.color.text_color_new)); // playerHolder.player_img_b.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_lost_bg)); playerHolder.over_playercard_b.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_gray)); playerHolder.playerCheck_b.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_loss)); // playerHolder.player_Name_b.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); playerHolder.player_Name_b.setTextColor(mContext.getResources().getColor(R.color.hint)); } else { if (matchups.get(position).getPlayerstatus().equalsIgnoreCase("1")) { Log.e("bnull", "not null---"); playerHolder.left_matchcard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_gray)); // playerHolder.first_player_img.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_lost_bg)); playerHolder.first_playerCheck.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_loss)); playerHolder.first_player_Name.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); playerHolder.second_player_Name.setTextColor(mContext.getResources().getColor(R.color.hint)); } else { Log.e("bnullnot", "null---"); setTextViewDrawableColor(playerHolder.overview_txt, mContext.getResources().getColor(R.color.text_color_new)); // playerHolder.overView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_lost_bg)); playerHolder.over_playercard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_gray)); playerHolder.overCheckbox.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_loss)); playerHolder.overview_txt.setTextColor(mContext.getResources().getColor(R.color.hint)); } } } if ((matchups.get(position).getPickIndex() == 0 && matchups.get(position).getWinIndex() == -1) && matchups.get(position).getIsCancelled()) { playerHolder.win_loss_statusView_ly.setVisibility(View.VISIBLE); playerHolder.win_loss_statusView.setBackgroundColor(mContext.getResources().getColor(R.color.text_color_new)); if (matchups.get(position).getCancelledReason() != null) { playerHolder.statusTxt.setText(matchups.get(position).getCancelledReason()); } else { playerHolder.statusTxt.setText("CANCELLED"); } if (matchups.get(position).getPlayerC() != null) { setTextViewDrawableColor(playerHolder.player_Name_c, mContext.getResources().getColor(R.color.text_color_new)); playerHolder.player_Name_c.setTextColor(mContext.getResources().getColor(R.color.hint)); // playerHolder.player_img_b.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_lost_bg)); playerHolder.over_playercard_b.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_gray)); playerHolder.playerCheck_b.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_loss)); } else { // if (matchups.get(position).getPlayerB() != null) { if (matchups.get(position).getPlayerstatus().equalsIgnoreCase("1")) { // playerHolder.first_player_img.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_lost_bg)); playerHolder.left_matchcard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_gray)); playerHolder.first_playerCheck.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_loss)); playerHolder.first_player_Name.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); playerHolder.second_player_Name.setTextColor(mContext.getResources().getColor(R.color.hint)); } else { setTextViewDrawableColor(playerHolder.overview_txt, mContext.getResources().getColor(R.color.text_color_new)); // playerHolder.overView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_lost_bg)); playerHolder.over_playercard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_gray)); playerHolder.overCheckbox.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_loss)); playerHolder.underView_txt.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); } } // } if ((matchups.get(position).getPickIndex() == 1 && matchups.get(position).getWinIndex() == -1) && matchups.get(position).getIsCancelled()) { playerHolder.win_loss_statusView_ly.setVisibility(View.VISIBLE); playerHolder.win_loss_statusView.setBackgroundColor(mContext.getResources().getColor(R.color.text_color_new)); if (matchups.get(position).getCancelledReason() != null) { playerHolder.statusTxt.setText(matchups.get(position).getCancelledReason()); } else { playerHolder.statusTxt.setText("CANCELLED"); } if (matchups.get(position).getPlayerC() != null) { setTextViewDrawableColor(playerHolder.player_Name_c, mContext.getResources().getColor(R.color.text_color_new)); playerHolder.player_Name_c.setTextColor(mContext.getResources().getColor(R.color.hint)); // playerHolder.player_img_b.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_lost_bg)); playerHolder.over_playercard_b.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_gray)); playerHolder.playerCheck_b.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_loss)); } else { // if (matchups.get(position).getPlayerB() != null) { if (matchups.get(position).getPlayerstatus().equalsIgnoreCase("1")) { // playerHolder.second_player_img.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_lost_bg)); playerHolder.right_matchcard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_gray)); playerHolder.second_playerCheck.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_loss)); playerHolder.first_player_Name.setTextColor(mContext.getResources().getColor(R.color.hint)); playerHolder.second_player_Name.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); } else { setTextViewDrawableColor(playerHolder.underView_txt, mContext.getResources().getColor(R.color.text_color_new)); playerHolder.underView_txt.setTextColor(mContext.getResources().getColor(R.color.hint)); // playerHolder.overView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_lost_bg)); playerHolder.over_playercard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_gray)); playerHolder.overCheckbox.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_loss)); } } } /* if winindex=1,pickindex=0 or winindex=1,pickindex=-1 playerB checked gray*/ if (matchups.get(position).getPickIndex() == 1 && matchups.get(position).getWinIndex() == 0) { playerHolder.win_loss_statusView_ly.setVisibility(View.VISIBLE); playerHolder.win_loss_statusView.setBackgroundColor(mContext.getResources().getColor(R.color.text_color_new)); playerHolder.statusTxt.setText("LOST"); if (matchups.get(position).getPlayerC() != null) { setTextViewDrawableColor(playerHolder.player_Name_c, mContext.getResources().getColor(R.color.text_color_new)); // playerHolder.player_img_c.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_lost_bg)); playerHolder.playerCheck_c.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_loss)); playerHolder.over_playercard_c.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_gray)); // playerHolder.player_Name_c.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); playerHolder.player_Name_c.setTextColor(mContext.getResources().getColor(R.color.hint)); } else { // if (matchups.get(position).getPlayerB() != null) { if (matchups.get(position).getPlayerstatus().equalsIgnoreCase("1")) { // playerHolder.second_player_img.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_lost_bg)); playerHolder.right_matchcard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_gray)); playerHolder.second_playerCheck.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_loss)); playerHolder.second_player_Name.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); playerHolder.first_player_Name.setTextColor(mContext.getResources().getColor(R.color.hint)); } else { setTextViewDrawableColor(playerHolder.underView_txt, mContext.getResources().getColor(R.color.text_color_new)); // playerHolder.underView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_lost_bg)); playerHolder.under_playercard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_gray)); playerHolder.underCheckbox.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_loss)); playerHolder.underView_txt.setTextColor(mContext.getResources().getColor(R.color.hint)); } } } } else { Log.e("277---", "277----not played"); /* if played false,pickindex=0 playerA checked */ if (matchups.get(position).getPickIndex() == 0) { // if (matchups.get(position).getPlayerB() != null) { if (matchups.get(position).getPlayerC() != null) { // if (matchups.get(position).getPlayerstatus_C().equalsIgnoreCase("1")) { // } else if (matchups.get(position).getPlayerC() != null){ // playerHolder.player_img_b.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_select_bg_circle1)); playerHolder.over_playercard_b.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_win)); // playerHolder.left_matchcard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_win)); playerHolder.playerCheck_b.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_selected)); setTextViewDrawableColor(playerHolder.player_Name_b, mContext.getResources().getColor(R.color.text_color_new)); playerHolder.player_Name_c.setTextColor(mContext.getResources().getColor(R.color.hint)); } else { if (matchups.get(position).getPlayerstatus().equalsIgnoreCase("1")) { // playerHolder.first_player_img.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_select_bg_circle1)); playerHolder.left_matchcard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_win)); playerHolder.first_playerCheck.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_selected)); playerHolder.first_player_Name.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); playerHolder.second_player_Name.setTextColor(mContext.getResources().getColor(R.color.hint)); } else { setTextViewDrawableColor(playerHolder.overview_txt, mContext.getResources().getColor(R.color.text_color_new)); playerHolder.underView_txt.setTextColor(mContext.getResources().getColor(R.color.hint)); // playerHolder.overView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_select_bg_circle1)); playerHolder.over_playercard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_win)); playerHolder.overCheckbox.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_selected)); } } } /* if played =flase,pickindex=1 playerB checked */ if (matchups.get(position).getPickIndex() == 1) { Log.e("277---", "0101"); if (matchups.get(position).getPlayerC() != null) { // if (matchups.get(position).getPlayerstatus_C().equalsIgnoreCase("1")) { Log.e("277---", "0102"); // } else if (matchups.get(position).getPlayerC() != null){ // playerHolder.player_img_c.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_select_bg_circle1)); playerHolder.over_playercard_c.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_win)); playerHolder.playerCheck_c.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_selected)); // playerHolder.player_Name_c.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); playerHolder.player_Name_b.setTextColor(mContext.getResources().getColor(R.color.hint)); setTextViewDrawableColor(playerHolder.player_Name_c, mContext.getResources().getColor(R.color.text_color_new)); } else { Log.e("277---", "0103"); // if (matchups.get(position).getPlayerB() != null) { if (matchups.get(position).getPlayerstatus().equalsIgnoreCase("1")) { Log.e("277---", "0104"); // playerHolder.second_player_img.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_select_bg_circle1)); playerHolder.right_matchcard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_win)); playerHolder.second_playerCheck.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_selected)); playerHolder.second_player_Name.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); playerHolder.first_player_Name.setTextColor(mContext.getResources().getColor(R.color.hint)); } else { Log.e("277---", "0105"); setTextViewDrawableColor(playerHolder.underView_txt, mContext.getResources().getColor(R.color.text_color_new)); // playerHolder.underView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_select_bg_circle1)); playerHolder.under_playercard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_win)); playerHolder.underCheckbox.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_selected)); playerHolder.overview_txt.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); } } } /* if (matchups.size() > 0) { Log.e("277---", matchups.get(position).getPlayerA().getFirstName() + "277----not played" + matchups.get(position).getPlayerB().getFirstName()); *//* if played false,pickindex=0 playerA checked *//* if (matchups.get(position).getPickIndex() == 0) { // Toast.makeText(mContext,"533--"+matchups.get(position).getPickIndex(),Toast.LENGTH_LONG).show(); if (matchups.get(position).getPlayerB() != null) { if (matchups.get(position).getPlayerstatus().equalsIgnoreCase("1")) { // Toast.makeText(mContext,"535--",Toast.LENGTH_LONG).show(); playerHolder.first_player_img.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_select_bg_circle1)); playerHolder.first_playerCheck.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_selected)); playerHolder.first_player_Name.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); playerHolder.second_player_Name.setTextColor(mContext.getResources().getColor(R.color.hint)); } else { // Toast.makeText(mContext,"541-null-",Toast.LENGTH_LONG).show(); setTextViewDrawableColor(playerHolder.overview_txt, mContext.getResources().getColor(R.color.text_color_new)); playerHolder.underView_txt.setTextColor(mContext.getResources().getColor(R.color.hint)); playerHolder.overView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_select_bg_circle1)); playerHolder.overCheckbox.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_selected)); } } } *//* if played =flase,pickindex=1 playerB checked *//* if (matchups.get(position).getPickIndex() == 1) { // Toast.makeText(mContext,"551--"+position,Toast.LENGTH_LONG).show(); if (matchups.get(position).getPlayerB() != null) { if (matchups.get(position).getPlayerstatus().equalsIgnoreCase("1")) { // Toast.makeText(mContext,"557--",Toast.LENGTH_LONG).show(); playerHolder.second_player_img.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_select_bg_circle1)); playerHolder.second_playerCheck.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_selected)); playerHolder.second_player_Name.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); playerHolder.first_player_Name.setTextColor(mContext.getResources().getColor(R.color.hint)); } else { // Toast.makeText(mContext,"559--",Toast.LENGTH_LONG).show(); setTextViewDrawableColor(playerHolder.underView_txt, mContext.getResources().getColor(R.color.text_color_new)); playerHolder.underView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_select_bg_circle1)); playerHolder.underCheckbox.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.game_badge_selected)); playerHolder.overview_txt.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); } } } }*/ } } catch (Exception e) { } } else { // guest/ not purchage playerHolder.win_loss_statusView_ly.setVisibility(View.GONE); playerHolder.first_playerCard.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (playerHolder.no_player.getVisibility() == View.GONE || playerHolder.no_player_abc.getVisibility() == View.GONE) { mHilightViews(playerHolder, 1, position); } // if (playerHolder.no_player_abc.getVisibility() == View.GONE) { // mHilightViews(playerHolder, 1, position); // } } }); playerHolder.second_playerCard.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mHilightViews(playerHolder, 2, position); } }); playerHolder.over_playercard.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mHilightViews(playerHolder, 3, position); } }); playerHolder.under_playercard.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mHilightViews(playerHolder, 4, position); } }); playerHolder.over_playercard_b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mHilightViews(playerHolder, 5, position); } }); playerHolder.over_playercard_c.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mHilightViews(playerHolder, 6, position); } }); } // playerHolder.playerstatsViewSpinner.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // playerHolder.playerStatisticsView.setVisibility(playerHolder.playerStatisticsView.getVisibility() == View.GONE ? View.VISIBLE : View.GONE); // if (playerHolder.playerStatisticsView.getVisibility() == View.VISIBLE) { // playerHolder.arrow.setRotation(180); // } else { // playerHolder.arrow.setRotation(360); // } // } // }); playerHolder.playerstatsViewSpinner.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { playerHolder.playerStatisticsView.setVisibility(playerHolder.playerStatisticsView.getVisibility() == View.GONE ? View.VISIBLE : View.GONE); if (playerHolder.playerStatisticsView.getVisibility() == View.VISIBLE) { playerHolder.arrow.setRotation(180); } else { playerHolder.arrow.setRotation(360); } int size = matchups.size(); System.out.println("size" + size + " " + position); int values = position + 1; if (size == values) { System.out.println("size" + size + position); // int values=position+1; playerGridView.scrollToPosition(values); playerGridView.scrollTo(position, values); // playerGridView.setSelection(scorll); playerGridView.setVerticalScrollbarPosition(values); playerGridView.smoothScrollToPosition(values); } } }); playerHolder.sq_cc_over.setClickable(true); playerHolder.sq_cc.setClickable(true); playerHolder.sq_cc.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.e("1425----", "1112"); playerHolder.playerStatisticsView.setVisibility(playerHolder.playerStatisticsView.getVisibility() == View.GONE ? View.VISIBLE : View.GONE); if (playerHolder.playerStatisticsView.getVisibility() == View.VISIBLE) { playerHolder.arrow.setRotation(180); } else { playerHolder.arrow.setRotation(360); } int size = matchups.size(); System.out.println("size" + size + " " + position); int values = position + 1; if (size == values) { System.out.println("size" + size + position); // int values=position+1; playerGridView.scrollToPosition(values); playerGridView.scrollTo(position, values); // playerGridView.setSelection(scorll); playerGridView.setVerticalScrollbarPosition(values); playerGridView.smoothScrollToPosition(values); } } }); playerHolder.sq_cc_over.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { playerHolder.playerStatisticsView.setVisibility(playerHolder.playerStatisticsView.getVisibility() == View.GONE ? View.VISIBLE : View.GONE); if (playerHolder.playerStatisticsView.getVisibility() == View.VISIBLE) { playerHolder.arrow.setRotation(180); } else { playerHolder.arrow.setRotation(360); } int size = matchups.size(); System.out.println("size" + size + " " + position); int values = position + 1; if (size == values) { System.out.println("size" + size + position); // int values=position+1; playerGridView.scrollToPosition(values); playerGridView.scrollTo(position, values); // playerGridView.setSelection(scorll); playerGridView.setVerticalScrollbarPosition(values); playerGridView.smoothScrollToPosition(values); } } }); // NewPLayerStatisticsAdapter pLayerStatisticsAdapter = new NewPLayerStatisticsAdapter(matchups.get(position).getDisplayStats(), mContext); //// NewPLayerStatisticsAdapter pLayerStatisticsAdapter = new NewPLayerStatisticsAdapter(stats_ps, mContext); // CustomLinearLayoutManager gridLayoutManager = new CustomLinearLayoutManager(mContext); // playerHolder.playerStatsRcView_child.setLayoutManager(gridLayoutManager); // // /// ststsus // playerHolder.playerStatsRcView_child.setAdapter(pLayerStatisticsAdapter); // if (matchups.get(position).getPlayerB() != null) { if (matchups.get(position).getPlayerC() != null) { NewPLayerStatisticsAdapter pLayerStatisticsAdapter = new NewPLayerStatisticsAdapter(matchups.get(position).getDisplayStats(), mContext, "3"); // NewPLayerStatisticsAdapter pLayerStatisticsAdapter = new NewPLayerStatisticsAdapter(stats_ps, mContext); CustomLinearLayoutManager gridLayoutManager = new CustomLinearLayoutManager(mContext); playerHolder.playerStatsRcView_child.setLayoutManager(gridLayoutManager); /// ststsus playerHolder.playerStatsRcView_child.setAdapter(pLayerStatisticsAdapter); } else { if (matchups.get(position).getPlayerstatus().equalsIgnoreCase("1")) { NewPLayerStatisticsAdapter pLayerStatisticsAdapter = new NewPLayerStatisticsAdapter(matchups.get(position).getDisplayStats(), mContext, "1"); // NewPLayerStatisticsAdapter pLayerStatisticsAdapter = new NewPLayerStatisticsAdapter(stats_ps, mContext); CustomLinearLayoutManager gridLayoutManager = new CustomLinearLayoutManager(mContext); playerHolder.playerStatsRcView_child.setLayoutManager(gridLayoutManager); /// ststsus playerHolder.playerStatsRcView_child.setAdapter(pLayerStatisticsAdapter); } else { NewPLayerStatisticsAdapter pLayerStatisticsAdapter = new NewPLayerStatisticsAdapter(matchups.get(position).getDisplayStats(), mContext, "2"); // NewPLayerStatisticsAdapter pLayerStatisticsAdapter = new NewPLayerStatisticsAdapter(stats_ps, mContext); CustomLinearLayoutManager gridLayoutManager = new CustomLinearLayoutManager(mContext); playerHolder.playerStatsRcView_child.setLayoutManager(gridLayoutManager); /// ststsus playerHolder.playerStatsRcView_child.setAdapter(pLayerStatisticsAdapter); } } } private String getTime(String leagueTime) { String time = null; @SuppressLint("SimpleDateFormat") SimpleDateFormat f = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss"); f.setTimeZone(TimeZone.getTimeZone("EST")); String currentDate = f.format(new Date()).toString(); String[] currentTime = currentDate.split(" "); String[] hoursMIns = currentTime[1].split(":"); int curHour = Integer.parseInt(hoursMIns[0]); int curMins = Integer.parseInt(hoursMIns[1]); if (leagueTime != null && !leagueTime.equals("")) { String[] timeArray = leagueTime.split("T"); if (timeArray.length > 0) { String lg_time = timeArray[1]; String[] hourArray = lg_time.split("\\."); if (hourArray.length > 0) { String[] final_time = hourArray[0].split(":"); if (final_time.length > 0) { int lg_hour = Integer.parseInt(final_time[0]); int lg_mins = Integer.parseInt(final_time[1]); int diffHours = lg_hour - curHour; int diffMins = lg_mins - curMins; if (diffHours > 0) { if (diffMins > 0) time = diffHours + "h " + diffMins + "m"; else time = diffHours + "h"; } else { if (diffMins > 0) time = diffMins + "m"; } } } } } else { time = ""; } return time; } private void mHilightViews(PlayerHolder playerHolder, int from, int position) { if (from == 1) { if (playerHolder.first_playerCheck.isChecked()) { // PLAYER A REMOVED if (new_pick_index.size() > 0) { new_pick_index.remove(matchups.get(position).get_id()); } playerHolder.first_playerCheck.setChecked(false); setFirstPlayerTextEnableDisable(playerHolder, false, position); playerHolder.first_player_Name.setTextColor(mContext.getResources().getColor(R.color.black)); playerHolder.second_player_Name.setTextColor(mContext.getResources().getColor(R.color.black)); // playerHolder.first_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.sqorr_red)); // playerHolder.second_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.gray_line)); } else { if (playerHolder.second_playerCheck.isChecked()) { //PLAYER B REMOVED playerHolder.second_playerCheck.setChecked(false); new_pick_index.remove(matchups.get(position).get_id()); setSecondPlayerTextDisableEnableMode(playerHolder, false, position); } // playerHolder.first_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.gray_line)); // playerHolder.second_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.sqorr_red)); //PLAYER A ADDED playerHolder.first_playerCheck.setChecked(true); new_pick_index.put(matchups.get(position).get_id(), "0"); setFirstPlayerTextEnableDisable(playerHolder, true, position); } } else if (from == 2) { if (playerHolder.second_playerCheck.isChecked()) { //PLAYER B REMOVED playerHolder.second_playerCheck.setChecked(false); if (new_pick_index.size() > 0) { new_pick_index.remove(matchups.get(position).get_id()); } setSecondPlayerTextDisableEnableMode(playerHolder, false, position); playerHolder.first_player_Name.setTextColor(mContext.getResources().getColor(R.color.black)); playerHolder.second_player_Name.setTextColor(mContext.getResources().getColor(R.color.black)); } else { if (playerHolder.first_playerCheck.isChecked()) { // PLAYER A REMOVED playerHolder.first_playerCheck.setChecked(false); new_pick_index.remove(matchups.get(position).get_id()); setFirstPlayerTextEnableDisable(playerHolder, false, position); } //PLAYER B ADDED playerHolder.second_playerCheck.setChecked(true); new_pick_index.put(matchups.get(position).get_id(), "1"); setSecondPlayerTextDisableEnableMode(playerHolder, true, position); } } else if (from == 3) { if (playerHolder.overCheckbox.isChecked()) { if (new_pick_index.size() > 0) { new_pick_index.remove(matchups.get(position).get_id()); } playerHolder.overCheckbox.setChecked(false); setAPlayerTextDisableEnableMode(playerHolder, false, position); } else { if (playerHolder.underCheckbox.isChecked()) { new_pick_index.remove(matchups.get(position).get_id()); playerHolder.underCheckbox.setChecked(false); setBPlayerTextDisableEnableMode(playerHolder, false, position); } playerHolder.overCheckbox.setChecked(true); new_pick_index.put(matchups.get(position).get_id(), "0"); setAPlayerTextDisableEnableMode(playerHolder, true, position); } } else if (from == 4) { if (playerHolder.underCheckbox.isChecked()) { playerHolder.underCheckbox.setChecked(false); if (new_pick_index.size() > 0) { new_pick_index.remove(matchups.get(position).get_id()); } setBPlayerTextDisableEnableMode(playerHolder, false, position); } else { if (playerHolder.overCheckbox.isChecked()) { playerHolder.overCheckbox.setChecked(false); new_pick_index.remove(matchups.get(position).get_id()); setAPlayerTextDisableEnableMode(playerHolder, false, position); } playerHolder.underCheckbox.setChecked(true); new_pick_index.put(matchups.get(position).get_id(), "1"); setBPlayerTextDisableEnableMode(playerHolder, true, position); } } else if (from == 5) { if (playerHolder.playerCheck_b.isChecked()) { if (new_pick_index.size() > 0) { new_pick_index.remove(matchups.get(position).get_id()); } playerHolder.playerCheck_b.setChecked(false); setABPlayerTextDisableEnableMode(playerHolder, false,position); } else { if (playerHolder.playerCheck_c.isChecked()) { new_pick_index.remove(matchups.get(position).get_id()); playerHolder.playerCheck_c.setChecked(false); setACPlayerTextDisableEnableMode(playerHolder, false,position); } playerHolder.playerCheck_b.setChecked(true); new_pick_index.put(matchups.get(position).get_id(), "0"); setABPlayerTextDisableEnableMode(playerHolder, true,position); } } else if (from == 6) { if (playerHolder.playerCheck_c.isChecked()) { playerHolder.playerCheck_c.setChecked(false); if (new_pick_index.size() > 0) { new_pick_index.remove(matchups.get(position).get_id()); } setACPlayerTextDisableEnableMode(playerHolder, false,position); } else { if (playerHolder.playerCheck_b.isChecked()) { playerHolder.playerCheck_b.setChecked(false); new_pick_index.remove(matchups.get(position).get_id()); setABPlayerTextDisableEnableMode(playerHolder, false,position); } playerHolder.playerCheck_c.setChecked(true); new_pick_index.put(matchups.get(position).get_id(), "1"); setACPlayerTextDisableEnableMode(playerHolder, true,position); } } } private void setABPlayerTextDisableEnableMode(PlayerHolder playerHolder, boolean enable,int position) { // if (enable) { // playerHolder.player_Name_b.setTextColor(mContext.getResources().getColor(R.color.black)); // playerHolder.overView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_select_bg_circle1)); // setTextViewDrawableColor(playerHolder.overview_txt, mContext.getResources().getColor(R.color.black)); // } else { // playerHolder.player_Name_b.setTextColor(mContext.getResources().getColor(R.color.hint)); // playerHolder.overView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_unchecked)); // setTextViewDrawableColor(playerHolder.overview_txt, mContext.getResources().getColor(R.color.hint)); // } // mCallback.onClick(new_pick_index); if (enable) { playerHolder.player_Name_b.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); playerHolder.player_Name_c.setTextColor(mContext.getResources().getColor(R.color.hint)); // playerHolder.over_playercard_b.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_win)); setTextViewDrawableColor(playerHolder.player_Name_b, mContext.getResources().getColor(R.color.text_color_new)); if (position == 0) { playerHolder.over_playercard_b.setBackgroundColor(mContext.getResources().getColor(R.color.p0)); } if (position == 1) { playerHolder.over_playercard_b.setBackgroundColor(mContext.getResources().getColor(R.color.p1)); } if (position == 2) { playerHolder.over_playercard_b.setBackgroundColor(mContext.getResources().getColor(R.color.p2)); } if (position == 3) { playerHolder.over_playercard_b.setBackgroundColor(mContext.getResources().getColor(R.color.p3)); } if (position == 4) { playerHolder.over_playercard_b.setBackgroundColor(mContext.getResources().getColor(R.color.p4)); } if (position == 5) { playerHolder.over_playercard_b.setBackgroundColor(mContext.getResources().getColor(R.color.p5)); } if (position == 6) { playerHolder.over_playercard_b.setBackgroundColor(mContext.getResources().getColor(R.color.p6)); } if (position == 7) { playerHolder.over_playercard_b.setBackgroundColor(mContext.getResources().getColor(R.color.p7)); } if (position == 8) { playerHolder.over_playercard_b.setBackgroundColor(mContext.getResources().getColor(R.color.p8)); } } else { playerHolder.over_playercard_b.setBackgroundColor(mContext.getResources().getColor(R.color.white)); playerHolder.player_Name_b.setTextColor(mContext.getResources().getColor(R.color.hint)); } mCallback.onClick(new_pick_index); } private void setACPlayerTextDisableEnableMode(PlayerHolder playerHolder, boolean enable,int position) { /* if (enable) { playerHolder.player_Name_c.setTextColor(mContext.getResources().getColor(R.color.black)); playerHolder.underView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_select_bg_circle1)); setTextViewDrawableColor(playerHolder.underView_txt, mContext.getResources().getColor(R.color.black)); } else { playerHolder.player_Name_c.setTextColor(mContext.getResources().getColor(R.color.hint)); setTextViewDrawableColor(playerHolder.underView_txt, mContext.getResources().getColor(R.color.hint)); playerHolder.underView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_unchecked)); } mCallback.onClick(new_pick_index);*/ if (enable) { playerHolder.player_Name_c.setTextColor(mContext.getResources().getColor((R.color.text_color_new))); playerHolder.player_Name_b.setTextColor(mContext.getResources().getColor((R.color.hint))); // playerHolder.player_img_c.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_select_bg_circle1)); // playerHolder.over_playercard_c.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_win)); if (position == 0) { playerHolder.over_playercard_c.setBackgroundColor(mContext.getResources().getColor(R.color.p0)); } if (position == 1) { playerHolder.over_playercard_c.setBackgroundColor(mContext.getResources().getColor(R.color.p1)); } if (position == 2) { playerHolder.over_playercard_c.setBackgroundColor(mContext.getResources().getColor(R.color.p2)); } if (position == 3) { playerHolder.over_playercard_c.setBackgroundColor(mContext.getResources().getColor(R.color.p3)); } if (position == 4) { playerHolder.over_playercard_c.setBackgroundColor(mContext.getResources().getColor(R.color.p4)); } if (position == 5) { playerHolder.over_playercard_c.setBackgroundColor(mContext.getResources().getColor(R.color.p5)); } if (position == 6) { playerHolder.over_playercard_c.setBackgroundColor(mContext.getResources().getColor(R.color.p6)); } if (position == 7) { playerHolder.over_playercard_c.setBackgroundColor(mContext.getResources().getColor(R.color.p7)); } if (position == 8) { playerHolder.over_playercard_c.setBackgroundColor(mContext.getResources().getColor(R.color.p8)); } setTextViewDrawableColor(playerHolder.player_Name_c, mContext.getResources().getColor(R.color.text_color_new)); } else { playerHolder.player_Name_c.setTextColor(mContext.getResources().getColor((R.color.hint))); playerHolder.over_playercard_c.setBackgroundColor(mContext.getResources().getColor(R.color.white)); // playerHolder.player_img_c.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_checked)); } mCallback.onClick(new_pick_index); } //bb private void setAPlayerTextDisableEnableMode(PlayerHolder playerHolder, boolean enable, int position) { if (enable) { playerHolder.overview_txt.setTextColor(mContext.getResources().getColor(R.color.black)); // playerHolder.overView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_select_bg_circle1)); // playerHolder.over_playercard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_win)); setTextViewDrawableColor(playerHolder.overview_txt, mContext.getResources().getColor(R.color.black)); playerHolder.over_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p0)); playerHolder.under_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.gray_line)); if (position == 0) { playerHolder.over_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p0)); } if (position == 1) { playerHolder.over_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p1)); } if (position == 2) { playerHolder.over_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p2)); } if (position == 3) { playerHolder.over_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p3)); } if (position == 4) { playerHolder.over_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p4)); } if (position == 5) { playerHolder.over_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p5)); } if (position == 6) { playerHolder.over_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p6)); } if (position == 7) { playerHolder.over_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p7)); } if (position == 8) { playerHolder.over_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p8)); } } else { playerHolder.overview_txt.setTextColor(mContext.getResources().getColor(R.color.black)); // playerHolder.overView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_unchecked)); playerHolder.over_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.white)); setTextViewDrawableColor(playerHolder.overview_txt, mContext.getResources().getColor(R.color.hint)); playerHolder.over_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.gray_line)); playerHolder.under_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.gray_line)); } mCallback.onClick(new_pick_index); } private void setBPlayerTextDisableEnableMode(PlayerHolder playerHolder, boolean enable, int position) { if (enable) { playerHolder.underView_txt.setTextColor(mContext.getResources().getColor(R.color.black)); // playerHolder.underView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_select_bg_circle1)); // playerHolder.under_playercard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_win)); setTextViewDrawableColor(playerHolder.underView_txt, mContext.getResources().getColor(R.color.black)); // playerHolder.under_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p0)); playerHolder.over_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.gray_line)); if (position == 0) { playerHolder.under_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p0)); } if (position == 1) { playerHolder.under_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p1)); } if (position == 2) { playerHolder.under_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p2)); } if (position == 3) { playerHolder.under_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p3)); } if (position == 4) { playerHolder.under_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p4)); } if (position == 5) { playerHolder.under_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p5)); } if (position == 6) { playerHolder.under_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p6)); } if (position == 7) { playerHolder.under_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p7)); } if (position == 8) { playerHolder.under_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.p8)); } } else { playerHolder.over_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.gray_line)); playerHolder.under_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.gray_line)); playerHolder.underView_txt.setTextColor(mContext.getResources().getColor(R.color.black)); setTextViewDrawableColor(playerHolder.underView_txt, mContext.getResources().getColor(R.color.hint)); // playerHolder.underView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_unchecked)); playerHolder.under_playercard.setBackgroundColor(mContext.getResources().getColor(R.color.white)); } mCallback.onClick(new_pick_index); } private void setFirstPlayerTextEnableDisable(PlayerHolder playerHolder, boolean enable, int position) { if (enable) { playerHolder.first_player_Name.setTextColor(mContext.getResources().getColor(R.color.text_color_new)); playerHolder.second_player_Name.setTextColor(mContext.getResources().getColor(R.color.hint)); // playerHolder.first_player_img.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_select_bg_circle1)); playerHolder.left_matchcard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_win)); setTextViewDrawableColor(playerHolder.first_player_Name, mContext.getResources().getColor(R.color.text_color_new)); Log.e("11976-----------Pos", position + ""); playerHolder.second_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.gray_line)); if (position == 0) { playerHolder.first_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.p0)); } if (position == 1) { playerHolder.first_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.p1)); } if (position == 2) { playerHolder.first_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.p2)); } if (position == 3) { playerHolder.first_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.p3)); } if (position == 4) { playerHolder.first_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.p4)); } if (position == 5) { playerHolder.first_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.p5)); } if (position == 6) { playerHolder.first_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.p6)); } if (position == 7) { playerHolder.first_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.p7)); } if (position == 8) { playerHolder.first_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.p8)); } } else { playerHolder.first_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.gray_line)); playerHolder.second_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.gray_line)); // playerHolder.first_player_img.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_checked)); playerHolder.left_matchcard.setBackgroundColor(mContext.getResources().getColor(R.color.white)); playerHolder.first_player_Name.setTextColor(mContext.getResources().getColor(R.color.hint)); } mCallback.onClick(new_pick_index); } private void setSecondPlayerTextDisableEnableMode(PlayerHolder playerHolder, boolean enable, int position) { if (enable) { playerHolder.second_player_Name.setTextColor(mContext.getResources().getColor((R.color.text_color_new))); playerHolder.first_player_Name.setTextColor(mContext.getResources().getColor((R.color.hint))); playerHolder.right_matchcard.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.rectangle_new_win)); // playerHolder.second_player_img.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_select_bg_circle1)); setTextViewDrawableColor(playerHolder.second_player_Name, mContext.getResources().getColor(R.color.text_color_new)); playerHolder.first_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.gray_line)); if (position == 0) { playerHolder.second_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.p0)); } if (position == 1) { playerHolder.second_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.p1)); } if (position == 2) { playerHolder.second_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.p2)); } if (position == 3) { playerHolder.second_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.p3)); } if (position == 4) { playerHolder.second_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.p4)); } if (position == 5) { playerHolder.second_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.p5)); } if (position == 6) { playerHolder.second_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.p6)); } if (position == 7) { playerHolder.second_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.p7)); } if (position == 8) { playerHolder.second_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.p8)); } // playerHolder.second_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.sqorr_red)); } else { playerHolder.first_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.gray_line)); playerHolder.second_playerCard.setBackgroundColor(mContext.getResources().getColor(R.color.gray_line)); playerHolder.second_player_Name.setTextColor(mContext.getResources().getColor((R.color.hint))); // playerHolder.second_player_img.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.player_checked)); playerHolder.right_matchcard.setBackgroundColor(mContext.getResources().getColor(R.color.white)); } mCallback.onClick(new_pick_index); } @Override public int getItemCount() { return matchups.size(); } @SuppressLint("NewApi") public Bitmap transformImg(Bitmap source, int color) { int size = Math.min(source.getWidth(), source.getHeight()); int x = (source.getWidth() - size) / 2; int y = (source.getHeight() - size) / 2; Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size); if (squaredBitmap != source) { source.recycle(); } Bitmap bitmap = Bitmap.createBitmap(size, size, source.getConfig()); Canvas canvas = new Canvas(bitmap); Paint paint = new Paint(); BitmapShader shader = new BitmapShader(squaredBitmap, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP); paint.setShader(shader); paint.setAntiAlias(true); float r1 = size / 2f; canvas.drawCircle(r1, r1, r1, paint); //border code paint.setShader(null); paint.setStyle(Paint.Style.STROKE); paint.setColor(mContext.getColor(color)); paint.setStrokeWidth(1f); float r = size / 2f; canvas.drawCircle(r, r, r, paint); squaredBitmap.recycle(); return bitmap; } @SuppressLint("NewApi") private void setTextViewDrawableColor(TextView textView, int color) { textView.setCompoundDrawableTintList(ColorStateList.valueOf(color)); } @Override public long getItemId(int position) { return position; } @Override public int getItemViewType(int position) { return position; } public interface OnItemClick { void onClick(HashMap<String, String> matchup_selections); } public class PlayerHolder extends RecyclerView.ViewHolder { //1St PLayer ImageView first_player_img; TextView first_player_Name; TextView first_player_Time; TextView first_player_position; TextView first_player_place; TextView first_player_Match; Button first_player_price; CardView first_playerCard; CheckBox first_playerCheck; TextView first_platytime; RelativeLayout left_matchcard; //2nd player ImageView second_player_img; TextView second_player_Name; TextView second_player_Time; TextView second_player_position; TextView second_player_Match; Button second_player_price; CardView second_playerCard; CheckBox second_playerCheck; TextView secondtime; RelativeLayout right_matchcard; //Player statistics CardView playerstatsViewSpinner; LinearLayout playerStatisticsView; ImageView arrow; RecyclerView playerStatsRcView_child; //B player off CheckBox overCheckbox; CheckBox underCheckbox; RelativeLayout under_playercard; RelativeLayout over_playercard; TextView overview_txt; TextView underView_txt; LinearLayout overView; LinearLayout underView; CardView no_player, no_player_abc; TextView tvPlayPoints; /*win loss status View*/ FrameLayout win_loss_statusView_ly; CardView win_loss_statusView; TextView statusTxt; // TextView play; // AB TextView player_Name_b, player_position_b, player_Match_b, player_time_b, player_price_b; CheckBox playerCheck_b; RelativeLayout over_playercard_b; ImageView player_img_b; // AC ImageView player_img_c; TextView player_Name_c, player_position_c, player_Match_c, player_time_c, player_price_c; CheckBox playerCheck_c; RelativeLayout over_playercard_c; LinearLayout heads_s; TextView player_4, player_2, player_3; LinearLayout sq_cc, sq_cc_over; public PlayerHolder(@NonNull View itemView) { super(itemView); // PLAYER A this.first_platytime = (TextView) itemView.findViewById(R.id.player_time1); this.first_player_img = (ImageView) itemView.findViewById(R.id.player_img); this.first_player_Name = (TextView) itemView.findViewById(R.id.player_Name); this.first_player_position = (TextView) itemView.findViewById(R.id.player_position); this.first_player_place = (TextView) itemView.findViewById(R.id.player_place); this.first_player_Match = (TextView) itemView.findViewById(R.id.player_Match); this.first_player_Time = (TextView) itemView.findViewById(R.id.player_time); this.first_player_price = (Button) itemView.findViewById(R.id.player_price); this.first_playerCard = (CardView) itemView.findViewById(R.id.playerCard); this.first_playerCheck = (CheckBox) itemView.findViewById(R.id.playerCheck); this.left_matchcard = itemView.findViewById(R.id.left_matchcard); // PLAYER B this.second_player_img = (ImageView) itemView.findViewById(R.id.second_player_img); this.second_player_Name = (TextView) itemView.findViewById(R.id.second_player_Name); this.second_player_position = (TextView) itemView.findViewById(R.id.second_player_position); this.second_player_Match = (TextView) itemView.findViewById(R.id.second_player_Match); this.second_player_Time = (TextView) itemView.findViewById(R.id.second_player_time); this.second_player_price = (Button) itemView.findViewById(R.id.second_player_price); this.second_playerCard = (CardView) itemView.findViewById(R.id.second_playerCard); this.second_playerCheck = (CheckBox) itemView.findViewById(R.id.second_playerCheck); this.secondtime = (TextView) itemView.findViewById(R.id.second_player_time1); //Players ststistics this.playerstatsViewSpinner = (CardView) itemView.findViewById(R.id.playerstatsViewSpinner); this.playerStatisticsView = (LinearLayout) itemView.findViewById(R.id.playerStatisticsView); this.arrow = (ImageView) itemView.findViewById(R.id.arrow); this.playerStatsRcView_child = (RecyclerView) itemView.findViewById(R.id.playerStatsRcView_child); this.right_matchcard = itemView.findViewById(R.id.right_matchcard); //PlayerB OFF this.overCheckbox = (CheckBox) itemView.findViewById(R.id.overCheckbox); this.underCheckbox = (CheckBox) itemView.findViewById(R.id.underCheckbox); this.over_playercard = (RelativeLayout) itemView.findViewById(R.id.over_playercard); this.under_playercard = (RelativeLayout) itemView.findViewById(R.id.under_playercard); this.overview_txt = (TextView) itemView.findViewById(R.id.overview_txt); this.underView_txt = (TextView) itemView.findViewById(R.id.underView_txt); this.overView = (LinearLayout) itemView.findViewById(R.id.overView); this.underView = (LinearLayout) itemView.findViewById(R.id.underView); this.no_player = (CardView) itemView.findViewById(R.id.no_player); this.tvPlayPoints = (TextView) itemView.findViewById(R.id.tvPlayPoints); this.win_loss_statusView_ly = (FrameLayout) itemView.findViewById(R.id.win_loss_statusView_ly); this.win_loss_statusView = (CardView) itemView.findViewById(R.id.win_loss_statusView); this.statusTxt = (TextView) itemView.findViewById(R.id.statusTxt); // this.play=(TextView) itemView.findViewById(R.id.play); this.no_player_abc = (CardView) itemView.findViewById(R.id.no_player_abc); // PLAYER A vs B this.player_img_b = (ImageView) itemView.findViewById(R.id.player_img_b); this.player_Name_b = (TextView) itemView.findViewById(R.id.player_Name_b); this.player_position_b = (TextView) itemView.findViewById(R.id.player_position_b); this.player_Match_b = (TextView) itemView.findViewById(R.id.player_Match_b); this.player_time_b = (TextView) itemView.findViewById(R.id.player_time_b); this.player_price_b = (Button) itemView.findViewById(R.id.player_price_b); // this.second_playerCard = (CardView) itemView.findViewById(R.id.second_playerCard); // this.second_playerCheck = (CheckBox) itemView.findViewById(R.id.second_playerCheck); // this.secondtime = (TextView) itemView.findViewById(R.id.second_player_time1); this.playerCheck_b = (CheckBox) itemView.findViewById(R.id.playerCheck_b); this.over_playercard_b = (RelativeLayout) itemView.findViewById(R.id.over_playercard_b); // PLAYER A vs C this.player_img_c = (ImageView) itemView.findViewById(R.id.player_img_c); this.player_Name_c = (TextView) itemView.findViewById(R.id.player_Name_c); this.player_position_c = (TextView) itemView.findViewById(R.id.player_position_c); this.player_Match_c = (TextView) itemView.findViewById(R.id.player_Match_c); this.player_time_c = (TextView) itemView.findViewById(R.id.player_time_c); this.player_price_c = (Button) itemView.findViewById(R.id.player_price_c); // this.second_playerCard = (CardView) itemView.findViewById(R.id.second_playerCard); // this.secondtime = (TextView) itemView.findViewById(R.id.second_player_time1); this.playerCheck_c = (CheckBox) itemView.findViewById(R.id.playerCheck_c); this.over_playercard_c = (RelativeLayout) itemView.findViewById(R.id.over_playercard_c); this.heads_s = itemView.findViewById(R.id.heads_s); this.player_2 = itemView.findViewById(R.id.player_2); this.player_3 = itemView.findViewById(R.id.player_3); this.player_4 = itemView.findViewById(R.id.player_4); this.sq_cc = itemView.findViewById(R.id.sq_cc); this.sq_cc_over = itemView.findViewById(R.id.sq_cc_over); } } }
[ "kalyan0428@gmail.com" ]
kalyan0428@gmail.com
df205a4606937fea55585b6f3dbf0b2a2132987e
c30b55ece226470a9b7ecc4316db3acfeec7ad75
/gear2/src/main/java/per/sue/gear2/net/parser/StringParser.java
75047ba44d04537312352a0515a280f5d34fe42d
[]
no_license
wuqiuyun/ccq_mall
705619e9b422603cdd538fbe07cc5a2ce2952a66
bea23de87a14be47a09bdc9f3055c69882ff8f1d
refs/heads/master
2020-04-15T15:59:42.166298
2017-09-13T01:12:24
2017-09-13T01:12:24
164,814,615
0
0
null
null
null
null
UTF-8
Java
false
false
337
java
package per.sue.gear2.net.parser; import per.sue.gear2.net.exception.ParseException; /* * 文件名: * 描 述: * 作 者:苏昭强 * 时 间:2015/12/22 */ public class StringParser implements Parser<String> { @Override public String parse(String jsonString) throws ParseException { return jsonString; } }
[ "mhl_94@163.com" ]
mhl_94@163.com
458bbc20ba7ad4ed5f3631a885682c359e53a524
4c45fd10460f88c7176a01c450db5b0aa3314b9b
/src/com/earthman/app/nim/uikit/session/SessionEventListener.java
dc5ff7bd03d66e0e83083ad6677cc9b44df01719
[]
no_license
WenJunKing/diqiuren
b5c60134ba655bb45014a4a75d9b05313a585fb5
b4440085fccc413c1390db2678cd5da893217afc
refs/heads/master
2021-06-01T07:31:33.432581
2016-08-19T07:44:12
2016-08-19T07:44:12
66,062,997
0
1
null
null
null
null
UTF-8
Java
false
false
562
java
package com.earthman.app.nim.uikit.session; import android.content.Context; import com.netease.nimlib.sdk.msg.model.IMMessage; /** * 会话窗口消息列表一些点击事件的响应处理函数 */ public interface SessionEventListener { // 头像点击事件处理,一般用于打开用户资料页面 void onAvatarClicked(Context context, IMMessage message); // 头像长按事件处理,一般用于群组@功能,或者弹出菜单,做拉黑,加好友等功能 void onAvatarLongClicked(Context context, IMMessage message); }
[ "472759693@qq.com" ]
472759693@qq.com