blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
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
sequencelengths
1
1
author_id
stringlengths
0
313
17f615246c2b0eb3d097512b5a66306d4fe37cb5
23e03c72dd70bdda116a24dceca170d5d0e60762
/integration-test/src/test/java/org/cloudfoundry/networking/v1/PoliciesTest.java
d938e3e86173b8e2497c34f20c1f8e3ebfdf8cdd
[ "Apache-2.0" ]
permissive
lidortal/cf-java-client
eb5999c9bd2c1ab35445f3b3fee6a6c4e026e003
ba96cbc3fab9471dd3b175bc7271e1f39594c8be
refs/heads/master
2021-10-22T00:21:42.877968
2019-03-07T07:39:09
2019-03-07T07:39:09
111,803,850
0
0
null
2017-11-23T11:55:18
2017-11-23T11:55:17
null
UTF-8
Java
false
false
10,846
java
/* * Copyright 2013-2017 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.cloudfoundry.networking.v1; import org.cloudfoundry.AbstractIntegrationTest; import org.cloudfoundry.CloudFoundryVersion; import org.cloudfoundry.IfCloudFoundryVersion; import org.cloudfoundry.client.CloudFoundryClient; import org.cloudfoundry.client.v2.applications.CreateApplicationRequest; import org.cloudfoundry.client.v2.applications.CreateApplicationResponse; import org.cloudfoundry.networking.NetworkingClient; import org.cloudfoundry.networking.v1.policies.CreatePoliciesRequest; import org.cloudfoundry.networking.v1.policies.DeletePoliciesRequest; import org.cloudfoundry.networking.v1.policies.Destination; import org.cloudfoundry.networking.v1.policies.ListPoliciesRequest; import org.cloudfoundry.networking.v1.policies.ListPoliciesResponse; import org.cloudfoundry.networking.v1.policies.Policy; import org.cloudfoundry.networking.v1.policies.Ports; import org.cloudfoundry.networking.v1.policies.Source; import org.cloudfoundry.util.ResourceUtils; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import reactor.util.function.Tuples; import java.time.Duration; import java.util.concurrent.TimeoutException; import static org.cloudfoundry.util.tuple.TupleUtils.function; public final class PoliciesTest extends AbstractIntegrationTest { @Autowired private CloudFoundryClient cloudFoundryClient; @Autowired private NetworkingClient networkingClient; @Autowired private Mono<String> spaceId; @IfCloudFoundryVersion(greaterThanOrEqualTo = CloudFoundryVersion.PCF_1_12) @Test public void create() throws TimeoutException, InterruptedException { String destinationApplicationName = this.nameFactory.getApplicationName(); String sourceApplicationName = this.nameFactory.getApplicationName(); Integer port = this.nameFactory.getPort(); this.spaceId .flatMapMany(spaceId -> Mono.zip( createApplicationId(this.cloudFoundryClient, destinationApplicationName, spaceId), createApplicationId(this.cloudFoundryClient, sourceApplicationName, spaceId) )) .flatMap(function((destinationApplicationId, sourceApplicationId) -> this.networkingClient.policies() .create(CreatePoliciesRequest.builder() .policy(Policy.builder() .destination(Destination.builder() .id(destinationApplicationId) .ports(Ports.builder() .end(port + 1) .start(port) .build()) .protocol("tcp") .build()) .source(Source.builder() .id(sourceApplicationId) .build()) .build()) .build()) .then(Mono.just(destinationApplicationId)))) .flatMap(destinationApplicationId -> requestListPolicies(this.networkingClient) .flatMapIterable(ListPoliciesResponse::getPolicies) .filter(policy -> destinationApplicationId.equals(policy.getDestination().getId())) .single()) .map(policy -> policy.getDestination().getPorts().getStart()) .as(StepVerifier::create) .expectNext(port) .expectComplete() .verify(Duration.ofMinutes(5)); } @IfCloudFoundryVersion(greaterThanOrEqualTo = CloudFoundryVersion.PCF_1_12) @Test public void delete() throws TimeoutException, InterruptedException { String destinationApplicationName = this.nameFactory.getApplicationName(); String sourceApplicationName = this.nameFactory.getApplicationName(); Integer port = this.nameFactory.getPort(); this.spaceId .flatMapMany(spaceId -> Mono.zip( createApplicationId(this.cloudFoundryClient, destinationApplicationName, spaceId), createApplicationId(this.cloudFoundryClient, sourceApplicationName, spaceId) )) .delayUntil(function((destinationApplicationId, sourceApplicationId) -> requestCreatePolicy(this.networkingClient, destinationApplicationId, port, sourceApplicationId))) .flatMap(function((destinationApplicationId, sourceApplicationId) -> this.networkingClient.policies() .delete(DeletePoliciesRequest.builder() .policy(Policy.builder() .destination(Destination.builder() .id(destinationApplicationId) .ports(Ports.builder() .end(port) .start(port) .build()) .protocol("tcp") .build()) .source(Source.builder() .id(sourceApplicationId) .build()) .build()) .build()))) .then(requestListPolicies(this.networkingClient) .flatMapIterable(ListPoliciesResponse::getPolicies) .filter(policy -> port.equals(policy.getDestination().getPorts().getStart())) .singleOrEmpty()) .as(StepVerifier::create) .expectComplete() .verify(Duration.ofMinutes(5)); } @IfCloudFoundryVersion(greaterThanOrEqualTo = CloudFoundryVersion.PCF_1_12) @Test public void list() throws TimeoutException, InterruptedException { String destinationApplicationName = this.nameFactory.getApplicationName(); String sourceApplicationName = this.nameFactory.getApplicationName(); Integer port = this.nameFactory.getPort(); this.spaceId .flatMapMany(spaceId -> Mono.zip( createApplicationId(this.cloudFoundryClient, destinationApplicationName, spaceId), createApplicationId(this.cloudFoundryClient, sourceApplicationName, spaceId) )) .flatMap(function((destinationApplicationId, sourceApplicationId) -> requestCreatePolicy(this.networkingClient, destinationApplicationId, port, sourceApplicationId))) .then(this.networkingClient.policies() .list(ListPoliciesRequest.builder() .build()) .flatMapIterable(ListPoliciesResponse::getPolicies) .filter(policy -> port.equals(policy.getDestination().getPorts().getStart())) .single()) .map(policy -> policy.getDestination().getPorts().getStart()) .as(StepVerifier::create) .expectNext(port) .expectComplete() .verify(Duration.ofMinutes(5)); } @IfCloudFoundryVersion(greaterThanOrEqualTo = CloudFoundryVersion.PCF_1_12) @Test public void listFiltered() throws TimeoutException, InterruptedException { String destinationApplicationName = this.nameFactory.getApplicationName(); String sourceApplicationName = this.nameFactory.getApplicationName(); Integer port = this.nameFactory.getPort(); this.spaceId .flatMapMany(spaceId -> Mono.zip( createApplicationId(this.cloudFoundryClient, destinationApplicationName, spaceId), createApplicationId(this.cloudFoundryClient, sourceApplicationName, spaceId) )) .flatMap(function((destinationApplicationId, sourceApplicationId) -> requestCreatePolicy(this.networkingClient, destinationApplicationId, port, sourceApplicationId) .then(Mono.just(destinationApplicationId)))) .flatMap(destinationApplicationId -> this.networkingClient.policies() .list(ListPoliciesRequest.builder() .policyGroupId(destinationApplicationId) .build()) .flatMapIterable(ListPoliciesResponse::getPolicies) .map(policy -> policy.getDestination().getPorts().getStart())) .as(StepVerifier::create) .expectNext(port) .expectComplete() .verify(Duration.ofMinutes(5)); } private static Mono<String> createApplicationId(CloudFoundryClient cloudFoundryClient, String applicationName, String spaceId) { return requestCreateApplication(cloudFoundryClient, spaceId, applicationName) .map(ResourceUtils::getId); } private static Mono<CreateApplicationResponse> requestCreateApplication(CloudFoundryClient cloudFoundryClient, String spaceId, String applicationName) { return cloudFoundryClient.applicationsV2() .create(CreateApplicationRequest.builder() .buildpack("staticfile_buildpack") .diego(true) .diskQuota(512) .memory(64) .name(applicationName) .spaceId(spaceId) .build()); } private static Mono<Void> requestCreatePolicy(NetworkingClient networkingClient, String destinationApplicationId, Integer port, String sourceApplicationId) { return networkingClient.policies() .create(CreatePoliciesRequest.builder() .policy(Policy.builder() .destination(Destination.builder() .id(destinationApplicationId) .ports(Ports.builder() .end(port) .start(port) .build()) .protocol("tcp") .build()) .source(Source.builder() .id(sourceApplicationId) .build()) .build()) .build()); } private static Mono<ListPoliciesResponse> requestListPolicies(NetworkingClient networkingClient) { return networkingClient.policies() .list(ListPoliciesRequest.builder() .build()); } }
166e9815ef312ce469cc6b0254a238be8c86f974
936971f657ae995d927d9f4076e874f547fa4238
/AroundMe-AppEngine - Test/src/it/unisannio/server/test/UserQueryTest.java
b6ad939278bc82d280fc3c7ed8ab60acda4fae7b
[]
no_license
unisannio13/aroundme
bece6e0f31ed311fc5d889c950715522631eb7fc
6ac650b2d674b7250a4020684c856044b270f47d
refs/heads/master
2021-01-18T12:18:36.179375
2012-01-18T16:51:40
2012-01-18T16:51:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,699
java
/* AroundMe - Social Network mobile basato sulla geolocalizzazione * Copyright (C) 2012 AroundMe Working Group * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package it.unisannio.server.test; import it.unisannio.aroundme.model.ModelFactory; import it.unisannio.aroundme.model.test.helpers.UserQueryTestHelper; import it.unisannio.aroundme.server.ServerModelFactory; import junit.framework.TestCase; /** * @author Michele Piccirillo <[email protected]> */ public class UserQueryTest extends TestCase { private UserQueryTestHelper helper; @Override protected void setUp() throws Exception { super.setUp(); ModelFactory.setInstance(new ServerModelFactory()); helper = new UserQueryTestHelper(); } public void testById() { helper.testById(); } public void testCompatibility() { helper.testCompatibility(); } public void testEquals() { helper.testEquals(); } public void testIds() { helper.testIds(); } public void testInterestIds() { helper.testInterestIds(); } public void testNeighbourhood() { helper.testNeighbourhood(); } }
b7ed3b44d311cd521f541f081398012cd4d909b7
74823fd0dffa602718a2a093d164cc748e28ce22
/fenxiao/fenxiao-web/src/main/java/com/kedang/fenxiao/web/SysRoleController.java
fbe233b655ce3a7e09b388dd53328fd29650b03a
[]
no_license
marswon/fenxiao_2.1
ac65fee7b4d21a15fc1af0245cadf403ca48960f
51e8e7409733a14e143883d43e1f76e0ef6fa943
refs/heads/master
2021-06-16T09:12:05.763951
2017-06-05T06:08:58
2017-06-05T06:20:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,515
java
package com.kedang.fenxiao.web; import java.io.UnsupportedEncodingException; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springside.modules.web.Servlets; import com.kedang.fenxiao.entity.FXRole; import com.kedang.fenxiao.service.SysRoleService; import com.kedang.fenxiao.util.ResultFactory; import com.kedang.fenxiao.util.po.ResultDo; import com.kedang.fenxiao.util.util.PageUtils; import com.kedang.fenxiao.util.util.Query; import com.kedang.fenxiao.util.util.R; /** * * @author wangning * @email [email protected] * @date 2017年5月29日 上午10:11:19 */ @Controller @RequestMapping(value = "sys/role") public class SysRoleController { private static final Logger logger = LoggerFactory.getLogger(SysRoleController.class); @Autowired private SysRoleService sysRoleService; /** * 打开菜单视图 */ @RequestMapping(value = "") public String role() { return "role/role"; } /** * 查询所有菜单 */ @ResponseBody @RequestMapping(value = "getRole") public Page<FXRole> getRole( HttpServletRequest request, @RequestParam(value = "page", defaultValue = "1", required = false) int page, @RequestParam(value = "rows", defaultValue = "10", required = false) int rows) { Page<FXRole> pageList = null; try { logger.info("====== start SysRoleController.getRole ======"); Map<String, Object> searchParams = Servlets.getParametersStartingWith(request, "search_"); pageList = sysRoleService.findAllMenu(searchParams,new PageRequest(page - 1, rows, Sort.Direction.ASC, "id")); logger.info("====== end SysRoleController.getRole ,res[_listFxProductGroup=" + pageList + "] ======"); } catch (Exception e) { logger.error("SysRoleController.getRole error[" + e.getCause() + "]"); } return pageList; } @ResponseBody @RequestMapping("/list") public R list(@RequestParam Map<String, Object>params ){ //params = new String(params.getBytes("ISO8859-1"), "UTF-8"); //查询列表数据 Query query = new Query(params); if (params.get("roleName")!=null) { String pa = params.get("roleName").toString(); try { pa = new String(pa.getBytes("ISO8859-1"), "UTF-8"); List<FXRole> list = sysRoleService.queryListByRoleName(pa); int total = list.size(); PageUtils pageUtil = new PageUtils(list, total, query.getLimit(), query.getPage()); return R.ok().put("page", pageUtil); } catch (UnsupportedEncodingException e) { return R.error(); } } List<FXRole> list = sysRoleService.queryList(query); int total = list.size(); PageUtils pageUtil = new PageUtils(list, total, query.getLimit(), query.getPage()); return R.ok().put("page", pageUtil); } @RequestMapping(value = "getRoleList") @ResponseBody public ResultDo getRoleList() { try { logger.info("====== start SysRoleController.getRoleList ======"); List<FXRole> menus = sysRoleService.getRoleList(); logger.info("====== end SysRoleController.getRoleList ======"); return ResultFactory.getSuccessResult(menus); } catch (Exception e) { logger.error("SysMenuController.getMenuList error[" + e.getCause() + "]"); return ResultFactory.getFailedResult("获取角色列表异常"); } } /** * 删除角色 */ @RequestMapping(value = "delRole") @ResponseBody public ResultDo delRole(Long id) { try { logger.info("====== start SysRoleController.delRole ======"); sysRoleService.delRole(id); logger.info("====== end SysRoleController.delRole ======"); return ResultFactory.getSuccessResult(); } catch (Exception e) { logger.error("SysRoleController.delRole error[" + e.getCause() + "]"); return ResultFactory.getFailedResult("删除角色异常"); } } }
[ "Administrator@WBB2LF1CABYRBB9" ]
Administrator@WBB2LF1CABYRBB9
75a3703a244e05a0ee13f1448d86a6d6025d8769
2235648e794f55fa87816e7ca2d66a160d29086d
/backend/src/main/java/com/isdma/movieflixbds/components/JwtTokenEnhancer.java
836244f65bf0d130daea0ddcf266f33457e15d01
[]
no_license
isdma8/bds-movieflix
e8bb79ccda91c3a66b334472e74f9bbdbbdba74a
e22c4f4581ac0c753871d7bd64120d8db5aca15a
refs/heads/main
2023-03-22T11:03:02.572089
2021-03-18T17:27:15
2021-03-18T17:27:15
314,301,047
1
0
null
null
null
null
UTF-8
Java
false
false
1,181
java
package com.isdma.movieflixbds.components; import java.util.HashMap; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken; import org.springframework.security.oauth2.common.OAuth2AccessToken; import org.springframework.security.oauth2.provider.OAuth2Authentication; import org.springframework.security.oauth2.provider.token.TokenEnhancer; import org.springframework.stereotype.Component; import com.isdma.movieflixbds.entities.User; import com.isdma.movieflixbds.repositories.UserRepository; @Component public class JwtTokenEnhancer implements TokenEnhancer{ @Autowired private UserRepository userRepository; @Override public OAuth2AccessToken enhance(OAuth2AccessToken accessToken, OAuth2Authentication authentication) { User user = userRepository.findByEmail(authentication.getName()); Map<String, Object> map = new HashMap<>(); map.put("userName", user.getName()); map.put("userId", user.getId()); DefaultOAuth2AccessToken token = (DefaultOAuth2AccessToken)accessToken; token.setAdditionalInformation(map); return accessToken; } }
a49c18a809c8da0f257ff251db488f8def3743fb
8d3c894d0b0d94b2df521e663c19869bd50519d7
/MoroTestClient/src/main/java/cz/morosystems/morotestclient/model/MessageHistory.java
0cf31db258a3744bcc6e5adf1d68ede4ad5e2c85
[]
no_license
Avatarek78/PublicGit
b56ddcc87d3d5ebdf54c1945c53b42a44fe842be
30c41b46e8781a50eedb647992e64600c85dbdd9
refs/heads/master
2022-12-25T05:47:44.648341
2021-06-26T08:53:58
2021-06-26T08:53:58
57,158,949
1
0
null
2022-12-16T03:13:49
2016-04-26T20:14:56
HTML
UTF-8
Java
false
false
1,512
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 cz.morosystems.morotestclient.model; import java.util.LinkedList; /** * Message history class. * @author Tomas */ public class MessageHistory { /**List of history messages*/ private final LinkedList<MessageHistoryItem> history = new LinkedList<>(); /**Maximum size of history*/ private int historyMaxSize = 100; /** * * @param historySize Maximum size of history. */ public MessageHistory(int historySize) { this.historyMaxSize = historySize; } /** * Add message to the history. If history reached the maximum size oldest <BR> * message will be removed from history before adding new one. * @param histMessage */ public synchronized void addMessageToHistory(MessageHistoryItem histMessage) { if(history.size() == historyMaxSize) history.removeLast(); history.addFirst(histMessage); } public LinkedList<MessageHistoryItem> getHistory() { return history; } /** * Actual size of history. * @return */ public int getHistorySize() { return history.size(); } /** * Maximum size of history. * @return */ public int getHistoryMaxSize() { return historyMaxSize; } }
3fa8e50ffd562d23e0ecb180822eaa83aad1fbb4
8ef1a839827c0c64984d782a50d70d766fbcbeb1
/src/main/java/com/sdww8591/dao/VideoDao.java
7083bfcffb6825030cdb7601eee677f2f8bc0b54
[]
no_license
sdww2348115/sdww8591
fd212bb42db04210f08fd22fee0dc22a9415fc83
6c8896261d7e278ab4a349d03b9f776229d9833d
refs/heads/master
2021-01-10T04:08:09.179853
2016-02-26T07:07:07
2016-02-26T07:07:07
52,256,335
0
0
null
null
null
null
UTF-8
Java
false
false
170
java
package com.sdww8591.dao; import com.sdww8591.entity.Video; /** * Created by sdww on 16-2-24. */ public interface VideoDao { public Video getVideoById(int id); }
0152724d13f10c6e4ab2a1595affdb1bf61d26f2
a0efe604a62e7045242c18f00b9f6c2a115c08b3
/src-gen/org/eclipselabs/mlang/models/soy/impl/TemplateTagImpl.java
048a114d96b59b28eda96eaa38293e63b4e72527
[]
no_license
xibyte/anylang
24b45300c12664fc517b65a441945b7e1294e1bd
e05a35aa3dfe07c967756916b75936a21e5a17bd
refs/heads/master
2020-05-22T12:29:52.932697
2013-01-13T06:55:02
2013-01-13T06:55:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,796
java
/** * <copyright> * </copyright> * * $Id$ */ package org.eclipselabs.mlang.models.soy.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipselabs.mlang.models.soy.Doclet; import org.eclipselabs.mlang.models.soy.NamedTag; import org.eclipselabs.mlang.models.soy.SoyPackage; import org.eclipselabs.mlang.models.soy.TemplateTag; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Template Tag</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipselabs.mlang.models.soy.impl.TemplateTagImpl#getName <em>Name</em>}</li> * <li>{@link org.eclipselabs.mlang.models.soy.impl.TemplateTagImpl#getDoclet <em>Doclet</em>}</li> * </ul> * </p> * * @generated */ public class TemplateTagImpl extends TagImpl implements TemplateTag { /** * The default value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The cached value of the '{@link #getDoclet() <em>Doclet</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getDoclet() * @generated * @ordered */ protected Doclet doclet; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected TemplateTagImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return SoyPackage.Literals.TEMPLATE_TAG; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SoyPackage.TEMPLATE_TAG__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Doclet getDoclet() { if (doclet != null && doclet.eIsProxy()) { InternalEObject oldDoclet = (InternalEObject)doclet; doclet = (Doclet)eResolveProxy(oldDoclet); if (doclet != oldDoclet) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, SoyPackage.TEMPLATE_TAG__DOCLET, oldDoclet, doclet)); } } return doclet; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Doclet basicGetDoclet() { return doclet; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetDoclet(Doclet newDoclet, NotificationChain msgs) { Doclet oldDoclet = doclet; doclet = newDoclet; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SoyPackage.TEMPLATE_TAG__DOCLET, oldDoclet, newDoclet); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setDoclet(Doclet newDoclet) { if (newDoclet != doclet) { NotificationChain msgs = null; if (doclet != null) msgs = ((InternalEObject)doclet).eInverseRemove(this, SoyPackage.DOCLET__TEMPLATE, Doclet.class, msgs); if (newDoclet != null) msgs = ((InternalEObject)newDoclet).eInverseAdd(this, SoyPackage.DOCLET__TEMPLATE, Doclet.class, msgs); msgs = basicSetDoclet(newDoclet, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SoyPackage.TEMPLATE_TAG__DOCLET, newDoclet, newDoclet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SoyPackage.TEMPLATE_TAG__DOCLET: if (doclet != null) msgs = ((InternalEObject)doclet).eInverseRemove(this, SoyPackage.DOCLET__TEMPLATE, Doclet.class, msgs); return basicSetDoclet((Doclet)otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SoyPackage.TEMPLATE_TAG__DOCLET: return basicSetDoclet(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case SoyPackage.TEMPLATE_TAG__NAME: return getName(); case SoyPackage.TEMPLATE_TAG__DOCLET: if (resolve) return getDoclet(); return basicGetDoclet(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case SoyPackage.TEMPLATE_TAG__NAME: setName((String)newValue); return; case SoyPackage.TEMPLATE_TAG__DOCLET: setDoclet((Doclet)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SoyPackage.TEMPLATE_TAG__NAME: setName(NAME_EDEFAULT); return; case SoyPackage.TEMPLATE_TAG__DOCLET: setDoclet((Doclet)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SoyPackage.TEMPLATE_TAG__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case SoyPackage.TEMPLATE_TAG__DOCLET: return doclet != null; } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { if (baseClass == NamedTag.class) { switch (derivedFeatureID) { case SoyPackage.TEMPLATE_TAG__NAME: return SoyPackage.NAMED_TAG__NAME; default: return -1; } } return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { if (baseClass == NamedTag.class) { switch (baseFeatureID) { case SoyPackage.NAMED_TAG__NAME: return SoyPackage.TEMPLATE_TAG__NAME; default: return -1; } } return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (name: "); result.append(name); result.append(')'); return result.toString(); } } //TemplateTagImpl
fa298643a9ac4eaab355f4b66278888adf9a0daa
52c44155e5af808d38ece5b7fcc53a419fe7f756
/app/src/test/java/com/example/earthdefensesystem/android_notifications/ExampleUnitTest.java
b70054a33f20934d15ff9c3f067b85fb8d955ff6
[]
no_license
JTyzz/Android_Notifications
9eea1ca895ecc61841225bd0b6e32b04454161a8
c4663320303e460a213d6b051eeee26460ca7d58
refs/heads/master
2020-04-06T20:20:11.064718
2018-11-15T21:16:36
2018-11-15T21:16:36
157,769,422
0
0
null
2018-11-15T20:35:45
2018-11-15T20:35:45
null
UTF-8
Java
false
false
413
java
package com.example.earthdefensesystem.android_notifications; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
e6195ccdab3bc59da7ef371f1ffb8f152524924c
3c60a9ad3fbb690d18449ac3be7be2e35183a4d7
/ShopForKidsEJB/ejbModule/com/oracle/shopforkids/entities/ShRegion.java
2f16edb4641a30f1dd6acb4d733723aa187be782
[]
no_license
stephan1/SHOPFKIDS
66669f9c5903910e6361e43576d6c806fe716ebc
4cc110c3022d94c26af9096eccadac3d089fef89
refs/heads/master
2021-01-16T19:14:11.644634
2013-03-17T09:07:24
2013-03-17T09:07:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,084
java
package com.oracle.shopforkids.entities; import java.io.Serializable; import javax.persistence.*; import java.util.List; /** * The persistent class for the SH_REGION database table. * */ @Entity @Table(name="SH_REGION") public class ShRegion implements Serializable { private static final long serialVersionUID = 1L; @Id @SequenceGenerator(name="SH_REGION_REGIONID_GENERATOR" ) @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SH_REGION_REGIONID_GENERATOR") @Column(name="REGION_ID", unique=true, nullable=false, precision=22) private long regionId; @Column(name="REGION_NAME", nullable=false, length=20) private String regionName; //bi-directional many-to-one association to Fournisseur @OneToMany(mappedBy="shRegion") private List<Fournisseur> fournisseurs; //bi-directional many-to-one association to ShAddress @OneToMany(mappedBy="shRegion") private List<ShAddress> shAddresses; //bi-directional many-to-one association to Country @ManyToOne @JoinColumn(name="COUNTRY_ID") private Country country; //bi-directional many-to-one association to Warehouse @OneToMany(mappedBy="shRegion") private List<Warehouse> warehouses; public ShRegion() { } public long getRegionId() { return this.regionId; } public void setRegionId(long regionId) { this.regionId = regionId; } public String getRegionName() { return this.regionName; } public void setRegionName(String regionName) { this.regionName = regionName; } public List<Fournisseur> getFournisseurs() { return this.fournisseurs; } public void setFournisseurs(List<Fournisseur> fournisseurs) { this.fournisseurs = fournisseurs; } public Fournisseur addFournisseurs(Fournisseur fournisseurs) { getFournisseurs().add(fournisseurs); fournisseurs.setShRegion(this); return fournisseurs; } public Fournisseur removeFournisseurs(Fournisseur fournisseurs) { getFournisseurs().remove(fournisseurs); fournisseurs.setShRegion(null); return fournisseurs; } public List<ShAddress> getShAddresses() { return this.shAddresses; } public void setShAddresses(List<ShAddress> shAddresses) { this.shAddresses = shAddresses; } public ShAddress addShAddresses(ShAddress shAddresses) { getShAddresses().add(shAddresses); shAddresses.setShRegion(this); return shAddresses; } public ShAddress removeShAddresses(ShAddress shAddresses) { getShAddresses().remove(shAddresses); shAddresses.setShRegion(null); return shAddresses; } public Country getCountry() { return this.country; } public void setCountry(Country country) { this.country = country; } public List<Warehouse> getWarehouses() { return this.warehouses; } public void setWarehouses(List<Warehouse> warehouses) { this.warehouses = warehouses; } public Warehouse addWarehouses(Warehouse warehouses) { getWarehouses().add(warehouses); warehouses.setShRegion(this); return warehouses; } public Warehouse removeWarehouses(Warehouse warehouses) { getWarehouses().remove(warehouses); warehouses.setShRegion(null); return warehouses; } }
93c760d994931c6a5d056c28af20c9490905f1a6
fc5e9f9ee60db838aae35460c449b255fed08081
/accountcommon/src/main/java/com/instanect/accountcommon/account/AccountDetailsDeclarationInterface.java
3c5d2c0af7ef0b9983848c12d1d34769a7c1ab33
[]
no_license
cooldude77/AccountCommon
6ce1a5d10dc7f3d469a54057487ba49f5c9b2b3b
1d69d3ce27c17fb2e69fcf3aa18ca859535375d6
refs/heads/master
2021-04-12T08:31:35.645432
2019-12-06T05:01:51
2019-12-06T05:01:51
126,131,774
0
0
null
null
null
null
UTF-8
Java
false
false
268
java
package com.instanect.accountcommon.account; /** * Created by AKS on 3/23/2018. */ public interface AccountDetailsDeclarationInterface { String getAccountType(); String getAuthTokenType(); String getUsernameString(); String getAppAuthority(); }
1a3773bc17fb7343d9aaec987eeddc3a344c252d
6105ccea98a846cad26b34193c4bfd27a739a8b6
/Stormy/app/src/main/java/com/test/nelson/stormy/ui/MainActivity.java
21eb91cc6d1eb5dbe29e3537d7a38bbf3a3a37ff
[]
no_license
BurlApps/android-learning
6cfc27860811005cb44901ed766c8307f2decbb0
c9e5d328eab05a5cd7deb2758c44e564f3f5ab44
refs/heads/master
2021-01-24T22:21:01.117945
2015-09-16T04:24:44
2015-09-16T04:24:44
39,046,487
0
0
null
null
null
null
UTF-8
Java
false
false
9,681
java
package com.test.nelson.stormy.ui; import android.content.Context; import android.content.Intent; import android.graphics.drawable.Drawable; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.squareup.okhttp.Call; import com.squareup.okhttp.Callback; import com.squareup.okhttp.OkHttpClient; import com.squareup.okhttp.Request; import com.squareup.okhttp.Response; import com.test.nelson.stormy.R; import com.test.nelson.stormy.weather.Current; import com.test.nelson.stormy.weather.Day; import com.test.nelson.stormy.weather.Forecast; import com.test.nelson.stormy.weather.Hour; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.IOException; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; public class MainActivity extends AppCompatActivity { public static final String TAG = MainActivity.class.getSimpleName(); public static final String DAILY_FORECAST = "DAILY_FORECAST"; public static final String HOURLY_FORECAST = "HOURLY_FORECAST"; private Forecast mForecast; @Bind(R.id.temperatureLabel) TextView mTemperatureLabel; @Bind(R.id.timeLabel) TextView mTimeLabel; @Bind(R.id.humidityValue) TextView mHumidityValue; @Bind(R.id.precipValue) TextView mPrecipValue; @Bind(R.id.iconImageView) ImageView mIconImageView; @Bind(R.id.summaryLabel) TextView mSummaryLabel; @Bind(R.id.refreshImageView) ImageView mRefreshImageView; @Bind(R.id.progressBar) ProgressBar mProgressBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); mProgressBar.setVisibility(View.INVISIBLE); final double latitude = 37.8267; final double longitude = -122.423; mRefreshImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getForecast(latitude, longitude); } }); getForecast(latitude, longitude); } private void getForecast( double latitude, double longitude) { String apiKey = "ef0fe1d37b5300485589c845c96c18ae"; String forecastURL = "https://api.forecast.io/forecast/" + apiKey + "/" + latitude + "," + longitude; if(isNetworkAvailable()) { toggleRefresh(); OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url(forecastURL) .build(); Call call = client.newCall(request); call.enqueue(new Callback() { @Override public void onFailure(Request request, IOException e) { runOnUiThread(new Runnable() { @Override public void run() { toggleRefresh(); } }); alertUserAboutError(); } @Override public void onResponse(Response response) throws IOException { runOnUiThread(new Runnable() { @Override public void run() { toggleRefresh(); } }); try { String jsonData = response.body().string(); Log.v(TAG, response.body().string()); if (response.isSuccessful()) { mForecast = parseForecastDetails(jsonData); runOnUiThread(new Runnable() { @Override public void run() { updateDisplay(); } }); } else { alertUserAboutError(); } } catch (IOException e) { Log.e(TAG, "Exception caught: ", e); } catch (JSONException e) { Log.e(TAG, "Exception caught: ", e); } } }); } else { Toast.makeText(this, R.string.network_unavailable, Toast.LENGTH_LONG).show(); } } private void toggleRefresh() { if(mProgressBar.getVisibility() == View.INVISIBLE) { mProgressBar.setVisibility(View.VISIBLE); mRefreshImageView.setVisibility(View.INVISIBLE); } else { mProgressBar.setVisibility(View.INVISIBLE); mRefreshImageView.setVisibility(View.VISIBLE); } } private void updateDisplay() { Current current = mForecast.getCurrent(); Drawable drawable = getResources().getDrawable(current.getIconId()); mTemperatureLabel.setText(current.getTemperature() + ""); mTimeLabel.setText("At "+ current.getFormattedTime()+" it will be"); mHumidityValue.setText(current.getHumidity() + ""); mPrecipValue.setText(current.getPrecipChance() + "%"); mIconImageView.setImageDrawable(drawable); mSummaryLabel.setText(current.getSummary()); } private Forecast parseForecastDetails(String jsonData) throws JSONException{ Forecast forecast = new Forecast(); forecast.setCurrent(getCurrentDetails(jsonData)); forecast.setDailyForecast(getDailyForecast(jsonData)); forecast.setHourlyForecast(getHourlyForecast(jsonData)); return forecast; } private Day[] getDailyForecast(String jsonData) throws JSONException{ JSONObject forecast = new JSONObject(jsonData); String timezone = forecast.getString("timezone"); JSONObject daily = forecast.getJSONObject("daily"); JSONArray data = daily.getJSONArray("data"); Day[] dailyForecast = new Day[data.length()]; for(int i = 0; i < data.length(); i++) { JSONObject hourData = data.getJSONObject(i); Day day = new Day(); day.setTime(hourData.getLong("time")); day.setIcon(hourData.getString("icon")); day.setTemperatureMax(hourData.getDouble("temperatureMax")); day.setSummary(hourData.getString("summary")); day.setTimeZone(timezone); dailyForecast[i] = day; } return dailyForecast; } private Hour[] getHourlyForecast(String jsonData) throws JSONException{ JSONObject forecast = new JSONObject(jsonData); String timezone = forecast.getString("timezone"); JSONObject hourly = forecast.getJSONObject("hourly"); JSONArray data = hourly.getJSONArray("data"); Hour[] hourlyForecast = new Hour[data.length()]; for(int i = 0; i < data.length(); i++) { JSONObject hourData = data.getJSONObject(i); Hour hour = new Hour(); hour.setTime(hourData.getLong("time")); hour.setIcon(hourData.getString("icon")); hour.setTemperature(hourData.getDouble("temperature")); hour.setSummary(hourData.getString("summary")); hour.setTimeZone(timezone); hourlyForecast[i] = hour; } return hourlyForecast; } private Current getCurrentDetails(String jsonData) throws JSONException{ JSONObject forecast = new JSONObject(jsonData); String timezone = forecast.getString("timezone"); JSONObject currently = forecast.getJSONObject("currently"); Current current = new Current(); current.setHumidity(currently.getDouble("humidity")); current.setPrecipChance(currently.getDouble("precipProbability")); current.setSummary(currently.getString("summary")); current.setTemperature(currently.getDouble("temperature")); current.setTime(currently.getLong("time")); current.setIcon(currently.getString("icon")); current.setTimeZone(timezone); Log.d(TAG, current.getFormattedTime()); Log.i(TAG, "From JSON: "+timezone); return current; } private boolean isNetworkAvailable() { ConnectivityManager manager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = manager.getActiveNetworkInfo(); boolean isAvailable = false; if(networkInfo != null && networkInfo.isConnected()) { isAvailable = true; } return isAvailable; } private void alertUserAboutError() { AlertDialogFragment dialog = new AlertDialogFragment(); dialog.show(getFragmentManager(), "error_dialog"); } @OnClick (R.id.dailyButton) public void startDailyActivity(View view) { Intent intent = new Intent(this, DailyForecastActivity.class); intent.putExtra(DAILY_FORECAST, mForecast.getDailyForecast()); startActivity(intent); } @OnClick (R.id.hourlyButton) public void startHourlyActivity(View view) { Intent intent = new Intent(this, HourlyForecastActivity.class); intent.putExtra(HOURLY_FORECAST, mForecast.getHourlyForecast()); startActivity(intent); } }
7fe204d114d96e91c1d171b2697817a17dd5f07e
ff4d920efe1fa9bddde9be9d6585f3372a44aae3
/src/main/java/com/tonggu/ZxsApplication.java
5a92fadbcd1e46b92cf06174c457d23dec43cfa5
[]
no_license
wjf8882300/ck
5d7176b6e38f414e67063aa283a97a3452bf8358
3187d459cefe1cf8ac113af1457e3491eb55a0a5
refs/heads/master
2021-12-27T20:12:53.590804
2018-05-27T03:09:52
2018-05-27T03:09:52
135,010,951
2
0
null
null
null
null
UTF-8
Java
false
false
1,162
java
package com.tonggu; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.web.SpringBootServletInitializer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ImportResource; import com.tonggu.component.MetaDataManager; @SpringBootApplication @EnableAutoConfiguration @ImportResource({"classpath:/applicationContext-task.xml", "classpath:/spring/application-security.xml"}) // public class ZxsApplication extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(ZxsApplication.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { // TODO Auto-generated method stub return application.sources(ZxsApplication.class); } @Bean MetaDataManager metaDataManager() { return new MetaDataManager(new String[] {"com.tonggu.controller"}); } }
013d13e9cb8e6ff111283a605f309f1d061caaff
3e263b52d2a223b67f1ec355f7082c98a16eb107
/app/src/main/java/com/example/aabdelnazeer/foodrecipeproject/ui/recipeDetails/RecipeDetailScreen.java
99fd09f8c6769b37a739ac254de7fcf8e325520f
[]
no_license
abodeltae/FoodRecipeProject
916b15b94237dc508523d264ab8d3a8994c75fc0
748a61aa7b08b74d0e60acbb46548d8e3389a750
refs/heads/master
2021-04-28T19:06:50.638255
2017-08-10T18:14:35
2017-08-10T18:14:35
121,887,610
0
0
null
null
null
null
UTF-8
Java
false
false
449
java
package com.example.aabdelnazeer.foodrecipeproject.ui.recipeDetails; import android.graphics.Bitmap; import android.view.View; import com.example.aabdelnazeer.foodrecipeproject.DataLayer.models.Recipe; public interface RecipeDetailScreen { void showIngredientsLoading(boolean showLoading); void setRecipe(Recipe recipe); void setRecipeBitmap(Bitmap bitmap); void setRecipeDetailScreenListner(RecipeDetailListner listner); View getView(); }
ee5ffe7a693f1267e374fc74284e11af41dcc587
63fc5d6ebe2b844c19da767e1e0329c53e4ac381
/src/ch/nexpose/deepspace/objects/Bullet.java
46cd5d45469f915512846a9b77a490483d32bb4c
[]
no_license
cansik/SimpleGameEngine2D
7b415e900fae37cee9393e6dfc39901074b6d32a
23569c756df6001054a9656b4f9ab7561fecd11b
refs/heads/master
2021-01-18T20:11:57.205488
2015-09-16T11:09:40
2015-09-16T11:09:40
18,556,844
1
0
null
null
null
null
UTF-8
Java
false
false
1,994
java
package ch.nexpose.deepspace.objects; import ch.nexpose.deepspace.stories.LevelGameStory; import ch.nexpose.deepspace.gui.ScoreType; import ch.nexpose.sge.SimpleGameEngine2D; import ch.nexpose.sge.collisions.Collision; import ch.nexpose.sge.objects.BaseObject2D; import ch.nexpose.sge.objects.GravityObject2D; import java.awt.*; /** * Created by cansik on 06/05/14. */ public class Bullet extends GravityObject2D { BaseObject2D parent; public BaseObject2D getParent() { return parent; } public void setParent(BaseObject2D parent) { this.parent = parent; } public Bullet(SimpleGameEngine2D engine, BaseObject2D parent) { super(engine, null); this.parent = parent; setTexture(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/resources/bullet.png"))); setCounterforce(1); setLocation(new Point(parent.getLocation().x + parent.getSize().width, parent.getLocation().y + (int) (parent.getSize().height / 2) - (int) (getSize().height / 2))); } @Override public void action() { super.action(); if(!isOnScene()) setAlive(false); } @Override public void collisionDetected(Collision c) { BaseObject2D crashedObject = c.getEnemyObject(this); if(parent != crashedObject) { setAlive(false); if (crashedObject instanceof EnemySpaceShip) { EnemySpaceShip enemy = (EnemySpaceShip) crashedObject; enemy.hit(); } if(crashedObject instanceof SpaceShip) { SpaceShip space = (SpaceShip)crashedObject; getGameStory().scorePoint(ScoreType.Life); } } } /** * Returns the current game story. * @return */ private LevelGameStory getGameStory() { return (LevelGameStory)getEngine().getNextFrameListener().get(0); } }
41a9e23381df51c02066bf3673eadd81a7476e99
f626484431bf0e8dd2e49cd0c9021f95c7e90638
/demos/gradle-build-tool-fundamentals-m2/Ant/HttpProxy/src/main/java/com/mantiso/kevinj/http/ui/InitDialog.java
797e64f562de20060a13e83365965e5398704517
[]
no_license
claudemirton/gradle-fundamentals
f799f3f841fdc2e0498fad96dca8ad163a94e0c0
ac52bc34cebc99c365518745577982e67d3bf67f
refs/heads/master
2023-04-04T01:32:18.427988
2021-04-03T11:18:07
2021-04-03T11:18:07
354,271,359
0
0
null
null
null
null
UTF-8
Java
false
false
7,299
java
/* * Created by IntelliJ IDEA. * User: Kevin Jones * Date: 17-Jun-02 * Time: 17:18:04 * To change template for new class use * Code Style | Class Templates options (Tools | IDE Options). */ package com.mantiso.kevinj.http.ui; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; public class InitDialog extends JDialog { public InitDialog() throws HeadlessException { this(null, "Set Initialization Properties", false); } public InitDialog(Frame owner, String title, boolean modal) throws HeadlessException { super(owner, title, modal); initComponents(); } protected JRootPane createRootPane() { JRootPane pane = new JRootPane(); KeyStroke keyStroke = KeyStroke.getKeyStroke("ESCAPE"); Action actionListener = new AbstractAction() { public void actionPerformed(ActionEvent e) { setVisible(false); } }; InputMap inputMap = pane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); inputMap.put(keyStroke, "ESCAPE"); pane.getActionMap().put("ESCAPE", actionListener); return pane; } /** 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. */ private void initComponents() {//GEN-BEGIN:initComponents mainPanel = new javax.swing.JPanel(); textPanel = new javax.swing.JPanel(); listenLabel = new javax.swing.JLabel(); serverLabel = new javax.swing.JLabel(); sendLabel = new javax.swing.JLabel(); editPanel = new javax.swing.JPanel(); server = new javax.swing.JTextField(); listenPort = new javax.swing.JTextField(); sendPort = new javax.swing.JTextField(); buttonPanel = new javax.swing.JPanel(); okButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton(); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); mainPanel.setLayout(new java.awt.BorderLayout()); mainPanel.setMinimumSize(new java.awt.Dimension(300, 132)); mainPanel.setPreferredSize(new java.awt.Dimension(300, 132)); textPanel.setLayout(new java.awt.BorderLayout()); listenLabel.setText("Listen Port"); listenLabel.setToolTipText("Add Listen Port"); listenLabel.setMaximumSize(new java.awt.Dimension(70, 32)); listenLabel.setMinimumSize(new java.awt.Dimension(70, 32)); listenLabel.setPreferredSize(new java.awt.Dimension(70, 32)); listenLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); textPanel.add(listenLabel, java.awt.BorderLayout.NORTH); serverLabel.setText("Server "); serverLabel.setToolTipText("Remote Computer to Connect To"); serverLabel.setMaximumSize(new java.awt.Dimension(70, 32)); serverLabel.setMinimumSize(new java.awt.Dimension(70, 32)); serverLabel.setPreferredSize(new java.awt.Dimension(70, 32)); textPanel.add(serverLabel, java.awt.BorderLayout.CENTER); sendLabel.setText("Send Port"); sendLabel.setToolTipText("Port on Remote Computer to Connect to"); sendLabel.setMaximumSize(new java.awt.Dimension(70, 32)); sendLabel.setMinimumSize(new java.awt.Dimension(70, 32)); sendLabel.setPreferredSize(new java.awt.Dimension(70, 32)); textPanel.add(sendLabel, java.awt.BorderLayout.SOUTH); // getContentPane().add(textPanel, java.awt.BorderLayout.WEST); mainPanel.add(textPanel, java.awt.BorderLayout.WEST); editPanel.setLayout(new java.awt.BorderLayout()); server.setText("localhost"); editPanel.add(server, java.awt.BorderLayout.CENTER); listenPort.setText("8080"); listenPort.setMaximumSize(new java.awt.Dimension(2147483647, 32)); listenPort.setMinimumSize(new java.awt.Dimension(4, 32)); listenPort.setPreferredSize(new java.awt.Dimension(63, 32)); editPanel.add(listenPort, java.awt.BorderLayout.NORTH); sendPort.setText("80"); sendPort.setMaximumSize(new java.awt.Dimension(2147483647, 32)); sendPort.setMinimumSize(new java.awt.Dimension(4, 32)); sendPort.setPreferredSize(new java.awt.Dimension(63, 32)); editPanel.add(sendPort, java.awt.BorderLayout.SOUTH); mainPanel.add(editPanel, java.awt.BorderLayout.CENTER); // getContentPane().add(editPanel, java.awt.BorderLayout.CENTER); okButton.setText("OK"); okButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { okButtonActionPerformed(evt); } }); buttonPanel.add(okButton); cancelButton.setText("Cancel"); cancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelButtonActionPerformed(evt); } }); buttonPanel.add(cancelButton); mainPanel.add(buttonPanel, java.awt.BorderLayout.SOUTH); getContentPane().add(mainPanel, java.awt.BorderLayout.CENTER); setResizable(false); pack(); }//GEN-END:initComponents public void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed // Add your handling code here: close(); }//GEN-LAST:event_cancelButtonActionPerformed private void close() { setVisible(false); ok = false; dispose(); } public void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed // Add your handling code here: this.setVisible(false); ok = true; }//GEN-LAST:event_okButtonActionPerformed /** Closes the dialog */ private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog close(); }//GEN-LAST:event_closeDialog // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel buttonPanel; private javax.swing.JLabel serverLabel; private javax.swing.JButton okButton; private javax.swing.JLabel listenLabel; private javax.swing.JTextField sendPort; private javax.swing.JTextField listenPort; private javax.swing.JPanel editPanel; private javax.swing.JPanel textPanel; private javax.swing.JButton cancelButton; private javax.swing.JLabel sendLabel; private javax.swing.JPanel mainPanel; private javax.swing.JTextField server; // End of variables declaration//GEN-END:variables private boolean ok = false; public String getSendPort() { return sendPort.getText(); } public String getListenPort() { return listenPort.getText(); } public String getServer() { return server.getText(); } public boolean isOk() { return ok; } }
dc197ae7d8c10b8ff098a22c94acd41a13041a2a
df3937c9a8b65333d9289c2c3042a2afa298c246
/ResourceCatalogClient/src/main/java/eu/linksmart/local/sdk/LSLCResource.java
045c789546c74a3341131ec7d42a243b87c30acf
[]
no_license
linksmart/lslc-sdk
03443604c27e1b2857d34bb7efdfa8b46371443d
cd3a193dc0ebf0b7064cf30180c37e8336e880f9
refs/heads/master
2020-07-20T04:50:49.346796
2016-12-09T14:49:17
2016-12-09T14:49:17
206,575,893
0
0
null
null
null
null
UTF-8
Java
false
false
444
java
package eu.linksmart.local.sdk; import java.util.ArrayList; import java.util.List; /** * Created by carlos on 24.10.14. */ public class LSLCResource { public String id; public final String type = "Resource"; public String name; public String device; public LSLCRepresentation representation; public List<LSLCProtocol> protocols; public LSLCResource(){ protocols = new ArrayList<LSLCProtocol>(); } }
ff02fbc2e88731a52b52882319a547b7382dd3fc
29763eeec1d7eeed0512b7594d3684e755899870
/supply-chain/scenario/src/supply/ontology/IMD_Motherboard.java
6b8baae663d429115463964b017a0fe589c26a77
[]
no_license
juliomorales98/JADE-CID
da5ccd2ebfa975eb9b3f46379830688d874f7b89
9ebd1302d989269aee5a220ad6efb59a53146dc7
refs/heads/master
2022-11-27T18:25:10.751145
2020-05-21T19:47:18
2020-05-21T19:47:18
285,053,936
0
0
null
null
null
null
UTF-8
Java
false
false
266
java
package supply.ontology; import jade.content.*; import jade.util.leap.*; import jade.core.*; /** * Protege name: IMD Motherboard * @author ontology bean generator * @version 2017/11/28, 20:55:56 */ public class IMD_Motherboard extends Component{ }
90ed72d05b1ae08db54a77a2ec88939efc1bf779
af66be4a8fcfc501f8825b6685b7247b1a6976ac
/src/main/java/com/mikelzuzu/services/GreetingRepository.java
a222c2dfa6c9b32b4bc74c13b0cb28371f27f5ac
[]
no_license
mikelzuzu/spring5-di-demo
2b6ed2b7c30652468779a0f6fcfed1fc52c224d5
d5b14e2b41c17510eab8e461121ffcfb4bfdb5a6
refs/heads/master
2020-03-23T11:01:11.152032
2018-09-22T11:35:03
2018-09-22T11:35:03
141,477,483
0
0
null
2018-09-22T11:35:04
2018-07-18T18:56:47
Java
UTF-8
Java
false
false
173
java
package com.mikelzuzu.services; public interface GreetingRepository { String getEnglishGreeting(); String getSpanishGreeting(); String getGermanGreeting(); }
8b7c976ed9258203cff61c1cf00e77d211fea693
5c16b2005fccfbac2477df66fe2320b4c6be54c0
/app/src/main/java/com/example/aswathy/newapplication/RegisterActivity.java
1cbafb7934e6b5a13db2b0b535eda6bdf79f1e27
[]
no_license
aswathy1998/studentregistrationnew
69ed4ee54c3f15bb2799a7270abc76caf127de39
2c243cee199714d3ee5274185b493fa32770c823
refs/heads/master
2020-04-22T14:52:48.807025
2019-02-13T07:15:28
2019-02-13T07:15:28
170,459,537
0
0
null
null
null
null
UTF-8
Java
false
false
2,267
java
package com.example.aswathy.newapplication; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class RegisterActivity extends AppCompatActivity { TextView ed1,ed2,ed3,ed4,ed5; Button b1,b2; Dbhelper dbhelper; String s1,s2,s3,s4,s5; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); ed1=(TextView) findViewById(R.id.name); ed2=(TextView) findViewById(R.id.email); ed3=(TextView) findViewById(R.id.mob); ed4=(TextView) findViewById(R.id.uname); ed5=(TextView) findViewById(R.id.pass); b1=(Button)findViewById(R.id.reg); b2=(Button)findViewById(R.id.bklg); dbhelper=new Dbhelper(this); dbhelper.getWritableDatabase(); b1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { s1=ed1.getText().toString(); s2=ed2.getText().toString(); s3=ed3.getText().toString(); s4=ed4.getText().toString(); s5=ed5.getText().toString(); Log.d("name",s1); Log.d("Email id",s2); Log.d("mobileno",s3); Log.d("username",s4); Log.d("password",s5); boolean status=dbhelper.insertData(s1,s2,s3,s4,s5); if(status==true){ Toast.makeText(getApplicationContext(),"succcessfully inserted",Toast.LENGTH_LONG).show(); } else{ Toast.makeText(getApplicationContext(),"Error",Toast.LENGTH_LONG).show(); } } }); b2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent i=new Intent(getApplicationContext(),MainActivity.class); startActivity(i); } }); } }
786d386a920cf7620254d09c107dc46c926c379a
2c470020dd7c18210c2281b425381dbec44e538f
/nicecore/src/com/nice/core/setup/CoreSystemSetup.java
a3854a4a48c739df7b5dbc1be36c7576dfb6ea28
[]
no_license
fajruddinsk/nice
84397518b8ad6a4b64b5dcf16fb6896532ed9441
69cd96d9382d8e84184f9ac2a8c4428fc3bd5d00
refs/heads/master
2021-01-11T09:18:48.513403
2016-12-27T03:15:08
2016-12-27T03:15:08
77,399,415
0
1
null
null
null
null
UTF-8
Java
false
false
4,848
java
/* * [y] hybris Platform * * Copyright (c) 2000-2015 hybris AG * All rights reserved. * * This software is the confidential and proprietary information of hybris * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with hybris. * * */ package com.nice.core.setup; import de.hybris.platform.commerceservices.setup.AbstractSystemSetup; import de.hybris.platform.core.Registry; import de.hybris.platform.core.initialization.SystemSetup; import de.hybris.platform.core.initialization.SystemSetup.Process; import de.hybris.platform.core.initialization.SystemSetup.Type; import de.hybris.platform.core.initialization.SystemSetupContext; import de.hybris.platform.core.initialization.SystemSetupParameter; import de.hybris.platform.core.initialization.SystemSetupParameterMethod; import com.nice.core.constants.NiceCoreConstants; import java.util.ArrayList; import java.util.List; /** * This class provides hooks into the system's initialization and update processes. * * @see "https://wiki.hybris.com/display/release4/Hooks+for+Initialization+and+Update+Process" */ @SystemSetup(extension = NiceCoreConstants.EXTENSIONNAME) public class CoreSystemSetup extends AbstractSystemSetup { public static final String IMPORT_ACCESS_RIGHTS = "accessRights"; /** * This method will be called by system creator during initialization and system update. Be sure that this method can * be called repeatedly. * * @param context * the context provides the selected parameters and values */ @SystemSetup(type = Type.ESSENTIAL, process = Process.ALL) public void createEssentialData(final SystemSetupContext context) { importImpexFile(context, "/nicecore/import/common/essential-data.impex"); importImpexFile(context, "/nicecore/import/common/countries.impex"); importImpexFile(context, "/nicecore/import/common/delivery-modes.impex"); importImpexFile(context, "/nicecore/import/common/themes.impex"); importImpexFile(context, "/nicecore/import/common/user-groups.impex"); } /** * Generates the Dropdown and Multi-select boxes for the project data import */ @Override @SystemSetupParameterMethod public List<SystemSetupParameter> getInitializationOptions() { final List<SystemSetupParameter> params = new ArrayList<SystemSetupParameter>(); params.add(createBooleanSystemSetupParameter(IMPORT_ACCESS_RIGHTS, "Import Users & Groups", true)); return params; } /** * This method will be called during the system initialization. * * @param context * the context provides the selected parameters and values */ @SystemSetup(type = Type.PROJECT, process = Process.ALL) public void createProjectData(final SystemSetupContext context) { final boolean importAccessRights = getBooleanSystemSetupParameter(context, IMPORT_ACCESS_RIGHTS); final List<String> extensionNames = getExtensionNames(); if (importAccessRights && extensionNames.contains("cmscockpit")) { importImpexFile(context, "/nicecore/import/cockpits/cmscockpit/cmscockpit-users.impex"); importImpexFile(context, "/nicecore/import/cockpits/cmscockpit/cmscockpit-access-rights.impex"); } if (importAccessRights && extensionNames.contains("btgcockpit")) { importImpexFile(context, "/nicecore/import/cockpits/cmscockpit/btgcockpit-users.impex"); importImpexFile(context, "/nicecore/import/cockpits/cmscockpit/btgcockpit-access-rights.impex"); } if (importAccessRights && extensionNames.contains("productcockpit")) { importImpexFile(context, "/nicecore/import/cockpits/productcockpit/productcockpit-users.impex"); importImpexFile(context, "/nicecore/import/cockpits/productcockpit/productcockpit-access-rights.impex"); importImpexFile(context, "/nicecore/import/cockpits/productcockpit/productcockpit-constraints.impex"); } if (importAccessRights && extensionNames.contains("cscockpit")) { importImpexFile(context, "/nicecore/import/cockpits/cscockpit/cscockpit-users.impex"); importImpexFile(context, "/nicecore/import/cockpits/cscockpit/cscockpit-access-rights.impex"); } if (importAccessRights && extensionNames.contains("reportcockpit")) { importImpexFile(context, "/nicecore/import/cockpits/reportcockpit/reportcockpit-users.impex"); importImpexFile(context, "/nicecore/import/cockpits/reportcockpit/reportcockpit-access-rights.impex"); } if (extensionNames.contains("mcc")) { importImpexFile(context, "/nicecore/import/common/mcc-sites-links.impex"); } } protected List<String> getExtensionNames() { return Registry.getCurrentTenant().getTenantSpecificExtensionNames(); } protected <T> T getBeanForName(final String name) { return (T) Registry.getApplicationContext().getBean(name); } }
[ "Fajruddin Sk" ]
Fajruddin Sk
eccfe2f86b5ac604eeec4561b1d408f7b595238d
a206fb82f62453fb5c40247e30b45eddb798f865
/app/src/main/java/com/example/user/userlogin/MainActivity.java
e30ddb0ce8bb0b7220da9b6f8cd4ba5b8eef482e
[]
no_license
navyathomas/userAndroiApp
e66fadc17d06bc09e0cbf99d64bfe14ff92b2766
6aafbaabaff0c3f5d800447d6953d824d330cab0
refs/heads/master
2020-04-18T01:55:00.720131
2019-01-23T07:41:43
2019-01-23T07:41:43
167,139,380
0
0
null
null
null
null
UTF-8
Java
false
false
1,719
java
package com.example.user.userlogin; import android.content.Intent; import android.content.SharedPreferences; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; public class MainActivity extends AppCompatActivity { EditText ed1,ed2; Button b; String usrnme,passwrdd; SharedPreferences pref; SharedPreferences.Editor editor; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ed1=(EditText)findViewById(R.id.usr); ed2=(EditText)findViewById(R.id.pwd); b=(Button)findViewById(R.id.log); pref=getApplicationContext().getSharedPreferences("mypref",0); editor=pref.edit(); String a=pref.getString("usernme",null); if(a!=null){ Intent i=new Intent(getApplicationContext(),UserLog2Activity.class); startActivity(i); } b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { usrnme=ed1.getText().toString(); passwrdd=ed2.getText().toString(); if ((usrnme.equals("admin")&&(passwrdd.equals("1234")))) { editor.putString("usernme",usrnme); editor.putString("passwordd",passwrdd); editor.commit(); Intent i=new Intent(getApplicationContext(),UserLog2Activity.class); startActivity(i); } } }); } }
193b7047d26f58c82bd5ef74310bf331d2d18b37
f5ca14bf4fb22a7efec6d11936f99f57c2249d3f
/src/main/java/gr/di/uoa/m151/repo/ChatMessageRepo.java
52439c63e2d98b3ebfa57592c0da3c1c19f24f83
[]
no_license
oddo-trisp/m151_api
cfce03afcb5b8ccd24f8a5b56c86eaeda630fab8
9b8437b5625cdae8b71e3fd1d06f548058a883c1
refs/heads/master
2020-05-18T07:23:06.314094
2019-05-20T21:09:09
2019-05-20T21:09:09
184,261,810
0
0
null
null
null
null
UTF-8
Java
false
false
677
java
package gr.di.uoa.m151.repo; import gr.di.uoa.m151.entity.AppUser; import gr.di.uoa.m151.entity.ChatMessage; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import java.util.List; public interface ChatMessageRepo extends CrudRepository<ChatMessage,Long> { @Query(value = "select * from chat_message cm\n" + "where (cm.sender_id = ?1 and cm.receiver_id = ?2)\n" + " or (cm.sender_id = ?2 and cm.receiver_id = ?1)\n" + "order by cm.creation_date desc limit 100", nativeQuery = true) List<ChatMessage> findMessagesOnConversation(Long senderId, Long receiverId); }
8ddab4bd9e812c448dbd8e26df526f3a54f4084c
d110d51df5c59810142c907e7b4753812942d21a
/generator-javaee-sample-app/src/main/java/knorxx/framework/generator/javaeesampleapp/server/service/StorageService.java
3a1123a5cbcbc5f02e4c71b657a50b989d19b19d
[ "MIT" ]
permissive
janScheible/knorxx
a1b3730e9d46f4c58a1cee42052d9c829e98c480
b0885eec7ffe3870c8ea4cd1566b26b744f34bab
refs/heads/master
2021-01-25T06:05:58.474442
2015-12-22T11:27:23
2015-12-22T11:27:23
17,491,095
2
1
null
null
null
null
UTF-8
Java
false
false
1,015
java
package knorxx.framework.generator.javaeesampleapp.server.service; import com.mysema.query.jpa.impl.JPAQuery; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.servlet.http.HttpServletRequest; import knorxx.framework.generator.javaeesampleapp.server.model.QTestEntity; import knorxx.framework.generator.javaeesampleapp.server.model.TestEntity; import knorxx.framework.generator.web.client.RpcService; import org.stjs.javascript.functions.Callback1; /** * * @author sj */ public class StorageService implements RpcService { @PersistenceContext EntityManager entityManager; public TestEntity getById(HttpServletRequest request, long id, Callback1<TestEntity> callback, Object scope) { TestEntity testEntity = new JPAQuery (entityManager).from(QTestEntity.testEntity) .where(QTestEntity.testEntity.name.contains("wing")) .singleResult(QTestEntity.testEntity); return testEntity; } }
11e95aa22a2d9cba52d278515766f445dd70f748
2165261d6c2eef068070eaa6101fe167dcbbb7ae
/JWTAuthPratice2/src/test/java/com/jwtauth2/pratice/JwtAuthPratice2ApplicationTests.java
899a332cd52bd6e48152d362da119655944e0f1e
[]
no_license
RukeshB/fuse_machine_intern
e158d0cf8cf8d02963c84abffcd6d20c192802dd
254e455faf13f19580df5756070c5386e234fa9b
refs/heads/main
2023-06-10T22:02:07.542210
2021-07-09T08:04:19
2021-07-09T08:04:19
366,950,213
0
0
null
null
null
null
UTF-8
Java
false
false
221
java
package com.jwtauth2.pratice; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class JwtAuthPratice2ApplicationTests { @Test void contextLoads() { } }
d195ae55f974ea4b56af49f72ed641b1ab9b460f
0c953e0f1e50e7163a976443d29fa207b81b2e0a
/Razi-CTF2020/Android/chasing_a_lock_COMPLETED/classes-dex2jar.jar.src/androidx/appcompat/widget/ResourcesWrapper.java
b89d2a0570801b7287783a9c2f9759cc0880dc0b
[]
no_license
autun12/CTF-Writeups
0b25da42b7f2c8565cc5a4f9fea97b260200c3ea
cff195482a832455ffb5da134225724aff1650cd
refs/heads/master
2023-01-02T09:22:28.330091
2020-10-28T20:17:52
2020-10-28T20:17:52
295,495,100
4
1
null
null
null
null
UTF-8
Java
false
false
8,404
java
package androidx.appcompat.widget; import android.content.res.AssetFileDescriptor; import android.content.res.ColorStateList; import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.graphics.Movie; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.TypedValue; import java.io.IOException; import java.io.InputStream; import org.xmlpull.v1.XmlPullParserException; class ResourcesWrapper extends Resources { private final Resources mResources; public ResourcesWrapper(Resources paramResources) { super(paramResources.getAssets(), paramResources.getDisplayMetrics(), paramResources.getConfiguration()); this.mResources = paramResources; } public XmlResourceParser getAnimation(int paramInt) throws Resources.NotFoundException { return this.mResources.getAnimation(paramInt); } public boolean getBoolean(int paramInt) throws Resources.NotFoundException { return this.mResources.getBoolean(paramInt); } public int getColor(int paramInt) throws Resources.NotFoundException { return this.mResources.getColor(paramInt); } public ColorStateList getColorStateList(int paramInt) throws Resources.NotFoundException { return this.mResources.getColorStateList(paramInt); } public Configuration getConfiguration() { return this.mResources.getConfiguration(); } public float getDimension(int paramInt) throws Resources.NotFoundException { return this.mResources.getDimension(paramInt); } public int getDimensionPixelOffset(int paramInt) throws Resources.NotFoundException { return this.mResources.getDimensionPixelOffset(paramInt); } public int getDimensionPixelSize(int paramInt) throws Resources.NotFoundException { return this.mResources.getDimensionPixelSize(paramInt); } public DisplayMetrics getDisplayMetrics() { return this.mResources.getDisplayMetrics(); } public Drawable getDrawable(int paramInt) throws Resources.NotFoundException { return this.mResources.getDrawable(paramInt); } public Drawable getDrawable(int paramInt, Resources.Theme paramTheme) throws Resources.NotFoundException { return this.mResources.getDrawable(paramInt, paramTheme); } public Drawable getDrawableForDensity(int paramInt1, int paramInt2) throws Resources.NotFoundException { return this.mResources.getDrawableForDensity(paramInt1, paramInt2); } public Drawable getDrawableForDensity(int paramInt1, int paramInt2, Resources.Theme paramTheme) { return this.mResources.getDrawableForDensity(paramInt1, paramInt2, paramTheme); } public float getFraction(int paramInt1, int paramInt2, int paramInt3) { return this.mResources.getFraction(paramInt1, paramInt2, paramInt3); } public int getIdentifier(String paramString1, String paramString2, String paramString3) { return this.mResources.getIdentifier(paramString1, paramString2, paramString3); } public int[] getIntArray(int paramInt) throws Resources.NotFoundException { return this.mResources.getIntArray(paramInt); } public int getInteger(int paramInt) throws Resources.NotFoundException { return this.mResources.getInteger(paramInt); } public XmlResourceParser getLayout(int paramInt) throws Resources.NotFoundException { return this.mResources.getLayout(paramInt); } public Movie getMovie(int paramInt) throws Resources.NotFoundException { return this.mResources.getMovie(paramInt); } public String getQuantityString(int paramInt1, int paramInt2) throws Resources.NotFoundException { return this.mResources.getQuantityString(paramInt1, paramInt2); } public String getQuantityString(int paramInt1, int paramInt2, Object... paramVarArgs) throws Resources.NotFoundException { return this.mResources.getQuantityString(paramInt1, paramInt2, paramVarArgs); } public CharSequence getQuantityText(int paramInt1, int paramInt2) throws Resources.NotFoundException { return this.mResources.getQuantityText(paramInt1, paramInt2); } public String getResourceEntryName(int paramInt) throws Resources.NotFoundException { return this.mResources.getResourceEntryName(paramInt); } public String getResourceName(int paramInt) throws Resources.NotFoundException { return this.mResources.getResourceName(paramInt); } public String getResourcePackageName(int paramInt) throws Resources.NotFoundException { return this.mResources.getResourcePackageName(paramInt); } public String getResourceTypeName(int paramInt) throws Resources.NotFoundException { return this.mResources.getResourceTypeName(paramInt); } public String getString(int paramInt) throws Resources.NotFoundException { return this.mResources.getString(paramInt); } public String getString(int paramInt, Object... paramVarArgs) throws Resources.NotFoundException { return this.mResources.getString(paramInt, paramVarArgs); } public String[] getStringArray(int paramInt) throws Resources.NotFoundException { return this.mResources.getStringArray(paramInt); } public CharSequence getText(int paramInt) throws Resources.NotFoundException { return this.mResources.getText(paramInt); } public CharSequence getText(int paramInt, CharSequence paramCharSequence) { return this.mResources.getText(paramInt, paramCharSequence); } public CharSequence[] getTextArray(int paramInt) throws Resources.NotFoundException { return this.mResources.getTextArray(paramInt); } public void getValue(int paramInt, TypedValue paramTypedValue, boolean paramBoolean) throws Resources.NotFoundException { this.mResources.getValue(paramInt, paramTypedValue, paramBoolean); } public void getValue(String paramString, TypedValue paramTypedValue, boolean paramBoolean) throws Resources.NotFoundException { this.mResources.getValue(paramString, paramTypedValue, paramBoolean); } public void getValueForDensity(int paramInt1, int paramInt2, TypedValue paramTypedValue, boolean paramBoolean) throws Resources.NotFoundException { this.mResources.getValueForDensity(paramInt1, paramInt2, paramTypedValue, paramBoolean); } public XmlResourceParser getXml(int paramInt) throws Resources.NotFoundException { return this.mResources.getXml(paramInt); } public TypedArray obtainAttributes(AttributeSet paramAttributeSet, int[] paramArrayOfint) { return this.mResources.obtainAttributes(paramAttributeSet, paramArrayOfint); } public TypedArray obtainTypedArray(int paramInt) throws Resources.NotFoundException { return this.mResources.obtainTypedArray(paramInt); } public InputStream openRawResource(int paramInt) throws Resources.NotFoundException { return this.mResources.openRawResource(paramInt); } public InputStream openRawResource(int paramInt, TypedValue paramTypedValue) throws Resources.NotFoundException { return this.mResources.openRawResource(paramInt, paramTypedValue); } public AssetFileDescriptor openRawResourceFd(int paramInt) throws Resources.NotFoundException { return this.mResources.openRawResourceFd(paramInt); } public void parseBundleExtra(String paramString, AttributeSet paramAttributeSet, Bundle paramBundle) throws XmlPullParserException { this.mResources.parseBundleExtra(paramString, paramAttributeSet, paramBundle); } public void parseBundleExtras(XmlResourceParser paramXmlResourceParser, Bundle paramBundle) throws XmlPullParserException, IOException { this.mResources.parseBundleExtras(paramXmlResourceParser, paramBundle); } public void updateConfiguration(Configuration paramConfiguration, DisplayMetrics paramDisplayMetrics) { super.updateConfiguration(paramConfiguration, paramDisplayMetrics); Resources resources = this.mResources; if (resources != null) resources.updateConfiguration(paramConfiguration, paramDisplayMetrics); } } /* Location: /home/austin/Documents/CTFFolder/CTF-Writeups/Razi-CTF2020/Android/chasing_a_lock/chasing a lock/classes-dex2jar.jar!/androidx/appcompat/widget/ResourcesWrapper.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
925d620e5092d1315f727fcd38e342440f197296
6ea438044892d62fc73df769bf43844016f992ac
/app/src/main/java/com/example/bankapp/splash/LoginActivityPresenter.java
b09c1a66885afcc9a707e4f9b2ed2d017d4176cc
[]
no_license
HaiFengZhiNeng/BankApp
ce00267a46d15c62da6430f4b2986441a796441b
7c696245808e48a8660e33c69fe516560d6d9820
refs/heads/master
2021-01-25T10:57:11.615452
2018-01-12T10:17:27
2018-01-12T10:17:27
123,376,654
0
1
null
null
null
null
UTF-8
Java
false
false
5,358
java
package com.example.bankapp.splash; import android.app.PendingIntent; import android.content.Intent; import android.os.Bundle; import com.example.bankapp.base.config.Constant; import com.example.bankapp.base.presenter.BasePresenter; import com.example.bankapp.main.MainView; import com.example.bankapp.util.L; import com.yuntongxun.ecsdk.ECDevice; import com.yuntongxun.ecsdk.ECError; import com.yuntongxun.ecsdk.ECInitParams; import com.yuntongxun.ecsdk.ECNotifyOptions; import com.yuntongxun.ecsdk.ECVoIPSetupManager; import com.yuntongxun.ecsdk.SdkErrorCode; import static com.example.bankapp.splash.SingleLogin.isInitSuccess; /** * Created by dell on 2017/8/1. */ public class LoginActivityPresenter extends BasePresenter<ILoginView> { private String username = Constant.LOGIN_NAME; private String appKey = "8a216da85ea31fdd015ea399cb4b0075"; private String token = "c3f9bc4ed6f62a1b2888f4dc4d6604ab"; private SingleLogin mLogin; public LoginActivityPresenter(ILoginView mView) { super(mView); mLogin = SingleLogin.getInstance(getContext(), ""); } @Override public void onCreate(Bundle saveInstanceState) { super.onCreate(saveInstanceState); mLogin = SingleLogin.getInstance(getContext(), "asd"); } SingleLogin.OnInitListener initListener = new SingleLogin.OnInitListener() { @Override public void onSuccess() { L.e("key", "loginSuccess"); // DoLogin(); } @Override public void onError(Exception exception) { L.e("key", "loginError"); } @Override public void onInitFinish() { if (isInitSuccess) { loginMain(); } else { L.e("GG", "初始化失败"); } } }; public void DoLogin() { mLogin.initInitialized(); mLogin.setOnInitListener(initListener); } private void loginMain() { if (!isInitSuccess) return; L.e("key", "初始化SDK及登陆代码完成"); ECInitParams params = ECInitParams.createParams(); params.setUserid(username); params.setAppKey(appKey); params.setToken(token); //设置登陆验证模式:自定义登录方式 params.setAuthType(ECInitParams.LoginAuthType.NORMAL_AUTH); //DloginMode(强制上线:FORCE_DlogIN 默认登录:AUTO。使用方式详见注意事项) params.setMode(ECInitParams.LoginMode.FORCE_LOGIN); /** * 登录回调 */ ECDevice.setOnDeviceConnectListener(onECDeviceConnectListener); /** * 设置接收VoIP来电事件通知Intent * 呼入界面activity、开发者需修改该类 * */ Intent intent = new Intent(getContext(), MainView.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent pendingIntent = PendingIntent.getActivity(getContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); ECDevice.setPendingIntent(pendingIntent); /** * 验证参数是否正确 * */ if (params.validate()) { // 登录函数 ECDevice.login(params); } // 设置VOIP 自定义铃声路径 ECVoIPSetupManager setupManager = ECDevice.getECVoIPSetupManager(); if (setupManager != null) { // 目前支持下面三种路径查找方式 // 1、如果是assets目录则设置为前缀[assets://] setupManager.setInComingRingUrl(true, "assets://phonering.mp3"); setupManager.setOutGoingRingUrl(true, "assets://phonering.mp3"); setupManager.setBusyRingTone(true, "assets://played.mp3"); // 2、如果是raw目录则设置为前缀[raw://] // 3、如果是SDCard目录则设置为前缀[file://] } } /** * 设置通知回调监听包含登录状态监听,接收消息监听,呼叫事件回调监听和 * 设置接收来电事件通知Intent等 */ private ECDevice.OnECDeviceConnectListener onECDeviceConnectListener = new ECDevice.OnECDeviceConnectListener() { public void onConnect() { //兼容旧版本的方法,不必处理 } @Override public void onDisconnect(ECError error) { //兼容旧版本的方法,不必处理 } @Override public void onConnectState(ECDevice.ECConnectState state, ECError error) { if (state == ECDevice.ECConnectState.CONNECT_FAILED) { if (error.errorCode == SdkErrorCode.SDK_KICKED_OFF) { L.e("key", "==帐号异地登陆"); } else { L.e("key", "==其他登录失败,错误码:" + error.errorMsg + error.errorCode); L.e("GG", "正在重新登录。。。"); // DoLogin(); } return; } else if (state == ECDevice.ECConnectState.CONNECT_SUCCESS) { L.e("key", "==登陆成功" + error.toString()); startActivity(MainView.class); exit(); } } }; @Override public void onLocalError() { } @Override public void onInsufficient() { } }
ddad31f0d872bd022fba2a459d96a8e3196938f6
77ef8a157277960adff6142bcb3699d812a8c2cd
/src/main/java/com/springaws/servicios/serviciosartifact/mvc/model/repository/CatTipoDatoRepository.java
a781d39907ffd84be5895474d1684c1bb882daa9
[]
no_license
salazar0985/ServiciosAWS
1b1ea1059e1f143c4478e2803dbd495805a68821
1aedd011211ef0e5d3e379b7e590cc5c26f40b32
refs/heads/master
2020-04-20T09:01:33.893329
2019-04-22T03:31:19
2019-04-22T03:31:19
168,753,244
0
0
null
null
null
null
UTF-8
Java
false
false
358
java
package com.springaws.servicios.serviciosartifact.mvc.model.repository; import com.springaws.servicios.serviciosartifact.mvc.model.persistence.CatTipoDatoEntity; import org.springframework.data.repository.CrudRepository; /** * Created by IDEX1010 on 19/02/2019. */ public interface CatTipoDatoRepository extends CrudRepository<CatTipoDatoEntity,Long>{ }
b41f25d5b381b02b29fc3db7dc5cfa919499701a
3a53421aabee5ae306f69b9f6dfcd23a9d501d63
/communication/assignment1/A1-Android-App-AndroidStudio/A1AndroidApp/src/main/java/vandy/mooc/presenter/ImagePresenter.java
0865872f2332960cb74e98ca4b6312661fe99ed9
[]
no_license
MarcoFarrier/POSA-16
a9e8b525d65f99271c6b39b216bcf172fd8d9987
0ebc4174b97383eb3971bd7b4910ab266fe232b3
refs/heads/master
2020-12-14T09:58:10.950202
2016-04-28T01:11:51
2016-04-28T01:11:51
53,460,706
1
0
null
2016-03-09T02:13:01
2016-03-09T02:13:01
null
UTF-8
Java
false
false
10,762
java
package vandy.mooc.presenter; import java.io.File; import java.lang.ref.WeakReference; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import vandy.mooc.MVP; import vandy.mooc.common.GenericPresenter; import vandy.mooc.common.Utils; import vandy.mooc.model.ImageModel; import vandy.mooc.model.datamodel.ReplyMessage; import android.app.Activity; import android.content.Context; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.util.Log; /** * This class defines all the image-related operations. It implements * the various Ops interfaces so it can be created/managed by the * GenericActivity framework. It plays the role of the "Presenter" in * the Model-View-Presenter pattern. */ public class ImagePresenter extends GenericPresenter<MVP.RequiredPresenterOps, MVP.ProvidedModelOps, ImageModel> implements MVP.ProvidedPresenterOps, MVP.RequiredPresenterOps { /** * Used to enable garbage collection. */ private WeakReference<MVP.RequiredViewOps> mImageView; /** * Stores the running total number of images downloaded that must * be handled by ServiceResultHandler. */ private int mNumImagesToHandle; /** * Stores the running total number of images that have been * handled by the ServiceResultHandler. */ private int mNumImagesHandled; /** * Stores the directory to be used for all downloaded images. */ private Uri mDirectoryPathname = null; /** * Array of Strings that represent the valid URLs that have * been entered. */ private ArrayList<Uri> mUrlList; /** * Constructor will choose either the Started Service or Bound * Service implementation of ImagePresenter. */ public ImagePresenter() { } /** * Hook method called when a new instance of AcronymPresenter is * created. One time initialization code goes here, e.g., storing * a WeakReference to the View layer and initializing the Model * layer. * * @param view * A reference to the View layer. */ @Override public void onCreate(MVP.RequiredViewOps view) { // Set the WeakReference. mImageView = new WeakReference<>(view); // Create a timestamp that will be unique. final String timestamp = new SimpleDateFormat("yyyyMMdd'_'HHmm").format(new Date()); // Use the timestamp to create a pathname for the // directory that stores downloaded images. mDirectoryPathname = Uri.parse(Environment.getExternalStoragePublicDirectory (Environment.DIRECTORY_DCIM) + "/" + timestamp + "/"); // Initialize the list of URLs. mUrlList = new ArrayList<Uri>(); // Finish the initialization steps. resetFields(); // Invoke the special onCreate() method in GenericPresenter, // passing in the ImageModel class to instantiate/manage and // "this" to provide ImageModel with this MVP.RequiredModelOps // instance. super.onCreate(ImageModel.class, this); } /** * Hook method dispatched by the GenericActivity framework to * initialize the ImagePresenter object after a runtime * configuration change. * * @param view The currently active ImagePresenter.View. */ @Override public void onConfigurationChange(MVP.RequiredViewOps view) { // Reset the mImageView WeakReference. mImageView = new WeakReference<>(view); // If the content is non-null then we're done, so set the // result of the Activity and finish it. if (allDownloadsComplete()) { // Hide the progress bar. mImageView.get().dismissProgressBar(); Log.d(TAG, "All images have finished downloading"); } else if (downloadsInProgress()) { // Display the progress bar. mImageView.get().displayProgressBar(); Log.d(TAG, "Not all images have finished downloading"); } // (Re)display the URLs. mImageView.get().displayUrls(); } /** * Hook method called to shutdown the Presenter layer. * * @param isChangeConfigurations * True if a runtime configuration triggered the onDestroy() call. */ @Override public void onDestroy(boolean isChangingConfigurations) { // Destroy the model. getModel().onDestroy(isChangingConfigurations); } /** * Get the list of URLs. */ @Override public ArrayList<Uri> getUrlList() { return mUrlList; } /** * Reset the URL and counter fields and redisplay linear layout. */ private void resetFields() { // Reset the number of images to handle and which have been // handled. mNumImagesHandled = 0; mNumImagesToHandle = 0; // Clear the URL list. mUrlList.clear(); // Redisplay the URLs, which should now be empty. mImageView.get().displayUrls(); } /** * Start all the downloads and processing. Plays the role of the * "Template Method" in the Template Method pattern. */ @Override public void startProcessing() { if (mUrlList.isEmpty()) Utils.showToast(mImageView.get().getActivityContext(), "no images provided"); else { // Make the progress bar visible. mImageView.get().displayProgressBar(); // Keep track of number of images to download that must be // displayed. mNumImagesToHandle = mUrlList.size(); // Iterate over each URL and start the download. for (final Uri url : mUrlList) getModel().startDownload(url, mDirectoryPathname); } } /** * Interact with the View layer to display the downloaded images * when they are all returned from the Model. */ @Override public void onDownloadComplete(ReplyMessage replyMessage) { // Increment the number of images handled regardless of // whether this result succeeded or failed to download and // image. ++mNumImagesHandled; if (replyMessage.getResultCode() == Activity.RESULT_CANCELED) // Handle a failed download. mImageView.get().reportDownloadFailure (replyMessage.getImageURL(), allDownloadsComplete()); else /* replyMessage.getResultCode() == Activity.RESULT_OK) */ // Handle a successful download. Log.d(TAG, "received image " + replyMessage.getImagePathname().toString()); // Try to display all images received successfully. tryToDisplayImages(); } /** * Launch an Activity to display all the images that were received * successfully if all downloads are complete. */ private void tryToDisplayImages() { // If this is last image handled, display images via // DisplayImagesActivity. if (allDownloadsComplete()) { // Dismiss the progress bar. mImageView.get().dismissProgressBar(); // Initialize state for the next run. resetFields(); // Only start the DisplayImageActivity if the image folder // exists and also contains at least 1 image to display. // Note that if the directory is empty, File.listFiles() // returns null. File file = new File(mDirectoryPathname.toString()); if (file.isDirectory() && file.listFiles() != null && file.listFiles().length > 0) { // Display the results. mImageView.get().displayResults(mDirectoryPathname); } } } /** * Returns true if all the downloads have completed, else false. */ private boolean allDownloadsComplete() { return mNumImagesHandled == mNumImagesToHandle && mNumImagesHandled > 0; } /** * Returns true if there are any downloads in progress, else false. */ private boolean downloadsInProgress() { return mNumImagesToHandle > 0; } /** * Delete all the downloaded images. */ @Override public void deleteDownloadedImages() { // Delete all the downloaded image. int fileCount = deleteFiles(mDirectoryPathname, 0); // Indicate how many files were deleted. Utils.showToast(mImageView.get().getActivityContext(), fileCount + " downloaded image" + (fileCount == 1 ? " was" : "s were") + " deleted."); // Reset the fields for the next run. resetFields(); } /** * A helper method that recursively deletes files in a specified * directory. */ private Integer deleteFiles(Uri directoryPathname, int fileCount) { File imageDirectory = new File(directoryPathname.toString()); File files[] = imageDirectory.listFiles(); if (files == null) return fileCount; // Android does not allow you to delete a directory with child // files, so we need to write code that handles this // recursively. for (final File f : files) { final Uri fileOrDirectoryName = Uri.parse(f.toString()); if (f.isDirectory()) fileCount += deleteFiles(fileOrDirectoryName, fileCount); Log.d(TAG, "deleting file " + fileOrDirectoryName.toString() + " with count " + fileCount); ++fileCount; f.delete(); } imageDirectory.delete(); return fileCount; } /** * Return the Activity context. */ @Override public Context getActivityContext() { return mImageView.get().getActivityContext(); } /** * Return the Application context. */ @Override public Context getApplicationContext() { return mImageView.get().getApplicationContext(); } }
c2eeed314f9bb6826fb8ef5a12bdd168227405a6
3f141fe7e25cdbc0f5bdec0e3e1d56d562440e1b
/code/BufferedReaderDemo.java
0aa69af282469741da5c78abba2c58729f2c43b7
[]
no_license
munjalupadhyay/Gui-Mail-Reader
d36c8961cbb71df7d64235922918668632e90423
a68b2455760999058dd39803e5ddda8bfa4c8189
refs/heads/master
2016-09-15T22:18:22.634629
2015-04-21T17:10:52
2015-04-21T17:10:52
34,177,390
0
0
null
null
null
null
UTF-8
Java
false
false
5,979
java
import java.io.*; class BufferedReaderDemo { int count=0; public static void main(String args[]) { BufferedReaderDemo brd = new BufferedReaderDemo(); RandomAccessFile br; int countTemp=5; String mailId = new String("[email protected]"); //--------------------------need the count(total no of mails)-------------------------------------- try { br = new RandomAccessFile("Inbox.txt", "r"); String strLine; //Read File Line By Line while ((strLine = br.readLine()) != null) { // Print the content on the console if(strLine.contains(mailId)) { while (countTemp>0 && !strLine.isEmpty()) { strLine = br.readLine(); if((strLine.startsWith("Date:"))) { System.out.println(strLine); countTemp--; } else if((strLine.startsWith("Subject:"))) { System.out.println(strLine); countTemp--; } else if((strLine.startsWith("From:"))) { System.out.println(strLine); countTemp--; } else if((strLine.startsWith("Cc"))) { System.out.println(strLine); countTemp--; } else if((strLine.startsWith("X-Priority"))) { System.out.println(strLine); countTemp--; } }//end of internal while // brd.count++; while(!strLine.isEmpty()) { strLine=br.readLine(); } while(!strLine.startsWith("From") && !strLine.contains("@dcis.uohyd.ernet.in") ) { System.out.println(strLine); strLine=br.readLine(); if(strLine.startsWith(">From")) { while(!strLine.isEmpty()) { System.out.println(strLine); strLine=br.readLine(); }//end while }//end if }//end while // }//end of while }//end of if } // end of while //System.out.println(brd.count); //String str[] = new String[brd.count]; //br.seek(0); //---------------------------need to store all the message ids in decending order in array if strings--------- //countTemp=(brd.count-1); //while ((strLine = br.readLine()) != null) //{ //if(strLine.startsWith("Message-ID: <") || strLine.startsWith("Message-Id: <")) //{ //System.out.println (strLine); // String s = strLine.substring(13); //System.out.println(s); //int i=s.length(); //System.out.println(""+i); //i=i-2; //System.out.println(s.substring(0,i) ); // str[countTemp]=strLine; //str[countTemp]=s.substring(0,i); //System.out.println(str[countTemp]); // countTemp=countTemp-1; //System.out.println(countTemp); //System.out.println("hiiii..."); //} // end of if //} // end of while //for(int kk=0;kk<11;kk++) // { // System.out.println(str[kk]); // } //-----------------------------search for he message-id ----------------------------------- //br.seek(0); //while ((strLine = br.readLine()) != null) // { //if(strLine.equals(str[7])) // { // strLine = br.readLine(); //System.out.println (strLine); //strLine = br.readLine(); //strLine = br.readLine(); //strLine = br.readLine(); //System.out.println (strLine); //while (!(strLine.startsWith("Date: ")) ) //{ //if((strLine.startsWith("Message-ID: <"))) //{ // break; //} //else //strLine = br.readLine(); //} //System.out.println (strLine); //while (!(strLine.startsWith("Subject: ")) ) //{ //if((strLine.startsWith("Message-ID: <"))) //{ // break; //} //else //strLine = br.readLine(); //} //System.out.println (strLine); //while (!(strLine.startsWith("From: ")) ) //{ //if((strLine.startsWith("Message-ID: <"))) //{ // break; //} //else //strLine = br.readLine(); //} //System.out.println (strLine); //String s = strLine.substring(13); //System.out.println(s); //int i=s.length(); //System.out.println(""+i); //i=i-2; //System.out.println(s.substring(0,i) ); //str[countTemp]=strLine; //str[countTemp]=s.substring(0,i); //System.out.println(str[countTemp]); //countTemp=countTemp-1; //System.out.println(countTemp); //System.out.println("hiiii..."); //} // end of while } // end of try catch (Exception e) { //Catch exception if any System.out.println("Error: " +e); } /* while ((strLine = br.readLine()) != null) { // Print the content on the console if(strLine.startsWith("Message-ID: <") || strLine.startsWith("Message-Id: <")) { System.out.println (strLine); String s = strLine.substring(13); //System.out.println(s); int i=s.length(); //System.out.println(""+i); i=i-2; System.out.println(s.substring(0,i) ); /* for(int k=brd.count;k<0;k--) { str[k]=s.substring(0,i); System.out.println("hiiii..."); } } } // end of while */ //Close the input stream } // end of main() } // end of class
c066bd437bad8e5e45453568a8dbfabd70867a91
2e16dec3e018fba4e340cd4848267f42efc3d2fa
/src/main/java/com/neuedu/service/impl/ShippingServiceImpl.java
45a9e437ba094c8641a603b86ed9633d59300d60
[]
no_license
Einsteinl/business
77565268da719aa8aa4947efca127992603789e5
3f06299138096f42003c4ae000367df6392fead5
refs/heads/master
2020-07-22T03:14:31.402559
2019-09-08T04:08:58
2019-09-08T04:08:58
207,057,877
0
0
null
null
null
null
UTF-8
Java
false
false
1,156
java
package com.neuedu.service.impl; import com.neuedu.common.ResponseCode; import com.neuedu.common.ServerResponse; import com.neuedu.dao.ShippingMapper; import com.neuedu.pojo.Shipping; import com.neuedu.service.IShippingService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class ShippingServiceImpl implements IShippingService { @Autowired ShippingMapper shippingMapper; @Override public ServerResponse add(Shipping shipping) { //step1:参数非空判断 if (shipping==null){ return ServerResponse.serverResponseByError(ResponseCode.ERROR,"参数必传"); } Integer shippingid=shipping.getId(); if (shippingid==null){ //添加 int result= shippingMapper.insert(shipping); if (result<=0){ return ServerResponse.serverResponseByError(ResponseCode.ERROR,"添加地址失败"); }else{ return ServerResponse.serverResponseBySuccess(shipping.getId()); } }else{ //更新 } return null; } }
f6d0b3a7abc9a1da4fadba2eb0ef95417edea2cc
a5d01febfd8d45a61f815b6f5ed447e25fad4959
/Source Code/5.27.0/sources/androidx/appcompat/widget/TintResources.java
d269b43354b138b633d2e869b4445215e9bb9593
[]
no_license
kkagill/Decompiler-IQ-Option
7fe5911f90ed2490687f5d216cb2940f07b57194
c2a9dbbe79a959aa1ab8bb7a89c735e8f9dbc5a6
refs/heads/master
2020-09-14T20:44:49.115289
2019-11-04T06:58:55
2019-11-04T06:58:55
223,236,327
1
0
null
2019-11-21T18:17:17
2019-11-21T18:17:16
null
UTF-8
Java
false
false
876
java
package androidx.appcompat.widget; import android.content.Context; import android.content.res.Resources; import android.graphics.drawable.Drawable; import androidx.annotation.NonNull; import java.lang.ref.WeakReference; class TintResources extends ResourcesWrapper { private final WeakReference<Context> mContextRef; public TintResources(@NonNull Context context, @NonNull Resources resources) { super(resources); this.mContextRef = new WeakReference(context); } public Drawable getDrawable(int i) { Drawable drawable = super.getDrawable(i); Context context = (Context) this.mContextRef.get(); if (!(drawable == null || context == null)) { AppCompatDrawableManager.get(); AppCompatDrawableManager.tintDrawableUsingColorFilter(context, i, drawable); } return drawable; } }
e71c8323c2b88f1fb50ba680c7599717bcabbe50
280006fe0b43875ef75dc77f38ad7751d4e3f750
/src/main/java/io/infoworks/util/HdfsUtil.java
b91b2c0be1a4c371ce1d779b432601fac954ff10
[]
no_license
Infoworks/IWValidator
f3fd3c44803fb7679e289afe6f82540d96a14541
646389be7abf0df7f1079818c4167effa388329e
refs/heads/master
2022-09-10T23:42:24.315653
2016-08-24T17:49:01
2016-08-24T17:49:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,668
java
package io.infoworks.util; import java.net.URI; import java.util.logging.Logger; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter.DEFAULT; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; public class HdfsUtil { private static String DEFAULT_SCHEME = "hdfs" ; private static Logger logger = Logger.getLogger("HdfsUtil") ; public static void deletePath(String host, String port, String scheme, String filePath) { try { if(scheme == null) { scheme = DEFAULT_SCHEME ; } String uri = createUri(scheme, host, port, filePath) ; Path path = createPath(uri) ; logger.info("Deleting hdfs path " + uri); FileSystem file = getFileSystem(uri, new Configuration()) ; try { boolean isDeleted = file.delete(path, true) ; logger.info("Is file " + path + " deleted." + isDeleted); } catch(Exception ex) { ex.printStackTrace(); logger.severe("ignoring the exception for time being"); } } catch(Exception e) { e.printStackTrace(); logger.severe("error occurred." + e.getMessage() ); throw new RuntimeException(e) ; } } private static FileSystem getFileSystem(String uri, Configuration conf) throws Exception { return FileSystem.get (new URI(uri), conf); } private static Path createPath(String uri) { return new Path(uri) ; } private static String createUri(String scheme, String hostname, String port, String filepath) { return new StringBuilder(scheme) .append("://") .append(hostname) .append(":") .append("" + port) .append("/") .append(filepath).toString() ; } }
6354c76979bd4d5d36ae04899c091b278c86ece4
4a51235a9426611efe3ae4aa94ff0cbc6e404ad2
/main/engine/org/joverseer/engine/orders/TransferArtifactsOrder.java
c71b4afba526554a26a679180ba6f541b0614def
[ "BSD-3-Clause" ]
permissive
randybias/joverseer
122ee34e54ae77de85357c68a00d627d254d1082
9c5ada5589fc587a4e5b26b22b7c8dc0cbb13c48
refs/heads/master
2021-01-15T17:10:13.975620
2018-11-01T03:54:02
2018-11-01T03:54:02
99,738,349
1
1
null
2017-08-08T21:38:31
2017-08-08T21:38:31
null
UTF-8
Java
false
false
2,019
java
package org.joverseer.engine.orders; import org.joverseer.domain.Order; import org.joverseer.engine.ErrorException; import org.joverseer.engine.ExecutingOrder; import org.joverseer.game.Game; import org.joverseer.game.Turn; import org.joverseer.metadata.domain.ArtifactInfo; public class TransferArtifactsOrder extends ExecutingOrder { public TransferArtifactsOrder(Order order) { super(order); } @Override public void doExecute(Game game, Turn turn) throws ErrorException { String id = getParameter(0); int[] a = new int[6]; for (int i=0; i<6; i++) { a[i] = getParameterInt(i+1); } addMessage("{char} was ordered to transfer some artifacts."); if (!loadCharacter2(turn, id)) { addMessage("{gp} was unable to transfer the artifacts because no character with id " + id + " was found"); return; } if (!areCharsAtSameHex()) { addMessage("{gp} was unable to transfer the artifacts because he was not in the same hex with {char2}."); return; } int artifactsTransfered = 0; String artifacts = ""; for (int i=0; i<6; i++) { if (a[i] > 0) { // check artifact held if (!getCharacter().getArtifacts().contains(a[i])) continue; if (getCharacter2().getArtifacts().size() == 6) continue; getCharacter().getArtifacts().remove(new Integer(a[i])); getCharacter2().getArtifacts().add(a[i]); artifactsTransfered++; ArtifactInfo ai = (ArtifactInfo)game.getMetadata().getArtifacts().findFirstByProperty("no", a[i]); artifacts += (artifacts.equals("") ? "" : ", ") + ai.getName(); if (getCharacter().getArtifactInUse() == a[i]) { getCharacter().setArtifactInUse(0); //TODO Fix artifact in use } } } if (artifactsTransfered == 0) { addMessage("No artifacts were transfered."); } else if (artifactsTransfered == 1) { addMessage (artifacts + " was transfered to {char2}."); } else { addMessage (artifacts + " were transfered to {char2}."); } } }
[ "mscoon@fa9a4770-0a1f-0410-ae64-d31215b636fb" ]
mscoon@fa9a4770-0a1f-0410-ae64-d31215b636fb
700c0e41d59ad61ee442551503858f2298a32671
7d3cb3fb374ae0820a52017e419608d9f2b70b77
/src/projek/Pembeli.java
2cb9c8b8bf67692919e3c4fe6b963f199392a36a
[]
no_license
mziyadam/Projek_GUI
b68ebaaecb47b1dd612e305f26464f00b39c378b
bcb055f8cea836dd84d4fff07026b1be95efd3f6
refs/heads/master
2023-04-21T21:17:50.476356
2021-05-12T05:11:20
2021-05-12T05:11:20
366,599,203
0
0
null
null
null
null
UTF-8
Java
false
false
17,385
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 projek; import java.awt.event.*; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; import javax.swing.*; import javax.swing.table.DefaultTableModel; /** * * @author ziyad */ class pemb{ private String ID,Nama,Gaji,Dept_ID; public pemb(String ID, String Nama, String Gaji, String Dept_ID) { this.ID = ID; this.Nama = Nama; this.Gaji = Gaji; this.Dept_ID = Dept_ID; } public String getID() { return ID; } public void setID(String ID) { this.ID = ID; } public String getNama() { return Nama; } public void setNama(String Nama) { this.Nama = Nama; } public String getGaji() { return Gaji; } public void setGaji(String Gaji) { this.Gaji = Gaji; } public String getDept_ID() { return Dept_ID; } public void setDept_ID(String Dept_ID) { this.Dept_ID = Dept_ID; } } public class Pembeli extends javax.swing.JFrame { /** * Creates new form Departemen */ public Pembeli(mainApp frame) { initComponents(); show_user(); this.setTitle("Pembeli"); } public ArrayList<pemb>userList(){ ArrayList<pemb>userList=new ArrayList<>(); try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Connection con = Driver.getcon(); String query1 = "SELECT * FROM Pembeli"; Statement st = con.createStatement(); ResultSet res = st.executeQuery(query1); pemb user; while (res.next()) { user=new pemb(res.getString(1),res.getString(2),res.getString(3),res.getString(4)); userList.add(user); } return userList; } catch(Exception e){ JOptionPane.showMessageDialog(null, "Ups! Ada yang salah"); System.out.println(""); } return userList; } public void show_user(){ ArrayList<pemb>list=userList(); DefaultTableModel model=(DefaultTableModel)jTable_karyawan.getModel(); Object[]row=new Object[4]; for (int i = 0; i < list.size(); i++) { row[0]=list.get(i).getID(); row[1]=list.get(i).getNama(); row[2]=list.get(i).getGaji(); row[3]=list.get(i).getDept_ID(); model.addRow(row); } } /** * 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() { jLabel3 = new javax.swing.JLabel(); Nama = new javax.swing.JTextField(); BtnUpdate = new javax.swing.JButton(); ID = new javax.swing.JTextField(); BtnAdd = new javax.swing.JButton(); BtnDel = new javax.swing.JButton(); jLabel2 = new javax.swing.JLabel(); back_btn = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); jTable_karyawan = new javax.swing.JTable(); Dept_ID = new javax.swing.JTextField(); Gaji = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setMinimumSize(new java.awt.Dimension(530, 430)); setPreferredSize(new java.awt.Dimension(530, 430)); getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jLabel3.setText("Nama"); getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 217, -1, -1)); getContentPane().add(Nama, new org.netbeans.lib.awtextra.AbsoluteConstraints(101, 211, 169, -1)); BtnUpdate.setText("UPDATE"); BtnUpdate.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { BtnUpdateActionPerformed(evt); } }); getContentPane().add(BtnUpdate, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 311, -1, -1)); ID.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { IDActionPerformed(evt); } }); getContentPane().add(ID, new org.netbeans.lib.awtextra.AbsoluteConstraints(101, 186, 169, -1)); BtnAdd.setText("ADD"); BtnAdd.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { BtnAddActionPerformed(evt); } }); getContentPane().add(BtnAdd, new org.netbeans.lib.awtextra.AbsoluteConstraints(87, 311, -1, -1)); BtnDel.setText("DELETE"); BtnDel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { BtnDelActionPerformed(evt); } }); getContentPane().add(BtnDel, new org.netbeans.lib.awtextra.AbsoluteConstraints(146, 311, -1, -1)); jLabel2.setText("No. Telp"); getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 239, -1, -1)); back_btn.setText("Back"); back_btn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { back_btnActionPerformed(evt); } }); getContentPane().add(back_btn, new org.netbeans.lib.awtextra.AbsoluteConstraints(391, 336, 69, -1)); jLabel4.setText("Alamat"); getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 264, -1, -1)); jTable_karyawan.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "ID", "Nama", "Nomor Telpon", "Alamat" } )); jTable_karyawan.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTable_karyawanMouseClicked(evt); } }); jScrollPane1.setViewportView(jTable_karyawan); getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 486, 147)); getContentPane().add(Dept_ID, new org.netbeans.lib.awtextra.AbsoluteConstraints(101, 261, 169, -1)); Gaji.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { GajiActionPerformed(evt); } }); getContentPane().add(Gaji, new org.netbeans.lib.awtextra.AbsoluteConstraints(101, 236, 169, -1)); jLabel1.setText("ID"); getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 191, 31, -1)); pack(); }// </editor-fold>//GEN-END:initComponents private void BtnUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnUpdateActionPerformed try{Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Connection con = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=projek;integratedSecurity=true;"); String query1 = "update Pembeli set Nama_Pembeli=?,Nomor_Pembeli=?,Alamat_Pembeli=? where ID_Pembeli=?"; PreparedStatement pst=con.prepareStatement(query1); pst.setString(1,Nama.getText()); pst.setString(2,Gaji.getText()); pst.setString(3,Dept_ID.getText()); pst.setString(4,ID.getText()); pst.executeUpdate(); JOptionPane.showMessageDialog(null, "Update berhasil!"); DefaultTableModel model = (DefaultTableModel) jTable_karyawan.getModel(); model.setRowCount(0); show_user(); } catch(Exception e){ JOptionPane.showMessageDialog(null, "Ups! Ada yang salah"); }/*Karyawan mhsDao = new Karyawan(); dept mhs = new dept(); mhs.setID_Departemen(ID.getText()); mhs.setNama_Departemen(Nama.getText()); mhs.setNama_Departemen(Gaji.getText()); mhs.setNomor_Telepon(Dept_ID.getText()); mhs.setMANAGER_ID_MANAGER(Pengirim_ID.getText()); try { mhsDao.updateMhs(mhs); rows = mhsDao.getAllMhs(); tableModel = new TableModel(rows); jTable_karyawan.setModel(tableModel); } catch (SQLException ex) { Logger.getLogger(mainApp.class.getName()).log(Level.SEVERE, null, ex); } catch (ClassNotFoundException ex) { Logger.getLogger(mainApp.class.getName()).log(Level.SEVERE, null, ex); }*/ }//GEN-LAST:event_BtnUpdateActionPerformed private void IDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_IDActionPerformed // TODO add your handling code here: }//GEN-LAST:event_IDActionPerformed private void BtnAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnAddActionPerformed try{Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Connection con = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=projek;integratedSecurity=true;"); String query1 = "insert into Pembeli values(?,?,?,?)"; PreparedStatement pst=con.prepareStatement(query1); pst.setString(1,ID.getText()); pst.setString(2,Nama.getText()); pst.setString(3,Gaji.getText()); pst.setString(4,Dept_ID.getText()); pst.executeUpdate(); JOptionPane.showMessageDialog(null, "Insert berhasil!"); DefaultTableModel model = (DefaultTableModel) jTable_karyawan.getModel(); model.setRowCount(0); show_user(); } catch(Exception e){ JOptionPane.showMessageDialog(null, "Ups! Ada yang salah"); } /*MhsDao mhsDao = new MhsDao(); dept mhs = new dept(); mhs.setID_Departemen(ID.getText()); mhs.setNama_Departemen(Nama.getText()); mhs.setNama_Departemen(Gaji.getText()); mhs.setNomor_Telepon(Dept_ID.getText()); mhs.setMANAGER_ID_MANAGER(Pengirim_ID.getText()); try { mhsDao.insertMhs(mhs); rows = mhsDao.getAllMhs(); tableModel = new TableModel(rows); jTable_karyawan.setModel(tableModel); } catch (SQLException ex) { Logger.getLogger(mainApp.class.getName()).log(Level.SEVERE, null, ex); } catch (ClassNotFoundException ex) { Logger.getLogger(mainApp.class.getName()).log(Level.SEVERE, null, ex); }*/ }//GEN-LAST:event_BtnAddActionPerformed private void BtnDelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnDelActionPerformed try{Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Connection con = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=projek;integratedSecurity=true;"); String query1 = "delete Pembeli where ID_Pembeli=?"; PreparedStatement pst=con.prepareStatement(query1); pst.setString(1,ID.getText()); pst.executeUpdate(); JOptionPane.showMessageDialog(null, "Delete berhasil!"); DefaultTableModel model = (DefaultTableModel) jTable_karyawan.getModel(); model.setRowCount(0); show_user(); } catch(Exception e){ JOptionPane.showMessageDialog(null, "Ups! Ada yang salah"); } /*MhsDao mhsDao = new MhsDao(); dept mhs = new dept(); mhs.setID_Departemen(ID.getText()); mhs.setNama_Departemen(Nama.getText()); mhs.setNama_Departemen(Gaji.getText()); mhs.setNomor_Telepon(Dept_ID.getText()); mhs.setMANAGER_ID_MANAGER(Pengirim_ID.getText()); try { mhsDao.deleteMhs(mhs); rows = mhsDao.getAllMhs(); tableModel = new TableModel(rows); jTable_karyawan.setModel(tableModel); } catch (SQLException ex) { Logger.getLogger(mainApp.class.getName()).log(Level.SEVERE, null, ex); } catch (ClassNotFoundException ex) { Logger.getLogger(mainApp.class.getName()).log(Level.SEVERE, null, ex); }*/ }//GEN-LAST:event_BtnDelActionPerformed public void showSelectedRow(int row) { String[]val=new String[4]; for (int i = 0; i < val.length; i++) { val[i] = jTable_karyawan.getModel().getValueAt(row, i).toString(); } ID.setText(val[0]); Nama.setText(val[1]); Gaji.setText(val[2]); Dept_ID.setText(val[3]); } private void back_btnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_back_btnActionPerformed // TODO add your handling code here: mainApp ma=new mainApp(); ma.setVisible(true); dispose(); }//GEN-LAST:event_back_btnActionPerformed private void jTable_karyawanMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable_karyawanMouseClicked int row = jTable_karyawan.getSelectedRow(); showSelectedRow(row); }//GEN-LAST:event_jTable_karyawanMouseClicked private void GajiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_GajiActionPerformed // TODO add your handling code here: }//GEN-LAST:event_GajiActionPerformed /** * @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(Pembeli.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Pembeli.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Pembeli.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Pembeli.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</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.JButton BtnAdd; private javax.swing.JButton BtnDel; private javax.swing.JButton BtnUpdate; private javax.swing.JTextField Dept_ID; private javax.swing.JTextField Gaji; private javax.swing.JTextField ID; private javax.swing.JTextField Nama; private javax.swing.JButton back_btn; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JScrollPane jScrollPane1; public javax.swing.JTable jTable_karyawan; // End of variables declaration//GEN-END:variables }
09c853e13d601fcabe94ea68638a44b04bfd0ee8
772f4a81a3306dee2b3fc9cd20840b7b910d8c47
/hw/cs220-hw6/src/Location.java
0cd42eab0fe38bb60be02917b1009648b0e097cb
[]
no_license
CoffeePlatypus/CS220
f33f8def09c95663e9a0dae51e23b2bebf1e5bec
e0e312234bf70581fa40e3b813ea905e8bf0c85e
refs/heads/master
2020-03-11T17:17:26.247839
2018-04-19T01:39:04
2018-04-19T01:39:04
130,142,892
0
0
null
null
null
null
UTF-8
Java
false
false
1,875
java
import java.util.ArrayList; import java.util.List; public class Location { private int row, col; private Location from; private Direction fromDirection; public Location(int row, int col, Location from, Direction d) { this.row = row; this.col = col; this.from = from; this.fromDirection = d; } public Direction getMovedDirection() { return fromDirection; } public List<Direction> getDirectionsToHere( ) { List<Direction> result = new ArrayList<Direction>(); Location current = this; while( current != null && current.fromDirection != null ) { result.add(0, current.fromDirection ); current=current.from; } return result; } public String toString() { return "(" + col + "," + row + ")"; } public Location getLocation(Direction d) { switch(d) { case EAST: return new Location( row, col+1, this, d); case SOUTH: return new Location(row+1, col, this, d); case WEST: return new Location( row, col-1, this, d); case NORTH: return new Location(row-1, col, this, d); default: return null; } } public Location getLocation(Location from, Direction d) { switch(d) { case EAST: return new Location( row, col+1, from, d); case SOUTH: return new Location(row+1, col, from, d); case WEST: return new Location( row, col-1, from, d); case NORTH: return new Location(row-1, col, from, d); default: return null; } } public int getColumn() { return col; } public boolean equals(Object other) { if(other instanceof Location ){ Location loc = (Location)other; return loc.row == row && loc.col == col; } else { return false; } } public Location getFrom() { return from; } public int getRow() { return row; } }
3165d0e4cc24aaeff39e088f403cf60d0054512a
7a4e68da3042becd0af5341bb929d30f5de848d9
/src/main/java/co/com/escuelait/microservicessrl/dao/repositories/UserRepository.java
7de93048dc8e209026e75983bc6104165741e143
[]
no_license
SRIVERAL/microservicessrl
52d38554f5007fed626ae0fd39a6f6f4752a55c9
ff70b3094efb66a69c1bae099596586438d66508
refs/heads/master
2022-12-28T19:31:04.270480
2020-10-13T03:26:25
2020-10-13T03:26:25
303,567,802
0
0
null
null
null
null
UTF-8
Java
false
false
844
java
package co.com.escuelait.microservicessrl.dao.repositories; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import co.com.escuelait.microservicessrl.dao.entities.UserEntity; @Repository public interface UserRepository extends JpaRepository<UserEntity, Integer>{ public List<UserEntity> findByEdadLessThan(int edad); public List<UserEntity> findByEdadGreaterThanEqual(int edad); public List<UserEntity> findByNameLike(String name); public List<UserEntity> findByNameContaining(String name); @Query(value="SELECT * FROM ms_users WHERE name = ?1 AND edad >= ?2 AND edad <= ?3", nativeQuery= true) public List<UserEntity> findAllUsersBetweenAgeAndName(String name, int ageBegin, int ageEnd); }
a19380ee6cee3955658433b8a5e1d12a3e8a3204
84a638e778dc0b9fc9393bfca0ba997c1bc88510
/basetest/BaseTest.java
e39e0dfe7423c66ddc824b6f25286feeb74e16a0
[]
no_license
saispandanaramisetty1/YoAspireCompleteProject
5a469d890a2af8c7667b80f57a622bb2609caff2
69f24fa8cbf61cfe8ed1b47420df779b0336137d
refs/heads/master
2020-08-04T09:25:31.081330
2019-10-01T12:52:39
2019-10-01T12:52:39
212,080,845
0
0
null
null
null
null
UTF-8
Java
false
false
1,489
java
package com.basetest; import org.apache.log4j.Logger; import org.apache.log4j.xml.DOMConfigurator; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeSuite; import org.testng.annotations.Parameters; import com.relevantcodes.extentreports.ExtentReports; import com.relevantcodes.extentreports.ExtentTest; /** * * @author BaseTest *Class for basic start of the browser */ public class BaseTest { public static WebDriver driver; public static ExtentReports reports; public static ExtentTest etest; public static Logger logger; @BeforeSuite @Parameters("browser") public void baseTest(String browser) { reports = new ExtentReports("./Reports/ExtentReports.html"); logger = Logger.getLogger(BaseTest.class.getName()); DOMConfigurator.configure("log4j.xml"); logger.info("starting of the browser"); if(browser.equals("chrome")) { System.setProperty("webdriver.chrome.driver", "./Drivers/chromedriver.exe"); driver = new ChromeDriver(); } else { System.setProperty("webdriver.firefox.driver", "./Drivers/firefoxdriver.exe"); driver = new FirefoxDriver(); } driver.get("https://yoaspire.com"); driver.manage().window().maximize(); } @AfterSuite public void baseClose() { reports.endTest(etest); reports.flush(); } }
7216c4fbfdcbc55fc2c0957e470859b4b59151cc
9f43b8c8486bebb7c9e559c1d86176e82b3ba51a
/src/main/java/ws/payper/gateway/lightning/LightningNetworkConfiguration.java
c1acfdfc2a5fa26f1e59f7c6f77db104f6985d59
[ "Apache-2.0" ]
permissive
badJAVAlitta/payper-gateway
e30a2c2b4168e2639a4cc4bde4e53f5e2e203076
d3479859e826d71335a07ac9754a68ceefe5e8cc
refs/heads/master
2020-04-17T14:55:40.073364
2018-12-28T16:17:22
2018-12-28T16:17:22
166,678,087
0
0
Apache-2.0
2019-01-20T15:40:55
2019-01-20T15:40:54
null
UTF-8
Java
false
false
1,128
java
package ws.payper.gateway.lightning; import org.lightningj.lnd.wrapper.ClientSideException; import org.lightningj.lnd.wrapper.SynchronousLndAPI; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import ws.payper.gateway.hedera.NetworkCommunicationException; import javax.net.ssl.SSLException; import java.io.File; @Configuration @PropertySource("classpath:lightning-conn.properties") public class LightningNetworkConfiguration { @Value("${rpcserver.host}") private String host; @Value("${rpcserver.port}") private int port; @Value("${tlscert.path}") private File tlsCert; @Value("${macaroon.path}") private File macaroon; @Bean public SynchronousLndAPI synchronousLndAPI() { try { return new SynchronousLndAPI(host, port, tlsCert, macaroon); } catch (SSLException | ClientSideException e) { throw new NetworkCommunicationException(e); } } }
b4a014455594b4c426b96f50a4350a4dd8162fe1
fadfc40528c5473c8454a4835ba534a83468bb3b
/domain-services/jbb-frontend/src/main/java/org/jbb/frontend/impl/faq/FaqCaches.java
2b15b2c7952c5e17ac19522f68f88b2bd8733a78
[ "Apache-2.0" ]
permissive
jbb-project/jbb
8d04e72b2f2d6c088b870e9a6c9dba8aa2e1768e
cefa12cda40804395b2d6e8bea0fb8352610b761
refs/heads/develop
2023-08-06T15:26:08.537367
2019-08-25T21:32:19
2019-08-25T21:32:19
60,918,871
4
3
Apache-2.0
2023-09-01T22:21:04
2016-06-11T17:20:33
Java
UTF-8
Java
false
false
455
java
/* * Copyright (C) 2019 the original author or authors. * * This file is part of jBB Application Project. * * Licensed under the Apache License, Version 2.0 (the "License"); * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 */ package org.jbb.frontend.impl.faq; import lombok.experimental.UtilityClass; @UtilityClass public class FaqCaches { public static final String FAQ = "frontend.faq"; }
c2ec0a5e620652cabc2848cec90d605eb28b63a3
b4ecac83e691891979e5c6a493a4a6fde4ec6267
/MoneyDistribution/HelloWorldFunction/src/main/java/distribution/adapter/database/MoneyDistRepoDynamoDB.java
f8129bf5eb3cf92e02a4e6198ef2f41cf3f1bd59
[ "MIT" ]
permissive
scottbae1101/money-distribution
c4252734e0c48d2b06e346cae20e13844841113f
8af501b0491e6e57b3b14c99545ee7dac10b95db
refs/heads/develop
2023-01-23T21:42:11.075035
2020-11-23T15:24:31
2020-11-23T15:24:31
314,113,372
0
0
MIT
2020-11-23T15:24:32
2020-11-19T02:21:53
Java
UTF-8
Java
false
false
8,876
java
package distribution.adapter.database; import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder; import com.amazonaws.services.dynamodbv2.document.*; import com.amazonaws.services.dynamodbv2.document.spec.QuerySpec; import com.amazonaws.services.dynamodbv2.document.spec.UpdateItemSpec; import com.amazonaws.services.dynamodbv2.document.utils.ValueMap; import com.amazonaws.services.dynamodbv2.model.*; import distribution.application.repository.MoneyDistRepository; import distribution.application.usecase.GetMoneyDistUsecase; import distribution.application.usecase.UpdateMoneyDistUsecase; import distribution.entity.MoneyDistribution; import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; public class MoneyDistRepoDynamoDB implements MoneyDistRepository { public static final String ATTR_TOKEN_PK = "PK"; public static final String ATTR_OWNER_ID = "ownerId"; public static final String ATTR_ROOM_ID = "roomId"; public static final String ATTR_CREATE_EPOCH = "createEpoch"; public static final String ATTR_TOTAL_AMOUNT = "totalAmount"; public static final String ATTR_GUEST_CNT = "guestCnt"; public static final String ATTR_DISTRIBUTE_REMAINING_LIST = "distributeRemainingList"; public static final String FORMAT_PK_TOKEN = "TOKEN#%s"; public static final int RESPONSE_OK = 200; public static final String ATTR_DISTRIBUTE_INFO_MAP = "distributeInfoMap"; private final AmazonDynamoDB ddb; private String tableName; public MoneyDistRepoDynamoDB() { ddb = AmazonDynamoDBClientBuilder.standard().build(); tableName = System.getenv("DDB_NAME") == null ? "money-distribution" : System.getenv("DDB_NAME"); } @Override public boolean save(MoneyDistribution newDistribution) { String ownerId = newDistribution.getOwnerId(); String roomId = newDistribution.getRoomId(); String token = String.format(FORMAT_PK_TOKEN, newDistribution.getToken()); String createEpoch = String.valueOf(newDistribution.getCreateEpoch()); String totalAmount = String.valueOf(newDistribution.getTotalAmount()); String guestCnt = String.valueOf(newDistribution.getGuestCnt()); List<AttributeValue> distributeRemainingList = newDistribution.getDistributeRemainingList() .stream() .map(each -> new AttributeValue().withN(String.valueOf(each))) .collect(Collectors.toList()); Map<String, AttributeValue> distInfoMap = new HashMap<>(); newDistribution.getDistributeInfoMap().forEach((s, integer) -> distInfoMap.put(s, new AttributeValue().withN(String.valueOf(integer)))); Map<String, AttributeValue> item = new HashMap<>(); item.put(ATTR_OWNER_ID, (new AttributeValue()).withS(ownerId)); item.put(ATTR_ROOM_ID, (new AttributeValue()).withS(roomId)); item.put(ATTR_TOKEN_PK, (new AttributeValue()).withS(token)); item.put(ATTR_CREATE_EPOCH, (new AttributeValue()).withN(createEpoch)); item.put(ATTR_TOTAL_AMOUNT, (new AttributeValue()).withN(totalAmount)); item.put(ATTR_GUEST_CNT, (new AttributeValue()).withN(guestCnt)); item.put(ATTR_DISTRIBUTE_REMAINING_LIST, (new AttributeValue().withL(distributeRemainingList))); item.put(ATTR_DISTRIBUTE_INFO_MAP, (new AttributeValue().withM(distInfoMap))); PutItemRequest putItemRequest = (new PutItemRequest()) .withTableName(tableName) .withConditionExpression("attribute_not_exists(" + ATTR_TOKEN_PK + ")") .withItem(item); PutItemResult putItemResult = ddb.putItem(putItemRequest); int actualCode = putItemResult.getSdkHttpMetadata().getHttpStatusCode(); if (actualCode != RESPONSE_OK) { return false; } return true; } @Override public int updateDistribution(UpdateMoneyDistUsecase.RequestDTO req) { String token = req.getToken(); String tokenPk = String.format(FORMAT_PK_TOKEN, token); String userId = req.getUserId(); String roomId = req.getRoomId(); long epoch10MinAgo = req.getRequestEpoch() - 60 * 10; try { DynamoDB dynamoDB = new DynamoDB(ddb); Table table = dynamoDB.getTable(tableName); UpdateItemOutcome outcome = checkAndUpdateDistribution(tokenPk, userId, roomId, epoch10MinAgo, table); List<BigDecimal> distributeRemainingList = (List) outcome.getItem().get("distributeRemainingList"); int money = distributeRemainingList.get(0).toBigInteger().intValue(); updateDistributionInfo(tokenPk, userId, money); updateRecvUsers(tokenPk, userId, table); return money; } catch (Exception e) { System.err.println(e.getMessage()); throw e; } } private UpdateItemOutcome checkAndUpdateDistribution(String tokenPk, String userId, String roomId, long epoch10MinAgo, Table table) { // fail: token invalid // fail: userId == ownerId // fail: roomId != roomId // fail: check time(>10min) // fail: userId in recvUsers UpdateItemSpec updateItemSpec = new UpdateItemSpec().withPrimaryKey("PK", tokenPk) .withConditionExpression("attribute_exists(PK)" + " AND " + "createEpoch >= :epoch AND " + "ownerId <> :user AND " + "roomId = :room AND " + "not attribute_exists(" + userId + ") AND " + "size(distributeRemainingList) >= :sizeVal") .withValueMap( new ValueMap().withNumber(":epoch", epoch10MinAgo) .withString(":user", userId) .withString(":room", roomId) .withNumber(":sizeVal", 1) ) .withUpdateExpression("REMOVE distributeRemainingList[0]") .withReturnValues(ReturnValue.ALL_OLD); UpdateItemOutcome outcome = table.updateItem(updateItemSpec); return outcome; } private void updateDistributionInfo(String tokenPk, String userId, int money) { Map<String, AttributeValue> expressionAttributeValues = new HashMap<>(); Map<String, AttributeValue> key = new HashMap<String, AttributeValue>(); key.put(ATTR_TOKEN_PK, new AttributeValue().withS(tokenPk)); expressionAttributeValues.put(":user", (new AttributeValue()).withN(String.valueOf(money))); UpdateItemRequest updateItemRequest = new UpdateItemRequest().withTableName(tableName).withKey(key) .withUpdateExpression("SET " + userId + " = :user") .withExpressionAttributeValues(expressionAttributeValues).withReturnValues(ReturnValue.NONE); ddb.updateItem(updateItemRequest); } private void updateRecvUsers(String tokenPk, String userId, Table table) { Map<String, String> expressionAttributeNames = new HashMap<String, String>(); expressionAttributeNames.put("#A", "recvUsers"); Map<String, Object> expressionAttributeValues = new HashMap<String, Object>(); expressionAttributeValues.put(":val1", new HashSet<String>(Arrays.asList(userId))); table.updateItem(ATTR_TOKEN_PK, tokenPk, "add #A :val1", expressionAttributeNames, expressionAttributeValues); } @Override public GetMoneyDistUsecase.ResponseDTO getDistribution(String token) { DynamoDB dynamoDB = new DynamoDB(ddb); Table table = dynamoDB.getTable(tableName); QuerySpec querySpec = buildQueryParam(token); GetMoneyDistUsecase.ResponseDTO res = new GetMoneyDistUsecase.ResponseDTO(); try { ItemCollection<QueryOutcome> items = table.query(querySpec); Iterator<Item> iterator = items.iterator(); Item item = null; while (iterator.hasNext()) { item = iterator.next(); } res.setCreateEpoch(item.getBigInteger("createEpoch").intValue()); res.setTotalAmount(item.getBigInteger("totalAmount").intValue()); res.setOwnerId(item.getString("ownerId")); if(item != null) { res.setToken(token); } HashMap<String, Integer> distInfoMap = new HashMap<>(); ArrayList<HashMap<String, Integer>> list = new ArrayList<>(); list.add(distInfoMap); res.setDistributionList(list); List<String> recvUsers = item.getList("recvUsers"); int distributedAmount = 0; for (String recvUser : recvUsers) { int money = item.getBigInteger(recvUser).intValue(); distributedAmount += money; distInfoMap.put(recvUser, money); } res.setDistributedAmount(distributedAmount); res.setSucceeded(true); return res; } catch (Exception e) { System.err.println(e.getMessage()); } return res; } private QuerySpec buildQueryParam(String token) { HashMap<String, String> nameMap = new HashMap<>(); nameMap.put("#pk", "PK"); HashMap<String, Object> valueMap = new HashMap<>(); valueMap.put(":pk", String.format(FORMAT_PK_TOKEN, token)); QuerySpec querySpec = new QuerySpec().withKeyConditionExpression("#pk = :pk").withNameMap(nameMap) .withValueMap(valueMap); return querySpec; } }
7835caf38233866404ff232fdf4f19628d9bec59
e177289569324127b5710781f23fb6490eb7a2ae
/Lvl-1/Java-Basics/Java-Basics-Exam-Preparation/11-04-2014-Evening/src/_2_Illuminati.java
144f0bd4f9bc9e14055622c32f321875746b854d
[]
no_license
kbabacheva/Software-University
6e27000863ba812b7831d909eeeea4230fe3b9c5
0fe2dc262968ecd8ac004dc6315895c7f9cc9f7a
refs/heads/master
2020-08-07T06:34:58.533437
2015-10-21T14:13:04
2015-10-21T14:13:04
24,787,318
0
0
null
null
null
null
UTF-8
Java
false
false
846
java
import java.util.Scanner; public class _2_Illuminati { public static void main(String[] args) { Scanner input = new Scanner(System.in); String str = input.nextLine(); char[] charArray = str.toCharArray(); int counter = 0; int sumVowels = 0; for (int i = 0; i < charArray.length; i++) { if (charArray[i] == 'a' || charArray[i] == 'A') { counter++; sumVowels += 65; } if (charArray[i] == 'e' || charArray[i] == 'E') { counter++; sumVowels += 69; } if (charArray[i] == 'i' || charArray[i] == 'I') { counter++; sumVowels += 73; } if (charArray[i] == 'o' || charArray[i] == 'O') { counter++; sumVowels += 79; } if (charArray[i] == 'u' || charArray[i] == 'U') { counter++; sumVowels += 85; } } System.out.println(counter); System.out.println(sumVowels); } }
19ed9b828ab16255dfded792aca6567df286c79b
2d997f9fe5ecfafb97b3a73dc4c539fcda647a9b
/sources/com/ftdi/j2xx/FT_EEPROM.java
abca427bcfc7d2d80813735c38f3eb50a4757f34
[]
no_license
Riora-Innovations/reverse-eng
31af20c8496ecde2af55e02785c37892a8d0e043
613f537d9807d81fa5f6c11bffb31c0c0449bf19
refs/heads/master
2022-12-05T09:02:05.477417
2020-08-29T01:49:52
2020-08-29T01:49:52
291,220,650
0
0
null
null
null
null
UTF-8
Java
false
false
492
java
package com.ftdi.j2xx; public class FT_EEPROM { public short DeviceType = 0; public String Manufacturer = "FTDI"; public short MaxPower = 90; public String Product = "USB <-> Serial Converter"; public short ProductId = 24577; public boolean PullDownEnable = false; public boolean RemoteWakeup = false; public boolean SelfPowered = false; public boolean SerNumEnable = true; public String SerialNumber = "FT123456"; public short VendorId = 1027; }
ce313dd7e1e7a1ab4ef599d288a15d89d31f02da
fb971a17a7d5f8216c7e80bbc31be4b1e228a820
/spring-hessian-learn/src/main/java/com/nchu/learn/hessian/service/impl/DemoHessianServiceImpl.java
629d6147effc472190bd833358be06f6979fa6ce
[]
no_license
CodeWorkerCoding/-training-ground
17f1251068b4d491251fd4d1a5ca2d3d53ddd31d
d2d3c8682353e7fb1b75e0fa99f03f5bf66f0fe9
refs/heads/master
2021-09-18T14:36:21.903077
2018-07-16T01:42:22
2018-07-16T01:42:22
110,770,494
0
0
null
null
null
null
UTF-8
Java
false
false
360
java
package com.nchu.learn.hessian.service.impl; import com.nchu.learn.hessian.service.DemoHessianService; /** * @author fujianjian * @project self-learn * @date 2018/1/2 17:23 */ public class DemoHessianServiceImpl implements DemoHessianService { @Override public String sayHello(String userName) { return "hello world" + userName; } }
fe16540966e115341e01d812802ca081763f0f50
6bc6aa1dce4929e79113cfd3ebaa0107ebaee24c
/src/main/java/ApplaudoStudios/Factory/DriverFactory.java
597258716597d9d3722f6776a626ef3260595b67
[]
no_license
j4lli0t/appStTask
fe30b1759d3c1786e3180a8755c52547801a0ea3
2121e4a2423d99d863c570bf42a2672faa1196fc
refs/heads/main
2023-05-02T19:06:07.357069
2021-05-29T17:08:55
2021-05-29T17:08:55
371,853,694
1
0
null
null
null
null
UTF-8
Java
false
false
1,926
java
package ApplaudoStudios.Factory; import io.github.bonigarcia.wdm.WebDriverManager; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.Properties; public class DriverFactory { private Properties properties; private OptionsManager optionsManager; public static ThreadLocal<WebDriver> driver = new ThreadLocal<>(); private InputStream file; public DriverFactory() { this.file = DriverFactory.class.getResourceAsStream("/config.properties"); } public WebDriver initDriver(Properties properties) { optionsManager = new OptionsManager(properties); String typeOfBrowser = properties.getProperty("browser").trim(); if(typeOfBrowser.equalsIgnoreCase("chrome")) { WebDriverManager.chromedriver().setup(); driver.set(new ChromeDriver(optionsManager.getChromeOptions())); }else if (typeOfBrowser.equalsIgnoreCase("firefox")) { WebDriverManager.firefoxdriver().setup(); driver.set(new FirefoxDriver(optionsManager.getFirefoxOptions())); }else System.out.println("Invalid name for browser" + typeOfBrowser); return getDriver(); } public WebDriver getDriver() { return driver.get(); } public Properties initProperties() throws FileNotFoundException { properties = new Properties(); try { properties.load(this.file); }catch (FileNotFoundException error) { System.out.println("File not found"); error.printStackTrace(); }catch (IOException error) { error.printStackTrace(); } return properties; } }
f3db4511b202b5a513a9ef1a917ebecf9352ad41
47cb5f4954bf3a7231a043dff5f9285d2265a34d
/src/com/luv2code/springdemo/HappyFortuneService.java
0bbf57d5ee254a82d1920db20685f4c8db01b258
[]
no_license
Kimi323/java-spring-learning
dc25c8586138ba3ffd21115250409b3cec1bbab4
3d0c88a945703ec53d6e6b0ce8778beb9b391293
refs/heads/master
2020-03-09T10:52:00.923447
2018-11-20T05:46:30
2018-11-20T05:46:30
128,747,111
0
0
null
null
null
null
UTF-8
Java
false
false
190
java
package com.luv2code.springdemo; public class HappyFortuneService implements FortuneService { @Override public String getFortune() { return "today is your lucky day!"; } }
f89c2cc672ec1c23ad08980ba7c1b63e850886b8
975dd2b911554103981d63cfd231e1225bf9fec0
/app/src/main/java/com/lida/carcare/activity/ActivityZhuXiao.java
f03c5c2ed5a31bc9304d3cb6c5721528ce34248c
[]
no_license
Asher-fei/CarCare
02b94c86e56c80bf1158736ce97d37483c93d345
07757477284219a82767b52cbfbbb6f8bf21728e
refs/heads/master
2020-04-03T06:34:49.305077
2017-09-21T03:33:33
2017-09-21T03:33:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,192
java
package com.lida.carcare.activity; import android.os.Bundle; import android.widget.Button; import android.widget.TextView; import com.lida.carcare.R; import com.midian.base.base.BaseActivity; import com.midian.base.util.UIHelper; import com.midian.base.widget.BaseLibTopbarView; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; /** * 注销账号 * Created by WeiQingFeng on 2017/5/3. */ public class ActivityZhuXiao extends BaseActivity { @BindView(R.id.topbar) BaseLibTopbarView topbar; @BindView(R.id.btnZhuXiao) Button btnZhuXiao; @BindView(R.id.tvPhone) TextView tvPhone; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_zhuxiao); ButterKnife.bind(this); topbar.setTitle("注销账号"); topbar.setLeftImageButton(R.drawable.icon_back, UIHelper.finish(_activity)); tvPhone.setText("将"+ac.phone+"所绑定的账号注销"); } @OnClick(R.id.btnZhuXiao) public void onViewClicked() { finish(); UIHelper.t(_activity, "账号已注销!"); } }
4c8782401d4014e051755b967a8d6bfe07541a0d
029748ec1e1a1e507a75b7708643ce37f5b31e28
/src/main/java/com/ty/com/base/ObjectOriented/interfaces/Engine.java
64e07bdac2deb4536f099fc03fd848c48fcfce6c
[]
no_license
newruby/JavaBase
75ca3f33a7004dca9ada74496f1f655fafd685f8
d33630942c49bd0d7820de3021d10fe2a430e107
refs/heads/master
2020-03-15T19:02:08.038122
2018-05-29T12:32:37
2018-05-29T12:32:37
132,298,593
0
0
null
null
null
null
UTF-8
Java
false
false
291
java
package com.ty.com.base.ObjectOriented.interfaces; /** * created by TY on 2018/5/12. */ /** * 汽车和发动机之间接口 * 生产汽车的厂家面向接口生产 * 生产发动机的厂家面向接口生产 * @param * @return */ public interface Engine { void start(); }
d4280fdeb5f3163f479380fc738a7999ea2f6b85
c4253c364268dfc00452d34a848f12221106f882
/src/com/szkingdom/bean/pojo/system/Users.java
915ac77a756fe03f36f7fa999e009e925fddf669
[]
no_license
214175590/okrs
c281b066bf11d1c64fd0fee84f40424eb0e3d4fc
cbb20cb745ddba3981da6cf76d6bf893fa2af942
refs/heads/master
2020-03-29T12:26:53.377560
2018-01-17T03:14:10
2018-01-17T03:14:10
27,983,627
1
0
null
null
null
null
UTF-8
Java
false
false
2,871
java
package com.szkingdom.bean.pojo.system; public class Users { private String id; private String userName; private String password; private String name; private String sex; private String userIp; private String mobile; private String email; private String registerDate; private String lastLoginDate; private int onlines; // 在线状态(在线,离线) private String entrance;//入口 web、mobile // 额外属性 private int size; // 记录数 private String idstr; // 多个ID字符串 private String orderby; // 结果列表排序字段 private String keyword; // 搜索关键字 private int fromIndex; // 分页开始索引 private int toIndex; // 分页结束索引 public String getId() { return id; } public void setId(String id) { this.id = id; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public String getUserIp() { return userIp; } public void setUserIp(String userIp) { this.userIp = userIp; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getRegisterDate() { return registerDate; } public void setRegisterDate(String registerDate) { this.registerDate = registerDate; } public String getLastLoginDate() { return lastLoginDate; } public void setLastLoginDate(String lastLoginDate) { this.lastLoginDate = lastLoginDate; } public int getOnlines() { return onlines; } public void setOnlines(int onlines) { this.onlines = onlines; } public String getEntrance() { return entrance; } public void setEntrance(String entrance) { this.entrance = entrance; } public int getSize() { return size; } public void setSize(int size) { this.size = size; } public String getIdstr() { return idstr; } public void setIdstr(String idstr) { this.idstr = idstr; } public String getOrderby() { return orderby; } public void setOrderby(String orderby) { this.orderby = orderby; } public String getKeyword() { return keyword; } public void setKeyword(String keyword) { this.keyword = keyword; } public int getFromIndex() { return fromIndex; } public void setFromIndex(int fromIndex) { this.fromIndex = fromIndex; } public int getToIndex() { return toIndex; } public void setToIndex(int toIndex) { this.toIndex = toIndex; } }
16bdd36a699bd8c63be5864588457d038f420980
e0c8cbd8d5d63a813bd0b60f5a7d14f56424fb64
/WorkSheet_Linux/src/dx/timesheet/IconifyUtilityClass.java
625cbc6a7f1236052c28ae9212809a6820a056b6
[]
no_license
Naman550/Project
56618bb1220c3e3b242a4f73a02eb511bc87095f
ff18d328c8e168fdb3250134d9a614ee3f459378
refs/heads/master
2021-01-12T17:22:04.103937
2017-03-08T12:04:23
2017-03-08T12:04:23
71,549,883
1
0
null
null
null
null
UTF-8
Java
false
false
1,106
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package dx.timesheet; /** * * @author Me */ import java.awt.Component; import java.awt.Window; import com.sun.jna.Library; import com.sun.jna.Native; import com.sun.jna.platform.win32.WinDef.HWND; import com.sun.jna.platform.unix.X11; public class IconifyUtilityClass { public static void minimize(Window window) { // HWND hWnd = getHWND(window); // User32dll.INSTANCE.CloseWindow(hWnd); //call CloseWindow with this windows handle } public static void restore(Window window) { // HWND hWnd = getHWND(window); // User32dll.INSTANCE.OpenIcon(hWnd); //call OpenIcon with this windows handle } private interface User32dll extends Library { // User32dll INSTANCE = (User32dll) Native.loadLibrary("libX11.so", User32dll.class); // boolean OpenIcon(HWND hWnd); // boolean CloseWindow(HWND hWnd); } private static HWND getHWND(Component comp) { return new HWND(Native.getComponentPointer(comp)); } }
8c769fe9d9e9b14ef9d0d6e4c4eae6a62761c703
1de783743c24c5c8a3b02bf0ec5005733ccfc6d8
/NetBeansProjects/Matrizes/src/matrizes/Exercicio22.java
bfe3a923c7715e50cbdf5f16a4122c1203bb16fa
[]
no_license
X0Roger0X/Banco-de-Dados
5e3d9cc65f106050597123f7e0b39e035bdc2a77
5a645ba79f143f335a1978ad73085eec712c7322
refs/heads/master
2020-07-19T11:29:12.190594
2019-10-31T00:42:17
2019-10-31T00:42:17
206,440,093
0
0
null
null
null
null
UTF-8
Java
false
false
1,073
java
/* Algoritmos e Lógica de Programação I Prof. Dr. Fernando Almeida e Prof. Me. Willian Honda LISTA DE EXERCÍCIOS Matriz JAVA Roger Araujo dos Reis Turma: A Exercício 22: Dada uma matriz de tamanho N x M, de números inteiros, fazer um programa que preenche e imprime cada elemento da matriz com o número 20. */ package matrizes; public class Exercicio22 { public static void main(String[] args) { int n = 2; int m = 4; int[][] matriz = new int[n][m]; System.out.println("VALORES INICIAIS"); for(int i =0; i < matriz.length; i++){ for(int j =0; j < matriz.length; j++){ System.out.println("matriz: "+matriz[i][j]); } } System.out.println("VALORES FINAIS"); for(int i =0; i < matriz.length; i++){ for(int j =0; j < matriz.length; j++){ matriz[i][j]=20; System.out.println("matriz: "+matriz[i][j]); } } } }
eb03406bce3d5830e833b682a0bf1f2bda6fe365
e6bfcae15ba55fa3a70b9d2d4deffd96b00f6d8e
/Lab2/src/gmm/GMM.java
8eb4163b9e2d6625a381d475cd84afb03e92d9f7
[]
no_license
MingyanZHU/BigData_Anaylize
9268aa440f1b1a2c96bb676e922901dfe1b30c0a
8ae86a2c1bd8da13dbb06a113920e745e343ebf4
refs/heads/master
2022-01-10T07:22:51.738986
2019-06-30T12:35:38
2019-06-30T12:35:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,605
java
package gmm; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import java.io.IOException; import java.net.URI; public class GMM { public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException { int numberMix = 8; int featuresNumber = 68; Configuration configuration = new Configuration(); configuration.setInt("gmm.num.mix", numberMix); configuration.setInt("gmm.features.number", featuresNumber); Job job = Job.getInstance(configuration); job.setJobName("GMM Init"); job.setJarByClass(GMM.class); job.setMapperClass(GMMInitMapper.class); job.setReducerClass(GMMInitReducer.class); job.setOutputKeyClass(IntWritable.class); job.setOutputValueClass(Text.class); long x = 768 * 1024 * 1024; long y = 512 * 1024 * 1024; FileInputFormat.setMaxInputSplitSize(job, x); FileInputFormat.setMinInputSplitSize(job, y); FileInputFormat.addInputPath(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1] + "_m_0")); job.waitForCompletion(true); int iteration = 1; int MAX_ITERATION = 20; while (iteration < MAX_ITERATION) { String uri = args[1] + "_m_" + (iteration - 1) + "/part-r-00000"; Configuration fileConf = new Configuration(); FileSystem fileSystem = FileSystem.get(URI.create(uri), fileConf); Path inputPath = new Path(uri); FSDataInputStream inputStream = fileSystem.open(inputPath); String[] mu = new String[numberMix]; String[] sigma = new String[numberMix]; double[] pi = new double[numberMix]; for (int i = 0; i < numberMix; i++) { String line = inputStream.readLine(); String[] temp = line.split("\t"); pi[i] = Double.parseDouble(temp[1]); mu[i] = temp[2]; sigma[i] = temp[3]; } Configuration gmmConf = new Configuration(); for (int i = 0; i < numberMix; i++) { gmmConf.set("gmm.sigma." + i, sigma[i]); gmmConf.set("gmm.mu." + i, mu[i]); gmmConf.setDouble("gmm.pi." + i, pi[i]); } gmmConf.setInt("gmm.num.mix", numberMix); gmmConf.setInt("gmm.features.number", featuresNumber); Job gmm = Job.getInstance(gmmConf); gmm.setJarByClass(GMM.class); gmm.setJobName("GMM " + iteration); gmm.setMapperClass(GMMMapper.class); // TODO 迭代一轮后的协方差矩阵为奇异矩阵 gmm.setReducerClass(GMMReducer.class); gmm.setOutputKeyClass(IntWritable.class); gmm.setOutputValueClass(Text.class); x = 16 * 1024 * 1024; FileInputFormat.setMaxInputSplitSize(gmm, x); FileInputFormat.setMinInputSplitSize(gmm, x); FileInputFormat.addInputPath(gmm, new Path(args[2])); FileOutputFormat.setOutputPath(gmm, new Path(args[1] + "_m_" + iteration)); gmm.waitForCompletion(true); iteration++; } } }
4168b3f19d620b784ec8ff9882e1e6c45a3bd30c
e55733dcd7705530411b176b016f5961695d6c71
/zndc/src/cn/com/bjggs/ctr/util/SmartOnew.java
35399495a1f8bab076673e9210fa5e2324df1608
[]
no_license
meng0195/fp
9e7a3c8ce41f524d8121e33632f0fb0b5914d770
222f49dd19760c8971ad87392266fe8f443e60a0
refs/heads/master
2021-09-08T23:20:56.638143
2019-02-26T06:39:38
2019-02-26T06:39:38
172,647,194
0
0
null
null
null
null
UTF-8
Java
false
false
13,897
java
package cn.com.bjggs.ctr.util; import java.net.InetSocketAddress; import org.nutz.lang.Strings; import cn.com.bjggs.basis.domain.EquipIps; import cn.com.bjggs.basis.domain.Equipment; import cn.com.bjggs.basis.util.DwrUtil; import cn.com.bjggs.basis.util.HouseUtil; import cn.com.bjggs.basis.util.HouseUtil.TypeHouseConf; import cn.com.bjggs.core.util.JsonUtil; import cn.com.bjggs.ctr.domain.CtrMsg; import cn.com.bjggs.warns.domain.AlarmNotes; /** * 设备控制单项风机模式工具 * @author wc * @date 2017-10-01 */ public class SmartOnew implements SmartModel{ //private static final byte[] WRITES = new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x01, 0x10, (byte)0xD9, 0x3A, 0x00, 0x0C, 0x18, 0x12, 0x00, 0x12, 0x00, 0x12, 0x00, 0x12, 0x00, 0x12, 0x00, 0x12, 0x00, 0x12, 0x00, 0x12, 0x00, 0x12, 0x00, 0x12, 0x00, 0x12, 0x00, 0x12, 0x00}; //写单个指令 private static final byte[] WRITE = new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x01, 0x06, (byte)0xD9, 0x3A, 0x00, 0x00}; //读指令全部 private static final byte[] READ = new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x01, 0x03, (byte)0xD9, 0x39, 0x00, 0x0D}; private static final int len = CtrConstant.CTR_READ_LEN + READ[11] * 2; private InetSocketAddress address; private CtrMbs mbs = new CtrMbs(); public SmartOnew(EquipIps ips){ this.address = new InetSocketAddress(ips.getOnewIp(), ips.getOnewPort()); } public int open(Equipment equip, AlarmNotes an0) { int tag = 0; //验证模式是否正确 byte[] req = mbs.sendMsg(READ, address, len); if(req == null || req.length < 11 || req[10]%16 != CtrConstant.ONEW) throw new RuntimeException("控制板模式验证错误!"); if(req[10]/16 != CtrConstant.LINE) throw new RuntimeException("当前非联网模式,不能通过系统完成控制!"); if(equip != null){ int index = 12 + equip.getRegisterWay() * 2; if(Strings.isNotBlank(equip.getBindIp())){ byte[] bind = new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x01, 0x06, (byte)0xD9, (byte)(0x3A + equip.getBindRegister()), 0x00, CtrConstant.M1O}; CtrMbs bm = new CtrMbs(); InetSocketAddress ad = null; EquipIps ips = HouseUtil.get(equip.getHouseNo(), TypeHouseConf.EIPS.code(), EquipIps.class); if(equip.getBindModel() == 1){ ad = new InetSocketAddress(ips.getWindIp1(), ips.getWindPort1()); } else if(equip.getBindModel() == 2){ ad = new InetSocketAddress(ips.getWindIp2(), ips.getWindPort2()); } else { ad = new InetSocketAddress(ips.getWindIp3(), ips.getWindPort3()); } for (int i = 0; i < 6; i++) { req = bm.sendMsg(bind, ad, 12); if(i == 5){ throw new RuntimeException("启动命令发送超时!"); } if(req != null && req.length == 12 && req[11] == CtrConstant.M1O){ //前台同步讯息 DwrUtil.sendCtr(JsonUtil.toJson(new CtrMsg(equip.getHouseNo(), equip.getEquipNo(), CtrConstant.C_ING1, equip.getModel(), CtrConstant.R2OW, equip.getEquipName() + ":正在开窗!"))); //同步当前设备状态 equip.setStatus(CtrConstant.R2OW); break; } } try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } index = 12 + equip.getBindRegister() * 2; //获取状态 for (int i = 0; i < 30; i++) { try{ req = bm.sendMsg(READ, ad, len); if(req != null){ if(req[index] == CtrConstant.R1OA){ //前台同步讯息 DwrUtil.sendCtr(JsonUtil.toJson(new CtrMsg(equip.getHouseNo(), equip.getEquipNo(), CtrConstant.C_ING, equip.getModel(), CtrConstant.R2O, equip.getEquipName() + ":开窗到位!"))); //同步当前设备状态 equip.setStatus(CtrConstant.R1OA); tag = 4; break; } else if(req[index] == CtrConstant.R1F){ DwrUtil.sendCtr(JsonUtil.toJson(new CtrMsg(equip.getHouseNo(), equip.getEquipNo(), CtrConstant.C_BAD, equip.getModel(), CtrConstant.R1F, equip.getEquipName() + ":故障!"))); //同步当前设备状态 equip.setStatus(CtrConstant.R1F); addError(an0, equip.getEquipName() + ":故障!"); break; } else if(req[index] == CtrConstant.R1OT){ DwrUtil.sendCtr(JsonUtil.toJson(new CtrMsg(equip.getHouseNo(), equip.getEquipNo(), CtrConstant.C_BAD, equip.getModel(), CtrConstant.R1OT, equip.getEquipName() + ":开窗超时!"))); //同步当前设备状态 equip.setStatus(CtrConstant.R1OT); addError(an0, equip.getEquipName() + ":开窗超时!"); break; } } }catch(Exception e){} try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } if(i == 29){ throw new RuntimeException("开窗状态查询超出步长"); } } } if(Strings.isBlank(equip.getBindIp()) || tag == 4){ tag = 0; // int reg = 14 + equip.getRegisterWay() * 2; // byte[] cmd = WRITES.clone(); // cmd[reg] = CtrConstant.M2O; byte[] cmd = WRITE.clone(); cmd[9] = (byte)(0x3A + equip.getRegisterWay()); cmd[11] = CtrConstant.M2O; for (int i = 0; i < 6; i++) { req = mbs.sendMsg(cmd, address, 12); if(i == 5){ throw new RuntimeException("启动命令发送超时!"); } if(req != null && req.length == 12 && CtrConstant.M2O == req[11]){ //前台同步讯息 DwrUtil.sendCtr(JsonUtil.toJson(new CtrMsg(equip.getHouseNo(), equip.getEquipNo(), CtrConstant.C_ING, equip.getModel(), CtrConstant.R2O, equip.getEquipName() + ":正在开启,请稍候!"))); //同步当前设备状态 equip.setStatus(CtrConstant.R2O); break; } try { Thread.sleep(55); } catch (InterruptedException e) { e.printStackTrace(); } } for (int i = 0; i < 30; i++) { try { Thread.sleep(1500); } catch (InterruptedException e) { e.printStackTrace(); } req = mbs.sendMsg(READ, address, len); if(req != null){ if(req[index] == CtrConstant.R2OA){ //前台同步讯息 DwrUtil.sendCtr(JsonUtil.toJson(new CtrMsg(equip.getHouseNo(), equip.getEquipNo(), CtrConstant.C_OPEN, equip.getModel(), CtrConstant.R2OA, equip.getEquipName() + ":风机已经开启!"))); //同步当前设备状态 equip.setStatus(CtrConstant.R2OA); tag = 1; break; } else if(req[index] == CtrConstant.R2N){ DwrUtil.sendCtr(JsonUtil.toJson(new CtrMsg(equip.getHouseNo(), equip.getEquipNo(), CtrConstant.C_BAD, equip.getModel(), CtrConstant.R2N, equip.getEquipName() + ":故障!"))); //同步当前设备状态 equip.setStatus(CtrConstant.R2N); addError(an0, equip.getEquipName() + ":故障!"); break; } else if(req[index] == CtrConstant.R2F){ DwrUtil.sendCtr(JsonUtil.toJson(new CtrMsg(equip.getHouseNo(), equip.getEquipNo(), CtrConstant.C_BAD, equip.getModel(), CtrConstant.R2F, equip.getEquipName() + ":负载超载!"))); //同步当前设备状态 equip.setStatus(CtrConstant.R2F); addError(an0, equip.getEquipName() + ":负载超载!"); break; } } if(i == 29){ throw new RuntimeException("开窗状态查询超出步长"); } } } } return tag; } public int close(Equipment equip, AlarmNotes an0) { int tag = 0; //验证模式是否正确 byte[] req = mbs.sendMsg(READ, address, len); if(req == null || req.length < 11 || req[10]%16 != CtrConstant.ONEW) throw new RuntimeException("控制板模式验证错误!"); if(req[10]/16 != CtrConstant.LINE) throw new RuntimeException("当前非联网模式,不能通过系统完成控制!"); if(equip != null){ int index = 12 + equip.getRegisterWay() * 2; // int reg = 14 + equip.getRegisterWay() * 2; // byte[] cmd = WRITES.clone(); // cmd[reg] = CtrConstant.M2S; byte[] cmd = WRITE.clone(); cmd[9] = (byte)(0x3A + equip.getRegisterWay()); cmd[11] = CtrConstant.M2S; for (int i = 0; i < 6; i++) { req = mbs.sendMsg(cmd, address, 12); if(i == 5){ throw new RuntimeException("关闭命令发送超时!"); } if(req != null && req.length == 12 && CtrConstant.M2S == req[11]){ //前台同步讯息 DwrUtil.sendCtr(JsonUtil.toJson(new CtrMsg(equip.getHouseNo(), equip.getEquipNo(), CtrConstant.C_ING, equip.getModel(), CtrConstant.M2S, equip.getEquipName() + ":正在关闭,请稍候!"))); //同步当前设备状态 equip.setStatus(CtrConstant.M2S); break; } } for (int i = 0; i < 30; i++) { try { Thread.sleep(1500); } catch (InterruptedException e) { e.printStackTrace(); } req = mbs.sendMsg(READ, address, len); if(req != null){ if(req[index] == CtrConstant.R2SA){ //前台同步讯息 DwrUtil.sendCtr(JsonUtil.toJson(new CtrMsg(equip.getHouseNo(), equip.getEquipNo(), CtrConstant.C_CLOSE, equip.getModel(), CtrConstant.R2SA, equip.getEquipName() + ":风机已停止!"))); //同步当前设备状态 equip.setStatus(CtrConstant.R2SA); tag = 1; break; } else if(req[index] == CtrConstant.R2N){ DwrUtil.sendCtr(JsonUtil.toJson(new CtrMsg(equip.getHouseNo(), equip.getEquipNo(), CtrConstant.C_BAD, equip.getModel(), CtrConstant.R2N, equip.getEquipName() + ":故障!"))); //同步当前设备状态 equip.setStatus(CtrConstant.R2N); addError(an0, equip.getEquipName() + ":故障!"); break; } else if(req[index] == CtrConstant.R2F){ DwrUtil.sendCtr(JsonUtil.toJson(new CtrMsg(equip.getHouseNo(), equip.getEquipNo(), CtrConstant.C_BAD, equip.getModel(), CtrConstant.R2F, equip.getEquipName() + ":负载超载!"))); //同步当前设备状态 equip.setStatus(CtrConstant.R2F); addError(an0, equip.getEquipName() + ":负载超载!"); break; } } if(i == 29){ throw new RuntimeException("关风机状态查询超出步长"); } } if(Strings.isNotBlank(equip.getBindIp())){ //关闭绑定风窗 byte[] bind = new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x01, 0x06, (byte)0xD9, (byte)(0x3A + equip.getBindRegister()), 0x00, CtrConstant.M1C}; CtrMbs bm = new CtrMbs(); InetSocketAddress ad = null; EquipIps ips = HouseUtil.get(equip.getHouseNo(), TypeHouseConf.EIPS.code(), EquipIps.class); if(equip.getBindModel() == 1){ ad = new InetSocketAddress(ips.getWindIp1(), ips.getWindPort1()); } else if(equip.getBindModel() == 2){ ad = new InetSocketAddress(ips.getWindIp2(), ips.getWindPort2()); } else { ad = new InetSocketAddress(ips.getWindIp3(), ips.getWindPort3()); } //发送关闭指令 for (int i = 0; i < 6; i++) { req = bm.sendMsg(bind, ad, 12); if(i == 5){ throw new RuntimeException("关窗命令发送超时!"); } if(req != null && req.length == 12 && req[11] == CtrConstant.M1C){ //前台同步讯息 DwrUtil.sendCtr(JsonUtil.toJson(new CtrMsg(equip.getHouseNo(), equip.getEquipNo(), CtrConstant.C_ING1, equip.getModel(), CtrConstant.R2CW, equip.getEquipName() + ":正在关窗!"))); //同步当前设备状态 equip.setStatus(CtrConstant.R2CW); break; } } try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } index = 12 + equip.getBindRegister() * 2; //获取状态 for (int i = 0; i < 30; i++) { req = mbs.sendMsg(READ, ad, len); if(req != null){ if(req[index] == CtrConstant.R1CA){ //前台同步讯息 DwrUtil.sendCtr(JsonUtil.toJson(new CtrMsg(equip.getHouseNo(), equip.getEquipNo(), CtrConstant.C_CLOSE, equip.getModel(), CtrConstant.R2SA, equip.getEquipName() + ":关闭成功!"))); //同步当前设备状态 equip.setStatus(CtrConstant.R2SA); break; } else if(req[index] == CtrConstant.R1SA){ DwrUtil.sendCtr(JsonUtil.toJson(new CtrMsg(equip.getHouseNo(), equip.getEquipNo(), CtrConstant.C_HALF, equip.getModel(), CtrConstant.R1SA, equip.getEquipName() + ":被干预,中途停止!"))); //同步当前设备状态 equip.setStatus(CtrConstant.R2SA); break; } else if(req[index] == CtrConstant.R1F){ DwrUtil.sendCtr(JsonUtil.toJson(new CtrMsg(equip.getHouseNo(), equip.getEquipNo(), CtrConstant.C_BAD, equip.getModel(), CtrConstant.R1F, equip.getEquipName() + ":故障!"))); //同步当前设备状态 equip.setStatus(CtrConstant.R1F); addError(an0, equip.getEquipName() + ":故障!"); break; } else if(req[index] == CtrConstant.R1CT){ DwrUtil.sendCtr(JsonUtil.toJson(new CtrMsg(equip.getHouseNo(), equip.getEquipNo(), CtrConstant.C_BAD, equip.getModel(), CtrConstant.R1CT, equip.getEquipName() + ":关闭超时!"))); //同步当前设备状态 equip.setStatus(CtrConstant.R1CT); addError(an0, equip.getEquipName() + ":关闭超时!"); break; } } try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } if(i == 29){ throw new RuntimeException("关窗状态查询超出步长"); } } } } return tag; } public int openr(Equipment equip, AlarmNotes an0) { return 0; } public int stop(Equipment equip, AlarmNotes an0) { return 0; } private void addError(AlarmNotes an0, String msg){ an0.setNums(an0.getNums() + 1); an0.setFaultStr((an0.getFaultStr() == null ? "" : an0.getFaultStr()) + msg + "|"); } }
743d759f9ad35b44bcf37063dec593c1304e46da
520c051fcdc1c5f746cd34d6fafcfc9ad26e045c
/app/src/test/java/com/dvipersquad/editableprofile/data/source/ProfilesRepositoryTests.java
e2662a848881eb860da3e06ef5c429886e60c150
[]
no_license
brahyam/editable-profile
4d49e51ceb72c422df1d28baac997e7223ed7077
bbd041a18df3515fc87e1ab62cebca822810a392
refs/heads/master
2020-03-30T04:21:42.646064
2018-10-01T17:30:48
2018-10-01T17:30:48
150,739,048
0
0
null
2018-10-01T17:30:49
2018-09-28T12:43:16
Java
UTF-8
Java
false
false
5,328
java
package com.dvipersquad.editableprofile.data.source; import com.dvipersquad.editableprofile.data.LocationCoordinate; import com.dvipersquad.editableprofile.data.Profile; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import java.util.Date; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.verify; public class ProfilesRepositoryTests { private static final Profile PROFILE = new Profile( "c5pQGk6vISfNAPd2", // Hardcoded Id "Test Disp Name", "Test Real Name", "TestPictureUrl.jpg", new Date(), "testGenderId", "testEthnicityId", "testReligionId", 111, "testFigureId", "testMaritalStatusId", "Test Occupation", "Test About me text", new LocationCoordinate("testLat", "testLong")); private ProfilesRepository profilesRepository; @Mock private ProfilesDataSource profilesRemoteDataSource; @Mock private ProfilesDataSource profilesLocalDataSource; @Mock private ProfilesDataSource.GetProfileCallback getProfileCallback; @Mock private ProfilesDataSource.ModifyProfileCallback modifyProfileCallback; @Captor private ArgumentCaptor<ProfilesDataSource.GetProfileCallback> getProfileCallbackCaptor; @Captor private ArgumentCaptor<ProfilesDataSource.ModifyProfileCallback> modifyProfileCallbackCaptor; @Before public void setupProfilesRepository() { MockitoAnnotations.initMocks(this); profilesRepository = new ProfilesRepository(profilesRemoteDataSource, profilesLocalDataSource); } @Test public void saveProfile_savesProfileToRemote() { // When a profile is saved profilesRepository.saveProfile(PROFILE, null); // Then profile is saved locally and cache is updated verify(profilesRemoteDataSource).saveProfile(eq(PROFILE), any(ProfilesDataSource.ModifyProfileCallback.class)); } @Test public void saveProfile_savesProfileToLocalDBAndUpdatesCache() { // When a profile is saved profilesRepository.saveProfile(PROFILE, null); setProfileSaved(profilesRemoteDataSource, PROFILE); // Then profile is saved locally and cache is updated verify(profilesLocalDataSource).saveProfile(PROFILE, null); assertThat(profilesRepository.cachedProfiles.size(), is(1)); } @Test public void getProfile_requestsSingleProfileFromLocalDataSource() { // When a profile is requested from the profiles repository profilesRepository.getProfile(PROFILE.getId(), getProfileCallback); verify(profilesLocalDataSource).getProfile(eq(PROFILE.getId()), any(ProfilesDataSource.GetProfileCallback.class)); } @Test public void getProfileWithCacheInvalidated_requestsSingleProfileFromRemoteDataSource() { profilesRepository.refreshProfiles(); // When a profile is requested from the profiles repository profilesRepository.getProfile(PROFILE.getId(), getProfileCallback); verify(profilesRemoteDataSource).getProfile(eq(PROFILE.getId()), any(ProfilesDataSource.GetProfileCallback.class)); } @Test public void deleteProfile_deleteProfileFromLocalDBAndRemovedFromCache() { // Given a profile in the repository profilesRepository.saveProfile(PROFILE, modifyProfileCallback); setProfileSaved(profilesRemoteDataSource, PROFILE); assertThat(profilesRepository.cachedProfiles.containsKey(PROFILE.getId()), is(true)); // When deleted profilesRepository.deleteProfile(PROFILE.getId(), null); // Verify the local data source is called verify(profilesLocalDataSource).deleteProfile(PROFILE.getId(), null); // Verify it's removed from cache assertThat(profilesRepository.cachedProfiles.containsKey(PROFILE.getId()), is(false)); } @Test public void getProfileWithBothDataSourcesUnavailable_firesOnDataUnavailable() { String WRONG_PROFILE_ID = "123"; // Request wrong profile profilesRepository.getProfile(WRONG_PROFILE_ID, getProfileCallback); // Data is not available locally setProfileNotAvailable(profilesLocalDataSource, WRONG_PROFILE_ID); setProfileNotAvailable(profilesRemoteDataSource, WRONG_PROFILE_ID); // Verify no data is returned verify(getProfileCallback).onDataNotAvailable(any(String.class)); } private void setProfileNotAvailable(ProfilesDataSource dataSource, String profileId) { verify(dataSource).getProfile(eq(profileId), getProfileCallbackCaptor.capture()); getProfileCallbackCaptor.getValue().onDataNotAvailable(""); } private void setProfileSaved(ProfilesDataSource dataSource, Profile profile) { verify(dataSource).saveProfile(eq(profile), modifyProfileCallbackCaptor.capture()); modifyProfileCallbackCaptor.getValue().onProfileModified(profile); } }
bcaa1b83f031404c2358bbc4e4f41cc691518608
0f46fde3a8f87c9ea3d15dcc717df4e604b2dc3a
/plugin/src/main/java/me/velz/facility/commands/BroadcastCommand.java
52dc10d57bdb6c2c0a8aa99c336c78e3018dae15
[ "MIT" ]
permissive
Zarosch/Facility
3755a13294e6b04635bfd407ba5fca46d8a12d43
17a7fe5a7af6c0a326416fb14dc154f74cc3fd0b
refs/heads/master
2021-06-23T06:34:52.777929
2020-11-29T13:44:15
2020-11-29T13:44:15
148,338,281
0
0
null
null
null
null
UTF-8
Java
false
false
1,430
java
package me.velz.facility.commands; import me.velz.facility.Facility; import me.velz.facility.utils.MessageUtil; import net.md_5.bungee.api.ChatColor; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; public class BroadcastCommand implements CommandExecutor { private final Facility plugin; public BroadcastCommand(Facility plugin) { this.plugin = plugin; } @Override public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) { if (!cs.hasPermission(plugin.getFileManager().getPermissionPrefix() + ".command.broadcast")) { cs.sendMessage(MessageUtil.PREFIX.getLocal() + MessageUtil.ERROR_NOPERMISSIONS.getLocal()); return true; } if (args.length == 0) { cs.sendMessage(MessageUtil.PREFIX.getLocal() + MessageUtil.ERROR_SYNTAX.getLocal().replaceAll("%command", "/broadcast <message>")); return true; } String message = ""; for (String msg : args) { message = message + " " + msg; } message = message.substring(1, message.length()); Bukkit.broadcastMessage(MessageUtil.CHAT_BROADCAST.getLocal().replaceAll("%message", ChatColor.translateAlternateColorCodes('&', message))); return true; } }
[ "[email protected]_w_724v_typ_a_05011603_06_003" ]
[email protected]_w_724v_typ_a_05011603_06_003
f5e7de745515390f4c0a236f5698c33705938b8e
744d57477a4e6e738c351dfa75e9d1e208dbbbbf
/version 3/src/codebase/MyChatServer.java
3b1ca82b87e4e4479c3b99021e94a4185c10a634
[]
no_license
mv740/SecureChat
882d04d05e33840c0b2e152c8eaf1cd998992a79
8a3c2a8193618b6428bb71b34a8b02d901ba22fd
refs/heads/master
2021-01-13T11:07:36.038010
2015-12-08T19:44:58
2015-12-08T19:44:58
46,068,416
0
0
null
null
null
null
UTF-8
Java
false
false
20,435
java
package codebase; import infrastructure.ChatServer; import javax.crypto.KeyAgreement; import javax.crypto.SecretKey; import javax.crypto.interfaces.DHPublicKey; import javax.crypto.spec.DHParameterSpec; import javax.json.Json; import javax.json.JsonArray; import javax.json.JsonReader; import java.io.*; import java.security.*; import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPublicKey; import java.security.spec.InvalidKeySpecException; import java.security.spec.X509EncodedKeySpec; /** * ChatServer implements the fundamental communication capabilities for your * server, but it does not take care of the semantics of the payload it carries. * <p> * Here MyChatServer (of your choice) extends it and implements the actual * server-side protocol. It must be replaced with/adapted for your designed * protocol. */ class MyChatServer extends ChatServer { /** * A Json array loaded from disk file storing plaintext uids and pwds. */ JsonArray database; /** * Client login status; "" indicates not logged in or otherwise is set to * uid. **/ String statA = ""; String statB = ""; //who is authenticated [Alice, Bob] private boolean[] Authenticated; //server nonce store. used to detect replay attack private byte[][] serverNonceStore; private byte[][] clientNonceStore; //clients Public keys RSAPublicKey[] rsaPublicKeys; //server PrivateKey RSAPrivateKey rsaPrivateKeyServer; //DH- exchange private boolean[] SECURED_MODE; private SecretKey[] symmetricKeyStore; byte[][] ivStore; byte[][] sendStoreIV; byte[][] refreshStoreIV; boolean[] gotIv; // In Constructor, the user database is loaded. MyChatServer() { //try { //InputStream in = new FileInputStream("database.json"); //JsonReader jsonReader = Json.createReader(in); //database = jsonReader.readArray(); Authenticated = new boolean[2]; SECURED_MODE = new boolean[2]; symmetricKeyStore = new SecretKey[2]; rsaPrivateKeyServer = Encryption.rsaLoadPrivateKey((new File("./certificate/private/server.key.pem")), "1q2w"); rsaPublicKeys = new RSAPublicKey[2]; serverNonceStore = new byte[2][]; clientNonceStore = new byte[2][]; ivStore = new byte[2][]; gotIv = new boolean[2]; sendStoreIV = new byte[2][]; refreshStoreIV = new byte[2][]; // } catch (FileNotFoundException e) { // System.err.println("Database file not found!"); // System.exit(-1); // } } /** * Methods invoked by the network stack */ /** * Overrides the function in ChatServer Whenever a packet is received this * method is called and IsA indicates whether it is from A (or B) with the * byte array of the raw packet */ public void PacketReceived(boolean IsA, byte[] buf) { ByteArrayInputStream is = new ByteArrayInputStream(buf); ObjectInput in = null; //http://docs.oracle.com/javase/7/docs/technotes/guides/security/crypto/CryptoSpec.html#DH2Ex //http://docstore.mik.ua/orelly/java-ent/security/ch13_07.htm try { ChatPacket p = null; //accept chat message/or logout from authenticated user only if (Authenticated[getUser(IsA)]) { if (SECURED_MODE[getUser(IsA)]) { if (gotIv[getUser(IsA)]) { p = Encryption.decryptWithAES(is, symmetricKeyStore[getUser(IsA)], ivStore[getUser(IsA)]); gotIv[getUser(IsA)] = false; //used iv so reset ivStore[getUser(IsA)] = null; } else { in = new ObjectInputStream(is); Object o = in.readObject(); p = (ChatPacket) o; ivStore[getUser(IsA)] = p.data; gotIv[getUser(IsA)] = true; //got iv } if (p.request == ChatRequest.CHAT) { // This is a chat message byte[] hashMessage = Encryption.generateSHA256Digest(p.data); if (Encryption.verifySignature(p.signature, hashMessage, rsaPublicKeys[getUser(IsA)])) { // Whoever is sending it must be already logged in if ((IsA && statA != "") || (!IsA && statB != "")) { // Forward the original packet to the recipient //receiver must be logged in to received //SEND to authenticated user if (IsA && statB != "") { //send message to other user sendMessageAndRefreshSender(IsA, p); } if (!IsA && statA != "") { sendMessageAndRefreshSender(IsA, p); } } } else errorMITM(IsA); } else if (p.request == ChatRequest.LOGOUT) { if (IsA) { statA = ""; } else { statB = ""; } UpdateLogin(IsA, ""); String message = "LOGOUT"; byte[] messageHash = Encryption.generateSHA256Digest(message.getBytes("UTF-8")); RespondtoClient(IsA, message, Encryption.generateSignature(messageHash, rsaPrivateKeyServer)); logoutUser(IsA); } } else { in = new ObjectInputStream(is); Object o = in.readObject(); p = (ChatPacket) o; if (p.request == ChatRequest.DH_PUBLIC_KEY) { byte[] messageHash = Encryption.generateSHA256Digest(p.data); if (Encryption.verifySignature(p.signature, messageHash, rsaPublicKeys[getUser(IsA)])) { System.out.println("server start create public key"); byte[] serverPublicKey = serverCreatePublicPairKey(IsA, p.data); sendDHPublicKeyToClient(IsA, serverPublicKey); SECURED_MODE[getUser(IsA)] = true; //user is authenticated on the server side } else errorMITM(IsA); } } } else { ObjectInput objectInput = new ObjectInputStream(is); Object object = objectInput.readObject(); p = (ChatPacket) object; if (p.request == ChatRequest.Nonce) { //recreate the hash of message byte[] message = Encryption.concatenateMessage(p.rsaPublicKey.getEncoded(), p.cnonce); byte[] hashMessage = Encryption.generateSHA256Digest(message); //Authentication of message, no impersonation of user if (Encryption.verifySignature(p.signature, hashMessage, p.rsaPublicKey)) { System.out.println("VALID SIGNATURE"); //signature is valid, it is that user byte[] clientNonce = Encryption.privateKeyDecryptionByte(p.cnonce, rsaPrivateKeyServer); if (clientNonceStore[getUser(IsA)] != clientNonce) { storePublicKeyAndClientNonce(IsA, p, clientNonce); //create a challenge for the client System.out.println("create server nonce"); byte[] nonceServer = Encryption.generateNonce(); //send to client ChatPacket msg = new ChatPacket(); msg.request = ChatRequest.Nonce; msg.uid = IsA ? statA : statB; msg.success = "ok"; //msg.cnonce = IsA ? clientNonceA : clientNonceB; msg.cnonce = Encryption.privateKeyDecryptionByte(p.cnonce, rsaPrivateKeyServer); msg.snonce = Encryption.publicKeyEncryption(nonceServer, (rsaPublicKeys[getUser(IsA)])); message = Encryption.concatenateMessage(msg.cnonce, msg.snonce); hashMessage = Encryption.generateSHA256Digest(message); msg.signature = Encryption.generateSignature(hashMessage, rsaPrivateKeyServer); //sign the client hashedMessage System.out.println("send client nonce back + encrypted server nonce"); SerializeNSend(IsA, msg); } else errorReplayAttack(); } else { errorMITM(IsA); } } if (p.request == ChatRequest.LOGIN) { System.out.println("server received last authentication msg"); byte[] hashMessage = Encryption.generateSHA256Digest(p.snonce); if (Encryption.verifySignature(p.signature, hashMessage, (rsaPublicKeys[getUser(IsA)]))) { //valid signature if (serverNonceStore[getUser(IsA)] != p.snonce) { //nonce is unique, was never reused... protect against replay attack serverNonceStore[getUser(IsA)] = p.snonce; //store it for future authentication Authenticated[getUser(IsA)] = true; // We do not allow one user to be logged in on multiple // clients if (!p.uid.equals(IsA ? statB : statA)) { //not already logged in if (IsA) { statA = p.uid; } else { statB = p.uid; } // Update the UI to indicate this UpdateLogin(IsA, IsA ? statA : statB); // Inform the client that it was successful System.out.println("server sucessful login"); String message = "LOGIN"; //sign successful login hashMessage = Encryption.generateSHA256Digest(message.getBytes("UTF-8")); RespondtoClient(IsA, message, Encryption.generateSignature(hashMessage, rsaPrivateKeyServer)); } else errorReplayAttack(); } } if ((IsA ? statA : statB).equals("")) { // Oops, this means a failure, we tell the client so System.out.println("Server info : SYSTEM DENIED ACCESS"); String message = "access_denied"; //sign failure message byte[] messageHash = Encryption.generateSHA256Digest(message.getBytes("UTF-8")); RespondtoClient(IsA, message, Encryption.generateSignature(messageHash, rsaPrivateKeyServer)); } } } } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } private void errorReplayAttack() { System.out.println("server detected : REPLAY ATTACK"); } /** * send iv + encrypted message to other user * then send iv + encrypted ack to original sender * * @param IsA user * @param p message */ private void sendMessageAndRefreshSender(boolean IsA, ChatPacket p) { //send message to other user ChatPacket ivMessage = new ChatPacket(); ivMessage.request = ChatRequest.IV; sendStoreIV[getUser(!IsA)] = Encryption.generateIV(); ivMessage.data = sendStoreIV[getUser(!IsA)]; SerializeNSend(!IsA, ivMessage); p.signature = Encryption.generateSignature(Encryption.generateSHA256Digest(p.data), rsaPrivateKeyServer); SerializeNSend(!IsA, p); //refresh ui ivMessage = new ChatPacket(); ivMessage.request = ChatRequest.IV; refreshStoreIV[getUser(IsA)] = Encryption.generateIV(); ivMessage.data = refreshStoreIV[getUser(IsA)]; System.out.println("server send new iv back to original client"); SerializeNSend(IsA, ivMessage); System.out.println("system send back original message to refresh screen"); refreshSenderUI(IsA, p); } private void errorMITM(boolean IsA) { System.out.println("MAN In the middle attack"); reset(IsA); } /** * Diffie-Hellman public key is too big to encrypted by our RSA public key so we need to split it into two message * each part is encrypted and the signed * * @param IsA * @param serverPublicKey */ private void sendDHPublicKeyToClient(boolean IsA, byte[] serverPublicKey) { //send to client ChatPacket msg = new ChatPacket(); msg.request = ChatRequest.DH_PUBLIC_KEY; msg.uid = IsA ? statA : statB; msg.success = "Success"; msg.data = serverPublicKey; byte[] messageHash = Encryption.generateSHA256Digest(msg.data); msg.signature = Encryption.generateSignature(messageHash, rsaPrivateKeyServer); SerializeNSend(IsA, msg); System.out.println("server send server public key"); System.out.println("server side secured-mode activated for " + IsA); } /** * Create public Pair Key then create the shared secret key based on parameter from client user * * @param IsA * @param p * @param DHpublicKey * @return serverPublicKey */ private byte[] serverCreatePublicPairKey(boolean IsA,byte[] DHpublicKey) { byte[] serverPublicKey = null; try { //get public key pair from other user System.out.println("Server receive client public key pair"); //byte[] clientPublicKeyPair = Encryption.privateKeyDecryptionByte(p.data, rsaPrivateKeyServer); byte[] clientPublicKeyPair = DHpublicKey; //Instantiate DH public key from the encoded key material KeyFactory serverKeyFactory = KeyFactory.getInstance("DH"); X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(clientPublicKeyPair); PublicKey clientPubKey = serverKeyFactory.generatePublic(x509KeySpec); //get DH parameter from client public key DHParameterSpec dhParamSpec = ((DHPublicKey) clientPubKey).getParams(); //server create his own public key KeyPairGenerator serverKeyPairGenerator = KeyPairGenerator.getInstance("DH"); try { serverKeyPairGenerator.initialize(dhParamSpec); KeyPair serverKeyPair = serverKeyPairGenerator.generateKeyPair(); //server create and initialize keyAgreement KeyAgreement serverKeyAgreement = KeyAgreement.getInstance("DH"); serverKeyAgreement.init(serverKeyPair.getPrivate()); System.out.println("server create shared secret key"); //create shared secret KEY serverKeyAgreement.doPhase(clientPubKey, true); byte[] sharedSecret = serverKeyAgreement.generateSecret(); generateSharedAESKey(IsA, sharedSecret); //server encode his public key and send to client serverPublicKey = serverKeyPair.getPublic().getEncoded(); } catch (InvalidAlgorithmParameterException e) { e.printStackTrace(); } } catch (NoSuchAlgorithmException | InvalidKeyException | InvalidKeySpecException e) { e.printStackTrace(); } return serverPublicKey; } private void generateSharedAESKey(boolean IsA, byte[] sharedSecret) { //create shared AES symmetric key SecretKey symmetricKeyAES = Encryption.generateAESKeyFromShareSecret(sharedSecret, Encryption.KeySize.KEY256); symmetricKeyStore[getUser(IsA)] = symmetricKeyAES; } private void storePublicKeyAndClientNonce(boolean IsA, ChatPacket p, byte[] clientNonce) { rsaPublicKeys[getUser(IsA)] = p.rsaPublicKey; clientNonceStore[getUser(IsA)] = clientNonce; } private void refreshSenderUI(boolean IsA, ChatPacket p) { // Flip the uid and send it back to the sender for updating // chat history p.request = ChatRequest.CHAT_ACK; p.uid = (IsA ? statB : statA); SerializeNSend(IsA, p); } /** * Methods for updating UI */ // You can use this.UpdateServerLog("anything") to update the TextField on // the server portion of the UI // when needed /** * Methods invoked locally */ /** * This method serializes (into byte[] representation) a Java object * (ChatPacket) and sends it to the corresponding recipient (A or B) */ private void SerializeNSend(boolean IsA, ChatPacket p) { ByteArrayOutputStream os = new ByteArrayOutputStream(); ObjectOutput out = null; try { out = new ObjectOutputStream(os); out.writeObject(p); byte[] packet = os.toByteArray(); if (SECURED_MODE[getUser(IsA)] && Authenticated[getUser(IsA)] && p.request != ChatRequest.IV) { if (p.request == ChatRequest.CHAT_ACK) { packet = Encryption.encryptWithAES(packet, symmetricKeyStore[getUser(IsA)], refreshStoreIV[getUser(IsA)]); } else packet = Encryption.encryptWithAES(packet, symmetricKeyStore[getUser(IsA)], sendStoreIV[getUser(IsA)]); } SendtoClient(IsA, packet); } catch (IOException e) { e.printStackTrace(); } finally { try { out.close(); } catch (IOException e) { e.printStackTrace(); } try { os.close(); } catch (IOException e) { e.printStackTrace(); } } } /** * This method composes the packet needed to respond to a client (indicated * by IsA) regarding whether the login/logout request was successful * p.success would be "" if failed or "LOGIN"/"LOGOUT" respectively if * successful */ void RespondtoClient(boolean IsA, String Success, byte[] signature) { ChatPacket p = new ChatPacket(); p.request = ChatRequest.RESPONSE; p.uid = IsA ? statA : statB; p.success = Success; p.signature = signature; SerializeNSend(IsA, p); } private void logoutUser(Boolean IsA) { System.out.println("Logout user :" + IsA); if (IsA) { this.UpdateServerLog("server stop authenticated connection with alice"); } else this.UpdateServerLog("server stop authenticated connection with Bob"); reset(IsA); } public void reset(boolean IsA) { Authenticated[getUser(IsA)] = false; SECURED_MODE[getUser(IsA)] = false; symmetricKeyStore[getUser(IsA)] = null; } /** * convert true/false into binary * * @param IsA is Alice * @return binary 0/1 */ public static int getUser(boolean IsA) { ////http://stackoverflow.com/questions/3793650/convert-boolean-to-int-in-java // bool to integer return Boolean.compare(IsA, false); } }
933712cb3f4a89f34241cab11fc8a3f00c906510
237b4ab97aba5c083511f4be370f355191057623
/vlc_sample/src/org/videolan/libvlc/AWindowNativeHandler.java
fe40e98bbcfb9b1a28ab098c7c31454752ffca1b
[]
no_license
icemanyandy/flash_player_for_android_6.0
dcf921afa645319b22019bb3652372de9a7d9f95
0490a7e136ba324d16e87e441c792a812d822200
refs/heads/master
2022-07-10T23:05:53.312046
2022-06-23T02:55:47
2022-06-23T02:55:47
71,772,874
17
2
null
null
null
null
UTF-8
Java
false
false
4,028
java
/***************************************************************************** * public class AWindowNativeHandler.java * **************************************************************************** * Copyright © 2015 VLC authors, VideoLAN and VideoLabs * <p> * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * <p> * 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 Lesser General Public License for more details. * <p> * You should have received a copy of the GNU Lesser 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.videolan.libvlc; import android.view.Surface; public abstract class AWindowNativeHandler { /** * Callback called from {@link IVLCVout#sendMouseEvent}. * * @param nativeHandle handle passed by {@link #setCallback}. * @param action see ACTION_* in {@link android.view.MotionEvent}. * @param button see BUTTON_* in {@link android.view.MotionEvent}. * @param x x coordinate. * @param y y coordinate. */ protected abstract void nativeOnMouseEvent(long nativeHandle, int action, int button, int x, int y); /** * Callback called from {@link IVLCVout#setWindowSize}. * * @param nativeHandle handle passed by {@link #setCallback}. * @param width width of the window. * @param height height of the window. */ protected abstract void nativeOnWindowSize(long nativeHandle, int width, int height); /** * Get the valid Video surface. * * @return can be null if the surface was destroyed. */ @SuppressWarnings("unused") /* Used by JNI */ protected abstract Surface getVideoSurface(); /** * Get the valid Subtitles surface. * * @return can be null if the surface was destroyed. */ @SuppressWarnings("unused") /* Used by JNI */ protected abstract Surface getSubtitlesSurface(); /** * Set a callback in order to receive {@link #nativeOnMouseEvent} and {@link #nativeOnWindowSize} events. * * @param nativeHandle native Handle passed by {@link #nativeOnMouseEvent} and {@link #nativeOnWindowSize} * @return true if callback was successfully registered */ @SuppressWarnings("unused") /* Used by JNI */ protected abstract boolean setCallback(long nativeHandle); /** * This method is only used for ICS and before since ANativeWindow_setBuffersGeometry doesn't work before. * It is synchronous. * * @param surface surface returned by getVideoSurface or getSubtitlesSurface * @param width surface width * @param height surface height * @param format color format (or PixelFormat) * @return true if buffersGeometry were set (only before ICS) */ @SuppressWarnings("unused") /* Used by JNI */ protected abstract boolean setBuffersGeometry(Surface surface, int width, int height, int format); /** * Set the window Layout. * This call will result of {@link IVLCVout.Callback#onNewLayout} being called from the main thread. * * @param width Frame width * @param height Frame height * @param visibleWidth Visible frame width * @param visibleHeight Visible frame height * @param sarNum Surface aspect ratio numerator * @param sarDen Surface aspect ratio denominator */ @SuppressWarnings("unused") /* Used by JNI */ protected abstract void setWindowLayout(int width, int height, int visibleWidth, int visibleHeight, int sarNum, int sarDen); }
8b79bfcf3914a55a62755d1b65d556d27b301c3c
b4ba7deb5906965bd78809efd7599d676d11545f
/src/main/java/com/dianping/maven/sync/producer/controller/GlobalAuditEventController.java
9390bce599077751d8aee7a2dad8f99108fd253b
[]
no_license
liuz7/maven-sync-producer
6a9c012874eddda9ee47d33f7db6bda8772a50b7
bce056e84695ffe6192ef1c1d068dae0afd4e648
refs/heads/master
2021-01-22T03:40:05.386137
2017-05-25T04:09:13
2017-05-25T04:09:13
92,392,068
0
0
null
null
null
null
UTF-8
Java
false
false
2,068
java
package com.dianping.maven.sync.producer.controller; import com.dianping.maven.sync.producer.model.GlobalAuditEvent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import java.util.StringJoiner; /** * Created by georgeliu on 2017/5/24. */ @RestController @RequestMapping("/global") public class GlobalAuditEventController { @Autowired private KafkaTemplate<String, String> kafkaTemplate; @Value("${kafka.topic}") private String kafkaTopic; public static final Logger logger = LoggerFactory.getLogger(GlobalAuditEventController.class); public static final String REPOSITORY_ASSET = "repository.asset"; @RequestMapping(value = "/audit/", method = RequestMethod.POST) public ResponseEntity<?> postAuditEvent(@RequestBody GlobalAuditEvent globalAuditEvent) { logger.debug("Received Global Audit Event : {}", globalAuditEvent); if (globalAuditEvent.getAudit().getDomain().equalsIgnoreCase(REPOSITORY_ASSET)) { StringJoiner stringJoiner = new StringJoiner("|", "[", "]"); String data = stringJoiner.add(globalAuditEvent.getAudit().getAttributes().getRepositoryName()). add(globalAuditEvent.getAudit().getAttributes().getName()). add(globalAuditEvent.getAudit().getType()).toString(); this.kafkaTemplate.send(this.kafkaTopic, data); } HttpHeaders headers = new HttpHeaders(); return new ResponseEntity<String>(headers, HttpStatus.CREATED); } }
0dfb947ac49ffa103bee0c4af47b8bad8d695390
3cd69da4d40f2d97130b5bf15045ba09c219f1fa
/sources/kotlinx/coroutines/flow/FlowKt__ZipKt$combine$$inlined$unsafeFlow$5$lambda$1.java
a866493bbfb92e4e4360dfb9e7aadeeee90f0d3b
[]
no_license
TheWizard91/Album_base_source_from_JADX
946ea3a407b4815ac855ce4313b97bd42e8cab41
e1d228fc2ee550ac19eeac700254af8b0f96080a
refs/heads/master
2023-01-09T08:37:22.062350
2020-11-11T09:52:40
2020-11-11T09:52:40
311,927,971
0
0
null
null
null
null
UTF-8
Java
false
false
1,427
java
package kotlinx.coroutines.flow; import kotlin.Metadata; import kotlin.jvm.functions.Function0; import kotlin.jvm.internal.Intrinsics; import kotlin.jvm.internal.Lambda; @Metadata(mo33669bv = {1, 0, 3}, mo33670d1 = {"\u0000\u0016\n\u0000\n\u0002\u0010\u0011\n\u0002\b\u0004\n\u0002\b\u0004\n\u0002\b\u0004\n\u0002\b\u0005\u0010\u0000\u001a\n\u0012\u0006\u0012\u0004\u0018\u0001H\u00020\u0001\"\u0006\b\u0000\u0010\u0002\u0018\u0001\"\u0004\b\u0001\u0010\u0003H\n¢\u0006\u0004\b\u0004\u0010\u0005¨\u0006\u0006"}, mo33671d2 = {"<anonymous>", "", "T", "R", "invoke", "()[Ljava/lang/Object;", "kotlinx/coroutines/flow/FlowKt__ZipKt$combine$5$1"}, mo33672k = 3, mo33673mv = {1, 1, 15}) /* compiled from: Zip.kt */ public final class FlowKt__ZipKt$combine$$inlined$unsafeFlow$5$lambda$1 extends Lambda implements Function0<T[]> { final /* synthetic */ FlowKt__ZipKt$combine$$inlined$unsafeFlow$5 this$0; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public FlowKt__ZipKt$combine$$inlined$unsafeFlow$5$lambda$1(FlowKt__ZipKt$combine$$inlined$unsafeFlow$5 flowKt__ZipKt$combine$$inlined$unsafeFlow$5) { super(0); this.this$0 = flowKt__ZipKt$combine$$inlined$unsafeFlow$5; } public final T[] invoke() { int length = this.this$0.$flows$inlined.length; Intrinsics.reifiedOperationMarker(0, "T?"); return new Object[length]; } }
38f05e344016d4db6685ffaf7d5131d57622784e
f81e5a2f5cd9dde82344e3926b121c35c8f01086
/app/src/main/java/com/techlogn/cleanmate_pos_v36/MyAdapterReport.java
059b4fc5dd830866ae43231c02903ce8942d6fba
[]
no_license
gnapahcuna/Cleanmate-App-POS
e40683a0f2becb004d4d58d8ee9655198c2e3e8b
8f487302cd2b9ea17d8b7e3a63fc7286766bde61
refs/heads/master
2021-06-23T15:05:16.879383
2021-06-09T14:04:54
2021-06-09T14:04:54
167,883,540
0
0
null
null
null
null
UTF-8
Java
false
false
1,823
java
package com.techlogn.cleanmate_pos_v36; import android.app.Fragment; import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import java.util.ArrayList; /** * Created by anucha on 5/8/2018. */ public class MyAdapterReport extends ArrayAdapter { Fragment fragment; private Context mContext; private ArrayList<CustomItemReport> items; private int mLayout; LayoutInflater inflater; View v; ViewHolderReport vHolder; public MyAdapterReport(Context context, int layout, ArrayList<CustomItemReport> arrayList) { super(context, layout, arrayList); mContext = context; mLayout = layout; items = arrayList; } @NonNull @Override public View getView(final int position, @Nullable View convertView, @NonNull ViewGroup parent) { /*rowView = convertView; v = convertView;*/ if(convertView == null) { /*inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); rowView = inflater.inflate(mLayout, parent, false);*/ LayoutInflater inflater = LayoutInflater.from(mContext); convertView = inflater.inflate(mLayout, parent, false); vHolder = new ViewHolderReport(convertView); convertView.setTag(vHolder); } else { vHolder = (ViewHolderReport)convertView.getTag(); } MyFont myFont=new MyFont(mContext); final CustomItemReport item = items.get(position); vHolder.mText.setText(item.mText); vHolder.mText.setTypeface(myFont.setFont()); return convertView; } }
0739448590b88640f0204a6693c790fa2d6aae96
d6ee393f6e3728a5cdc8dc5cbf3cb09edffcbf25
/.svn/pristine/84/84f17c42c0447ccf8a292a7f879e3e99cf85b6df.svn-base
804ec9f74bc2607f72c9c4db99ef8c8ac3ed3245
[]
no_license
wuzhining/mesParent
f4cfd11828586d738e8123c6d4b675a77d465333
d806586103327d48f26ce2725e0e201292793f94
refs/heads/master
2022-12-21T00:07:07.116066
2019-10-04T05:35:10
2019-10-04T05:35:10
212,742,010
3
0
null
2022-12-16T09:57:13
2019-10-04T05:25:37
JavaScript
UTF-8
Java
false
false
1,897
package com.techsoft.entity.bill; import java.util.Date; import com.techsoft.entity.common.BillInventory; public class BillInventoryParamVo extends BillInventory { private static final long serialVersionUID = -4828022005486181916L; public BillInventoryParamVo (){ } public BillInventoryParamVo(BillInventory value) { value.cloneProperties(this); } private Date timeStartBegin; private Date timeStartEnd; private Date timeEndBegin; private Date timeEndEnd; private Date createTimeBegin; private Date createTimeEnd; private Date modifyTimeBegin; private Date modifyTimeEnd; private Long notFinish; public Date getTimeStartBegin() { return timeStartBegin; } public void setTimeStartBegin(Date value) { this.timeStartBegin = value; } public Date getTimeStartEnd() { return timeStartEnd; } public void setTimeStartEnd(Date value) { this.timeStartEnd = value; } public Date getTimeEndBegin() { return timeEndBegin; } public void setTimeEndBegin(Date value) { this.timeEndBegin = value; } public Date getTimeEndEnd() { return timeEndEnd; } public void setTimeEndEnd(Date value) { this.timeEndEnd = value; } public Date getCreateTimeBegin() { return createTimeBegin; } public void setCreateTimeBegin(Date value) { this.createTimeBegin = value; } public Date getCreateTimeEnd() { return createTimeEnd; } public void setCreateTimeEnd(Date value) { this.createTimeEnd = value; } public Date getModifyTimeBegin() { return modifyTimeBegin; } public void setModifyTimeBegin(Date value) { this.modifyTimeBegin = value; } public Date getModifyTimeEnd() { return modifyTimeEnd; } public void setModifyTimeEnd(Date value) { this.modifyTimeEnd = value; } public Long getNotFinish() { return notFinish; } public void setNotFinish(Long notFinish) { this.notFinish = notFinish; } }
225248a5736b553fbd6897e8a82c9527b2cbe28b
48e835e6f176a8ac9ae3ca718e8922891f1e5a18
/benchmark/validation/org/deeplearning4j/nn/modelimport/keras/layers/convolution/KerasAtrousConvolution2DTest.java
5ea8acca803b2792b8f54106ee22ce78af53b73d
[]
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
2,196
java
/** * ***************************************************************************** * Copyright (c) 2015-2018 Skymind, Inc. * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available 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. * * SPDX-License-Identifier: Apache-2.0 * **************************************************************************** */ package org.deeplearning4j.nn.modelimport.keras.layers.convolution; import org.deeplearning4j.nn.modelimport.keras.config.Keras1LayerConfiguration; import org.deeplearning4j.nn.weights.IWeightInit; import org.deeplearning4j.nn.weights.WeightInitXavier; import org.junit.Test; /** * * * @author Max Pumperla */ public class KerasAtrousConvolution2DTest { private final String ACTIVATION_KERAS = "linear"; private final String ACTIVATION_DL4J = "identity"; private final String LAYER_NAME = "atrous_conv_2d"; private final String INIT_KERAS = "glorot_normal"; private final IWeightInit INIT_DL4J = new WeightInitXavier(); private final double L1_REGULARIZATION = 0.01; private final double L2_REGULARIZATION = 0.02; private final double DROPOUT_KERAS = 0.3; private final double DROPOUT_DL4J = 1 - (DROPOUT_KERAS); private final int[] KERNEL_SIZE = new int[]{ 1, 2 }; private final int[] DILATION = new int[]{ 2, 2 }; private final int[] STRIDE = new int[]{ 3, 4 }; private final int N_OUT = 13; private final String BORDER_MODE_VALID = "valid"; private final int[] VALID_PADDING = new int[]{ 0, 0 }; private Keras1LayerConfiguration conf1 = new Keras1LayerConfiguration(); @Test public void testAtrousConvolution2DLayer() throws Exception { Integer keras1 = 1; buildAtrousConvolution2DLayer(conf1, keras1); } }
5bfe2613eb8c8a01f13cb9dceabb2cc035900f3b
545afd3495e678bac243880aaee743ca708f6d17
/Medical/obj/Release/android/src/com/mkh75health_medical/R.java
298edfe10c7fe070e18cff139df29525336ed119
[]
no_license
Mahdikh75/Medical
c3848dd83f64e6b972f3edbc883cd1fe3198f158
5eb2cd384f471b7d86be9b6c86fefecf93907c05
refs/heads/main
2023-04-11T03:17:09.849556
2021-04-30T10:12:37
2021-04-30T10:12:37
363,103,531
0
0
null
null
null
null
UTF-8
Java
false
false
42,807
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.mkh75health_medical; public final class R { public static final class attr { /** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int fontPath=0x7f01000b; /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int mainColor=0x7f01000c; /** <p>Must be an integer value, such as "<code>100</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int max=0x7f010001; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int numberProgressBarStyle=0x7f01000a; /** <p>Must be an integer value, such as "<code>100</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int progress=0x7f010000; /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int progress_reached_bar_height=0x7f010004; /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int progress_reached_color=0x7f010003; /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int progress_text_color=0x7f010007; /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int progress_text_offset=0x7f010008; /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int progress_text_size=0x7f010006; /** <p>Must be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>visible</code></td><td>0</td><td></td></tr> <tr><td><code>invisible</code></td><td>1</td><td></td></tr> </table> */ public static final int progress_text_visibility=0x7f010009; /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int progress_unreached_bar_height=0x7f010005; /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int progress_unreached_color=0x7f010002; /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int secondaryColor=0x7f01000d; } public static final class color { public static final int ColorBtn=0x7f090004; public static final int ColorLYTCBP=0x7f090008; public static final int ColorTmAb=0x7f090007; public static final int Cus=0x7f090002; public static final int MinOR=0x7f090006; public static final int OrangeRed=0x7f090005; public static final int Red=0x7f090000; public static final int WDC=0x7f090003; public static final int White=0x7f090001; } public static final class drawable { public static final int agalarm=0x7f020000; public static final int agcbp=0x7f020001; public static final int agcycle=0x7f020002; public static final int aghr=0x7f020003; public static final int agmsg=0x7f020004; public static final int agsetpcounter=0x7f020005; public static final int agtest=0x7f020006; public static final int agwatchsmart=0x7f020007; public static final int am=0x7f020008; public static final int blackdel=0x7f020009; public static final int blackheartratehr=0x7f02000a; public static final int blackheartrateinfo=0x7f02000b; public static final int caitea=0x7f02000c; public static final int caleri=0x7f02000d; public static final int caloric=0x7f02000e; public static final int cbp=0x7f02000f; public static final int cbpcafi=0x7f020010; public static final int cbpfood=0x7f020011; public static final int cbpsleep=0x7f020012; public static final int cbpsport=0x7f020013; public static final int cbpsportred=0x7f020014; public static final int cbpwater=0x7f020015; public static final int cmactivity=0x7f020016; public static final int cmage=0x7f020017; public static final int cmcancel=0x7f020018; public static final int cmheight=0x7f020019; public static final int cmno=0x7f02001a; public static final int cmok=0x7f02001b; public static final int cmsex=0x7f02001c; public static final int cmweight=0x7f02001d; public static final int cmyes=0x7f02001e; public static final int cpbheartrateblood=0x7f02001f; public static final int cpbhome=0x7f020020; public static final int cpbreport=0x7f020021; public static final int cpbweight=0x7f020022; public static final int darshbordk=0x7f020023; public static final int dashboard=0x7f020024; public static final int defaccount=0x7f020025; public static final int delpf=0x7f020026; public static final int delss=0x7f020027; public static final int error=0x7f020028; public static final int food=0x7f020029; public static final int girl=0x7f02002a; public static final int gvalarm=0x7f02002b; public static final int gvcbp=0x7f02002c; public static final int gvcycle=0x7f02002d; public static final int gvhr=0x7f02002e; public static final int gvmsg=0x7f02002f; public static final int gvsetpcounter=0x7f020030; public static final int gvtagz=0x7f020031; public static final int gvtest=0x7f020032; public static final int gvwatchsmart=0x7f020033; public static final int health=0x7f020034; public static final int healthcal=0x7f020035; public static final int healthheight=0x7f020036; public static final int healthkhmeter=0x7f020037; public static final int healthnotisp=0x7f020038; public static final int healthspeed=0x7f020039; public static final int healthstepcounter=0x7f02003a; public static final int healthtimer=0x7f02003b; public static final int heart=0x7f02003c; public static final int heartratehrcount=0x7f02003d; public static final int heartratemonitor=0x7f02003e; public static final int heartratenoti=0x7f02003f; public static final int heartratesonv=0x7f020040; public static final int heights=0x7f020041; public static final int helpra=0x7f020042; public static final int hr=0x7f020043; public static final int hr450=0x7f020044; public static final int hr470=0x7f020045; public static final int hr490=0x7f020046; public static final int hr520=0x7f020047; public static final int hrbbloodpre=0x7f020048; public static final int hrbheartrate=0x7f020049; public static final int hrcardiogram=0x7f02004a; public static final int ic_checked_mark=0x7f02004b; public static final int ic_failure_mark=0x7f02004c; public static final int infoapp=0x7f02004d; public static final int man=0x7f02004e; public static final int mcdep=0x7f02004f; public static final int mchome=0x7f020050; public static final int mcsb=0x7f020051; public static final int medicalapp=0x7f020052; public static final int metaldetector=0x7f020053; public static final int mg=0x7f020054; public static final int reload=0x7f020055; public static final int reportfwcs=0x7f020056; public static final int rgbheartratehr=0x7f020057; public static final int rgbheartrateinfo=0x7f020058; public static final int sensor=0x7f020059; public static final int setdataok=0x7f02005a; public static final int sleepy=0x7f02005b; public static final int smartphonevib=0x7f02005c; public static final int sp=0x7f02005d; public static final int speedd=0x7f02005e; public static final int st=0x7f02005f; public static final int stepcounternoti=0x7f020060; public static final int timer=0x7f020061; public static final int water=0x7f020062; public static final int whtall=0x7f020063; public static final int whweight=0x7f020064; } public static final class id { public static final int AHImageViewMain=0x7f080093; public static final int AHScrollViewMp=0x7f080094; public static final int AHTextViewSummery=0x7f080095; public static final int CBPActionMenuViewCafi=0x7f08004f; public static final int CBPActionMenuViewFood=0x7f080047; public static final int CBPActionMenuViewSleep=0x7f080053; public static final int CBPActionMenuViewWater=0x7f08004b; public static final int CBPButtonCalc=0x7f08005a; public static final int CBPButtonClaerData=0x7f080059; public static final int CBPEditTextValueFWCS=0x7f080061; public static final int CBPImageViewCafi=0x7f080051; public static final int CBPImageViewFood=0x7f080049; public static final int CBPImageViewSleep=0x7f080055; public static final int CBPImageViewWater=0x7f08004d; public static final int CBPInputDataSHWTEditTextKeyText=0x7f080042; public static final int CBPInputDataSHWTEditTextKeyTitle=0x7f080041; public static final int CBPLinearLayoutTPBtn=0x7f080058; public static final int CBPLinearLayoutTp1=0x7f080044; public static final int CBPLinearLayoutTp2=0x7f08005b; public static final int CBPLinearLayoutTp3=0x7f08005d; public static final int CBPLinearLayoutTp4=0x7f08005f; public static final int CBPScrollViewMT=0x7f080056; public static final int CBPTabHostMain=0x7f080043; public static final int CBPTableLayoutMain=0x7f080045; public static final int CBPTableRowCafi=0x7f08004e; public static final int CBPTableRowFood=0x7f080046; public static final int CBPTableRowSleep=0x7f080052; public static final int CBPTableRowWater=0x7f08004a; public static final int CBPTextViewCafi=0x7f080050; public static final int CBPTextViewFood=0x7f080048; public static final int CBPTextViewSleep=0x7f080054; public static final int CBPTextViewVitaem=0x7f080057; public static final int CBPTextViewWater=0x7f08004c; public static final int CBPTimePickerSleepy=0x7f080062; public static final int CMDepButtonAgainTest=0x7f080022; public static final int CMDepButtonResult=0x7f080023; public static final int CMDepLinearLayoutBtn=0x7f080021; public static final int CMDepLinearLayoutMain=0x7f08001f; public static final int CMDepListViewMain=0x7f080020; public static final int CMDiabetButtonCalc=0x7f08003e; public static final int CMDiabetButtonClaer=0x7f08003d; public static final int CMDiabetEditTextAge=0x7f08002f; public static final int CMDiabetEditTextTall=0x7f08002c; public static final int CMDiabetEditTextWCD=0x7f080032; public static final int CMDiabetEditTextWeight=0x7f080029; public static final int CMDiabetLinearLayoutTP1=0x7f080026; public static final int CMDiabetLinearLayoutTP2=0x7f08003c; public static final int CMDiabetScrollViewTmMn=0x7f080025; public static final int CMDiabetSpinnerSex=0x7f080035; public static final int CMDiabetSwitchActive=0x7f08003b; public static final int CMDiabetSwitchDaPb=0x7f080039; public static final int CMDiabetSwitchHisBd=0x7f080038; public static final int CMDiabetSwitchParnet=0x7f080037; public static final int CMDiabetSwitchSomk=0x7f08003a; public static final int CMDiabetTableLayoutMain=0x7f080027; public static final int CMDiabetTableRowTp1=0x7f080028; public static final int CMDiabetTableRowTp2=0x7f08002b; public static final int CMDiabetTableRowTp3=0x7f08002e; public static final int CMDiabetTableRowTp4=0x7f080031; public static final int CMDiabetTableRowTp5=0x7f080034; public static final int CMDiabetTextViewTm1=0x7f08002a; public static final int CMDiabetTextViewTm2=0x7f08002d; public static final int CMDiabetTextViewTm3=0x7f080030; public static final int CMDiabetTextViewTm4=0x7f080033; public static final int CMDiabetTextViewTm7=0x7f080036; public static final int CMTabHostImageViewPic=0x7f08003f; public static final int CMTabHostTextViewTilte=0x7f080040; public static final int CPBNumberPickerWCS=0x7f080063; public static final int CalculatorMedicalHBtnCalc=0x7f08001c; public static final int CalculatorMedicalHEditTextAge=0x7f080009; public static final int CalculatorMedicalHEditTextTall=0x7f08000d; public static final int CalculatorMedicalHEditTextWeight=0x7f080011; public static final int CalculatorMedicalHEditViewTall=0x7f08000e; public static final int CalculatorMedicalHImageViewActive=0x7f08001b; public static final int CalculatorMedicalHImageViewAge=0x7f08000b; public static final int CalculatorMedicalHImageViewSex=0x7f080017; public static final int CalculatorMedicalHImageViewTall=0x7f08000f; public static final int CalculatorMedicalHImageViewWeight=0x7f080013; public static final int CalculatorMedicalHLinearLayoutPanel=0x7f080006; public static final int CalculatorMedicalHScrollViewMain=0x7f080005; public static final int CalculatorMedicalHSpinnerActive=0x7f080019; public static final int CalculatorMedicalHSpinnerSex=0x7f080015; public static final int CalculatorMedicalHTableLayoutMain=0x7f080007; public static final int CalculatorMedicalHTableRowActive=0x7f080018; public static final int CalculatorMedicalHTableRowAge=0x7f080008; public static final int CalculatorMedicalHTableRowSex=0x7f080014; public static final int CalculatorMedicalHTableRowTall=0x7f08000c; public static final int CalculatorMedicalHTableRowWeight=0x7f080010; public static final int CalculatorMedicalHTextViewActive=0x7f08001a; public static final int CalculatorMedicalHTextViewAge=0x7f08000a; public static final int CalculatorMedicalHTextViewResult=0x7f08001d; public static final int CalculatorMedicalHTextViewSex=0x7f080016; public static final int CalculatorMedicalHTextViewWeight=0x7f080012; public static final int CalculatorMedicalLinearLayoutTp1=0x7f080004; public static final int CalculatorMedicalLinearLayoutTp2=0x7f08001e; public static final int CalculatorMedicalLinearLayoutTp3=0x7f080024; public static final int CalculatorMedicalTabHostMain=0x7f080003; public static final int HRBListViewData=0x7f08005e; public static final int HealthBtnOnOff=0x7f080077; public static final int HealthChronometerMain=0x7f080068; public static final int HealthFlipNumbersMainV=0x7f080064; public static final int HealthImageViewCaleri=0x7f08006c; public static final int HealthImageViewHeightKL=0x7f080076; public static final int HealthImageViewKiloMeter=0x7f08006f; public static final int HealthImageViewSpeed=0x7f080072; public static final int HealthImageViewTimer=0x7f080069; public static final int HealthLinearLayoutMTP=0x7f080065; public static final int HealthScrollViewMainTVK=0x7f080074; public static final int HealthTableLayoutMain=0x7f080066; public static final int HealthTableRowCaleri=0x7f08006a; public static final int HealthTableRowHeightKL=0x7f080073; public static final int HealthTableRowKiloMeter=0x7f08006d; public static final int HealthTableRowSpeed=0x7f080070; public static final int HealthTableRowTimer=0x7f080067; public static final int HealthTextViewCaleri=0x7f08006b; public static final int HealthTextViewHeightKL=0x7f080075; public static final int HealthTextViewKiloMeter=0x7f08006e; public static final int HealthTextViewSpeed=0x7f080071; public static final int HeartRateCSToastImageViewTM=0x7f080089; public static final int HeartRateCSToastTextViewTM=0x7f08008a; public static final int HeartRateImageViewAniTime=0x7f080078; public static final int HeartRateImageViewCountHR=0x7f08007e; public static final int HeartRateImageViewReport=0x7f080082; public static final int HeartRateImageViewValueMain=0x7f080086; public static final int HeartRateLinearLayoutTM=0x7f08007a; public static final int HeartRateLinearLayoutWC=0x7f080088; public static final int HeartRateNumberbarProTime=0x7f080087; public static final int HeartRateScrollViewHRm=0x7f080084; public static final int HeartRateScrollViewRp=0x7f080080; public static final int HeartRateScrollViewTLMain=0x7f080079; public static final int HeartRateTHHLinearLayoutEdu=0x7f080090; public static final int HeartRateTHHLinearLayoutNotes=0x7f08008d; public static final int HeartRateTHHLinearLayoutOne=0x7f08008c; public static final int HeartRateTHHScrollViewTVm1=0x7f08008e; public static final int HeartRateTHHScrollViewTVm2=0x7f080091; public static final int HeartRateTHHTabHostMain=0x7f08008b; public static final int HeartRateTHHTextViewEdu=0x7f08008f; public static final int HeartRateTHHTextViewNote=0x7f080092; public static final int HeartRateTableLayoutMain=0x7f08007b; public static final int HeartRateTableRowOne=0x7f08007c; public static final int HeartRateTableRowThree=0x7f080083; public static final int HeartRateTableRowTwo=0x7f08007f; public static final int HeartRateTextViewCountHR=0x7f08007d; public static final int HeartRateTextViewReport=0x7f080081; public static final int HeartRateTextViewVMHR=0x7f080085; public static final int LVDepLinearLayoutMain=0x7f08009c; public static final int LayGVImageViewMain=0x7f08009a; public static final int LayGVLinearLayoutMmp=0x7f080099; public static final int LayGVTextViewTitle=0x7f08009b; public static final int LvCusLinearLayoutMtp=0x7f080096; public static final int LvCusTextViewSummery=0x7f080098; public static final int LvCusTextViewTitle=0x7f080097; public static final int LvDepImageViewOC=0x7f0800a1; public static final int LvDepLinearLayoutTT=0x7f08009e; public static final int LvDepTextViewNumber=0x7f08009d; public static final int LvDepTextViewText=0x7f0800a0; public static final int LvDepTextViewTitle=0x7f08009f; public static final int MassagersBtnMSHandel=0x7f0800a8; public static final int MassagersImageViewVib=0x7f0800a6; public static final int MassagersNumberPickerTime=0x7f0800a9; public static final int MassagersTextViewPanel=0x7f0800a7; public static final int MassagersToggleButtonRate=0x7f0800aa; public static final int ProfileEditTextAge=0x7f0800b2; public static final int ProfileEditTextName=0x7f0800ae; public static final int ProfileEditTextTall=0x7f0800b5; public static final int ProfileEditTextWeight=0x7f0800b8; public static final int ProfileImageViewNA=0x7f0800ad; public static final int ProfileLinearLayoutTp1=0x7f0800ab; public static final int ProfileLinearLayoutTp2=0x7f0800af; public static final int ProfileLinearLayoutTpp1=0x7f0800ac; public static final int ProfileSCToastTextViewTS=0x7f0800c0; public static final int ProfileSpinnerActive=0x7f0800be; public static final int ProfileSpinnerSex=0x7f0800bb; public static final int ProfileTableLayoutMain=0x7f0800b0; public static final int ProfileTableRowA=0x7f0800b1; public static final int ProfileTableRowAC=0x7f0800bd; public static final int ProfileTableRowS=0x7f0800ba; public static final int ProfileTableRowT=0x7f0800b4; public static final int ProfileTableRowW=0x7f0800b7; public static final int ProfileTextViewA=0x7f0800b3; public static final int ProfileTextViewAC=0x7f0800bf; public static final int ProfileTextViewS=0x7f0800bc; public static final int ProfileTextViewT=0x7f0800b6; public static final int ProfileTextViewW=0x7f0800b9; public static final int SportListViewMain=0x7f08005c; public static final int WHListViewData=0x7f080060; public static final int calligraphy_tag_id=0x7f080000; public static final int content_frame=0x7f0800a3; public static final int drawer_layout=0x7f0800a2; public static final int gridView1=0x7f0800a4; public static final int invisible=0x7f080001; public static final int left_drawer=0x7f0800a5; public static final int visible=0x7f080002; } public static final class layout { public static final int alarmmedical=0x7f030000; public static final int calculatormedical=0x7f030001; public static final int calculatormedicaltabhostcustom=0x7f030002; public static final int cbpinputdatashrwt=0x7f030003; public static final int controlbodyposition=0x7f030004; public static final int cpbinputhome=0x7f030005; public static final int cpbinputsleepy=0x7f030006; public static final int cpbinputwatercafi=0x7f030007; public static final int health=0x7f030008; public static final int heartrate=0x7f030009; public static final int heartratecstoast=0x7f03000a; public static final int heartratethhelp=0x7f03000b; public static final int helpabout=0x7f03000c; public static final int layoutcbplsv=0x7f03000d; public static final int layoutmgv=0x7f03000e; public static final int listviewcmdep=0x7f03000f; public static final int main=0x7f030010; public static final int massagers=0x7f030011; public static final int massagerscustom=0x7f030012; public static final int profile=0x7f030013; public static final int profilecstoast=0x7f030014; } public static final class raw { public static final int beep1=0x7f050000; public static final int beep2=0x7f050001; public static final int beep3=0x7f050002; public static final int beeperror=0x7f050003; public static final int click1=0x7f050004; public static final int click2=0x7f050005; public static final int heartrate=0x7f050006; public static final int lf=0x7f050007; } public static final class string { public static final int ApplicationName=0x7f060001; public static final int Edu1=0x7f060002; public static final int Edu2=0x7f060003; public static final int Edu3=0x7f060004; public static final int Edu4=0x7f060005; public static final int Edu5=0x7f060006; public static final int HelpAppHR1=0x7f060007; public static final int HelpAppHR2=0x7f060008; public static final int HelpAppHR3=0x7f060009; public static final int HelpAppHR4=0x7f06000a; public static final int HelpAppHR5=0x7f06000b; public static final int app_name=0x7f060000; } public static final class style { public static final int NumberProgressBar_Beauty_Red=0x7f070000; public static final int NumberProgressBar_Default=0x7f070001; public static final int NumberProgressBar_Funny_Orange=0x7f070002; public static final int NumberProgressBar_Grace_Yellow=0x7f070003; public static final int NumberProgressBar_Passing_Green=0x7f070004; public static final int NumberProgressBar_Relax_Blue=0x7f070005; public static final int NumberProgressBar_Twinkle_Night=0x7f070006; public static final int NumberProgressBar_Warning_Red=0x7f070007; public static final int ThemeaMain=0x7f070008; } public static final class xml { public static final int uisettingp=0x7f040000; } public static final class styleable { /** Attributes that can be used with a AnimatedCircleLoadingView. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #AnimatedCircleLoadingView_mainColor Com.Mkh75Health_Medical:mainColor}</code></td><td></td></tr> <tr><td><code>{@link #AnimatedCircleLoadingView_secondaryColor Com.Mkh75Health_Medical:secondaryColor}</code></td><td></td></tr> </table> @see #AnimatedCircleLoadingView_mainColor @see #AnimatedCircleLoadingView_secondaryColor */ public static final int[] AnimatedCircleLoadingView = { 0x7f01000c, 0x7f01000d }; /** <p>This symbol is the offset where the {@link Com.Mkh75Health_Medical.R.attr#mainColor} attribute's value can be found in the {@link #AnimatedCircleLoadingView} array. <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name Com.Mkh75Health_Medical:mainColor */ public static final int AnimatedCircleLoadingView_mainColor = 0; /** <p>This symbol is the offset where the {@link Com.Mkh75Health_Medical.R.attr#secondaryColor} attribute's value can be found in the {@link #AnimatedCircleLoadingView} array. <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name Com.Mkh75Health_Medical:secondaryColor */ public static final int AnimatedCircleLoadingView_secondaryColor = 1; /** Attributes that can be used with a NumberProgressBar. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #NumberProgressBar_max Com.Mkh75Health_Medical:max}</code></td><td></td></tr> <tr><td><code>{@link #NumberProgressBar_progress Com.Mkh75Health_Medical:progress}</code></td><td></td></tr> <tr><td><code>{@link #NumberProgressBar_progress_reached_bar_height Com.Mkh75Health_Medical:progress_reached_bar_height}</code></td><td></td></tr> <tr><td><code>{@link #NumberProgressBar_progress_reached_color Com.Mkh75Health_Medical:progress_reached_color}</code></td><td></td></tr> <tr><td><code>{@link #NumberProgressBar_progress_text_color Com.Mkh75Health_Medical:progress_text_color}</code></td><td></td></tr> <tr><td><code>{@link #NumberProgressBar_progress_text_offset Com.Mkh75Health_Medical:progress_text_offset}</code></td><td></td></tr> <tr><td><code>{@link #NumberProgressBar_progress_text_size Com.Mkh75Health_Medical:progress_text_size}</code></td><td></td></tr> <tr><td><code>{@link #NumberProgressBar_progress_text_visibility Com.Mkh75Health_Medical:progress_text_visibility}</code></td><td></td></tr> <tr><td><code>{@link #NumberProgressBar_progress_unreached_bar_height Com.Mkh75Health_Medical:progress_unreached_bar_height}</code></td><td></td></tr> <tr><td><code>{@link #NumberProgressBar_progress_unreached_color Com.Mkh75Health_Medical:progress_unreached_color}</code></td><td></td></tr> </table> @see #NumberProgressBar_max @see #NumberProgressBar_progress @see #NumberProgressBar_progress_reached_bar_height @see #NumberProgressBar_progress_reached_color @see #NumberProgressBar_progress_text_color @see #NumberProgressBar_progress_text_offset @see #NumberProgressBar_progress_text_size @see #NumberProgressBar_progress_text_visibility @see #NumberProgressBar_progress_unreached_bar_height @see #NumberProgressBar_progress_unreached_color */ public static final int[] NumberProgressBar = { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007, 0x7f010008, 0x7f010009 }; /** <p>This symbol is the offset where the {@link Com.Mkh75Health_Medical.R.attr#max} attribute's value can be found in the {@link #NumberProgressBar} array. <p>Must be an integer value, such as "<code>100</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name Com.Mkh75Health_Medical:max */ public static final int NumberProgressBar_max = 1; /** <p>This symbol is the offset where the {@link Com.Mkh75Health_Medical.R.attr#progress} attribute's value can be found in the {@link #NumberProgressBar} array. <p>Must be an integer value, such as "<code>100</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name Com.Mkh75Health_Medical:progress */ public static final int NumberProgressBar_progress = 0; /** <p>This symbol is the offset where the {@link Com.Mkh75Health_Medical.R.attr#progress_reached_bar_height} attribute's value can be found in the {@link #NumberProgressBar} array. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name Com.Mkh75Health_Medical:progress_reached_bar_height */ public static final int NumberProgressBar_progress_reached_bar_height = 4; /** <p>This symbol is the offset where the {@link Com.Mkh75Health_Medical.R.attr#progress_reached_color} attribute's value can be found in the {@link #NumberProgressBar} array. <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name Com.Mkh75Health_Medical:progress_reached_color */ public static final int NumberProgressBar_progress_reached_color = 3; /** <p>This symbol is the offset where the {@link Com.Mkh75Health_Medical.R.attr#progress_text_color} attribute's value can be found in the {@link #NumberProgressBar} array. <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name Com.Mkh75Health_Medical:progress_text_color */ public static final int NumberProgressBar_progress_text_color = 7; /** <p>This symbol is the offset where the {@link Com.Mkh75Health_Medical.R.attr#progress_text_offset} attribute's value can be found in the {@link #NumberProgressBar} array. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name Com.Mkh75Health_Medical:progress_text_offset */ public static final int NumberProgressBar_progress_text_offset = 8; /** <p>This symbol is the offset where the {@link Com.Mkh75Health_Medical.R.attr#progress_text_size} attribute's value can be found in the {@link #NumberProgressBar} array. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name Com.Mkh75Health_Medical:progress_text_size */ public static final int NumberProgressBar_progress_text_size = 6; /** <p>This symbol is the offset where the {@link Com.Mkh75Health_Medical.R.attr#progress_text_visibility} attribute's value can be found in the {@link #NumberProgressBar} array. <p>Must be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>visible</code></td><td>0</td><td></td></tr> <tr><td><code>invisible</code></td><td>1</td><td></td></tr> </table> @attr name Com.Mkh75Health_Medical:progress_text_visibility */ public static final int NumberProgressBar_progress_text_visibility = 9; /** <p>This symbol is the offset where the {@link Com.Mkh75Health_Medical.R.attr#progress_unreached_bar_height} attribute's value can be found in the {@link #NumberProgressBar} array. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name Com.Mkh75Health_Medical:progress_unreached_bar_height */ public static final int NumberProgressBar_progress_unreached_bar_height = 5; /** <p>This symbol is the offset where the {@link Com.Mkh75Health_Medical.R.attr#progress_unreached_color} attribute's value can be found in the {@link #NumberProgressBar} array. <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name Com.Mkh75Health_Medical:progress_unreached_color */ public static final int NumberProgressBar_progress_unreached_color = 2; /** Attributes that can be used with a Themes. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #Themes_numberProgressBarStyle Com.Mkh75Health_Medical:numberProgressBarStyle}</code></td><td></td></tr> </table> @see #Themes_numberProgressBarStyle */ public static final int[] Themes = { 0x7f01000a }; /** <p>This symbol is the offset where the {@link Com.Mkh75Health_Medical.R.attr#numberProgressBarStyle} attribute's value can be found in the {@link #Themes} array. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". @attr name Com.Mkh75Health_Medical:numberProgressBarStyle */ public static final int Themes_numberProgressBarStyle = 0; }; }
d43c3ebf918ac6f3a6eb9350563f0e9a42afd063
6c0193d244afdfb94da66efcd8f4bfc835eb63fa
/ocmsdk/src/main/java/com/gigigo/orchextra/core/sdk/OcmSchemeHandler.java
16acd22f1fedb9fa5f8814016c3cb8d9bb85ddb9
[]
no_license
pedroamador/orchextra-content-android-sdk
3a07a530733b098cfcc055e54903980428c2eb07
1ccd8f26fd1c42830c2bb50b6fe3c8da67122830
refs/heads/master
2021-05-02T10:42:45.112080
2017-05-08T14:10:48
2017-05-08T14:10:48
120,762,436
0
0
null
2018-02-08T13:05:08
2018-02-08T13:05:08
null
UTF-8
Java
false
false
511
java
package com.gigigo.orchextra.core.sdk; import com.gigigo.orchextra.core.sdk.application.OcmContextProvider; import com.gigigo.orchextra.core.sdk.model.detail.DetailActivity; public class OcmSchemeHandler { private final OcmContextProvider contextProvider; public OcmSchemeHandler(OcmContextProvider contextProvider) { this.contextProvider = contextProvider; } public void processScheme(String path) { DetailActivity.open(contextProvider.getCurrentActivity(), path, null, 0, 0, null); } }
7a5fb70e2025ad477f1400a07cf6967313d36c3a
f6a584e54039b7d6478cb591d3084dfd16529ad0
/gmall-user-service/src/main/java/com/meng/gmall/user/service/impl/UserMemberReceiveAddressServiceImpl.java
f367b19d0bfcffb8150d9734c7b439285ea555cc
[]
no_license
misssong123/gmall0206
4b9dfd37e0a584b3debbd1b71a6e4b61fcdd5bcb
4e04e3e2dd91d28b631f0bb0cd3ccf45901b908f
refs/heads/main
2023-03-07T09:23:39.622480
2021-02-22T11:14:55
2021-02-22T11:14:55
336,546,723
0
0
null
null
null
null
UTF-8
Java
false
false
915
java
package com.meng.gmall.user.service.impl; import com.alibaba.dubbo.config.annotation.Service; import com.meng.gmall.bean.UmsMemberReceiveAddress; import com.meng.gmall.service.UserMemberReceiveAddressService; import com.meng.gmall.user.mapper.UmsMemberReceiveAddressMapper; import org.springframework.beans.factory.annotation.Autowired; import java.util.List; @Service public class UserMemberReceiveAddressServiceImpl implements UserMemberReceiveAddressService { @Autowired UmsMemberReceiveAddressMapper umsMemberReceiveAddressMapper; @Override public List<UmsMemberReceiveAddress> getReceiveAddressByMemberId(String memberId) { UmsMemberReceiveAddress demo = new UmsMemberReceiveAddress(); demo.setMemberId(memberId); List<UmsMemberReceiveAddress> umsMemberReceiveAddresses = umsMemberReceiveAddressMapper.select(demo); return umsMemberReceiveAddresses; } }
1627b45b9fbda682948aa997afba70ca5dbffd51
7295f909dc1b1ac6698773f6c5ff2656c59fe88f
/src/main/java/com/registel/rdw/datos/AccesoPerfilBD.java
9b942d21b0e0083af56a1d1cfa0f1cfed7d813aa
[]
no_license
maorcomaop/pruebas
e67b253951de4d5be627c57a53fb5d9c8db25f52
d232feab4972981d16f1aa3ee550feaf4e07c59a
refs/heads/master
2020-04-06T12:03:21.319912
2018-11-13T21:21:05
2018-11-13T21:21:05
157,441,832
0
0
null
null
null
null
UTF-8
Java
false
false
8,812
java
/** * Clase modelo que permite la comunicacion entre la base de datos y la aplicacion */ package com.registel.rdw.datos; import com.registel.rdw.logica.Acceso; import com.registel.rdw.logica.AccesoAccesoPerfil; import com.registel.rdw.logica.AccesoPerfil; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import com.registel.rdw.logica.Alarma; import java.sql.Statement; import java.util.ArrayList; import java.util.List; /** * * @author lider_desarrollador */ public class AccesoPerfilBD { static String procedimiento = "proc_tbl_acceso_perfil"; public static ArrayList<AccesoAccesoPerfil> selectByPerfilId(Integer fkPerfil, Integer fkPerfilUsuarioLogin) { return selectByPerfilId(fkPerfil, false, fkPerfilUsuarioLogin); } public static ArrayList<AccesoAccesoPerfil> selectByPerfilId(Integer fkPerfil, boolean permissions, Integer fkPerfilUsuarioLogin) { PilaConexiones pila_con = PilaConexiones.obtenerInstancia(); Connection con = pila_con.obtenerConexion(); PreparedStatement ps = null; ResultSet rs = null; String joinType = "LEFT"; if (permissions) { joinType = "INNER"; } String sql = "SELECT accs_prfl.PK_ACCESO_PERFIL," + "accs_prfl.FK_PERFIL," + "accs.PK_ACCESO," + "accs.FK_ACCESO_PADRE," + "accs.FK_GRUPO," + "accs.SUBGRUPO," + "accs.POSICION," + "accs.NOMBRE_ACCESO," + "accs.ALIAS_ACCESO," + "accs.FK_ACCESO_TIPO," + "accs.FK_MODULO," + " ? as FK_PERFIL_USUARIO_LOGIN," + "accs.MAXSUBGRUPO " + "FROM " + "(SELECT (SELECT MAX(SUBGRUPO) as MAXSUBGRUPO_ FROM tbl_acceso) as MAXSUBGRUPO, PK_ACCESO, FK_ACCESO_PADRE, FK_GRUPO, NOMBRE_ACCESO ,ALIAS_ACCESO, SUBGRUPO,POSICION, FK_ACCESO_TIPO, FK_MODULO, ESTADO FROM tbl_acceso WHERE ESTADO = 1) accs " + joinType + " JOIN " + "(SELECT PK_ACCESO_PERFIL, FK_PERFIL, FK_ACCESO, ESTADO FROM tbl_acceso_perfil WHERE FK_PERFIL = ? AND ESTADO = 1) accs_prfl " + "ON accs.PK_ACCESO = accs_prfl.FK_ACCESO ORDER BY accs.SUBGRUPO DESC, accs.POSICION"; try { ps = con.prepareStatement(sql); ps.setInt(1, fkPerfilUsuarioLogin); ps.setInt(2, fkPerfil); rs = ps.executeQuery(); //System.out.println("sql permissos " + sql); ArrayList<AccesoAccesoPerfil> lst_aap = new ArrayList<>(); while (rs.next()) { AccesoAccesoPerfil a = new AccesoAccesoPerfil(); a.setPkAcceso(rs.getInt("PK_ACCESO")); a.setPkAccesoPerfil(rs.getInt("PK_ACCESO_PERFIL")); a.setFkAccesoPadre(rs.getInt("FK_ACCESO_PADRE")); a.setFkGrupo(rs.getInt("FK_GRUPO")); a.setFkAccesoTipo(rs.getInt("FK_ACCESO_TIPO")); a.setFkModulo(rs.getInt("FK_MODULO")); a.setNombreAcceso(rs.getString("NOMBRE_ACCESO")); a.setAliasAcceso(rs.getString("ALIAS_ACCESO")); a.setSubGrupo(rs.getInt("SUBGRUPO")); a.setPosicion(rs.getInt("POSICION")); a.setFkPerfil(rs.getInt("FK_PERFIL")); a.setMaxSubGrupo(rs.getInt("MAXSUBGRUPO")); a.setFkPerfilUsuarioLogin(rs.getInt("FK_PERFIL_USUARIO_LOGIN")); lst_aap.add(a); } return lst_aap; } catch (SQLException e) { System.out.println(e); } finally { UtilBD.closeResultSet(rs); UtilBD.closePreparedStatement(ps); pila_con.liberarConexion(con); } return null; } public static boolean editAccesosPerfil(List<Integer> accesosId, Integer fkPerfil) { PilaConexiones pila_con = PilaConexiones.obtenerInstancia(); Connection conn = pila_con.obtenerConexion(); PreparedStatement ps = null; ResultSet rs = null; String sqlUpdt0 = "UPDATE tbl_acceso_perfil SET ESTADO = 0 WHERE FK_PERFIL = ?;"; try { ps = conn.prepareStatement(sqlUpdt0); ps.setInt(1, fkPerfil); ps.executeUpdate(); List<Integer> lapInsrt1 = new ArrayList<>(); List<Integer> lapUpdt1 = new ArrayList<>(); for (Integer fkAcceso : accesosId) { AccesoPerfil ap = getByAceesoPerfilWoConn(fkAcceso, fkPerfil, conn); if (ap != null) { lapUpdt1.add(fkAcceso); } else { lapInsrt1.add(fkAcceso); } } if (lapUpdt1.size() > 0) { String sqlUpdt1 = "UPDATE tbl_acceso_perfil SET ESTADO = CASE "; for (Integer fkAcceso : lapUpdt1) { sqlUpdt1 += "WHEN (FK_PERFIL = " + fkPerfil + " AND FK_ACCESO =" + fkAcceso + ") THEN 1 "; } sqlUpdt1 += "ELSE ESTADO END;"; ps = conn.prepareStatement(sqlUpdt1); ps.executeUpdate(); } if (lapInsrt1.size() > 0) { String sqlInsrt1 = "INSERT INTO tbl_acceso_perfil (FK_PERFIL, FK_ACCESO, ESTADO, MODIFICACION_LOCAL) VALUES "; for (Integer fkAcceso : lapInsrt1) { sqlInsrt1 += "(" + fkPerfil + "," + fkAcceso + ",1,1),"; } sqlInsrt1 = sqlInsrt1.substring(0, sqlInsrt1.length() - 1); sqlInsrt1 += ";"; ps = conn.prepareStatement(sqlInsrt1); ps.executeUpdate(); } } catch (SQLException e) { System.out.println(e); } finally { UtilBD.closeResultSet(rs); UtilBD.closePreparedStatement(ps); pila_con.liberarConexion(conn); } return true; } public AccesoPerfil getByIdWoConn(Integer id, Connection conn) { AccesoPerfil accesoPerfil = null; try { Statement st = conn.createStatement(); st.executeUpdate("START TRANSACTION;"); String query = "CALL " + procedimiento + " (" + id + ", " + UtilBD.getNullFields(5) + " NULL, NULL , 3);"; ResultSet rs = st.executeQuery(query); while (rs.next()) { accesoPerfil = new AccesoPerfil(); accesoPerfil.setId(rs.getInt("PK_ACCESO_PERFIL")); accesoPerfil.setFkPerfil(rs.getInt("FK_PERFIL")); accesoPerfil.setFkAcceso(rs.getInt("FK_ACCESO")); accesoPerfil.setEstado(rs.getInt("ESTADO")); accesoPerfil.setModificacionLocal(rs.getShort("MODIFICACION_LOCAL")); accesoPerfil.setFechaModificacion(rs.getTimestamp("FECHA_MODIFICACION")); } } catch (SQLException e) { System.out.println(e); } return accesoPerfil; } public static AccesoPerfil getByAceesoPerfilWoConn(Integer fkAcceso, Integer fkPerfil, Connection conn) { AccesoPerfil accesoPerfil = null; try { Statement st = conn.createStatement(); st.executeUpdate("START TRANSACTION;"); String query = "CALL " + procedimiento + " (NULL, " + fkPerfil + "," + fkAcceso + "," + UtilBD.getNullFields(4) + " NULL, NULL , 3);"; ResultSet rs = st.executeQuery(query); while (rs.next()) { accesoPerfil = new AccesoPerfil(); accesoPerfil.setId(rs.getInt("PK_ACCESO_PERFIL")); accesoPerfil.setFkPerfil(rs.getInt("FK_PERFIL")); accesoPerfil.setFkAcceso(rs.getInt("FK_ACCESO")); accesoPerfil.setEstado(rs.getInt("ESTADO")); accesoPerfil.setModificacionLocal(rs.getShort("MODIFICACION_LOCAL")); accesoPerfil.setFechaModificacion(rs.getTimestamp("FECHA_MODIFICACION")); } } catch (SQLException e) { System.out.println(e); } return accesoPerfil; } public static AccesoPerfil getEntidad(ResultSet resultset) throws SQLException { AccesoPerfil entidad = new AccesoPerfil(); entidad.setFechaModificacion(resultset.getTimestamp("FECHA_MODIFICACION")); entidad.setModificacionLocal(resultset.getShort("MODIFICACION_LOCAL")); entidad.setId(resultset.getInt("PK_ACCESO_PERFIL")); entidad.setFkPerfil(resultset.getInt("FK_PERFIL")); entidad.setFkAcceso(resultset.getInt("FK_ACCESO")); entidad.setEstado(resultset.getShort("ESTADO")); return entidad; } }//FIN DE CLASE
81cc3aa6331dce73e9f7ff409d42c76d099e4b1a
178793be999c199d1a65ad9a87cf75359c7f288a
/src/main/java/ro/jademy/contactlist/UserForm.java
bdc97d571f6edc32a1c0ef6fe8e300718dae8a7a
[]
no_license
bogdansava-github/ContactList
0aa5d319377382dfa4982ae60189a816678432a3
48f963c8fc8c6722561244575ed7a00707eb149d
refs/heads/master
2020-12-11T17:48:10.494644
2020-03-21T20:01:58
2020-03-21T20:01:58
233,916,233
0
0
null
2020-01-14T19:24:20
2020-01-14T19:12:55
null
UTF-8
Java
false
false
5,923
java
package ro.jademy.contactlist; import ro.jademy.contactlist.model.Address; import ro.jademy.contactlist.model.Company; import ro.jademy.contactlist.model.PhoneNumber; import ro.jademy.contactlist.model.User; import ro.jademy.contactlist.service.FileUserService; import java.util.*; public class UserForm { public User createNewUser(int id) { System.out.print("Input first name: "); String fName = Main.scanner.nextLine(); System.out.print("Input last name: "); String lName = Main.scanner.nextLine(); System.out.print("Input job title: "); String jobTitle = Main.scanner.nextLine(); //scanner.next(); System.out.print("Input company name: "); String companyName = Main.scanner.nextLine(); //scanner.next(); System.out.println("Input the work phone number"); System.out.print("Country Prefix: "); String workPhonePrefix = Main.scanner.nextLine(); System.out.print("Work phone number: "); String workPhoneNumber = Main.scanner.nextLine(); System.out.println("Input the mobile phone number"); System.out.print("Country Prefix: "); String mobilePhonePrefix = Main.scanner.nextLine(); System.out.print("Mobile phone number: "); String mobilePhoneNumber = Main.scanner.nextLine(); System.out.println("Input the home phone number"); System.out.print("Country Prefix: "); String homePhonePrefix = Main.scanner.nextLine(); System.out.print("Home phone number: "); String homePhoneNumber = Main.scanner.nextLine(); Map<String, PhoneNumber> phoneNumbersNewUser = new HashMap<>(); phoneNumbersNewUser.put("w", new PhoneNumber(workPhonePrefix, workPhoneNumber)); phoneNumbersNewUser.put("m", new PhoneNumber(mobilePhonePrefix, mobilePhoneNumber)); phoneNumbersNewUser.put("h", new PhoneNumber(homePhonePrefix, homePhoneNumber)); System.out.print("Input the e-mail: "); String email = Main.scanner.nextLine(); System.out.println("Input the home address"); System.out.print("Street name: "); String streetNameHome = Main.scanner.nextLine(); int x = 1; int streetNrHome = 0; do { try { System.out.print("Street number: "); streetNrHome = Main.scanner.nextInt(); x = 2; } catch (InputMismatchException ex) { System.out.println("Please input a number!!!"); Main.scanner.nextLine(); } } while (x == 1); Main.scanner.nextLine(); x = 1; int aptNrHome = 0; do { try { System.out.print("Apartment number: "); aptNrHome = Main.scanner.nextInt(); Main.scanner.nextLine(); x = 2; } catch (InputMismatchException ex) { System.out.println("Please input a number!!!"); Main.scanner.nextLine(); } } while (x == 1); System.out.print("Floor: "); String floorHome = Main.scanner.nextLine(); System.out.print("ZipCode: "); String zipCodeHome = Main.scanner.nextLine(); System.out.print("City: "); String cityHome = Main.scanner.nextLine(); System.out.print("Country: "); String countryHome = Main.scanner.nextLine(); Address homeAddress = new Address(streetNameHome, streetNrHome, aptNrHome, floorHome, zipCodeHome, cityHome, countryHome); System.out.println("Input the work address"); System.out.print("Street name: "); String streetNameWork = Main.scanner.nextLine(); x = 1; int streetNrWork = 0; do { try { System.out.print("Street number: "); streetNrWork = Main.scanner.nextInt(); x = 2; } catch (InputMismatchException ex) { System.out.println("Please input a number!!!"); Main.scanner.nextLine(); } } while (x == 1); x = 1; int aptNrWork = 0; do { try { System.out.print("Apartment number: "); aptNrWork = Main.scanner.nextInt(); Main.scanner.nextLine(); x = 2; } catch (InputMismatchException ex) { System.out.println("Please input a number!!!"); Main.scanner.nextLine(); } } while (x == 1); System.out.print("Floor: "); String floorWork = Main.scanner.nextLine(); System.out.print("ZipCode: "); String zipCodeWork = Main.scanner.nextLine(); System.out.print("City: "); String cityWork = Main.scanner.nextLine(); System.out.print("Country: "); String countryWork = Main.scanner.nextLine(); Address workAddress = new Address(streetNameWork, streetNrWork, aptNrWork, floorWork, zipCodeWork, cityWork, countryWork); Company company = new Company(companyName, workAddress); x = 1; int age = 0; do { try { System.out.print("Input age: "); age = Main.scanner.nextInt(); Main.scanner.nextLine(); x = 2; } catch (InputMismatchException ex) { System.out.println("Please input a number!!!"); Main.scanner.nextLine(); } } while (x == 1); System.out.print("Add to favorite? (y/n): "); String answer = Main.scanner.next(); boolean isFavorite = answer.equals("y") || answer.equals("Y"); return new User(id, fName, lName, email, age, phoneNumbersNewUser, homeAddress, jobTitle, company, isFavorite); } }
2b85abf4678791a089030eb85f60629f9d7480d6
2686a30b43e7bda9c55f3c159b116f0b1344fcfb
/source/src/main/java/org/formix/btb/PrimaryKeyNotFoundException.java
bf3baa28e5a1b55944ff01ac85cb77a3dd24af7f
[ "Apache-2.0" ]
permissive
formix/btb
7a86bc15b8fc12f56ed4ad0393d3281cbae8ea8d
866ae1332173b4496fc7e25ff19e9c3ea7b5fe1f
refs/heads/master
2020-06-05T16:22:34.413815
2015-09-01T11:42:08
2015-09-01T11:42:08
41,174,696
0
0
null
null
null
null
UTF-8
Java
false
false
1,970
java
/** * Copyright 2012 Jean-Philippe Gravel, P. Eng., CSDP * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy * of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package org.formix.btb; /** * Thrown when no primary key is found for a class. Valid properties for primary * keys are limited to "id" and "id<i>ClassName</i>. * * @author Jean-Philippe Gravel */ public class PrimaryKeyNotFoundException extends RuntimeException { private static final long serialVersionUID = 0x6259064e8b481decL; /** * Creates the default instance of this exception. */ public PrimaryKeyNotFoundException() { super(); } /** * Creates an instance of the exception using the specified message. * * @param message * The message of the exception. */ public PrimaryKeyNotFoundException(String message) { super(message); } /** * Creates an instance of the exception using the specified cause. * * @param cause * The cause of this exception. */ public PrimaryKeyNotFoundException(Throwable cause) { super(cause); } /** * Creates a new instance of the exception using both the specified message * and cause. * * @param message * The message of the exception. * @param cause * The cause of this exception. */ public PrimaryKeyNotFoundException(String message, Throwable cause) { super(message, cause); } }
53390d8a526e706a338d89f281f3a95ea0a071ad
e18adf088cae846ea075a4f3986224193cba025a
/commons/src/com/superstudio/commons/csharpbridge/StringComparison.java
04bfa182a09933073c4c328f7531db66f063d3e1
[]
no_license
dotnetfish/JRazor
80bd154d18eed6c04d38dbc3ad959bc53d19d0c8
373374e16de75f98737b1fa54f453be1f25a94c6
refs/heads/master
2020-05-21T04:28:29.693903
2016-06-29T01:29:46
2016-06-29T01:29:46
44,751,853
2
0
null
2015-11-06T04:58:09
2015-10-22T14:43:51
Java
UTF-8
Java
false
false
117
java
package com.superstudio.commons.csharpbridge; public enum StringComparison { Ordinal, OrdinalIgnoreCase }
f96ea2b06a94c8534656bbe0d39ea9a58bced148
25b7b2d5edd71d7974ebad3232c5fc9e1818710f
/springjpadb/src/main/java/com/example/springjpadb/model/AppUser.java
162850e608aada7e683784d41c937f4bf4c3b897
[]
no_license
madluk-me/springbootapp
ad08e900b00a3d9612389427a9fad8675dd888c0
64708d305005da983fd3238e9d4914607607ea2b
refs/heads/master
2022-12-10T13:22:49.767442
2020-08-15T09:59:33
2020-08-15T09:59:33
287,695,255
0
0
null
null
null
null
UTF-8
Java
false
false
1,472
java
package com.example.springjpadb.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.UniqueConstraint; @Entity @Table(name = "App_User", // uniqueConstraints = { // @UniqueConstraint(name = "APP_USER_UK", columnNames = "User_Name") }) public class AppUser { @Id @GeneratedValue @Column(name = "User_Id", nullable = false) private Long userId; @Column(name = "User_Name", length = 36, nullable = false) private String userName; @Column(name = "Encryted_Password", length = 128, nullable = false) private String encrytedPassword; @Column(name = "Enabled", length = 1, nullable = false) private boolean enabled; public Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getEncrytedPassword() { return encrytedPassword; } public void setEncrytedPassword(String encrytedPassword) { this.encrytedPassword = encrytedPassword; } public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } }
4a400644f8754c490462fbe46a8641e199130eac
fa44c25029681b06c6793d6f0cb405f1cfba8e67
/nio-demos/NioDemo/src/main/java/com/dongnao/nio/server/NIOServer.java
3283eb749a406c1fe48b411b3fb1c19ee277a679
[]
no_license
evefost/JavaAdvanceStudy
126ef64b842c84c5022beac92dd62acd17e479d2
2e2fde47fcc2886055a478938d9ff9824453895e
refs/heads/master
2021-01-11T18:45:47.123892
2017-09-24T07:32:09
2017-09-24T07:32:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,258
java
package com.dongnao.nio.server; import java.io.IOException; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; /** * Java中定义了四个常量来表示这四种操作类型: * SelectionKey.OP_CONNECT 客户端关注连接上 * SelectionKey.OP_ACCEPT 服务端关注客户端接入 * SelectionKey.OP_READ * SelectionKey.OP_WRITE * 如果Selector对通道的多操作类型感兴趣,可以用“位或”操作符来实 * int interestSet=SelectionKey.OP_READ|SelectionKey.OP_WRITE; */ public class NIOServer { int port = 8080; ServerSocketChannel serverSocketChannel; Selector selector; ByteBuffer receiveBuffer = ByteBuffer.allocate(1024); ByteBuffer sendBuffer = ByteBuffer.allocate(1024); Map<SelectionKey, String> sessionMsg = new HashMap<SelectionKey, String>(); public NIOServer(int port) throws IOException { this.port = port; //ServerSocketChannel 服务端channecl //SocketChannel 客户端channel //打开服务通道 serverSocketChannel = ServerSocketChannel.open(); //绑定服务端接入端口 serverSocketChannel.socket().bind(new InetSocketAddress(this.port)); //设置为非阻塞 serverSocketChannel.configureBlocking(false); selector = Selector.open(); //注册接入事件,服务端自已这个通道只关注接入 serverSocketChannel.register(selector, SelectionKey.OP_ACCEPT); System.out.println("NIO Server启动 " + this.port); } public void listener() throws IOException { while (true) { //只要反应堆里面没东西了,那么就会阻塞在这个位置(相当于排队) int i = selector.selectNow();//阻塞方法,就相当于调用了wakeup,是一个阻塞方法 if (i == 0) { continue; } System.out.println("反应堆有新的事件触发......."); Set<SelectionKey> keys = selector.selectedKeys(); Iterator<SelectionKey> iterator = keys.iterator(); while (iterator.hasNext()) { SelectionKey key = iterator.next(); try { process(key); } catch (Exception e) { e.printStackTrace(); System.out.println("处理处事件异常:" + e.toString()); key.channel().close(); } iterator.remove(); } } } private void process(SelectionKey key) throws IOException { if (key.isAcceptable()) { System.out.println("process 可接入事件,注册关注读操作事件"); SocketChannel client = serverSocketChannel.accept(); // System.out.println(client); client.configureBlocking(false); //注册读事件后,当某个客户端的channel 有写数据进来,Selector 中有会有该channel的信息 //selector.selectedKeys() //如果Selector对通道的多操作类型感兴趣,可以用“位或”操作符来实现: // int interestSet=SelectionKey.OP_READ|SelectionKey.OP_WRITE client.register(selector, SelectionKey.OP_READ); } else if (key.isReadable()) { System.out.println("process 可读,注册关注读操作事件"); receiveBuffer.clear(); SocketChannel client = (SocketChannel) key.channel(); // System.out.println(client); int len = client.read(receiveBuffer); if (len > 0) { String msg = new String(receiveBuffer.array(), 0, len); sessionMsg.put(key, msg); System.out.println(System.currentTimeMillis() + " 收到客户端信息:" + msg); } client.register(selector, SelectionKey.OP_WRITE); } else if (key.isWritable()) { System.out.println("process 可写,注册可读作事件"); if (!sessionMsg.containsKey(key)) { return; } SocketChannel client = (SocketChannel) key.channel(); // System.out.println(client); sendBuffer.clear(); sendBuffer.put(new String(sessionMsg.get(key) + ",我是服务端").getBytes()); sendBuffer.flip();// client.write(sendBuffer); //册注读操作 client.register(selector, SelectionKey.OP_READ); //SelectionKey.OP_ACCEPT//����ˣ�ֻҪ�ͻ������ӣ��ʹ��� //SelectionKey.OP_CONNECT//�ͻ��ˣ�ֻҪ�����˷���ˣ��ʹ��� //SelectionKey.OP_READ//ֻҪ�������������ʹ��� //SelectionKey.OP_WRITE//ֻҪ����д�������ʹ��� } } public static void main(String[] args) throws IOException { new NIOServer(8080).listener(); } }
911142f397f85c791081280d5f6f8ac7ad600501
71436966929068fdedfccc05dcffccc4ed6a6d82
/HW09/test/hr/fer/zemris/math/ComplexTest.java
adb8d932417a9ebe5fd8e9879c41316729969c27
[]
no_license
antegrbesa/java-course
74d03481352c3fe48159a4c1ed436676191db232
355f54ba38cfab8e68e8a03669ac23038799590b
refs/heads/master
2021-07-01T05:40:40.600902
2017-09-21T17:19:42
2017-09-21T17:19:42
104,371,910
0
0
null
null
null
null
UTF-8
Java
false
false
2,365
java
package hr.fer.zemris.math; import static org.junit.Assert.*; import java.util.List; import org.junit.Before; import org.junit.Test; public class ComplexTest { Complex real; Complex imag; Complex both; Complex bothSec; @Before public void setUp() throws Exception { real = new Complex(4.12, 0); imag = new Complex(0, 2.25); both = new Complex(4.12, 2.25); bothSec = new Complex(2.25, 4.12); } @Test public void testGetReal() { assertEquals(4.12, both.getReal(), 1E-6); } @Test public void testGetImaginary() { assertEquals(2.25, both.getImaginary(), 1E-6); } @Test public void testModule() { assertEquals(4.69434, both.module(), 1E-5); } @Test public void testAdd() { Complex c = both.add(bothSec); assertEquals(6.37, c.getReal(), 1E-6); assertEquals(6.37, c.getImaginary(), 1E-6); } @Test public void testSub() { Complex c = both.sub(bothSec); assertEquals(1.87, c.getReal(), 1E-6); assertEquals(-1.87, c.getImaginary(), 1E-6); } @Test public void testMul() { Complex c = both.multiply(bothSec); assertEquals(0.0, c.getReal(), 1E-6); assertEquals(22.0369, c.getImaginary(), 1E-6); } @Test public void testDiv() { Complex c = both.divide(bothSec); assertEquals(0.841316, c.getReal(), 1E-6); assertEquals(-0.540543, c.getImaginary(), 1E-6); } @Test public void testPower() { Complex c = both.power(3); assertEquals(7.362028, c.getReal(), 1E-6); assertEquals(103.186575, c.getImaginary(), 1E-6); } @Test public void testRoot() { List<Complex> list = both.root(3); assertEquals(1.65121, list.get(0).getReal(), 1E-5); assertEquals(0.277697, list.get(0).getImaginary(), 1E-5); assertEquals(-1.0661, list.get(1).getReal(), 1E-5); assertEquals(1.29114, list.get(1).getImaginary(), 1E-5); assertEquals(-0.58511, list.get(2).getReal(), 1E-5); assertEquals(-1.56884, list.get(2).getImaginary(), 1E-5); } @Test public void testRootImaginaryOnly() { List<Complex> list = imag.root(3); assertEquals(1.13481, list.get(0).getReal(), 1E-5); assertEquals(0.655185, list.get(0).getImaginary(), 1E-5); assertEquals(-1.13481, list.get(1).getReal(), 1E-5); assertEquals(0.655185, list.get(1).getImaginary(), 1E-5); } }
a6aa4650e2dc464a229d5d689d1163886e94bd51
4bc6514505f68643a087e9f44819c0b564250fce
/Lab2/Conjunto.java
46d8e0e0caa2895f55bb53092d49da73b7ed12df
[]
no_license
rubensandersonn/TarefasTecnicas
554f377faf2fbe56d3be92be997de090d9c5186d
3c9542d62e66f33e9a9cdf94adfdfa203000d687
refs/heads/master
2020-05-15T04:30:05.589607
2019-04-18T12:52:25
2019-04-18T12:52:25
182,087,208
0
0
null
null
null
null
UTF-8
Java
false
false
1,451
java
/* Laboratório 2: Operaçoes com Conjuntos Autor: Rubens A. de Sousa Silva, 362984 Ciencia da computação UFC 2018.1 */ import java.util.ArrayList; import java.util.Collections; public class Conjunto <T>{ private ArrayList <T> set = new ArrayList<T>(); public Conjunto(){ } //public Conjunto(ArrayList <Integer> set){ public Conjunto(ArrayList <T> set){ this.set = set; } // (1.2) public void addEl(T el){ this.set.remove(el); this.set.add(el); } public void addSet(Conjunto subSet){ this.set.removeAll(subSet.getAll()); this.set.addAll(subSet.getAll()); } public void removeSet(Conjunto subSet){ this.set.removeAll(subSet.getAll()); } // (1.3) public boolean verifyEl(T el){ return this.set.contains(el); } // (1.4) public boolean containsSet(Conjunto subSet){ return this.set.containsAll(subSet.getAll()); } /*public void show(){ System.out.println(" " + set.toString()); }*/ public void show(){ System.out.print("\n ["); show(set); System.out.println("]"); } private void show(ArrayList<T> El){ for (int i = 0; i < El.size(); i++){ if (El.get(i) instanceof Conjunto){ System.out.print(" { "); Conjunto c = (Conjunto) El.get(i); show( c.getAll() ); System.out.print(" } "); }else{ System.out.print(El.get(i).toString() + " "); } } } public ArrayList <T> getAll(){ return new ArrayList<T>(set); } }
49154be2ed86092130d950212b9946b4f717fff9
a1c8efd74c862971764caeec49df62f84ca8f36e
/spring-mvc-demo/src/com/rama/springdemo/mvc/Student.java
41e15ef6837b54fa0f7dcb88790682fc582a10c4
[]
no_license
ramasubbaiya/Spring-and-Hibernate-Project
c06e2d7300f86ad837fca5201000d9818c4066e7
2c1c2e16e9b2d3777f6941de1089d769b782202d
refs/heads/master
2020-07-08T21:41:48.878527
2016-09-01T21:08:32
2016-09-01T21:08:32
66,019,821
0
0
null
null
null
null
UTF-8
Java
false
false
1,326
java
package com.rama.springdemo.mvc; import java.util.LinkedHashMap; public class Student { private String firstName; private String lastName; private String country; private String favoriteLanguage; private LinkedHashMap<String, String> countryOptions; public Student() { // populate country options: used ISO country code countryOptions = new LinkedHashMap<>(); countryOptions.put("BR", "Brazil"); countryOptions.put("FR", "France"); countryOptions.put("GR", "Germany"); countryOptions.put("IN", "India"); } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public LinkedHashMap<String, String> getCountryOptions() { return countryOptions; } public String getFavoriteLanguage() { return favoriteLanguage; } public void setFavoriteLanguage(String favoriteLanguage) { this.favoriteLanguage = favoriteLanguage; } public void setCountryOptions(LinkedHashMap<String, String> countryOptions) { this.countryOptions = countryOptions; } }
aac9977382146996f3916314cd22f70990bb1da9
0dd214e07eb1c3ed8b05d48056571f67388c3fce
/poi_sample1/src/listeners/RequestListener.java
57c554bf3505aeaad4dcd14f620af361e0a9e279
[]
no_license
OlgaDery/poi_sample1
364ad77b22182d7ae088b8226f0dee2ea9fe7379
6bd358880e7d46ccf314c76b22a340dde93185fb
refs/heads/master
2020-04-02T04:07:36.491768
2017-10-23T05:32:55
2017-10-23T05:32:55
63,897,911
0
0
null
null
null
null
UTF-8
Java
false
false
1,262
java
package listeners; import javax.servlet.ServletRequestEvent; import javax.servlet.ServletRequestListener; import javax.servlet.annotation.WebListener; import javax.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Application Lifecycle Listener implementation class RequestListener, tracks the uri for each request * */ @WebListener public class RequestListener implements ServletRequestListener { private final Logger logger = LoggerFactory.getLogger(RequestListener.class); /** * @see ServletRequestListener#requestInitialized(ServletRequestEvent) */ @Override public void requestInitialized(ServletRequestEvent sre) { logger.info("ENTER requestInitialized(sre)"); final HttpServletRequest request = (HttpServletRequest) sre.getServletRequest(); logger.info("URI: {}", request.getRequestURI()); logger.info("EXIT requestInitialized(sre)"); } /** * @see ServletRequestListener#requestDestroyed(ServletRequestEvent) */ @Override public void requestDestroyed(ServletRequestEvent sre) { logger.info("ENTER requestDestroyed(sre)"); logger.info("EXIT requestDestroyed(sre)"); } }
bced0cc7a841ba3e13908fdbd50205c50643395e
d651f757efa4a23deb86f02f1d3ba52493ef11d1
/src/JavaCore_06/Student.java
493455c611e78cbe418750acedde319b53374cdd
[]
no_license
AlekStark/JavaCore_01
c9e6719c3ab92813dcbdc7f31431cf7e22fa29ad
29985dbf9cb5329da81cc0edc3ec9641d1d1837b
refs/heads/master
2023-04-03T17:03:19.078012
2021-03-23T10:39:25
2021-03-23T10:39:25
313,678,021
0
0
null
null
null
null
UTF-8
Java
false
false
201
java
package JavaCore_06; public class Student { private String name; public void setName(String name){ this.name = name; } public String getName() { return name; } }
f0520ab7d010102a435218a9e729a6159bf1c462
56d533031135c90daed25c050d52373cc4ef44e3
/ready-work-cloud/src/main/java/work/ready/cloud/transaction/core/transaction/TransactionType.java
90420d0e774bb70292602bb00d049cb0305b648c
[ "Apache-2.0" ]
permissive
LyuWeihua/ReadyWork
519736b4c7e2c8515f655f6b25772300155a796a
d85d294c739d04052b6b4b365f0d3670564fc05e
refs/heads/main
2023-08-19T09:10:21.558128
2021-09-29T18:20:54
2021-09-29T18:20:54
411,740,933
2
0
null
null
null
null
UTF-8
Java
false
false
1,643
java
/** * * Copyright (c) 2020 WeiHua Lyu [ready.work] * * 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 work.ready.cloud.transaction.core.transaction; import work.ready.cloud.transaction.core.controller.DtxLocalController; import work.ready.cloud.transaction.core.propagation.PropagationState; import work.ready.cloud.transaction.core.message.CmdExecuteService; import work.ready.cloud.transaction.common.exception.TransactionTypeException; import work.ready.cloud.transaction.common.message.CmdType; import java.lang.reflect.Method; public interface TransactionType { String getName(); void init(); boolean verifyDeclaration(Method method) throws TransactionTypeException; void setBusinessController(PropagationState propagationState, DtxLocalController controller); DtxLocalController getBusinessController(PropagationState propagationState); void setCmdExecuteService(CmdType cmdType, CmdExecuteService service); CmdExecuteService getCmdExecuteService(CmdType cmdType); TransactionClearanceService getClearanceService(); TransactionResourceHandler getResourceHandler(); }
5ceb7d54020c7b22360dec46162d24bce1743d16
759ee9796703c04af0a69c04ceaf730029963f55
/src/main/java/com/banksource/onlinebank/service/mainServices/roleServiceInterface.java
e3ff30e94e44a762ae6f6a6de67f67d6d531aeae
[]
no_license
DoshikKing/online-bank
37cffb44abc48e94e4253e74db976a5df005f5e1
8262002ad9139658d81c717f09d53bc91bf7ebd8
refs/heads/master
2023-09-05T03:06:11.949661
2021-11-17T17:12:43
2021-11-17T17:12:43
425,537,369
0
0
null
null
null
null
UTF-8
Java
false
false
212
java
package com.banksource.onlinebank.service.mainServices; import com.banksource.onlinebank.components.Role; public interface roleServiceInterface { Role findById(Long id); Role findByRole(String role); }
4786e6db05f328c7aba1661c655b35b6eaa5b57a
6fd18f5b4573a41c46654eb8186cc479c81f5bcd
/Kodlar/Android/KanUyg/app/src/main/java/com/example/isatan/burbo/MainActivity.java
d2de430c9b3796612742ff70fa44a438cedb9723
[]
no_license
burakaltingoz/Android-blood-finding-application-with-php
63387992cd885d229837aef3900899a8912289ec
f15f5facbe758a334c3a578c5fe487ba265884f5
refs/heads/master
2020-06-22T23:54:08.676838
2019-07-23T13:26:08
2019-07-23T13:26:08
198,435,657
1
0
null
null
null
null
UTF-8
Java
false
false
5,478
java
package com.example.isatan.burbo; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.android.volley.AuthFailureError; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import java.util.HashMap; import java.util.Map; public class MainActivity extends AppCompatActivity implements View.OnClickListener { //Defining views private EditText editTextEmail; private EditText editTextPassword; private Button buttonLogin; //boolean variable to check user is logged in or not //initially it is false private boolean loggedIn = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(com.example.isatan.burbo.R.layout.activity_main); //Initializing views editTextEmail = (EditText) findViewById(com.example.isatan.burbo.R.id.editTextEmail); editTextPassword = (EditText) findViewById(com.example.isatan.burbo.R.id.editTextPassword); TextView tv_kay=(TextView)findViewById(com.example.isatan.burbo.R.id.tv_kayit); buttonLogin = (Button) findViewById(com.example.isatan.burbo.R.id.buttonLogin); //Adding click listener tv_kay.setOnClickListener(this); buttonLogin.setOnClickListener(this); } @Override protected void onResume() { super.onResume(); //In onresume fetching value from sharedpreference SharedPreferences sharedPreferences = getSharedPreferences(Config.SHARED_PREF_NAME, Context.MODE_PRIVATE); //Fetching the boolean value form sharedpreferences loggedIn = sharedPreferences.getBoolean(Config.LOGGEDIN_SHARED_PREF, false); //If we will get true if(loggedIn){ //We will start the Profile Activity Intent intent = new Intent(this, ProfileActivity.class); startActivity(intent); } } private void login(){ //Getting values from edit texts final String email = editTextEmail.getText().toString().trim(); final String password = editTextPassword.getText().toString().trim(); //Creating a string request StringRequest stringRequest = new StringRequest(Request.Method.POST, Config.LOGIN_URL, new Response.Listener<String>() { @Override public void onResponse(String response) { //If we are getting success from server if(response.equalsIgnoreCase(Config.LOGIN_SUCCESS)){ //Creating a shared preference SharedPreferences sharedPreferences = MainActivity.this.getSharedPreferences(Config.SHARED_PREF_NAME, Context.MODE_PRIVATE); //Creating editor to store values to shared preferences SharedPreferences.Editor editor = sharedPreferences.edit(); //Adding values to editor editor.putBoolean(Config.LOGGEDIN_SHARED_PREF, true); editor.putString(Config.EMAIL_SHARED_PREF, email); //Saving values to editor editor.commit(); //Starting profile activity Intent intent = new Intent(MainActivity.this, ProfileActivity.class); startActivity(intent); }else{ //If the server response is not success //Displaying an error message on toast Toast.makeText(MainActivity.this, "Hatalı Kullanıcı Adı veya Şifre", Toast.LENGTH_LONG).show(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { //You can handle error here if you want } }){ @Override protected Map<String, String> getParams() throws AuthFailureError { Map<String,String> params = new HashMap<>(); //Adding parameters to request params.put(Config.KEY_EMAIL, email); params.put(Config.KEY_PASSWORD, password); //returning parameter return params; } }; //Adding the string request to the queue RequestQueue requestQueue = Volley.newRequestQueue(this); requestQueue.add(stringRequest); } @Override public void onClick(View v) { //Calling the login function if(v.getId()== com.example.isatan.burbo.R.id.buttonLogin){ login();} else if(v.getId()== com.example.isatan.burbo.R.id.tv_kayit) { Intent linkintent = new Intent(this,KayitActivity.class); startActivity(linkintent); } } }
513cef38e582beaa58f0141d59ae56c22f8585f8
aabf80ee2c8032e02a517a4e5aaa36b2d11f7d45
/src/test/SimpleSwingTestFramework.java
b18cfd1413d2ca13bf8a6f5039e809a55f475a62
[]
no_license
Sereni/cs607Booking
364a883cd032e911d72d75990399a59eccfa3a10
36ab0427dfe500a7d64320760298e7cfd26756c7
refs/heads/master
2020-06-14T14:12:48.781992
2017-01-24T12:59:41
2017-01-24T12:59:41
75,172,782
1
1
null
2016-12-10T10:41:13
2016-11-30T09:41:08
Java
UTF-8
Java
false
false
7,039
java
package test; import java.awt.Component; import java.awt.Container; import java.awt.KeyboardFocusManager; import java.awt.Robot; import java.awt.Window; import java.util.Date; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JTextField; import javax.swing.SwingUtilities; import org.jdatepicker.impl.JDatePickerImpl; import org.jdatepicker.impl.UtilDateModel; /** * Simple Swing test framework.<br> * Note you can safely read directly from Swing components, but any write operations must take * place on the Swing event queue (SwingUtilities.invokeLater or SwingUtilities.InvokeAndWait) * @author sbrown * */ public class SimpleSwingTestFramework { /** * Create Swing robot at object creation */ Robot robot=null; { try {robot = new Robot();} catch (Exception e) {}; robot.setAutoWaitForIdle( true ); } // Parameters for the Swing invoke queue Component laterComponent; String laterString; boolean laterBoolean; int laterInteger; /** * Find a Swing component by its name & class * @param c - the Swing Container to search (note: full hierarchical search searches sub-containers until component found) * @param cName - the name of the component (set by setName) * @param requiredClass - the required class of the component * @return - a reference to the component, or null if not found */ Component find(Container c, String cName, Class<?> requiredClass) { Component[] l=c.getComponents(); for (Component d:l) { if (d!=null) { if ( (d.getName()!=null) && (d.getName().equals(cName)) && (d.getClass()==requiredClass) ) { return d; } if (d instanceof Container) { Component dd = find( (Container)d, cName, requiredClass); if (dd!=null) return dd; } } } return null; } /** * Find a JButton by the text displayed on the button * @param c - the Swing Container to search (note: full hierarchical search searches sub-containers until component found) * @param bText - the text displayed on the button * @return - a reference to the button, or null if not found */ JButton findButton(Container c, String bText) { Component[] l=c.getComponents(); for (Component d:l) { if (d!=null) { if (d.getClass()==JButton.class) if ( (((JButton)d).getText()!=null) && (((JButton)d).getText().equals(bText))) return (JButton)d; if (d instanceof Container) { JButton dd = findButton( (Container)d, bText); if (dd!=null) return dd; } } } return null; } /** * Click on a button. Note this hangs if the click brings up a modal dialog, so use clickLater in this case. * @param c - the JButton to click on * @throws Exception - if anything goes wrong */ void click(JButton c) throws Exception { laterComponent = c; SwingUtilities.invokeAndWait( new Runnable() { public void run() { ((JButton)laterComponent).doClick(); } } ); robot.waitForIdle(); } /** * Click on a button. Note only use this is the click brings up a modal dialog * @param c - the JButton to click on * @throws Exception - if anything goes wrong */ // Use if the button click brings up a modal dialog void clickLater(JButton c) throws Exception { laterComponent = c; SwingUtilities.invokeLater( new Runnable() { public void run() { ((JButton)laterComponent).doClick(); } } ); } /** * Set a checkbox to be selected or unselected * @param c - the checkbox * @param selected - if true, the checkbox is selected. Otherwise, it is deselected. * @throws Exception - if anything goes wrrong. */ void select(JCheckBox c, boolean selected) throws Exception { laterBoolean = selected; laterComponent = c; SwingUtilities.invokeAndWait( new Runnable() { public void run() { ((JCheckBox)laterComponent).setSelected(laterBoolean); } } ); robot.waitForIdle(); } /** * Select an item (by index) from a pull-down list (JComboBox) * @param c - the pull-down list * @param index - the item index (starts at 0) * @throws Exception - if anything goes wrong */ void select(JComboBox<?> c, int index) throws Exception { laterInteger = index; laterComponent = c; SwingUtilities.invokeAndWait( new Runnable() { public void run() { ((JComboBox<?>)laterComponent).setSelectedIndex(laterInteger); } } ); robot.waitForIdle(); } /** * Select a date in JDatePicker * @param datePicker - date picker * @param date - selected date dd/MM/yyyy * @throws Exception - if anything goes wrong */ void select(JDatePickerImpl datePicker, Date date) throws Exception { laterComponent = datePicker; SwingUtilities.invokeAndWait( new Runnable() { public void run() { UtilDateModel model = (UtilDateModel) ((JDatePickerImpl)laterComponent).getModel(); model.setValue(date); model.setSelected(true); } } ); robot.waitForIdle(); } /** * Enter some text into a textbox. Note this does not simulate "typing" - it just sets the text value directly. Use a Swing Robot, and keyPress/keyRelease to simulate typing specific keys. * @param c - the textbox * @param s - the text string to enter * @throws Exception - if anything goes wrong */ void type(JTextField c, String s) throws Exception { laterComponent = c; laterString = new String(s); SwingUtilities.invokeAndWait( new Runnable() { public void run() { ((JTextField)laterComponent).setText(laterString); } } ); robot.waitForIdle(); } /** * Get the title of the window with focus * @return - the title */ String getActiveTitle() { String title=null; robot.waitForIdle(); Window w = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow(); if (w instanceof JFrame) title = ((JFrame)w).getTitle(); else if (w instanceof JDialog) title = ((JDialog)w).getTitle(); return title; } /** * active frame * @return active frame */ JFrame getActiveFrame() { robot.waitForIdle(); Window w = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow(); if (w instanceof JFrame) return ((JFrame)w); return null; } /** * Wait for a particular window to become active (i.e. have focus). Note this waits forever-it would be an improvement to add a timeout! * @param name - the name (title) of the window to wait for * @throws Exception - if anything goes wrong */ void waitForActiveTitle(String name) throws Exception { String title=null; while (true) { title = getActiveTitle(); if (title==name) return; else Thread.sleep(100); } } }
17d552f80a1435b651b0ffd17155fb5a8ffa34c9
f4c05f1827026a7584a8058062697047b601296c
/src/main/java/com/yun/market/task/spider/other/ShopParseMis.java
bb92cc4a1eb22137636319a37362bcc1acd54f31
[]
no_license
hrywxn/TheMarketSpider
521032fece78322842c1ef450415701cf54c682e
04538e7a5d9d86d7de3199de1b6ceda00c62d140
refs/heads/master
2023-07-18T06:39:32.113000
2021-09-03T11:58:07
2021-09-03T11:58:07
402,753,528
0
0
null
null
null
null
UTF-8
Java
false
false
3,169
java
package com.yun.market.task.spider.other; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.yun.market.common.CreatedSqlCommon; import com.yun.market.config.HttpConfig; import com.yun.market.model.shop.ShopModel; import com.yun.market.model.spider.SpiderTaskMode; import com.yun.market.service.general.GeneralService; import com.yun.market.service.sprider.SpriderTaskService; import com.yun.market.service.yye.LhbService; import com.yun.market.util.TimesUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; @Component public class ShopParseMis { @Autowired SpriderTaskService spriderTaskService; @Autowired GeneralService generalService; @Autowired LhbService lhbService; public void doStartGeneMis(SpiderTaskMode spiderNode) { int id = spiderNode.getId(); spriderTaskService.updateTaskStart(spiderNode, "shop"); //标识抓取开始 for (int i = 1; i < 11; i++) { int page = (i - 1) * 60; String spiderHttp = spiderNode.getSpiderHttp() .replace("fixOpendateHis", String.valueOf(page)) .replace("findKey",spiderNode.getFixOpendateHis()); //获取内容 String html = HttpConfig.sendGet(spiderHttp); JSONObject jsonObject = JSON.parseObject(html); JSONArray jsonArray = jsonObject.getJSONArray("items"); List<ShopModel> shopModelList = new ArrayList<>(); for (Object json:jsonArray){ ShopModel shopModel = new ShopModel(); String name = JSON.parseObject(json.toString()).getJSONObject("item_basic").getString("name"); shopModel.setName(name); String sold = JSON.parseObject(json.toString()).getJSONObject("item_basic").getString("sold"); shopModel.setSold(sold); String ctime = JSON.parseObject(json.toString()).getJSONObject("item_basic").getString("ctime"); String view_count = JSON.parseObject(json.toString()).getJSONObject("item_basic").getString("view_count"); shopModel.setView_count(view_count); String shop_location = JSON.parseObject(json.toString()).getJSONObject("item_basic").getString("shop_location"); shopModel.setShop_location(shop_location); ctime = TimesUtil.stampToDate(ctime); shopModel.setCtime(ctime); shopModel.setType(spiderNode.getFixOpendateHis()); double price = JSON.parseObject(json.toString()).getJSONObject("item_basic").getDouble("price")/100000; shopModel.setPrice(price); shopModelList.add(shopModel); } String saveSql = CreatedSqlCommon.initCreatedTable(ShopModel.class, "t_market_shop"); lhbService.saveDataShop(saveSql, shopModelList); } spriderTaskService.updateTaskEnd(spiderNode, "shop"); //标识抓取开始 } }
[ "Abc27841308" ]
Abc27841308
b6c886a86602f278e7d30a96c4a45e0278621dce
85df2e4f71b9a2e66feb19e3fc2da08c94f4379b
/src/oop/webApp/util/CommonUtil.java
8cf7143346b252ca0151e35f403504891d89dfa6
[]
no_license
alvinz97/Next-Auction-Java-Jsp-Servlet
5a81438a6d0e160e6f7212fb65b2c14f798b5ef0
16fb892b5e54ce6478ab9972adae21be32a6e35a
refs/heads/master
2021-06-26T00:46:33.597449
2021-04-16T04:44:52
2021-04-16T04:44:52
224,663,511
0
1
null
2021-04-16T04:44:53
2019-11-28T13:50:43
HTML
UTF-8
Java
false
false
1,011
java
package oop.webApp.util; import java.io.IOException; import java.util.ArrayList; import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger; import oop.webApp.service.IItemService; public class CommonUtil { /** Initialize logger */ public static final Logger log = Logger.getLogger(IItemService.class.getName()); public static final Properties properties = new Properties(); static { try { // Read the property only once when load the class properties.load(QueryUtil.class.getResourceAsStream(CommonConstants.PROPERTY_FILE)); } catch (IOException e) { log.log(Level.SEVERE, e.getMessage()); } } /** * Add new Item ID * * @param arrayList * @return */ public static String generateIDs(ArrayList<String> arrayList) { String id; int next = arrayList.size(); next++; id = CommonConstants.ITEM_ID_PREFIX + next; if (arrayList.contains(id)) { next++; id = CommonConstants.ITEM_ID_PREFIX + next; } return id; } }
face9be04802ef73458b1b0701e3a8174383a2bb
15975b61c90881de686eafa238c1abf8d4f44c0a
/src/main/java/server/security/JwtTokenUtil.java
757bda3d1c1f32bf2c2e43e8124eed258cc6a3e6
[]
no_license
BettorLeague/spring-boot-server-deprecated
baad3c8bcb782d1df836f8f6fdcee40d9d304a32
7cd5cebdc9503a68fb40603caf2b63b3f2a5d05e
refs/heads/master
2020-03-23T13:12:14.370455
2019-04-15T08:47:25
2019-04-15T08:47:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,458
java
package server.security; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.stereotype.Component; import server.model.user.User; import javax.servlet.http.HttpServletRequest; import java.io.Serializable; import java.util.Date; import java.util.function.Function; import java.util.stream.Collectors; @Component public class JwtTokenUtil implements Serializable { @Value("${jwt.header}") private String tokenHeader; @Value("${jwt.secret}") private String secret; @Value("${jwt.expiration}") private Long expiration; public String getUsernameFromToken(String token) { return getClaimFromToken(token, Claims::getSubject); } public Date getExpirationDateFromToken(String token) { return getClaimFromToken(token, Claims::getExpiration); } public <T> T getClaimFromToken(String token, Function<Claims, T> claimsResolver) { final Claims claims = getAllClaimsFromToken(token); return claimsResolver.apply(claims); } private Claims getAllClaimsFromToken(String token) { return Jwts.parser() .setSigningKey(secret) .parseClaimsJws(token) .getBody(); } private Boolean isTokenExpired(String token) { final Date expiration = getExpirationDateFromToken(token); return expiration.before(new Date()); } public String generateToken(Authentication authentication) { final String authorities = authentication.getAuthorities().stream() .map(GrantedAuthority::getAuthority) .collect(Collectors.joining(",")); return Jwts.builder() .setSubject(authentication.getName()) .claim("scopes", authorities) .signWith(SignatureAlgorithm.HS256, secret) .setIssuedAt(new Date(System.currentTimeMillis())) .setExpiration(new Date(System.currentTimeMillis() + expiration*1000)) .compact(); } public Boolean validateToken(String token, User user) { final String username = getUsernameFromToken(token); return (username.equals(user.getUsername()) && !isTokenExpired(token)); } }
722fb6fbdca0b37edfb53989cac5635c7c8200e9
382fdd8f21393323295b8d1585d48427450e0cce
/codigos/0005_FilaPilhaEstatica/Fila.java
ab7adebf6e311c666dafb3153308e83b236ee0b5
[]
no_license
brunomns/estruturaDados
7be87c3bb97b3c9abe96b9bf94db04edb69b9518
7dfc3cd7b0590d8b65268fe3cedcb1a573cf4ff8
refs/heads/master
2021-12-22T05:02:21.756606
2021-11-30T20:07:36
2021-11-30T20:07:36
180,206,981
0
0
null
null
null
null
UTF-8
Java
false
false
1,467
java
public class Fila { int TAM = 10; No fila[]; int comeco = -1; int fim = -1; public Fila(int tam){ fila = new No[tam]; this.TAM = tam; } //Fila insere no fim //remove do comeco/inicio public void insere(No n){ //verifica se a fila esta vazia if(comeco == -1){ comeco = 0; fim = 0; fila[fim] = n; System.out.println("Elemento inserido..."+n.tostring()); } else if(fim < (TAM-1)){ fim = fim +1; fila[fim] = n; System.out.println("Elemento inserido..."+n.tostring()); } else { System.out.println("FILA CHEIA..."); } } //remocao sempre no inicio da fila public No remove(){ if (this.comeco != -1){ //fila não vazia.... No temp = fila[comeco]; for (int i = comeco; i <fim ; i++) { //operacao de deslocamento fila[i] = fila[i+1]; } fila[fim] = null; fim = fim - 1; System.out.println("Removido com sucesso: "+ temp.tostring()); return temp; } else{ System.out.println("Lista vazia"); return null; } } public void imprime(){ for (int i = this.comeco; i <= this.fim; i++) { System.out.println(i+" - " +fila[i].tostring()); } } }
f46534e9db90bbdce9d94a2f49fe46cd6010a019
9d32980f5989cd4c55cea498af5d6a413e08b7a2
/A92s_10_0_0/src/main/java/com/color/inner/nfc/cardemulation/ApduServiceInfoWrapper.java
df65faa28916924377e256fae946e2023265dc5a
[]
no_license
liuhaosource/OppoFramework
e7cc3bcd16958f809eec624b9921043cde30c831
ebe39acabf5eae49f5f991c5ce677d62b683f1b6
refs/heads/master
2023-06-03T23:06:17.572407
2020-11-30T08:40:07
2020-11-30T08:40:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,020
java
package com.color.inner.nfc.cardemulation; import android.nfc.cardemulation.OppoBaseApduServiceInfo; import android.util.Log; import com.color.util.ColorTypeCastingHelper; public class ApduServiceInfoWrapper { private static final String TAG = "ApduServiceInfoWrapper"; private ApduServiceInfoWrapper() { } public static boolean isServiceEnabled(Object apduServiceInfoObject, String category) { try { OppoBaseApduServiceInfo baseApduServiceInfo = typeCasting(apduServiceInfoObject); if (baseApduServiceInfo != null) { return baseApduServiceInfo.isServiceEnabled(category); } return false; } catch (Throwable e) { Log.e(TAG, e.toString()); return false; } } private static OppoBaseApduServiceInfo typeCasting(Object apduServiceInfoObject) { return (OppoBaseApduServiceInfo) ColorTypeCastingHelper.typeCasting(OppoBaseApduServiceInfo.class, apduServiceInfoObject); } }
7c9d65076bf7aa0296b301a6ff665141df76e6e7
8b7f420269f168091d453ebc9a2f70df2bdbb999
/codeb/src/com/internousdev/codeb/acion/package-info.java
3b117c0f2d11cb7debe1b1624332197f3652611a
[]
no_license
mitarashi335/MyECsite
6b93623e7f047038efa75b16b336d45311e16866
0b46b9a926cd594a97868181eccfcceb759f96c4
refs/heads/master
2020-05-29T13:27:44.450588
2019-05-29T07:11:29
2019-05-29T07:11:29
188,795,268
0
0
null
null
null
null
UTF-8
Java
false
false
84
java
/** * */ /** * @author internousdev * */ package com.internousdev.codeb.acion;
9fe924b284af3a71d518bddc6288e72b62e1cd0f
56cc04afc5452c53844d793bea6f1945c2bf5118
/app/src/main/java/com/satisfactoryplace/gichul/gichulgenerator/data/QuestionNameBuilder.java
4eb61f9a4f9c091b77626ab6a640bc590f06a347
[]
no_license
NamGungGeon/GiChulGenerator
c8236961466fed6e2d3f2cc6318d943378941f5e
01c86904076d2619f575c5517a985a048f63e187
refs/heads/master
2021-05-10T19:41:26.225967
2019-01-15T12:56:48
2019-01-15T12:56:48
118,163,102
0
0
null
null
null
null
UTF-8
Java
false
false
3,902
java
package com.satisfactoryplace.gichul.gichulgenerator.data; import android.support.annotation.NonNull; import android.util.Log; public class QuestionNameBuilder { public static QuestionNameBuilder inst; public static final int TYPE_KOR= 2222; public static final int TYPE_ENG= 3333; public static final int TYPE_Q= 13324; public static final int TYPE_A= 12233; public static final String UNDEFINED= "UNDEFINED"; public String y; public String m; public String k_inst; public String e_inst; public String k_sub; public String e_sub; public String number; public String potential; public QuestionNameBuilder(@NonNull String y, @NonNull String m, @NonNull String inst, @NonNull String sub, @NonNull String number, @NonNull String potential, int type) { switch (type){ case TYPE_KOR: this.k_inst= inst; this.k_sub= sub; break; case TYPE_ENG: this.e_inst= inst; this.e_sub= sub; break; } this.y = y; this.m = m; this.number = number; this.potential= potential; initInstAndSub(); } public void initInstAndSub(){ if(k_inst== null && k_sub== null){ switch (e_inst){ case "sunung": k_inst= "대학수학능력평가시험"; break; case "gyoyuk": k_inst= "교육청"; break; case "pyeong": k_inst= "교육과정평가원"; break; } switch (e_sub){ case "imath": k_sub= "수학(이과)"; break; case "mmath": k_sub= "수학(문과)"; break; } }else if(e_inst== null&& e_sub== null){ //generate e_inst switch (k_inst){ case "수능": case "대학수학능력평가시험": e_inst= "sunung"; break; case "교육청": e_inst= "gyoyuk"; break; case "평가원": case "교육과정평가원": e_inst= "pyeong"; break; } //generate e_sub switch (k_sub){ case "수학(이과)": e_sub= "imath"; break; case "수학(문과)": e_sub= "mmath"; break; } } } public String createImagePath(int type){ String path= "exam/"+ y+ "_"+ m+ "_"+ e_inst+ "_"+ e_sub+ "/"+ createFileName(type); return path; } public String createFileName(int type){ switch (type){ case TYPE_A: return "a_"+ createFileName(); case TYPE_Q: return "q_"+ createFileName(); default: return createFileName(); } } public String createFileName(){ return y+ "_"+ m+ "_"+ e_inst+ "_"+ e_sub+ "_"+ number; } public String createTitileText(){ return y+ "년 "+ k_inst+ "\n"+ k_sub+ "과목 "+ m+ "월 시험 "+ number+ "번 문제"; } public String createPotentialPath(){ String path; if(number.equals(UNDEFINED)){ path= "potential/" + y + "/" + e_inst+ "/"+ m + "/" + e_sub; }else{ path= "potential/" + y + "/" + e_inst+ "/"+ m + "/" + e_sub + "/" + number; } return path; } public String createRightAnswerPath(){ String path= "answer/" + y + "/" + e_inst+ "/"+ m + "/" + e_sub + "/" + number; return path; } }
ffc21705edb400d873009362a3d71843afd16d27
dd76d0b680549acb07278b2ecd387cb05ec84d64
/divestory-CFR/androidx/core/view/NestedScrollingParentHelper.java
46905250254dff2765679872f3d744e785fe707b
[]
no_license
ryangardner/excursion-decompiling
43c99a799ce75a417e636da85bddd5d1d9a9109c
4b6d11d6f118cdab31328c877c268f3d56b95c58
refs/heads/master
2023-07-02T13:32:30.872241
2021-08-09T19:33:37
2021-08-09T19:33:37
299,657,052
0
0
null
null
null
null
UTF-8
Java
false
false
1,225
java
/* * Decompiled with CFR <Could not determine version>. * * Could not load the following classes: * android.view.View * android.view.ViewGroup */ package androidx.core.view; import android.view.View; import android.view.ViewGroup; public class NestedScrollingParentHelper { private int mNestedScrollAxesNonTouch; private int mNestedScrollAxesTouch; public NestedScrollingParentHelper(ViewGroup viewGroup) { } public int getNestedScrollAxes() { return this.mNestedScrollAxesTouch | this.mNestedScrollAxesNonTouch; } public void onNestedScrollAccepted(View view, View view2, int n) { this.onNestedScrollAccepted(view, view2, n, 0); } public void onNestedScrollAccepted(View view, View view2, int n, int n2) { if (n2 == 1) { this.mNestedScrollAxesNonTouch = n; return; } this.mNestedScrollAxesTouch = n; } public void onStopNestedScroll(View view) { this.onStopNestedScroll(view, 0); } public void onStopNestedScroll(View view, int n) { if (n == 1) { this.mNestedScrollAxesNonTouch = 0; return; } this.mNestedScrollAxesTouch = 0; } }
54cc25738c7e5ec20ae7c95ae39796d01d8b9393
652288d6484737524e5e1e8ed6c656149a65d82b
/Genome random forest/src/test/java/ru/shemplo/genome/rf/test/RunTest.java
cdfad885980eec532b9ad2bee4660cf5662425df
[ "MIT" ]
permissive
Shemplo/Shemplo-sandbox
850ddbdb45773d12e0622ea4ba72bab0930aa3f0
3f7427764a7c92381ea4d56db1d7d31af594f2a4
refs/heads/master
2021-05-26T05:16:59.132887
2019-10-18T19:39:54
2019-10-18T19:39:54
127,563,604
2
0
MIT
2019-10-15T10:41:09
2018-03-31T19:20:27
Java
UTF-8
Java
false
false
7,173
java
package ru.shemplo.genome.rf.test; import static java.lang.Character.*; import static java.nio.charset.StandardCharsets.*; import static ru.shemplo.snowball.utils.fun.StreamUtils.*; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import java.util.stream.Stream; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import ru.shemplo.genome.rf.data.EntityVerdict; import ru.shemplo.genome.rf.data.NormalizedMatrix; import ru.shemplo.genome.rf.data.SourceDataset; import ru.shemplo.genome.rf.data.SourceEntity; import ru.shemplo.genome.rf.forest.AvDistanceStrategy; import ru.shemplo.genome.rf.forest.RandomForest; import ru.shemplo.genome.rf.forest.SplitStrategy; import ru.shemplo.snowball.stuctures.Pair; public class RunTest { public static void main (String ... args) throws Exception { List <Pair <List <Double>, Integer>> trainRows = new ArrayList <> (); try ( InputStream train = openResource ("/train.csv"); Reader r = new InputStreamReader (train, UTF_8); BufferedReader br = new BufferedReader (r); ) { br.readLine (); // Line with description of input data String line = null; while ((line = br.readLine ()) != null) { if (line.length () == 0) { continue; } List <Double> tokens = Arrays.asList (line.split (",")).stream ().skip (1) . map (RunTest::convertLetterToDigit) . map (Double::parseDouble) . collect (Collectors.toList ()); int size = tokens.size (); trainRows.add (Pair.mp (tokens.subList (0, size - 1), tokens.get (size - 1).intValue ())); } } trainRows = trainRows.stream ().filter (p -> p.S < 2) . collect (Collectors.toList ()); SourceDataset dataset = new SourceDataset (); zip (trainRows.stream (), Stream.iterate (0, i -> i + 1), Pair::mp).forEach (row -> { SourceEntity entity = new SourceEntity ("u" + row.S); zip (row.F.F.stream (), Stream.iterate (0, i -> i + 1), Pair::mp).forEach (fs -> { entity.addGeneExpression ("g" + fs.S, fs.F); }); entity.setVerdict (EntityVerdict.values () [row.F.S * 2]); dataset.addEntity (entity); }); NormalizedMatrix matrix = dataset.getNormalizedMatrix (); SplitStrategy strategy = new AvDistanceStrategy (); RandomForest forest = new RandomForest (matrix, strategy, dataset, 5, 301) . train (); Map <Integer, List <Double>> testRows = new HashMap <> (); Map <Integer, Integer> testAnswers = new HashMap <> (); try ( InputStream test = openResource ("/test.csv"); Reader r = new InputStreamReader (test, UTF_8); BufferedReader br = new BufferedReader (r); ) { br.readLine (); // Line with description of input data String line = null; while ((line = br.readLine ()) != null) { if (line.length () == 0) { continue; } List <Double> tokens = Arrays.asList (line.split (",")).stream () . map (RunTest::convertLetterToDigit) . map (Double::parseDouble) . collect (Collectors.toList ()); int size = tokens.size (); testRows.put (tokens.get (0).intValue (), tokens.subList (1, size)); } } try ( InputStream test = openResource ("/answer.csv"); Reader r = new InputStreamReader (test, UTF_8); BufferedReader br = new BufferedReader (r); ) { br.readLine (); // Line with description of input data String line = null; while ((line = br.readLine ()) != null) { if (line.length () == 0) { continue; } List <Double> tokens = Arrays.asList (line.split (",")).stream () . map (RunTest::convertLetterToDigit) . map (Double::parseDouble) . collect (Collectors.toList ()); testAnswers.put (tokens.get (0).intValue (), tokens.get (1).intValue ()); } } AtomicInteger correct = new AtomicInteger (), total = new AtomicInteger (); zip (testRows.keySet ().stream (), Stream.iterate (0, i -> i + 1), Pair::mp) . forEach (row -> { SourceEntity entity = new SourceEntity ("testEntity" + row.S); int answer = testAnswers.get (row.F); if (answer >= 2) { return; } total.incrementAndGet (); entity.setVerdict (EntityVerdict.values () [answer * 2]); zip (testRows.get (row.F).stream (), Stream.iterate (0, i -> i + 1), Pair::mp).forEach (fs -> { entity.addGeneExpression ("g" + fs.S, fs.F); }); EntityVerdict prediction = forest.predict (entity.getGenesExpMap ()); if (prediction.equals (entity.getVerdict ())) { correct.incrementAndGet (); } }); System.out.println ("Corrrect: " + correct.get () + " / " + total.get ()); /* forest.makeProbabilities ().forEach ((k, v) -> { System.out.println (String.format (" - %12s %.8f", k, v)); }); */ Map <String, Double> probs = forest.makeProbabilities (); probs.keySet ().stream () . map (k -> Pair.mp (k, probs.get (k))) . sorted ((pa, pb) -> -Double.compare (pa.S, pb.S)) . map (p -> String.format (" - %12s %.1f", p.F, p.S)) . forEach (System.out::println); } private static String convertLetterToDigit (String token) { if (token.length () == 1) { char [] symbols = token.toCharArray (); int shift = getNumericValue ('A'); if (Character.isLetter (symbols [0])) { int code = getNumericValue (symbols [0]); return "" + (code - shift); } } return token; } private static final InputStream openResource (String path) { return RunTest.class.getResourceAsStream (path); } }
c39ff5caba0756dfc6c07d43cf983087071ebe44
c894a51d200f0f88363feba21b535b98686f3e79
/src/Vista/Usuarios/Modal_Crear_compras.java
616a0547fab32f4fba786fc567a5b9a786d240ac
[]
no_license
jimmyhomero/Sofi3
9c880970705b07e36cf5025a516619d68b2b5a15
46da1de610b7bc7aaedfffe48b967e831a6990a6
refs/heads/master
2022-12-10T23:10:44.237411
2022-12-07T19:03:10
2022-12-07T19:03:10
189,910,727
1
0
null
null
null
null
UTF-8
Java
false
false
150,274
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 Vista.Usuarios; import AA_MainPruebas.JtableconBotonesCompras; import java.awt.Dimension; import ClasesAuxiliares.FeCodigoNUmerico; import ClasesAuxiliares.Leertxt; import ClasesAuxiliares.NewSql.Forms.OperacionesForms; import ClasesAuxiliares.NullValidator; import ClasesAuxiliares.Variables; import ClasesAuxiliares.debug.Deb; import ClasesAuxiliares.tablas.SetRenderJTableCXC; import Controlador.ComitsAll; import Controlador.Coneccion; import Controlador.Usuarios.CajasDetalleDao; import Controlador.Usuarios.ClientesDao; import Controlador.Usuarios.ComprasDao; import Controlador.Usuarios.DetalleComprasDao; import Controlador.Usuarios.DetalleFacturaDao; import Controlador.Usuarios.DetalleProformaDao; import Controlador.Usuarios.DetalleTicketDao; import Controlador.Usuarios.EquiposDao; import Controlador.Usuarios.FacturasDao; import Controlador.Usuarios.FormasPagoCVDao; import Controlador.Usuarios.FormasPagoVDao; import Controlador.Usuarios.UsuariosDao; import Modelo.Clientes; import Modelo.Usuarios; import Vista.Principal; import static Vista.Principal.desktopPane; import Controlador.Usuarios.HoraFecha; import Controlador.Usuarios.ImpresionDao; import Controlador.Usuarios.KardexDao; import Controlador.Usuarios.ProductosDao; import Controlador.Usuarios.cxcDao; import Controlador.Usuarios.ProformasDao; import Controlador.Usuarios.RetencionCDao; import Controlador.Usuarios.SeriesFacturasDao; import Controlador.Usuarios.TicketsDao; import Controlador.Usuarios.cxpDao; import Modelo.CajasDetalle; import Modelo.Compras; import Modelo.DetalleFactura; import Modelo.DetalleProforma; import Modelo.DetalleTicket; import Modelo.Equipos; import Modelo.Facturas; import Modelo.FormasPagoV; import Modelo.Kardex; import Modelo.Cxc; import Modelo.Cxp; import Modelo.DetalleCompra; import Modelo.FormasPagoCV; import Modelo.Productos; import Modelo.Proformas; import Modelo.Proveedores; import Modelo.SeriesFacturas; import Modelo.Tickets; import Modelo.sri_sustentocomprobante; import Modelo.sri_tipocomprobante; import Vista.Dialogs.PrecioTotalComprasXFila; import Vista.Dialogs.PrecioTotalFacturacionXFila; import Vista.Dialogs.cantidadCompra; import Vista.Dialogs.precioCompra; import static Vista.Principal.desktopPane; import static Vista.Usuarios.Modal_CrearFacturas.jcbFormasPago; import Vlidaciones.ProgressBar; import Vlidaciones.VaciarTexto; import Vlidaciones.ValidaCedula; import Vlidaciones.ValidaNUmeros; import com.mxrck.autocompleter.AutoCompleterCallback; import com.mxrck.autocompleter.TextAutoCompleter; import ecx.unomas.factura.Detalle; import ecx.unomas.factura.Factura; import ecx.unomas.factura.TotalImpuesto; import ecx.unomas.service.Comprobante; import login.login; import impresoras.ServicioDeImpresion; import java.awt.Frame; import java.awt.Image; import java.awt.MouseInfo; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.beans.PropertyVetoException; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import javafx.scene.paint.Color; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JInternalFrame; import javax.swing.JOptionPane; import javax.swing.JTable; import javax.swing.ListModel; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableColumnModel; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperPrintManager; import net.sf.jasperreports.view.JasperViewer; import persistencia.modelos.Formaspagoc; /** * * @author USUARIO */ public class Modal_Crear_compras extends javax.swing.JInternalFrame { public static boolean esLlamdoDesdeAsisgnarNuevoAIRalRegistrarCompra = false; TextAutoCompleter proveedorAutoCompleter; TextAutoCompleter productosAutoCompleter; public static boolean isOpenfromCrearFacturaSelectAir = false; public static CajasDetalle cd = new CajasDetalle(); public static Integer indexPositiotoolBar; public static String formaPagoSeelccionada; public static Integer codigoCompra; public static Integer codigoClienteCompra; public static boolean RegistrodeCreditoExitoso = false; public static boolean RegistrodeEfectivoyCambioExitoso = true; public static String claveAcceso; public static Double efectivo; public static Double cambio; public static Double costoEnviadodesdeDialog; public static Double cantidadEnviadadesdeDialog; public static String diasCrediotoconProveedor; public static Integer CrediotoconProveedorSiNo; public static Integer aumentarIvaSiNO = -1; public static int filacliked = -1; public static int columnacliked = -1; HashMap<String, String> formaPagomap = new HashMap<String, String>(); Integer ultimoIndexSeleccionadojcBTipoCOmporbante = 0; Integer ultimoIndexSeleccionadojcbSustento = 0; ProgressBar a = new ProgressBar(3000, "Mensaje Inicial"); Double utilidad; Double descuentogeneral; Double descuentoItem; boolean afectakardex = false; ///e proformas no public static boolean afectacaja = false; /// en cuadno es credito no private static DefaultTableModel modelo = null; Double total = 0.0; Double subtotal = 0.0; Double subtotaliva12 = 0.0; Double subtotaliva0 = 0.0; Double iva = Double.valueOf(Principal.iva); ProgressBar msg = new ProgressBar(3000, "Mensaje Inicial"); public static String secuenciaFac = null; public static String IdTipoComprabanteSeleccionado = null; public static String IdsustentoComprabanteSeleccionado = null; public static Integer codigFormaPagoSeleccionada = null; Boolean dobleClick = false; // ProgressBar msg = new ProgressBar(3000, "Mensaje Inicial"); public static String tipoDocumento = ""; ArrayList<Usuarios> listaU = new ArrayList<Usuarios>(); private static ArrayList<sri_tipocomprobante> listatipoComprobantes = new ArrayList<sri_tipocomprobante>(); private static ArrayList<sri_sustentocomprobante> listasustentoComprobantes = new ArrayList<sri_sustentocomprobante>(); ArrayList<FormasPagoCV> listaFormasDePago = new ArrayList<FormasPagoCV>(); List<Clientes> listaProveedores = new ArrayList<Clientes>(); FormasPagoV objFormasdePago = new FormasPagoV(); // ArrayList<DetalleFactura> listaDetFac = new ArrayList<DetalleFactura>(); Integer codigoUsuarioVendedorSeleccionadoJCB; //String[] registros = new String[8]; private static void datosPredeterminadosFacturas() { txt_cedula.requestFocus(); txt_cedula.setText("9999999999999"); codigoClienteCompra = addDatosClienteonFactura(txt_cedula.getText()); txt_cedula.setSelectionStart(0); txt_cedula.setSelectionEnd(txt_cedula.getText().length()); lbl_subTotalIva.setText("Sub Total IVA " + Principal.iva + "%"); //check_Fac.setSelected(true); //tipoDocumento = "FACTURA"; txt_total_.setText("0.00"); txt_iva_valor.setText("0.00"); txt_subtotalIvaValor.setText("0.00"); txt_subtotal.setText("0.00"); txt_descuentoGenral.setText("0.00"); txt_subtotalIvaValor.setText("0.00"); txt_subtotalIvaValorCero.setText("0.00"); txt_utilidad.setText("0.00"); ComprasDao cDao = new ComprasDao(); listatipoComprobantes = cDao.getlistaTipoComprobate(); for (sri_tipocomprobante tcom : listatipoComprobantes) { jcb_tipoComprobante.addItem(tcom.getTipocomprobante()); IdTipoComprabanteSeleccionado = tcom.getId(); } ComprasDao c2Dao = new ComprasDao(); listasustentoComprobantes = c2Dao.getlistasustentoComprobate(); for (sri_sustentocomprobante suscom : listasustentoComprobantes) { jcb_sustentoComprobante.addItem(suscom.getSustento()); IdsustentoComprabanteSeleccionado = suscom.getId(); } } public Modal_Crear_compras() { initComponents(); proveedorAutoCompleter = new TextAutoCompleter(txt_nombres, new AutoCompleterCallback() { @Override public void callback(Object selectedItem) { // Deb.consola(((Clientes) selectedItem).getNombre() + " hola"); // Imprime 25 // Object itemSelected = clienteAutoCompleter.getItemSelected(); if (selectedItem instanceof Clientes) { Clientes c = new Clientes(); c = ((Clientes) selectedItem); txt_cedula.setText(c.getCedula()); txt_celular.setText(c.getCelular()); txt_clienteCodigo.setText(c.getCodigo().toString()); txt_dir.setText(c.getDireccion()); codigoClienteCompra = c.getCodigo(); //Deb.consola(((Clientes) selectedItem).getNombre() + " casas"); // Imprime 25 } else { Deb.consola("El item es de un tipo desconocido"); } } }); proveedorAutoCompleter.setCaseSensitive(false); proveedorAutoCompleter.setMode(0); // ProveedoresDao cd = new ProveedoresDao(); // listaProveedores = cd.listar(); // // for (Proveedores p : listaProveedores) { // // Deb.consola("Vista.Usuarios.Crear_Facturas.<init>()asdasdasdasdasdasdasvccccccccccccccccc"); // proveedorAutoCompleter.addItem(p); // } //listaClientes = cd.buscarConNombresLike(txt_nombres.getText()); productosAutoCompleter = new TextAutoCompleter(txtBuscar2, new AutoCompleterCallback() { @Override public void callback(Object selectedItem) { if (selectedItem instanceof Productos) { Productos c = new Productos(); c = ((Productos) selectedItem); addProductosfromautomplete(c); } else { Deb.consola("El item es de un tipo desconocido"); } } }); productosAutoCompleter.setCaseSensitive(false); productosAutoCompleter.setMode(0); // ProductosDao pDao = new ProductosDao(); // for (Productos p : pDao.listar()) { // Deb.consola("Prod: " + p.getProducto()); // productosAutoCompleter.addItem(p); // } ///llena secuencas facturas // llenarSecuenciaFacura(); // btn_nuevo.setVisible(false); txt_iva_valor.setText(iva.toString()); //Deb.consola("Iva: " + iva); datosPredeterminadosFacturas(); jTable1.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); String titulos[] = {"costo", "#", "Codigo", "ARTICULO", "CANTIDAD", "DESCUENTO", "BODEGA", "P. UNIT", "P. TOTAL", "CANTIDAD"}; String[] titulosxml = new String[]{"COSTO", "#", "CODIGO", "ARTICULO", "CANTIDAD", "DESCUENTO", "BODEGA", "P. UNIT", "P. TOTAL", "CANTIDAD", "AIR", "BUSCAR"}; Class[] tiposColumnas = new Class[]{ java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, JButton.class // <- noten que aquí se especifica que la última columna es un botón }; if (Principal.obligaoSINO.equalsIgnoreCase("NO")) { String[] titulosx = {"COSTO", "#", "CODIGO", "ARTICULO", "CANTIDAD", "DESCUENTO", "BODEGA", "P. UNIT", "P. TOTAL", "CANTIDAD"}; titulos = titulosx; } else { String[] titulosx = {"COSTO", "#", "CODIGO", "ARTICULO", "CANTIDAD", "DESCUENTO", "BODEGA", "P. UNIT", "P. TOTAL", "CANTIDAD", "AIR"}; titulos = titulosx; } // // modelo = new DefaultTableModel(null, titulos) { // @Override // public boolean isCellEditable(int row, int column) { // // make read only fields except column 0,13,14 // return column == 3 || column == 4 || column == 5 || column == 7 || column == 10; // // return false; // } // }; jTable1.setModel(JtableconBotonesCompras.setTabla(jTable1)); modelo = JtableconBotonesCompras.modelo; jTable1.setModel(modelo); // setModeloColumnas(jTable1); HoraFecha ob = new HoraFecha(); // jdchoserNOW.setDate(ob.getFechaNowTImestampServer()); HoraFecha ob2 = new HoraFecha(); jdfecha.setDateFormatString("yyyy-MM-dd"); jdfecha.setDate(ob2.obtenerFecha()); // list2.setVisible(false); // list1.setVisible(false); addOrDeleteRowTable(jTable1); int row = jTable1.getModel().getRowCount(); int col = jTable1.getModel().getColumnCount(); // txt_buscar_producto.requestFocus(); //lleno cb Vendedores UsuariosDao objUDao = new UsuariosDao(); listaU = objUDao.listarVendedores(); for (Usuarios usuarios : listaU) { jComboBox1.addItem(usuarios.getNombre()); } Deb.consola( "Nombre de Usuario: " + login.nombresUsuario); jComboBox1.setSelectedItem(login.nombresUsuario); /// pongo docuento predererminado ////formas de pago // FormasPagoVDao objFdPDao = new FormasPagoVDao(); // listaFormasDePago = objFdPDao.listar(); // for (FormasPagoV f : listaFormasDePago) { // jcbFormasPago.addItem(f.getFormaPago()); // } FormasPagoCVDao objFdPDao = new FormasPagoCVDao(); listaFormasDePago = objFdPDao.listar(); for (FormasPagoCV f : listaFormasDePago) { formaPagomap.put(f.getTipoPago(), f.getFormaPago()); if (f.getEsCxcCxp().equalsIgnoreCase(OperacionesForms._FORMA_PAGO_CXP_TEXT)) { jcbFormasPago.addItem(f.getFormaPago()); Deb.consola("fp: "+Principal.formadepagopredeterminadaCompra); Deb.consola("xxxx : "+f.getFormaPago()); if (f.getFormaPago().equalsIgnoreCase(Principal.formadepagopredeterminadaCompra)) { jcbFormasPago.setSelectedItem(f.getFormaPago()); codigFormaPagoSeleccionada = f.getCodigo(); } } } // jcbFormasPago.setSelectedItem(Principal.formadepagopredeterminadaCompra); } public void addProductosfromautomplete(Productos c) { ComprasDao facDao = new ComprasDao(); // modelo= ; //FacturasDao facDao = new FacturasDao(); modelo.addRow(facDao.Buscar_registros(c.getProducto(), Principal.bodegaPredeterminadaenCOmpra.substring(0, 1))); //jTable1.setModel(JtableconBotonesCompras.setTabla(jTable1)); jTable1.setModel(modelo); if (c.getImagen() != null) { ImageIcon icon = new ImageIcon(c.getImagen()); Icon icono = new ImageIcon(icon.getImage().getScaledInstance(251, 205, Image.SCALE_DEFAULT)); foto.setText(null); foto.setIcon(icono); } else { foto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Img/producto.jpg"))); } } /** * 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() { txt_utilidad = new javax.swing.JLabel(); txt_clienteCodigo = new javax.swing.JLabel(); txt_usuarioCodigo = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); jPanel6 = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); txt_nombres = new javax.swing.JTextField(); jLabel6 = new javax.swing.JLabel(); txt_celular = new javax.swing.JTextField(); jLabel8 = new javax.swing.JLabel(); txt_dir = new javax.swing.JTextField(); jComboBox1 = new javax.swing.JComboBox<>(); jLabel10 = new javax.swing.JLabel(); txt_cedula = new javax.swing.JTextField(); jPanel7 = new javax.swing.JPanel(); jLabel7 = new javax.swing.JLabel(); txt_sec1 = new javax.swing.JTextField(); txt_secNUmFac = new javax.swing.JTextField(); jLabel11 = new javax.swing.JLabel(); txt_sec2 = new javax.swing.JTextField(); txt_hora = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); jdfecha = new com.toedter.calendar.JDateChooser(); txt_total_val = new javax.swing.JLabel(); txt_numAutorizacion = new javax.swing.JTextField(); jcb_tipoComprobante = new javax.swing.JComboBox<>(); jLabel9 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jcb_sustentoComprobante = new javax.swing.JComboBox<>(); jButton7 = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jLabel3 = new javax.swing.JLabel(); txtBuscar2 = new javax.swing.JTextField(); jButton3 = new javax.swing.JButton(); jPanel8 = new javax.swing.JPanel(); foto = new javax.swing.JLabel(); jcbFormasPago = new javax.swing.JComboBox<>(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jPanel9 = new javax.swing.JPanel(); txt_subtotal = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); txt_descuentoGenral = new javax.swing.JTextField(); lbl_subTotalIva = new javax.swing.JLabel(); lbl_subTotalIva1 = new javax.swing.JLabel(); txt_subtotalIvaValorCero = new javax.swing.JLabel(); lbl_Iva = new javax.swing.JLabel(); txt_iva_valor = new javax.swing.JLabel(); lbl_subTotalIva2 = new javax.swing.JLabel(); txt_total_ = new javax.swing.JLabel(); txt_subtotalIvaValor = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jPanel10 = new javax.swing.JPanel(); jButton4 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jButton6 = new javax.swing.JButton(); jchek_hacer_retencion = new javax.swing.JCheckBox(); jPanel5 = new javax.swing.JPanel(); txt_utilidad.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N txt_clienteCodigo.setText(" "); txt_clienteCodigo.setOpaque(true); txt_usuarioCodigo.setText(" "); txt_usuarioCodigo.setOpaque(true); setClosable(true); setIconifiable(true); setMaximizable(true); setResizable(true); setTitle("CrearComprasx"); setName(""); // NOI18N addInternalFrameListener(new javax.swing.event.InternalFrameListener() { public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) { formInternalFrameClosed(evt); } public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) { } }); jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Datos del Proveedor", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N jLabel4.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N jLabel4.setText("Nombres/RUC"); jLabel5.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N jLabel5.setText("RUC/Cedula"); txt_nombres.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N txt_nombres.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { txt_nombresFocusGained(evt); } }); txt_nombres.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { txt_nombresKeyPressed(evt); } public void keyReleased(java.awt.event.KeyEvent evt) { txt_nombresKeyReleased(evt); } }); jLabel6.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N jLabel6.setText("Direccion"); txt_celular.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N jLabel8.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N jLabel8.setText("Celular"); txt_dir.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N jComboBox1.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Seleccione" })); jComboBox1.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jComboBox1ItemStateChanged(evt); } }); jLabel10.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N jLabel10.setText("Vendedor:"); txt_cedula.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N txt_cedula.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { txt_cedulaFocusGained(evt); } }); txt_cedula.addInputMethodListener(new java.awt.event.InputMethodListener() { public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { } public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) { txt_cedulaInputMethodTextChanged(evt); } }); txt_cedula.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent evt) { txt_cedulaPropertyChange(evt); } }); txt_cedula.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { txt_cedulaKeyPressed(evt); } public void keyReleased(java.awt.event.KeyEvent evt) { txt_cedulaKeyReleased(evt); } public void keyTyped(java.awt.event.KeyEvent evt) { txt_cedulaKeyTyped(evt); } }); javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup( jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup() .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup() .addGap(41, 41, 41) .addComponent(jLabel10) .addGap(18, 18, 18) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 397, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel6Layout.createSequentialGroup() .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup() .addGap(4, 4, 4) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel6Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel5)) .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING)) .addGap(18, 18, 18) .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel6Layout.createSequentialGroup() .addComponent(txt_cedula, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txt_celular, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(txt_nombres) .addComponent(txt_dir)))) .addContainerGap()) ); jPanel6Layout.setVerticalGroup( jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup() .addGap(8, 8, 8) .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(txt_nombres, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(7, 7, 7) .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent(txt_cedula, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel8) .addComponent(txt_celular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(2, 2, 2) .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(txt_dir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(10, 10, 10) .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel10) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) ); jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Datos de Cliente", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N jLabel7.setText("Numero Aut."); txt_sec1.setText("001"); txt_sec1.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { txt_sec1FocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { txt_sec1FocusLost(evt); } }); txt_sec1.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { txt_sec1KeyReleased(evt); } }); txt_secNUmFac.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { txt_secNUmFacFocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { txt_secNUmFacFocusLost(evt); } }); txt_secNUmFac.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { txt_secNUmFacKeyReleased(evt); } }); jLabel11.setText("Hora:"); txt_sec2.setText("001"); txt_sec2.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { txt_sec2FocusGained(evt); } public void focusLost(java.awt.event.FocusEvent evt) { txt_sec2FocusLost(evt); } }); txt_sec2.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { txt_sec2KeyReleased(evt); } }); jLabel1.setText("Fecha:"); jdfecha.setOpaque(false); txt_total_val.setBackground(new java.awt.Color(255, 51, 51)); txt_total_val.setFont(new java.awt.Font("Tahoma", 1, 48)); // NOI18N txt_total_val.setText("0.00"); txt_total_val.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Total", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N txt_numAutorizacion.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { txt_numAutorizacionKeyPressed(evt); } public void keyReleased(java.awt.event.KeyEvent evt) { txt_numAutorizacionKeyReleased(evt); } public void keyTyped(java.awt.event.KeyEvent evt) { txt_numAutorizacionKeyTyped(evt); } }); jcb_tipoComprobante.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jcb_tipoComprobanteItemStateChanged(evt); } }); jLabel9.setText("Tipo de Comprobante"); jLabel15.setText("Sustento Comp"); jcb_sustentoComprobante.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jcb_sustentoComprobanteItemStateChanged(evt); } }); jButton7.setText("SRI"); jButton7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton7ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); jPanel7.setLayout(jPanel7Layout); jPanel7Layout.setHorizontalGroup( jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup() .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup() .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel9) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txt_hora, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel7Layout.createSequentialGroup() .addGap(4, 4, 4) .addComponent(jcb_tipoComprobante, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(106, 106, 106) .addComponent(txt_total_val, javax.swing.GroupLayout.DEFAULT_SIZE, 346, Short.MAX_VALUE)) .addGroup(jPanel7Layout.createSequentialGroup() .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(jPanel7Layout.createSequentialGroup() .addGap(14, 14, 14) .addComponent(jLabel1) .addGap(11, 11, 11) .addComponent(jdfecha, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel7Layout.createSequentialGroup() .addGap(4, 4, 4) .addComponent(txt_sec1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txt_sec2, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(txt_secNUmFac, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup() .addGap(19, 19, 19) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(txt_numAutorizacion) .addGap(4, 4, 4)) .addGroup(jPanel7Layout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(jLabel15) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jcb_sustentoComprobante, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(2, 2, 2))) .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); jPanel7Layout.setVerticalGroup( jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup() .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup() .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup() .addGap(1, 1, 1) .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txt_sec1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txt_sec2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txt_secNUmFac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) .addComponent(txt_numAutorizacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup() .addGap(7, 7, 7) .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jdfecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel7Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel15) .addComponent(jcb_sustentoComprobante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))) .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup() .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel9) .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(txt_hora, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jcb_tipoComprobante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) .addComponent(txt_total_val, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))) ); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(45, 45, 45)) ); jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { } )); jTable1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTable1MouseClicked(evt); } }); jTable1.addInputMethodListener(new java.awt.event.InputMethodListener() { public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { } public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) { jTable1InputMethodTextChanged(evt); } }); jTable1.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { jTable1KeyTyped(evt); } }); jScrollPane1.setViewportView(jTable1); jLabel3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel3.setText("BUSCAR PRODUCTOS"); txtBuscar2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtBuscar2ActionPerformed(evt); } }); txtBuscar2.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { txtBuscar2KeyPressed(evt); } public void keyReleased(java.awt.event.KeyEvent evt) { txtBuscar2KeyReleased(evt); } public void keyTyped(java.awt.event.KeyEvent evt) { txtBuscar2KeyTyped(evt); } }); jButton3.setText("+"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jPanel8.setBorder(javax.swing.BorderFactory.createEtchedBorder()); javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8); jPanel8.setLayout(jPanel8Layout); jPanel8Layout.setHorizontalGroup( jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup() .addContainerGap() .addComponent(foto, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); jPanel8Layout.setVerticalGroup( jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup() .addComponent(foto, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); jcbFormasPago.setFont(new java.awt.Font("Tahoma", 1, 15)); // NOI18N jcbFormasPago.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jcbFormasPagoItemStateChanged(evt); } }); jButton1.setBackground(new java.awt.Color(102, 153, 255)); jButton1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jButton1.setText("Guardar"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton1.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent evt) { jButton1PropertyChange(evt); } }); jButton2.setBackground(new java.awt.Color(255, 102, 102)); jButton2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jButton2.setText("Cerrar"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder("")); txt_subtotal.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N jLabel12.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel12.setText("Subtotal:"); jLabel13.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel13.setText("%Dcto"); txt_descuentoGenral.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N txt_descuentoGenral.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { txt_descuentoGenralFocusGained(evt); } }); txt_descuentoGenral.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { txt_descuentoGenralMouseClicked(evt); } }); txt_descuentoGenral.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { txt_descuentoGenralKeyPressed(evt); } public void keyReleased(java.awt.event.KeyEvent evt) { txt_descuentoGenralKeyReleased(evt); } public void keyTyped(java.awt.event.KeyEvent evt) { txt_descuentoGenralKeyTyped(evt); } }); lbl_subTotalIva.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N lbl_subTotalIva.setText("Subtotal iva:"); lbl_subTotalIva1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N lbl_subTotalIva1.setText("Subtotal iva 0:"); txt_subtotalIvaValorCero.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N lbl_Iva.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N lbl_Iva.setText("IVA"); txt_iva_valor.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N lbl_subTotalIva2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N lbl_subTotalIva2.setText("Total"); txt_total_.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N txt_subtotalIvaValor.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9); jPanel9.setLayout(jPanel9Layout); jPanel9Layout.setHorizontalGroup( jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel9Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel9Layout.createSequentialGroup() .addComponent(jLabel12) .addGap(28, 28, 28) .addComponent(jLabel13) .addGap(26, 26, 26) .addComponent(lbl_subTotalIva, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(30, 30, 30) .addComponent(lbl_subTotalIva1, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(80, 80, 80) .addComponent(lbl_Iva, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel9Layout.createSequentialGroup() .addComponent(txt_subtotal, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(txt_descuentoGenral, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(30, 30, 30) .addComponent(txt_subtotalIvaValor, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txt_subtotalIvaValorCero, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(88, 88, 88) .addComponent(txt_iva_valor, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(40, 40, 40) .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(lbl_subTotalIva2, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txt_total_, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(150, Short.MAX_VALUE)) ); jPanel9Layout.setVerticalGroup( jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel9Layout.createSequentialGroup() .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel12) .addComponent(jLabel13) .addComponent(lbl_subTotalIva) .addComponent(lbl_subTotalIva1) .addComponent(lbl_Iva) .addComponent(lbl_subTotalIva2)) .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel9Layout.createSequentialGroup() .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel9Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txt_subtotalIvaValorCero, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel9Layout.createSequentialGroup() .addGap(8, 8, 8) .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txt_descuentoGenral) .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txt_subtotal, javax.swing.GroupLayout.DEFAULT_SIZE, 20, Short.MAX_VALUE) .addComponent(txt_subtotalIvaValor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))) .addContainerGap()) .addGroup(jPanel9Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txt_total_, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txt_iva_valor, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) ); jLabel2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel2.setText("Pago:"); jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder("")); jButton4.setBackground(new java.awt.Color(102, 255, 102)); jButton4.setText("+ IVA"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); jButton5.setBackground(new java.awt.Color(255, 102, 102)); jButton5.setText("- IVA"); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10); jPanel10.setLayout(jPanel10Layout); jPanel10Layout.setHorizontalGroup( jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel10Layout.createSequentialGroup() .addContainerGap(629, Short.MAX_VALUE) .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); jPanel10Layout.setVerticalGroup( jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel10Layout.createSequentialGroup() .addComponent(jButton4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE) .addComponent(jButton5) .addContainerGap()) ); jButton6.setBackground(new java.awt.Color(255, 204, 51)); jButton6.setFont(new java.awt.Font("Tahoma", 1, 15)); // NOI18N jButton6.setText("RIDE (PDF)"); jButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton6ActionPerformed(evt); } }); jchek_hacer_retencion.setText("Hacer Retención"); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(26, 26, 26) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jButton6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(18, 18, 18) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(38, 38, 38) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jcbFormasPago, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jchek_hacer_retencion))) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel3) .addComponent(jPanel8, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(txtBuscar2, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))))) .addContainerGap()) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtBuscar2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 298, Short.MAX_VALUE)) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(77, 77, 77) .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(13, 13, 13) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jcbFormasPago, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jchek_hacer_retencion) .addGap(17, 17, 17) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel2Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(6, 6, 6)) ); jPanel5.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); jPanel5Layout.setVerticalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 46, Short.MAX_VALUE) ); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void txt_nombresFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txt_nombresFocusGained // TODO add your handling code here: //txt_nombres.selectAll(); }//GEN-LAST:event_txt_nombresFocusGained private void addDialogoCantidad() { Frame frame = JOptionPane.getFrameForComponent(this); cantidadCompra pcdialog = new cantidadCompra(frame, true); int fila = jTable1.getRowCount(); if (jTable1.getRowCount() > 0) { pcdialog.txt_producto.setText(modelo.getValueAt(fila - 1, 3).toString()); pcdialog.txt_cantidad.setText(modelo.getValueAt(fila - 1, 4).toString().replace(",", ".")); pcdialog.txt_cantidad.selectAll(); pcdialog.setLocationRelativeTo(this); pcdialog.setVisible(true); jTable1.setValueAt(cantidadEnviadadesdeDialog, fila - 1, 4); } //Double precio = Double.valueOf(modelo.getValueAt(fila, 8).toString().replace(",", ".")); } private void addDialogoPrecio() { int x = MouseInfo.getPointerInfo().getLocation().x; int y = MouseInfo.getPointerInfo().getLocation().y; Frame frame = JOptionPane.getFrameForComponent(this); precioCompra pcdialog = new precioCompra(frame, true); int fila = jTable1.getRowCount(); pcdialog.txt_producto.setText(modelo.getValueAt(fila - 1, 3).toString()); pcdialog.precioIn = Double.parseDouble(modelo.getValueAt(fila - 1, 7).toString().replace(",", ".")); pcdialog.txt_precio.setText(modelo.getValueAt(fila - 1, 7).toString().replace(",", ".")); pcdialog.txt_precio.selectAll(); pcdialog.setLocationRelativeTo(this); pcdialog.setVisible(true); jTable1.setValueAt(costoEnviadodesdeDialog, fila - 1, 7); } private static void llenarSecuenciaFacura() { int x = MouseInfo.getPointerInfo().getLocation().x; int y = MouseInfo.getPointerInfo().getLocation().y; // DecimalFormat formateador = new DecimalFormat("000000000"); // SeriesFacturas objSF = new SeriesFacturas(); // SeriesFacturasDao objDaoSF = new SeriesFacturasDao(); // // objSF = objDaoSF.getMaxNUumeroFactura(login.CodigoDelEquipo); // Integer nfac = Integer.parseInt(objSF.getFac3()); // nfac = nfac + 1; // String format = formateador.format(nfac); // txt_sec1.setText(objSF.getSec1()); // txt_sec2.setText(objSF.getSec2()); // txt_secNUmFac.setText(String.valueOf(format)); } private void addOrDeleteRowTable(JTable table) { table.getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { boolean esNUmero = false; if (e.getType() == TableModelEvent.UPDATE) { int col = e.getColumn(); int fila = e.getFirstRow(); //JOptionPane.showMessageDialog(null, "columana: "+col+" evento: "+e.getType()); // JOptionPane.showMessageDialog(null, "row: "+col); // if(col == 8){ // // if(ValidaNUmeros.isOnlyDouble(jTable1.getValueAt(fila, 8).toString()) && ValidaNUmeros.isOnlyDouble(jTable1.getValueAt(fila, 4).toString())){ // Double total=Double.parseDouble(jTable1.getValueAt(fila, 8).toString()); // Double can=Double.parseDouble(jTable1.getValueAt(fila, 4).toString()); // Double pu=0.0; // pu=total/can; // jTable1.setValueAt(String.format("%.3f", pu).replace(",", "."), fila, 7); // JOptionPane.showMessageDialog(null,String.valueOf(jTable1.getValueAt(fila, 7).toString()) ); // } // // } if (col == 3 || col == 4 || col == 5 || col == 7 || col == 10) { if (!ValidaNUmeros.isOnlyDouble(jTable1.getValueAt(fila, 4).toString())) { jTable1.setValueAt("1.0", fila, 4); } if (!ValidaNUmeros.isOnlyDouble(jTable1.getValueAt(fila, 5).toString())) { jTable1.setValueAt("0.0", fila, 5); } if (!ValidaNUmeros.isOnlyDouble(jTable1.getValueAt(fila, 7).toString())) { Double precio = Double.valueOf(modelo.getValueAt(fila, 8).toString().replace(",", ".")); jTable1.setValueAt(precio, fila, 7); } ///col 10 es la col del air // // for (int i = 0; i < jTable1.getModel().getRowCount(); i++) { // // Deb.consola("Vista.Usuarios.Crear_Facturas.addOrDeleteRowTable(): " + jTable1.getRowCount()); // jTable1.setValueAt("dd", i, 1); // } operacionFacturauPDATEandAddRowrs(); // jTable1.setValueAt(fila, fila, 1); } } if (e.getType() == TableModelEvent.INSERT) { operacionFacturauPDATEandAddRowrs(); } if (e.getType() == TableModelEvent.DELETE) { } } }); /// pongo numero de item en columna1 en cada evento depus de que se hya realizado cuaaquier accion sea update //delete or add row } private void cellEditJtableGuardaBDDMetodoUpdate(JTable table) { table.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { int row = table.getSelectedRow(); int column = table.getSelectedColumn(); // resul is the new value to insert in the DB String resul = table.getValueAt(row, column).toString(); // id is the primary key of my DB String id = table.getValueAt(row, 0).toString(); // update is my method to update. Update needs the id for // the where clausule. resul is the value that will receive // the cell and you need column to tell what to update. // update(id, resul, column); } } }); } private void operacionFacturauPDATEandAddRowrs() { Double tarifaIva = 0.0; try { utilidad = 0.0; descuentogeneral = Double.valueOf(txt_descuentoGenral.getText().replace(",", ".")); total = 0.0; subtotal = 0.0; subtotaliva0 = 0.0; subtotaliva12 = 0.0; Double ivadecimal = (iva / 100) + 1; int row = jTable1.getModel().getRowCount(); int col = jTable1.getModel().getColumnCount(); Deb.consola("Add_event: row: " + row + " col: " + col); for (int i = 0; i < row; i++) { // modelo.setValueAt(String.valueOf(precio), i, 7); Deb.consola("INGRESA AL pRIMER for"); Double cantidad = Double.valueOf(modelo.getValueAt(i, 4).toString().replace(",", ".")); Double precioold = Double.valueOf(modelo.getValueAt(i, 7).toString().replace(",", ".")); Double precio = Double.valueOf(modelo.getValueAt(i, 7).toString().replace(",", ".")); Double totalUnita = Double.valueOf(modelo.getValueAt(i, 8).toString().replace(",", ".")); totalUnita = precio * cantidad; //modelo.setValueAt(String.valueOf(String.format("%.3f", totalUnita)).replace(",", "."), i, 8); Deb.consola("rows: " + row + " PRECIO: " + precio); Deb.consola("rows: " + row + " TOTALUNITA: " + totalUnita); Deb.consola("rows: " + row + " UNIDAD: " + cantidad); // precio = totalUnita / cantidad; // modelo.setValueAt(String.valueOf(String.format("%.3f", precio)).replace(",", "."), i, 7); //////////descuento general if (descuentogeneral > 0 && descuentogeneral <= 100) { // precio=precio-(precio*descuentogeneral)/100; precio = precioold - (precioold * descuentogeneral) / 100; } //////////fin descuento general tarifaIva = Double.parseDouble(modelo.getValueAt(i, 1).toString().replace(",", ".")); if (aumentarIvaSiNO == 1) { if (tarifaIva == 0.0) { precio = precioold; } else { precio = precioold * ivadecimal; } } if (aumentarIvaSiNO == 0.0) { if (tarifaIva == 0.0) { precio = precioold; } else { precio = precioold / ivadecimal; } // modelo.setValueAt(String.valueOf(precio), i, 7); } // modelo.setValueAt(String.valueOf(precio), i, 7); Double descuento = Double.valueOf(modelo.getValueAt(i, 5).toString().replace(",", ".")); Double costo = Double.valueOf(modelo.getValueAt(i, 0).toString().replace(",", ".")); Double Ptotal = precio * cantidad; Double costoxFila = costo * cantidad; if (descuento > 0 && descuento <= 100) { Ptotal = Ptotal - ((Ptotal * descuento) / 100); //utilidad } // modelo.setValueAt(precio, i, 7); modelo.setValueAt(String.valueOf(String.format("%.3f", Ptotal)).replace(",", "."), i, 8); if (tarifaIva == 0) { subtotaliva0 = subtotaliva0 + Ptotal; // precio*cantidad; } else { subtotaliva12 = subtotaliva12 + Ptotal; // precio*cantidad; } //subtotaliva12 = subtotaliva12 * ivadecimal;// + subtotaliva0; subtotal = subtotaliva0 + subtotaliva12; total = subtotaliva12 * ivadecimal + subtotaliva0; utilidad = utilidad + (Double.valueOf(modelo.getValueAt(i, 8).toString().replace(",", ".")) - costoxFila); // utilidad = utilidad + Ptotal2 - costoxFila; // Deb.consola("total_segundoFor: " + Double.valueOf(modelo.getValueAt(i, 8).toString().replace(",", "."))); txt_utilidad.setText(String.valueOf(String.format("%.2f", utilidad)).replace(",", ".")); txt_subtotalIvaValorCero.setText(String.valueOf(String.format("%.2f", subtotaliva0)).replace(",", ".")); txt_total_val.setText(String.valueOf(String.format("%.2f", total)).replace(",", ".")); txt_total_.setText(String.valueOf(String.format("%.2f", total)).replace(",", ".")); txt_subtotal.setText(String.valueOf(String.format("%.2f", subtotal)).replace(",", ".")); txt_subtotalIvaValor.setText(String.valueOf(String.format("%.2f", subtotaliva12)).replace(",", ".")); txt_iva_valor.setText(String.valueOf(String.format("%.2f", (subtotaliva12 * ivadecimal - subtotaliva12))).replace(",", ".")); // modelo.setValueAt(String.valueOf(precio), i, 7); } } catch (Exception e) { msg.setMensaje(e.toString()); } } private static void limpiarIntefazVentas() { while (modelo.getRowCount() > 0) { modelo.removeRow(0); } jTable1.setModel(modelo); //VaciarTexto vt = new VaciarTexto(); VaciarTexto.limpiar_texto(jPanel2); txt_total_val.setText("0.00"); llenarSecuenciaFacura(); datosPredeterminadosFacturas(); // list1.setVisible(false); // list2.setVisible(false); } private static Integer addDatosClienteonFactura(String cedula) { //Deb.consola("Vista.Usuarios.Crear_Facturas.txt_cedulaKeyTyped() Entrooo: " + evt.getKeyCode()); Integer codigoCliente = null; try { Clientes obj = new Clientes(); ClientesDao objDao = new ClientesDao(); obj = objDao.buscarConCedula(cedula, 1); txt_nombres.setText(obj.getNombre()); txt_celular.setText(obj.getCelular()); txt_dir.setText(obj.getDireccion()); txt_clienteCodigo.setText(obj.getCodigo().toString()); txt_clienteCodigo.setVisible(false); codigoCliente = obj.getCodigo(); // if (obj.getCredito() == 1) { // diasCrediotoconProveedor = obj.getTiempoCredito(); // } else { // diasCrediotoconProveedor = "0"; // } diasCrediotoconProveedor = "0"; codigoClienteCompra = codigoCliente; } catch (Exception e) { } return codigoCliente; } private void txt_nombresKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_nombresKeyPressed // TODO add your handling code here: // TODO add your handling code here: //************************************ Deb.consola("Vista.Usuarios.Crear_Facturas.txt_nombresKeyPressed()xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); String ruc = ""; if (ValidaNUmeros.isOnlyNumbers(txt_nombres.getText()) && KeyEvent.VK_ENTER == evt.getKeyCode()) { if ((txt_nombres.getText().length() == 10 || txt_nombres.getText().length() == 13)) { ruc = txt_nombres.getText(); // JOptionPane.showMessageDialog(null, ruc); Deb.consola("Vista.Usuarios.Crear_Facturas.txt_nombresKeyPressed()llllllllllllllllllllllllll"); if (addDatosClienteonFactura(txt_nombres.getText()) == null) { // JOptionPane.showMessageDialog(null, ruc); Crear_Clientes obj_crearC = new Crear_Clientes(); obj_crearC.buscarProvvedoroCLiente = 1; Principal.desktopPane.add(obj_crearC); try { obj_crearC.setSelected(true); } catch (PropertyVetoException ex) { Logger.getLogger(Modal_CrearFacturas.class .getName()).log(Level.SEVERE, null, ex); } Crear_Clientes.txt_cedulax.setText(ruc); obj_crearC.setVisible(true); } } } else { Deb.consola("Vista.Usuarios.Crear_Facturas.txt_nombresKeyPressed()xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); ClientesDao cd = new ClientesDao(); listaProveedores = cd.BuscarClietneslikokokok(ruc, 0); proveedorAutoCompleter.removeAllItems(); for (Clientes p : listaProveedores) { proveedorAutoCompleter.addItem(p); } } }//GEN-LAST:event_txt_nombresKeyPressed private void txt_nombresKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_nombresKeyReleased // TODO add your handling code here: // // if (evt.getKeyCode() == 10) { // // } else { // // ProveedoresDao pDao = new ProveedoresDao(); // proveedorAutoCompleter.removeAllItems(); // for (Proveedores p : pDao.listarlike(txt_nombres.getText())) { //.listarlike(txtBuscar2.getText())) { // Deb.consola("Prod: " + p.getNombre()); // proveedorAutoCompleter.addItem(p); // } // } }//GEN-LAST:event_txt_nombresKeyReleased private void jComboBox1ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBox1ItemStateChanged // TODO add your handling code here: for (Usuarios usuarios : listaU) { if (usuarios.getNombre().equals(jComboBox1.getSelectedItem())) { this.codigoUsuarioVendedorSeleccionadoJCB = usuarios.getCodigo(); txt_usuarioCodigo.setText(codigoUsuarioVendedorSeleccionadoJCB.toString()); } } Deb.consola("Vista.Usuarios.Crear_Facturas.jComboBox1ItemStateChanged(): " + evt.getItem()); }//GEN-LAST:event_jComboBox1ItemStateChanged private void txt_cedulaFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txt_cedulaFocusGained }//GEN-LAST:event_txt_cedulaFocusGained private void txt_cedulaInputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_txt_cedulaInputMethodTextChanged // TODO add your handling code here }//GEN-LAST:event_txt_cedulaInputMethodTextChanged private void txt_cedulaPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_txt_cedulaPropertyChange // TODO add your handling code here: }//GEN-LAST:event_txt_cedulaPropertyChange private void txt_cedulaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_cedulaKeyPressed }//GEN-LAST:event_txt_cedulaKeyPressed private void txt_cedulaKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_cedulaKeyReleased // if (txt_cedula.getText().length() == 10 && txt_cedula.getText() != "9999999999" || txt_cedula.getText().length() == 13 && txt_cedula.getText() != "9999999999999") { // if (evt.getKeyCode() == KeyEvent.VK_ENTER) { // if (ValidaCedula.validaRUC(txt_cedula.getText())) { // // if (addDatosClienteonFactura(txt_cedula.getText()) == null) { // Crear_Clientes obj_crearC = new Crear_Clientes(); // Principal.desktopPane.add(obj_crearC); // obj_crearC.setVisible(true); // Crear_Clientes.txt_cedulax.setText(txt_cedula.getText()); // //Crear_Proveedores.txt_cedula.setText(txt_cedula.getText()); // try { // obj_crearC.setSelected(true); // // } catch (PropertyVetoException ex) { // Logger.getLogger(Crear_Compras.class // .getName()).log(Level.SEVERE, null, ex); // } // // // btn_nuevo.setVisible(true); // } // } else { // // // JOptionPane.showMessageDialog(null, "Cedula o RUC mal Formada."); // } // // } // } }//GEN-LAST:event_txt_cedulaKeyReleased private void txt_cedulaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_cedulaKeyTyped // TODO add your handling code here: //Deb.consola("Vista.Usuarios.Crear_Facturas.txt_cedulaKeyTyped() "+evt.getExtendedKeyCode()); // if (txt_cedula.getText().length() < 13 ) { // ValidaNUmeros val = new ValidaNUmeros(); // val.keyTyped(evt); }//GEN-LAST:event_txt_cedulaKeyTyped private void txt_sec1FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txt_sec1FocusGained txt_sec1.selectAll(); }//GEN-LAST:event_txt_sec1FocusGained private void txt_sec1FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txt_sec1FocusLost // TODO add your handling code here: txt_sec1.setText(OperacionesForms.validaNumeroFactura3(txt_sec1.getText())); }//GEN-LAST:event_txt_sec1FocusLost private void txt_sec1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_sec1KeyReleased // TODO add your handling code here: //if (!ValidaNUmeros.isOnlyNumbers(txt_sec1.getText())|| !(txt_sec1.getText().length() <= 3)) { txt_sec1.setText(OperacionesForms.ValidaNumeroFacturaCompraKeyRelesed3(txt_sec1.getText())); if (txt_sec1.getText().equals("000")) { txt_sec1.selectAll(); } }//GEN-LAST:event_txt_sec1KeyReleased private void txt_secNUmFacFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txt_secNUmFacFocusGained // TODO add your handling code here: txt_secNUmFac.selectAll(); }//GEN-LAST:event_txt_secNUmFacFocusGained private void txt_secNUmFacFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txt_secNUmFacFocusLost // TODO add your handling code here: txt_secNUmFac.setText(OperacionesForms.validaNumeroFactura9(txt_secNUmFac.getText())); }//GEN-LAST:event_txt_secNUmFacFocusLost private void txt_secNUmFacKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_secNUmFacKeyReleased txt_secNUmFac.setText(OperacionesForms.ValidaNumeroFacturaCompraKeyRelesed9(txt_secNUmFac.getText())); if (txt_secNUmFac.getText().equals("000000001")) { txt_secNUmFac.selectAll(); } // TODO add your handling code here: }//GEN-LAST:event_txt_secNUmFacKeyReleased private void txt_sec2FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txt_sec2FocusGained // TODO add your handling code here: txt_sec2.selectAll(); }//GEN-LAST:event_txt_sec2FocusGained private void txt_sec2FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txt_sec2FocusLost // TODO add your handling code here: txt_sec2.setText(OperacionesForms.validaNumeroFactura3(txt_sec2.getText())); }//GEN-LAST:event_txt_sec2FocusLost private void txt_sec2KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_sec2KeyReleased // TODO add your handling code here: txt_sec2.setText(OperacionesForms.ValidaNumeroFacturaCompraKeyRelesed3(txt_sec2.getText())); if (txt_sec2.getText().equals("001")) { txt_sec2.selectAll(); } }//GEN-LAST:event_txt_sec2KeyReleased private void txt_numAutorizacionKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_numAutorizacionKeyReleased // TODO add your handling code here: //txt_numAutorizacion.setText(OperacionesForms.ValidaNumeroFacturaCompraNumeroAutorizacion(txt_numAutorizacion.getText())); ValidaNUmeros.keyTyped(evt); }//GEN-LAST:event_txt_numAutorizacionKeyReleased private void txt_numAutorizacionKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_numAutorizacionKeyTyped // TODO add your handling code here: ValidaNUmeros.keyTyped(evt); }//GEN-LAST:event_txt_numAutorizacionKeyTyped private void jcb_tipoComprobanteItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jcb_tipoComprobanteItemStateChanged // TODO add your handling code here: for (sri_tipocomprobante t : listatipoComprobantes) { if (jcb_tipoComprobante.getSelectedItem().toString().contains(t.getTipocomprobante())) { IdTipoComprabanteSeleccionado = t.getId(); tipoDocumento = t.getTipocomprobante(); ultimoIndexSeleccionadojcBTipoCOmporbante = 10; } } }//GEN-LAST:event_jcb_tipoComprobanteItemStateChanged private void jcb_sustentoComprobanteItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jcb_sustentoComprobanteItemStateChanged // TODO add your handling code here: for (sri_sustentocomprobante t : listasustentoComprobantes) { if (jcb_sustentoComprobante.getSelectedItem().toString().contains(t.getSustento())) { IdsustentoComprabanteSeleccionado = t.getId(); ultimoIndexSeleccionadojcbSustento = 10; } } }//GEN-LAST:event_jcb_sustentoComprobanteItemStateChanged private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked // TODO add your handling code here: int Rowclik = jTable1.getSelectedRow(); int columclik = jTable1.getSelectedColumn(); int colpvpTotalrow = 8; int colAIR = 11; int colcantidad = 4; int x = MouseInfo.getPointerInfo().getLocation().x; int y = MouseInfo.getPointerInfo().getLocation().y; Deb.consola("X AND Y : " + x + " - " + y); if (evt.getButton() == MouseEvent.BUTTON1) { Deb.consola("BOTON 1"); // operacionFacturauPDATEandAddRowrs(); if ((colAIR == columclik) && (evt.getClickCount() == 2)) { if (ValidaNUmeros.isOnlyNumbers(jTable1.getValueAt(Rowclik, colAIR - 1).toString())) { ComprasDao cdao = new ComprasDao(); // if (!cdao.getTrueifCodigoAIRisCorrect(jTable1.getValueAt(Rowclik, colAIR).toString())) { // JOptionPane.showMessageDialog(null, "EL codiogo AIR es Incorrecto"); isOpenfromCrearFacturaSelectAir = true; columnacliked = colAIR; filacliked = Rowclik; Frame f = JOptionPane.getFrameForComponent(Modal_Crear_compras.this); SelectPorcentajesRetencion dialog = new SelectPorcentajesRetencion(f, true); dialog.isCheckrenta = true; dialog.jTable11.setModel(Crear_RetencionC.llenartableRENTA()); dialog.setLocationRelativeTo(null); dialog.setVisible(true); // } } else { JOptionPane.showMessageDialog(null, "Algo Anda muy mal"); jTable1.setValueAt("0", Rowclik, colAIR); } } } if (evt.getButton() == MouseEvent.BUTTON2) { Deb.consola("BOTON 2"); } if (evt.getButton() == MouseEvent.BUTTON3) { Deb.consola("BOTON 3"); // if (evt.getClickCount() == 1 && columclik == colAIRrow) { // if (jTable1.getSelectedRow() != -1) { // // remove selected row from the model // if (jTable1.getRowCount() > 0) { // Deb.consola("asdasdasdasdasdasdassssssssssssssssssssssssssssss"); // Frame f = JOptionPane.getFrameForComponent(this); // //isOpenfromCrearRetencion = true; // SelectPorcentajesRetencion dialog2 = new SelectPorcentajesRetencion(f, true); // dialog2.isCheckrenta = true; // dialog2.jTable11.setModel(Crear_RetencionC.llenartableRENTA()); // dialog2.setLocationRelativeTo(null); // dialog2.setVisible(true); // } // } // } } if (evt.getButton() == MouseEvent.BUTTON3 || evt.getButton() == MouseEvent.BUTTON1) { try { if (evt.getClickCount() == 3) { if (jTable1.getSelectedRow() != -1) { // remove selected row from the model if (jTable1.getRowCount() > 0) { ///eliminamos la fila seleccionada y actualizamos el total de la factura int row = jTable1.getSelectedRow(); Deb.consola("88888888: " + SetRenderJTableCXC.get_jtable_cell_component(jTable1, row, 2).getBackground().toString()); Double costo = Double.valueOf(modelo.getValueAt(row, 0).toString().replace(",", ".")); Double cantidad = Double.valueOf(modelo.getValueAt(row, 4).toString().replace(",", ".")); Double Ptotal = Double.valueOf(modelo.getValueAt(row, 8).toString().replace(",", ".")); Double costoxFila = costo * cantidad; Double totaltemp = Double.valueOf(txt_total_val.getText().toString().replace(",", ".")); Double Utilidadtemp = Double.valueOf(txt_utilidad.getText().toString().replace(",", ".")); total = totaltemp - Double.valueOf(jTable1.getValueAt(row, 8).toString().replace(",", ".")); utilidad = Utilidadtemp - (Ptotal - costoxFila); //Double.valueOf(modelo.getValueAt(row, 7).toString().replace(",", ".")); //txt_pvp.setText(String.valueOf(String.format("%.4f", pvp1))); txt_total_val.setText(String.valueOf(String.format("%.2f", total)).replace(",", ".")); txt_total_.setText(String.valueOf(String.format("%.2f", total)).replace(",", ".")); txt_utilidad.setText(String.valueOf(String.format("%.2f", utilidad)).replace(",", ".")); Double ivadecimal = (this.iva / 100) + 1; subtotal = total / ivadecimal; txt_subtotal.setText(String.valueOf(String.format("%.2f", subtotal)).replace(",", ".")); txt_subtotalIvaValor.setText(String.valueOf(String.format("%.2f", subtotal)).replace(",", ".")); //txt_iva_valor.setText(total-subtotal); txt_iva_valor.setText(String.valueOf(String.format("%.2f", (total - subtotal))).replace(",", ".")); modelo.removeRow(row); } } } if (evt.getClickCount() == 1 && columclik == colpvpTotalrow) { //if (jTable1.getSelectedRow() != -1) { String tot = jTable1.getValueAt(Rowclik, colpvpTotalrow).toString(); // Deb.consola("Vista.Usuarios.Crear_Facturas.jTable1MouseClicked()codigo prducto seleccionado L: " + codigoProductoSeleccionadoClickonJTable); Frame frame = JOptionPane.getFrameForComponent(this); PrecioTotalComprasXFila pcdialog = new PrecioTotalComprasXFila(frame, true); // pcdialog.codigoProducto = codigoProductoSeleccionadoClickonJTable; pcdialog.cantidadProducto = Double.parseDouble(jTable1.getValueAt(Rowclik, colcantidad).toString()); pcdialog._pvpTotal = Double.parseDouble(jTable1.getValueAt(Rowclik, colpvpTotalrow).toString()); pcdialog._pvpUnitario = Double.parseDouble(jTable1.getValueAt(Rowclik, 7).toString()); pcdialog.txt_precio.setText(jTable1.getValueAt(Rowclik, colpvpTotalrow).toString()); pcdialog.txt_producto.setText(jTable1.getValueAt(Rowclik, 5).toString()); Deb.consola("X AND Y : " + x + " - " + y); pcdialog.setLocation(x, y); // pcdialog.setLocationRelativeTo(frame); pcdialog.txt_precio.selectAll(); pcdialog.setVisible(true); jTable1.setValueAt(pcdialog._pvpUnitario, Rowclik, 7); jTable1.setValueAt(pcdialog.txt_precio.getText(), Rowclik, colpvpTotalrow); //} } } catch (Exception e) { msg.setMensaje(e.toString()); } } }//GEN-LAST:event_jTable1MouseClicked private void jTable1InputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_jTable1InputMethodTextChanged // TODO add your handling code here: }//GEN-LAST:event_jTable1InputMethodTextChanged private void jTable1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTable1KeyTyped // TODO add your handling code here: Deb.consola("Vista.Usuarios.Crear_Facturas.jTable1KeyTyped() enteeerrrr" + evt.getKeyCode()); if (evt.getKeyCode() == 10) { Deb.consola("Vista.Usuarios.Crear_Facturas.jTable1KeyTyped() enteeerrrr"); // list1.requestFocus(); // list2.requestFocus(); } }//GEN-LAST:event_jTable1KeyTyped private void txtBuscar2KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtBuscar2KeyPressed // Deb.consola("cadena: " + txtBuscar2.getText() + " - Presed: " + evt.getKeyChar()); // TODO add your handling code here: }//GEN-LAST:event_txtBuscar2KeyPressed private void txtBuscar2KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtBuscar2KeyReleased // TODO add your handling code here: //Deb.consola("relesed : "+txtBuscar2.getText()); if (evt.getKeyCode() == 10) { if (!txtBuscar2.getText().equalsIgnoreCase("")) { txtBuscar2.setText(""); addDialogoCantidad(); addDialogoPrecio(); } } else { ProductosDao pDao = new ProductosDao(); productosAutoCompleter.removeAllItems(); for (Productos p : pDao.listarlike(txtBuscar2.getText())) { // Deb.consola("Prod: " + p.getProducto()); // Deb.consola("prod: " + p.getProducto()); productosAutoCompleter.addItem(p); } } }//GEN-LAST:event_txtBuscar2KeyReleased private void txtBuscar2KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtBuscar2KeyTyped // Deb.consola("cadena: " + txtBuscar2.getText() + " - KeyTyped: " + evt.getKeyChar()); // TODO add your handling code here: }//GEN-LAST:event_txtBuscar2KeyTyped private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed // TODO add your handling code here: Integer numVentana = 0; JInternalFrame v[] = desktopPane.getAllFrames(); if (v.length >= 1) { for (int i = 0; i < v.length; i++) { if (v[i] instanceof Crear_Productos) { if (numVentana == 0) { numVentana = 100; try { v[i].setSelected(true); } catch (PropertyVetoException ex) { Logger.getLogger(Principal.class .getName()).log(Level.SEVERE, null, ex); } } else { v[i].dispose(); } } else { if (numVentana == 0) { numVentana = 100; Crear_Productos obj = new Crear_Productos(); desktopPane.add(obj); obj.setVisible(true); JButton a = new JButton("Crear Productos"); } } } numVentana = 0; } else { Crear_Productos obj = new Crear_Productos(); desktopPane.add(obj); obj.setVisible(true); JButton a = new JButton("Crear Productos"); } }//GEN-LAST:event_jButton3ActionPerformed private void jcbFormasPagoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jcbFormasPagoItemStateChanged // TODO add your handling code here: FormasPagoCV f = new FormasPagoCV(); FormasPagoCVDao objFdPDao = new FormasPagoCVDao(); f = objFdPDao.buscarConFormaPagobynombre(evt.getItem().toString()); this.formaPagoSeelccionada = f.getFormaPago(); codigFormaPagoSeleccionada = f.getCodigo(); }//GEN-LAST:event_jcbFormasPagoItemStateChanged private void llenarcompraDesdeXML() { Factura facx = new Factura(); facx = OperacionesForms.factura; txt_cedula.setText(facx.getRUC()); //tx } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed //boolean afectaacaja = false; ArrayList<Kardex> listakardesk = new ArrayList<>(); ArrayList<DetalleCompra> listadetallecompras = new ArrayList<>(); ArrayList<Productos> listaProductos = new ArrayList<>(); Cxp cxp = new Cxp(); // long d = java.sql.Date fecha = new java.sql.Date(d); // JOptionPane.showMessageDialog(null, "fechaxxasasd: "+fecha); Compras u = new Compras(); /*creo el codigoAcceso*/ String ruc = ""; if (txt_cedula.getText().length() == 10) { ruc = txt_cedula.getText() + "001"; } else if (txt_cedula.getText().length() == 13) { ruc = txt_cedula.getText(); } claveAcceso = txt_numAutorizacion.getText(); if (codigoClienteCompra != null) { if (!txt_cedula.getText().isEmpty() && !txt_nombres.getText().isEmpty() && !txt_sec1.getText().isEmpty() && !txt_sec2.getText().isEmpty() && !txt_secNUmFac.getText().isEmpty()) { // JOptionPane.showMessageDialog(null, "codigo: " + codigoClienteFactura); if (jTable1.getRowCount() != 0) { u.setEstablecimiento(txt_sec1.getText()); u.setPtoEmision(txt_sec2.getText()); u.setSecfactura(txt_secNUmFac.getText()); u.setProveedores_codigo(codigoClienteCompra); u.setUsuarios_Codigo(Integer.valueOf(txt_usuarioCodigo.getText())); u.setDescuento(txt_descuentoGenral.getText()); u.setEquipo(login.nombreDelEquipo); u.setFecha(jdfecha.getDate()); u.setIva(iva.toString()); secuenciaFac = txt_sec1.getText() + "-" + txt_sec2.getText() + "-" + txt_secNUmFac.getText(); u.setSecuencia(secuenciaFac); u.setSubtotaI_con_iva(txt_subtotalIvaValor.getText()); u.setSubtotal_sin_iva(txt_subtotalIvaValorCero.getText()); u.setTotal(txt_total_val.getText()); u.setUtilidad(this.utilidad.toString()); u.setUsuarios_Codigo(this.codigoUsuarioVendedorSeleccionadoJCB); String fechaInicio = HoraFecha.fecha_aa_mm_dd_HH_mm_ss(jdfecha.getDate().toString()); u.setIva_valor(txt_iva_valor.getText()); u.setFechain(fechaInicio); u.setCalveAcceso(claveAcceso); for (sri_tipocomprobante t : listatipoComprobantes) { if (jcb_tipoComprobante.getSelectedItem().toString().contains(t.getTipocomprobante())) { IdTipoComprabanteSeleccionado = t.getId(); tipoDocumento = t.getTipocomprobante(); } } for (sri_sustentocomprobante t : listasustentoComprobantes) { if (jcb_sustentoComprobante.getSelectedItem().toString().contains(t.getSustento())) { IdsustentoComprabanteSeleccionado = t.getId(); } } u.setTipo_documentoID(IdTipoComprabanteSeleccionado); u.setTipo_documento(jcb_tipoComprobante.getSelectedItem().toString()); u.setSustento(jcb_sustentoComprobante.getSelectedItem().toString()); u.setSustentoID(IdsustentoComprabanteSeleccionado); Cxp pagos = new Cxp(); cxpDao pagosDao = new cxpDao(); ComprasDao objFacDao = new ComprasDao(); // CajasDetalleDao cdDao = new CajasDetalleDao(); Double Ptotal = 0.0; int col = jTable1.getColumnCount(); int row = jTable1.getRowCount(); SeriesFacturas objSF = new SeriesFacturas(); SeriesFacturasDao objDaoSF = new SeriesFacturasDao(); String rutaInforme = ""; Map parametros = new HashMap(); /* ANTES DE GUARDAR LA COMPRA REVISAMOS TIPO DE FORMA DE PAGO. **/ FormasPagoCVDao objFdPDao = new FormasPagoCVDao(); listaFormasDePago = objFdPDao.listar(); formaPagomap.clear(); String tipoFormaPago = ""; for (FormasPagoCV f : listaFormasDePago) { formaPagomap.put(f.getTipoPago(), f.getFormaPago()); if (jcbFormasPago.getSelectedItem().toString().equalsIgnoreCase(f.getFormaPago())) { tipoFormaPago = f.getTipoPago(); // f.getEsCxcCxp().equalsIgnoreCase(OperacionesForms._FORMA_PAGO_CXP_TEXT; } else { } } /*VALIDA LOS CODIGOS AIR EN CADA ITEM DE PRODUCTOS DE LA FACTURA*/ boolean valida = true; if (Principal.obligaoSINO.equalsIgnoreCase("si")) { for (int i = 0; i < jTable1.getRowCount(); i++) { if (jTable1.getValueAt(i, 10).toString().equals("0") || jTable1.getValueAt(i, 10).toString().trim().equals("")) { // jTable1.setValueAt("NA", i, 4); ProgressBar.mostrarMensajeAzul("DEBE ASIGANAR CODIGO DE RETENCION AL PRODUCTO: " + jTable1.getValueAt(i, 3).toString()); Deb.consola("::::::::::::::::::::::::::::YYYYYYYYYYYYYYYYYY:::::::::::::::::::::::::::::::::"); i = jTable1.getRowCount(); valida = false; } } } /*---------------------*/ switch (tipoFormaPago) { case "EFECTIVO": formaPagoSeelccionada = jcbFormasPago.getSelectedItem().toString(); u.setFormaPago(formaPagoSeelccionada); u.setCalveAcceso(claveAcceso); u.setEfectivo(0.0); u.setCambio(0.0); /////////// DETALLE DE CAJA cd.setCajas_Codigo(login.codigoCaja); cd.setDetalle(Variables.CAJA_EGRESO_COMPRA_EFECTIVO + tipoDocumento + " - " + jcbFormasPago.getSelectedItem().toString() + " # " + secuenciaFac + " EN EQUIPO: " + login.nombreDelEquipo + " USUARIO: " + login.nombresUsuario); cd.setDescripcion("---"); cd.setDocumento(tipoDocumento); cd.setFecha(jdfecha.getDate()); cd.setTipo(Variables.CAJA_TIPO_INGRESO); cd.setValor(Double.parseDouble(txt_total_val.getText())); cd.setCodigoDocuemnto(codigoCompra); // codigoCompra = objFacDao.guardar(u); afectacaja = true; afectakardex = true; if (RegistrodeEfectivoyCambioExitoso) { /* EFECTIVO*/ /* REGISTO PAGO EN EFECTIVO Y VUELTO*/ Deb.consola("Vista.Usuarios.Crear_Facturas.facfafac()"); for (int i = 0; i < row; i++) { Productos pr = new Productos(); ProductosDao prDao = new ProductosDao(); pr = prDao.buscarPorCodigoAlterno(jTable1.getValueAt(i, 2).toString()); DetalleCompra df = new DetalleCompra(); ProductosDao productoDao = new ProductosDao(); Kardex k = new Kardex(); KardexDao kDao = new KardexDao(); DetalleComprasDao dfDao = new DetalleComprasDao(); Double iva12 = 0.0; Double BaseImponible = 0.0; df.setCantidad(jTable1.getValueAt(i, 4).toString()); df.setDetalle(jTable1.getValueAt(i, 3).toString()); Ptotal = Double.valueOf(jTable1.getValueAt(i, 8).toString().replace(",", ".")); BaseImponible = Ptotal / ((this.iva / 100) + 1); iva12 = Ptotal - BaseImponible; df.setIva(String.valueOf(String.format("%.4f", iva12)).replace(",", ".")); Double ivaDecimal = ((this.iva / 100) + 1); Double valorUnitarioSinIVA = Double.valueOf(jTable1.getValueAt(i, 7).toString().replace(",", ".")); Double valorTotalSinIVA = Double.valueOf(jTable1.getValueAt(i, 8).toString().replace(",", ".")); String costoUnitario = jTable1.getValueAt(i, 7).toString().replace(",", "."); Double costounitario = Double.parseDouble(costoUnitario); // JOptionPane.showMessageDialog(null, "val: " + costoUnitario); Double ValorBase = 0.0; if (pr.getImpuesto().contains(Principal.iva)) { valorUnitarioSinIVA = valorUnitarioSinIVA * ivaDecimal; valorTotalSinIVA = valorTotalSinIVA * ivaDecimal; costounitario = costounitario * ivaDecimal; ValorBase = valorUnitarioSinIVA / ivaDecimal; } else { } String valunitadoString = (String.valueOf(String.format("%.4f", ValorBase)).replace(",", ".")); Double vau = Double.parseDouble(valunitadoString); // valorUnitarioSinIVA = (valorUnitarioSinIVA / ivaDecimal); df.setDescuento(jTable1.getValueAt(i, 5).toString()); df.setValorUnitario(String.valueOf(String.format("%.4f", valorUnitarioSinIVA)).replace(",", ".")); df.setValorTotal(String.valueOf(String.format("%.4f", valorTotalSinIVA)).replace(",", ".")); Productos pro = new Productos(); ProductosDao proDao = new ProductosDao(); pro = proDao.buscarPorCodigoAlterno(jTable1.getValueAt(i, 2).toString().trim()); Integer codigoProducto = pro.getCodigo(); df.setCompra_Codigo(codigoCompra); df.setProductos_codigo(codigoProducto); k.setBodega(jTable1.getValueAt(i, 6).toString()); k.setFecha(jdfecha.getDate()); k.setDetalle("INGRESO -- REGISTRO " + tipoDocumento + " DE COMPRA " + secuenciaFac); k.setOutcantidad("0"); k.setIncantidad(jTable1.getValueAt(i, 4).toString()); k.setIncosto(jTable1.getValueAt(i, 0).toString()); k.setInpvp(jTable1.getValueAt(i, 7).toString()); // k.setSaldocantidad(secuenciaFac); k.setProductos_Codigo(codigoProducto); ////lleno informacion para actualizar el costo del producto // pr = prodconsultaDao.buscarConID(codigoProducto); Double porvcentajeDeUtilidad = Double.parseDouble(pro.getUtilidad()); Double pvp = (costounitario + (porvcentajeDeUtilidad * costounitario) / 100); pro.setCodigo(codigoProducto); pro.setCosto(String.valueOf(String.format("%.4f", costounitario)).replace(",", ".")); pro.setPvp(String.valueOf(String.format("%.4f", pvp)).replace(",", ".")); pro.setBase(vau); listadetallecompras.add(df); listakardesk.add(k); listaProductos.add(pro); } boolean mostrarError = true; ///IMPRESION DEL DOCUMENTO // rutaInforme = "C:\\Users\\USUARIO\\OneDrive\\NetBeansProjects\\Sofi\\src\\Reportes\\FACTURA.jasper"; // parametros.put("numeroFactura", secuenciaFac); // for (int i = 0; i < Integer.parseInt(Principal.numerovecseimpresionFactura); i++) { // ImpresionDao imp = new ImpresionDao(); // imp.impresionDontShowReport(parametros, rutaInforme); // } //* enviamoa a crear i firmar factura electronica*/ // objFacDao.creaxmlFacturaElectronica(codigoFactura); // FacturasDao fad = new FacturasDao(); // fad.creaxmlFacturaElectronica(codigoFactura); /* fincreacion facura electronica*/ /*SI ES OBLIGADO A LLEEVAR CONTABILIDAD Y TODOS LOS ITEMS TIENE EL CODIGOA AIR SE REGISTRA SIN PROBLEMA*/ Integer cod = 0; if (Principal.obligaoSINO.equalsIgnoreCase("si") && valida) { /*REGISTRO COMPRA EN EFECTIVO*/ ComitsAll c = new ComitsAll(); cod = c.compraEfectivo(u, cd, listadetallecompras, listakardesk, afectacaja, afectakardex, listaProductos); /** * **************************** */ Crear_RetencionC obj = new Crear_RetencionC(); Compras compra1 = new Compras(); ComprasDao facDao = new ComprasDao(); compra1 = facDao.buscarConID(cod); RetencionCDao r = new RetencionCDao(); Boolean existe = r.Buscar_siExisteRetenciondelDocumento(compra1.getSecuencia()); ClientesDao pbDao = new ClientesDao(); Clientes p = new Clientes(); Crear_RetencionC.proveerdor = p = pbDao.buscarConID(compra1.getProveedores_codigo(), 1); Crear_RetencionC.tProveedor.setText(p.getNombre()); Crear_RetencionC.tRUc.setText(p.getCedula()); Crear_RetencionC.txtSec1Compra.setText(compra1.getSecuencia()); Crear_RetencionC.jdfechacaducidadFac.setDate(compra1.getFecha()); Crear_RetencionC.compra = compra1; Double base = Double.parseDouble(compra1.getSubtotaI_con_iva()) + Double.parseDouble(compra1.getSubtotal_sin_iva()); Crear_RetencionC.txtBaseFac.setText(String.valueOf(base)); Crear_RetencionC.txtIvaFac.setText(compra1.getIva_valor()); // buscaCompradesderegistrarRetencion = false; Crear_RetencionC.jButton1.setEnabled(false); // Crear_RetencionC.tsec1.setEnabled(false); // Crear_RetencionC.tsec2.setEnabled(false); // Crear_RetencionC.tsec3.setEnabled(false); Crear_RetencionC.jdfechacaducidadFac.setEnabled(false); Crear_RetencionC.txtSec1Compra.setEnabled(false); Crear_RetencionC.jcbtipoDocumento.setSelectedItem(compra1.getTipo_documento()); // buscaCompradesderegistrarRetencion = false; // dispose(); OperacionesForms.nuevaVentanaInternalForm(obj, obj.getTitle(), false); } else if (Principal.obligaoSINO.equalsIgnoreCase("si") && !valida) { mostrarError = false; } else if (Principal.obligaoSINO.equalsIgnoreCase("no")) { /*REGISTRO COMPRA EN EFECTIVO*/ ComitsAll c = new ComitsAll(); cod = c.compraEfectivo(u, cd, listadetallecompras, listakardesk, afectacaja, afectakardex, listaProductos); /** * **************************** */ } /*----------------------------------------------*/ if (cod > 0) { limpiarIntefazVentas(); } else { if (mostrarError) { ProgressBar.mostrarMensajeAzul("ERROR AL REGISTRA COMPRA EN EFECTIVO"); } } } break; case "CREDITO": if (codigoClienteCompra != null && !txt_cedula.getText().contains("9999999999")) { formaPagoSeelccionada = jcbFormasPago.getSelectedItem().toString(); u.setFormaPago(formaPagoSeelccionada); u.setCalveAcceso(claveAcceso); u.setEfectivo(0.00); u.setCambio(0.00); Frame frame = JOptionPane.getFrameForComponent(this); PagoCreditoCompras pcdialog = new PagoCreditoCompras(frame, true); pcdialog.txt_total.setText(txt_total_val.getText()); formaPagoSeelccionada = jcbFormasPago.getSelectedItem().toString(); pcdialog.txt_saldo.setText(txt_total_val.getText()); u.setFormaPago(formaPagoSeelccionada); u.setEfectivo(0.00); u.setCambio(0.00); cxp = pcdialog.cxpx; //pcdialog.comp = u; pcdialog.setVisible(true); if (RegistrodeCreditoExitoso) { for (int i = 0; i < row; i++) { DetalleCompra df = new DetalleCompra(); Kardex k = new Kardex(); KardexDao kDao = new KardexDao(); DetalleComprasDao dfDao = new DetalleComprasDao(); Double iva12 = 0.0; Double BaseImponible = 0.0; df.setCantidad(jTable1.getValueAt(i, 4).toString()); df.setDetalle(jTable1.getValueAt(i, 3).toString()); Ptotal = Double.valueOf(jTable1.getValueAt(i, 8).toString().replace(",", ".")); BaseImponible = Ptotal / ((this.iva / 100) + 1); iva12 = Ptotal - BaseImponible; df.setIva(String.valueOf(String.format("%.4f", iva12)).replace(",", ".")); Double ivaDecimal = ((this.iva / 100) + 1); Double valorUnitarioSinIVA = Double.valueOf(jTable1.getValueAt(i, 7).toString().replace(",", ".")); valorUnitarioSinIVA = (valorUnitarioSinIVA / ivaDecimal); Double valorTotalSinIVA = Double.valueOf(jTable1.getValueAt(i, 8).toString().replace(",", ".")); valorTotalSinIVA = valorTotalSinIVA / ivaDecimal; df.setDescuento(jTable1.getValueAt(i, 5).toString()); df.setValorUnitario(String.valueOf(String.format("%.4f", valorUnitarioSinIVA)).replace(",", ".")); df.setValorTotal(String.valueOf(String.format("%.4f", valorTotalSinIVA)).replace(",", ".")); df.setCompra_Codigo(codigoCompra); Productos pro = new Productos(); ProductosDao proDao = new ProductosDao(); pro = proDao.buscarPorCodigoAlterno(jTable1.getValueAt(i, 2).toString().trim()); Integer codigoProducto = pro.getCodigo(); df.setProductos_codigo(codigoProducto); k.setBodega(jTable1.getValueAt(i, 6).toString()); k.setFecha(jdfecha.getDate()); k.setDetalle("INGRESO -- " + tipoDocumento + " " + secuenciaFac); k.setOutcantidad("0"); k.setIncantidad(jTable1.getValueAt(i, 4).toString()); k.setIncosto(jTable1.getValueAt(i, 0).toString()); k.setInpvp(jTable1.getValueAt(i, 7).toString()); // k.setSaldocantidad(secuenciaFac); k.setProductos_Codigo(codigoProducto); listadetallecompras.add(df); listakardesk.add(k); listaProductos.add(pro); } // ///GUARDO LAS SERIES D ELA FACTURA // // objSF.setSec1(txt_sec1.getText()); // objSF.setSec2(txt_sec2.getText()); // objSF.setFac3(txt_secNUmFac.getText()); // objSF.setEquipos_Codigo(login.CodigoDelEquipo); // objDaoSF.guardar(objSF); //// //// ///IMPRESION DEL DOCUMENTO //// rutaInforme = "C:\\Users\\USUARIO\\OneDrive\\NetBeansProjects\\Sofi\\src\\Reportes\\FACTURA.jasper"; //// //// // 001-001-0000022 //// //parametros.put("numeroFactura", secuenciaFac); //// parametros.put("numeroFactura", secuenciaFac); // for (int i = 0; i < Integer.parseInt(Principal.numerovecseimpresionFactura); i++) { // // ImpresionDao imp = new ImpresionDao(); // imp.impresionDontShowReport(parametros, rutaInforme); // } // FacturasDao fad = new FacturasDao(); // fad.creaxmlFacturaElectronica(codigoFactura); afectacaja = false; afectakardex = true; ComitsAll c = new ComitsAll(); Integer cod = c.compraCreditoconcxp(u, cd, listadetallecompras, listakardesk, afectacaja, afectakardex, listaProductos, cxp); if (cod > 0) { limpiarIntefazVentas(); if (jchek_hacer_retencion.isSelected()) { Crear_RetencionC obj = new Crear_RetencionC(); Compras compra1 = new Compras(); ComprasDao facDao = new ComprasDao(); compra1 = facDao.buscarConID(cod); RetencionCDao r = new RetencionCDao(); Boolean existe = r.Buscar_siExisteRetenciondelDocumento(compra1.getSecuencia()); if (existe == false) { ClientesDao pbDao = new ClientesDao(); Clientes p = new Clientes(); Crear_RetencionC.proveerdor = p = pbDao.buscarConID(compra1.getProveedores_codigo(), 1); Crear_RetencionC.tProveedor.setText(p.getNombre()); Crear_RetencionC.tRUc.setText(p.getCedula()); Crear_RetencionC.txtSec1Compra.setText(compra1.getSecuencia()); Crear_RetencionC.jdfechacaducidadFac.setDate(compra1.getFecha()); Crear_RetencionC.compra = compra1; Double base = Double.parseDouble(compra1.getSubtotaI_con_iva()) + Double.parseDouble(compra1.getSubtotal_sin_iva()); Crear_RetencionC.txtBaseFac.setText(String.valueOf(base)); Crear_RetencionC.txtIvaFac.setText(compra1.getIva_valor()); // buscaCompradesderegistrarRetencion = false; Crear_RetencionC.jButton1.setEnabled(false); // Crear_RetencionC.tsec1.setEnabled(false); // Crear_RetencionC.tsec2.setEnabled(false); // Crear_RetencionC.tsec3.setEnabled(false); Crear_RetencionC.jdfechacaducidadFac.setEnabled(false); Crear_RetencionC.txtSec1Compra.setEnabled(false); Crear_RetencionC.jcbtipoDocumento.setSelectedItem(compra1.getTipo_documento()); // buscaCompradesderegistrarRetencion = false; dispose(); OperacionesForms.nuevaVentanaInternalForm(obj, obj.getTitle(), false); } else { if (existe) { JOptionPane.showMessageDialog(null, "ya existe una retencion registrada sobre esa factura!!", "Retenicion ya Existe", 3); } } } } else { ProgressBar.mostrarMensajeAzul("ERROR AL REGISTRA COMPRA CREDITO"); } } } else { JOptionPane.showMessageDialog(null, "Debe seleccionar un cliente para registrar el Credito", "Aviso Importante", 0, frameIcon); } break; case "CHEQUE": break; case "MIXTO": break; case "TRANSFERENCIA": break; } /////////FACTURA ELECTRONICA//////////// ////////FACTURA ELECTRONICA////////////// //////////////////// ///vavi tabla detalle } else { a.setProgressBar_mensajae("No existen Articulos a facturar"); } } else { a.setProgressBar_mensajae("Debes LLenar los campos Obligatorios"); } } else { // Crear_Proveedores p = new Crear_Proveedores(); Crear_Clientes obj = new Crear_Clientes(); obj.setTitle("Nuevo Proveedor"); ///false valor por defeccto, para cleintes obj.isllamadoDesdeNuevoProveedor = true; OperacionesForms.nuevaVentanaInternalForm(obj, obj.getTitle(), false); Crear_Clientes.txt_nombres.setText(txt_nombres.getText()); Crear_Clientes.txt_cedulax.setText(txt_cedula.getText()); Crear_Clientes.txt_dir.setText(txt_dir.getText()); } }//GEN-LAST:event_jButton1ActionPerformed private void jButton1PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jButton1PropertyChange // TODO add your handling code here: //if(evt.getPropertyName()) if (jButton1.getText().equals("Actualizar")) { //jcb_estado.setSelectedItem(""); } Deb.consola("Vista.Usuarios.Crear_Usuarios.jButton1Prop,,,,,,,,ertyChange()" + evt.getNewValue()); }//GEN-LAST:event_jButton1PropertyChange private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: this.dispose(); }//GEN-LAST:event_jButton2ActionPerformed private void txt_descuentoGenralFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txt_descuentoGenralFocusGained // TODO add your handling code here: txt_descuentoGenral.selectAll(); }//GEN-LAST:event_txt_descuentoGenralFocusGained private void txt_descuentoGenralKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_descuentoGenralKeyPressed // TODO add your handling code here: }//GEN-LAST:event_txt_descuentoGenralKeyPressed private void txt_descuentoGenralKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_descuentoGenralKeyReleased // TODO add your handling code here: if (!ValidaNUmeros.isOnlyDouble(txt_descuentoGenral.getText())) { txt_descuentoGenral.setText("0.00"); } else { operacionFacturauPDATEandAddRowrs(); } }//GEN-LAST:event_txt_descuentoGenralKeyReleased private void txt_descuentoGenralKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_descuentoGenralKeyTyped // TODO add your handling code here: }//GEN-LAST:event_txt_descuentoGenralKeyTyped private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed aumentarIvaSiNO = 1; operacionFacturauPDATEandAddRowrs(); aumentarIvaSiNO = -1; // TODO add your handling code here: }//GEN-LAST:event_jButton4ActionPerformed private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed // TODO add your handling code here: aumentarIvaSiNO = 0; operacionFacturauPDATEandAddRowrs(); aumentarIvaSiNO = -1; }//GEN-LAST:event_jButton5ActionPerformed public static void llenarCompraviaclaveAcceso() { if (txt_numAutorizacion.getText().length() == 49) { if (ValidaNUmeros.isOnlyNumbers(txt_numAutorizacion.getText()) && (txt_numAutorizacion.getText().length() == 49)) { limpiarIntefazVentas(); ComprasDao cDao = new ComprasDao(); if (cDao.buscarbyCLaveAcceso(txt_numAutorizacion.getText()) != null) { ProgressBar.mostrarMensajeAzul("Clave de Acceso ya esta registrada"); } else { OperacionesForms.solocrearFacturaNOgenerrarPDF = false; String rpta = Leertxt.descargarXMLformSRItoFileXMLandPFDenUnSoloPasoEMITIDOSlista(txt_numAutorizacion.getText()); if (!rpta.equalsIgnoreCase("error")) { Factura f = new Factura(); f = Leertxt.facturaElectronica; // Leertxt.registrarcompradesdesriconCLavedeAcceso(f); txt_cedula.setText(f.getRUC()); // pROVE txt_dir.setText(f.getDirMatriz()); txt_nombres.setText(f.getRazonSocial()); txt_sec1.setText(f.getEstab()); txt_sec2.setText(f.getPtoEmi()); txt_secNUmFac.setText(f.getSecuencia()); jdfecha.setDateFormatString(f.getFechaEmision()); ////codigo prveedro Clientes c = new Clientes(); ClientesDao cliDao = new ClientesDao(); c = cliDao.buscarConCedula(f.getRUC(), 1); ///compras ComprasDao facDao = new ComprasDao(); //FacturasDao facDao = new FacturasDao(); for (Detalle d : f.getDetalles()) { modelo.addRow(facDao.Buscar_registrosfacxml_prodInternos(d, Principal.bodegaPredeterminadaenCOmpra.substring(0, 1), codigoClienteCompra)); } jTable1.setModel(modelo); //// /// valida si exite registrador el proveedor txt_cedula.grabFocus(); // Clientes c = new Clientes(); // ClientesDao cliDao = new ClientesDao(); // if (!cliDao.buscarClienteRegistrado(txt_cedula.getText(), 1)) { //// ClientesDao cliDao2 = new ClientesDao(); //// c.setCedula(f.getRUC()); //// c.setNombre(f.getRazonSocial()); //// c.setObservaciones(f.getNombreComercial()); //// c.setDireccion(f.getDirEstablecimiento()); //// c.setProveedor(1); //// // c.setMail(f.getInfoAdicionalEmail()); //// //// codigoClienteCompra = cliDao2.guardar(c); //// //// if (codigoClienteCompra != 0) { //// txt_clienteCodigo.setText(codigoClienteCompra.toString()); //// } else { //// ProgressBar.mostrarMensajeAzul("Errror al crear Nuevo Proveedor, por favor crear manualmente y volver a cargar la compra"); //// } // txt_cedula.setBackground(Color.red); // txt_nombres.setText(f.getRUC()); // } // txtBuscar2.grabFocus(); //////////////// //// if (c.getImagen() != null) { //// ImageIcon icon = new ImageIcon(c.getImagen()); //// Icon icono = new ImageIcon(icon.getImage().getScaledInstance(251, 205, Image.SCALE_DEFAULT)); //// foto.setText(null); //// foto.setIcon(icono); //// } else { //// foto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Img/producto.jpg"))); //// } /// } else { ProgressBar.mostrarMensajeAzul("SRI NO DEVOLVIO NADA.."); txt_numAutorizacion.selectAll(); } } } else { ProgressBar.mostrarMensajeAzul("clave de acceso mal fomada"); txt_numAutorizacion.selectAll(); } } } public static void llenarCompraviaclaveAccesoVerificaExistenciadePRoveedor() { if (txt_numAutorizacion.getText().length() == 49) { if (ValidaNUmeros.isOnlyNumbers(txt_numAutorizacion.getText()) && (txt_numAutorizacion.getText().length() == 49)) { limpiarIntefazVentas(); ComprasDao cDao = new ComprasDao(); if (cDao.buscarbyCLaveAcceso(txt_numAutorizacion.getText()) == null) { // ProgressBar.mostrarMensajeAzul("Clave de Acceso ya esta registrada"); ///txt_numAutorizacion.setBackground(java.awt.Color.yellow); //jButton1.setEnabled(false); //} else { OperacionesForms.solocrearFacturaNOgenerrarPDF = false; String rpta = Leertxt.descargarXMLformSRItoFileXMLandPFDenUnSoloPasoEMITIDOSlista(txt_numAutorizacion.getText()); if (!rpta.equalsIgnoreCase("error")) { Factura f = new Factura(); f = Leertxt.facturaElectronica; ClientesDao cliDao = new ClientesDao(); Clientes c = new Clientes(); if (c.getCedula() != null) { // Leertxt.registrarcompradesdesriconCLavedeAcceso(f); c = cliDao.buscarConCedula(f.getRUC(), 1); txt_cedula.setText(c.getCedula()); codigoClienteCompra = c.getCodigo(); // pROVE txt_dir.setText(c.getDireccion()); txt_nombres.setText(c.getNombre()); txt_sec1.setText(f.getEstab()); txt_sec2.setText(f.getPtoEmi()); txt_secNUmFac.setText(f.getSecuencia()); jdfecha.setDateFormatString(f.getFechaEmision()); ///compras ComprasDao facDao = new ComprasDao(); //FacturasDao facDao = new FacturasDao(); for (Detalle d : f.getDetalles()) { modelo.addRow(facDao.Buscar_registrosfacxml_prodInternos(d, Principal.bodegaPredeterminadaenCOmpra.substring(0, 1), c.getCodigo())); } jTable1.setModel(modelo); //// /// valida si exite registrador el proveedor // txt_nombres.grabFocus(); } else { txt_nombres.setText(f.getRUC()); } txt_nombres.grabFocus(); } else { ProgressBar.mostrarMensajeAzul("SRI NO DEVOLVIO NADA.."); txt_numAutorizacion.selectAll(); } } else { ProgressBar.mostrarMensajeAzul("CLave registrada"); } } else { ProgressBar.mostrarMensajeAzul("clave de acceso mal fomada"); txt_numAutorizacion.selectAll(); } } } private void formInternalFrameClosed(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameClosed // TODO add your handling code here: }//GEN-LAST:event_formInternalFrameClosed private void txtBuscar2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtBuscar2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtBuscar2ActionPerformed private void txt_numAutorizacionKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_numAutorizacionKeyPressed // TODO add your handling code here: if (evt.getKeyChar() == KeyEvent.VK_ENTER) { } }//GEN-LAST:event_txt_numAutorizacionKeyPressed private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed // TODO add your handling code here: if (txt_numAutorizacion.getText().length() == 49) { OperacionesForms.solocrearFacturaNOgenerrarPDF = true; Leertxt.descargarXMLformSRItoFileXMLandPFDenUnSoloPasoclickjtable(txt_numAutorizacion.getText()); String file = OperacionesForms.rutadocPDFgeneradook;//Config.AUTORIZADOS_DIR +claveAcceso + ".pdf"; JOptionPane.showMessageDialog(null, file); //definiendo la ruta en la propiedad file try { Deb.consola("ruta file pdf: " + file); Runtime.getRuntime().exec("cmd /c start " + file); } catch (Exception e) { ProgressBar.mostrarMensajeRojo("Error al abrir el PDF :" + e.toString()); } } }//GEN-LAST:event_jButton6ActionPerformed private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed // TODO add your handling code here: Frame frame = JOptionPane.getFrameForComponent(this); JDclaveAccesoCOmprasSRI pcdialog = new JDclaveAccesoCOmprasSRI(frame, true); pcdialog.setLocationRelativeTo(frame); pcdialog.setVisible(true); }//GEN-LAST:event_jButton7ActionPerformed private void txt_descuentoGenralMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txt_descuentoGenralMouseClicked // TODO add your handling code here: txt_descuentoGenral.selectAll(); }//GEN-LAST:event_txt_descuentoGenralMouseClicked // Variables declaration - do not modify//GEN-BEGIN:variables public static javax.swing.JLabel foto; public static javax.swing.JButton jButton1; public static javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JButton jButton6; private javax.swing.JButton jButton7; private javax.swing.JComboBox<String> jComboBox1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel10; private static javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanel6; private javax.swing.JPanel jPanel7; private javax.swing.JPanel jPanel8; private javax.swing.JPanel jPanel9; private javax.swing.JScrollPane jScrollPane1; public static javax.swing.JTable jTable1; public static javax.swing.JComboBox<String> jcbFormasPago; private static javax.swing.JComboBox<String> jcb_sustentoComprobante; private static javax.swing.JComboBox<String> jcb_tipoComprobante; private javax.swing.JCheckBox jchek_hacer_retencion; private static com.toedter.calendar.JDateChooser jdfecha; private static javax.swing.JLabel lbl_Iva; private static javax.swing.JLabel lbl_subTotalIva; private static javax.swing.JLabel lbl_subTotalIva1; private static javax.swing.JLabel lbl_subTotalIva2; private javax.swing.JTextField txtBuscar2; public static javax.swing.JTextField txt_cedula; public static javax.swing.JTextField txt_celular; private static javax.swing.JLabel txt_clienteCodigo; private static javax.swing.JTextField txt_descuentoGenral; public static javax.swing.JTextField txt_dir; public static javax.swing.JLabel txt_hora; private static javax.swing.JLabel txt_iva_valor; public static javax.swing.JTextField txt_nombres; public static javax.swing.JTextField txt_numAutorizacion; public static javax.swing.JTextField txt_sec1; public static javax.swing.JTextField txt_sec2; public static javax.swing.JTextField txt_secNUmFac; private static javax.swing.JLabel txt_subtotal; private static javax.swing.JLabel txt_subtotalIvaValor; private static javax.swing.JLabel txt_subtotalIvaValorCero; private static javax.swing.JLabel txt_total_; private static javax.swing.JLabel txt_total_val; private static javax.swing.JLabel txt_usuarioCodigo; private static javax.swing.JLabel txt_utilidad; // End of variables declaration//GEN-END:variables }
[ "USUARIO@DESKTOP-T00QBA8" ]
USUARIO@DESKTOP-T00QBA8
a80846f1077733232e2bd278b52de13787164c3d
f0778057f103de9de6ab0c401e84477b427a0e9a
/src/monster/controller/MonsterRunner.java
802ae82c9983795ad3d14839eac8ad2a7c84baeb
[]
no_license
1upsoda/MonsterProject
ffea52dc5012082d36ea9d48cc8170916ab27d1a
1559e343654af5b1b83e2d4a8d9016b32b02fb15
refs/heads/master
2021-01-19T08:10:18.914909
2015-05-20T13:54:35
2015-05-20T13:54:35
23,966,716
0
0
null
null
null
null
UTF-8
Java
false
false
212
java
package monster.controller; public class MonsterRunner { public static void main(String[] args) { MonsterAppController monsterController = new MonsterAppController(); monsterController.start(); } }
8ca69035ca32d918411242272a11d6c1da21e799
77e99427a33f2af4d0da766146723c7749e59f40
/src/main/java/com/google/devtools/build/lib/remote/downloader/GrpcRemoteDownloader.java
d94efdc0c60899c87d0768925dc3aaa01e961ce9
[ "Apache-2.0" ]
permissive
benjaminp/bazel
885634a54dedcf346092831796ef90d7cd3b45a8
af83e773341cb5ad1fc093a8faa62acef2046f54
refs/heads/master
2023-09-04T14:35:52.079155
2022-10-19T14:42:21
2022-10-19T14:44:03
126,263,117
3
0
Apache-2.0
2018-03-22T01:40:01
2018-03-22T01:40:00
null
UTF-8
Java
false
false
10,263
java
// Copyright 2020 The Bazel Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.devtools.build.lib.remote.downloader; import build.bazel.remote.asset.v1.FetchBlobRequest; import build.bazel.remote.asset.v1.FetchBlobResponse; import build.bazel.remote.asset.v1.FetchGrpc; import build.bazel.remote.asset.v1.FetchGrpc.FetchBlockingStub; import build.bazel.remote.asset.v1.Qualifier; import build.bazel.remote.execution.v2.Digest; import build.bazel.remote.execution.v2.RequestMetadata; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Strings; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.devtools.build.lib.bazel.repository.downloader.Checksum; import com.google.devtools.build.lib.bazel.repository.downloader.Downloader; import com.google.devtools.build.lib.bazel.repository.downloader.HashOutputStream; import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.events.ExtendedEventHandler; import com.google.devtools.build.lib.remote.ReferenceCountedChannel; import com.google.devtools.build.lib.remote.RemoteRetrier; import com.google.devtools.build.lib.remote.common.RemoteActionExecutionContext; import com.google.devtools.build.lib.remote.common.RemoteCacheClient; import com.google.devtools.build.lib.remote.options.RemoteOptions; import com.google.devtools.build.lib.remote.util.TracingMetadataUtils; import com.google.devtools.build.lib.remote.util.Utils; import com.google.devtools.build.lib.vfs.Path; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import io.grpc.CallCredentials; import io.grpc.Channel; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.io.OutputStream; import java.net.URI; import java.net.URL; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.TreeMap; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import javax.annotation.Nullable; /** * A Downloader implementation that uses Bazel's Remote Execution APIs to delegate downloads of * external files to a remote service. * * <p>See https://github.com/bazelbuild/remote-apis for more details on the exact capabilities and * semantics of the Remote Execution API. */ public class GrpcRemoteDownloader implements AutoCloseable, Downloader { private final String buildRequestId; private final String commandId; private final ReferenceCountedChannel channel; private final Optional<CallCredentials> credentials; private final RemoteRetrier retrier; private final RemoteCacheClient cacheClient; private final RemoteOptions options; private final boolean verboseFailures; @Nullable private final Downloader fallbackDownloader; private final AtomicBoolean closed = new AtomicBoolean(); // The `Qualifier::name` field uses well-known string keys to attach arbitrary // key-value metadata to download requests. These are the qualifier names // supported by Bazel. private static final String QUALIFIER_CHECKSUM_SRI = "checksum.sri"; private static final String QUALIFIER_CANONICAL_ID = "bazel.canonical_id"; private static final String QUALIFIER_AUTH_HEADERS = "bazel.auth_headers"; public GrpcRemoteDownloader( String buildRequestId, String commandId, ReferenceCountedChannel channel, Optional<CallCredentials> credentials, RemoteRetrier retrier, RemoteCacheClient cacheClient, RemoteOptions options, boolean verboseFailures, @Nullable Downloader fallbackDownloader) { this.buildRequestId = buildRequestId; this.commandId = commandId; this.channel = channel; this.credentials = credentials; this.retrier = retrier; this.cacheClient = cacheClient; this.options = options; this.verboseFailures = verboseFailures; this.fallbackDownloader = fallbackDownloader; } @Override public void close() { if (closed.getAndSet(true)) { return; } cacheClient.close(); channel.release(); } @Override public void download( List<URL> urls, Map<URI, Map<String, List<String>>> authHeaders, com.google.common.base.Optional<Checksum> checksum, String canonicalId, Path destination, ExtendedEventHandler eventHandler, Map<String, String> clientEnv, com.google.common.base.Optional<String> type) throws IOException, InterruptedException { RequestMetadata metadata = TracingMetadataUtils.buildMetadata(buildRequestId, commandId, "remote_downloader", null); RemoteActionExecutionContext remoteActionExecutionContext = RemoteActionExecutionContext.create(metadata); final FetchBlobRequest request = newFetchBlobRequest( options.remoteInstanceName, urls, authHeaders, checksum, canonicalId, options.remoteDownloaderSendAllHeaders); try { FetchBlobResponse response = retrier.execute( () -> channel.withChannelBlocking( channel -> fetchBlockingStub(remoteActionExecutionContext, channel) .fetchBlob(request))); final Digest blobDigest = response.getBlobDigest(); retrier.execute( () -> { try (OutputStream out = newOutputStream(destination, checksum)) { Utils.getFromFuture( cacheClient.downloadBlob(remoteActionExecutionContext, blobDigest, out)); } return null; }); } catch (StatusRuntimeException | IOException e) { if (fallbackDownloader == null) { if (e instanceof StatusRuntimeException) { throw new IOException(e); } throw e; } eventHandler.handle( Event.warn("Remote Cache: " + Utils.grpcAwareErrorMessage(e, verboseFailures))); fallbackDownloader.download( urls, authHeaders, checksum, canonicalId, destination, eventHandler, clientEnv, type); } } @VisibleForTesting static FetchBlobRequest newFetchBlobRequest( String instanceName, List<URL> urls, Map<URI, Map<String, List<String>>> authHeaders, com.google.common.base.Optional<Checksum> checksum, String canonicalId, boolean includeAllHeaders) { FetchBlobRequest.Builder requestBuilder = FetchBlobRequest.newBuilder().setInstanceName(instanceName); for (URL url : urls) { requestBuilder.addUris(url.toString()); } if (checksum.isPresent()) { requestBuilder.addQualifiers( Qualifier.newBuilder() .setName(QUALIFIER_CHECKSUM_SRI) .setValue(checksum.get().toSubresourceIntegrity()) .build()); } if (!Strings.isNullOrEmpty(canonicalId)) { requestBuilder.addQualifiers( Qualifier.newBuilder().setName(QUALIFIER_CANONICAL_ID).setValue(canonicalId).build()); } if (!authHeaders.isEmpty()) { requestBuilder.addQualifiers( Qualifier.newBuilder() .setName(QUALIFIER_AUTH_HEADERS) .setValue(authHeadersJson(urls, authHeaders, includeAllHeaders)) .build()); } return requestBuilder.build(); } private FetchBlockingStub fetchBlockingStub( RemoteActionExecutionContext context, Channel channel) { return FetchGrpc.newBlockingStub(channel) .withInterceptors( TracingMetadataUtils.attachMetadataInterceptor(context.getRequestMetadata())) .withInterceptors(TracingMetadataUtils.newDownloaderHeadersInterceptor(options)) .withCallCredentials(credentials.orElse(null)) .withDeadlineAfter(options.remoteTimeout.getSeconds(), TimeUnit.SECONDS); } private OutputStream newOutputStream( Path destination, com.google.common.base.Optional<Checksum> checksum) throws IOException { OutputStream out = destination.getOutputStream(); if (checksum.isPresent()) { out = new HashOutputStream(out, checksum.get()); } return out; } private static String authHeadersJson( List<URL> urls, Map<URI, Map<String, List<String>>> authHeaders, boolean includeAllHeaders) { ImmutableSet<String> hostSet = urls.stream().map(URL::getHost).collect(ImmutableSet.toImmutableSet()); Map<String, JsonObject> subObjects = new TreeMap<>(); for (Map.Entry<URI, Map<String, List<String>>> entry : authHeaders.entrySet()) { URI uri = entry.getKey(); // Only add headers that are relevant to the hosts. if (!hostSet.contains(uri.getHost())) { continue; } JsonObject subObject = new JsonObject(); Map<String, List<String>> orderedHeaders = new TreeMap<>(entry.getValue()); for (Map.Entry<String, List<String>> subEntry : orderedHeaders.entrySet()) { if (includeAllHeaders) { JsonArray values = new JsonArray(subEntry.getValue().size()); for (String value : subEntry.getValue()) { values.add(value); } subObject.add(subEntry.getKey(), values); } else { String value = Iterables.getFirst(subEntry.getValue(), null); if (value != null) { subObject.addProperty(subEntry.getKey(), value); } } } subObjects.put(uri.toString(), subObject); } JsonObject authHeadersJson = new JsonObject(); for (Map.Entry<String, JsonObject> entry : subObjects.entrySet()) { authHeadersJson.add(entry.getKey(), entry.getValue()); } return new Gson().toJson(authHeadersJson); } }
7a8b2f1b51b07ef37fb5d637e0c7a94abbf45a73
4b29ea221ed81bd9d735fcddc9116de0198234ab
/itcast-haoke-manage-api-server/src/main/java/cn/itcast/haoke/dubbo/api/controller/SearchController.java
c1ef53ea1d54490c8f40d5036e802df74959f702
[]
no_license
wuwu955/house-manager
dfc8c3256c7d0d4a24d5213cb83c1e7482d36dcf
2b119e37fe64218b6d753ee41f806b6664cbbf80
refs/heads/master
2022-10-10T23:42:52.397708
2022-06-28T08:45:30
2022-06-28T08:45:30
207,118,963
0
0
null
2022-09-16T21:06:39
2019-09-08T13:45:24
Java
UTF-8
Java
false
false
1,610
java
package cn.itcast.haoke.dubbo.api.controller; import cn.itcast.haoke.dubbo.api.service.SearchService; import cn.itcast.haoke.dubbo.api.vo.SearchResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.*; import java.util.Set; @RequestMapping("search") @RestController @CrossOrigin public class SearchController { private static final Logger LOGGER = LoggerFactory.getLogger(SearchService.class); @Autowired private SearchService searchService; @Autowired private RedisTemplate redisTemplate; @GetMapping public SearchResult search(@RequestParam("keyWord") String keyWord, @RequestParam(value = "page", defaultValue = "1") Integer page) { if (page > 100) { //防止爬虫抓取过多的数据 page = 1; } String redisKey = "HAOKE_SERCH_HOT_WORD"; SearchResult search = this.searchService.search(keyWord, page); if(search.getTotalPage() <= 1){ Set set = this.redisTemplate.opsForZSet().reverseRange(redisKey, 0, 4); search.setHotWord(set); } int count = ((Math.max(search.getTotalPage(), 1) - 1) * SearchService.ROWS) + search.getList().size(); this.redisTemplate.opsForZSet().add(redisKey, keyWord, count); LOGGER.info("[Search]关键字为:" + keyWord + ",数量为:" + count); return search; } }
60b5d64e1b9c9f240ee53670a81e0406ab20235c
03ff067958d8cf38e9a218c021e510a1dd5efef1
/Vendas/src/test/java/PageObjects/OportunidadesElementMap.java
c3916992977af6f28de6b3765ba6f435dbcd1525
[]
no_license
JulianneSantos/Selenium
ad2c6f2aca8c6962320220ad5e7fa4c8709d24b7
16cf0370362ab0f2a40d64d9425774afd7b4b2de
refs/heads/master
2021-01-02T22:05:46.679189
2020-02-19T01:45:03
2020-02-19T01:45:03
239,820,533
0
0
null
2020-10-13T19:30:10
2020-02-11T17:18:11
Java
UTF-8
Java
false
false
965
java
package PageObjects; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.pagefactory.AjaxElementLocatorFactory; public class OportunidadesElementMap { WebDriver driver; public OportunidadesElementMap(WebDriver driver) { this.driver = driver; PageFactory.initElements(new AjaxElementLocatorFactory(driver, 50), this); } //Tela principal //@FindBy(xpath = "//a[contains(@title,'Oportunidades')") @FindBy(xpath = ".//one-app-nav-bar-item-root[@class='navItem slds-context-bar__item slds-shrink-none'][a[span[text()='Oportunidades']]]") protected WebElement aba_Oportunidades; public WebElement aba_Oportunidades() { return aba_Oportunidades; } @FindBy() protected WebElement nomeOportunidade; public WebElement nomeOportunidade() { return nomeOportunidade; } }
adb77b118d980a87345d869fec807e8cc8ba7bd2
75191657d2226dab4dbaa4baf0dda64f9cc67691
/java_project/FirstJava/src/first/StringIndexTest.java
3df3f2dfbef78bd7a5f1fbb331aedea77693b74f
[]
no_license
dkaylee/ClassProject
d1c02b65b9a4f45b51a43af2a139f5f19b10214a
0e6488fb598899621642b9a809796299632c74f8
refs/heads/master
2023-03-15T17:09:42.482162
2021-03-16T12:11:02
2021-03-16T12:11:02
299,173,494
1
0
null
null
null
null
UTF-8
Java
false
false
331
java
package first; public class StringIndexTest { public static void main(String[] args) { ///String index 사용 String str = "ABCDE"; String result = ""; for(int i=str.length()-1; i>=0; i--) { result += str.charAt(i); // ""+'A' -> "A" + 'B' -> "AB"+'C' -> "ABC" } System.out.println("result = "+result); } }
170bfe9c111219ead93c28ad61c4eb8487c98d30
6a7a66132a9b8cb931ceb1304e2ed4aa613c1fba
/app/src/main/java/com/novp/sprytar/fitness/FitnessClassesNotifyPresenter.java
9e3338c43e340b8812bc7036a82b24911ec521f1
[]
no_license
imobdevdevice/Sprytar
e6961a11e408e8e586f60e2f5257dd7c749a85ea
9d1820bb94084bdfe3a07a1a46192fb0fac82bfd
refs/heads/master
2021-07-17T01:57:21.491625
2017-10-17T12:43:00
2017-10-17T12:43:00
106,373,802
0
0
null
null
null
null
UTF-8
Java
false
false
1,094
java
package com.novp.sprytar.fitness; import android.content.Context; import com.novp.sprytar.events.SendNotificationEvent; import com.novp.sprytar.presentation.BasePresenter; import org.greenrobot.eventbus.EventBus; import javax.inject.Inject; public class FitnessClassesNotifyPresenter extends BasePresenter<FitnessClassesNotifyView> { private final Context context; private final EventBus bus; @Inject public FitnessClassesNotifyPresenter(Context context, EventBus eventBus) { this.context = context; this.bus = eventBus; } @Override public void attachView(FitnessClassesNotifyView mvpView) { super.attachView(mvpView); } @Override public void detachView() { super.detachView(); } @Override public void onDestroyed() { } public void onSendClick(String subject, String message) { bus.post(new SendNotificationEvent.Builder() .setSubject(subject) .setMessage(message) .build()); getMvpView().closeDialog(); } }
3055b6f723587f57ef4acc297621642ab1988a38
ada747a534de2979e717faf37baf4805c703fad2
/awaitility/src/main/java/org/awaitility/core/PredicateExceptionIgnorer.java
cac4e4c8651ae3e6747e3ab53e82500266196a3c
[ "Apache-2.0" ]
permissive
ponziani/awaitility
2c5cc60f32b051a87756c011267f75d5fe6f67ff
74022a246661362e0228247591a728d4ef99e506
refs/heads/master
2020-03-27T06:07:44.581297
2018-08-25T09:03:12
2018-08-25T09:03:12
146,080,935
0
0
Apache-2.0
2018-08-25T08:58:51
2018-08-25T08:58:50
null
UTF-8
Java
false
false
1,134
java
/* * Copyright 2015 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.awaitility.core; public class PredicateExceptionIgnorer implements ExceptionIgnorer { private final Predicate<? super Throwable> predicate; public PredicateExceptionIgnorer(Predicate<? super Throwable> predicate) { if (predicate == null) { throw new IllegalArgumentException("predicate cannot be null"); } this.predicate = predicate; } public boolean shouldIgnoreException(Throwable exception) { return predicate.matches(exception); } }
ecd5e47413d98784f5774743abd91347d7ea32df
afbb1cf6db015282053f9efe70e4416810792e42
/src/day8/Day8Main.java
05d987f835084485d6ecbe1bd838d2b5caa1ed11
[]
no_license
griffintench/Advent-of-Code-2020
45459e1a7bbe760df9118dc99ea6baba24e8b108
c6f1bfa25821e1067bf0d42b4399bc24baffae9e
refs/heads/master
2023-02-04T11:34:37.622110
2020-12-25T08:07:27
2020-12-25T08:07:27
321,576,122
0
0
null
null
null
null
UTF-8
Java
false
false
4,691
java
package day8; import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; public class Day8Main { private static enum InstructionType { acc, jmp, nop; } private static class Instruction { public InstructionType op; public final int arg; public Instruction(final String line) { final String[] splitLine = line.split(" "); if (splitLine[0].equals("acc")) { op = InstructionType.acc; } else if (splitLine[0].equals("jmp")) { op = InstructionType.jmp; } else { op = InstructionType.nop; } arg = Integer.parseInt(splitLine[1]); } public Instruction(final Instruction inst) { op = inst.op; arg = inst.arg; } } public static void run() throws FileNotFoundException { final File inputFile = new File("src/day8/input.txt"); final Scanner scan = new Scanner(inputFile); final List<Instruction> instructions = new ArrayList<>(); while(scan.hasNextLine()) { final String line = scan.nextLine(); Instruction instruction = new Instruction(line); instructions.add(instruction); } scan.close(); System.out.println(part2(instructions)); } private static int part1(final List<Instruction> instructions) { int accumulator = 0; int nextInstructionIndex = 0; final boolean[] usedInstructions = new boolean[instructions.size()]; while (!usedInstructions[nextInstructionIndex]) { usedInstructions[nextInstructionIndex] = true; final Instruction nextInstruction = instructions.get(nextInstructionIndex); final InstructionType nextInstructionType = nextInstruction.op; if (nextInstructionType == InstructionType.acc) { accumulator += nextInstruction.arg; ++nextInstructionIndex; } else if (nextInstructionType == InstructionType.jmp) { nextInstructionIndex += nextInstruction.arg; } else if (nextInstructionType == InstructionType.nop) { ++nextInstructionIndex; } } return accumulator; } private static int part2(final List<Instruction> instructions) { for (int i = 0; i < instructions.size(); ++i) { final Instruction instruction = instructions.get(i); if (instruction.op == InstructionType.jmp) { final List<Instruction> instructionCopies = new ArrayList<>(); for (int j = 0; j < instructions.size(); ++j) { final Instruction newInstruction = new Instruction(instructions.get(j)); if (i == j) { newInstruction.op = InstructionType.nop; } instructionCopies.add(newInstruction); } final int result = runInstructions(instructionCopies); if (result != Integer.MAX_VALUE) { return result; } } } System.out.println("Nothing works!"); return -1; } private static int runInstructions(final List<Instruction> instructions) { int accumulator = 0; int nextInstructionIndex = 0; final boolean[] usedInstructions = new boolean[instructions.size()]; while (nextInstructionIndex >= 0 && nextInstructionIndex < usedInstructions.length && !usedInstructions[nextInstructionIndex]) { usedInstructions[nextInstructionIndex] = true; final Instruction nextInstruction = instructions.get(nextInstructionIndex); final InstructionType nextInstructionType = nextInstruction.op; if (nextInstructionType == InstructionType.acc) { accumulator += nextInstruction.arg; ++nextInstructionIndex; } else if (nextInstructionType == InstructionType.jmp) { nextInstructionIndex += nextInstruction.arg; } else if (nextInstructionType == InstructionType.nop) { ++nextInstructionIndex; } } if (nextInstructionIndex >= 0 && nextInstructionIndex < usedInstructions.length) { // infinite loop return Integer.MAX_VALUE; } return accumulator; } }
c0497a25854383d903ecf17e6ce08511de5458e3
1e3a260329a23a087faffc3a5d750f31568d811a
/src/factory_method/MainClass.java
31c3caa8b5ab0eed30d6830e3fbde91ef80f2ad8
[]
no_license
MRohit/Design-Patterns
91f30390a1549d73d530ba4aaae39f3dcb33cd39
fdfd5bd2691af30763324543c16f263b3c22300b
refs/heads/master
2021-05-16T01:02:57.351998
2017-11-02T17:40:05
2017-11-02T17:40:05
107,033,175
1
0
null
null
null
null
UTF-8
Java
false
false
210
java
package factory_method; public class MainClass { public static void main (String args[]) { MazeGame ordinaryGame = new OrdinaryMazeGame(); MazeGame magicGame = new MagicMazeGame(); } }
e16804d28bb368f115bd25da4338030ace8f199f
6fa701cdaa0d83caa0d3cbffe39b40e54bf3d386
/google/cloud/pubsublite/v1/google-cloud-pubsublite-v1-java/proto-google-cloud-pubsublite-v1-java/src/main/java/com/google/cloud/pubsublite/proto/SubscribeRequestOrBuilder.java
381f15abdb8de00b1a622354e50bafba9107d74c
[ "Apache-2.0" ]
permissive
oltoco/googleapis-gen
bf40cfad61b4217aca07068bd4922a86e3bbd2d5
00ca50bdde80906d6f62314ef4f7630b8cdb6e15
refs/heads/master
2023-07-17T22:11:47.848185
2021-08-29T20:39:47
2021-08-29T20:39:47
null
0
0
null
null
null
null
UTF-8
Java
false
true
2,666
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/cloud/pubsublite/v1/subscriber.proto package com.google.cloud.pubsublite.proto; public interface SubscribeRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.cloud.pubsublite.v1.SubscribeRequest) com.google.protobuf.MessageOrBuilder { /** * <pre> * Initial request on the stream. * </pre> * * <code>.google.cloud.pubsublite.v1.InitialSubscribeRequest initial = 1;</code> * @return Whether the initial field is set. */ boolean hasInitial(); /** * <pre> * Initial request on the stream. * </pre> * * <code>.google.cloud.pubsublite.v1.InitialSubscribeRequest initial = 1;</code> * @return The initial. */ com.google.cloud.pubsublite.proto.InitialSubscribeRequest getInitial(); /** * <pre> * Initial request on the stream. * </pre> * * <code>.google.cloud.pubsublite.v1.InitialSubscribeRequest initial = 1;</code> */ com.google.cloud.pubsublite.proto.InitialSubscribeRequestOrBuilder getInitialOrBuilder(); /** * <pre> * Request to update the stream's delivery cursor. * </pre> * * <code>.google.cloud.pubsublite.v1.SeekRequest seek = 2;</code> * @return Whether the seek field is set. */ boolean hasSeek(); /** * <pre> * Request to update the stream's delivery cursor. * </pre> * * <code>.google.cloud.pubsublite.v1.SeekRequest seek = 2;</code> * @return The seek. */ com.google.cloud.pubsublite.proto.SeekRequest getSeek(); /** * <pre> * Request to update the stream's delivery cursor. * </pre> * * <code>.google.cloud.pubsublite.v1.SeekRequest seek = 2;</code> */ com.google.cloud.pubsublite.proto.SeekRequestOrBuilder getSeekOrBuilder(); /** * <pre> * Request to grant tokens to the server, * </pre> * * <code>.google.cloud.pubsublite.v1.FlowControlRequest flow_control = 3;</code> * @return Whether the flowControl field is set. */ boolean hasFlowControl(); /** * <pre> * Request to grant tokens to the server, * </pre> * * <code>.google.cloud.pubsublite.v1.FlowControlRequest flow_control = 3;</code> * @return The flowControl. */ com.google.cloud.pubsublite.proto.FlowControlRequest getFlowControl(); /** * <pre> * Request to grant tokens to the server, * </pre> * * <code>.google.cloud.pubsublite.v1.FlowControlRequest flow_control = 3;</code> */ com.google.cloud.pubsublite.proto.FlowControlRequestOrBuilder getFlowControlOrBuilder(); public com.google.cloud.pubsublite.proto.SubscribeRequest.RequestCase getRequestCase(); }
[ "bazel-bot-development[bot]@users.noreply.github.com" ]
bazel-bot-development[bot]@users.noreply.github.com
e89f834ceda3b8aef6f0060a4af31dd7cfc1eb0f
7c9e9989e08f6b29fb86ba9d948d3fdaaf2df5b0
/src/main/java/com/smart/room/RoomUsageMaxCalculator.java
ca1b320280a79d0d0a381e76ff89c16ce6a7227a
[]
no_license
pchlebda/room-occupancy-manager
ccb2e780bd9af9523f6996561d8f6ea34f2b64cb
b862e5a59be65eb556d06fc18997ebc3c8653b73
refs/heads/master
2023-06-03T07:00:16.650214
2021-06-25T10:40:32
2021-06-25T10:40:32
368,982,578
0
0
null
null
null
null
UTF-8
Java
false
false
3,935
java
package com.smart.room; import org.springframework.stereotype.Component; import java.math.BigDecimal; import java.util.Comparator; import java.util.List; import java.util.function.Predicate; @Component class RoomUsageMaxCalculator implements RoomUsageCalculable { private static final BigDecimal PREMIUM_LVL = new BigDecimal(100); @Override public RoomsResponse calculate(RoomsRequest roomsRequest, List<Guest> guests) { int availableEconomyRooms = roomsRequest.getFreeEconomyRooms(); int availablePremiumRooms = roomsRequest.getFreePremiumRooms(); int willingToPayForPremium = calculateWillingToPayForPremium(guests); int willingToPayForEconomy = calculateWillingToPayForEconomy(guests); int economyUsage = calculateEconomyUsage(availableEconomyRooms, willingToPayForEconomy); int numberOfEconomyToUpgrade = calculateNumberOfEconomyToUpgrade(availableEconomyRooms, availablePremiumRooms, willingToPayForEconomy, willingToPayForPremium); int premiumUsage = calculatePremiumUsage(availablePremiumRooms, willingToPayForPremium, numberOfEconomyToUpgrade); BigDecimal economyTotalValue = calculateEconomyTotalValue(economyUsage, guests, numberOfEconomyToUpgrade); BigDecimal premiumTotalValue = calculatePremiumTotalValue(premiumUsage, guests); return RoomsResponse.builder() .economyRoomUsage(economyUsage) .premiumRoomUsage(premiumUsage) .economyRoomTotalValue(economyTotalValue) .premiumRoomTotalValue(premiumTotalValue) .build(); } private int calculateNumberOfEconomyToUpgrade(int availableEconomyRooms, int availablePremiumRooms, int willingToPayForEconomy, int willingToPayForPremium) { if (availableEconomyRooms < willingToPayForEconomy && availablePremiumRooms > willingToPayForPremium) { return Math.min(willingToPayForEconomy - availableEconomyRooms, availablePremiumRooms - willingToPayForPremium); } return 0; } private int calculatePremiumUsage(int availablePremiumRooms, int willingToPayForPremium, int numberOfEconomyToUpgrade) { return Math.min(willingToPayForPremium + numberOfEconomyToUpgrade, availablePremiumRooms); } private int calculateEconomyUsage(int availableEconomyRooms, int willingToPayForEconomy) { return Math.min(willingToPayForEconomy, availableEconomyRooms); } private BigDecimal calculateEconomyTotalValue(int roomUsage, List<Guest> willingToPayPrices, int numberOfEconomyToUpgrade) { return willingToPayPrices.stream() .map(Guest::getOfferPrice) .filter(price -> price.compareTo(PREMIUM_LVL) < 0) .sorted(Comparator.reverseOrder()) .skip(numberOfEconomyToUpgrade) .limit(roomUsage) .reduce(BigDecimal.ZERO, BigDecimal::add); } private BigDecimal calculatePremiumTotalValue(int roomUsage, List<Guest> willingToPayPrices) { return willingToPayPrices.stream() .map(Guest::getOfferPrice) .sorted(Comparator.reverseOrder()) .limit(roomUsage) .reduce(BigDecimal.ZERO, BigDecimal::add); } private int calculateWillingToPayForPremium(final List<Guest> willingToPayPrices) { return calculateWillingToPay(willingToPayPrices, price -> price.compareTo(PREMIUM_LVL) >= 0); } private int calculateWillingToPayForEconomy(final List<Guest> willingToPayPrices) { return calculateWillingToPay(willingToPayPrices, price -> price.compareTo(PREMIUM_LVL) < 0); } private int calculateWillingToPay(final List<Guest> willingToPayGuest, Predicate<BigDecimal> predicate) { return (int) willingToPayGuest.stream() .map(Guest::getOfferPrice) .filter(predicate) .count(); } }