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
30ce624886a726177546b942ac235300a73120bf
43b7d79aec0c020365da7f94bfa001072f134c98
/api-service/src/main/java/io/revx/api/mysql/repo/pixel/PixelRepository.java
ce43986bea9d820a440ed23e897fba8192a46bc7
[]
no_license
anony-mous131415/api
2706d4e617fd181462545d8c349a975653924755
4c9309bcbe7810f94a2a8c23276414ffc8f56049
refs/heads/master
2023-04-10T11:46:24.498611
2021-04-21T13:26:27
2021-04-21T13:26:27
360,180,066
0
1
null
null
null
null
UTF-8
Java
false
false
1,247
java
package io.revx.api.mysql.repo.pixel; import java.util.List; import java.util.Set; import javax.transaction.Transactional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import io.revx.api.mysql.entity.pixel.ConversionPixelEntity; @Repository public interface PixelRepository extends JpaRepository<ConversionPixelEntity, Long> { List<ConversionPixelEntity> findByIdIn(Set<Long> ids); @Modifying @Transactional @Query("update ConversionPixelEntity p set p.active = true where p.id = ?1") int activate(Long id); @Modifying @Transactional @Query("update ConversionPixelEntity p set p.active = false where p.id = ?1") int deActivate(Long id); List<ConversionPixelEntity> findAllByIdIn(List<Long> pixelId); List<ConversionPixelEntity> findAllByAdvertiserId(Long advertiserId); List<Long> findAllIdByAdvertiserId(Long AdvertiserId); ConversionPixelEntity findByIdAndLicenseeId(Long id, Long licenseeId); ConversionPixelEntity findByIdAndLicenseeIdAndAdvertiserIdIn(Long id, Long licenseeId, List<Long> advertiserId); }
b6d38300dd50a6d3a74c964303420d1fa7582eb0
6d8119144403e7a7eee1700c0af28fc5131ca7c4
/src/Scripts/ScrollPage.java
ddd4cd50586ab74219b844d99f726d8414b8a2b5
[]
no_license
Swathishetty1987/NewAutomation
fb0ca572f5f25304b59136b944a0b61fa790d877
f41766ae2db3441474ec0b58ffa5c46b03e23cf1
refs/heads/master
2021-01-24T04:01:37.234511
2018-02-26T05:39:59
2018-02-26T05:39:59
122,916,653
0
0
null
null
null
null
UTF-8
Java
false
false
869
java
package Scripts; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebElement; import org.testng.annotations.Test; import Generic.BaseTest; import Page.HomePage; public class ScrollPage extends BaseTest { @Test public void testScroll() throws Exception { HomePage h=new HomePage(driver); h.ClickLoginin(); h.setemailid("[email protected]"); h.setpassword("hellosishellosis"); h.ClickLoginhere(); Thread.sleep(2000); h.clicksolitaire(); Thread.sleep(2000); JavascriptExecutor e= (JavascriptExecutor) driver; WebElement policies = driver.findElement(By.xpath("//span[.='POLICIES']")); for(int i=0;i<=5;i++) { e.executeScript("window.scrollBy(0,500)"); Thread.sleep(2000); // e.executeScript("window.scrollBy(0,document.body.scrollHeight)"); Thread.sleep(2000); } } }
cf6b742f036c697940bf1645f7f51a994006faa6
4679024fe07717f224a4aa95d378d8cb9bac2d8d
/cms/src/main/java/de/innovationgate/wgpublisher/auth/DelegatingAuthModule.java
b817d779b0c57f9b1dcfd27abe0e7f72ef0898c4
[]
no_license
oweise/WestGate
cb2d42495c60c4fd971578f935f179ed1b435cfd
f665b226fed2259e7aaa418a8874b732ba6552b4
refs/heads/master
2020-03-21T10:48:51.255135
2018-07-13T16:08:47
2018-07-13T16:08:47
138,472,376
0
0
null
null
null
null
UTF-8
Java
false
false
7,916
java
/******************************************************************************* * Copyright 2009, 2010 Innovation Gate GmbH. All Rights Reserved. * * This file is part of the OpenWGA databaseServer platform. * * OpenWGA 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. * * In addition, a special exception is granted by the copyright holders * of OpenWGA called "OpenWGA plugin exception". You should have received * a copy of this exception along with OpenWGA in file COPYING. * If not, see <http://www.openwga.com/gpl-plugin-exception>. * * OpenWGA 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 OpenWGA in file COPYING. * If not, see <http://www.gnu.org/licenses/>. ******************************************************************************/ package de.innovationgate.wgpublisher.auth; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import org.hibernate.QueryException; import de.innovationgate.webgate.api.WGDatabase; import de.innovationgate.webgate.api.WGQueryException; import de.innovationgate.webgate.api.auth.AnonymousAuthSession; import de.innovationgate.webgate.api.auth.AuthenticationException; import de.innovationgate.webgate.api.auth.AuthenticationModule; import de.innovationgate.webgate.api.auth.AuthenticationSession; import de.innovationgate.webgate.api.auth.AuthenticationSourceListener; import de.innovationgate.webgate.api.auth.ConfigurationException; import de.innovationgate.wgpublisher.WGADomain; import de.innovationgate.wgpublisher.WGACore; import de.innovationgate.wgpublisher.WGACoreEvent; import de.innovationgate.wgpublisher.WGACoreEventListener; /** * An authentication module that delegates everything to the auth module of a given domain * * Unlike {@link DomainRedirectionAuthModule} this module is capable of being created even before the domain is completely setup * and therefor can be used for OpenWGA plugins that want to authenticate against a domain. If the auth module is created before * the auth domain is ready (on OpenWGA startup) then this module caches all auth listeners that register. Once startup has finished * it will delegate all those listeners to the backend module. */ public class DelegatingAuthModule implements CoreAwareAuthModule, WGACoreEventListener { public static final String COPTION_DOMAIN = "delegate.domain"; private String _domainName; public String getDomainName() { return _domainName; } private WGACore _core; private List _cachedListeners = new ArrayList(); private boolean _ready = false; public DelegatingAuthModule() { } public void setCore(WGACore core) { _core = core; } private AuthenticationModule getAuthModule() { if (!_ready) { return null; } WGADomain conf = _core.getDomains(_domainName); if (conf != null) { return conf.getAuthModule(); } else { return null; } } public synchronized void addAuthenticationSourceListener(AuthenticationSourceListener listener) { if (!_ready) { _cachedListeners.add(listener); return; } AuthenticationModule mod = getAuthModule(); if (mod == null) { return; } mod.addAuthenticationSourceListener(listener); } public void clearCache() { AuthenticationModule mod = getAuthModule(); if (mod == null) { return; } mod.clearCache(); } public void destroy() { if (!_ready) { return; } _core.removeEventListener(this); // No, we won't pass this on. Target module should destroy itself } public Class[] getAllowedCredentialClasses() { AuthenticationModule mod = getAuthModule(); if (mod == null) { return new Class[] {}; } return mod.getAllowedCredentialClasses(); } public String getAuthenticationSource() { if (!_ready) { return "Delegate Auth Module, not yet ready"; } AuthenticationModule mod = getAuthModule(); if (mod == null) { return "No authentication"; } return mod.getAuthenticationSource() + " (delegated)"; } public String getEMailAddress(String user) { AuthenticationModule mod = getAuthModule(); if (mod == null) { return null; } return mod.getEMailAddress(user); } public synchronized void init(Map params, WGDatabase db) throws ConfigurationException { _domainName = (String) params.get(COPTION_DOMAIN); if (_core.getStatus() < WGACoreEvent.TYPE_STARTUP_POST_CONNECT) { _ready = false; _core.addEventListener(this); } else { enable(); } } private void enable() { AuthenticationModule mod = getAuthModule(); if (mod != null) { Iterator listeners = _cachedListeners.iterator(); while (listeners.hasNext()) { AuthenticationSourceListener listener = (AuthenticationSourceListener) listeners.next(); mod.addAuthenticationSourceListener(listener); } } _cachedListeners.clear(); _ready = true; } public boolean isGeneratesSessionToken() { AuthenticationModule mod = getAuthModule(); if (mod == null) { return false; } return mod.isGeneratesSessionToken(); } public boolean isPoolable() { return true; } public boolean isQueryable(String queryType) { AuthenticationModule mod = getAuthModule(); if (mod == null) { return false; } return mod.isQueryable(queryType); } public AuthenticationSession login(String user, Object credentials) throws AuthenticationException { AuthenticationModule mod = getAuthModule(); if (mod == null) { return AnonymousAuthSession.getInstance(); } return mod.login(user, credentials); } public Object query(Object query, String queryType) throws WGQueryException { AuthenticationModule mod = getAuthModule(); if (mod == null) { return null; } return mod.query(query, queryType); } public void removeAuthenticationSourceListener(AuthenticationSourceListener listener) { if (!_ready) { _cachedListeners.remove(listener); } AuthenticationModule mod = getAuthModule(); if (mod == null) { return; } mod.removeAuthenticationSourceListener(listener); } public void contentStoreConnected(WGACoreEvent event) { } public void contentStoreDisconnected(WGACoreEvent event) { } public void shutdownPostDisconnect(WGACoreEvent event) { } public void shutdownPreDisconnect(WGACoreEvent event) { } public void startupPostConnect(WGACoreEvent event) { if (!_ready) { enable(); } } public void startupPreConnect(WGACoreEvent event) { } }
170545072c8c92b2fca3547522db0140831eea57
903c9afd7144432dbfac85a9786fe1c5ec06ed8c
/src/main/java/com/thonecardoso/bookstoremanager/config/JwtAuthenticationEntryPoint.java
160ff57dc412016e6e1f3d8a746dac201cfbbe5d
[ "MIT" ]
permissive
thonecardoso/bookstoremanager-api
96636f8cb0675bd61b0de5a4310c556a9b346254
dc0994a27c779793ff55784340041a239ba72c0a
refs/heads/main
2023-04-14T23:08:51.848601
2021-04-27T00:38:42
2021-04-27T00:38:42
357,194,343
0
0
MIT
2021-04-23T21:12:16
2021-04-12T12:58:49
Java
UTF-8
Java
false
false
744
java
package com.thonecardoso.bookstoremanager.config; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.stereotype.Component; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @Component public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint { @Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized"); } }
4a8fa4cc583015f0976fce6d9b3a8703f2bfcfab
0fc7b644c1c15c1700699fd4dcad75d72afebc95
/src/main/java/com/lakeacr/asoms/service/SubjectsService.java
a6b28633cbb5cddcff1180bbe2549103f3768757
[]
no_license
surajschandel/asoms
96a02996b695cc61482a907a8ac7a290c6e38815
4d4fcb36a353a5d29ac8db923b77f23dd0aae28a
refs/heads/master
2022-12-04T11:09:38.162651
2020-08-23T10:28:09
2020-08-23T10:28:09
287,443,404
0
0
null
null
null
null
UTF-8
Java
false
false
895
java
package com.lakeacr.asoms.service; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.multipart.MultipartFile; import com.lakeacr.asoms.domain.Subjects; import com.lakeacr.asoms.domain.User; /** * * @author SURAJ CHANDEL * */ public interface SubjectsService { /** * * @return */ Subjects getSubject(Long id); /** * * @param subject * @return */ String saveOrUpdateSubject(Subjects subject, User user); /** * * @return */ void deleteSubject(Long id, User user); /** * * @return */ List<Subjects> getSubjects(); /** * * @param file * @return */ String uploadCsvFileData(MultipartFile file, Long userId) ; /** * * @param request * @param response */ void export(HttpServletRequest request, HttpServletResponse response); }
eb5993d1b8ddf9c1f28a275455c0eeb0b7ff7f9f
5923ddc22a19e8319566fae6a241d3038e882dd1
/src/main/java/org/basma/store/shared/dto/CartDto.java
4ea43ebde9a403edf48ae302d14c621543a32944
[]
no_license
7askhatir/Bassma-V3
6f61fd185649b589d8de1659a9abff98420754d4
e9caaf21dd0e44345f8bf54d4f2c07fd98f0d4bc
refs/heads/main
2023-09-02T05:44:52.229715
2021-11-16T15:12:27
2021-11-16T15:12:27
428,704,510
0
0
null
null
null
null
UTF-8
Java
false
false
1,448
java
package org.basma.store.shared.dto; import org.basma.store.entities.Cart; import org.basma.store.entities.ProductEntity; import org.basma.store.entities.UserEntity; import com.sun.istack.NotNull; public class CartDto { private long id; private @NotNull UserEntity userId; private @NotNull int quantity; private @NotNull ProductEntity product; public CartDto() { } public CartDto(Cart cart) { this.setId(cart.getId()); this.setUserId(cart.getUserId()); this.setQuantity(cart.getQuantity()); this.setProduct(cart.getProduct()); } @Override public String toString() { return "CartDto{" + "id=" + id + ", userId=" + userId + ", quantity=" + quantity + ", productName=" + product.getTitleProduct() + '}'; } public long getId() { return id; } public void setId(long id) { this.id = id; } public UserEntity getUserId() { return userId; } public void setUserId(UserEntity userId) { this.userId = userId; } public int getQuantity() { return quantity; } public void setQuantity(int quantity) { this.quantity = quantity; } public ProductEntity getProduct() { return product; } public void setProduct(ProductEntity product) { this.product = product; } }
fda9ea5b10fd9340dff4c9ffc4187978e6fbbb43
406209cf359d32d8bbd012f3e835586515991a52
/transit-monitor/src/main/java/com/paradise/project/domain/CheckRecord.java
deef9d30c1b37e5886e0ac01fd57a96b0cd281cc
[]
no_license
xiumu2017/ProjectMonitor
0e7b66e989127121154cd61ee3118a18c9f44cbd
368dc9a2b36aaf21239a258e4cbd3e08cc23dfa6
refs/heads/master
2022-07-03T14:26:17.021390
2020-12-20T13:09:57
2020-12-20T13:09:57
189,160,621
1
0
null
2021-06-04T02:00:19
2019-05-29T06:05:34
Java
UTF-8
Java
false
false
1,849
java
package com.paradise.project.domain; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import lombok.EqualsAndHashCode; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; /** * 巡检记录 * * @author Paradise */ @EqualsAndHashCode(callSuper = true) @Data public class CheckRecord extends BaseDomain { private String projectId; private String result; private String type; private String checkCode; private String projectName; private Date createTime; public CheckRecord() { } private CheckRecord(Builder builder) { this.projectId = builder.projectId; this.result = builder.result; this.type = builder.type; this.checkCode = builder.checkCode; } public enum Type { /** * 服务器问题 */ SERVER("1"), WEB("2"), MAS("3"); Type(String code) { this.code = code; } private String code; public String getCode() { return code; } public void setCode(String code) { this.code = code; } } public static class Builder { private String projectId; private String result; private String type; private String checkCode; private Date createTime; public Builder(String projectId, String result) { this.projectId = projectId; this.result = result; } public Builder type(String type) { this.type = type; return this; } public Builder checkCode(String checkCode) { this.checkCode = checkCode; return this; } public CheckRecord build() { return new CheckRecord(this); } } }
11e722d62e8b7dd333704b591c9248e9d6993d1b
02b17dd2aabd053d27938b8012a462c5e916e107
/jphs-manager/src/main/java/com/jinpaihushi/jphs/information/controller/InformationEvaluateController.java
228e6c1f060983030cbb1f6d9d86bce4babb099e
[]
no_license
wangwenteng/jphs-parent
8e3ebbb9c25e40ed1e77e3ba8f756d9cca9b5c44
a0f1db0f19321ea52137325cf9a12bc1e4f2d967
refs/heads/master
2022-03-08T04:19:12.557274
2019-03-28T10:40:04
2019-03-28T10:40:04
112,137,508
0
1
null
null
null
null
UTF-8
Java
false
false
6,916
java
package com.jinpaihushi.jphs.information.controller; import java.util.UUID; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.github.pagehelper.Page; import com.jinpaihushi.controller.BaseController; import com.jinpaihushi.jphs.information.model.Information; import com.jinpaihushi.jphs.information.model.InformationEvaluate; import com.jinpaihushi.jphs.information.service.InformationEvaluateService; import com.jinpaihushi.jphs.information.service.InformationService; import com.jinpaihushi.jphs.system.model.SystemUser; import com.jinpaihushi.service.BaseService; import com.jinpaihushi.utils.PageInfos; /** * * @author scj * @date 2017-07-19 15:01:20 * @version 1.0 */ @Controller @RequestMapping(name = "资讯评价", path = "/information/evaluate") public class InformationEvaluateController extends BaseController<InformationEvaluate> { @Autowired private InformationEvaluateService informationEvaluateService; @Autowired private InformationService informationService; @Override protected BaseService<InformationEvaluate> getService() { return informationEvaluateService; } @RequestMapping(name = "列表页", path = "/index.jhtml") public String index(HttpSession hs, HttpServletRequest req, HttpServletResponse resp, ModelMap modelMap, InformationEvaluate informationEvaluate, Integer p, Integer n) { startPage(p, n); Page<InformationEvaluate> list = informationEvaluateService.query(informationEvaluate); PageInfos<InformationEvaluate> pageInfo = new PageInfos<InformationEvaluate>(list, req); modelMap.put("list", list); modelMap.put("pageInfo", pageInfo); return "information/evaluate/list"; } @RequestMapping(name = "跳转到修改页", path = "/redirectUpdate.jhtml") public String toUpdate(HttpSession hs, HttpServletRequest req, HttpServletResponse resp, ModelMap modelMap, String id) { InformationEvaluate informationEvaluate = informationEvaluateService.loadById(id); Information information = new Information(); if (informationEvaluate.getInformationId() != null && !"".equals(informationEvaluate.getInformationId())) { information = informationService.loadById(informationEvaluate.getInformationId()); } modelMap.put("information", information); modelMap.put("informationEvaluate", informationEvaluate); return "information/evaluate/edit"; } @RequestMapping(name = "跳转到添加页", path = "/redirectAddPage.jhtml") public String redirectAddPage(ModelMap modelMap) { return "information/evaluate/edit"; } @RequestMapping(name = "详情页", path = "/detail.jhtml", method = RequestMethod.GET) public String detail(HttpSession hs, HttpServletRequest req, HttpServletResponse resp, ModelMap modelMap, String id) { InformationEvaluate informationEvaluate = informationEvaluateService.loadById(id); Information information = new Information(); if (informationEvaluate.getInformationId() != null && !"".equals(informationEvaluate.getInformationId())) { information = informationService.loadById(informationEvaluate.getInformationId()); } modelMap.put("information", information); modelMap.put("informationEvaluate", informationEvaluate); return "information/evaluate/detail"; } @RequestMapping(name = "添加或修改数据", path = "/insert.jhtml") public String insert(HttpSession hs, HttpServletRequest req, HttpServletResponse resp, ModelMap modelMap, InformationEvaluate informationEvaluate, String auditarr, String audit, String essence) { if (informationEvaluate.getId() != null && !informationEvaluate.getId().equals("") && !audit.equals("1")) { boolean b = informationEvaluateService.update(informationEvaluate); if (b == false) { // 跳转到错误页 return "redirect:/information/evaluate/err.jhtml"; } } else { if (auditarr != null && !"".equals(auditarr) && audit != null && !"".equals(audit)) { String[] str_arr = auditarr.split(","); InformationEvaluate informationEvaluateUp = new InformationEvaluate(); informationEvaluateUp.setStatus(Integer.valueOf(audit)); for (int a = 0; a < str_arr.length; a++) { informationEvaluateUp.setId(str_arr[a]); informationEvaluateService.update(informationEvaluateUp); } } else if (audit != null && !"".equals(audit)) { if (audit.equals("1")) { if (essence.equals("0")) { informationEvaluate.setEssence(-1); } else { informationEvaluate.setEssence(0); } informationEvaluateService.update(informationEvaluate); } return "redirect:/information/evaluate/index.jhtml"; } else { try { SystemUser user = (SystemUser) hs.getAttribute("session_user"); informationEvaluate.setCreatorId(user.getId()); informationEvaluate.setCreatorName(user.getName()); } catch (Exception e) { } informationEvaluate.setId(UUID.randomUUID().toString()); String result = informationEvaluateService.insert(informationEvaluate); if (result.length() <= 0) { // 跳转到错误页 return "redirect:/information/evaluate/err.jhtml"; } } } return "redirect:/information/evaluate/index.jhtml"; } @RequestMapping(name = "删除数据", path = "/delete.jhtml") public String delete(HttpSession hs, HttpServletRequest req, HttpServletResponse resp, ModelMap modelMap, String id) { boolean b = informationEvaluateService.deleteById(id); if (b == false) { // 跳转到错误页 return "redirect:/information/evaluate/err.jhtml"; } return "redirect:/information/evaluate/index.jhtml"; } }
b502cf72f4c8dc0b215a29faf4e6b2fa8b391692
e9ac6e963badb2aebd99d039d6b81663d4b61e89
/src/Baseball_Boxscore/json/Data.java
42cc0632abc6562d2f517a31c93f945cf44af9b4
[]
no_license
kayazas123/modern-java-recipes
8ee54f76b1e794b190753188055db5b9193dd3fe
3abaa852777adf6bb1abe7ade1838f01f8c563fe
refs/heads/main
2023-02-19T10:26:38.688716
2021-01-20T21:11:04
2021-01-20T21:11:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
340
java
package Baseball_Boxscore.json; /** * @author Mohammed Amr * @created 19/01/2021 - 02:21 * @project Modern Java Recipes */ public class Data { private Boxscore boxscore; public Boxscore getBoxscore() { return boxscore; } public void setBoxscore(Boxscore boxscore) { this.boxscore = boxscore; } }
0ea8a1c8d4b1b9d18da400647ac5fae5b57ea952
96865ea6782ab689c341356c9e9f86f7e0ae1365
/gwt-jackson/src/test/java/com/github/nmorel/gwtjackson/client/advanced/InheritanceGwtTest.java
8119c8aeec9201ad6657d03a04f1450756976b1c
[ "Apache-2.0" ]
permissive
nmorel/gwt-jackson
60e2bda4072489d9960e06ea6513a4e68d65d8ca
688cdca205f1ec3554509a5df2d18d594a47a5ff
refs/heads/master
2023-08-25T01:52:50.537529
2021-02-21T12:11:37
2021-02-21T12:11:37
12,341,002
91
62
Apache-2.0
2022-07-15T21:05:14
2013-08-24T09:24:43
Java
UTF-8
Java
false
false
1,617
java
/* * Copyright 2013 Nicolas Morel * * 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.github.nmorel.gwtjackson.client.advanced; import com.github.nmorel.gwtjackson.client.GwtJacksonTestCase; import com.github.nmorel.gwtjackson.client.ObjectMapper; import com.github.nmorel.gwtjackson.shared.ObjectMapperTester; import com.github.nmorel.gwtjackson.shared.advanced.InheritanceTester; import com.github.nmorel.gwtjackson.shared.advanced.InheritanceTester.ChildBean; import com.google.gwt.core.client.GWT; /** * @author Nicolas Morel */ public class InheritanceGwtTest extends GwtJacksonTestCase { public interface InheritanceMapper extends ObjectMapper<ChildBean>, ObjectMapperTester<ChildBean> { static InheritanceMapper INSTANCE = GWT.create( InheritanceMapper.class ); } private InheritanceTester tester = InheritanceTester.INSTANCE; public void testSerializePrivateField() { tester.testSerialize( InheritanceMapper.INSTANCE ); } public void testDeserializePrivateField() { tester.testDeserialize( InheritanceMapper.INSTANCE ); } }
e306266e70950aebb529df8eed8c1b2e345802f8
fe753cf92fdc0c175159e463fcb6e826a83b620f
/kodilla-patterns2/src/test/java/com/kodilla/patterns2/adapter/bookclasifier/libraryb/MedianAdapterTestSuite.java
eee889967887bbf6c5ab503bbbe4cf0f9adf9481
[]
no_license
jrubach/jacek-rubach-kodilla2-java
188df280e10e7d641733b90bd198cfdfe7af2405
b7a1dc5da8ec238a88ca0d5ddb82d8b2db2b4abe
refs/heads/master
2022-12-19T00:57:06.143220
2020-09-23T13:01:12
2020-09-23T13:01:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,315
java
package com.kodilla.patterns2.adapter.bookclasifier.libraryb; import com.kodilla.patterns2.adapter.bookclasifier.MedianAdapter; import com.kodilla.patterns2.adapter.bookclasifier.librarya.Book; import org.junit.Assert; import org.junit.Test; import java.util.HashSet; import java.util.Set; public class MedianAdapterTestSuite { @Test public void publicationYearMedianTest() { //Given Book book1 = new Book("aut1","tit1",2000,"123"); Book book2 = new Book("aut2","tit2",2001,"1234"); Book book3 = new Book("aut3","tit3",2002,"12345"); Book book4 = new Book("aut4","tit4",2003,"123456"); Set<Book> bookSetEven = new HashSet<>(); Set<Book> bookSetOdd = new HashSet<>(); bookSetEven.add(book1); bookSetEven.add(book2); bookSetEven.add(book3); bookSetEven.add(book4); bookSetOdd.add(book1); bookSetOdd.add(book2); bookSetOdd.add(book3); MedianAdapter medianAdapter = new MedianAdapter(); //When double medianEven = medianAdapter.publicationYearMedian(bookSetEven); double medianOdd = medianAdapter.publicationYearMedian(bookSetOdd); //Then Assert.assertEquals(2001.5,medianEven,0.00001); Assert.assertEquals(2001,medianOdd,0.00001); } }
fad0b2c32b1117755aa37f941deb8688f78d8c2f
86561ed7bc82d7c3cfb5d57610a62dcb8c8035a7
/app/src/test/java/com/somsubhra/ipfinder/ExampleUnitTest.java
afdd42385acd1bc22de0ef2f7562b11763fe722a
[ "MIT" ]
permissive
Somsubhra1/IP-Finder-Android
7a446de8787a86113c449a8bdf8db487228f2f8a
44a4fa244fb954356663c36937052e0420f55d49
refs/heads/master
2021-05-11T05:50:23.887203
2018-07-21T10:52:33
2018-07-21T10:52:33
117,971,371
0
1
null
null
null
null
UTF-8
Java
false
false
400
java
package com.somsubhra.ipfinder; 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() throws Exception { assertEquals(4, 2 + 2); } }
6a840a64a2af8674bd1f25be8fb22e4499d4a2ce
69005ab4c8cc5d88d7996d47ac8def0b28730b95
/android-medium/app/src/main/java/test/perf/MyPerfClass_880.java
9e74380e6e1f8d998e5c43e52d4d1f9416fecd11
[]
no_license
sakerbuild/performance-comparisons
ed603c9ffa0d34983a7da74f7b2b731dc3350d7e
78cd8d7896c4b0255ec77304762471e6cab95411
refs/heads/master
2020-12-02T19:14:57.865537
2020-05-11T14:09:40
2020-05-11T14:09:40
231,092,201
0
0
null
null
null
null
UTF-8
Java
false
false
799
java
package test.perf; public class MyPerfClass_880{ private final String property; public MyPerfClass_880(String param) { this.property = param; } public String getProperty() { return property; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((property == null) ? 0 : property.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; MyPerfClass_880 other = (MyPerfClass_880) obj; if (property == null) { if (other.property != null) return false; } else if (!property.equals(other.property)) return false; return true; } }
a205ad595b44c9ad9317df4fb8083d9b0c06be8a
27ceb9728f25f76150e775845c002e901211c7c7
/Student Grading System/.history/src/Driver/Controller_20210519111605.java
2acfbf2e1a2e46a5b350b5077ff6a62d20b1ca93
[]
no_license
cormacmattimoe/SoftwareQualityAssuranceFinalCa
bd1f4f64fef3396e4dfdfac199d1876311841596
7d4d9e8b9d36b28e77b319d4e5061da93233a442
refs/heads/master
2023-05-06T11:50:58.072870
2021-05-21T09:04:55
2021-05-21T09:04:55
368,800,636
0
0
null
2021-05-21T09:04:56
2021-05-19T08:40:30
Java
UTF-8
Java
false
false
7,094
java
package Driver; import java.util.ArrayList; import java.util.Scanner; import Entities.Criterion; import Entities.Rubric; import Entities.StudentGrade; //This is main class that controls of the user inputs and data. //This class allows the user to choose options from the menu. // class that handles user input and data // inside this class should cover all the various parts of grading system // Tasks // public class Controller { Scanner scan = new Scanner(System.in); ArrayList<Rubric> listOfRubrics = new ArrayList<>(); ArrayList<Criterion> listOfCriteria = new ArrayList<>(); ArrayList<StudentGrade> listOfGrades = new ArrayList<>(); StudentGrade tempStudentGrade; public void showMenu(){ System.out.println("Welcome"); System.out.println("-----------------------"); System.out.println("1. Create a rubric"); System.out.println("2. View a rubric"); System.out.println("3. View all rubrics"); System.out.println("4. Add a Criteria to a rubric"); System.out.println("5. Add a studentGrade to a criteria"); System.out.println("6. View min and max standard dev and average across all grades"); System.out.println("7. View min and max standard dev and average across specific criteria"); System.out.println("8. View average, standard deviation, minimum and maximum score for a Rubric"); scan = new Scanner(System.in); switch (scan.next()){ case("1"): scan = new Scanner(System.in); System.out.println("Please enter a rubric name:"); String rubricName = scan.nextLine(); if(createRubric(rubricName)) { System.out.println("Rubric successfully created"); } showMenu(); break; case("2"): System.out.println("Please enter a rubric name:"); String rubricReturned = scan.nextLine(); Rubric r = new Rubric(); getARubric(rubricReturned,r); if(r != null){ System.out.println("Rubric found"); } showMenu(); break; case("3"): System.out.println("Please enter a rubric name"); String rubric = scan.nextLine(); System.out.println("Please enter a name of criterion"); String criterionReturned = scan.nextLine(); Rubric ub = new Rubric(); // createCriterion(criterionReturned,rub); showMenu(); break; case("4"): System.out.println("What rubric would you like?"); String rubicre = scan.nextLine(); // getARubric() showMenu(); break; default: System.out.println("That is not a reponse!\n\n"); showMenu(); break; } } public Boolean createRubric(String rubricTobeCreated){ //1. Check to see if the rubric name exists Rubric tempRubric = new Rubric(); for (Rubric r : listOfRubrics) { if(r.getRubricName() == rubricTobeCreated) { System.out.println("Failed"); return false; } } tempRubric.setRubricName(rubricTobeCreated); listOfRubrics.add(tempRubric); return true; } public void getARubric(String nameOfRubric, Rubric rubricReturned) { rubricReturned = null; for (Rubric r : listOfRubrics) { if(r.getRubricName() == nameOfRubric) { rubricReturned = r; } } } public Boolean createCriterion(String criterionToBeCreated, Rubric rubricname) { Criterion tempCriteria = new Criterion(); //1. Check to see if the there is already 10 criteria //2. Check to see iof the name exists //3. Else add it if(rubricname.getCriteria().size() > 9) { System.out.println("To many criteria already exist"); return false; } listOfCriteria = rubricname.getCriteria(); for (Criterion c : listOfCriteria) { if(c.getCriteriaName() == criterionToBeCreated) { System.out.println("Name already exists"); return false; } } tempCriteria.setCriteriaName(criterionToBeCreated); rubricname.addCriteria(tempCriteria); return true; } public Boolean addStudentGrade(Criterion criteria, Rubric rubricname, String nameOfStudent,int gradeOfStudent) { StudentGrade tempStudentGrade = new StudentGrade(); //1. Check to see if the rubric exists //2. Check to see if the criteria exists //3. Check to see if the grade is between 1-5 //4. Check to see if the student name already exists. //5. Else create populate studentGrade class //6. Add that to the array for the criterion if(gradeOfStudent < 1 || gradeOfStudent > 5) { System.out.println("Grade is out of range"); return false; } for (Rubric r : listOfRubrics) { if(r.getRubricName() == rubricname.getRubricName()) { listOfCriteria = rubricname.getCriteria(); for (Criterion c : listOfCriteria) { if(c.getCriteriaName() == criteria.getCriteriaName()) { tempStudentGrade.setStudentName(nameOfStudent); tempStudentGrade.setGrade(gradeOfStudent); c.addStudentGrade(tempStudentGrade); return true; } } System.out.println("Criteria not found"); return false; } } System.out.println("Rubric not found"); return false; } public ArrayList<Rubric> getAllRubrics(){ ArrayList<Rubric> allOfRubrics = new ArrayList<>(); for(Rubric rubric: listOfRubrics){ System.out.println(rubric.toString()); } return allOfRubrics; } // Gets the average score across all graded Students public double getRubricScoreAverage(String name) { int sum = 0 ; int count = 0 ; int avg = 0 ; for (StudentGrade grade : listOfGrades) { if(grade.getStudentName().equalsIgnoreCase(name)) { for (Criterion criterion : grade.getGrade()) { sum += criterion.score; count ++ ; } } } if(sum != 0 && count != 0) { avg = sum/count ; } return avg ; } public static void main(String[] args) { Controller controller = new Controller(); controller.showMenu(); } }
1a614ff712d0c723f6d36e63ea52b1f8e2e0d393
0a210969d2ea5ae0e08afab1bc158a39d8115104
/src/main/java/com/ldg/tcm/po/Admin.java
3da0e8c4f14ed3935f80ce97a9974bd064917b8f
[]
no_license
ldiongge/helloworld
30ac0cd4f135f20654c612dcb8f1dd880d9c018e
f61c91f7c81a510ab69c67c80593b9ba45fc843d
refs/heads/master
2023-04-14T20:27:58.006054
2021-04-16T09:42:11
2021-04-16T09:42:11
358,543,760
0
0
null
null
null
null
UTF-8
Java
false
false
1,049
java
package com.ldg.tcm.po; import com.baomidou.mybatisplus.annotation.IdType; import java.util.Date; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import java.io.Serializable; import lombok.Data; import lombok.EqualsAndHashCode; /** * <p> * * </p> * * @author 李东阁 * @since 2021-03-25 */ @Data @EqualsAndHashCode(callSuper = false) public class Admin implements Serializable { private static final long serialVersionUID = 1L; @TableId(value = "id", type = IdType.AUTO) private Integer id; private String username; private String password; private String nickname; private String phone; private String email; private Date createtime; private Date updatetime; private Integer role; private Integer statusid; private String remarks; @TableField(exist = false) private Boolean check; @TableField(exist = false) private String rolename; @TableField(exist = false) private Status status; }
977792e91eb9517d75572c7ecbb2974ba36faf4f
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/4/4_b4aed1d0b9cb85c0b2db656d6994eb458a45ece0/BookData/4_b4aed1d0b9cb85c0b2db656d6994eb458a45ece0_BookData_s.java
fed76dbc27c0b89e6b3d0c4d212a379328048086
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
10,982
java
/** * Distribution License: * JSword is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License, version 2.1 as published by * the Free Software Foundation. This program is distributed in the hope * that it will be useful, but WITHOUT ANY WARRANTY; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * The License is available on the internet at: * http://www.gnu.org/copyleft/lgpl.html * or by writing to: * Free Software Foundation, Inc. * 59 Temple Place - Suite 330 * Boston, MA 02111-1307, USA * * Copyright: 2005 * The copyright to this program is held by it's authors. * * ID: $Id$ */ package org.crosswire.jsword.book; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.crosswire.common.diff.Diff; import org.crosswire.common.diff.DiffCleanup; import org.crosswire.common.diff.Difference; import org.crosswire.common.util.Language; import org.crosswire.common.xml.JDOMSAXEventProvider; import org.crosswire.common.xml.SAXEventProvider; import org.crosswire.jsword.passage.Key; import org.jdom.Content; import org.jdom.Document; import org.jdom.Element; import org.jdom.Namespace; import org.jdom.Text; /** * BookData is the assembler of the OSIS that is returned by the filters. As * such it puts that into an OSIS document. When several books are supplied, it * gets the data from each and puts it into a parallel or interlinear view. * Note: it is critical that all the books are able to understand the same key. * That does not mean that each has to have content for each key. Missing keys * are represented by empty cells. * * @see gnu.lgpl.License for license details.<br> * The copyright to this program is held by it's authors. * @author Joe Walker [joe at eireneh dot com] * @author DM Smith [dmsmith555 at yahoo dot com] */ public class BookData implements BookProvider { /** * Ctor */ public BookData(Book book, Key key) { assert book != null; assert key != null; this.key = key; books = new Book[1]; books[0] = book; } /** * Create BookData for multiple books. */ public BookData(Book[] books, Key key, boolean compare) { assert books != null && books.length > 0; assert key != null; this.books = books.clone(); this.key = key; this.comparingBooks = compare; } /** * Accessor for the root OSIS element */ public Element getOsis() throws BookException { if (osis == null) { // TODO(DMS): Determine the proper representation of the OSISWork // name for multiple books. osis = OSISUtil.createOsisFramework(getFirstBook().getBookMetaData()); Element text = osis.getChild(OSISUtil.OSIS_ELEMENT_OSISTEXT); Element div = getOsisFragment(); text.addContent(div); } return osis; } /** * Accessor for the root OSIS element */ public Element getOsisFragment() throws BookException { if (fragment == null) { fragment = getOsisContent(); } return fragment; } /** * Output the current data as a SAX stream. * * @return A way of posting SAX events */ public SAXEventProvider getSAXEventProvider() throws BookException { // If the fragment is already in a document, then use that. Element frag = getOsisFragment(); Document doc = frag.getDocument(); if (doc == null) { doc = new Document(frag); } return new JDOMSAXEventProvider(doc); } /** * Who created this data. * * @return Returns the book. */ public Book[] getBooks() { return books == null ? null : (Book[]) books.clone(); } /** * Get the first book. */ public Book getFirstBook() { return books != null && books.length > 0 ? books[0] : null; } /** * The key used to obtain data from one or more books. * * @return Returns the key. */ public Key getKey() { return key; } /** * @return whether the books should be compared. */ public boolean isComparingBooks() { return comparingBooks; } private Element getOsisContent() throws BookException { Element div = OSISUtil.factory().createDiv(); if (books.length == 1) { Iterator<Content> iter = books[0].getOsisIterator(key, false); while (iter.hasNext()) { Content content = iter.next(); div.addContent(content); } } else { Element table = OSISUtil.factory().createTable(); Element row = OSISUtil.factory().createRow(); Element cell = null; table.addContent(row); Iterator<Content>[] iters = new Iterator[books.length]; boolean[] showDiffs = new boolean[books.length - 1]; boolean doDiffs = false; for (int i = 0; i < books.length; i++) { Book book = books[i]; cell = OSISUtil.factory().createHeaderCell(); if (i > 0) { Book prevBook = books[i - 1]; BookCategory category = book.getBookCategory(); BookCategory prevCategory = prevBook.getBookCategory(); String prevName = prevBook.getInitials(); showDiffs[i - 1] = comparingBooks && BookCategory.BIBLE.equals(category) && category.equals(prevCategory) && book.getLanguage().equals(prevBook.getLanguage()) && !book.getInitials().equals(prevName); if (showDiffs[i - 1]) { doDiffs = true; StringBuilder buf = new StringBuilder(prevBook.getInitials()); buf.append(" ==> "); buf.append(book.getInitials()); cell.addContent(OSISUtil.factory().createText(buf.toString())); row.addContent(cell); cell = OSISUtil.factory().createHeaderCell(); } } cell.addContent(OSISUtil.factory().createText(book.getInitials())); row.addContent(cell); iters[i] = book.getOsisIterator(key, true); } Content content = null; int cellCount = 0; int rowCount = 0; while (true) { cellCount = 0; row = OSISUtil.factory().createRow(); String lastText = ""; for (int i = 0; i < iters.length; i++) { Book book = books[i]; cell = OSISUtil.factory().createCell(); Language lang = (Language) book.getProperty(BookMetaData.KEY_XML_LANG); cell.setAttribute(OSISUtil.OSIS_ATTR_LANG, lang.getCode(), Namespace.XML_NAMESPACE); row.addContent(cell); StringBuilder newText = new StringBuilder(doDiffs ? 32 : 0); if (iters[i].hasNext()) { List<Content> contents = new ArrayList<Content>(1); do { content = iters[i].next(); contents.add(content); addText(doDiffs, newText, content); } while (!isNextVerse(content)); if (doDiffs) { String thisText = newText.toString(); if (unaccenter != null) { thisText = unaccenter.unaccent(thisText); } if (i > 0 && showDiffs[i - 1]) { List<Difference> diffs = new Diff(lastText, thisText, false).compare(); DiffCleanup.cleanupSemantic(diffs); cell.addContent(OSISUtil.diffToOsis(diffs)); // Since we used that cell create another cell = OSISUtil.factory().createCell(); lang = (Language) book.getProperty(BookMetaData.KEY_XML_LANG); cell.setAttribute(OSISUtil.OSIS_ATTR_LANG, lang.getCode(), Namespace.XML_NAMESPACE); row.addContent(cell); } lastText = thisText; } cell.addContent(contents); cellCount++; } } if (cellCount == 0) { break; } table.addContent(row); rowCount++; } if (rowCount > 0) { div.addContent(table); } } return div; } private boolean isNextVerse(Content content) { if (content instanceof Element) { return OSISUtil.OSIS_ELEMENT_VERSE.equals(((Element) content).getName()); } return false; } private void addText(boolean doDiffs, StringBuilder newText, Content content) { if (doDiffs) { // if we already have content, let's add a space to avoid chaining words together if (newText.length() != 0) { newText.append(' '); } if (content instanceof Element) { newText.append(OSISUtil.getCanonicalText((Element) content)); } else if (content instanceof Text) { newText.append(((Text) content).getText()); } } } /** * @param unaccenter the unaccenter to set */ public void setUnaccenter(UnAccenter unaccenter) { this.unaccenter = unaccenter; } /** * What key was used to create this data */ private Key key; /** * The books to which the key should be applied. */ private Book[] books; /** * Whether the Books should be compared. */ private boolean comparingBooks; /** * The complete OSIS container for the element */ private Element osis; /** * Just the element */ private Element fragment; private UnAccenter unaccenter; }
870c9ad6d942f0c33a2ccad0e2de0e3d911e9595
044d43db9d7f14a55d27256b0427e9ed3cb5258a
/sqlConvert/src/test/java/demo/sqlConvert/AppTest.java
8cd3d3fce12bc781866d9c35387f5f9b819b8807
[]
no_license
Xayna/sqlConvert
67938bff213ed382d36abbb2ed8509319f64456a
9b42b62519fad1e2d96fe8dba424a6a37f6eff96
refs/heads/master
2021-01-25T10:07:28.058251
2015-12-23T17:23:10
2015-12-23T17:23:10
41,768,258
0
0
null
null
null
null
UTF-8
Java
false
false
681
java
package demo.sqlConvert; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
56afe640921739c27b13f2682f37a4c05c0bc435
4aae78df83a757e91b23cd12df99107ac3810cc1
/Excercises/Huffman.java
925c9bb3d52ae8eb45c3fe05ca4a982a85f51ba7
[]
no_license
suzanagi/materials-classactivity-uoa-2017-FU09-algorighms_and_data_structures_II
c8816014e876f685bdfd5f34cf241be9c60d6350
a0af2d5b8e4bf30102d263053e59b9d526cf6e53
refs/heads/master
2020-05-01T14:26:14.465973
2019-03-25T05:34:41
2019-03-25T05:34:41
177,520,432
0
0
null
null
null
null
UTF-8
Java
false
false
5,219
java
/* @Author s1240234 Yuta Nemoto * @Date 13, May, 2018 * How to use: * First, compile the java program by using command: * javac Huffman.java * And execute it by using command: * java Huffman * Then it asks you to enter the text for encoding so please enter the text. * It automatically outputs the calculation results of probabilities of each letter, the assigned codes for each letter, and the result of encoding, decoding. */ import java.io.File; import java.io.FileNotFoundException; import java.util.PriorityQueue; import java.util.Scanner; import java.util.TreeMap; public class Huffman { static final boolean readFromFile = false; static final boolean newTextBasedOnOldOne = false; static PriorityQueue<Node> nodes = new PriorityQueue<>((o1, o2) -> (o1.value < o2.value) ? -1 : 1); static TreeMap<Character, String> codes = new TreeMap<>(); static String text = ""; static String encoded = ""; static String decoded = ""; static int ASCII[] = new int[128]; public static void main(String[] args) throws FileNotFoundException { Scanner scanner = (readFromFile) ? new Scanner(new File("input.txt")) : new Scanner(System.in); handleNewText(scanner); } private static boolean handleNewText(Scanner scanner) { int oldTextLength = text.length(); System.out.println("Enter the text:"); text = scanner.nextLine(); if (newTextBasedOnOldOne) { if (oldTextLength != 0 && !IsSameCharacterSet()) { System.out.println("Not Valid input"); text = ""; return true; } } ASCII = new int[128]; nodes.clear(); codes.clear(); encoded = ""; decoded = ""; System.out.println("Text: " + text); calculateCharIntervals(nodes, true); buildTree(nodes); generateCodes(nodes.peek(), ""); printCodes(); System.out.println("-- Encoding/Decoding --"); encodeText(); decodeText(); return false; } private static boolean IsSameCharacterSet() { boolean flag = true; for (int i = 0; i < text.length(); i++) if (ASCII[text.charAt(i)] == 0) { flag = false; break; } return flag; } private static void decodeText() { decoded = ""; Node node = nodes.peek(); for (int i = 0; i < encoded.length(); ) { Node tmpNode = node; while (tmpNode.left != null && tmpNode.right != null && i < encoded.length()) { if (encoded.charAt(i) == '1') tmpNode = tmpNode.right; else tmpNode = tmpNode.left; i++; } if (tmpNode != null) if (tmpNode.character.length() == 1) decoded += tmpNode.character; else System.out.println("Input not Valid"); } System.out.println("Decoded Text: " + decoded); } private static void encodeText() { encoded = ""; for (int i = 0; i < text.length(); i++) encoded += codes.get(text.charAt(i)); System.out.println("Encoded Text: " + encoded); } private static void buildTree(PriorityQueue<Node> vector) { while (vector.size() > 1) vector.add(new Node(vector.poll(), vector.poll())); } private static void printCodes() { System.out.println("--- Codes for each letters ---"); codes.forEach((k, v) -> System.out.println("'" + k + "' : " + v)); } private static void calculateCharIntervals(PriorityQueue<Node> vector, boolean printIntervals) { if (printIntervals) System.out.println("-- Probabilities --"); for (int i = 0; i < text.length(); i++) ASCII[text.charAt(i)]++; for (int i = 0; i < ASCII.length; i++) if (ASCII[i] > 0) { vector.add(new Node(ASCII[i] / (text.length() * 1.0), ((char) i) + "")); if (printIntervals) System.out.println("'" + ((char) i) + "' : " + ASCII[i] / (text.length() * 1.0)); } } private static void generateCodes(Node node, String s) { if (node != null) { if (node.right != null) generateCodes(node.right, s + "1"); if (node.left != null) generateCodes(node.left, s + "0"); if (node.left == null && node.right == null) codes.put(node.character.charAt(0), s); } } } class Node { Node left, right; double value; String character; public Node(double value, String character) { this.value = value; this.character = character; left = null; right = null; } public Node(Node left, Node right) { this.value = left.value + right.value; character = left.character + right.character; if (left.value < right.value) { this.right = right; this.left = left; } else { this.right = left; this.left = right; } } }
fd15ff16bcf54de96f9488c09bca725ad0142512
6d69e906335c928efb12e6c0b6eb0f0fe6c38668
/app/src/main/java/com/gamil/martinccleonardo/ourcart/AddItems.java
bc7ba962e5a1dfec4dccaeb16d29d3013b9cf417
[]
no_license
martinleonardo/Our-Cart
cfbc7ca9cdd2315e832f199dd928c4762901acec
0ea7a98de446190fcf6e4d1f0d2fdf206c335de6
refs/heads/main
2023-06-02T05:44:38.237412
2021-06-17T23:16:46
2021-06-17T23:16:46
376,162,903
0
0
null
null
null
null
UTF-8
Java
false
false
4,226
java
package com.gamil.martinccleonardo.ourcart; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import com.gamil.martinccleonardo.ourcart.databinding.ActivityScrollingBinding; import com.google.android.gms.auth.api.signin.GoogleSignIn; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import com.google.android.material.appbar.CollapsingToolbarLayout; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; public class AddItems extends AppCompatActivity { private ActivityScrollingBinding binding; TextView text; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_items); text = findViewById(R.id.textView); Log.d("DEBUG", "Attempting to process account"); GoogleSignInAccount acct = GoogleSignIn.getLastSignedInAccount(this); if (acct != null) { String personName = acct.getDisplayName(); String personGivenName = acct.getGivenName(); String personFamilyName = acct.getFamilyName(); String personEmail = acct.getEmail(); String personId = acct.getId(); Uri personPhoto = acct.getPhotoUrl(); text.setText(personId); } else { text.setText("No account"); } Log.d("DEBUG", "Processing completed"); //binding = ActivityScrollingBinding.inflate(getLayoutInflater()); //setContentView(binding.getRoot()); Button addItemBtn; addItemBtn = findViewById(R.id.addItemBtn); addItemBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); login(); } }); // Toolbar toolbar = binding.toolbar; // setSupportActionBar(toolbar); // CollapsingToolbarLayout toolBarLayout = binding.toolbarLayout; // toolBarLayout.setTitle(getTitle()); // // FloatingActionButton fab = binding.fab; // fab.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View view) { // Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) // .setAction("Action", null).show(); // } // }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_scrolling, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public void login() { EditText itemInput, amountInput, unitInput; itemInput = (EditText)findViewById(R.id.itemInput); amountInput = (EditText)findViewById(R.id.amountInput); unitInput = (EditText)findViewById(R.id.unitInput); String type, item, amount, unit; item = itemInput.getText().toString(); amount = amountInput.getText().toString(); unit = unitInput.getText().toString(); type = "add"; BackgroundWorker backgroundWorker = new BackgroundWorker(this); backgroundWorker.execute(type, item, amount, unit); } }
f31df1cef5ee25d38de03a571889401ab684e2d6
447520f40e82a060368a0802a391697bc00be96f
/apks/malware/app52/source/com/snowfish/a/a/p/IAUserService.java
f257e1c1971620e9166c044951203778162eca61
[ "Apache-2.0" ]
permissive
iantal/AndroidPermissions
7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465
d623b732734243590b5f004d167e542e2e2ae249
refs/heads/master
2023-07-19T01:29:26.689186
2019-09-30T19:01:42
2019-09-30T19:01:42
107,239,248
0
0
Apache-2.0
2023-07-16T07:41:38
2017-10-17T08:22:57
null
UTF-8
Java
false
false
111
java
package com.snowfish.a.a.p; public abstract interface IAUserService { public abstract String getUserId(); }
99d290c197d9d593647d5d4b49b7a17fb2a0c3c9
dafff507fdde2b3f1ae94d3ad10b2b49f2c141d9
/ssm/src/cn/yq/ssm/service/UserService.java
ce2227cacfa465fb6ca3c4d46bd962f1fcc72182
[]
no_license
VnorahC/ssm
e2526ab87aa02d21e02384304243aea09618f09d
79b93f9d38d23e04cf5fe295330a3bef4e79c625
refs/heads/master
2020-05-04T15:40:34.784393
2019-04-03T09:18:31
2019-04-03T09:18:31
179,251,621
0
0
null
null
null
null
UTF-8
Java
false
false
290
java
package cn.yq.ssm.service; import java.util.List; import cn.yq.ssm.pojo.User; public interface UserService { User selectByPrimaryKey(Integer id); List<User> selectByCondition(); int updateByPrimaryKey(User user); int deleteByPrimaryKey(Integer id); int insert(User user); }
644b3da997947365b8596eeb38b3fcf0e7818599
7f2a44e61cabaa39bc6b4c65821851028bb8bd51
/cash-desk-service/src/main/java/org/jhipster/cashdeskservice/web/rest/PrinterResource.java
c94cd5da3eb45ee9b66e4b4f6e29ea6283f608be
[]
no_license
NasrinD/tradingsystem-micro
192a4d96d9fbcaaca608d9773d422823a1eee6c2
efb79d385f0a326be4b9b8085fe7c0d5c4a86c9f
refs/heads/master
2020-03-29T09:41:31.274427
2018-11-26T16:36:43
2018-11-26T16:36:43
149,769,969
0
0
null
null
null
null
UTF-8
Java
false
false
5,074
java
package org.jhipster.cashdeskservice.web.rest; import com.codahale.metrics.annotation.Timed; import org.jhipster.cashdeskservice.domain.Printer; import org.jhipster.cashdeskservice.repository.PrinterRepository; import org.jhipster.cashdeskservice.web.rest.errors.BadRequestAlertException; import org.jhipster.cashdeskservice.web.rest.util.HeaderUtil; import io.github.jhipster.web.util.ResponseUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.StreamSupport; /** * REST controller for managing Printer. */ @RestController @RequestMapping("/api") public class PrinterResource { private final Logger log = LoggerFactory.getLogger(PrinterResource.class); private static final String ENTITY_NAME = "printer"; private final PrinterRepository printerRepository; public PrinterResource(PrinterRepository printerRepository) { this.printerRepository = printerRepository; } /** * POST /printers : Create a new printer. * * @param printer the printer to create * @return the ResponseEntity with status 201 (Created) and with body the new printer, or with status 400 (Bad Request) if the printer has already an ID * @throws URISyntaxException if the Location URI syntax is incorrect */ @PostMapping("/printers") @Timed public ResponseEntity<Printer> createPrinter(@Valid @RequestBody Printer printer) throws URISyntaxException { log.debug("REST request to save Printer : {}", printer); if (printer.getId() != null) { throw new BadRequestAlertException("A new printer cannot already have an ID", ENTITY_NAME, "idexists"); } Printer result = printerRepository.save(printer); return ResponseEntity.created(new URI("/api/printers/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())) .body(result); } /** * PUT /printers : Updates an existing printer. * * @param printer the printer to update * @return the ResponseEntity with status 200 (OK) and with body the updated printer, * or with status 400 (Bad Request) if the printer is not valid, * or with status 500 (Internal Server Error) if the printer couldn't be updated * @throws URISyntaxException if the Location URI syntax is incorrect */ @PutMapping("/printers") @Timed public ResponseEntity<Printer> updatePrinter(@Valid @RequestBody Printer printer) throws URISyntaxException { log.debug("REST request to update Printer : {}", printer); if (printer.getId() == null) { return createPrinter(printer); } Printer result = printerRepository.save(printer); return ResponseEntity.ok() .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, printer.getId().toString())) .body(result); } /** * GET /printers : get all the printers. * * @param filter the filter of the request * @return the ResponseEntity with status 200 (OK) and the list of printers in body */ @GetMapping("/printers") @Timed public List<Printer> getAllPrinters(@RequestParam(required = false) String filter) { if ("cashdesk-is-null".equals(filter)) { log.debug("REST request to get all Printers where cashDesk is null"); return StreamSupport .stream(printerRepository.findAll().spliterator(), false) .filter(printer -> printer.getCashDesk() == null) .collect(Collectors.toList()); } log.debug("REST request to get all Printers"); return printerRepository.findAll(); } /** * GET /printers/:id : get the "id" printer. * * @param id the id of the printer to retrieve * @return the ResponseEntity with status 200 (OK) and with body the printer, or with status 404 (Not Found) */ @GetMapping("/printers/{id}") @Timed public ResponseEntity<Printer> getPrinter(@PathVariable Long id) { log.debug("REST request to get Printer : {}", id); Printer printer = printerRepository.findOne(id); return ResponseUtil.wrapOrNotFound(Optional.ofNullable(printer)); } /** * DELETE /printers/:id : delete the "id" printer. * * @param id the id of the printer to delete * @return the ResponseEntity with status 200 (OK) */ @DeleteMapping("/printers/{id}") @Timed public ResponseEntity<Void> deletePrinter(@PathVariable Long id) { log.debug("REST request to delete Printer : {}", id); printerRepository.delete(id); return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build(); } }
39c17a76d963ca13e34a0ba7eba1ddb1f3ace749
71f2fbd214a56cbbb9c927b4deb5b6a415d31e50
/spring-core/src/main/java/IoC/factoryBean/Student.java
4544fb1207ee1513c6b9657b0a66ee80d745b68a
[]
no_license
lanourain/java-demo
ee54ed517031b201a6b9eb5c05118d8cf41e1add
09faf728fe20ff9b5447a44a4c801c9a116f8c8e
refs/heads/master
2022-12-20T21:46:20.964494
2021-04-10T15:33:03
2021-04-10T15:33:03
100,092,862
0
0
null
null
null
null
UTF-8
Java
false
false
207
java
package IoC.factoryBean; public class Student { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } }
b5a103866e01f405c6835a2647f12ee07bf41c13
5256132ad8756388d274c9607b88cb8e7259f0e7
/app/src/androidTest/java/me/fmy/postthink/ApplicationTest.java
da7ad35f13e34abd3de7fade0e5dae6d3b889c7c
[]
no_license
famepram/postthink
0fb4a8f41125847aad18de93d8d976d5d0c03adf
279f22847aa399bbd383f70f171d92eff5905401
refs/heads/master
2021-01-11T21:08:16.331806
2017-01-17T18:21:52
2017-01-17T18:21:52
79,252,317
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
package me.fmy.postthink; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
a9ba9cc48ac1a9384a809c7324db63ff58f08059
ccd714bfc3ea394e61266bde7c7d1cf553430b93
/Money/src/main/java/com/accp/domain/VipExample.java
4d1f6c70199c04bbb74cb95f985f1f6a8f3d68e2
[]
no_license
jxf010723/java30project
66506ae421115a0b468898fcd878e8d98e95f13c
e06dd881c515f53e0030d16f5e0b300152a8f9f6
refs/heads/master
2023-05-12T15:01:24.682361
2019-12-08T09:23:59
2019-12-08T09:23:59
221,888,491
0
0
null
2023-05-07T07:10:16
2019-11-15T09:19:34
JavaScript
UTF-8
Java
false
false
37,750
java
package com.accp.domain; import java.util.ArrayList; import java.util.List; public class VipExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public VipExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andVipIdIsNull() { addCriterion("vip_id is null"); return (Criteria) this; } public Criteria andVipIdIsNotNull() { addCriterion("vip_id is not null"); return (Criteria) this; } public Criteria andVipIdEqualTo(Integer value) { addCriterion("vip_id =", value, "vipId"); return (Criteria) this; } public Criteria andVipIdNotEqualTo(Integer value) { addCriterion("vip_id <>", value, "vipId"); return (Criteria) this; } public Criteria andVipIdGreaterThan(Integer value) { addCriterion("vip_id >", value, "vipId"); return (Criteria) this; } public Criteria andVipIdGreaterThanOrEqualTo(Integer value) { addCriterion("vip_id >=", value, "vipId"); return (Criteria) this; } public Criteria andVipIdLessThan(Integer value) { addCriterion("vip_id <", value, "vipId"); return (Criteria) this; } public Criteria andVipIdLessThanOrEqualTo(Integer value) { addCriterion("vip_id <=", value, "vipId"); return (Criteria) this; } public Criteria andVipIdIn(List<Integer> values) { addCriterion("vip_id in", values, "vipId"); return (Criteria) this; } public Criteria andVipIdNotIn(List<Integer> values) { addCriterion("vip_id not in", values, "vipId"); return (Criteria) this; } public Criteria andVipIdBetween(Integer value1, Integer value2) { addCriterion("vip_id between", value1, value2, "vipId"); return (Criteria) this; } public Criteria andVipIdNotBetween(Integer value1, Integer value2) { addCriterion("vip_id not between", value1, value2, "vipId"); return (Criteria) this; } public Criteria andUserIdIsNull() { addCriterion("user_id is null"); return (Criteria) this; } public Criteria andUserIdIsNotNull() { addCriterion("user_id is not null"); return (Criteria) this; } public Criteria andUserIdEqualTo(Integer value) { addCriterion("user_id =", value, "userId"); return (Criteria) this; } public Criteria andUserIdNotEqualTo(Integer value) { addCriterion("user_id <>", value, "userId"); return (Criteria) this; } public Criteria andUserIdGreaterThan(Integer value) { addCriterion("user_id >", value, "userId"); return (Criteria) this; } public Criteria andUserIdGreaterThanOrEqualTo(Integer value) { addCriterion("user_id >=", value, "userId"); return (Criteria) this; } public Criteria andUserIdLessThan(Integer value) { addCriterion("user_id <", value, "userId"); return (Criteria) this; } public Criteria andUserIdLessThanOrEqualTo(Integer value) { addCriterion("user_id <=", value, "userId"); return (Criteria) this; } public Criteria andUserIdIn(List<Integer> values) { addCriterion("user_id in", values, "userId"); return (Criteria) this; } public Criteria andUserIdNotIn(List<Integer> values) { addCriterion("user_id not in", values, "userId"); return (Criteria) this; } public Criteria andUserIdBetween(Integer value1, Integer value2) { addCriterion("user_id between", value1, value2, "userId"); return (Criteria) this; } public Criteria andUserIdNotBetween(Integer value1, Integer value2) { addCriterion("user_id not between", value1, value2, "userId"); return (Criteria) this; } public Criteria andViptypeIdIsNull() { addCriterion("vipType_id is null"); return (Criteria) this; } public Criteria andViptypeIdIsNotNull() { addCriterion("vipType_id is not null"); return (Criteria) this; } public Criteria andViptypeIdEqualTo(Integer value) { addCriterion("vipType_id =", value, "viptypeId"); return (Criteria) this; } public Criteria andViptypeIdNotEqualTo(Integer value) { addCriterion("vipType_id <>", value, "viptypeId"); return (Criteria) this; } public Criteria andViptypeIdGreaterThan(Integer value) { addCriterion("vipType_id >", value, "viptypeId"); return (Criteria) this; } public Criteria andViptypeIdGreaterThanOrEqualTo(Integer value) { addCriterion("vipType_id >=", value, "viptypeId"); return (Criteria) this; } public Criteria andViptypeIdLessThan(Integer value) { addCriterion("vipType_id <", value, "viptypeId"); return (Criteria) this; } public Criteria andViptypeIdLessThanOrEqualTo(Integer value) { addCriterion("vipType_id <=", value, "viptypeId"); return (Criteria) this; } public Criteria andViptypeIdIn(List<Integer> values) { addCriterion("vipType_id in", values, "viptypeId"); return (Criteria) this; } public Criteria andViptypeIdNotIn(List<Integer> values) { addCriterion("vipType_id not in", values, "viptypeId"); return (Criteria) this; } public Criteria andViptypeIdBetween(Integer value1, Integer value2) { addCriterion("vipType_id between", value1, value2, "viptypeId"); return (Criteria) this; } public Criteria andViptypeIdNotBetween(Integer value1, Integer value2) { addCriterion("vipType_id not between", value1, value2, "viptypeId"); return (Criteria) this; } public Criteria andVipPhoneIsNull() { addCriterion("vip_phone is null"); return (Criteria) this; } public Criteria andVipPhoneIsNotNull() { addCriterion("vip_phone is not null"); return (Criteria) this; } public Criteria andVipPhoneEqualTo(String value) { addCriterion("vip_phone =", value, "vipPhone"); return (Criteria) this; } public Criteria andVipPhoneNotEqualTo(String value) { addCriterion("vip_phone <>", value, "vipPhone"); return (Criteria) this; } public Criteria andVipPhoneGreaterThan(String value) { addCriterion("vip_phone >", value, "vipPhone"); return (Criteria) this; } public Criteria andVipPhoneGreaterThanOrEqualTo(String value) { addCriterion("vip_phone >=", value, "vipPhone"); return (Criteria) this; } public Criteria andVipPhoneLessThan(String value) { addCriterion("vip_phone <", value, "vipPhone"); return (Criteria) this; } public Criteria andVipPhoneLessThanOrEqualTo(String value) { addCriterion("vip_phone <=", value, "vipPhone"); return (Criteria) this; } public Criteria andVipPhoneLike(String value) { addCriterion("vip_phone like", value, "vipPhone"); return (Criteria) this; } public Criteria andVipPhoneNotLike(String value) { addCriterion("vip_phone not like", value, "vipPhone"); return (Criteria) this; } public Criteria andVipPhoneIn(List<String> values) { addCriterion("vip_phone in", values, "vipPhone"); return (Criteria) this; } public Criteria andVipPhoneNotIn(List<String> values) { addCriterion("vip_phone not in", values, "vipPhone"); return (Criteria) this; } public Criteria andVipPhoneBetween(String value1, String value2) { addCriterion("vip_phone between", value1, value2, "vipPhone"); return (Criteria) this; } public Criteria andVipPhoneNotBetween(String value1, String value2) { addCriterion("vip_phone not between", value1, value2, "vipPhone"); return (Criteria) this; } public Criteria andVipNameIsNull() { addCriterion("vip_name is null"); return (Criteria) this; } public Criteria andVipNameIsNotNull() { addCriterion("vip_name is not null"); return (Criteria) this; } public Criteria andVipNameEqualTo(String value) { addCriterion("vip_name =", value, "vipName"); return (Criteria) this; } public Criteria andVipNameNotEqualTo(String value) { addCriterion("vip_name <>", value, "vipName"); return (Criteria) this; } public Criteria andVipNameGreaterThan(String value) { addCriterion("vip_name >", value, "vipName"); return (Criteria) this; } public Criteria andVipNameGreaterThanOrEqualTo(String value) { addCriterion("vip_name >=", value, "vipName"); return (Criteria) this; } public Criteria andVipNameLessThan(String value) { addCriterion("vip_name <", value, "vipName"); return (Criteria) this; } public Criteria andVipNameLessThanOrEqualTo(String value) { addCriterion("vip_name <=", value, "vipName"); return (Criteria) this; } public Criteria andVipNameLike(String value) { addCriterion("vip_name like", value, "vipName"); return (Criteria) this; } public Criteria andVipNameNotLike(String value) { addCriterion("vip_name not like", value, "vipName"); return (Criteria) this; } public Criteria andVipNameIn(List<String> values) { addCriterion("vip_name in", values, "vipName"); return (Criteria) this; } public Criteria andVipNameNotIn(List<String> values) { addCriterion("vip_name not in", values, "vipName"); return (Criteria) this; } public Criteria andVipNameBetween(String value1, String value2) { addCriterion("vip_name between", value1, value2, "vipName"); return (Criteria) this; } public Criteria andVipNameNotBetween(String value1, String value2) { addCriterion("vip_name not between", value1, value2, "vipName"); return (Criteria) this; } public Criteria andVipPwdIsNull() { addCriterion("vip_pwd is null"); return (Criteria) this; } public Criteria andVipPwdIsNotNull() { addCriterion("vip_pwd is not null"); return (Criteria) this; } public Criteria andVipPwdEqualTo(String value) { addCriterion("vip_pwd =", value, "vipPwd"); return (Criteria) this; } public Criteria andVipPwdNotEqualTo(String value) { addCriterion("vip_pwd <>", value, "vipPwd"); return (Criteria) this; } public Criteria andVipPwdGreaterThan(String value) { addCriterion("vip_pwd >", value, "vipPwd"); return (Criteria) this; } public Criteria andVipPwdGreaterThanOrEqualTo(String value) { addCriterion("vip_pwd >=", value, "vipPwd"); return (Criteria) this; } public Criteria andVipPwdLessThan(String value) { addCriterion("vip_pwd <", value, "vipPwd"); return (Criteria) this; } public Criteria andVipPwdLessThanOrEqualTo(String value) { addCriterion("vip_pwd <=", value, "vipPwd"); return (Criteria) this; } public Criteria andVipPwdLike(String value) { addCriterion("vip_pwd like", value, "vipPwd"); return (Criteria) this; } public Criteria andVipPwdNotLike(String value) { addCriterion("vip_pwd not like", value, "vipPwd"); return (Criteria) this; } public Criteria andVipPwdIn(List<String> values) { addCriterion("vip_pwd in", values, "vipPwd"); return (Criteria) this; } public Criteria andVipPwdNotIn(List<String> values) { addCriterion("vip_pwd not in", values, "vipPwd"); return (Criteria) this; } public Criteria andVipPwdBetween(String value1, String value2) { addCriterion("vip_pwd between", value1, value2, "vipPwd"); return (Criteria) this; } public Criteria andVipPwdNotBetween(String value1, String value2) { addCriterion("vip_pwd not between", value1, value2, "vipPwd"); return (Criteria) this; } public Criteria andVipProvinceIsNull() { addCriterion("vip_province is null"); return (Criteria) this; } public Criteria andVipProvinceIsNotNull() { addCriterion("vip_province is not null"); return (Criteria) this; } public Criteria andVipProvinceEqualTo(String value) { addCriterion("vip_province =", value, "vipProvince"); return (Criteria) this; } public Criteria andVipProvinceNotEqualTo(String value) { addCriterion("vip_province <>", value, "vipProvince"); return (Criteria) this; } public Criteria andVipProvinceGreaterThan(String value) { addCriterion("vip_province >", value, "vipProvince"); return (Criteria) this; } public Criteria andVipProvinceGreaterThanOrEqualTo(String value) { addCriterion("vip_province >=", value, "vipProvince"); return (Criteria) this; } public Criteria andVipProvinceLessThan(String value) { addCriterion("vip_province <", value, "vipProvince"); return (Criteria) this; } public Criteria andVipProvinceLessThanOrEqualTo(String value) { addCriterion("vip_province <=", value, "vipProvince"); return (Criteria) this; } public Criteria andVipProvinceLike(String value) { addCriterion("vip_province like", value, "vipProvince"); return (Criteria) this; } public Criteria andVipProvinceNotLike(String value) { addCriterion("vip_province not like", value, "vipProvince"); return (Criteria) this; } public Criteria andVipProvinceIn(List<String> values) { addCriterion("vip_province in", values, "vipProvince"); return (Criteria) this; } public Criteria andVipProvinceNotIn(List<String> values) { addCriterion("vip_province not in", values, "vipProvince"); return (Criteria) this; } public Criteria andVipProvinceBetween(String value1, String value2) { addCriterion("vip_province between", value1, value2, "vipProvince"); return (Criteria) this; } public Criteria andVipProvinceNotBetween(String value1, String value2) { addCriterion("vip_province not between", value1, value2, "vipProvince"); return (Criteria) this; } public Criteria andVipCityIsNull() { addCriterion("vip_city is null"); return (Criteria) this; } public Criteria andVipCityIsNotNull() { addCriterion("vip_city is not null"); return (Criteria) this; } public Criteria andVipCityEqualTo(String value) { addCriterion("vip_city =", value, "vipCity"); return (Criteria) this; } public Criteria andVipCityNotEqualTo(String value) { addCriterion("vip_city <>", value, "vipCity"); return (Criteria) this; } public Criteria andVipCityGreaterThan(String value) { addCriterion("vip_city >", value, "vipCity"); return (Criteria) this; } public Criteria andVipCityGreaterThanOrEqualTo(String value) { addCriterion("vip_city >=", value, "vipCity"); return (Criteria) this; } public Criteria andVipCityLessThan(String value) { addCriterion("vip_city <", value, "vipCity"); return (Criteria) this; } public Criteria andVipCityLessThanOrEqualTo(String value) { addCriterion("vip_city <=", value, "vipCity"); return (Criteria) this; } public Criteria andVipCityLike(String value) { addCriterion("vip_city like", value, "vipCity"); return (Criteria) this; } public Criteria andVipCityNotLike(String value) { addCriterion("vip_city not like", value, "vipCity"); return (Criteria) this; } public Criteria andVipCityIn(List<String> values) { addCriterion("vip_city in", values, "vipCity"); return (Criteria) this; } public Criteria andVipCityNotIn(List<String> values) { addCriterion("vip_city not in", values, "vipCity"); return (Criteria) this; } public Criteria andVipCityBetween(String value1, String value2) { addCriterion("vip_city between", value1, value2, "vipCity"); return (Criteria) this; } public Criteria andVipCityNotBetween(String value1, String value2) { addCriterion("vip_city not between", value1, value2, "vipCity"); return (Criteria) this; } public Criteria andVipRegionIsNull() { addCriterion("vip_region is null"); return (Criteria) this; } public Criteria andVipRegionIsNotNull() { addCriterion("vip_region is not null"); return (Criteria) this; } public Criteria andVipRegionEqualTo(String value) { addCriterion("vip_region =", value, "vipRegion"); return (Criteria) this; } public Criteria andVipRegionNotEqualTo(String value) { addCriterion("vip_region <>", value, "vipRegion"); return (Criteria) this; } public Criteria andVipRegionGreaterThan(String value) { addCriterion("vip_region >", value, "vipRegion"); return (Criteria) this; } public Criteria andVipRegionGreaterThanOrEqualTo(String value) { addCriterion("vip_region >=", value, "vipRegion"); return (Criteria) this; } public Criteria andVipRegionLessThan(String value) { addCriterion("vip_region <", value, "vipRegion"); return (Criteria) this; } public Criteria andVipRegionLessThanOrEqualTo(String value) { addCriterion("vip_region <=", value, "vipRegion"); return (Criteria) this; } public Criteria andVipRegionLike(String value) { addCriterion("vip_region like", value, "vipRegion"); return (Criteria) this; } public Criteria andVipRegionNotLike(String value) { addCriterion("vip_region not like", value, "vipRegion"); return (Criteria) this; } public Criteria andVipRegionIn(List<String> values) { addCriterion("vip_region in", values, "vipRegion"); return (Criteria) this; } public Criteria andVipRegionNotIn(List<String> values) { addCriterion("vip_region not in", values, "vipRegion"); return (Criteria) this; } public Criteria andVipRegionBetween(String value1, String value2) { addCriterion("vip_region between", value1, value2, "vipRegion"); return (Criteria) this; } public Criteria andVipRegionNotBetween(String value1, String value2) { addCriterion("vip_region not between", value1, value2, "vipRegion"); return (Criteria) this; } public Criteria andVipStreetIsNull() { addCriterion("vip_street is null"); return (Criteria) this; } public Criteria andVipStreetIsNotNull() { addCriterion("vip_street is not null"); return (Criteria) this; } public Criteria andVipStreetEqualTo(String value) { addCriterion("vip_street =", value, "vipStreet"); return (Criteria) this; } public Criteria andVipStreetNotEqualTo(String value) { addCriterion("vip_street <>", value, "vipStreet"); return (Criteria) this; } public Criteria andVipStreetGreaterThan(String value) { addCriterion("vip_street >", value, "vipStreet"); return (Criteria) this; } public Criteria andVipStreetGreaterThanOrEqualTo(String value) { addCriterion("vip_street >=", value, "vipStreet"); return (Criteria) this; } public Criteria andVipStreetLessThan(String value) { addCriterion("vip_street <", value, "vipStreet"); return (Criteria) this; } public Criteria andVipStreetLessThanOrEqualTo(String value) { addCriterion("vip_street <=", value, "vipStreet"); return (Criteria) this; } public Criteria andVipStreetLike(String value) { addCriterion("vip_street like", value, "vipStreet"); return (Criteria) this; } public Criteria andVipStreetNotLike(String value) { addCriterion("vip_street not like", value, "vipStreet"); return (Criteria) this; } public Criteria andVipStreetIn(List<String> values) { addCriterion("vip_street in", values, "vipStreet"); return (Criteria) this; } public Criteria andVipStreetNotIn(List<String> values) { addCriterion("vip_street not in", values, "vipStreet"); return (Criteria) this; } public Criteria andVipStreetBetween(String value1, String value2) { addCriterion("vip_street between", value1, value2, "vipStreet"); return (Criteria) this; } public Criteria andVipStreetNotBetween(String value1, String value2) { addCriterion("vip_street not between", value1, value2, "vipStreet"); return (Criteria) this; } public Criteria andVipTurnoverIsNull() { addCriterion("vip_turnover is null"); return (Criteria) this; } public Criteria andVipTurnoverIsNotNull() { addCriterion("vip_turnover is not null"); return (Criteria) this; } public Criteria andVipTurnoverEqualTo(Integer value) { addCriterion("vip_turnover =", value, "vipTurnover"); return (Criteria) this; } public Criteria andVipTurnoverNotEqualTo(Integer value) { addCriterion("vip_turnover <>", value, "vipTurnover"); return (Criteria) this; } public Criteria andVipTurnoverGreaterThan(Integer value) { addCriterion("vip_turnover >", value, "vipTurnover"); return (Criteria) this; } public Criteria andVipTurnoverGreaterThanOrEqualTo(Integer value) { addCriterion("vip_turnover >=", value, "vipTurnover"); return (Criteria) this; } public Criteria andVipTurnoverLessThan(Integer value) { addCriterion("vip_turnover <", value, "vipTurnover"); return (Criteria) this; } public Criteria andVipTurnoverLessThanOrEqualTo(Integer value) { addCriterion("vip_turnover <=", value, "vipTurnover"); return (Criteria) this; } public Criteria andVipTurnoverIn(List<Integer> values) { addCriterion("vip_turnover in", values, "vipTurnover"); return (Criteria) this; } public Criteria andVipTurnoverNotIn(List<Integer> values) { addCriterion("vip_turnover not in", values, "vipTurnover"); return (Criteria) this; } public Criteria andVipTurnoverBetween(Integer value1, Integer value2) { addCriterion("vip_turnover between", value1, value2, "vipTurnover"); return (Criteria) this; } public Criteria andVipTurnoverNotBetween(Integer value1, Integer value2) { addCriterion("vip_turnover not between", value1, value2, "vipTurnover"); return (Criteria) this; } public Criteria andTransactionPriceIsNull() { addCriterion("transaction_price is null"); return (Criteria) this; } public Criteria andTransactionPriceIsNotNull() { addCriterion("transaction_price is not null"); return (Criteria) this; } public Criteria andTransactionPriceEqualTo(Double value) { addCriterion("transaction_price =", value, "transactionPrice"); return (Criteria) this; } public Criteria andTransactionPriceNotEqualTo(Double value) { addCriterion("transaction_price <>", value, "transactionPrice"); return (Criteria) this; } public Criteria andTransactionPriceGreaterThan(Double value) { addCriterion("transaction_price >", value, "transactionPrice"); return (Criteria) this; } public Criteria andTransactionPriceGreaterThanOrEqualTo(Double value) { addCriterion("transaction_price >=", value, "transactionPrice"); return (Criteria) this; } public Criteria andTransactionPriceLessThan(Double value) { addCriterion("transaction_price <", value, "transactionPrice"); return (Criteria) this; } public Criteria andTransactionPriceLessThanOrEqualTo(Double value) { addCriterion("transaction_price <=", value, "transactionPrice"); return (Criteria) this; } public Criteria andTransactionPriceIn(List<Double> values) { addCriterion("transaction_price in", values, "transactionPrice"); return (Criteria) this; } public Criteria andTransactionPriceNotIn(List<Double> values) { addCriterion("transaction_price not in", values, "transactionPrice"); return (Criteria) this; } public Criteria andTransactionPriceBetween(Double value1, Double value2) { addCriterion("transaction_price between", value1, value2, "transactionPrice"); return (Criteria) this; } public Criteria andTransactionPriceNotBetween(Double value1, Double value2) { addCriterion("transaction_price not between", value1, value2, "transactionPrice"); return (Criteria) this; } public Criteria andBalanceIsNull() { addCriterion("balance is null"); return (Criteria) this; } public Criteria andBalanceIsNotNull() { addCriterion("balance is not null"); return (Criteria) this; } public Criteria andBalanceEqualTo(Double value) { addCriterion("balance =", value, "balance"); return (Criteria) this; } public Criteria andBalanceNotEqualTo(Double value) { addCriterion("balance <>", value, "balance"); return (Criteria) this; } public Criteria andBalanceGreaterThan(Double value) { addCriterion("balance >", value, "balance"); return (Criteria) this; } public Criteria andBalanceGreaterThanOrEqualTo(Double value) { addCriterion("balance >=", value, "balance"); return (Criteria) this; } public Criteria andBalanceLessThan(Double value) { addCriterion("balance <", value, "balance"); return (Criteria) this; } public Criteria andBalanceLessThanOrEqualTo(Double value) { addCriterion("balance <=", value, "balance"); return (Criteria) this; } public Criteria andBalanceIn(List<Double> values) { addCriterion("balance in", values, "balance"); return (Criteria) this; } public Criteria andBalanceNotIn(List<Double> values) { addCriterion("balance not in", values, "balance"); return (Criteria) this; } public Criteria andBalanceBetween(Double value1, Double value2) { addCriterion("balance between", value1, value2, "balance"); return (Criteria) this; } public Criteria andBalanceNotBetween(Double value1, Double value2) { addCriterion("balance not between", value1, value2, "balance"); return (Criteria) this; } public Criteria andIntegralIsNull() { addCriterion("integral is null"); return (Criteria) this; } public Criteria andIntegralIsNotNull() { addCriterion("integral is not null"); return (Criteria) this; } public Criteria andIntegralEqualTo(Integer value) { addCriterion("integral =", value, "integral"); return (Criteria) this; } public Criteria andIntegralNotEqualTo(Integer value) { addCriterion("integral <>", value, "integral"); return (Criteria) this; } public Criteria andIntegralGreaterThan(Integer value) { addCriterion("integral >", value, "integral"); return (Criteria) this; } public Criteria andIntegralGreaterThanOrEqualTo(Integer value) { addCriterion("integral >=", value, "integral"); return (Criteria) this; } public Criteria andIntegralLessThan(Integer value) { addCriterion("integral <", value, "integral"); return (Criteria) this; } public Criteria andIntegralLessThanOrEqualTo(Integer value) { addCriterion("integral <=", value, "integral"); return (Criteria) this; } public Criteria andIntegralIn(List<Integer> values) { addCriterion("integral in", values, "integral"); return (Criteria) this; } public Criteria andIntegralNotIn(List<Integer> values) { addCriterion("integral not in", values, "integral"); return (Criteria) this; } public Criteria andIntegralBetween(Integer value1, Integer value2) { addCriterion("integral between", value1, value2, "integral"); return (Criteria) this; } public Criteria andIntegralNotBetween(Integer value1, Integer value2) { addCriterion("integral not between", value1, value2, "integral"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
ffd6879b169f14a73a19edcaeff227ff37e66a85
a93563e44f22aaba200d12534a4b07ebdaed803e
/src/dnd/logic/enemies/Enemy.java
946a22a96cd7712a360f1812b9b8da6246dd9619
[]
no_license
boaz23/oosd-assignment3
daa0733256d86b7cbaeb90812afe96fe22f408d5
ca0cbb28c12875c7695b398becdbc361a560ca94
refs/heads/master
2023-06-20T09:31:58.490346
2021-07-21T15:20:54
2021-07-21T15:20:54
186,615,948
0
0
null
null
null
null
UTF-8
Java
false
false
2,929
java
package dnd.logic.enemies; import dnd.cli.view.GameEventObserver; import dnd.dto.units.EnemyDTO; import dnd.logic.DeathObserver; import dnd.logic.GameException; import dnd.logic.MoveResult; import dnd.logic.player.Player; import dnd.logic.tileOccupiers.TileVisitor; import dnd.logic.tileOccupiers.Unit; /** * Base class for all enemies in the game */ public abstract class Enemy extends Unit { int experienceValue; char tile; Enemy(String name, int healthPool, int attack, int defense, int experienceValue, char tile) { super(name, healthPool, attack, defense); init(experienceValue, tile); } private void init(int experienceValue, char tile) { if (experienceValue < 0) { throw new IllegalArgumentException("experienceValue must be a non-negative number."); } if (tile == '\0') { throw new IllegalArgumentException("the tile must be a valid character."); } this.experienceValue = experienceValue; this.tile = tile; } public int getExperienceValue() { return experienceValue; } /** * Used to get the tile char for the factory map when loading a level * @return */ public char getTileChar() { return tile; } @Override public char toTileChar() { return tile; } @Override public MoveResult accept(TileVisitor visitor) throws GameException { return visitor.visit(this); } @Override public MoveResult visit(Enemy enemy) { return MoveResult.Invalid; } @Override public MoveResult visit(Player player) throws GameException { callEngageObservers(player); return meleeAttack(player) ? MoveResult.Dead : MoveResult.Engaged; } @Override public boolean defend(Unit attacker, int damage) throws GameException { boolean died = super.defend(attacker, damage); if (died) { callDeathObservers(); callOnEnemyDeathObservers(); } return died; } @Override public abstract Enemy clone(); @Override public EnemyDTO createDTO() { EnemyDTO enemyDTO = new EnemyDTO(); fillUnitDtoFields(enemyDTO); return enemyDTO; } @Override public String toString() { return getTileChar() + ", " + name; } private void callOnEnemyDeathObservers() { for (GameEventObserver observer : gameEventObservers) { observer.onEnemyDeath(createDTO()); } } void callEngageObservers(Player player) { for (GameEventObserver observer : gameEventObservers) { observer.onEnemyEngage(createDTO(), player.createDTO()); } } private void callDeathObservers() throws GameException { for (DeathObserver observer : deathObservers) { observer.onDeath(this); } } }
93f4e9419fd3bd092d36a727e4af7670e047b0c5
73626f6a22a63ac8650099ab05d4fd0a644252e6
/src/MementoPattern/CareTaker.java
b49a98827cb89b1d802f052abb89bf7b67ee8bf2
[]
no_license
XiaobingBenYu/DesignPatterns
c273699923bbd9a7e9abf527d42f44650a016fc9
6ade74eaf370dbc4921cde21d73741b41c9049ce
refs/heads/master
2016-09-01T19:48:29.794022
2015-07-22T06:18:11
2015-07-22T06:18:11
39,488,566
0
0
null
null
null
null
UTF-8
Java
false
false
368
java
package MementoPattern; import java.util.ArrayList; import java.util.List; /** * Created by Ben Yu on 4/10/15. */ public class CareTaker { private List<Memento> mementoList = new ArrayList<Memento>(); public void add(Memento state) { mementoList.add(state); } public Memento get(int index) { return mementoList.get(index); } }
cf0fa717fad9ebd270794159f46ea4e6b80f8418
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/7/7_1ccbe15d087518d793bdef5a4563f2c937b22ebb/MethodJavaDocGenerator/7_1ccbe15d087518d793bdef5a4563f2c937b22ebb_MethodJavaDocGenerator_s.java
cfb3220662116c1a98dae41fe8491a00f866b85d
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
2,575
java
package com.github.ideajavadocs.generator.impl; import com.github.ideajavadocs.generator.JavaDocGenerator; import com.intellij.psi.*; import com.intellij.psi.javadoc.PsiDocComment; public class MethodJavaDocGenerator implements JavaDocGenerator<PsiMethod> { @Override public PsiDocComment generate(PsiMethod element, boolean replace) { PsiDocComment oldDocComment = null; if (element.getFirstChild() instanceof PsiDocComment) { oldDocComment = (PsiDocComment) element.getFirstChild(); } if (oldDocComment != null) { // TODO merge or replace javadoc } String name = element.getName(); PsiParameterList parameterList = element.getParameterList(); PsiType returnType = element.getReturnType(); PsiClassType[] throwsList = element.getThrowsList().getReferencedTypes(); boolean isConstructor = element.isConstructor(); StringBuilder result = new StringBuilder(); result .append("/**\n") .append("* The ") .append(name); if (isConstructor) { result.append(" constructor\n"); } else { result.append(" method\n"); } result.append(".\n"); result.append("*\n"); if (parameterList.getParametersCount() > 0) { for (PsiParameter parameter : parameterList.getParameters()) { String paramType = parameter.getType().getCanonicalText(); result.append("* @param ") .append(parameter.getName()) .append(" the ") .append(paramType) .append("\n"); } } if (returnType != null && !returnType.isAssignableFrom(PsiType.VOID)) { result.append("* @return ") .append(returnType.getCanonicalText()) .append("\n"); } if (throwsList.length > 0) { for (PsiClassType throwsType : throwsList) { result.append("* @throws") .append(throwsType.getCanonicalText()) .append("\n"); } } result.append("*/\n"); PsiElementFactory psiElementFactory = PsiElementFactory.SERVICE.getInstance(element.getProject()); PsiDocComment docElement = psiElementFactory.createDocCommentFromText(result.toString()); return docElement; } }
f8f929e4dd024f3301b2e7b245593b75fcbb72f0
3e1582a333a81251ac8fa695abbde5dbeb30f372
/mybatis5/src/main/java/com/ray/mybatis/mapper/ComboMapper.java
a2aa3fe63579512e74f1b141ad279ebfb92179ba
[]
no_license
leuher/SpringBoot-Mybatis
fbcd922072f7df6646ab5faef48699a4a3f41a04
682b95283e1f650e4ac5e95593ab100fb6793fd8
refs/heads/master
2023-03-16T19:38:07.651056
2018-07-09T01:34:32
2018-07-09T01:34:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
277
java
package com.ray.mybatis.mapper; import com.ray.mybatis.entity.Combo; /** * @author Ray * @date 2018/7/7 0007 * 数据操作层 */ public interface ComboMapper { /** * 根据id查询运营商拥有的用户 */ public Combo selectUserById(Integer id); }
fefcc05d018a91b76c559350e21c52d97db8a4f9
4e32c41349335277f95babcf63b66b488906c505
/src/main/java/com/topjoy/omtools/modules/currentInterface/util/UploadExcel.java
9b8339c1083995cbcf850a822f3fbb2bc69fd1ef
[]
no_license
1346404847/toolsSpringDemo
1887cee940a74de4ff911efbfdf98c8eb50bc7d1
4d142e283dc464fff4ab331bc388689cf4150ee7
refs/heads/master
2020-03-28T05:14:13.838491
2018-09-07T03:17:03
2018-09-07T03:17:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,933
java
package com.topjoy.omtools.modules.currentInterface.util; import com.topjoy.omtools.common.entity.Result; import com.topjoy.omtools.common.util.ResultCode; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.io.IOException; import java.util.Date; import java.util.HashMap; import java.util.Map; /** * 文件上传工具 */ @RestController @RequestMapping(value = "/upload-excel") public class UploadExcel { @Value("${fileuploadpath}") private String fileUploadPath; @CrossOrigin(methods = { RequestMethod.OPTIONS,RequestMethod.POST,RequestMethod.GET }) @PostMapping(value = "/upload-file") public Result getUploadFilePath(@RequestParam(value = "excelfile",required = false) MultipartFile file) { Map<String,Object> map = new HashMap<>(); /**----上传文件start-----**/ if (file.isEmpty()) { return Result.failure(ResultCode.DATA_UPLOAD_EMPTY,null); } // 获取文件名 String fileName = file.getOriginalFilename(); // 获取文件的后缀名 String suffixName = fileName.substring(fileName.lastIndexOf(".")); Long format = new Date().getTime(); //设置新的文件名字 String newFileName = "omtool_"+format+suffixName; //设置文件上传后的路径 String filePath = fileUploadPath; File dest = new File(filePath + newFileName); if (!dest.getParentFile().exists()) { if(!dest.getParentFile().mkdirs()){ return Result.failure(ResultCode.DATA_UPLOAD_PATH,null); } } try { file.transferTo(dest); // 转存文件 } catch (IOException e) { e.printStackTrace(); } return Result.success(newFileName); } }
53abbea6547b810c122024429606ac97a7b5bc81
5f88f3eb18d9e9afc3628fc285450fc408ffdfb7
/app/src/main/java/com/software/digitals/layoutpractice/MainActivity.java
5e50acf50b7f13e8619cfc35bc836fa0c232ca6c
[]
no_license
mitcho85/LayoutPractice
cfd4e2ee1b1d25febc09db7045f5646499e7fccd
7c3637b1e83ca044d06d4038c305d6ace3614d34
refs/heads/master
2021-08-30T12:30:39.405685
2017-12-18T00:15:43
2017-12-18T00:15:43
114,574,846
0
0
null
null
null
null
UTF-8
Java
false
false
1,195
java
package com.software.digitals.layoutpractice; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.widget.ImageView; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageView mImageView = findViewById(R.id.mitchCircle); final AlphaAnimation alphaAnimation = new AlphaAnimation(0F, 1F); alphaAnimation.setDuration(1000); setupAnimation(mImageView, alphaAnimation); } private void setupAnimation(ImageView view, final Animation animation) { view.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // If the button is checked, load the animation from the given resource // id instead of using the passed-in animation paramter. See the xml files // for the details on those animations. v.startAnimation(animation); } }); } }
2cbe33ed48731027f265dd12f071e621b6480150
c20e0743fdb0e0259d193a663a5ba1501e7d19e5
/src/cn/edu/zjut/dao/BaseHibernateDAO.java
9568b46845d375b2b4942b792fb88fff6d506cd5
[]
no_license
strehl-st/LSS
3aeba728a69d512598c2c8f8a3ef8e921c466fdf
cf6f592c47bf8b879aa5dbe9a33f4cc64a33ecd2
refs/heads/main
2023-02-05T00:16:23.794458
2020-12-24T13:03:16
2020-12-24T13:03:16
324,155,269
0
0
null
null
null
null
UTF-8
Java
false
false
351
java
package cn.edu.zjut.dao; import org.hibernate.Session; import org.hibernate.SessionFactory; public class BaseHibernateDAO{ private SessionFactory sessionFactory; public Session getSession(){ return sessionFactory.openSession(); } public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } }
be886766bcf281821f72715828e1d83223cdb8e5
2ba4035ad7d9179e04c8c45d064b3defa68a023a
/app/src/main/java/org/themoviedb/api/v3/schemes/MovieReviewsPage.java
04074feeadd49eb7a0e93de596457a1d80f07b74
[]
no_license
brolam/PopularMovies
afce7bddabf887cfee545f1b24c92f1d461e4545
76f686511a85df83ebf3566b34fcd265511028cf
refs/heads/master
2021-01-11T10:21:29.337785
2016-11-12T16:54:53
2016-11-12T16:54:53
72,311,692
0
0
null
null
null
null
UTF-8
Java
false
false
828
java
package org.themoviedb.api.v3.schemes; import org.json.JSONException; import org.json.JSONObject; import org.themoviedb.api.v3.schemes.base.PageBase; /** * Representa uma ou mais páginas com revisões recuperadas na api do TheMovieDd, veja https://developers.themoviedb.org/3/movies/get-movie-reviews. * @see PageBase * @author Breno Marques * @version 1.00 * @since Release 03 */ public class MovieReviewsPage extends PageBase<MovieReview> { public MovieReviewsPage(){ super(); } public MovieReviewsPage(String jsonString) throws JSONException { super(jsonString); } public MovieReviewsPage(Exception e) { super(e); } @Override public MovieReview getNewItem(JSONObject jsonObject) throws JSONException { return new MovieReview(jsonObject); } }
d5d1fcfec9c8f4c0125c6450a63b34b455b976a9
139eb6d772a319388044df3a800b35a98cb6f73d
/app.web/src/main/java/com/web/controller/CommisionLevelController.java
b17a9139359c0539f44a0d79e4c3d84e82be44d1
[]
no_license
spkhillar/JBS
6ff7a52fd703a4075228d2f89bd6a8c88a54d8e9
a095cfcfcff72fa45d4cb0194a55dd4d9528eb50
refs/heads/master
2016-09-05T14:25:35.298898
2013-10-18T23:33:02
2013-10-18T23:33:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,511
java
package com.web.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import com.jpa.entities.CommisionLevel; import com.service.CommisionLevelService; import com.web.util.DomainObjectMapper; import com.web.util.JqGridResponse; @Controller @RequestMapping(value = "/commission") public class CommisionLevelController extends BaseAuthenticatedController { @Autowired private CommisionLevelService commisionLevelService; @RequestMapping(value = "/list", method = RequestMethod.GET) public String listCommission() { return "admin.list.commission"; } @RequestMapping(value = "/records", produces = "application/json") public @ResponseBody JqGridResponse<CommisionLevel> records(@RequestParam("_search") final Boolean search, @RequestParam(value = "filters", required = false) final String filters, @RequestParam(value = "page", required = false) final Integer page, @RequestParam(value = "rows", required = false) final Integer rows, @RequestParam(value = "sidx", required = false) final String sidx, @RequestParam(value = "sord", required = false) final String sord) { Page<CommisionLevel> commisionLevels = null; if (search == true) { commisionLevels = commisionLevelService.findAll(page, rows, sord, sidx); } else { commisionLevels = commisionLevelService.findAll(page, rows, sord, sidx); } List<Object> list = DomainObjectMapper.listEntities(commisionLevels); JqGridResponse<CommisionLevel> response = new JqGridResponse<CommisionLevel>(); response.setRows(list); response.setRecords(Long.valueOf(commisionLevels.getTotalElements()).toString()); response.setTotal(Integer.valueOf(commisionLevels.getTotalPages()).toString()); response.setPage(Integer.valueOf(commisionLevels.getNumber() + 1).toString()); return response; } @RequestMapping(value = "/update", method = RequestMethod.POST) @ResponseBody public String updateCommission(CommisionLevel commisionLevel) { commisionLevelService.update(commisionLevel); return "updated"; } }
60b83b937b500f05abeb0a087c478d2a6135f2ee
296957e3d37ad77913a19d5bcd1ffc6e0c247f2a
/src/com/neusoft/mapper/RoleInfoMapper.java
427d1e4104d7b1739e5997c1f1e3a2f9db928007
[]
no_license
margaret-77/-
a0a3e8f92d4194db95e6c76b0744dcdd5eee8e39
8d6aad31a3ad32dccb027bac8eaaf10c1ed2ea1d
refs/heads/master
2022-08-09T02:33:16.808896
2020-05-22T05:03:47
2020-05-22T05:03:47
265,307,970
0
0
null
null
null
null
GB18030
Java
false
false
572
java
package com.neusoft.mapper; import java.util.List; import java.util.Map; import com.neusoft.beans.RoleInfo; import com.neusoft.beans.RoleMenu; public interface RoleInfoMapper { public void addRole(RoleInfo role); //增加角色 public List<RoleInfo> getAllRole();//查询所有角色 public List<RoleMenu> getRoleMenuId(int roleId); //查询 角色对应的所有菜单 public void delRoleMenu(int roleId); //删除角色对应的菜单 public void addRoleMenu(Map<Object,Object> map); //增加角色和对应的菜单 [int roleId ,int menuId] }
b53a29376b68aa29a2f1187cf623152bcc41bf4d
38cfd76d398a2fe89cd5b91e0134dd453c1be425
/src/main/java/com/example/app/ExcelReader.java
8cbfcb0577f1aff40501e728dfe02b2fd2c2699d
[]
no_license
NikhilSinghal85/StockExchange
c2759e125694f243c749a320ef28d1fb52358727
b84889e316370926d40a443b9510a1c2463eb3ac
refs/heads/master
2020-04-15T11:37:57.713530
2019-03-07T09:13:13
2019-03-07T09:13:13
164,638,094
1
0
null
null
null
null
UTF-8
Java
false
false
1,754
java
package com.example.app; import org.apache.poi.ss.usermodel.*; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Iterator; public class ExcelReader { private static final String FILE_NAME = "C:\\Users\\nikhil.singhal\\Desktop\\Example.xlsx"; public static void main(String[] args) { try { FileInputStream excelFile = new FileInputStream(new File(FILE_NAME)); Workbook workbook = new XSSFWorkbook(excelFile); Sheet datatypeSheet = workbook.getSheetAt(0); Iterator<Row> iterator = datatypeSheet.iterator(); while (iterator.hasNext()) { Row currentRow = iterator.next(); Iterator<Cell> cellIterator = currentRow.iterator(); while (cellIterator.hasNext()) { Cell currentCell = cellIterator.next(); //getCellTypeEnum shown as deprecated for version 3.15 //getCellTypeEnum ill be renamed to getCellType starting from version 4.0 if (currentCell.getCellType() == CellType.STRING) { System.out.print(currentCell.getStringCellValue() + " "); } else if (currentCell.getCellType() == CellType.NUMERIC) { System.out.print(currentCell.getNumericCellValue() + " "); } } System.out.println(); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
11e5334b4e1b1bc30f6bfc965a91eb277b37c8d2
c8a6a7fc8e6c682a98547947ae638577c88d60db
/app/src/main/java/com/rearcam/receive/utils/LoadingDialogUtil.java
6dd04c3dc8e17c895eb0cd22361816e85d96871d
[]
no_license
daniel-pancorbo/SunveyTechSDK_TEST
07d6c5ef6d844b20a3ad306952680050b776c631
f8ab9eaffad75bad0484b4b14eacf02e624201c5
refs/heads/master
2023-03-21T19:20:07.233953
2021-03-11T12:56:43
2021-03-11T12:56:43
345,972,165
0
0
null
null
null
null
UTF-8
Java
false
false
541
java
package com.rearcam.receive.utils; import android.content.Context; import android.view.WindowManager; import com.rearcam.receive.R; public class LoadingDialogUtil { public static Loading createLoading(Context context, String message){ Loading loading = new Loading(context, R.style.loadingDialogTheme, message); WindowManager.LayoutParams params = loading.getWindow().getAttributes(); // params.alpha = 0.6f;// 透明度 loading.getWindow().setAttributes(params); return loading; } }
80e5cd7beb29219383df908eede67eb9aadd04ee
a13154b0d4d592a216299a1eaf20b0f7cf6bde07
/Spring-11-Rest-OpenApi3.0/src/main/java/com/cybertek/repository/AccountRepository.java
abe93c829d2c48cb34b0807396badb795a9237de
[]
no_license
qaqasazeri/JD-SpringFramework
b3c7fa5827dcac235510de7332e6764fd61672c2
1f6226ea32b1516898d7a7642d435fad3eff7b2e
refs/heads/main
2023-03-20T03:16:56.338899
2021-03-09T03:53:48
2021-03-09T03:53:48
304,900,299
0
0
null
null
null
null
UTF-8
Java
false
false
2,735
java
package com.cybertek.repository; import com.cybertek.entity.Account; import com.cybertek.enums.UserRole; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import javax.persistence.NamedNativeQuery; import java.util.List; @Repository public interface AccountRepository extends JpaRepository<Account,Long> { // ------------------- DERIVED QUERIES ------------------- // //Write a derived query to list all accounts with a specific country or state /* List<Account> findAllByCountryOrState(String country, String state); //Write a derived query to list all accounts with age lower than or equal to a specific value List<Account> findAllByAgeLessThanEqual(Integer age); //Write a derived query to list all accounts with a specific role List<Account> findAllByRole(UserRole role); //Write a derived query to list all accounts between a range of ages List<Account> findAllByAgeBetween(Integer age1, Integer age2); //Write a derived query to list all accounts where the beginning of the address contains the keyword List<Account> findAllByAddressStartingWith(String pattern); //Write a derived query to sort the list of accounts with age List<Account> findAllByOrderByAgeDesc(); // ------------------- JPQL QUERIES ------------------- // //Write a JPQL query that returns all accounts @Query("SELECT a from Account a") List<Account> fetchAllJPQL(); //Write a JPQL query to list all admin accounts @Query("SELECT a from Account a where a.role='USER'") List<Account> fetchAdminUsers(); //Write a JPQL query to sort all accounts with age @Query("SELECT a from Account a ORDER BY a.age desc ") List<Account> orderByAgeJPQL(); // ------------------- Native QUERIES ------------------- // //Write a native query to read all accounts with an age lower than a specific value @Query(value="select * from account_details WHERE age<?1",nativeQuery = true) List<Account> retrieveAllByAgeLessThan(Integer age); //Write a native query to read all accounts that a specific value can be containable in the name, address, country, state city @Query(value="select * from account_details WHERE name ILIKE concat('%',?1,'%')or country ILIKE concat('%',?1,'%') or address ILIKE concat('%',?1,'%') or stateILIKE concat('%',?1,'%')",nativeQuery = true) List<Account> retrieveBySearchCriteria(String pattern); //Write a native query to read all accounts with an age greater than a specific value @Query(value="select * from account_details WHERE age>?1",nativeQuery = true) List<Account> retrieveLessThanAge(Integer age); */ }
af42eb6988a013b5e33b8a60579a7ff45cb1931f
8e492b8d65019bbf1a5baaec8bc30752e57aa1be
/src/org/openmrs/module/restrictbyuser/extension/html/AdminList.java
273e63493c196b99fd572ef8701c50628269e6d3
[]
no_license
roseannsale/RestrictByUser
d776862ce0118368e9fb3d9844936d61d59fadb5
71e16fc1889f45044a79ca5aade93086cabeee4f
refs/heads/master
2020-03-29T10:16:56.459945
2012-12-29T04:33:43
2012-12-29T04:33:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,725
java
/** * The contents of this file are subject to the OpenMRS Public License * Version 1.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://license.openmrs.org * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. * * Copyright (C) OpenMRS, LLC. All Rights Reserved. */ package org.openmrs.module.restrictbyuser.extension.html; import java.util.HashMap; import java.util.Map; import org.openmrs.module.Extension; import org.openmrs.module.web.extension.AdministrationSectionExt; /** * This class defines the links that will appear on the administration page under the * "restrictbyuser.title" heading. This extension is enabled by defining (uncommenting) it in the * /metadata/config.xml file. */ public class AdminList extends AdministrationSectionExt { /** * @see org.openmrs.module.web.extension.AdministrationSectionExt#getMediaType() */ public Extension.MEDIA_TYPE getMediaType() { return Extension.MEDIA_TYPE.html; } /** * @see org.openmrs.module.web.extension.AdministrationSectionExt#getTitle() */ public String getTitle() { return "restrictbyuser.title"; } /** * @see org.openmrs.module.web.extension.AdministrationSectionExt#getLinks() */ public Map<String, String> getLinks() { Map<String, String> map = new HashMap<String, String>(); map.put("module/restrictbyuser/restrictbyuser.list", "restrictbyuser.link"); return map; } }
ee05e0c5d7852ae889ecec16d6aab475a7b58ef6
b1cd1bfa9a0d86497b3e3756ed8445215c62f14d
/Antons/app/src/androidTest/java/se/miun/josd1802/antons/ExampleInstrumentedTest.java
8d3aef82bb1df8df54be786fa385fe87d3720bc5
[]
no_license
Bassam1997/Applikationsutveckling-Java
16be86f51f5c17a6780119d39e459390226a2cc4
847c4f2cdc24c69e2ede53eff0e15287fc43674e
refs/heads/main
2023-03-27T23:30:39.173659
2021-03-21T18:16:22
2021-03-21T18:16:22
331,335,811
0
0
null
null
null
null
UTF-8
Java
false
false
760
java
package se.miun.josd1802.antons; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("se.miun.josd1802.antons", appContext.getPackageName()); } }
bfc366ef5610b51400215fbcef2078eb645ac89e
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/25/25_202bf7d46465a11a7188bff4b3fef91110263ca2/MetallurgyMetals/25_202bf7d46465a11a7188bff4b3fef91110263ca2_MetallurgyMetals_t.java
f37fce1dc47274cf76a65c865b9e746d1c3bfa33
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
17,318
java
package rebelkeithy.mods.metallurgy.metals; import java.io.File; import java.io.IOException; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.potion.Potion; import net.minecraft.src.ModLoader; import net.minecraftforge.common.Configuration; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; import rebelkeithy.mods.metallurgy.core.MetalInfoDatabase; import rebelkeithy.mods.metallurgy.core.MetallurgyCore; import rebelkeithy.mods.metallurgy.core.MetallurgyTabs; import rebelkeithy.mods.metallurgy.core.metalsets.ISwordHitListener; import rebelkeithy.mods.metallurgy.core.metalsets.MetalSet; import rebelkeithy.mods.metallurgy.metals.utilityItems.ItemFertilizer; import rebelkeithy.mods.metallurgy.metals.utilityItems.ItemIgniter; import rebelkeithy.mods.metallurgy.metals.utilityItems.tnt.EntityLargeTNTPrimed; import rebelkeithy.mods.metallurgy.metals.utilityItems.tnt.EntityMinersTNTPrimed; import rebelkeithy.mods.metallurgy.metals.utilityItems.tnt.BlockLargeTNT; import rebelkeithy.mods.metallurgy.metals.utilityItems.tnt.BlockMinersTNT; import rebelkeithy.mods.particleregistry.ParticleRegistry; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PostInit; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid="Metallurgy3Base", name="Metallurgy 3 Base", version="1.4.7-1.11.13-1a") @NetworkMod(channels = {"MetallurgyBase"}, clientSideRequired = true, serverSideRequired = false) public class MetallurgyMetals { public boolean isRelease = false; public static MetalSet baseSet; public static MetalSet preciousSet; public static MetalSet netherSet; public static MetalSet fantasySet; public static MetalSet enderSet; public static MetalSet utilitySet; public static MetallurgyTabs baseTab; public static MetallurgyTabs preciousTab; public static MetallurgyTabs netherTab; public static MetallurgyTabs fantasyTab; public static MetallurgyTabs enderTab; public static MetallurgyTabs utilityTab; public static Configuration baseConfig; public static Configuration utilityConfig; public static Configuration fantasyConfig; //Vanilla Items public static Item dustIron; public static Item dustGold; //Utility Items public static Item magnesiumIgniter; public static Item match; public static Item fertilizer; public static Item tar; public static Block largeTNT; public static Block minersTNT; @SidedProxy(clientSide = "rebelkeithy.mods.metallurgy.metals.ClientProxy", serverSide = "rebelkeithy.mods.metallurgy.metals.CommonProxy") public static CommonProxy proxy; @Instance(value = "Metallurgy3Base") public static MetallurgyMetals instance; public static Potion potion; @PreInit public void preInit(FMLPreInitializationEvent event) { baseConfig = initConfig("Base"); baseConfig.load(); utilityConfig = initConfig("Utility"); utilityConfig.load(); fantasyConfig = initConfig("Fantasy"); potion = new MetallurgyPotion(21, false, 8356754).setPotionName("Low Gravity"); baseTab = new MetallurgyTabs("Metallurgy: Base"); preciousTab = new MetallurgyTabs("Metallurgy: Precious"); netherTab = new MetallurgyTabs("Metallurgy: Nether"); fantasyTab = new MetallurgyTabs("Metallurgy: Fantasy"); enderTab = new MetallurgyTabs("Metallurgy: Ender"); utilityTab = new MetallurgyTabs("Metallurgy: Utility"); LanguageRegistry.instance().addStringLocalization("itemGroup.Metallurgy: Base", "Metallurgy: Base"); LanguageRegistry.instance().addStringLocalization("itemGroup.Metallurgy: Precious", "Metallurgy: Precious"); LanguageRegistry.instance().addStringLocalization("itemGroup.Metallurgy: Nether", "Metallurgy: Nether"); LanguageRegistry.instance().addStringLocalization("itemGroup.Metallurgy: Fantasy", "Metallurgy: Fantasy"); LanguageRegistry.instance().addStringLocalization("itemGroup.Metallurgy: Utility", "Metallurgy: Utility"); LanguageRegistry.instance().addStringLocalization("itemGroup.Metallurgy: Ender", "Metallurgy: Ender"); //TODO String filepath = event.getSourceFile().getAbsolutePath(); if(!isRelease) { //TODO: Note: Other users will need to point this to the directory continaning Metallurgy.jar filepath = "C:/Users/Keithy/Documents/Metallurgy 3 1.5/eclipse/Metallurgy 3/mods/Metallurgy.jar"; } MetalInfoDatabase.readMetalDataFromJar("spreadsheet.csv", filepath); MetalInfoDatabase.readItemDataFromJar(utilityConfig, "Items.csv", filepath, utilityTab); baseSet = new MetalSet("Base", MetalInfoDatabase.getSpreadsheetDataForSet("Base"), baseTab); preciousSet = new MetalSet("Precious", MetalInfoDatabase.getSpreadsheetDataForSet("Precious"), preciousTab); netherSet = new MetalSet("Nether", MetalInfoDatabase.getSpreadsheetDataForSet("Nether"), netherTab); fantasySet = new MetalSet("Fantasy", MetalInfoDatabase.getSpreadsheetDataForSet("Fantasy"), fantasyTab); enderSet = new MetalSet("Ender", MetalInfoDatabase.getSpreadsheetDataForSet("Ender"), enderTab); utilitySet = new MetalSet("Utility", MetalInfoDatabase.getSpreadsheetDataForSet("Utility"), utilityTab); } @Init public void Init(FMLInitializationEvent event) { //TODO add config for vanilla dusts dustIron = new Item(5100).setUnlocalizedName("Metallurgy:Vanilla/IronDust").setCreativeTab(CreativeTabs.tabMaterials); dustGold = new Item(5101).setUnlocalizedName("Metallurgy:Vanilla/GoldDust").setCreativeTab(CreativeTabs.tabMaterials); FurnaceRecipes.smelting().addSmelting(dustIron.itemID, 0, new ItemStack(Item.ingotIron), 0.7F); FurnaceRecipes.smelting().addSmelting(dustGold.itemID, 0, new ItemStack(Item.ingotGold), 0.7F); LanguageRegistry.addName(dustIron, "Iron Dust"); LanguageRegistry.addName(dustGold, "Gold Dust"); OreDictionary.registerOre("dustIron", dustIron); OreDictionary.registerOre("dustGold", dustGold); Item debug = new ItemOreFinder(5102).setUnlocalizedName("stick").setCreativeTab(CreativeTabs.tabTools); createUtilityItems(); utilityConfig.save(); ParticleRegistry.registerParticle("FantasyOre", EntityFantasyOreFX.class); fantasySet.getOreInfo("Astral Silver").ore.addDisplayListener(new DisplayListenerOreParticles("FantasyOre", 0.6, 0.8, 0.95)); fantasySet.getOreInfo("Carmot").ore.addDisplayListener(new DisplayListenerOreParticles("FantasyOre", 0.8, 0.8, 0.4)); fantasySet.getOreInfo("Mithril").ore.addDisplayListener(new DisplayListenerOreParticles("FantasyOre", 0.6, 0.9, 0.95)); fantasySet.getOreInfo("Orichalcum").ore.addDisplayListener(new DisplayListenerOreParticles("FantasyOre", 0.3, 0.5, 0.15)); fantasySet.getOreInfo("Adamantine").ore.addDisplayListener(new DisplayListenerOreParticles("FantasyOre", 0.5, 0.2, 0.2)); fantasySet.getOreInfo("Atlarus").ore.addDisplayListener(new DisplayListenerOreParticles("FantasyOre", 0.8, 0.8, 0.2)); ParticleRegistry.registerParticle("NetherOre", EntityNetherOreFX.class); netherSet.getOreInfo("Midasium").ore.addDisplayListener(new DisplayListenerOreParticles("NetherOre", 1.0, 0.8, 0.25)); netherSet.getOreInfo("Vyroxeres").ore.addDisplayListener(new DisplayListenerVyroxeresOreParticles()); netherSet.getOreInfo("Ceruclase").ore.addDisplayListener(new DisplayListenerOreParticles("NetherOre", 0.35, 0.6, 0.9)); netherSet.getOreInfo("Kalendrite").ore.addDisplayListener(new DisplayListenerOreParticles("NetherOre", 0.8, 0.4, 0.8)); netherSet.getOreInfo("Vulcanite").ore.addDisplayListener(new DisplayListenerVulcaniteOreParticles()); netherSet.getOreInfo("Sanguinite").ore.addDisplayListener(new DisplayListenerOreParticles("NetherOre", 0.85, 0.0, 0.0)); netherSet.getOreInfo("Vyroxeres").ore.addCollisionListener(new VyroxeresCollisionListener()); addSwordEffects(); } @PostInit public void postInit(FMLPostInitializationEvent event) { baseTab.setIconItem(baseSet.getOreInfo("Steel").helmet.itemID); preciousTab.setIconItem(preciousSet.getOreInfo("Platinum").helmet.itemID); netherTab.setIconItem(netherSet.getOreInfo("Sanguinite").helmet.itemID); fantasyTab.setIconItem(fantasySet.getOreInfo("Tartarite").helmet.itemID); enderTab.setIconItem(enderSet.getOreInfo("Desichalkos").helmet.itemID); createMidasiumRecipes(); } public void createUtilityItems() { int id = utilityConfig.get("Item IDs", "HE TNT", 920).getInt(); largeTNT = new BlockLargeTNT(id).setUnlocalizedName("M3HETNT").setCreativeTab(utilityTab); GameRegistry.registerBlock(largeTNT, "M3HETNT"); EntityRegistry.registerModEntity(EntityLargeTNTPrimed.class, "LargeTNTEntity", 113, this, 64, 10, true); LanguageRegistry.addName(largeTNT, "HE TNT"); id = utilityConfig.get("Item IDs", "LE TNT", 921).getInt(); minersTNT = new BlockMinersTNT(id).setUnlocalizedName("M3LETNT").setCreativeTab(utilityTab); GameRegistry.registerBlock(minersTNT, "M3LETNT"); EntityRegistry.registerModEntity(EntityMinersTNTPrimed.class, "MinersTNTEntity", 113, this, 64, 10, true); LanguageRegistry.addName(minersTNT, "LE TNT"); id = utilityConfig.get("Item IDs", "Magnesium Igniter", 29007).getInt(); magnesiumIgniter = new ItemIgniter(id).setUnlocalizedName("Metallurgy:Utility/Igniter").setCreativeTab(utilityTab); LanguageRegistry.addName(magnesiumIgniter, "Magnesium Igniter"); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(magnesiumIgniter), "X ", " F", 'X', "dustMagnesium", 'F', Item.flintAndSteel)); id = utilityConfig.get("Item IDs", "Match", 29008).getInt(); match = new ItemIgniter(id).setUnlocalizedName("Metallurgy:Utility/Match").setCreativeTab(utilityTab); LanguageRegistry.addName(match, "Match"); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(match), "X", "|", 'X', "dustPhosphorus", '|', Item.stick)); id = utilityConfig.get("Item IDs", "Fertilizer", 29009).getInt(); fertilizer = new ItemFertilizer(id).setUnlocalizedName("Metallurgy:Utility/Fertilizer").setCreativeTab(utilityTab); LanguageRegistry.addName(fertilizer, "Fertilizer"); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(fertilizer), "dustPhosphorus", "dustMagnesium", "dustPotash")); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(fertilizer), "dustPhosphorus", "dustMagnesium", "dustSaltpeter")); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(fertilizer), "dustPhosphorus", "dustSaltpeter", "dustPotash")); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(fertilizer), "dustSaltpeter", "dustMagnesium", "dustPotash")); OreDictionary.registerOre("itemFertilizer", fertilizer); id = utilityConfig.get("Item IDs", "Tar", 29010).getInt(); tar = new Item(id).setUnlocalizedName("Metallurgy:Utility/Tar").setCreativeTab(utilityTab); LanguageRegistry.addName(tar, "Tar"); OreDictionary.registerOre("itemTar", tar); GameRegistry.addRecipe(new ShapelessOreRecipe(Item.gunpowder, "dustSulfur", "dustSaltpeter")); GameRegistry.addRecipe(new ShapelessOreRecipe(Item.magmaCream, "itemTar", Item.blazePowder)); GameRegistry.addRecipe(new ShapedOreRecipe(Block.pistonStickyBase, "T", "P", 'T', "itemTar", 'P', Block.pistonBase)); GameRegistry.addSmelting(MetalInfoDatabase.getItem("Bitumen").itemID, new ItemStack(tar), 0.1F); utilityTab.setIconItem(fertilizer.itemID); } public Configuration initConfig(String name) { File fileDir = new File(MetallurgyCore.proxy.getMinecraftDir() + "/config/Metallurgy3"); fileDir.mkdir(); File cfgFile = new File(MetallurgyCore.proxy.getMinecraftDir() + "/config/Metallurgy3/Metallurgy" + name + ".cfg"); try { cfgFile.createNewFile(); } catch (IOException e) { System.out.println(e); } return new Configuration(cfgFile); } public void createMidasiumRecipes() { String[] ores = OreDictionary.getOreNames(); System.out.println("Searching for dust for midsasium recipes"); int count = 0; for(String name : ores) { if(name.contains("dust")) { System.out.println("Adding recipe for " + name + " midasium = gold"); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(dustGold), "dustMidasium", name)); count++; } } } public void addSwordEffects() { ISwordHitListener swordEffects = new NetherSwordHitListener(); MinecraftForge.EVENT_BUS.register(swordEffects); // Registers the on death event needed by Midasium's looting effect netherSet.getOreInfo("Ignatius").sword.addHitListener(swordEffects); netherSet.getOreInfo("Ignatius").sword.setSubText("cIgnite I"); netherSet.getOreInfo("Shadow Iron").sword.addHitListener(swordEffects); netherSet.getOreInfo("Shadow Iron").sword.setSubText("cWeakness I"); netherSet.getOreInfo("Shadow Steel").sword.addHitListener(swordEffects); netherSet.getOreInfo("Shadow Steel").sword.setSubText("7Weakness II"); // Midsium'ss effect comes from the onDeath event, not the onHit method netherSet.getOreInfo("Midasium").sword.setSubText("7Looting I"); netherSet.getOreInfo("Vyroxeres").sword.addHitListener(swordEffects); netherSet.getOreInfo("Vyroxeres").sword.setSubText("cPoison I"); netherSet.getOreInfo("Ceruclase").sword.addHitListener(swordEffects); netherSet.getOreInfo("Ceruclase").sword.setSubText("cSlowness"); netherSet.getOreInfo("Inolashite").sword.addHitListener(swordEffects); netherSet.getOreInfo("Inolashite").sword.setSubText("7Poison, Slowness"); netherSet.getOreInfo("Kalendrite").sword.addHitListener(swordEffects); netherSet.getOreInfo("Kalendrite").sword.setSubText("7Regen"); netherSet.getOreInfo("Amordrine").sword.addHitListener(swordEffects); netherSet.getOreInfo("Amordrine").sword.setSubText("7Healing"); netherSet.getOreInfo("Vulcanite").sword.addHitListener(swordEffects); netherSet.getOreInfo("Vulcanite").sword.setSubText("cIgnite II"); netherSet.getOreInfo("Sanguinite").sword.addHitListener(swordEffects); netherSet.getOreInfo("Sanguinite").sword.setSubText("cWither I"); swordEffects = new FantasySwordHitListener(); MinecraftForge.EVENT_BUS.register(swordEffects); // Registers the on death event needed by Astral Silver's and Carmot's looting effect fantasySet.getOreInfo("Deep Iron").sword.addHitListener(swordEffects); fantasySet.getOreInfo("Deep Iron").sword.setSubText("cBlindness I"); fantasySet.getOreInfo("Black Steel").sword.addHitListener(swordEffects); fantasySet.getOreInfo("Black Steel").sword.setSubText("cBlindness II"); fantasySet.getOreInfo("Oureclase").sword.addHitListener(swordEffects); fantasySet.getOreInfo("Oureclase").sword.setSubText("7Resistance I"); //fantasySet.getOreInfo("Astral Silver").sword.addHitListener(swordEffects); fantasySet.getOreInfo("Astral Silver").sword.setSubText("7Looting I"); //fantasySet.getOreInfo("Carmot").sword.addHitListener(swordEffects); fantasySet.getOreInfo("Carmot").sword.setSubText("7Looting II"); fantasySet.getOreInfo("Mithril").sword.addHitListener(swordEffects); fantasySet.getOreInfo("Mithril").sword.setSubText("7Haste I"); fantasySet.getOreInfo("Quicksilver").sword.addHitListener(swordEffects); fantasySet.getOreInfo("Quicksilver").sword.setSubText("7Speed I"); fantasySet.getOreInfo("Haderoth").sword.addHitListener(swordEffects); fantasySet.getOreInfo("Haderoth").sword.setSubText("cHaste I, Ignite II"); fantasySet.getOreInfo("Orichalcum").sword.addHitListener(swordEffects); fantasySet.getOreInfo("Orichalcum").sword.setSubText("cResistance II"); fantasySet.getOreInfo("Celenegil").sword.addHitListener(swordEffects); fantasySet.getOreInfo("Celenegil").sword.setSubText("7Resistance III"); fantasySet.getOreInfo("Adamantine").sword.addHitListener(swordEffects); fantasySet.getOreInfo("Adamantine").sword.setSubText("7Fire Resist I, Ignite II"); fantasySet.getOreInfo("Atlarus").sword.addHitListener(swordEffects); fantasySet.getOreInfo("Atlarus").sword.setSubText("7Strength II"); fantasySet.getOreInfo("Tartarite").sword.addHitListener(swordEffects); fantasySet.getOreInfo("Tartarite").sword.setSubText("cWither, Igntite II"); } }
293ce355d93403f7addd4d910d7f7581d58a1702
675574d5cb3cb989323cc9078fafd1a9a81ac602
/CTBRI_wxcc/src/com/ctbri/wxcc/shake/GetPathFromUri4kitkat.java
ec2bf4b4ae1256023031e73849ce7b3331f7a671
[ "Apache-2.0" ]
permissive
un097/wuxianchangchun
24f702ce1d8e7f763ae9762fb63606f78a33565b
cc7ffcdf171eb9463ef396e389127d69cbd18c93
refs/heads/master
2020-07-31T07:35:13.486938
2016-11-13T09:25:36
2016-11-13T09:25:36
73,606,051
1
0
null
null
null
null
UTF-8
Java
false
false
4,897
java
package com.ctbri.wxcc.shake; import android.annotation.SuppressLint; import android.content.ContentUris; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Build; import android.os.Environment; import android.provider.DocumentsContract; import android.provider.MediaStore; public class GetPathFromUri4kitkat { @SuppressLint("NewApi") public static String getPath(final Context context, final Uri uri) { final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; // DocumentProvider if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { // ExternalStorageProvider if (isExternalStorageDocument(uri)) { final String docId = DocumentsContract.getDocumentId(uri); final String[] split = docId.split(":"); final String type = split[0]; if ("primary".equalsIgnoreCase(type)) { return Environment.getExternalStorageDirectory() + "/" + split[1]; } // TODO handle non-primary volumes } // DownloadsProvider else if (isDownloadsDocument(uri)) { final String id = DocumentsContract.getDocumentId(uri); final Uri contentUri = ContentUris.withAppendedId( Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); return getDataColumn(context, contentUri, null, null); } // MediaProvider else if (isMediaDocument(uri)) { final String docId = DocumentsContract.getDocumentId(uri); final String[] split = docId.split(":"); final String type = split[0]; Uri contentUri = null; if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else if ("video".equals(type)) { contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; } else if ("audio".equals(type)) { contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; } final String selection = "_id=?"; final String[] selectionArgs = new String[] { split[1] }; return getDataColumn(context, contentUri, selection, selectionArgs); } } // MediaStore (and general) else if ("content".equalsIgnoreCase(uri.getScheme())) { return getDataColumn(context, uri, null, null); } // File else if ("file".equalsIgnoreCase(uri.getScheme())) { return uri.getPath(); } return null; } /** * Get the value of the data column for this Uri. This is useful for * MediaStore Uris, and other file-based ContentProviders. * * @param context * The context. * @param uri * The Uri to query. * @param selection * (Optional) Filter used in the query. * @param selectionArgs * (Optional) Selection arguments used in the query. * @return The value of the _data column, which is typically a file path. */ public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { Cursor cursor = null; final String column = "_data"; final String[] projection = { column }; try { cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); if (cursor != null && cursor.moveToFirst()) { final int column_index = cursor.getColumnIndexOrThrow(column); return cursor.getString(column_index); } } finally { if (cursor != null) cursor.close(); } return null; } /** * @param uri * The Uri to check. * @return Whether the Uri authority is ExternalStorageProvider. */ public static boolean isExternalStorageDocument(Uri uri) { return "com.android.externalstorage.documents".equals(uri.getAuthority()); } /** * @param uri * The Uri to check. * @return Whether the Uri authority is DownloadsProvider. */ public static boolean isDownloadsDocument(Uri uri) { return "com.android.providers.downloads.documents".equals(uri.getAuthority()); } /** * @param uri * The Uri to check. * @return Whether the Uri authority is MediaProvider. */ public static boolean isMediaDocument(Uri uri) { return "com.android.providers.media.documents".equals(uri.getAuthority()); } }
b27e635afd4eb81240bc6135c5d58dcc784b8030
b4d42f0055b3704f2688e654a687ddb6c5624431
/src/it/unimi/dsi/fastutil/longs/LongHeapIndirectPriorityQueue.java
42689247faf3e7f4f0a5bb46e2e5012ae148d1e3
[ "Apache-2.0" ]
permissive
valmac/fastutil-1
50c9ea26904d2687a5aeabfa3ebec11e7c1f4789
1eec4d37a1c9995688c7e8cac0f5cbee63f87f21
refs/heads/master
2021-05-27T09:06:47.249224
2013-04-05T20:17:32
2013-04-05T20:17:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,290
java
/* Generic definitions */ /* Assertions (useful to generate conditional code) */ /* Current type and class (and size, if applicable) */ /* Value methods */ /* Interfaces (keys) */ /* Interfaces (values) */ /* Abstract implementations (keys) */ /* Abstract implementations (values) */ /* Static containers (keys) */ /* Static containers (values) */ /* Implementations */ /* Synchronized wrappers */ /* Unmodifiable wrappers */ /* Other wrappers */ /* Methods (keys) */ /* Methods (values) */ /* Methods (keys/values) */ /* Methods that have special names depending on keys (but the special names depend on values) */ /* Equality */ /* Object/Reference-only definitions (keys) */ /* Primitive-type-only definitions (keys) */ /* Object/Reference-only definitions (values) */ /* * Copyright (C) 2003-2013 Paolo Boldi and Sebastiano Vigna * * 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 it.unimi.dsi.fastutil.longs; import it.unimi.dsi.fastutil.ints.IntArrays; import java.util.NoSuchElementException; /** A type-specific heap-based indirect priority queue. * * <P>Instances of this class use an additional <em>inversion array</em>, of the same length of the reference array, * to keep track of the heap position containing a given element of the reference array. The priority queue is * represented using a heap. The heap is enlarged as needed, but it is never * shrunk. Use the {@link #trim()} method to reduce its size, if necessary. * * <P>This implementation does <em>not</em> allow one to enqueue several times the same index. */ public class LongHeapIndirectPriorityQueue extends LongHeapSemiIndirectPriorityQueue { /** The inversion array. */ protected int inv[]; /** Creates a new empty queue with a given capacity and comparator. * * @param refArray the reference array. * @param capacity the initial capacity of this queue. * @param c the comparator used in this queue, or <code>null</code> for the natural order. */ public LongHeapIndirectPriorityQueue( long[] refArray, int capacity, LongComparator c ) { super( refArray, capacity, c ); if ( capacity > 0 ) this.heap = new int[ capacity ]; this.refArray = refArray; this.c = c; this.inv = new int[ refArray.length ]; IntArrays.fill( inv, -1 ); } /** Creates a new empty queue with a given capacity and using the natural order. * * @param refArray the reference array. * @param capacity the initial capacity of this queue. */ public LongHeapIndirectPriorityQueue( long[] refArray, int capacity ) { this( refArray, capacity, null ); } /** Creates a new empty queue with capacity equal to the length of the reference array and a given comparator. * * @param refArray the reference array. * @param c the comparator used in this queue, or <code>null</code> for the natural order. */ public LongHeapIndirectPriorityQueue( long[] refArray, LongComparator c ) { this( refArray, refArray.length, c ); } /** Creates a new empty queue with capacity equal to the length of the reference array and using the natural order. * @param refArray the reference array. */ public LongHeapIndirectPriorityQueue( long[] refArray ) { this( refArray, refArray.length, null ); } /** Wraps a given array in a queue using a given comparator. * * <P>The queue returned by this method will be backed by the given array. * The first <code>size</code> element of the array will be rearranged so to form a heap (this is * more efficient than enqueing the elements of <code>a</code> one by one). * * @param refArray the reference array. * @param a an array of indices into <code>refArray</code>. * @param size the number of elements to be included in the queue. * @param c the comparator used in this queue, or <code>null</code> for the natural order. */ public LongHeapIndirectPriorityQueue( final long[] refArray, final int[] a, final int size, final LongComparator c ) { this( refArray, 0, c ); this.heap = a; this.size = size; int i = size; while( i-- != 0 ) { if ( inv[ a[ i ] ] != -1 ) throw new IllegalArgumentException( "Index " + a[ i ] + " appears twice in the heap" ); inv[ a[ i ] ] = i; } LongIndirectHeaps.makeHeap( refArray, a, inv, size, c ); } /** Wraps a given array in a queue using a given comparator. * * <P>The queue returned by this method will be backed by the given array. * The elements of the array will be rearranged so to form a heap (this is * more efficient than enqueing the elements of <code>a</code> one by one). * * @param refArray the reference array. * @param a an array of indices into <code>refArray</code>. * @param c the comparator used in this queue, or <code>null</code> for the natural order. */ public LongHeapIndirectPriorityQueue( final long[] refArray, final int[] a, final LongComparator c ) { this( refArray, a, a.length, c ); } /** Wraps a given array in a queue using the natural order. * * <P>The queue returned by this method will be backed by the given array. * The first <code>size</code> element of the array will be rearranged so to form a heap (this is * more efficient than enqueing the elements of <code>a</code> one by one). * * @param refArray the reference array. * @param a an array of indices into <code>refArray</code>. * @param size the number of elements to be included in the queue. */ public LongHeapIndirectPriorityQueue( final long[] refArray, final int[] a, int size ) { this( refArray, a, size, null ); } /** Wraps a given array in a queue using the natural order. * * <P>The queue returned by this method will be backed by the given array. * The elements of the array will be rearranged so to form a heap (this is * more efficient than enqueing the elements of <code>a</code> one by one). * * @param refArray the reference array. * @param a an array of indices into <code>refArray</code>. */ public LongHeapIndirectPriorityQueue( final long[] refArray, final int[] a ) { this( refArray, a, a.length ); } @SuppressWarnings("unchecked") public void enqueue( final int x ) { if ( inv[ x ] >= 0 ) throw new IllegalArgumentException( "Index " + x + " belongs to the queue" ); if ( size == heap.length ) heap = IntArrays.grow( heap, size + 1 ); inv[ heap[ size ] = x ] = size++; LongIndirectHeaps.upHeap( refArray, heap, inv, size, size - 1, c ); } public boolean contains( final int index ) { return inv[ index ] >= 0; } public int dequeue() { if ( size == 0 ) throw new NoSuchElementException(); final int result = heap[ 0 ]; if ( --size != 0 ) inv[ heap[ 0 ] = heap[ size ] ] = 0; inv[ result ] = -1; if ( size != 0 ) LongIndirectHeaps.downHeap( refArray, heap, inv, size, 0, c ); return result; } public void changed() { LongIndirectHeaps.downHeap( refArray, heap, inv, size, 0, c ); } public void changed( final int index ) { final int pos = inv[ index ]; if ( pos < 0 ) throw new IllegalArgumentException( "Index " + index + " does not belong to the queue" ); final int newPos = LongIndirectHeaps.upHeap( refArray, heap, inv, size, pos, c ); LongIndirectHeaps.downHeap( refArray, heap, inv, size, newPos, c ); } /** Rebuilds this heap in a bottom-up fashion. */ public void allChanged() { LongIndirectHeaps.makeHeap( refArray, heap, inv, size, c ); } public boolean remove( final int index ) { final int result = inv[ index ]; if ( result < 0 ) return false; inv[ index ] = -1; if ( result < --size ) { inv[ heap[ result ] = heap[ size ] ] = result; final int newPos = LongIndirectHeaps.upHeap( refArray, heap, inv, size, result, c ); LongIndirectHeaps.downHeap( refArray, heap, inv, size, newPos, c ); } return true; } public void clear() { size = 0; IntArrays.fill( inv, -1 ); } }
ecaa545208585842e2fb01e4fd61f064e969bd8c
63e36d35f51bea83017ec712179302a62608333e
/framework/android/ddm/DdmHandleNativeHeap.java
900d1cba3ef92f780f621b3344aaf9c692350450
[]
no_license
hiepgaf/oneplus_blobs_decompiled
672aa002fa670bdcba8fdf34113bc4b8e85f8294
e1ab1f2dd111f905ff1eee18b6a072606c01c518
refs/heads/master
2021-06-26T11:24:21.954070
2017-08-26T12:45:56
2017-08-26T12:45:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,433
java
package android.ddm; import android.util.Log; import org.apache.harmony.dalvik.ddmc.Chunk; import org.apache.harmony.dalvik.ddmc.ChunkHandler; import org.apache.harmony.dalvik.ddmc.DdmServer; public class DdmHandleNativeHeap extends ChunkHandler { public static final int CHUNK_NHGT = type("NHGT"); private static DdmHandleNativeHeap mInstance = new DdmHandleNativeHeap(); private native byte[] getLeakInfo(); private Chunk handleNHGT(Chunk paramChunk) { paramChunk = getLeakInfo(); if (paramChunk != null) { Log.i("ddm-nativeheap", "Sending " + paramChunk.length + " bytes"); return new Chunk(ChunkHandler.type("NHGT"), paramChunk, 0, paramChunk.length); } return createFailChunk(1, "Something went wrong"); } public static void register() { DdmServer.registerHandler(CHUNK_NHGT, mInstance); } public void connected() {} public void disconnected() {} public Chunk handleChunk(Chunk paramChunk) { Log.i("ddm-nativeheap", "Handling " + name(paramChunk.type) + " chunk"); int i = paramChunk.type; if (i == CHUNK_NHGT) { return handleNHGT(paramChunk); } throw new RuntimeException("Unknown packet " + ChunkHandler.name(i)); } } /* Location: /Users/joshua/Desktop/system_framework/classes-dex2jar.jar!/android/ddm/DdmHandleNativeHeap.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
14067e49ab6389f9507d2bf3561c39d31239e4a7
4e36a95f166c293b38e4374e56bf21b16cea8b60
/src/main/java/com/wandson/food/api/v1/assembler/PedidoResumoModelAssembler.java
880a0073a0543f770f606ed5f4c03f382e3e1f22
[]
no_license
JoseWandson/food-api
d44160a5baef627a6e1c00e638111e7bba377c25
1012d83bb5aa14b812130dcf4c55dd3f175be314
refs/heads/master
2023-09-05T17:06:58.166704
2023-08-22T17:06:13
2023-08-22T17:06:13
242,260,439
0
0
null
2022-07-16T21:12:20
2020-02-22T01:27:48
Java
UTF-8
Java
false
false
1,259
java
package com.wandson.food.api.v1.assembler; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.hateoas.server.mvc.RepresentationModelAssemblerSupport; import org.springframework.stereotype.Component; import com.wandson.food.api.v1.Links; import com.wandson.food.api.v1.controller.PedidoController; import com.wandson.food.api.v1.model.PedidoResumoModel; import com.wandson.food.domain.model.Pedido; @Component public class PedidoResumoModelAssembler extends RepresentationModelAssemblerSupport<Pedido, PedidoResumoModel> { @Autowired private ModelMapper modelMapper; @Autowired private Links links; public PedidoResumoModelAssembler() { super(PedidoController.class, PedidoResumoModel.class); } @Override public PedidoResumoModel toModel(Pedido pedido) { PedidoResumoModel pedidoResumoModel = createModelWithId(pedido.getCodigo(), pedido); modelMapper.map(pedido, pedidoResumoModel); pedidoResumoModel.add(links.linkToPedidos("pedidos")); pedidoResumoModel.getRestaurante().add(links.linkToRestaurante(pedido.getRestaurante().getId())); pedidoResumoModel.getCliente().add(links.linkToUsuario(pedido.getCliente().getId())); return pedidoResumoModel; } }
d5a2757f4af9c7607c628b3e2ff84a2688fbc87e
eb16c122151770dbc534c12056f68d775cd9b7a8
/han xun ping/83/MyRestaurant/src/com/myl/view/EmpInfo.java
8336308dbce35e8cd7262224a8b32649295539ef
[]
no_license
mikechen88/java
648fca3a432c61208a88250d9c4bdfcb5d8c1507
f065826d997e9d659193973ad3e64041f36aaa4b
refs/heads/master
2021-01-19T22:29:29.047778
2013-10-19T16:55:47
2013-10-19T16:55:47
13,703,462
1
0
null
null
null
null
GB18030
Java
false
false
2,981
java
/** *用于显示认识管理的界面 */ package com.myl.view; import java.awt.*; import javax.swing.*; import com.mhl.model.*; import com.mhl.tools.ImagePanel; import com.mhl.tools.MyTools; import java.awt.Event; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class EmpInfo extends JPanel implements ActionListener{ //定义需要的各个组件 JPanel p1, p2, p3, p4, p5; JLabel p1_lab1, p3_lab1; JTextField p1_jtf1; JButton p1_jb1, p4_jb1, p4_jb2, p4_jb3, p4_jb4; //用于显示人事信息的table JTable jtable; JScrollPane jsp; //滚动的面板 EmpModel em=null; //构造函数 public EmpInfo() { //创建需要的组件 p1=new JPanel(new FlowLayout(FlowLayout.CENTER)); p1_lab1=new JLabel("请输入姓名(员工号或职位)"); p1_lab1.setFont(MyTools.f2); p1_jtf1=new JTextField(20); p1_jb1=new JButton("查询"); p1_jb1.setFont(MyTools.f3); //把他们加入到p1 p1.add(p1_lab1); p1.add(p1_jtf1); p1.add(p1_jb1); //处理中间 em=new EmpModel(); String []paras={"1"}; em.query("use RestaurantDB; select cleId , cleSex, cleZw from clerkInfo where 1=?", paras); jtable=new JTable(em); p2=new JPanel(new BorderLayout()); //先得到表格,把它放进滚动的面板 jsp=new JScrollPane(jtable); //再把滚动的面板放入p2 p2.add(jsp); //处理南边的 p3=new JPanel(new FlowLayout(FlowLayout.LEFT)); p3_lab1=new JLabel("总记录数是**条"); p3_lab1.setFont(MyTools.f3); p3.add(p3_lab1); p4=new JPanel(new FlowLayout(FlowLayout.RIGHT)); p4_jb1=new JButton("详细信息"); p4_jb1.setFont(MyTools.f3); p4_jb2=new JButton("添加"); p4_jb2.setFont(MyTools.f3); p4_jb3=new JButton("修改"); p4_jb3.setFont(MyTools.f3); p4_jb4=new JButton("删除"); p4_jb4.addActionListener(this); p4_jb4.setFont(MyTools.f3); p4.add(p4_jb1); p4.add(p4_jb2); p4.add(p4_jb3); p4.add(p4_jb4); p5=new JPanel(new BorderLayout()); p5.add(p3,"West"); p5.add(p4,"South"); //把总的JPanel设置为BorderLayout this.setLayout(new BorderLayout()); //把p1加入到JPanel this.add(p1,"North"); this.add(p2,"Center"); this.add(p5, "South"); // 设置背景颜色 // this.setBackground(Color.pink); this.setVisible(true); } public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub //如果用户要删除某个员工 if(this.p4_jb4==e.getSource()) { int selRowNum=jtable.getSelectedRow(); //得到选中的行 String empNo=(String)em.getValueAt(selRowNum, 0); //得到选中的行的第一个 编号 if(em.delEmpById(empNo)) { JOptionPane.showMessageDialog(null, "恭喜你删除成功"); }else{ JOptionPane.showMessageDialog(null, "删除失败"); } String []paras={"1"}; em=new EmpModel(); //更新查询 em.query("use RestaurantDB; select cleId , cleSex, cleZw from clerkInfo where 1=?", paras); jtable.setModel(em); } } }
6e239ee0fe900eb3108e8795fe4e6f48d96142d0
fab609b9559621b8d22be3a2052c0b5883e56a1c
/rotatedigits.java
98f91aa94a57d0fd821309e033362fc56d6dbd84
[]
no_license
mmsrajik/Java
777f4e632d555314e6dc10f77a96439d21303626
0d3e632e0c889243b878136546cdf2fb7954d06c
refs/heads/master
2021-11-19T14:12:34.616298
2021-09-28T19:20:55
2021-09-28T19:20:55
190,630,808
0
0
null
null
null
null
UTF-8
Java
false
false
1,247
java
Question : Truck loves to preform different operations on arrays, and so being the principal of ATV School, he assigned a task to his new student Risvi. Risvi will be provided with an integer array A of size N and an integer K , where she needs to rotate the array in the right direction by K steps and then print the resultant array. As she is new to the school, please help her to complete the task. Input: The first line consists of two integers N and K, N being the number of elements in the array and K denotes the number of steps of rotation. The next line consists of N space separated integers , denoting the elements of the array A. Output: Print the resultant array. Runtime Input : 5 2 1 2 3 4 5 Output : 4 5 1 2 3 import java.util.*; public class rotatedigits { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int num=sc.nextInt(); int k=sc.nextInt(); int arr[]=new int[num]; for(int i=0;i<num;i++) { arr[i]=sc.nextInt(); } for(int i=num-k;i<num;i++) { System.out.print(arr[i]+" "); } for(int i=0;i<num-k;i++) { if(i==(num-k)-1) { System.out.print(arr[i]); } else { System.out.print(arr[i]+" "); } } } }
9c120324224e8feaf8ebd713c44739314caf722a
b703561ceceacd0dc0d66f1e5d990663b22bf4ae
/spring-boot-rest-api/src/main/java/com/example/restservice/repository/HospitalRepository.java
bebafad2a3ef1dfc7513bd03b30691b61f0196a2
[]
no_license
milford116/212b014-Hackathon-Solution-E-prescription-
4171d980489db50f93839467c1e2c7c83b3f471e
8019d4b012cbda45c486fda95217ced25c841cee
refs/heads/master
2023-03-29T15:20:51.074779
2021-04-11T19:30:04
2021-04-11T19:30:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
457
java
package com.example.restservice.repository; import com.example.restservice.models.tutorial.Hospital; import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.Query; import java.util.List; public interface HospitalRepository extends MongoRepository<Hospital,Integer> { @Query("{ 'hospital_name' : ?0 }") List<Hospital> findByHospital_nameContaining (String hospital_name); }
81bd1d7fbf5054480b3014f996fa19aeee6e6639
7473947877b8648764db4b1bfc9ce673d168a295
/tresenRaya/src/tresenRaya.java
edfeb20468166b8a7ea7e7e3fec9af1fc4e90516
[ "BSD-3-Clause" ]
permissive
Cainuriel/Practicas-JAVA
3b30ea6aac1cc634c89c5b837f8fbb2362d8c5eb
e6b70ac68d2d7c317ff6daf863109c36a9a0bafa
refs/heads/master
2020-03-06T19:20:17.031480
2019-01-03T22:22:55
2019-01-03T22:22:55
127,025,550
0
0
null
null
null
null
UTF-8
Java
false
false
10,272
java
import java.util.Arrays; import java.util.Objects; import javax.swing.JOptionPane; import javax.swing.JTable; /* * 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. */ /** * * @author SOIB1A07 */ public class tresenRaya extends javax.swing.JFrame { static int mododejuego = 0; int x = 0; int y = 0; int turno = 0; int jugador = 0; public void setTurno(int turno) { this.turno = turno; } Juegotresrayas partida = new Juegotresrayas(); String[][] matriz = {{"", "", ""}, {"", "", ""}, {"", "", ""}}; String[][] matriz2 = {{"", "", ""}, {"", "", ""}, {"", "", ""}}; /** * Creates new form tresenRaya */ public tresenRaya() { initComponents(); } public String getvalueTable(int x, int y) { String valor = (String) tabla.getValueAt(x, y); return valor; } public void setvalueTable(int x, int y) { tabla.setValueAt("O", x, y); } public void contraMaquina() { int[] posicion = new int[2]; int x = 0; int y = 0; x = tabla.getSelectedRow(); y = tabla.getSelectedColumn(); tabla.setValueAt("X", x, y); matriz[x][y] = "X"; turno++; matriz2 = Juegotresrayas.copiarmatriz(matriz); partida.defensa(matriz); if (matriz2 == matriz) { posicion = partida.colocarficha(matriz); tabla.setValueAt("O", posicion[0], posicion[1]); } turno++; if (partida.quienGana(matriz)) { mensajes.setText("Demostrada mi superioridad: GANÉ"); int respuesta = JOptionPane.showConfirmDialog(null, "¿Revancha?", "GAME OVER", 2); if (respuesta == 0) { reiniciar(); } else { System.exit(0); } } if (turno == 9) { mensajes.setText("TABLAS"); int respuesta = JOptionPane.showConfirmDialog(null, "¿Revancha?", "GAME OVER", 2); if (respuesta == 0) { reiniciar(); } else { System.exit(0); } } } public void reiniciar() { setTurno(0); mensajes.setText(""); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { tabla.setValueAt("", i, j); } matriz = partida.inicializar(); } } public boolean tablas(String matriz[][]) { String espacio = ""; int contador = 0; for (int x = 0; x < matriz.length; x++) { for (int y = 0; y < matriz[x].length; y++) { if (Objects.equals(matriz[x][y], espacio)) { contador = 1; } } } if (contador == 0) { return true; } return false; } /** * 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() { tabla = new javax.swing.JTable(); BStart = new javax.swing.JButton(); mensajes = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setResizable(false); tabla.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); tabla.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N tabla.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null}, {null, null, null}, {null, null, null} }, new String [] { "Title 1", "Title 2", "Title 3" } ) { boolean[] canEdit = new boolean [] { false, false, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); tabla.setRowHeight(90); tabla.setRowMargin(5); tabla.setTableHeader(null); tabla.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { tablaMouseClicked(evt); } public void mousePressed(java.awt.event.MouseEvent evt) { tablaMousePressed(evt); } }); BStart.setText("START"); BStart.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { BStartMousePressed(evt); } }); BStart.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { BStartActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(32, 32, 32) .addComponent(BStart) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(mensajes, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(tabla, javax.swing.GroupLayout.PREFERRED_SIZE, 336, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(57, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(mensajes, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(BStart)) .addGap(18, 18, 18) .addComponent(tabla, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void tablaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tablaMouseClicked // TODO add your handling code here: }//GEN-LAST:event_tablaMouseClicked private void tablaMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tablaMousePressed // TODO add your handling code here: if (mododejuego == 1) { contraMaquina(); } mensajes.setText("JUGADOR 2"); if (jugador == 0) { x = tabla.getSelectedRow(); y = tabla.getSelectedColumn(); if (matriz[x][y] == "") { tabla.setValueAt(" X", x, y); matriz[x][y] = "X"; jugador = 1; } Juegotresrayas.imprimirmatriz(matriz); } else { mensajes.setText("JUGADOR 1"); x = tabla.getSelectedRow(); y = tabla.getSelectedColumn(); if (matriz[x][y] == "") { tabla.setValueAt(" O", x, y); matriz[x][y] = "O"; jugador = 0; } Juegotresrayas.imprimirmatriz(matriz); } if (partida.quienGana(matriz)) { mensajes.setText("FELICIDADES, HAS GANADO"); int respuesta = JOptionPane.showConfirmDialog(null, "¿Revancha?", "GAME OVER", 2); if (respuesta == 0) { reiniciar(); } else { System.exit(0); } } if (tablas(matriz)) { mensajes.setText("TABLAS"); int respuesta = JOptionPane.showConfirmDialog(null, "¿Revancha?", "GAME OVER", 2); if (respuesta == 0) { reiniciar(); } else { System.exit(0); } } }//GEN-LAST:event_tablaMousePressed private void BStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BStartActionPerformed // TODO add your handling code here: setTurno(0); mensajes.setText(""); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { tabla.setValueAt("", i, j); } } matriz = partida.inicializar(); }//GEN-LAST:event_BStartActionPerformed private void BStartMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_BStartMousePressed // TODO add your handling code here: }//GEN-LAST:event_BStartMousePressed /** * @param args the command line arguments */ public static void main(String args[]) { mododejuego = JOptionPane.showConfirmDialog(null, "¿Dos jugadores?", "MODO DE JUEGO", JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE); /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { new tresenRaya().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton BStart; private javax.swing.JLabel mensajes; private javax.swing.JTable tabla; // End of variables declaration//GEN-END:variables }
12558856c5aea5c01c6eb3abd858cc76f60d1dc1
c46000fbf572ff3f9c7cd7672351d42e43d670f2
/src/test/java/ru/netology/DbInteractionDbUtils.java
e920a6278bb6606372ff36ec8bed3ba836d3de77
[]
no_license
AlikAskat/SQL
9ad9e6ab0534ec808d252cd16ab33da859f35e71
b8b4bb786492faac133f87cfdbf5220431028c3a
refs/heads/main
2023-01-04T14:20:21.292111
2020-11-02T07:02:54
2020-11-02T07:02:54
305,945,070
0
0
null
null
null
null
UTF-8
Java
false
false
1,843
java
package ru.netology; import com.github.javafaker.Faker; import lombok.val; import org.apache.commons.dbutils.QueryRunner; import org.apache.commons.dbutils.handlers.BeanHandler; import org.apache.commons.dbutils.handlers.BeanListHandler; import org.apache.commons.dbutils.handlers.ScalarHandler; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import ru.netology.mode.User; import java.sql.DriverManager; import java.sql.SQLException; public class DbInteractionDbUtils { @BeforeEach void setUp() throws SQLException { val faker = new Faker(); val runner = new QueryRunner(); val dataSQL = "INSERT INTO users(login, password) VALUES (?, ?);"; try ( val conn = DriverManager.getConnection( "jdbc:mysql://localhost:3306/app", "app", "pass" ); ) { // обычная вставка runner.update(conn, dataSQL, faker.name().username(), "pass"); runner.update(conn, dataSQL, faker.name().username(), "pass"); } } @Test void stubTest() throws SQLException { val countSQL = "SELECT COUNT(*) FROM users;"; val usersSQL = "SELECT * FROM users;"; val runner = new QueryRunner(); try ( val conn = DriverManager.getConnection( "jdbc:mysql://localhost:3306/app", "app", "pass" ); ) { val count = runner.query(conn, countSQL, new ScalarHandler<>()); System.out.println(count); val first = runner.query(conn, usersSQL, new BeanHandler<>(User.class)); System.out.println(first); val all = runner.query(conn, usersSQL, new BeanListHandler<>(User.class)); System.out.println(all); } } }
836322f6862dfdf5cc99dd5072656e9e3bf7a1f0
1f510d22445fb7c13cade0f09c59ea3c9acf9df1
/src/main/java/com/progathon/apiRepository/cinema/getBookingReview.java
8952937b321a0891fafaed0d84594aab7460b413
[]
no_license
nitinat007/APIFramework
7f224734a5dc2760d7a08907234554c8f1ec306f
71aeed706a0323d09b449a4fe942e031cbad9263
refs/heads/master
2022-12-15T16:09:00.966786
2020-09-16T04:00:57
2020-09-16T04:00:57
259,996,381
1
0
null
null
null
null
UTF-8
Java
false
false
589
java
package com.progathon.apiRepository.cinema; import com.progathon.apiRepository.APITemplate; import java.util.HashMap; /** * Author: nitinkumar * Created Date: 16/01/20 * Info: info on getBookingReview api **/ public class getBookingReview extends APITemplate { public getBookingReview(String baseURL, HashMap<String, String> additionalHeaders, HashMap<String, String> additionalBody, String parameterType, HashMap<String, String> parameters) { super("POST", "v2/cinema/getBookingReview", baseURL, additionalHeaders, additionalBody, parameterType, parameters); } }
676a503268796abb3e7b9c64db27a6482b422510
65684b7877d2cc3d789ef01a98da8bc74001fbee
/2021-ps-a2-PopirtanVlad/src/main/java/ro/sd/a2/entity/Constructor.java
39a39babd7769cfeab3af12d4e20315677fcc972
[]
no_license
PopirtanVlad/F1Fantasy
d627451f0ea7df34048344e7a325d99089ffc54b
c77662a5a526d663be456634c58498cdc57ea3cb
refs/heads/main
2023-05-01T23:59:11.299053
2021-05-21T19:14:42
2021-05-21T19:14:42
369,631,416
0
0
null
null
null
null
UTF-8
Java
false
false
908
java
package ro.sd.a2.entity; import lombok.*; import javax.persistence.*; import java.util.Set; @Entity @Builder @NoArgsConstructor @AllArgsConstructor @Getter @Setter @Table(name="Constructor") public class Constructor { @Id private String constructor_id; @Column private String constructor_name; @Column private float constructor_price; @Column private int constructor_points; @OneToMany(mappedBy="constructor", orphanRemoval = false) private Set<Driver> drivers; public void addDrivers(Driver driver){ drivers.add(driver); driver.setConstructor(this); } public void removeDriver(Driver driver){ drivers.remove(driver); driver.setConstructor(null); } public Set<Driver> getDrivers() { return drivers; } public void setDrivers(Set<Driver> drivers) { this.drivers = drivers; } }
a94bdace4644597ccab9146a22561146616cd852
3ab83ee4ea02c31caad71cfff2f15233d34103ad
/src/sortingAnalysis/Main.java
928aa4e73c8af957546380adc61308cd34a20ba6
[]
no_license
shantanuspark/SortingAlgorithmsAnalysis
149b3fbc7879654cef9dc3f032e909c15fde075f
7f2dea967b40dde86a7047e2c7429c609ca053bc
refs/heads/master
2021-07-07T08:03:38.241676
2017-10-04T18:20:09
2017-10-04T18:20:09
105,470,055
2
0
null
null
null
null
UTF-8
Java
false
false
1,880
java
package sortingAnalysis; import java.util.Random; import javax.swing.SwingUtilities; public class Main { public static void main(String[] args) { int n = 100; Random rand = new Random(); SortingAlgorithms algos = new SortingAlgorithms(); long start, stop = 0; Integer test[]; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new LineChart("Algorithm Analysis").setVisible(true); } }); while (n <= 10000) { Integer[] a = new Integer[n]; for(int i = 0; i < n; i++) { a[i] = rand.nextInt(100000); } test = a.clone(); start = System.currentTimeMillis(); algos.split(test,0,a.length-1); stop = System.currentTimeMillis(); LineChart.dataset.addValue(stop-start, "Merge Sort", Integer.toString(n)); test = a.clone(); start = System.currentTimeMillis(); algos.qSplit(test,0,a.length-1); stop = System.currentTimeMillis(); LineChart.dataset.addValue(stop-start, "Quick Sort", Integer.toString(n)); test = a.clone(); start = System.currentTimeMillis(); algos.selectionSort(test); stop = System.currentTimeMillis(); LineChart.dataset.addValue(stop-start, "Selection Sort", Integer.toString(n)); test = a.clone(); start = System.currentTimeMillis(); algos.insertionSort(test); stop = System.currentTimeMillis(); LineChart.dataset.addValue(stop-start, "Insertion Sort", Integer.toString(n)); test = a.clone(); start = System.currentTimeMillis(); algos.bubbleSort(test); stop = System.currentTimeMillis(); LineChart.dataset.addValue(stop-start, "Bubble Sort", Integer.toString(n)); n*=5; } /*Integer a[] = {10,4,7,2,8,5,1,2,6}; new SortingAlgorithms().qSplit(a,0,a.length-1); for(int i=0;i<a.length;i++) System.out.print(" "+a[i]);*/ } }
8748da1beb996efe525898f029efc10507133dac
5081c48e924cce6b66b76390cc5cc034def11ece
/2020-Robockets-Code-Master/src/main/java/org/robockets/infiniterecharge/climber/ReelCommand.java
a899fefd36d2ff27977819078c9602c1ba16a55b
[ "MIT" ]
permissive
Team4761/2020-Robot-Code
ab26ceb260d09806332bc4332b9abdeed0fd3d09
360cde2f4bb25ca15dd262f7bebd09213179cf64
refs/heads/master
2020-12-09T10:13:29.759503
2020-03-03T21:14:28
2020-03-03T21:14:28
233,273,154
0
0
MIT
2020-02-15T18:45:10
2020-01-11T17:51:33
Java
UTF-8
Java
false
false
2,332
java
package org.robockets.infiniterecharge.climber; import edu.wpi.first.wpilibj.buttons.JoystickButton; import edu.wpi.first.wpilibj.command.Command; import org.robockets.infiniterecharge.OI; import org.robockets.infiniterecharge.Robot; @Deprecated public class ReelCommand extends Command { private double speed; public ReelCommand(double speed) { this.speed = speed; requires(Robot.Climber); // Use requires() here to declare subsystem dependencies // eg. requires(chassis); } /** * The initialize method is called just before the first time * this Command is run after being started. */ @Override protected void initialize() { } /** * The execute method is called repeatedly when this Command is * scheduled to run until this Command either finishes or is canceled. */ @Override protected void execute() { double run = 0.0; if(OI.button210.get()) run = speed; else if(OI.button204.get()) run = -speed; else run = 0.0; Robot.Climber.reel(run); System.out.println("run = " + run); } /** * <p> * Returns whether this command is finished. If it is, then the command will be removed and * {@link #end()} will be called. * </p><p> * It may be useful for a team to reference the {@link #isTimedOut()} * method for time-sensitive commands. * </p><p> * Returning false will result in the command never ending automatically. It may still be * cancelled manually or interrupted by another command. Returning true will result in the * command executing once and finishing immediately. It is recommended to use * {@link edu.wpi.first.wpilibj.command.InstantCommand} (added in 2017) for this. * </p> * * @return whether this command is finished. * @see Command#isTimedOut() isTimedOut() */ @Override protected boolean isFinished() { // TODO: Make this return true when this Command no longer needs to run execute() return false; } @Override protected void end() { Robot.Climber.reel(0.0); } @Override protected void interrupted() { end(); } }
8a982434be5c965283c0e33ba585fab39f6a990e
72d7546610f6436f5ce34a6439805423ed266cbd
/src/main/java/com/intocomunity/api/security/jwt/JwtAuthEntryPoint.java
980d68270b72a1846f6de0952375874b257b7bbc
[]
no_license
mibaneza/api
cc25b94c4faaa1d783bb0994cb1764d2cfff393d
150cd59b464eb92be6d0db3a81f8cfbb8e15cf37
refs/heads/master
2023-02-05T23:47:40.859893
2020-12-31T07:42:49
2020-12-31T07:42:49
325,744,930
0
0
null
null
null
null
UTF-8
Java
false
false
1,040
java
package com.intocomunity.api.security.jwt; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.stereotype.Component; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @Component public class JwtAuthEntryPoint implements AuthenticationEntryPoint { private static final Logger logger = LoggerFactory.getLogger(JwtAuthEntryPoint.class); @Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) throws IOException, ServletException { logger.error("Unauthorized error. Message - {}", e.getMessage()); response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Error -> Unauthorized"); } }
78216c018aaf3151ae555e8dba245ad59defbad6
c1135f50e68235d9487f03d86c844a991be17229
/src/main/java/WebDriverConcept/selectDropDownValuegetOptions.java
5ad10e0eacd017ed643a3cfaee95cdbf26563c7a
[]
no_license
srilathakatta/SeleniumConcepts
e971a31b29d0df1545a3e8b806e65b07352e4341
03a0b082e3503603a6c780dbbc3f0e2cf9491e25
refs/heads/master
2020-05-20T09:26:38.572485
2019-05-08T01:16:37
2019-05-08T01:16:37
185,500,359
0
0
null
null
null
null
UTF-8
Java
false
false
1,075
java
package WebDriverConcept; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.Select; public class selectDropDownValuegetOptions { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver","C:\\Users\\katta\\chromedriver.exe"); WebDriver driver=new ChromeDriver(); driver.get("http://demo.automationtesting.in/Register.html"); WebElement skills=driver.findElement(By.id("Skills")); selectValueByGetoptions(skills,"Software"); } public static void selectValueByGetoptions(WebElement element,String value){ Select select=new Select(element); List<WebElement>skillsList=select.getOptions(); System.out.println(skillsList.size()); for(int i=0;i<skillsList.size();i++){ String skillsValue=skillsList.get(i).getText(); System.out.println("skills list:"+skillsValue); if(skillsValue.equals(value)){ skillsList.get(i).click(); break; } } } }
cfc8468aeedc8f2ac43b57fba0d472b58909aa20
642f1f62abb026dee2d360a8b19196e3ccb859a1
/culturecloud-pojo/src/main/java/com/culturecloud/enumeration/operation/OperatFunction.java
aef1407dc1d30c0939255d52a43aa99d961ae703
[]
no_license
P79N6A/alibaba-1
f6dacf963d56856817b211484ca4be39f6dd9596
6ec48f26f16d51c8a493b0eee12d90775b6eaf1d
refs/heads/master
2020-05-27T08:34:26.827337
2019-05-25T07:50:12
2019-05-25T07:50:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
480
java
package com.culturecloud.enumeration.operation; /** * 运营模块功能 * * */ public enum OperatFunction { WHY, WHDT, //文化地铁 RMCG, //热门场馆 CGHD, //场馆活动 WHST, //文化社团 WHJS, //文化竞赛(百科全叔) HDZK, //活动周刊 HKHD, //虹口活动 FXHD, //奉贤活动 WHFY, //文化非遗 GYJZ, //古韵嘉州 WBJDS, //微笔记大赛 WHZYZ, //文化志愿者 CSZM, //发现城市之美 QRJF; //扫二维码送积分 }
ead94f31c55008dedcd2ec7c980aae1719fb8f5d
5e224ff6d555ee74e0fda6dfa9a645fb7de60989
/database/src/main/java/adila/db/hwhitv2dm1_hitv2dm1.java
7fbed70be990b007cf8e1bfe8b8931fe62c295ca
[ "MIT" ]
permissive
karim/adila
8b0b6ba56d83f3f29f6354a2964377e6197761c4
00f262f6d5352b9d535ae54a2023e4a807449faa
refs/heads/master
2021-01-18T22:52:51.508129
2016-11-13T13:08:04
2016-11-13T13:08:04
45,054,909
3
1
null
null
null
null
UTF-8
Java
false
false
233
java
// This file is automatically generated. package adila.db; /* * Huawei Honor Box Pro * * DEVICE: hwHiTV-M1 * MODEL: HiTV-M1 */ final class hwhitv2dm1_hitv2dm1 { public static final String DATA = "Huawei|Honor Box Pro|"; }
1fb29842ef1955d5f5995207fd395d5280b626dc
5955caa5726e105fe73b449d2b6b32c8d8d8c750
/TwitterAPI/src/dataextraction/GroundTruthNode.java
a8f43f65d3cf277eac3ce788d2a705fd2a24d5bc
[]
no_license
nicolasrsantos/RumourFlow
7c8ac597e2e307c9cb126b76b0d2006bc2a84a49
d0ce0c183af09f7892b9246157704949d18eddeb
refs/heads/master
2021-01-11T23:22:45.588118
2018-06-20T18:44:06
2018-06-20T18:44:06
115,960,809
1
0
null
null
null
null
UTF-8
Java
false
false
755
java
package dataextraction; public class GroundTruthNode { private String post; private String beliefClass; private String sentiment; public GroundTruthNode(){ // Nothing to do here } public GroundTruthNode(String post, String beliefClass, String sentiment) { super(); this.post = post; this.beliefClass = beliefClass; this.sentiment = sentiment; } public String getPost() { return post; } public void setPost(String post) { this.post = post; } public String getBeliefClass() { return beliefClass; } public void setBeliefClass(String beliefClass) { this.beliefClass = beliefClass; } public String getSentiment() { return sentiment; } public void setSentiment(String sentiment) { this.sentiment = sentiment; } }
01507045ac8caa3229b018e1fcf53c6bd913a086
f6a5f549a39c7e2afd0061fbf204e3743e900e60
/src/com/packex/loader/CompanyLoader.java
417ee8054bbf8766e2f7e6aea7c528c28089b3e4
[]
no_license
omaray/PackEx
f3450c39170a28b7ec1bd7b97b06f863b57e4729
ced7e26fdc468cde0078ffc3541030c1a11a8bc6
refs/heads/master
2021-01-16T21:28:53.526482
2016-05-26T05:36:57
2016-05-26T05:36:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,632
java
package com.packex.loader; import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import com.google.gson.Gson; import com.packex.Constants; import com.packex.Util; import com.packex.model.company.CompanyPackages; import com.packex.model.company.PackageInfo; public class CompanyLoader { private LinkedList<CompanyPackages> companyData; public void load() { this.load(Constants.PACKAGES_FILE_PATH); } public void load(String filePath) { Gson gson = new Gson(); String packagesInJson= Util.readFromFile(filePath); CompanyPackages[] companyPackages = gson.fromJson(packagesInJson, CompanyPackages[].class); this.companyData = new LinkedList<CompanyPackages>(Arrays.asList(companyPackages)); } public LinkedList<CompanyPackages> getCompanyData() { return this.companyData; } public static void main(String[] args) { CompanyLoader companyLoader= new CompanyLoader(); companyLoader.load(); LinkedList<CompanyPackages> companyPackagesList = companyLoader.getCompanyData(); for (CompanyPackages companyPackages : companyPackagesList) { System.out.println(companyPackages.getCompany()); ArrayList<PackageInfo> packages = companyPackages.getPackages(); for (PackageInfo pkg : packages) { System.out.print(" Language: " + pkg.getLanguage()); System.out.print(" Name: " + pkg.getName()); System.out.println(" Category: " + pkg.getCategory()); } } } }
267406ca1701a034b72993e1782960230b37da10
a0eb22707922c38e1940a939d53bf6434c2f4280
/src/com/sun/tools/javac/jvm/Code.java
f5f37ef043554682031b82bed91a2bb90ea3d121
[]
no_license
FlyingZC/Javac
e3ff3465679613a882218163bd1209ccfd9d853e
90f6f5b9d60f0ab298e764a95aff9e081b3aa8a3
refs/heads/main
2023-01-22T11:43:43.868875
2020-11-22T03:31:28
2020-11-22T03:31:28
304,769,870
0
0
null
null
null
null
UTF-8
Java
false
false
69,265
java
/* * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package com.sun.tools.javac.jvm; import com.sun.tools.javac.code.*; import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.code.Types.UniqueType; import com.sun.tools.javac.util.*; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; import static com.sun.tools.javac.code.TypeTag.BOT; import static com.sun.tools.javac.code.TypeTag.INT; import static com.sun.tools.javac.jvm.ByteCodes.*; import static com.sun.tools.javac.jvm.UninitializedType.*; import static com.sun.tools.javac.jvm.ClassWriter.StackMapTableFrame; /** An internal structure that corresponds to the code attribute of * methods in a classfile. The class also provides some utility operations to * generate bytecode instructions. * * <p><b>This is NOT part of any supported API. * If you write code that depends on this, you do so at your own risk. * This code and its internal interfaces are subject to change or * deletion without notice.</b> */ public class Code { public final boolean debugCode; public final boolean needStackMap; public enum StackMapFormat { NONE, CLDC { Name getAttributeName(Names names) { return names.StackMap; } }, JSR202 { Name getAttributeName(Names names) { return names.StackMapTable; } }; Name getAttributeName(Names names) { return names.empty; } } final Types types; final Symtab syms; /*---------- classfile fields: --------------- */ /** The maximum stack size. */ public int max_stack = 0; /** The maximum number of local variable slots. */ public int max_locals = 0; /** The code buffer. */ public byte[] code = new byte[64]; /** the current code pointer. */ public int cp = 0; /** Check the code against VM spec limits; if * problems report them and return true. */ public boolean checkLimits(DiagnosticPosition pos, Log log) { if (cp > ClassFile.MAX_CODE) { log.error(pos, "limit.code"); return true; } if (max_locals > ClassFile.MAX_LOCALS) { log.error(pos, "limit.locals"); return true; } if (max_stack > ClassFile.MAX_STACK) { log.error(pos, "limit.stack"); return true; } return false; } /** A buffer for expression catch data. Each enter is a vector * of four unsigned shorts. */ ListBuffer<char[]> catchInfo = new ListBuffer<char[]>(); /** A buffer for line number information. Each entry is a vector * of two unsigned shorts. */ List<char[]> lineInfo = List.nil(); // handled in stack fashion /** The CharacterRangeTable */ public CRTable crt; /*---------- internal fields: --------------- */ /** Are we generating code with jumps &ge; 32K? */ public boolean fatcode; /** Code generation enabled? */ private boolean alive = true; /** The current machine state (registers and stack). */ State state; /** Is it forbidden to compactify code, because something is * pointing to current location? */ private boolean fixedPc = false; /** The next available register. */ public int nextreg = 0; /** A chain for jumps to be resolved before the next opcode is emitted. * We do this lazily to avoid jumps to jumps. */ Chain pendingJumps = null; /** The position of the currently statement, if we are at the * start of this statement, NOPOS otherwise. * We need this to emit line numbers lazily, which we need to do * because of jump-to-jump optimization. */ int pendingStatPos = Position.NOPOS; /** Set true when a stackMap is needed at the current PC. */ boolean pendingStackMap = false; /** The stack map format to be generated. */ StackMapFormat stackMap; /** Switch: emit variable debug info. */ boolean varDebugInfo; /** Switch: emit line number info. */ boolean lineDebugInfo; /** Emit line number info if map supplied */ Position.LineMap lineMap; /** The constant pool of the current class. */ final Pool pool; final MethodSymbol meth; /** Construct a code object, given the settings of the fatcode, * debugging info switches and the CharacterRangeTable. */ public Code(MethodSymbol meth, boolean fatcode, Position.LineMap lineMap, boolean varDebugInfo, StackMapFormat stackMap, boolean debugCode, CRTable crt, Symtab syms, Types types, Pool pool) { this.meth = meth; this.fatcode = fatcode; this.lineMap = lineMap; this.lineDebugInfo = lineMap != null; this.varDebugInfo = varDebugInfo; this.crt = crt; this.syms = syms; this.types = types; this.debugCode = debugCode; this.stackMap = stackMap; switch (stackMap) { case CLDC: case JSR202: this.needStackMap = true; break; default: this.needStackMap = false; } state = new State(); lvar = new LocalVar[20]; this.pool = pool; } /* ************************************************************************** * Typecodes & related stuff ****************************************************************************/ /** Given a type, return its type code (used implicitly in the * JVM architecture). */ public static int typecode(Type type) { switch (type.getTag()) { case BYTE: return BYTEcode; case SHORT: return SHORTcode; case CHAR: return CHARcode; case INT: return INTcode; case LONG: return LONGcode; case FLOAT: return FLOATcode; case DOUBLE: return DOUBLEcode; case BOOLEAN: return BYTEcode; case VOID: return VOIDcode; case CLASS: case ARRAY: case METHOD: case BOT: case TYPEVAR: case UNINITIALIZED_THIS: case UNINITIALIZED_OBJECT: return OBJECTcode; default: throw new AssertionError("typecode " + type.getTag()); } } /** Collapse type code for subtypes of int to INTcode. */ public static int truncate(int tc) { switch (tc) { case BYTEcode: case SHORTcode: case CHARcode: return INTcode; default: return tc; } } /** The width in bytes of objects of the type. */ public static int width(int typecode) { switch (typecode) { case LONGcode: case DOUBLEcode: return 2; case VOIDcode: return 0; default: return 1; } } public static int width(Type type) { return type == null ? 1 : width(typecode(type)); } /** The total width taken up by a vector of objects. */ public static int width(List<Type> types) { int w = 0; for (List<Type> l = types; l.nonEmpty(); l = l.tail) w = w + width(l.head); return w; } /** Given a type, return its code for allocating arrays of that type. */ public static int arraycode(Type type) { switch (type.getTag()) { case BYTE: return 8; case BOOLEAN: return 4; case SHORT: return 9; case CHAR: return 5; case INT: return 10; case LONG: return 11; case FLOAT: return 6; case DOUBLE: return 7; case CLASS: return 0; case ARRAY: return 1; default: throw new AssertionError("arraycode " + type); } } /* ************************************************************************** * Emit code ****************************************************************************/ /** The current output code pointer. */ public int curPc() { if (pendingJumps != null) resolvePending(); if (pendingStatPos != Position.NOPOS) markStatBegin(); fixedPc = true; return cp; } /** Emit a byte of code. */ private void emit1(int od) { if (!alive) return; code = ArrayUtils.ensureCapacity(code, cp); code[cp++] = (byte)od; } /** Emit two bytes of code. */ private void emit2(int od) { if (!alive) return; if (cp + 2 > code.length) { emit1(od >> 8); emit1(od); } else { code[cp++] = (byte)(od >> 8); code[cp++] = (byte)od; } } /** Emit four bytes of code. */ public void emit4(int od) { if (!alive) return; if (cp + 4 > code.length) { emit1(od >> 24); emit1(od >> 16); emit1(od >> 8); emit1(od); } else { code[cp++] = (byte)(od >> 24); code[cp++] = (byte)(od >> 16); code[cp++] = (byte)(od >> 8); code[cp++] = (byte)od; } } /** Emit an opcode. */ private void emitop(int op) { if (pendingJumps != null) resolvePending(); if (alive) { if (pendingStatPos != Position.NOPOS) markStatBegin(); if (pendingStackMap) { pendingStackMap = false; emitStackMap(); } if (debugCode) System.err.println("emit@" + cp + " stack=" + state.stacksize + ": " + mnem(op)); emit1(op); } } void postop() { Assert.check(alive || state.stacksize == 0); } /** Emit a multinewarray instruction. */ public void emitMultianewarray(int ndims, int type, Type arrayType) { emitop(multianewarray); if (!alive) return; emit2(type); emit1(ndims); state.pop(ndims); state.push(arrayType); } /** Emit newarray. */ public void emitNewarray(int elemcode, Type arrayType) { emitop(newarray); if (!alive) return; emit1(elemcode); state.pop(1); // count state.push(arrayType); } /** Emit anewarray. */ public void emitAnewarray(int od, Type arrayType) { emitop(anewarray); if (!alive) return; emit2(od); state.pop(1); state.push(arrayType); } /** Emit an invokeinterface instruction. */ public void emitInvokeinterface(int meth, Type mtype) { int argsize = width(mtype.getParameterTypes()); emitop(invokeinterface); if (!alive) return; emit2(meth); emit1(argsize + 1); emit1(0); state.pop(argsize + 1); state.push(mtype.getReturnType()); } /** Emit an invokespecial instruction. */ public void emitInvokespecial(int meth, Type mtype) { int argsize = width(mtype.getParameterTypes()); emitop(invokespecial); if (!alive) return; emit2(meth); Symbol sym = (Symbol)pool.pool[meth]; state.pop(argsize); if (sym.isConstructor()) state.markInitialized((UninitializedType)state.peek()); state.pop(1); state.push(mtype.getReturnType()); } /** Emit an invokestatic instruction. */ public void emitInvokestatic(int meth, Type mtype) { int argsize = width(mtype.getParameterTypes()); emitop(invokestatic); if (!alive) return; emit2(meth); state.pop(argsize); state.push(mtype.getReturnType()); } /** Emit an invokevirtual instruction. */ public void emitInvokevirtual(int meth, Type mtype) { int argsize = width(mtype.getParameterTypes()); emitop(invokevirtual); if (!alive) return; emit2(meth); state.pop(argsize + 1); state.push(mtype.getReturnType()); } /** Emit an invokedynamic instruction. */ public void emitInvokedynamic(int desc, Type mtype) { // N.B. this format is under consideration by the JSR 292 EG int argsize = width(mtype.getParameterTypes()); emitop(invokedynamic); if (!alive) return; emit2(desc); emit2(0); state.pop(argsize); state.push(mtype.getReturnType()); } /** Emit an opcode with no operand field. */ public void emitop0(int op) { emitop(op); if (!alive) return; switch (op) { case aaload: { state.pop(1);// index Type a = state.stack[state.stacksize-1]; state.pop(1); //sometimes 'null type' is treated as a one-dimensional array type //see Gen.visitLiteral - we should handle this case accordingly Type stackType = a.hasTag(BOT) ? syms.objectType : types.erasure(types.elemtype(a)); state.push(stackType); } break; case goto_: markDead(); break; case nop: case ineg: case lneg: case fneg: case dneg: break; case aconst_null: state.push(syms.botType); break; case iconst_m1: case iconst_0: case iconst_1: case iconst_2: case iconst_3: case iconst_4: case iconst_5: case iload_0: case iload_1: case iload_2: case iload_3: state.push(syms.intType); break; case lconst_0: case lconst_1: case lload_0: case lload_1: case lload_2: case lload_3: state.push(syms.longType); break; case fconst_0: case fconst_1: case fconst_2: case fload_0: case fload_1: case fload_2: case fload_3: state.push(syms.floatType); break; case dconst_0: case dconst_1: case dload_0: case dload_1: case dload_2: case dload_3: state.push(syms.doubleType); break; case aload_0: state.push(lvar[0].sym.type); break; case aload_1: state.push(lvar[1].sym.type); break; case aload_2: state.push(lvar[2].sym.type); break; case aload_3: state.push(lvar[3].sym.type); break; case iaload: case baload: case caload: case saload: state.pop(2); state.push(syms.intType); break; case laload: state.pop(2); state.push(syms.longType); break; case faload: state.pop(2); state.push(syms.floatType); break; case daload: state.pop(2); state.push(syms.doubleType); break; case istore_0: case istore_1: case istore_2: case istore_3: case fstore_0: case fstore_1: case fstore_2: case fstore_3: case astore_0: case astore_1: case astore_2: case astore_3: case pop: case lshr: case lshl: case lushr: state.pop(1); break; case areturn: case ireturn: case freturn: Assert.check(state.nlocks == 0); state.pop(1); markDead(); break; case athrow: state.pop(1); markDead(); break; case lstore_0: case lstore_1: case lstore_2: case lstore_3: case dstore_0: case dstore_1: case dstore_2: case dstore_3: case pop2: state.pop(2); break; case lreturn: case dreturn: Assert.check(state.nlocks == 0); state.pop(2); markDead(); break; case dup: state.push(state.stack[state.stacksize-1]); break; case return_: Assert.check(state.nlocks == 0); markDead(); break; case arraylength: state.pop(1); state.push(syms.intType); break; case isub: case iadd: case imul: case idiv: case imod: case ishl: case ishr: case iushr: case iand: case ior: case ixor: state.pop(1); // state.pop(1); // state.push(syms.intType); break; case aastore: state.pop(3); break; case land: case lor: case lxor: case lmod: case ldiv: case lmul: case lsub: case ladd: state.pop(2); break; case lcmp: state.pop(4); state.push(syms.intType); break; case l2i: state.pop(2); state.push(syms.intType); break; case i2l: state.pop(1); state.push(syms.longType); break; case i2f: state.pop(1); state.push(syms.floatType); break; case i2d: state.pop(1); state.push(syms.doubleType); break; case l2f: state.pop(2); state.push(syms.floatType); break; case l2d: state.pop(2); state.push(syms.doubleType); break; case f2i: state.pop(1); state.push(syms.intType); break; case f2l: state.pop(1); state.push(syms.longType); break; case f2d: state.pop(1); state.push(syms.doubleType); break; case d2i: state.pop(2); state.push(syms.intType); break; case d2l: state.pop(2); state.push(syms.longType); break; case d2f: state.pop(2); state.push(syms.floatType); break; case tableswitch: case lookupswitch: state.pop(1); // the caller is responsible for patching up the state break; case dup_x1: { Type val1 = state.pop1(); Type val2 = state.pop1(); state.push(val1); state.push(val2); state.push(val1); break; } case bastore: state.pop(3); break; case int2byte: case int2char: case int2short: break; case fmul: case fadd: case fsub: case fdiv: case fmod: state.pop(1); break; case castore: case iastore: case fastore: case sastore: state.pop(3); break; case lastore: case dastore: state.pop(4); break; case dup2: if (state.stack[state.stacksize-1] != null) { Type value1 = state.pop1(); Type value2 = state.pop1(); state.push(value2); state.push(value1); state.push(value2); state.push(value1); } else { Type value = state.pop2(); state.push(value); state.push(value); } break; case dup2_x1: if (state.stack[state.stacksize-1] != null) { Type value1 = state.pop1(); Type value2 = state.pop1(); Type value3 = state.pop1(); state.push(value2); state.push(value1); state.push(value3); state.push(value2); state.push(value1); } else { Type value1 = state.pop2(); Type value2 = state.pop1(); state.push(value1); state.push(value2); state.push(value1); } break; case dup2_x2: if (state.stack[state.stacksize-1] != null) { Type value1 = state.pop1(); Type value2 = state.pop1(); if (state.stack[state.stacksize-1] != null) { // form 1 Type value3 = state.pop1(); Type value4 = state.pop1(); state.push(value2); state.push(value1); state.push(value4); state.push(value3); state.push(value2); state.push(value1); } else { // form 3 Type value3 = state.pop2(); state.push(value2); state.push(value1); state.push(value3); state.push(value2); state.push(value1); } } else { Type value1 = state.pop2(); if (state.stack[state.stacksize-1] != null) { // form 2 Type value2 = state.pop1(); Type value3 = state.pop1(); state.push(value1); state.push(value3); state.push(value2); state.push(value1); } else { // form 4 Type value2 = state.pop2(); state.push(value1); state.push(value2); state.push(value1); } } break; case dup_x2: { Type value1 = state.pop1(); if (state.stack[state.stacksize-1] != null) { // form 1 Type value2 = state.pop1(); Type value3 = state.pop1(); state.push(value1); state.push(value3); state.push(value2); state.push(value1); } else { // form 2 Type value2 = state.pop2(); state.push(value1); state.push(value2); state.push(value1); } } break; case fcmpl: case fcmpg: state.pop(2); state.push(syms.intType); break; case dcmpl: case dcmpg: state.pop(4); state.push(syms.intType); break; case swap: { Type value1 = state.pop1(); Type value2 = state.pop1(); state.push(value1); state.push(value2); break; } case dadd: case dsub: case dmul: case ddiv: case dmod: state.pop(2); break; case ret: markDead(); break; case wide: // must be handled by the caller. return; case monitorenter: case monitorexit: state.pop(1); break; default: throw new AssertionError(mnem(op)); } postop(); } /** Emit an opcode with a one-byte operand field. */ public void emitop1(int op, int od) { emitop(op); if (!alive) return; emit1(od); switch (op) { case bipush: state.push(syms.intType); break; case ldc1: state.push(typeForPool(pool.pool[od])); break; default: throw new AssertionError(mnem(op)); } postop(); } /** The type of a constant pool entry. */ private Type typeForPool(Object o) { if (o instanceof Integer) return syms.intType; if (o instanceof Float) return syms.floatType; if (o instanceof String) return syms.stringType; if (o instanceof Long) return syms.longType; if (o instanceof Double) return syms.doubleType; if (o instanceof ClassSymbol) return syms.classType; if (o instanceof Type.ArrayType) return syms.classType; if (o instanceof Type.MethodType) return syms.methodTypeType; if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type); if (o instanceof Pool.MethodHandle) return syms.methodHandleType; throw new AssertionError(o); } /** Emit an opcode with a one-byte operand field; * widen if field does not fit in a byte. */ public void emitop1w(int op, int od) { if (od > 0xFF) { emitop(wide); emitop(op); emit2(od); } else { emitop(op); emit1(od); } if (!alive) return; switch (op) { case iload: state.push(syms.intType); break; case lload: state.push(syms.longType); break; case fload: state.push(syms.floatType); break; case dload: state.push(syms.doubleType); break; case aload: state.push(lvar[od].sym.type); break; case lstore: case dstore: state.pop(2); break; case istore: case fstore: case astore: state.pop(1); break; case ret: markDead(); break; default: throw new AssertionError(mnem(op)); } postop(); } /** Emit an opcode with two one-byte operand fields; * widen if either field does not fit in a byte. */ public void emitop1w(int op, int od1, int od2) { if (od1 > 0xFF || od2 < -128 || od2 > 127) { emitop(wide); emitop(op); emit2(od1); emit2(od2); } else { emitop(op); emit1(od1); emit1(od2); } if (!alive) return; switch (op) { case iinc: break; default: throw new AssertionError(mnem(op)); } } /** Emit an opcode with a two-byte operand field. */ public void emitop2(int op, int od) { emitop(op); if (!alive) return; emit2(od); switch (op) { case getstatic: state.push(((Symbol)(pool.pool[od])).erasure(types)); break; case putstatic: state.pop(((Symbol)(pool.pool[od])).erasure(types)); break; case new_: state.push(uninitializedObject(((Symbol)(pool.pool[od])).erasure(types), cp-3)); break; case sipush: state.push(syms.intType); break; case if_acmp_null: case if_acmp_nonnull: case ifeq: case ifne: case iflt: case ifge: case ifgt: case ifle: state.pop(1); break; case if_icmpeq: case if_icmpne: case if_icmplt: case if_icmpge: case if_icmpgt: case if_icmple: case if_acmpeq: case if_acmpne: state.pop(2); break; case goto_: markDead(); break; case putfield: state.pop(((Symbol)(pool.pool[od])).erasure(types)); state.pop(1); // object ref break; case getfield: state.pop(1); // object ref state.push(((Symbol)(pool.pool[od])).erasure(types)); break; case checkcast: { state.pop(1); // object ref Object o = pool.pool[od]; Type t = (o instanceof Symbol) ? ((Symbol)o).erasure(types) : types.erasure((((UniqueType)o).type)); state.push(t); break; } case ldc2w: state.push(typeForPool(pool.pool[od])); break; case instanceof_: state.pop(1); state.push(syms.intType); break; case ldc2: state.push(typeForPool(pool.pool[od])); break; case jsr: break; default: throw new AssertionError(mnem(op)); } // postop(); } /** Emit an opcode with a four-byte operand field. */ public void emitop4(int op, int od) { emitop(op); if (!alive) return; emit4(od); switch (op) { case goto_w: markDead(); break; case jsr_w: break; default: throw new AssertionError(mnem(op)); } // postop(); } /** Align code pointer to next `incr' boundary. */ public void align(int incr) { if (alive) while (cp % incr != 0) emitop0(nop); } /** Place a byte into code at address pc. * Pre: {@literal pc + 1 <= cp }. */ private void put1(int pc, int op) { code[pc] = (byte)op; } /** Place two bytes into code at address pc. * Pre: {@literal pc + 2 <= cp }. */ private void put2(int pc, int od) { // pre: pc + 2 <= cp put1(pc, od >> 8); put1(pc+1, od); } /** Place four bytes into code at address pc. * Pre: {@literal pc + 4 <= cp }. */ public void put4(int pc, int od) { // pre: pc + 4 <= cp put1(pc , od >> 24); put1(pc+1, od >> 16); put1(pc+2, od >> 8); put1(pc+3, od); } /** Return code byte at position pc as an unsigned int. */ private int get1(int pc) { return code[pc] & 0xFF; } /** Return two code bytes at position pc as an unsigned int. */ private int get2(int pc) { return (get1(pc) << 8) | get1(pc+1); } /** Return four code bytes at position pc as an int. */ public int get4(int pc) { // pre: pc + 4 <= cp return (get1(pc) << 24) | (get1(pc+1) << 16) | (get1(pc+2) << 8) | (get1(pc+3)); } /** Is code generation currently enabled? */ public boolean isAlive() { return alive || pendingJumps != null; } /** Switch code generation on/off. */ public void markDead() { alive = false; } /** Declare an entry point; return current code pointer */ public int entryPoint() { int pc = curPc(); alive = true; pendingStackMap = needStackMap; return pc; } /** Declare an entry point with initial state; * return current code pointer */ public int entryPoint(State state) { int pc = curPc(); alive = true; this.state = state.dup(); Assert.check(state.stacksize <= max_stack); if (debugCode) System.err.println("entry point " + state); pendingStackMap = needStackMap; return pc; } /** Declare an entry point with initial state plus a pushed value; * return current code pointer */ public int entryPoint(State state, Type pushed) { int pc = curPc(); alive = true; this.state = state.dup(); Assert.check(state.stacksize <= max_stack); this.state.push(pushed); if (debugCode) System.err.println("entry point " + state); pendingStackMap = needStackMap; return pc; } /************************************************************************** * Stack map generation *************************************************************************/ /** An entry in the stack map. */ static class StackMapFrame { int pc; Type[] locals; Type[] stack; } /** A buffer of cldc stack map entries. */ StackMapFrame[] stackMapBuffer = null; /** A buffer of compressed StackMapTable entries. */ StackMapTableFrame[] stackMapTableBuffer = null; int stackMapBufferSize = 0; /** The last PC at which we generated a stack map. */ int lastStackMapPC = -1; /** The last stack map frame in StackMapTable. */ StackMapFrame lastFrame = null; /** The stack map frame before the last one. */ StackMapFrame frameBeforeLast = null; /** Emit a stack map entry. */ public void emitStackMap() { int pc = curPc(); if (!needStackMap) return; switch (stackMap) { case CLDC: emitCLDCStackMap(pc, getLocalsSize()); break; case JSR202: emitStackMapFrame(pc, getLocalsSize()); break; default: throw new AssertionError("Should have chosen a stackmap format"); } // DEBUG code follows if (debugCode) state.dump(pc); } private int getLocalsSize() { int nextLocal = 0; for (int i=max_locals-1; i>=0; i--) { if (state.defined.isMember(i) && lvar[i] != null) { nextLocal = i + width(lvar[i].sym.erasure(types)); break; } } return nextLocal; } /** Emit a CLDC stack map frame. */ void emitCLDCStackMap(int pc, int localsSize) { if (lastStackMapPC == pc) { // drop existing stackmap at this offset stackMapBuffer[--stackMapBufferSize] = null; } lastStackMapPC = pc; if (stackMapBuffer == null) { stackMapBuffer = new StackMapFrame[20]; } else { stackMapBuffer = ArrayUtils.ensureCapacity(stackMapBuffer, stackMapBufferSize); } StackMapFrame frame = stackMapBuffer[stackMapBufferSize++] = new StackMapFrame(); frame.pc = pc; frame.locals = new Type[localsSize]; for (int i=0; i<localsSize; i++) { if (state.defined.isMember(i) && lvar[i] != null) { Type vtype = lvar[i].sym.type; if (!(vtype instanceof UninitializedType)) vtype = types.erasure(vtype); frame.locals[i] = vtype; } } frame.stack = new Type[state.stacksize]; for (int i=0; i<state.stacksize; i++) frame.stack[i] = state.stack[i]; } void emitStackMapFrame(int pc, int localsSize) { if (lastFrame == null) { // first frame lastFrame = getInitialFrame(); } else if (lastFrame.pc == pc) { // drop existing stackmap at this offset stackMapTableBuffer[--stackMapBufferSize] = null; lastFrame = frameBeforeLast; frameBeforeLast = null; } StackMapFrame frame = new StackMapFrame(); frame.pc = pc; int localCount = 0; Type[] locals = new Type[localsSize]; for (int i=0; i<localsSize; i++, localCount++) { if (state.defined.isMember(i) && lvar[i] != null) { Type vtype = lvar[i].sym.type; if (!(vtype instanceof UninitializedType)) vtype = types.erasure(vtype); locals[i] = vtype; if (width(vtype) > 1) i++; } } frame.locals = new Type[localCount]; for (int i=0, j=0; i<localsSize; i++, j++) { Assert.check(j < localCount); frame.locals[j] = locals[i]; if (width(locals[i]) > 1) i++; } int stackCount = 0; for (int i=0; i<state.stacksize; i++) { if (state.stack[i] != null) { stackCount++; } } frame.stack = new Type[stackCount]; stackCount = 0; for (int i=0; i<state.stacksize; i++) { if (state.stack[i] != null) { frame.stack[stackCount++] = types.erasure(state.stack[i]); } } if (stackMapTableBuffer == null) { stackMapTableBuffer = new StackMapTableFrame[20]; } else { stackMapTableBuffer = ArrayUtils.ensureCapacity( stackMapTableBuffer, stackMapBufferSize); } stackMapTableBuffer[stackMapBufferSize++] = StackMapTableFrame.getInstance(frame, lastFrame.pc, lastFrame.locals, types); frameBeforeLast = lastFrame; lastFrame = frame; } StackMapFrame getInitialFrame() { StackMapFrame frame = new StackMapFrame(); List<Type> arg_types = ((MethodType)meth.externalType(types)).argtypes; int len = arg_types.length(); int count = 0; if (!meth.isStatic()) { Type thisType = meth.owner.type; frame.locals = new Type[len+1]; if (meth.isConstructor() && thisType != syms.objectType) { frame.locals[count++] = UninitializedType.uninitializedThis(thisType); } else { frame.locals[count++] = types.erasure(thisType); } } else { frame.locals = new Type[len]; } for (Type arg_type : arg_types) { frame.locals[count++] = types.erasure(arg_type); } frame.pc = -1; frame.stack = null; return frame; } /************************************************************************** * Operations having to do with jumps *************************************************************************/ /** A chain represents a list of unresolved jumps. Jump locations * are sorted in decreasing order. */ public static class Chain { /** The position of the jump instruction. */ public final int pc; /** The machine state after the jump instruction. * Invariant: all elements of a chain list have the same stacksize * and compatible stack and register contents. */ Code.State state; /** The next jump in the list. */ public final Chain next; /** Construct a chain from its jump position, stacksize, previous * chain, and machine state. */ public Chain(int pc, Chain next, Code.State state) { this.pc = pc; this.next = next; this.state = state; } } /** Negate a branch opcode. */ public static int negate(int opcode) { if (opcode == if_acmp_null) return if_acmp_nonnull; else if (opcode == if_acmp_nonnull) return if_acmp_null; else return ((opcode + 1) ^ 1) - 1; } /** Emit a jump instruction. * Return code pointer of instruction to be patched. */ public int emitJump(int opcode) { if (fatcode) { if (opcode == goto_ || opcode == jsr) { emitop4(opcode + goto_w - goto_, 0); } else { emitop2(negate(opcode), 8); emitop4(goto_w, 0); alive = true; pendingStackMap = needStackMap; } return cp - 5; } else { emitop2(opcode, 0); return cp - 3; } } /** Emit a branch with given opcode; return its chain. * branch differs from jump in that jsr is treated as no-op. */ public Chain branch(int opcode) { Chain result = null; if (opcode == goto_) { result = pendingJumps; pendingJumps = null; } if (opcode != dontgoto && isAlive()) { result = new Chain(emitJump(opcode), result, state.dup()); fixedPc = fatcode; if (opcode == goto_) alive = false; } return result; } /** Resolve chain to point to given target. */ public void resolve(Chain chain, int target) { boolean changed = false; State newState = state; for (; chain != null; chain = chain.next) { Assert.check(state != chain.state && (target > chain.pc || state.stacksize == 0)); if (target >= cp) { target = cp; } else if (get1(target) == goto_) { if (fatcode) target = target + get4(target + 1); else target = target + get2(target + 1); } if (get1(chain.pc) == goto_ && chain.pc + 3 == target && target == cp && !fixedPc) { // If goto the next instruction, the jump is not needed: // compact the code. cp = cp - 3; target = target - 3; if (chain.next == null) { // This is the only jump to the target. Exit the loop // without setting new state. The code is reachable // from the instruction before goto_. alive = true; break; } } else { if (fatcode) put4(chain.pc + 1, target - chain.pc); else if (target - chain.pc < Short.MIN_VALUE || target - chain.pc > Short.MAX_VALUE) fatcode = true; else put2(chain.pc + 1, target - chain.pc); Assert.check(!alive || chain.state.stacksize == newState.stacksize && chain.state.nlocks == newState.nlocks); } fixedPc = true; if (cp == target) { changed = true; if (debugCode) System.err.println("resolving chain state=" + chain.state); if (alive) { newState = chain.state.join(newState); } else { newState = chain.state; alive = true; } } } Assert.check(!changed || state != newState); if (state != newState) { setDefined(newState.defined); state = newState; pendingStackMap = needStackMap; } } /** Resolve chain to point to current code pointer. */ public void resolve(Chain chain) { Assert.check( !alive || chain==null || state.stacksize == chain.state.stacksize && state.nlocks == chain.state.nlocks); pendingJumps = mergeChains(chain, pendingJumps); } /** Resolve any pending jumps. */ public void resolvePending() { Chain x = pendingJumps; pendingJumps = null; resolve(x, cp); } /** Merge the jumps in of two chains into one. */ public static Chain mergeChains(Chain chain1, Chain chain2) { // recursive merge sort if (chain2 == null) return chain1; if (chain1 == null) return chain2; Assert.check( chain1.state.stacksize == chain2.state.stacksize && chain1.state.nlocks == chain2.state.nlocks); if (chain1.pc < chain2.pc) return new Chain( chain2.pc, mergeChains(chain1, chain2.next), chain2.state); return new Chain( chain1.pc, mergeChains(chain1.next, chain2), chain1.state); } /* ************************************************************************** * Catch clauses ****************************************************************************/ /** Add a catch clause to code. */ public void addCatch( char startPc, char endPc, char handlerPc, char catchType) { catchInfo.append(new char[]{startPc, endPc, handlerPc, catchType}); } public void compressCatchTable() { ListBuffer<char[]> compressedCatchInfo = ListBuffer.lb(); List<Integer> handlerPcs = List.nil(); for (char[] catchEntry : catchInfo) { handlerPcs = handlerPcs.prepend((int)catchEntry[2]); } for (char[] catchEntry : catchInfo) { int startpc = catchEntry[0]; int endpc = catchEntry[1]; if (startpc == endpc || (startpc == (endpc - 1) && handlerPcs.contains(startpc))) { continue; } else { compressedCatchInfo.append(catchEntry); } } catchInfo = compressedCatchInfo; } /* ************************************************************************** * Line numbers ****************************************************************************/ /** Add a line number entry. */ public void addLineNumber(char startPc, char lineNumber) { if (lineDebugInfo) { if (lineInfo.nonEmpty() && lineInfo.head[0] == startPc) lineInfo = lineInfo.tail; if (lineInfo.isEmpty() || lineInfo.head[1] != lineNumber) lineInfo = lineInfo.prepend(new char[]{startPc, lineNumber}); } } /** Mark beginning of statement. */ public void statBegin(int pos) { if (pos != Position.NOPOS) { pendingStatPos = pos; } } /** Force stat begin eagerly */ public void markStatBegin() { if (alive && lineDebugInfo) { int line = lineMap.getLineNumber(pendingStatPos); char cp1 = (char)cp; char line1 = (char)line; if (cp1 == cp && line1 == line) addLineNumber(cp1, line1); } pendingStatPos = Position.NOPOS; } /* ************************************************************************** * Simulated VM machine state ****************************************************************************/ class State implements Cloneable { /** The set of registers containing values. */ Bits defined; /** The (types of the) contents of the machine stack. */ Type[] stack; /** The first stack position currently unused. */ int stacksize; /** The numbers of registers containing locked monitors. */ int[] locks; int nlocks; State() { defined = new Bits(); stack = new Type[16]; } State dup() { try { State state = (State)super.clone(); state.defined = defined.dup(); state.stack = stack.clone(); if (locks != null) state.locks = locks.clone(); if (debugCode) { System.err.println("duping state " + this); dump(); } return state; } catch (CloneNotSupportedException ex) { throw new AssertionError(ex); } } void lock(int register) { if (locks == null) { locks = new int[20]; } else { locks = ArrayUtils.ensureCapacity(locks, nlocks); } locks[nlocks] = register; nlocks++; } void unlock(int register) { nlocks--; Assert.check(locks[nlocks] == register); locks[nlocks] = -1; } void push(Type t) { if (debugCode) System.err.println(" pushing " + t); switch (t.getTag()) { case VOID: return; case BYTE: case CHAR: case SHORT: case BOOLEAN: t = syms.intType; break; default: break; } stack = ArrayUtils.ensureCapacity(stack, stacksize+2); stack[stacksize++] = t; switch (width(t)) { case 1: break; case 2: stack[stacksize++] = null; break; default: throw new AssertionError(t); } if (stacksize > max_stack) max_stack = stacksize; } Type pop1() { if (debugCode) System.err.println(" popping " + 1); stacksize--; Type result = stack[stacksize]; stack[stacksize] = null; Assert.check(result != null && width(result) == 1); return result; } Type peek() { return stack[stacksize-1]; } Type pop2() { if (debugCode) System.err.println(" popping " + 2); stacksize -= 2; Type result = stack[stacksize]; stack[stacksize] = null; Assert.check(stack[stacksize+1] == null && result != null && width(result) == 2); return result; } void pop(int n) { if (debugCode) System.err.println(" popping " + n); while (n > 0) { stack[--stacksize] = null; n--; } } void pop(Type t) { pop(width(t)); } /** Force the top of the stack to be treated as this supertype * of its current type. */ void forceStackTop(Type t) { if (!alive) return; switch (t.getTag()) { case CLASS: case ARRAY: int width = width(t); Type old = stack[stacksize-width]; Assert.check(types.isSubtype(types.erasure(old), types.erasure(t))); stack[stacksize-width] = t; break; default: } } void markInitialized(UninitializedType old) { Type newtype = old.initializedType(); for (int i=0; i<stacksize; i++) if (stack[i] == old) stack[i] = newtype; for (int i=0; i<lvar.length; i++) { LocalVar lv = lvar[i]; if (lv != null && lv.sym.type == old) { VarSymbol sym = lv.sym; sym = sym.clone(sym.owner); sym.type = newtype; LocalVar newlv = lvar[i] = new LocalVar(sym); // should the following be initialized to cp? newlv.start_pc = lv.start_pc; } } } State join(State other) { defined = defined.andSet(other.defined); Assert.check(stacksize == other.stacksize && nlocks == other.nlocks); for (int i=0; i<stacksize; ) { Type t = stack[i]; Type tother = other.stack[i]; Type result = t==tother ? t : types.isSubtype(t, tother) ? tother : types.isSubtype(tother, t) ? t : error(); int w = width(result); stack[i] = result; if (w == 2) Assert.checkNull(stack[i+1]); i += w; } return this; } Type error() { throw new AssertionError("inconsistent stack types at join point"); } void dump() { dump(-1); } void dump(int pc) { System.err.print("stackMap for " + meth.owner + "." + meth); if (pc == -1) System.out.println(); else System.out.println(" at " + pc); System.err.println(" stack (from bottom):"); for (int i=0; i<stacksize; i++) System.err.println(" " + i + ": " + stack[i]); int lastLocal = 0; for (int i=max_locals-1; i>=0; i--) { if (defined.isMember(i)) { lastLocal = i; break; } } if (lastLocal >= 0) System.err.println(" locals:"); for (int i=0; i<=lastLocal; i++) { System.err.print(" " + i + ": "); if (defined.isMember(i)) { LocalVar var = lvar[i]; if (var == null) { System.err.println("(none)"); } else if (var.sym == null) System.err.println("UNKNOWN!"); else System.err.println("" + var.sym + " of type " + var.sym.erasure(types)); } else { System.err.println("undefined"); } } if (nlocks != 0) { System.err.print(" locks:"); for (int i=0; i<nlocks; i++) { System.err.print(" " + locks[i]); } System.err.println(); } } } static final Type jsrReturnValue = new Type(INT, null); /* ************************************************************************** * Local variables ****************************************************************************/ /** A live range of a local variable. */ static class LocalVar { final VarSymbol sym; final char reg; char start_pc = Character.MAX_VALUE; char length = Character.MAX_VALUE; LocalVar(VarSymbol v) { this.sym = v; this.reg = (char)v.adr; } public LocalVar dup() { return new LocalVar(sym); } public String toString() { return "" + sym + " in register " + ((int)reg) + " starts at pc=" + ((int)start_pc) + " length=" + ((int)length); } }; /** Local variables, indexed by register. */ LocalVar[] lvar; /** Add a new local variable. */ private void addLocalVar(VarSymbol v) { int adr = v.adr; lvar = ArrayUtils.ensureCapacity(lvar, adr+1); Assert.checkNull(lvar[adr]); if (pendingJumps != null) resolvePending(); lvar[adr] = new LocalVar(v); state.defined.excl(adr); } /** Set the current variable defined state. */ public void setDefined(Bits newDefined) { if (alive && newDefined != state.defined) { Bits diff = state.defined.dup().xorSet(newDefined); for (int adr = diff.nextBit(0); adr >= 0; adr = diff.nextBit(adr+1)) { if (adr >= nextreg) state.defined.excl(adr); else if (state.defined.isMember(adr)) setUndefined(adr); else setDefined(adr); } } } /** Mark a register as being (possibly) defined. */ public void setDefined(int adr) { LocalVar v = lvar[adr]; if (v == null) { state.defined.excl(adr); } else { state.defined.incl(adr); if (cp < Character.MAX_VALUE) { if (v.start_pc == Character.MAX_VALUE) v.start_pc = (char)cp; } } } /** Mark a register as being undefined. */ public void setUndefined(int adr) { state.defined.excl(adr); if (adr < lvar.length && lvar[adr] != null && lvar[adr].start_pc != Character.MAX_VALUE) { LocalVar v = lvar[adr]; char length = (char)(curPc() - v.start_pc); if (length > 0 && length < Character.MAX_VALUE) { lvar[adr] = v.dup(); v.length = length; putVar(v); } else { v.start_pc = Character.MAX_VALUE; } } } /** End the scope of a variable. */ private void endScope(int adr) { LocalVar v = lvar[adr]; if (v != null) { lvar[adr] = null; if (v.start_pc != Character.MAX_VALUE) { char length = (char)(curPc() - v.start_pc); if (length < Character.MAX_VALUE) { v.length = length; putVar(v); fillLocalVarPosition(v); } } } state.defined.excl(adr); } private void fillLocalVarPosition(LocalVar lv) { if (lv == null || lv.sym == null || lv.sym.annotations.isTypesEmpty()) return; for (Attribute.TypeCompound ta : lv.sym.getRawTypeAttributes()) { TypeAnnotationPosition p = ta.position; p.lvarOffset = new int[] { (int)lv.start_pc }; p.lvarLength = new int[] { (int)lv.length }; p.lvarIndex = new int[] { (int)lv.reg }; p.isValidOffset = true; } } // Method to be called after compressCatchTable to // fill in the exception table index for type // annotations on exception parameters. public void fillExceptionParameterPositions() { for (int i = 0; i < varBufferSize; ++i) { LocalVar lv = varBuffer[i]; if (lv == null || lv.sym == null || lv.sym.annotations.isTypesEmpty() || !lv.sym.isExceptionParameter()) return; int exidx = findExceptionIndex(lv); for (Attribute.TypeCompound ta : lv.sym.getRawTypeAttributes()) { TypeAnnotationPosition p = ta.position; p.exception_index = exidx; } } } private int findExceptionIndex(LocalVar lv) { List<char[]> iter = catchInfo.toList(); int len = catchInfo.length(); for (int i = 0; i < len; ++i) { char[] catchEntry = iter.head; iter = iter.tail; char handlerpc = catchEntry[2]; if (lv.start_pc == handlerpc + 1) { return i; } } return -1; } /** Put a live variable range into the buffer to be output to the * class file. */ void putVar(LocalVar var) { // Keep local variables if // 1) we need them for debug information // 2) it is an exception type and it contains type annotations if (!varDebugInfo && (!var.sym.isExceptionParameter() || var.sym.annotations.isTypesEmpty())) return; if ((var.sym.flags() & Flags.SYNTHETIC) != 0) return; if (varBuffer == null) varBuffer = new LocalVar[20]; else varBuffer = ArrayUtils.ensureCapacity(varBuffer, varBufferSize); varBuffer[varBufferSize++] = var; } /** Previously live local variables, to be put into the variable table. */ LocalVar[] varBuffer; int varBufferSize; /** Create a new local variable address and return it. */ private int newLocal(int typecode) { int reg = nextreg; int w = width(typecode); nextreg = reg + w; if (nextreg > max_locals) max_locals = nextreg; return reg; } private int newLocal(Type type) { return newLocal(typecode(type)); } public int newLocal(VarSymbol v) { int reg = v.adr = newLocal(v.erasure(types)); addLocalVar(v); return reg; } /** Start a set of fresh registers. */ public void newRegSegment() { nextreg = max_locals; } /** End scopes of all variables with registers &ge; first. */ public void endScopes(int first) { int prevNextReg = nextreg; nextreg = first; for (int i = nextreg; i < prevNextReg; i++) endScope(i); } /************************************************************************** * static tables *************************************************************************/ public static String mnem(int opcode) { return Mneumonics.mnem[opcode]; } private static class Mneumonics { private final static String[] mnem = new String[ByteCodeCount]; static { mnem[nop] = "nop"; mnem[aconst_null] = "aconst_null"; mnem[iconst_m1] = "iconst_m1"; mnem[iconst_0] = "iconst_0"; mnem[iconst_1] = "iconst_1"; mnem[iconst_2] = "iconst_2"; mnem[iconst_3] = "iconst_3"; mnem[iconst_4] = "iconst_4"; mnem[iconst_5] = "iconst_5"; mnem[lconst_0] = "lconst_0"; mnem[lconst_1] = "lconst_1"; mnem[fconst_0] = "fconst_0"; mnem[fconst_1] = "fconst_1"; mnem[fconst_2] = "fconst_2"; mnem[dconst_0] = "dconst_0"; mnem[dconst_1] = "dconst_1"; mnem[bipush] = "bipush"; mnem[sipush] = "sipush"; mnem[ldc1] = "ldc1"; mnem[ldc2] = "ldc2"; mnem[ldc2w] = "ldc2w"; mnem[iload] = "iload"; mnem[lload] = "lload"; mnem[fload] = "fload"; mnem[dload] = "dload"; mnem[aload] = "aload"; mnem[iload_0] = "iload_0"; mnem[lload_0] = "lload_0"; mnem[fload_0] = "fload_0"; mnem[dload_0] = "dload_0"; mnem[aload_0] = "aload_0"; mnem[iload_1] = "iload_1"; mnem[lload_1] = "lload_1"; mnem[fload_1] = "fload_1"; mnem[dload_1] = "dload_1"; mnem[aload_1] = "aload_1"; mnem[iload_2] = "iload_2"; mnem[lload_2] = "lload_2"; mnem[fload_2] = "fload_2"; mnem[dload_2] = "dload_2"; mnem[aload_2] = "aload_2"; mnem[iload_3] = "iload_3"; mnem[lload_3] = "lload_3"; mnem[fload_3] = "fload_3"; mnem[dload_3] = "dload_3"; mnem[aload_3] = "aload_3"; mnem[iaload] = "iaload"; mnem[laload] = "laload"; mnem[faload] = "faload"; mnem[daload] = "daload"; mnem[aaload] = "aaload"; mnem[baload] = "baload"; mnem[caload] = "caload"; mnem[saload] = "saload"; mnem[istore] = "istore"; mnem[lstore] = "lstore"; mnem[fstore] = "fstore"; mnem[dstore] = "dstore"; mnem[astore] = "astore"; mnem[istore_0] = "istore_0"; mnem[lstore_0] = "lstore_0"; mnem[fstore_0] = "fstore_0"; mnem[dstore_0] = "dstore_0"; mnem[astore_0] = "astore_0"; mnem[istore_1] = "istore_1"; mnem[lstore_1] = "lstore_1"; mnem[fstore_1] = "fstore_1"; mnem[dstore_1] = "dstore_1"; mnem[astore_1] = "astore_1"; mnem[istore_2] = "istore_2"; mnem[lstore_2] = "lstore_2"; mnem[fstore_2] = "fstore_2"; mnem[dstore_2] = "dstore_2"; mnem[astore_2] = "astore_2"; mnem[istore_3] = "istore_3"; mnem[lstore_3] = "lstore_3"; mnem[fstore_3] = "fstore_3"; mnem[dstore_3] = "dstore_3"; mnem[astore_3] = "astore_3"; mnem[iastore] = "iastore"; mnem[lastore] = "lastore"; mnem[fastore] = "fastore"; mnem[dastore] = "dastore"; mnem[aastore] = "aastore"; mnem[bastore] = "bastore"; mnem[castore] = "castore"; mnem[sastore] = "sastore"; mnem[pop] = "pop"; mnem[pop2] = "pop2"; mnem[dup] = "dup"; mnem[dup_x1] = "dup_x1"; mnem[dup_x2] = "dup_x2"; mnem[dup2] = "dup2"; mnem[dup2_x1] = "dup2_x1"; mnem[dup2_x2] = "dup2_x2"; mnem[swap] = "swap"; mnem[iadd] = "iadd"; mnem[ladd] = "ladd"; mnem[fadd] = "fadd"; mnem[dadd] = "dadd"; mnem[isub] = "isub"; mnem[lsub] = "lsub"; mnem[fsub] = "fsub"; mnem[dsub] = "dsub"; mnem[imul] = "imul"; mnem[lmul] = "lmul"; mnem[fmul] = "fmul"; mnem[dmul] = "dmul"; mnem[idiv] = "idiv"; mnem[ldiv] = "ldiv"; mnem[fdiv] = "fdiv"; mnem[ddiv] = "ddiv"; mnem[imod] = "imod"; mnem[lmod] = "lmod"; mnem[fmod] = "fmod"; mnem[dmod] = "dmod"; mnem[ineg] = "ineg"; mnem[lneg] = "lneg"; mnem[fneg] = "fneg"; mnem[dneg] = "dneg"; mnem[ishl] = "ishl"; mnem[lshl] = "lshl"; mnem[ishr] = "ishr"; mnem[lshr] = "lshr"; mnem[iushr] = "iushr"; mnem[lushr] = "lushr"; mnem[iand] = "iand"; mnem[land] = "land"; mnem[ior] = "ior"; mnem[lor] = "lor"; mnem[ixor] = "ixor"; mnem[lxor] = "lxor"; mnem[iinc] = "iinc"; mnem[i2l] = "i2l"; mnem[i2f] = "i2f"; mnem[i2d] = "i2d"; mnem[l2i] = "l2i"; mnem[l2f] = "l2f"; mnem[l2d] = "l2d"; mnem[f2i] = "f2i"; mnem[f2l] = "f2l"; mnem[f2d] = "f2d"; mnem[d2i] = "d2i"; mnem[d2l] = "d2l"; mnem[d2f] = "d2f"; mnem[int2byte] = "int2byte"; mnem[int2char] = "int2char"; mnem[int2short] = "int2short"; mnem[lcmp] = "lcmp"; mnem[fcmpl] = "fcmpl"; mnem[fcmpg] = "fcmpg"; mnem[dcmpl] = "dcmpl"; mnem[dcmpg] = "dcmpg"; mnem[ifeq] = "ifeq"; mnem[ifne] = "ifne"; mnem[iflt] = "iflt"; mnem[ifge] = "ifge"; mnem[ifgt] = "ifgt"; mnem[ifle] = "ifle"; mnem[if_icmpeq] = "if_icmpeq"; mnem[if_icmpne] = "if_icmpne"; mnem[if_icmplt] = "if_icmplt"; mnem[if_icmpge] = "if_icmpge"; mnem[if_icmpgt] = "if_icmpgt"; mnem[if_icmple] = "if_icmple"; mnem[if_acmpeq] = "if_acmpeq"; mnem[if_acmpne] = "if_acmpne"; mnem[goto_] = "goto_"; mnem[jsr] = "jsr"; mnem[ret] = "ret"; mnem[tableswitch] = "tableswitch"; mnem[lookupswitch] = "lookupswitch"; mnem[ireturn] = "ireturn"; mnem[lreturn] = "lreturn"; mnem[freturn] = "freturn"; mnem[dreturn] = "dreturn"; mnem[areturn] = "areturn"; mnem[return_] = "return_"; mnem[getstatic] = "getstatic"; mnem[putstatic] = "putstatic"; mnem[getfield] = "getfield"; mnem[putfield] = "putfield"; mnem[invokevirtual] = "invokevirtual"; mnem[invokespecial] = "invokespecial"; mnem[invokestatic] = "invokestatic"; mnem[invokeinterface] = "invokeinterface"; mnem[invokedynamic] = "invokedynamic"; mnem[new_] = "new_"; mnem[newarray] = "newarray"; mnem[anewarray] = "anewarray"; mnem[arraylength] = "arraylength"; mnem[athrow] = "athrow"; mnem[checkcast] = "checkcast"; mnem[instanceof_] = "instanceof_"; mnem[monitorenter] = "monitorenter"; mnem[monitorexit] = "monitorexit"; mnem[wide] = "wide"; mnem[multianewarray] = "multianewarray"; mnem[if_acmp_null] = "if_acmp_null"; mnem[if_acmp_nonnull] = "if_acmp_nonnull"; mnem[goto_w] = "goto_w"; mnem[jsr_w] = "jsr_w"; mnem[breakpoint] = "breakpoint"; } } }
e9c73f605c75031c58d42945f576d6397a71970a
b33cb90e7c8f27cfd35413833387d076b532635f
/src/day1/HelloWorld.java
f85a6464bb6287daf964b8bec43ba5a43d2de2dc
[]
no_license
kskolpen/GitPractice_1
70e68db5c80b75ed7d122a28e4c20ed65ed091ba
38d33e272c9133e5bda29b2e10b389974a4987d1
refs/heads/master
2023-04-14T00:47:04.169855
2021-04-24T20:52:55
2021-04-24T20:52:55
361,263,714
0
0
null
null
null
null
UTF-8
Java
false
false
229
java
package day1; public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World"); System.out.println("Adding GitHub now"); System.out.println("NEW STUFF"); } }
d07f0ac96d3f5f3cf5bbf03c33caee956c23cd13
2284c480349019aed23a106204a520961aeaf6e0
/src/main/java/poc/spring/boot/domain/model/DomainObject.java
084dae6f48c8014d799e28918a8b49b6f77b90da
[]
no_license
poc-z-cloud/poc-boot-web
dfa25f4e814cfc6eca7ed6994c927d59fbea6dbc
4de24251b70d6682d87350396ea0affe5e1bda6c
refs/heads/master
2022-12-23T21:58:13.888708
2022-12-09T22:14:42
2022-12-09T22:14:42
129,304,131
0
0
null
null
null
null
UTF-8
Java
false
false
127
java
package poc.spring.boot.domain.model; public interface DomainObject { Integer getId(); void setId(Integer id); }
eeeff8497526aad1eea842327538d2db2c1170c3
cd0466177f20a893cb2ef00e7e1d6682c2b9091a
/app/src/main/java/com/chen/fy/patshow/home/data/adapter/HomeAdapter.java
4e161680b09915c4714933a143ff3b02b70fb54a
[]
no_license
StephenChenOk/PatShow
497583321280a23fcca3e6a1af7623ff2d1f4277
77bef76e9c358bb0d1b964e5e8d28d0b0853392e
refs/heads/master
2023-04-13T22:22:38.545291
2021-04-23T05:53:37
2021-04-23T05:53:37
345,638,581
0
0
null
null
null
null
UTF-8
Java
false
false
2,737
java
package com.chen.fy.patshow.home.data.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import com.chen.fy.patshow.R; import com.chen.fy.patshow.home.share.data.ShareInfo; import com.chen.fy.patshow.network.MainServiceCreator; import com.chen.fy.patshow.user.data.User; import com.chen.fy.patshow.util.ShowUtils; import org.w3c.dom.Text; import java.util.List; import de.hdodenhof.circleimageview.CircleImageView; public class HomeAdapter extends RecyclerView.Adapter<HomeAdapter.ViewHolder> { private Context mContext; private int mResourceId; private List<ShareInfo> mList; public HomeAdapter(Context context, int resourceId) { this.mContext = context; this.mResourceId = resourceId; } public void setData(List<ShareInfo> list) { this.mList = list; } @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()) .inflate(mResourceId, parent, false); return new ViewHolder(view); } @Override public void onBindViewHolder(@NonNull ViewHolder holder, final int position) { ShareInfo shareInfo = mList.get(position); String url = shareInfo.getImgURL(); User user = shareInfo.getUser(); // set Glide.with(mContext).load(url).into(holder.ivImage); holder.tvContent.setText(shareInfo.getContent()); Glide.with(mContext) .load(MainServiceCreator.BASE_URL + user.getHeadUrl()) .into(holder.civHeadIcon); holder.tvNickname.setText(user.getNickname()); // image click holder.ivImage.setOnClickListener(v -> { ShowUtils.zoomPicture(mContext, v, url); }); } @Override public int getItemCount() { return mList.size(); } class ViewHolder extends RecyclerView.ViewHolder { private ImageView ivImage; private TextView tvContent; private CircleImageView civHeadIcon; private TextView tvNickname; ViewHolder(@NonNull View itemView) { super(itemView); ivImage = itemView.findViewById(R.id.iv_img_home_item); tvContent = itemView.findViewById(R.id.tv_content_home_item); civHeadIcon = itemView.findViewById(R.id.crv_head_icon_item); tvNickname = itemView.findViewById(R.id.tv_nickname_item); } } }
cb140c8e17e504c0c5efb6a40a676afbf035f267
c5ffe39f8930a2c7ad76c0f7466393c79772b0a5
/kaoyan/src/java/kaoyan/modifty_mima.java
f531ebc860354e87b486c143dac11c330c2e438e
[]
no_license
WhiteNew/website-of-PG-entrance-exam
74d7afd9815ade92dd5f1c8cda6db6c48e334454
d123011f9aa20ab768b76beef11c6d6adb0b3898
refs/heads/master
2020-06-07T16:55:03.464577
2019-06-21T08:32:48
2019-06-21T08:32:48
193,060,057
0
0
null
null
null
null
UTF-8
Java
false
false
5,379
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 kaoyan; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * * @author Baixin */ @WebServlet(name = "modifty_mima", urlPatterns = {"/modifty_mima"}) public class modifty_mima extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String uid=request.getParameter("uid"); String password=request.getParameter("password"); String password2=request.getParameter("password2"); Connection conn = null; PreparedStatement prst = null; ResultSet rs = null; String driver = "com.mysql.jdbc.Driver"; String url= "jdbc:mysql://localhost:3306/kaoyan"; String user = "root"; String pw ="123"; try { Class.forName(driver); conn = DriverManager.getConnection(url, user, pw); out.print(2); if(password.equals(password2)){ // String sql = "insert into gonggao(xuhao,biaoti,xueyuan,faburen,fabushijian,neirong,zhuangtai,liyou) values('"+new gonggao().i++ +"','"+biaoti+"','"+xueyuan+"','"+faburen+"','"+fabushijian+"','"+neirong+"','"+"待审核"+"','"+" "+"')"; String sql1="update user set password=? where uid=?"; prst=conn.prepareStatement(sql1); prst.setString(1,password); prst.setString(2, uid); prst.executeUpdate(); // HttpSession mySession = request.getSession(); // mySession.setAttribute("uid", uid); request.getRequestDispatcher("modifty_success.jsp").forward(request, response); }else { request.getRequestDispatcher("error.jsp").forward(request, response); } } catch (SQLException ex) { Logger.getLogger(modifty_mima.class.getName()).log(Level.SEVERE, null, ex); ex.printStackTrace(); } catch (ClassNotFoundException ex) { Logger.getLogger(modifty_mima.class.getName()).log(Level.SEVERE, null, ex); ex.printStackTrace(); }finally { if(rs !=null) try{rs.close();} catch (SQLException ex) { Logger.getLogger(modifty_mima.class.getName()).log(Level.SEVERE, null, ex);} if(prst !=null) try{prst.close();} catch (SQLException ex) { Logger.getLogger(modifty_mima.class.getName()).log(Level.SEVERE, null, ex);} if(conn !=null) try{conn.close();} catch (SQLException ex) { Logger.getLogger(modifty_mima.class.getName()).log(Level.SEVERE, null, ex);} out.close(); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
0347ee494dfda189587a8cafd7c7720953b0f4e3
c64400632c276f1781049099a01527e2380d4a66
/app/src/main/java/com/example/renovo/bulgariatour/adapters/PlacesRecyclerViewAdapter.java
f05dfa9c168bf69d233a59d0934bec5cc7293dd3
[]
no_license
nucleus210/BulgariaTour
347f96f4ef346a9f84d7ae5fd2d4b9a66461affe
94022a20485950c62a2da9ec4b9d6136787a1379
refs/heads/master
2020-03-25T01:36:38.895780
2019-02-03T19:34:45
2019-02-03T19:34:45
140,842,404
0
0
null
null
null
null
UTF-8
Java
false
false
2,551
java
package com.example.renovo.bulgariatour.adapters; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.example.renovo.bulgariatour.R; import com.example.renovo.bulgariatour.PlacesListFragment.OnListFragmentInteractionListener; import com.example.renovo.bulgariatour.places.PlacesContent.PlaceItem; import java.util.List; /** * {@link RecyclerView.Adapter} that can display a {@link PlaceItem} and makes a call to the * specified {@link OnListFragmentInteractionListener}. */ public class PlacesRecyclerViewAdapter extends RecyclerView.Adapter<PlacesRecyclerViewAdapter.ViewHolder> { private final List<PlaceItem> mValues; private final OnListFragmentInteractionListener mListener; public PlacesRecyclerViewAdapter(List<PlaceItem> items, OnListFragmentInteractionListener listener) { mValues = items; mListener = listener; } @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.fragment_places_list, parent, false); return new ViewHolder(view); } @Override public void onBindViewHolder(@NonNull final ViewHolder holder, int position) { holder.mContentView.setText(mValues.get(position).content); holder.mImageView.setImageResource(mValues.get(position).mImage); holder.mView.setOnClickListener(v -> { if (null != mListener) { // Notify the active callbacks interface (the activity, if the // fragment is attached to one) that an item has been selected. mListener.onListFragmentInteraction(position); } }); } @Override public int getItemCount() { return mValues.size(); } public class ViewHolder extends RecyclerView.ViewHolder { final View mView; final TextView mContentView; final ImageView mImageView; ViewHolder(View view) { super(view); mView = view; mContentView = view.findViewById(R.id.content_view); mImageView = view.findViewById(R.id.item_image); } @Override public String toString() { return super.toString() + " '" + mContentView.getText() + "'"; } } }
4250b4307a21e887c3a98b44e7a6de8611f36815
15a4f447531acc98dc09970d83705bc9eaca6f92
/src/sk/peterjurkovic/dril/de/InfoActivity.java
a0d30781dd6f66b0e54e5530a05d64b72ad64d6e
[]
no_license
peterjurkovic/Dril-de
326d0587eb67a10d5989be52fc63b49d74c6fae7
cefda7f2c98dcb3b924ee65d86db165b3f1f9e1f
refs/heads/master
2020-05-15T05:28:31.217464
2012-11-01T16:57:55
2012-11-01T16:57:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
647
java
package sk.peterjurkovic.dril.de; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ImageButton; public class InfoActivity extends MainActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.info_activity); ImageButton goHome = (ImageButton) findViewById(R.id.home); goHome.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { startActivity( new Intent(InfoActivity.this, DashboardActivity.class) ); } }); } }
0704b0f918d2c82fe067ee614541735c4119101b
6180817e2475b47cb401183d13145fab1dc1169d
/wo2b-common-api/src/com/wo2b/sdk/view/pulltorefresh/PullToRefreshScrollView.java
1b101913c09015d3d4a3b2ac134ad58e347b50f7
[ "Apache-2.0" ]
permissive
benniaobuguai/android-project-wo2b
a10c7f27949a5bd1ede675397d92bd6625c9f67f
edc5f13fb35d860345fe15062bd216e5ce418a34
refs/heads/master
2020-05-20T10:42:11.198177
2020-01-13T12:14:20
2020-01-13T12:14:20
29,479,296
85
45
null
null
null
null
UTF-8
Java
false
false
1,121
java
package com.wo2b.sdk.view.pulltorefresh; import android.content.Context; import android.util.AttributeSet; /** * 系统性上下拉控件 * * @author 笨鸟不乖 * @email [email protected] * @version 1.0.0 * @date 2014-11-10 */ public class PullToRefreshScrollView extends opensource.component.pulltorefresh.PullToRefreshScrollView { public PullToRefreshScrollView(Context context, AttributeSet attrs) { super(context, attrs); bindRefreshViewNothing(); } public PullToRefreshScrollView(Context context, opensource.component.pulltorefresh.PullToRefreshBase.Mode mode, opensource.component.pulltorefresh.PullToRefreshBase.AnimationStyle style) { super(context, mode, style); bindRefreshViewNothing(); } public PullToRefreshScrollView(Context context, opensource.component.pulltorefresh.PullToRefreshBase.Mode mode) { super(context, mode); bindRefreshViewNothing(); } public PullToRefreshScrollView(Context context) { super(context); bindRefreshViewNothing(); } private void bindRefreshViewNothing() { PullToRefreshHelper.bindRefreshViewNothing(this, Mode.BOTH); } }
340f6886c1a1ae0582277c85f3b26596394ae9a1
76d91a55e0f58aff9a1540b8719b0d06477cea56
/src/main/java/es/deusto/controller/IndexController.java
dcff0f91ecad406cb3d92fbdc6db3a07b0e862dd
[]
no_license
acanod/Biblioteca
fdf6a3dc4f80422d75c6d54491825f736cde55e4
c38f77f2d0e28f62a6a2f7ff0146eac3ac6b3fb5
refs/heads/master
2022-12-30T16:51:54.945198
2020-06-06T10:59:27
2020-06-06T10:59:27
267,341,747
0
0
null
null
null
null
UTF-8
Java
false
false
1,328
java
package es.deusto.controller; import java.io.IOException; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.stage.Modality; import javafx.stage.Stage; public class IndexController { @FXML private Button btnLibros; @FXML private Button btnAutores; @FXML private Button btnLibrerias; @FXML private Button btnEmpleados; private void cambiarVentana(String nombre) { FXMLLoader loader = new FXMLLoader(getClass().getResource("/es/deusto/" + nombre + ".fxml")); try { Scene scene = new Scene(loader.load()); Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.setScene(scene); stage.showAndWait(); } catch (IOException e) { e.printStackTrace(); } } @FXML void autores(ActionEvent event) throws IOException { cambiarVentana("autores"); } @FXML void empleados(ActionEvent event) { cambiarVentana("empleados"); } @FXML void librerias(ActionEvent event) { cambiarVentana("librerias"); } @FXML void libros(ActionEvent event) { cambiarVentana("libros"); } }
11be7c7c49c2039f0f5e55942ceb0b1eb0ee05a3
36d3f8750c6cd0a64a4e092a7de0fdfa5f0bbece
/JokeSite/src/main/java/webLayer/HomeController.java
82d2b5b4c3728b551088b8d18f9182f1b965de84
[]
no_license
Gliganu/Various-Little-Projects
a6e67fcb70dcc6654969cadf36b0719dc7c5cd63
c955e72f0da7e242de95233a4c1a2af578927918
refs/heads/master
2020-09-24T19:54:52.202343
2018-04-23T20:32:06
2018-04-23T20:32:06
65,906,441
0
0
null
null
null
null
UTF-8
Java
false
false
1,630
java
package webLayer; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import serviceLayer.JokesService; import serviceLayer.UsersService; import domainLayer.Joke; import domainLayer.User; @Controller @RequestMapping(value = "/") public class HomeController { private final static String HOME_PAGE = "home"; private final static String FUNNIEST_USERS_PAGE = "funniestUsers"; @Autowired private JokesService jokesService; @Autowired private UsersService usersService; @RequestMapping(value="/") public String showHomePage(Model model) { List<Joke> jokeList = jokesService.getAllJokes(); model.addAttribute("jokeList", jokeList); return HOME_PAGE; } @RequestMapping(value="/searchJokesByRating") public String searchJokesByRating(Model model) { List<Joke> jokeList = jokesService.getJokesByRating(); model.addAttribute("jokeList", jokeList); return HOME_PAGE; } @RequestMapping(value="/funniestUsers") public String searchFunniestUsers(Model model) { List<User> userList = usersService.getUsersByRating(); model.addAttribute("userList",userList); Map<User,Integer> jokesMap = new HashMap<User,Integer>(); for(User user: userList){ int numberJokes= jokesService.getJokesByUsername(user.getUsername()).size(); jokesMap.put(user, numberJokes); } model.addAttribute("jokesMap", jokesMap); return FUNNIEST_USERS_PAGE; } }
357e163313866c314ac13180d31a8ff0bc044fd4
9085076f0d3d75e19f3edb48dfb2543a7448ad7f
/src/com/mvc/demo/validation/CourseCodeConstraintValidator.java
20164823642194c10d96eeabcf601cc7a7a51c71
[]
no_license
jainanuj0812/spring-mvc-practice
ff1eea4f9f7bdac9df4b1b0d15824d39ab4f3811
bbe9715b2e13dd888dd4f590fdd8c2e41509ebfa
refs/heads/master
2022-04-20T12:21:52.306192
2020-04-18T17:30:11
2020-04-18T17:30:11
256,812,374
0
0
null
null
null
null
UTF-8
Java
false
false
536
java
package com.mvc.demo.validation; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; public class CourseCodeConstraintValidator implements ConstraintValidator<CourseCode, String> { private String coursePrifix; @Override public void initialize(CourseCode courseCode) { coursePrifix = courseCode.value(); } @Override public boolean isValid(String code, ConstraintValidatorContext arg1) { boolean result = code != null && code.startsWith(coursePrifix); return result; } }
f1f4c4f9af6dbbcc61d64a35b73eb287a05389d6
2a0d562bd56bc81255814a4bde3872734b183891
/src/main/java/org/davidwightman/testproject/dao/PersonDataAccessService.java
5b2253a95484df3367c59e58857b39034d525a9d
[]
no_license
davidwightman/testproject
9a769aebe5f589a2ca1d6844ecfa70fe16b52d5d
508be447f71554a41adfdea128c3b6c42c8c0555
refs/heads/master
2022-09-19T08:43:27.407714
2020-05-31T20:08:32
2020-05-31T20:08:32
267,313,521
0
0
null
null
null
null
UTF-8
Java
false
false
824
java
package org.davidwightman.testproject.dao; import org.davidwightman.testproject.model.Person; import org.springframework.stereotype.Repository; import java.util.List; import java.util.Optional; import java.util.UUID; @Repository("postgres") public class PersonDataAccessService implements PersonDao { @Override public int insertPerson(UUID id, Person person) { return 0; } @Override public List<Person> selectAllPeople() { return List.of(new Person(UUID.randomUUID(), "FROM POSTGRES DB")); } @Override public Optional<Person> selectPersonById(UUID id) { return Optional.empty(); } @Override public int deletePersonById(UUID id) { return 0; } @Override public int updatePerson(UUID id, Person person) { return 0; } }
1c9f902119e5c5529b017d39a1fab44e3639cb86
e6d0871231250dee5515bbfbf3d2f414b9bff3bb
/app/src/main/java/com/example/shani/gymapp/WebAppInterface.java
5176c5f21116755ce827f35df85f039033c4eb10
[]
no_license
ShaniGeva12/GymApp_Android
113b831591e124d7ab9e406b69bafcbb045f0598
4c0a7567e3a28eef05f5642e079542a9d5355209
refs/heads/master
2020-04-27T22:58:46.917300
2019-03-11T22:28:59
2019-03-11T22:28:59
174,757,407
0
0
null
null
null
null
UTF-8
Java
false
false
497
java
package com.example.shani.gymapp; import android.content.Context; import android.webkit.JavascriptInterface; import android.widget.Toast; public class WebAppInterface { Context mContext; /** Instantiate the interface and set the context */ WebAppInterface(Context c) { mContext = c; } /** Show a toast from the web page */ @JavascriptInterface public void showToast(String toast) { Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show(); } }
f783e5f5e3ff73053f0ac07c2b8cfe47012ddd22
f4aa697cdb15009be794685cdb7089f471812cc4
/src/main/java/org/j/products/entities/Product.java
99ea491c3d53f2c5d8aaddb6ef3f91ed7098166d
[]
no_license
lwzjf/spring-demo
ed8eb3247cb6f6a39c371db01b349f1b84929d75
7a67c28921cc277d4798aaa1f67efb466a25226f
refs/heads/master
2021-01-22T18:57:49.356326
2017-03-06T10:47:10
2017-03-06T10:47:10
85,136,800
1
0
null
2017-03-16T01:04:20
2017-03-16T01:04:20
null
UTF-8
Java
false
false
1,791
java
package org.j.products.entities; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.Table; import java.util.HashSet; import java.util.Set; /** * Created by Andrew on 11/9/16. */ @Entity @Table(name = "products") public class Product extends NamedEntity { @Column(name = "price", nullable = false) private Long price; public Long getPrice() { return price; } public void setPrice(final Long price) { this.price = price; } @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, fetch = FetchType.EAGER) @JoinTable(name = "items_values", joinColumns = { @JoinColumn( name = "item_id", referencedColumnName = "id" ) }, inverseJoinColumns = { @JoinColumn( name = "value_id", referencedColumnName = "id" ) } ) private Set<PropertyValue> values = new HashSet<PropertyValue>(); public Set<PropertyValue> getValues() { return values; } public void setValues(final Set<PropertyValue> values) { this.values = values; } public void addValue(final PropertyValue value) { values.add(value); } public void removeValue(final PropertyValue value) { values.remove(value); } public Set<Property> getProperties() { final Set<Property> properties = new HashSet<>(); values.forEach(value -> properties.add(value.getProperty())); return properties; } }
758cd4befd1fba2b33f590753c6c17795c1433ed
ebac03ab6fcc1c21cf03b3f8779a5b78d8698788
/Assignment2/.antlr/Assig2Lexer.java
34baeb05a40fcdc2abf9616068508152af064df5
[]
no_license
czhou578/Winter-2021-Quarter-Work
6906a9e91d1ae9b43a0347f0e3d9d145d642efb4
e10fa4fb93c92f5495c9974ceb3c0df9e179aa69
refs/heads/main
2023-08-18T00:48:42.301029
2021-09-21T16:27:25
2021-09-21T16:27:25
408,892,584
1
0
null
null
null
null
UTF-8
Java
false
false
3,130
java
// Generated from c:\Users\mycol\Winter Quarter 2021\CS 320 Prog. Lang\Work\src\Assignment2\Assig2.g4 by ANTLR 4.8 import org.antlr.v4.runtime.Lexer; import org.antlr.v4.runtime.CharStream; import org.antlr.v4.runtime.Token; import org.antlr.v4.runtime.TokenStream; import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.atn.*; import org.antlr.v4.runtime.dfa.DFA; import org.antlr.v4.runtime.misc.*; @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) public class Assig2Lexer extends Lexer { static { RuntimeMetaData.checkVersion("4.8", RuntimeMetaData.VERSION); } protected static final DFA[] _decisionToDFA; protected static final PredictionContextCache _sharedContextCache = new PredictionContextCache(); public static final int STRING=1; public static String[] channelNames = { "DEFAULT_TOKEN_CHANNEL", "HIDDEN" }; public static String[] modeNames = { "DEFAULT_MODE" }; private static String[] makeRuleNames() { return new String[] { "STRING" }; } public static final String[] ruleNames = makeRuleNames(); private static String[] makeLiteralNames() { return new String[] { }; } private static final String[] _LITERAL_NAMES = makeLiteralNames(); private static String[] makeSymbolicNames() { return new String[] { null, "STRING" }; } private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); /** * @deprecated Use {@link #VOCABULARY} instead. */ @Deprecated public static final String[] tokenNames; static { tokenNames = new String[_SYMBOLIC_NAMES.length]; for (int i = 0; i < tokenNames.length; i++) { tokenNames[i] = VOCABULARY.getLiteralName(i); if (tokenNames[i] == null) { tokenNames[i] = VOCABULARY.getSymbolicName(i); } if (tokenNames[i] == null) { tokenNames[i] = "<INVALID>"; } } } @Override @Deprecated public String[] getTokenNames() { return tokenNames; } @Override public Vocabulary getVocabulary() { return VOCABULARY; } public Assig2Lexer(CharStream input) { super(input); _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); } @Override public String getGrammarFileName() { return "Assig2.g4"; } @Override public String[] getRuleNames() { return ruleNames; } @Override public String getSerializedATN() { return _serializedATN; } @Override public String[] getChannelNames() { return channelNames; } @Override public String[] getModeNames() { return modeNames; } @Override public ATN getATN() { return _ATN; } public static final String _serializedATN = "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\3\7\b\1\4\2\t\2\3"+ "\2\3\2\2\2\3\3\3\3\2\3\4\2C\\c|\2\6\2\3\3\2\2\2\3\5\3\2\2\2\5\6\t\2\2"+ "\2\6\4\3\2\2\2\3\2\2"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); } } }
9b020fc3c18b612cdcf5a8d2e36ed6f4a68c3700
8b9022dda67a555c3fd70e652fa9159e5b517602
/src/main/java/org/drip/sample/bondeos/Taixing.java
8f268e4d1a1281d1bdfe65eb5d7c6fcb65f11d58
[ "Apache-2.0" ]
permissive
BugHunterPhilosopher/DROP
19b77d184fea32366c4892d7d2ca872a16b10c1c
166c1fc6276045aad97ffacf4226caccfa23ce10
refs/heads/master
2022-07-05T22:13:09.331395
2020-05-04T03:41:08
2020-05-04T03:41:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
17,199
java
package org.drip.sample.bondeos; import org.drip.analytics.date.*; import org.drip.numerical.common.FormatUtil; import org.drip.param.creator.MarketParamsBuilder; import org.drip.param.market.CurveSurfaceQuoteContainer; import org.drip.param.valuation.*; import org.drip.product.creator.BondBuilder; import org.drip.product.credit.BondComponent; import org.drip.product.definition.*; import org.drip.product.params.EmbeddedOptionSchedule; import org.drip.service.env.EnvManager; import org.drip.service.template.*; import org.drip.state.discount.MergedDiscountForwardCurve; import org.drip.state.govvie.GovvieCurve; /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! * Copyright (C) 2020 Lakshmi Krishnamurthy * Copyright (C) 2019 Lakshmi Krishnamurthy * Copyright (C) 2018 Lakshmi Krishnamurthy * Copyright (C) 2017 Lakshmi Krishnamurthy * * This file is part of DROP, an open-source library targeting analytics/risk, transaction cost analytics, * asset liability management analytics, capital, exposure, and margin analytics, valuation adjustment * analytics, and portfolio construction analytics within and across fixed income, credit, commodity, * equity, FX, and structured products. It also includes auxiliary libraries for algorithm support, * numerical analysis, numerical optimization, spline builder, model validation, statistical learning, * and computational support. * * https://lakshmidrip.github.io/DROP/ * * DROP is composed of three modules: * * - DROP Product Core - https://lakshmidrip.github.io/DROP-Product-Core/ * - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/ * - DROP Computational Core - https://lakshmidrip.github.io/DROP-Computational-Core/ * * DROP Product Core implements libraries for the following: * - Fixed Income Analytics * - Loan Analytics * - Transaction Cost Analytics * * DROP Portfolio Core implements libraries for the following: * - Asset Allocation Analytics * - Asset Liability Management Analytics * - Capital Estimation Analytics * - Exposure Analytics * - Margin Analytics * - XVA Analytics * * DROP Computational Core implements libraries for the following: * - Algorithm Support * - Computation Support * - Function Analysis * - Model Validation * - Numerical Analysis * - Numerical Optimizer * - Spline Builder * - Statistical Learning * * Documentation for DROP is Spread Over: * * - Main => https://lakshmidrip.github.io/DROP/ * - Wiki => https://github.com/lakshmiDRIP/DROP/wiki * - GitHub => https://github.com/lakshmiDRIP/DROP * - Repo Layout Taxonomy => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md * - Javadoc => https://lakshmidrip.github.io/DROP/Javadoc/index.html * - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal * - Release Versions => https://lakshmidrip.github.io/DROP/version.html * - Community Credits => https://lakshmidrip.github.io/DROP/credits.html * - Issues Catalog => https://github.com/lakshmiDRIP/DROP/issues * - JUnit => https://lakshmidrip.github.io/DROP/junit/index.html * - Jacoco => https://lakshmidrip.github.io/DROP/jacoco/index.html * * 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. */ /** * <i>Taixing</i> demonstrates EOS Fixed Coupon Multi-flavor Pricing and Relative Value Measure Generation * for Taixing. * * <br><br> * <ul> * <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ProductCore.md">Product Core Module</a></li> * <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/FixedIncomeAnalyticsLibrary.md">Fixed Income Analytics</a></li> * <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/sample/README.md">DROP API Construction and Usage</a></li> * <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/sample/bondeos/README.md">EOS Bond Bullet/Exercise Measures</a></li> * </ul> * <br><br> * * @author Lakshmi Krishnamurthy */ public class Taixing { private static final MergedDiscountForwardCurve FundingCurve ( final JulianDate dtSpot, final String strCurrency, final double dblBump) throws Exception { String[] astrDepositMaturityTenor = new String[] { "2D" }; double[] adblDepositQuote = new double[] { 0.0111956 + dblBump // 2D }; double[] adblFuturesQuote = new double[] { 0.011375 + dblBump, // 98.8625 0.013350 + dblBump, // 98.6650 0.014800 + dblBump, // 98.5200 0.016450 + dblBump, // 98.3550 0.017850 + dblBump, // 98.2150 0.019300 + dblBump // 98.0700 }; String[] astrFixFloatMaturityTenor = new String[] { "02Y", "03Y", "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" }; double[] adblFixFloatQuote = new double[] { 0.017029 + dblBump, // 2Y 0.019354 + dblBump, // 3Y 0.021044 + dblBump, // 4Y 0.022291 + dblBump, // 5Y 0.023240 + dblBump, // 6Y 0.024025 + dblBump, // 7Y 0.024683 + dblBump, // 8Y 0.025243 + dblBump, // 9Y 0.025720 + dblBump, // 10Y 0.026130 + dblBump, // 11Y 0.026495 + dblBump, // 12Y 0.027230 + dblBump, // 15Y 0.027855 + dblBump, // 20Y 0.028025 + dblBump, // 25Y 0.028028 + dblBump, // 30Y 0.027902 + dblBump, // 40Y 0.027655 + dblBump // 50Y }; MergedDiscountForwardCurve dcFunding = LatentMarketStateBuilder.SmoothFundingCurve ( dtSpot, strCurrency, astrDepositMaturityTenor, adblDepositQuote, "ForwardRate", adblFuturesQuote, "ForwardRate", astrFixFloatMaturityTenor, adblFixFloatQuote, "SwapRate" ); Component[] aDepositComp = OTCInstrumentBuilder.FundingDeposit ( dtSpot, strCurrency, astrDepositMaturityTenor ); Component[] aFuturesComp = ExchangeInstrumentBuilder.ForwardRateFuturesPack ( dtSpot, adblFuturesQuote.length, strCurrency ); Component[] aFixFloatComp = OTCInstrumentBuilder.FixFloatStandard ( dtSpot, strCurrency, "ALL", astrFixFloatMaturityTenor, "MAIN", 0. ); ValuationParams valParams = new ValuationParams ( dtSpot, dtSpot, strCurrency ); CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( dcFunding, null, null, null, null, null, null ); System.out.println(); System.out.println ("\t|-------------------------------------||"); System.out.println ("\t| DEPOSIT INPUT vs. CALC ||"); System.out.println ("\t|-------------------------------------||"); for (int i = 0; i < aDepositComp.length; ++i) System.out.println ("\t| [" + aDepositComp[i].maturityDate() + "] =" + FormatUtil.FormatDouble (aDepositComp[i].measureValue ( valParams, null, csqc, null, "ForwardRate" ), 1, 6, 1.) + " |" + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) + " ||" ); System.out.println ("\t|-------------------------------------||"); System.out.println(); System.out.println ("\t|-------------------------------------||"); System.out.println ("\t| FUTURES INPUT vs. CALC ||"); System.out.println ("\t|-------------------------------------||"); for (int i = 0; i < aFuturesComp.length; ++i) System.out.println ("\t| [" + aFuturesComp[i].maturityDate() + "] =" + FormatUtil.FormatDouble (aFuturesComp[i].measureValue ( valParams, null, csqc, null, "ForwardRate" ), 1, 6, 1.) + " |" + FormatUtil.FormatDouble (adblFuturesQuote[i], 1, 6, 1.) + " ||" ); System.out.println ("\t|-------------------------------------||"); System.out.println(); System.out.println ("\t|------------------------------------------------|| "); System.out.println ("\t| FIX-FLOAT INPUTS vs CALIB ||"); System.out.println ("\t|------------------------------------------------|| "); for (int i = 0; i < aFixFloatComp.length; ++i) System.out.println ("\t| [" + aFixFloatComp[i].maturityDate() + "] =" + FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( valParams, null, csqc, null, "CalibSwapRate" ), 1, 6, 1.) + " |" + FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 6, 1.) + " |" + FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( valParams, null, csqc, null, "FairPremium" ), 1, 6, 1.) + " ||" ); System.out.println ("\t|------------------------------------------------||"); System.out.println(); return dcFunding; } private static final GovvieCurve GovvieCurve ( final JulianDate dtSpot, final String strCode, final double[] adblCoupon, final double[] adblYield) throws Exception { JulianDate[] adtEffective = new JulianDate[] { dtSpot, dtSpot, dtSpot, dtSpot, dtSpot, dtSpot, dtSpot, dtSpot }; JulianDate[] adtMaturity = new JulianDate[] { dtSpot.addTenor ("1Y"), dtSpot.addTenor ("2Y"), dtSpot.addTenor ("3Y"), dtSpot.addTenor ("5Y"), dtSpot.addTenor ("7Y"), dtSpot.addTenor ("10Y"), dtSpot.addTenor ("20Y"), dtSpot.addTenor ("30Y") }; GovvieCurve gc = LatentMarketStateBuilder.GovvieCurve ( strCode, dtSpot, adtEffective, adtMaturity, adblCoupon, adblYield, "Yield", LatentMarketStateBuilder.SHAPE_PRESERVING ); BondComponent[] aComp = TreasuryBuilder.FromCode ( strCode, adtEffective, adtMaturity, adblCoupon ); ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); csqc.setGovvieState (gc); System.out.println(); System.out.println ("\t|-------------------------------------------||"); System.out.println ("\t| TREASURY INPUT vs CALIB YIELD ||"); System.out.println ("\t|-------------------------------------------||"); for (int i = 0; i < aComp.length; ++i) System.out.println ("\t| " + aComp[i].name() + " | " + FormatUtil.FormatDouble (adblYield[i], 1, 3, 100.) + "% | " + FormatUtil.FormatDouble (aComp[i].yieldFromPrice ( valParams, null, null, aComp[i].maturityDate().julian(), 1., aComp[i].priceFromYield ( valParams, null, null, gc.yield (aComp[i].maturityDate().julian()) ) ), 1, 3, 100.) + "% ||" ); System.out.println ("\t|-------------------------------------------||"); return gc; } private static final void RVMeasures ( final BondComponent bond, final JulianDate dtValue, final CurveSurfaceQuoteContainer csqc, final double dblCleanPrice) throws Exception { JulianDate dtSettle = dtValue.addBusDays ( 3, bond.currency() ); ValuationParams valParams = new ValuationParams ( dtValue, dtSettle, bond.currency() ); System.out.println(); System.out.println ("\t|--------------------------------||"); System.out.println ("\t| Trade Date : " + dtValue + " ||"); System.out.println ("\t| Cash Settle Date : " + dtSettle + " ||"); System.out.println ("\t|--------------------------------||"); System.out.println(); double dblYTM = Double.NaN; double dblYTW = Double.NaN; double dblOASTW = Double.NaN; double dblWALTM = Double.NaN; double dblWALTW = Double.NaN; double dblZSpreadTW = Double.NaN; double dblModifiedDurationTW = Double.NaN; WorkoutInfo wi = bond.exerciseYieldFromPrice ( valParams, csqc, null, dblCleanPrice ); try { dblYTW = wi.yield(); dblYTM = bond.yieldFromPrice ( valParams, csqc, null, bond.maturityDate().julian(), 1., dblCleanPrice ); dblWALTW = bond.weightedAverageLife ( valParams, csqc, wi.date(), wi.factor() ); dblWALTM = bond.weightedAverageLife ( valParams, csqc, bond.maturityDate().julian(), 1. ); dblZSpreadTW = bond.zSpreadFromYield ( valParams, csqc, null, wi.date(), wi.factor(), wi.yield() ); dblOASTW = bond.oasFromYield ( valParams, csqc, null, wi.date(), wi.factor(), wi.yield() ); dblModifiedDurationTW = bond.modifiedDurationFromPrice ( valParams, csqc, null, wi.date(), wi.factor(), dblCleanPrice ); } catch (Exception e) { // e.printStackTrace(); } System.out.println ("\t Bond Name => " + bond.name()); System.out.println ("\t Effective Date => " + bond.effectiveDate()); System.out.println ("\t Maturity Date => " + bond.maturityDate()); System.out.println ("\t Exercise Date => " + new JulianDate (wi.date())); System.out.println ("\t Price => " + FormatUtil.FormatDouble (dblCleanPrice, 1, 5, 100.)); System.out.println ("\t Bond Accrued => " + FormatUtil.FormatDouble (bond.accrued (dtSettle.julian(), csqc), 1, 4, 100.)); System.out.println ("\t Bond YTW => " + FormatUtil.FormatDouble (dblYTW, 1, 3, 100.) + "%"); System.out.println ("\t Bond YTM => " + FormatUtil.FormatDouble (dblYTM, 1, 3, 100.) + "%"); System.out.println ("\t Bond WAL TW => " + FormatUtil.FormatDouble (dblWALTW, 1, 3, 1.)); System.out.println ("\t Bond WAL TM => " + FormatUtil.FormatDouble (dblWALTM, 1, 3, 1.)); System.out.println ("\t Bond Modified Duration TW => " + FormatUtil.FormatDouble (dblModifiedDurationTW, 1, 4, 10000.)); System.out.println ("\t Bond Z Spread TW => " + FormatUtil.FormatDouble (dblZSpreadTW, 1, 1, 10000.)); System.out.println ("\t Bond OAS TW => " + FormatUtil.FormatDouble (dblOASTW, 1, 1, 10000.)); } public static final void main ( final String[] astrArgs) throws Exception { EnvManager.InitEnv ( "", true ); JulianDate dtSpot = DateUtil.CreateFromYMD ( 2017, DateUtil.MARCH, 10 ); String strCurrency = "USD"; String strTreasuryCode = "UST"; double[] adblTreasuryCoupon = new double[] { 0.0100, 0.0100, 0.0125, 0.0150, 0.0200, 0.0225, 0.0250, 0.0300 }; double[] adblTreasuryYield = new double[] { 0.0083, // 1Y 0.0122, // 2Y 0.0149, // 3Y 0.0193, // 5Y 0.0227, // 7Y 0.0248, // 10Y 0.0280, // 20Y 0.0308 // 30Y }; JulianDate dtEffective = DateUtil.CreateFromYMD (2010, 12, 21); JulianDate dtMaturity = DateUtil.CreateFromYMD (2035, 12, 15); double dblCoupon = 0.07140; double dblCleanPrice = 1.1089370; int iFreq = 2; String strCUSIP = "Taixing"; String strDayCount = "30/360"; int[] aiExerciseDate = new int[] { DateUtil.CreateFromYMD (2020, 6, 15).julian(), DateUtil.CreateFromYMD (2021, 6, 15).julian(), DateUtil.CreateFromYMD (2022, 6, 15).julian(), DateUtil.CreateFromYMD (2023, 6, 15).julian(), DateUtil.CreateFromYMD (2024, 6, 15).julian(), DateUtil.CreateFromYMD (2025, 6, 15).julian(), DateUtil.CreateFromYMD (2026, 6, 15).julian(), DateUtil.CreateFromYMD (2027, 6, 15).julian(), DateUtil.CreateFromYMD (2028, 6, 15).julian(), DateUtil.CreateFromYMD (2029, 6, 15).julian(), DateUtil.CreateFromYMD (2030, 6, 15).julian(), DateUtil.CreateFromYMD (2031, 6, 15).julian(), DateUtil.CreateFromYMD (2032, 6, 15).julian(), DateUtil.CreateFromYMD (2033, 6, 15).julian(), DateUtil.CreateFromYMD (2034, 6, 15).julian(), DateUtil.CreateFromYMD (2035, 6, 15).julian(), }; double[] adblExercisePrice = new double[] { 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., }; BondComponent bond = BondBuilder.CreateSimpleFixed ( strCUSIP, strCurrency, "", dblCoupon, iFreq, strDayCount, dtEffective, dtMaturity, null, null ); EmbeddedOptionSchedule eos = new EmbeddedOptionSchedule ( aiExerciseDate, adblExercisePrice, false, 30, false, Double.NaN, "", Double.NaN ); bond.setEmbeddedCallSchedule (eos); RVMeasures ( bond, dtSpot, MarketParamsBuilder.Create ( FundingCurve ( dtSpot, strCurrency, 0. ), GovvieCurve ( dtSpot, strTreasuryCode, adblTreasuryCoupon, adblTreasuryYield ), null, null, null, null, null ), dblCleanPrice ); EnvManager.TerminateEnv(); } }
99775726c2ed2172ef4d11f41519845807c149a1
3596c85b7c56fec815b6a1b7f2400cb4da798adf
/src/main/java/com/JavaStudent/DesignPattern/Bridge/ProgramCreator.java
ba079ea9980c0fa0e1872840e0943d534dcc0430
[]
no_license
Efficeon/JavaStudent
ca72cf663b7b94f12c3d3a459fb03d19a0b1fc88
d118cd940f8b93310bfead47cf7d29d883b44e0f
refs/heads/master
2020-05-21T17:55:54.591773
2016-10-06T20:46:01
2016-10-06T20:46:01
63,245,950
0
0
null
null
null
null
UTF-8
Java
false
false
359
java
package com.JavaStudent.DesignPattern.Bridge; public class ProgramCreator { public static void main(String[] args) { Program[] programs = {new BankSystem(new JavaDeveloper()), new StockExchange(new CppDeveloper())}; for (Program program : programs){ program.developProgram(); } } }
0cc9cc8e360e5bae98494c5647a111822994db66
a194d5755e1f3f2204400eccc4a73a2d50f1873a
/src/java/Facades/TipoDocumentoFacade.java
20a83e660228862f2751cc9e0d75f6bf325bc932
[]
no_license
victornavelino/capacitacion
adfd32de5d4988c5ea852cf14effd82e62cd1672
6458d9f59bd12140ef7d37a7e5072191a89af17a
refs/heads/master
2021-07-15T08:59:40.874358
2020-12-11T22:21:53
2020-12-11T22:21:53
226,762,660
0
1
null
null
null
null
UTF-8
Java
false
false
766
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 Facades; import Entidades.persona.TipoDocumento; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; /** * * @author nago */ @Stateless public class TipoDocumentoFacade extends AbstractFacade<TipoDocumento> { @PersistenceContext(unitName = "ProyectoCapacitacionPU") private EntityManager em; @Override protected EntityManager getEntityManager() { return em; } public TipoDocumentoFacade() { super(TipoDocumento.class); } }
[ "nago@DESKTOP-D5JOMH4" ]
nago@DESKTOP-D5JOMH4
7c2e56762e3cf448bcad4a99efc32a40aa02f487
754d3dc89dfd0ea5254504c42397ec90a38d6529
/src/test/java/com/companyName/projectName/module/utilities/Constants.java
a4235af9ea9501a61ee5a156b7f3f21af6859640
[]
no_license
rganjare/SeleniumTraining-B2
53148153f318f4b028c0b4a4f12e430bbde0498b
5f0251221d50d4e624d3be7d20c05aa590c637c7
refs/heads/master
2023-02-13T04:11:29.642734
2021-01-08T12:48:35
2021-01-08T12:48:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,207
java
package com.companyName.projectName.module.utilities; public class Constants { public static final String ConfigFile_Path = "\\src\\test\\resources\\properties\\Config.properties"; public static final String ORFile_Path = "\\src\\test\\resources\\properties\\OR.properties"; public static final String ExecutionReport_Path = "\\src\\test\\resources\\execution_Reports\\Execution_Results_"; public static final String ChromeDriver_Path = "E:\\Study Material\\Softwares\\chromedriver.exe"; public static final String Geckodriver_Path = "E:\\Study Material\\Softwares\\geckodriver-v0.24.0-win32\\geckodriver.exe"; public static final String IEDriver_Path = "E:\\Study Material\\Softwares\\IEDriverServer.exe"; public static final String MasterSheet_Path = "E:\\Study Material\\Automation_World-Training\\workspace\\Batch4thMayMavenProject\\src\\test\\resources\\testData\\Master_Sheet.xlsx"; public static final String TestCase_SheetName = "Test_Cases"; public static final String TestData_SheetName = "Test_Data"; public static final String Col_TestCaseName = "TestCaseName"; public static final String Col_RunMode = "Run_Mode"; //final - keyword //finally - method }
4455588d6eeed9814ea7a48bc51494f3cf4983e3
a360de09b03f49335462bd74974a18ab6f3cc9d3
/Source/GUIListeners/EnvironmentTabListener.java
bb2a514e540f65bf7c43a822c3fdd6a7939fb5b4
[]
no_license
dixons-57/DI-Network-Tool-Suite
660f6c24d2e350b4f330e32392e0e3bbc26c097d
ee0077c40335b42ec8351b9e9c86192498ba582d
refs/heads/master
2020-06-29T03:08:37.716779
2019-08-03T21:15:27
2019-08-03T21:15:27
200,421,620
0
0
null
null
null
null
UTF-8
Java
false
false
10,481
java
package GUIListeners; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JOptionPane; import EnvironmentOperations.NonArbGeneration; import EnvironmentOperations.UncertaintyGeneration; import GUI.ConsoleWindow; import GUI.EnvironmentTab; import InputOutputOperations.GeneralOperations; import InputOutputOperations.ParseSetNotationModule; import InputOutputOperations.SetNotationModulePresets; import SetNotationStructure.SetNotationModule; /* Process GUI events from the Environment Generation tab. It also acts as an intermediate * between the GUI aspects of the software and the various back-end algorithms and operations */ public class EnvironmentTabListener implements ActionListener { /* The static singleton instance of this class that is accessed by the GUI package */ public static EnvironmentTabListener instance = new EnvironmentTabListener(); /* Records which environment generation algorithm can be used (non-arb or general) */ private int algorithmType=0; /* Records whether the Set Notation module definition is currently being edited */ private boolean editingSetModule=false; /* Records whether the stored module is auto-clashing */ private boolean setModuleAutoClash=false; /* Records whether the stored module is auto-firing */ private boolean setModuleAutoFire=false; /* Records whether the stored module is 1-step consistent */ private boolean setModuleOneStepConsistent=false; /* Records whether the stored module is stable */ private boolean setModuleStable=false; /* Stores the generated environment */ private SetNotationModule storedEnvironment = null; /* Stores the parsed Set Notation module */ private SetNotationModule storedSetModule = null; /* Records whether a valid Set Notation module has been parsed */ private boolean validSetModule=false; /* Handles JButton events, disabling/re-enabling GUI elements appropriately. */ @Override public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); /* Initiates/finalises user editing of the module definition, parsing of the definition data is attempted * if this button is clicked when the user is already editing. */ if(command.equals("EditSet")){ if(!editingSetModule){ ConsoleWindow.output("Editing Set Module definition"); editingSetModule=true; EnvironmentTab.instance.EditButton.setText("Parse Definition"); EnvironmentTab.instance.ModuleDefinitionTextArea.setEditable(true); EnvironmentTab.instance.PresetBox.setEnabled(false); EnvironmentTab.instance.PresetLoadButton.setEnabled(false); EnvironmentTab.instance.PresetSaveButton.setEnabled(false); EnvironmentTab.instance.GenerateButton.setEnabled(false); ConsoleWindow.output("Other GUI controls disabled"); } else if(editingSetModule){ ConsoleWindow.output("Parsing Set Notation Module definition"); String module = EnvironmentTab.instance.ModuleDefinitionTextArea.getText(); loadModule(module); } } /* Displays helpful info to the user about how to enter a Set Notation module definition*/ if(command.equals("?")){ JOptionPane.showMessageDialog(null, "Enter a series of CCS-like state definitions separated by semi-colons. Line breaks are also allowed.\n" + "Also don't worry about spaces.\nType the definitions similarly to how they appear in the thesis, and in the included preset examples. \nDo not add random brackets.\n" + "Use only alpha-numeric characters (and prime operators ') for state, input, and output names.\n\n" + "e.g:\n\nS0 = ({a,b,c},{x,y}).S0 + ({a,b},{z}).S1;\n" + "S1 = ({c},{x}).S0 + ({a,b},{x,z}).S0;\n"); } /* Attempts to load the selected preset which stores a Set Notation module definition */ else if(command.equals("Load")){ if(EnvironmentTab.instance.PresetBox.getSelectedIndex()!=-1 && !EnvironmentTab.instance.PresetBox.getSelectedItem().toString().equals("")){ ConsoleWindow.output("Loading selected Set Notation module preset: "+EnvironmentTab.instance.PresetBox.getSelectedItem()+".snp"); if(SetNotationModulePresets.loadPreset(EnvironmentTab.instance.PresetBox.getSelectedItem().toString(),2)){ ConsoleWindow.output("Loaded preset: "+EnvironmentTab.instance.PresetBox.getSelectedItem()+".snp"); } else{ ConsoleWindow.output("Failed to load preset: "+EnvironmentTab.instance.PresetBox.getSelectedItem()+".snp"); } } else{ ConsoleWindow.output("No Set Notation module preset selected"); } } /* Attempts to save the existing Set Notation module definition as a preset */ else if(command.equals("Save")){ if(validSetModule){ ConsoleWindow.output("Saving current Set Notation Module definition in Environment Generation tab as a Set Notation module preset"); while(true){ String fileNameInput = JOptionPane.showInputDialog("Please enter a filename using only alphanumeric characters"); if(fileNameInput==null){ ConsoleWindow.output("Saving of preset cancelled by user"); break; } else if(GeneralOperations.alphaNumeric(fileNameInput,true) && !fileNameInput.equals("")){ boolean success = SetNotationModulePresets.savePreset(EnvironmentTab.instance.EnvironmentTextArea.getText(),fileNameInput); if(success){ ConsoleWindow.output("Saved preset: "+fileNameInput+".snp"); SetNotationModulePresets.loadFileList(); ConsoleWindow.output("Reloaded Set Notation module presets"); } else{ ConsoleWindow.output("Failed to save preset: "+fileNameInput+".snp"); } break; } ConsoleWindow.output("Invalid alphanumeric input. Please try again or cancel"); } } else{ ConsoleWindow.output("No valid module definition to save as a preset"); } } /* Generates the environment for the stored Set Notation module definition, using whichever algorithm * is required (non-arb algorithm if non-arb module, general algorithm otherwise) */ else if(command.equals("Generate Environment")){ if(algorithmType==1){ ConsoleWindow.output("Beginning environment generation (non-arb algorithm)"); storedEnvironment=NonArbGeneration.nonArb(storedSetModule); EnvironmentTab.instance.EnvironmentTextArea.setText(storedEnvironment.printModule()); ConsoleWindow.output("Environment generation complete"); } else if(algorithmType==2){ ConsoleWindow.output("Beginning environment generation (uncertainty algorithm)"); ConsoleWindow.output("A \"configuration\" refers to a triple String;Set;Set, where the String refers to a module state, " + "the first set refers to a set of pending input signals of the module, and the second set refers to a set of currently " + "travelling output signals from the module."); ConsoleWindow.output("An \"uncertainty\" refers to a finite set of configurations of the form config1:config2:config3 etc."); storedEnvironment=UncertaintyGeneration.generate(storedSetModule); EnvironmentTab.instance.EnvironmentTextArea.setText(storedEnvironment.printModule()); ConsoleWindow.output("Environment generation complete"); } } } /* Attempts to build the module object for the entered (or loaded from preset) definition. It utilises parsing functionality * from ParseSetNotationModule. It then checks various module properties which are relevant to environment generation */ public void loadModule(String module) { boolean ok=false; EnvironmentTab.instance.StatusLabel.setText("Status: N/A"); if(module.equals("")){ ok=true; validSetModule=false; algorithmType=0; storedSetModule=null; storedEnvironment=null; EnvironmentTab.instance.EnvironmentTextArea.setText(""); ConsoleWindow.output("Set Notation Module definition cleared"); } else{ SetNotationModule parsedResult; try { parsedResult = ParseSetNotationModule.parse(module); } catch (Exception e1) { parsedResult=null; } if(parsedResult==null){ ConsoleWindow.output("Error parsing Set Notation Module definition - please check and try again"); } else{ validSetModule=true; ok=true; storedSetModule=parsedResult; EnvironmentTab.instance.ModuleDefinitionTextArea.setText(parsedResult.printModule()); ConsoleWindow.output("Set Notation Module definition successfully parsed, checking well-formedness"); setModuleStable=false; setModuleAutoFire=false; setModuleAutoClash=false; setModuleOneStepConsistent=false; boolean arb=parsedResult.checkArb(); if(arb){ setModuleOneStepConsistent=parsedResult.checkOneStepConsistent(); setModuleStable=parsedResult.checkStability(); setModuleAutoFire = parsedResult.autoFiring(); if(setModuleAutoFire){ setModuleAutoClash = parsedResult.autoClashing(); } } if(!arb){ ConsoleWindow.output("Set Notation Module definition is non-arb (and hence stable,consistent, and non-auto-processing)" + " so the efficient environmental generation algorithm can be used"); EnvironmentTab.instance.StatusLabel.setText("Status: non-arb: Efficient algorithm available"); algorithmType=1; } else { String properties; if(setModuleOneStepConsistent){ properties="1-Step Consistent, "; } else{ properties="not 1-Step Consistent, "; } if(setModuleStable){ properties=properties + "stable, "; } else{ properties=properties + "unstable, "; } if(setModuleAutoFire){ properties=properties+"auto-firing"; if(setModuleAutoClash){ properties=properties+", and auto-clashing"; } } else{ properties=properties+"non-auto-processing"; } ConsoleWindow.output("Set Notation Module definition is arb, "+properties+", so uncertainty algorithm is needed"); EnvironmentTab.instance.StatusLabel.setText("Status: arb: Uncertainty algorithm required"); algorithmType=2; } } } if(ok){ editingSetModule=false; EnvironmentTab.instance.EditButton.setText("Edit Definition"); EnvironmentTab.instance.ModuleDefinitionTextArea.setEditable(false); EnvironmentTab.instance.PresetBox.setEnabled(true); EnvironmentTab.instance.PresetLoadButton.setEnabled(true); EnvironmentTab.instance.PresetSaveButton.setEnabled(true); EnvironmentTab.instance.GenerateButton.setEnabled(true); ConsoleWindow.output("GUI controls re-enabled"); } } }
508912fb25d5b91e48ae6080895193209e99a959
c97f0f8921dcd2a5b08a28bcd3af0b269e1fc619
/src/main/java/com/liveproject/simulatecustomer/model/OBExternalPartyType1Code.java
a11fbd9dddf27e23b15f68f2a47ee4d95761dabd
[]
no_license
gardida/simulate-customer
61bf5e3ca70d34674b198b00838af63bc21e67ab
099b37409f8ea4466b0e9881aac10f9eb85e7e03
refs/heads/master
2023-01-20T04:17:26.464126
2020-11-25T16:18:15
2020-11-25T16:18:15
314,588,968
0
0
null
null
null
null
UTF-8
Java
false
false
753
java
package com.liveproject.simulatecustomer.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; /** * Party type, in a coded form. */ public enum OBExternalPartyType1Code { DELEGATE("Delegate"), JOINT("Joint"), SOLE("Sole"); private String value; OBExternalPartyType1Code(String value) { this.value = value; } @Override @JsonValue public String toString() { return String.valueOf(value); } @JsonCreator public static OBExternalPartyType1Code fromValue(String text) { for (OBExternalPartyType1Code b : OBExternalPartyType1Code.values()) { if (String.valueOf(b.value).equals(text)) { return b; } } return null; } }
a9aa917266b96452263596a8d8d07afbba48913e
f934bb8661ca56236a40e57796b63b1446887a75
/com.zwayam.applies.puller.be/src/com/zwayam/appliespuller/mysql/repo/AuthApiConfigRepo.java
c98ec3750c6560a2447c9d9f3a6b19d5eedcc580
[]
no_license
sadique-mm/test
58470d27f963c4969dffb30c2214466d766a33c1
61b3b4d6c198be97c39210101f80d1c5186f917c
refs/heads/master
2021-07-12T04:24:42.013967
2017-10-15T16:59:38
2017-10-15T16:59:38
107,030,735
0
0
null
null
null
null
UTF-8
Java
false
false
429
java
package com.zwayam.appliespuller.mysql.repo; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import com.zwayam.appliespuller.mysql.models.AuthApiConfig; import com.zwayam.appliespuller.mysql.models.PullAppliesApiConfig; @Repository public interface AuthApiConfigRepo extends CrudRepository<AuthApiConfig, Integer> { AuthApiConfig findByName(String name); }
8997b42089e800d688e12beea90aeeb6191ae781
f7770e21f34ef093eb78dae21fd9bde99b6e9011
/src/main/java/com/hengyuan/hicash/service/validate/update/SaveMyMessageVal.java
72a2599b7c6c4f82d82d90d4bb3d906341ac94af
[]
no_license
webvul/HicashAppService
9ac8e50c00203df0f4666cd81c108a7f14a3e6e0
abf27908f537979ef26dfac91406c1869867ec50
refs/heads/master
2020-03-22T19:58:41.549565
2017-12-26T08:30:04
2017-12-26T08:30:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,050
java
package com.hengyuan.hicash.service.validate.update; import com.hengyuan.hicash.constant.ResultCodes; import com.hengyuan.hicash.parameters.request.user.SaveMyMessageReq; import com.hengyuan.hicash.utils.RegexValidate; public class SaveMyMessageVal { private SaveMyMessageReq valReq; public SaveMyMessageVal(SaveMyMessageReq valReq) { this.valReq = valReq; } public String validate(){ /* 姓名*/ if(RegexValidate.isNull(valReq.getName())){ return ResultCodes.REGISTER_REALNAME_ISNULL; } /* 消息code*/ if(RegexValidate.isNull(valReq.getCode())){ return ResultCodes.DDSJ_CODE_IS_NULL; } /* 用户名 */ if(RegexValidate.isNull(valReq.getUserName())){ return ResultCodes.ADDMERAPP_USERNAME_ISNULL; } /* 身份证号 */ if(RegexValidate.isNull(valReq.getIdNo())){ return ResultCodes.IDCARD_ISNULL; } /* 手机号 */ if(RegexValidate.isNull(valReq.getMobile())){ return ResultCodes.SENDAMOUNTCODE_MOBILE_ISNULL; } return ResultCodes.NORMAL; } }
845b0d042df62eaeb027e4df2099be9d4d5a5593
f5fd91045c1ab5ddab475ceaec809542b3d85664
/src/cn/moart/bugMg/test/InitRedisService.java
fc98af231419016b2432a8bc5f1591ffe5b4af17
[]
no_license
nikhe/bugMg
30e94a82b173f82e1daf0a48beddccd13eb9bcfe
bef73467bbc1c4767117540e6aef0df4c8043603
refs/heads/master
2021-05-30T21:47:03.015242
2016-04-19T03:22:25
2016-04-19T03:22:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,908
java
package cn.moart.bugMg.test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; /** * Service for initializing Redis with sample data */ @Component("initService") public class InitRedisService { @Autowired private RedisTemplate<String, String> template; public void init() { // Delete existing ones String key = "menuid_"+"1000100"; template.opsForHash().delete(key, "id"); template.opsForHash().delete(key, "name"); template.opsForHash().delete(key, "icon"); template.opsForHash().delete(key, "url"); template.opsForHash().delete(key, "parent_id"); key = "menuid_"+"1000101"; template.opsForHash().delete(key, "id"); template.opsForHash().delete(key, "name"); template.opsForHash().delete(key, "icon"); template.opsForHash().delete(key, "url"); template.opsForHash().delete(key, "parent_id"); key = "menuid_"+"1000102"; template.opsForHash().delete(key, "id"); template.opsForHash().delete(key, "name"); template.opsForHash().delete(key, "icon"); template.opsForHash().delete(key, "url"); template.opsForHash().delete(key, "parent_id"); key = "menuid_"+"1000103"; template.opsForHash().delete(key, "id"); template.opsForHash().delete(key, "name"); template.opsForHash().delete(key, "icon"); template.opsForHash().delete(key, "url"); template.opsForHash().delete(key, "parent_id"); key = "menuid_"+"1000200"; template.opsForHash().delete(key, "id"); template.opsForHash().delete(key, "name"); template.opsForHash().delete(key, "icon"); template.opsForHash().delete(key, "url"); template.opsForHash().delete(key, "parent_id"); key = "menuid_"+"1000201"; template.opsForHash().delete(key, "id"); template.opsForHash().delete(key, "name"); template.opsForHash().delete(key, "icon"); template.opsForHash().delete(key, "url"); template.opsForHash().delete(key, "parent_id"); key = "menuid_"+"1000202"; template.opsForHash().delete(key, "id"); template.opsForHash().delete(key, "name"); template.opsForHash().delete(key, "icon"); template.opsForHash().delete(key, "url"); template.opsForHash().delete(key, "parent_id"); // Create new records key = "menuid_"+"1000100"; template.opsForHash().put(key, "id", "1000100"); template.opsForHash().put(key, "name", "Bug管理"); template.opsForHash().put(key, "icon", "icon-sys"); template.opsForHash().put(key, "url", ""); template.opsForHash().put(key, "parent_id", "0"); template.opsForSet().add("menuid", key); key = "menuid_"+"1000101"; template.opsForHash().put(key, "id", "1000101"); template.opsForHash().put(key, "name", "未修复Bug"); template.opsForHash().put(key, "icon", "icon-log"); template.opsForHash().put(key, "url", "/views/bug/buglist.jsp?action=1"); template.opsForHash().put(key, "parent_id", "1000100"); template.opsForSet().add("menuid", key); key = "menuid_"+"1000102"; template.opsForHash().put(key, "id", "1000102"); template.opsForHash().put(key, "name", "修复中Bug"); template.opsForHash().put(key, "icon", "icon-log"); template.opsForHash().put(key, "url", "/views/bug/buglist.jsp?action=2"); template.opsForHash().put(key, "parent_id", "1000100"); template.opsForSet().add("menuid", key); key = "menuid_"+"1000103"; template.opsForHash().put(key, "id", "1000103"); template.opsForHash().put(key, "name", "已修复Bug"); template.opsForHash().put(key, "icon", "icon-log"); template.opsForHash().put(key, "url", "/views/bug/buglist.jsp?action=3"); template.opsForHash().put(key, "parent_id", "1000100"); template.opsForSet().add("menuid", key); key = "menuid_"+"1000200"; template.opsForHash().put(key, "id", "1000200"); template.opsForHash().put(key, "name", "项目成员列表"); template.opsForHash().put(key, "icon", "icon-sys"); template.opsForHash().put(key, "url", ""); template.opsForHash().put(key, "parent_id", "0"); template.opsForSet().add("menuid", key); key = "menuid_"+"1000201"; template.opsForHash().put(key, "id", "1000201"); template.opsForHash().put(key, "name", "正式员工"); template.opsForHash().put(key, "icon", "icon-sys"); template.opsForHash().put(key, "url", "/views/user/userlist.jsp?cat=1"); template.opsForHash().put(key, "parent_id", "1000200"); template.opsForSet().add("menuid", key); key = "menuid_"+"1000202"; template.opsForHash().put(key, "id", "1000202"); template.opsForHash().put(key, "name", "实习生"); template.opsForHash().put(key, "icon", "icon-sys"); template.opsForHash().put(key, "url", "/views/user/userlist.jsp?cat=2"); template.opsForHash().put(key, "parent_id", "1000200"); template.opsForSet().add("menuid", key); key = "menuid_"+"1000300"; template.opsForHash().put(key, "id", "1000300"); template.opsForHash().put(key, "name", "WiKi图片列表"); template.opsForHash().put(key, "icon", "icon-sys"); template.opsForHash().put(key, "url", ""); template.opsForHash().put(key, "parent_id", "0"); template.opsForSet().add("menuid", key); key = "menuid_"+"1000301"; template.opsForHash().put(key, "id", "1000301"); template.opsForHash().put(key, "name", "查询列表"); template.opsForHash().put(key, "icon", "icon-sys"); template.opsForHash().put(key, "url", "/views/imageabout/listurllist.jsp"); template.opsForHash().put(key, "parent_id", "1000300"); template.opsForSet().add("menuid", key); } public static void main(String[] args) { ApplicationContext app = new ClassPathXmlApplicationContext("applicationContext.xml"); InitRedisService initService = (InitRedisService) app.getBean("initService"); initService.init(); System.out.println("bbb"); } }
4c7d8febe828930516a99e9d9505ac79b2b18f20
dbb8f8642ca95a2e513c9afae27c7ee18b3ab7d8
/anchor-annotation-io/src/main/java/org/anchoranalysis/annotation/io/SimpleAnnotationDeleter.java
de6a5ece565af3bd74c3285bc38c4743000d7b16
[ "MIT" ]
permissive
anchoranalysis/anchor
19c2a40954515e93da83ddfc99b0ff4a95dc2199
b3b589e0d76f51b90589893cfc8dfbb5d7753bc9
refs/heads/master
2023-07-19T17:38:19.940164
2023-07-18T08:33:10
2023-07-18T08:33:10
240,029,306
3
0
MIT
2023-07-18T08:33:11
2020-02-12T14:12:28
Java
UTF-8
Java
false
false
1,680
java
/*- * #%L * anchor-annotation-io * %% * Copyright (C) 2010 - 2020 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche * %% * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * #L% */ package org.anchoranalysis.annotation.io; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; /** * Deletes any annotation when it is represented by a single file. * * <p>This file should refer to this annotation alone, exclusively. */ public class SimpleAnnotationDeleter implements AnnotationDeleter { @Override public void delete(Path path) throws IOException { Files.deleteIfExists(path); } }
a2ee5d2aa65adac9fc0537b04d83835ee9b7b5cf
4b7ae983085154612a52984d011440728a6cb28d
/jt-dubbo-search/src/main/java/com/jt/search/service/SearchServiceImpl.java
9e78b73cadbafe0c363c11490b5cfcf19f291592
[]
no_license
WGUOJ/GitRepository
b08754c3fa95ed63dd046c1e68ee4d1559e27785
bd7c86477a55184f90809a8dfe4dfece4cccafee
refs/heads/master
2020-04-10T04:33:03.770462
2018-12-12T11:26:07
2018-12-12T11:26:07
160,801,516
0
0
null
null
null
null
UTF-8
Java
false
false
891
java
package com.jt.search.service; import java.util.List; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.impl.HttpSolrClient; import org.apache.solr.client.solrj.response.QueryResponse; import org.springframework.beans.factory.annotation.Autowired; import com.jt.search.pojo.Item; public class SearchServiceImpl implements SearchService { @Autowired HttpSolrClient httpSolrClient; @Override public List<Item> findItemByKey(String key) { try { SolrQuery query=new SolrQuery(key); //如mysql :limit start,rows query.setStart(0);//从第0行开始读取数据 query.setRows(20);//取20行 QueryResponse response=httpSolrClient.query(query); List<Item> itemList = response.getBeans(Item.class); return itemList; } catch (Exception e) { e.printStackTrace(); } return null; } }
0a298122351216b7f74fb9e90e8cc6d7282ff54d
c9a6ac0db06a141bc92097f5be75febedf4b48b7
/src/concurrencia/ProyectoFinalV1.java
044d2ddfd0a081fe075e266f90b5d16c559d4fbc
[]
no_license
marcosbfmv/lenguajes-marcosrc
992118b4a3cec13d80788cc770db88f1ad563ca3
ae4f7bea2f4ae59f342f64d3c7900295e7921cc6
refs/heads/master
2021-01-20T21:59:09.786471
2015-07-31T00:51:13
2015-07-31T00:51:13
35,848,209
0
0
null
null
null
null
UTF-8
Java
false
false
5,901
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 concurrencia; import java.io.File; import javax.swing.JFileChooser; /** * * @author T-107 */ public class ProyectoFinalV1 extends javax.swing.JFrame { /** * Creates new form ProyectoFinalV1 */ public ProyectoFinalV1() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jLabel2 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setIcon(new javax.swing.ImageIcon("C:\\Users\\T101\\Documents\\NetBeansProjects\\lenguajes-marcosrc\\src\\concurrencia\\Imagen1.png")); // NOI18N jButton1.setText("Selecciona una imagen"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(46, 46, 46) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(167, 167, 167) .addComponent(jButton1) .addContainerGap(222, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 361, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(28, 28, 28)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(30, 30, 30) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(73, 73, 73) .addComponent(jButton1))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 57, Short.MAX_VALUE) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(158, 158, 158)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: JFileChooser selector=new JFileChooser(); selector.showOpenDialog(this); File archivo=selector.getSelectedFile(); //jLabel1.setText(archivo.getAbsolutePath()); jLabel2.setText(archivo.getAbsolutePath()); }//GEN-LAST:event_jButton1ActionPerformed /** * @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(ProyectoFinalV1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(ProyectoFinalV1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(ProyectoFinalV1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(ProyectoFinalV1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new ProyectoFinalV1().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; // End of variables declaration//GEN-END:variables }
[ "T-107@PC250" ]
T-107@PC250
3819e45f1e5f259fe33c1ab547d72fb7efe101a5
4f6e6e9790efbdc9110b27683283d89e60bb5f24
/BookList.java
e2dc8b32666656445c434447d611371505cde9b2
[]
no_license
Zhangxindong8/package_bookmanager
b4eef44d6e8476b5bda89362080eafce59467d44
92f12d5ceb9a4c72e45edfa215d3cd6c18996c12
refs/heads/master
2020-08-23T07:14:40.507252
2019-10-21T13:00:09
2019-10-21T13:00:09
216,568,315
0
0
null
null
null
null
UTF-8
Java
false
false
825
java
package package_bookmanager.book; public class BookList { private Book[] books = new Book[100]; private int size; public BookList() { books[0] = new Book("金瓶梅", "001", "兰陵笑笑生", 100, "古典名著", false); books[1] = new Book("水浒传", "002", "施耐庵", 100, "古典名著", false); books[2] = new Book("西游记", "003", "吴承恩", 100, "古典名著", false); size = 3; } public int getSize() { return size; } public void setSize(int size) { this.size = size; } public Book getBook(int index) { return books[index]; } public void setBook(int index, Book book) { books[index] = book; } }
008fd217752ca6e1f9fd227b9ef2c24366897d48
1b6ecad3272337928f5819bfc8683eeee1f19d89
/branches/ehcache-1.5.0/core/src/main/java/net/sf/ehcache/store/LruMemoryStore.java
e30aff49b199275e74c3428e0ece9183461924b6
[ "Apache-2.0" ]
permissive
MatthewRBruce/ehcache
77540643da5ca20b6fd5638221f4410a1baefe02
4365fc6cc87516344e95688c368d6a3d2cebbe5a
refs/heads/master
2020-12-27T18:55:00.785157
2015-01-21T07:11:38
2015-01-21T07:11:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,110
java
/** * Copyright 2003-2007 Luck Consulting Pty Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.sf.ehcache.store; import net.sf.ehcache.CacheException; import net.sf.ehcache.Ehcache; import net.sf.ehcache.Element; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.Map; /** * An implementation of a LruMemoryStore. * <p/> * This uses {@link java.util.LinkedHashMap} as its backing map. It uses the {@link java.util.LinkedHashMap} LRU * feature. LRU for this implementation means least recently accessed. * * @author <a href="mailto:[email protected]">Greg Luck</a> * @version $Id$ */ public class LruMemoryStore extends MemoryStore { private static final Log LOG = LogFactory.getLog(LruMemoryStore.class.getName()); /** * Constructor for the LruMemoryStore object * The backing {@link java.util.LinkedHashMap} is created with LRU by access order. */ public LruMemoryStore(Ehcache cache, Store diskStore) { super(cache, diskStore); try { map = loadMapInstance(); } catch (CacheException e) { LOG.error(cache.getName() + "Cache: Cannot start LruMemoryStore. Initial cause was " + e.getMessage(), e); } } /** * Tries to load a {@link java.util.LinkedHashMap} (JDK1.4) and then * tries to load an {@link org.apache.commons.collections.LRUMap}. * <p/> * This way applications running JDK1.4 do not have a dependency * on Apache commons-collections. * * @return a Map, being either {@link java.util.LinkedHashMap} or */ private Map loadMapInstance() throws CacheException { //First try to load java.util.LinkedHashMap, which is preferred, but only if not overriden if (System.getProperty("net.sf.ehcache.useLRUMap") == null) { try { Class.forName("java.util.LinkedHashMap"); Map candidateMap = new SpoolingLinkedHashMap(); if (LOG.isDebugEnabled()) { LOG.debug(cache.getName() + " Cache: Using SpoolingLinkedHashMap implementation"); } return candidateMap; } catch (Exception e) { if (LOG.isDebugEnabled()) { LOG.debug(cache.getName() + " Cache: Cannot find java.util.LinkedHashMap"); } } } //Secondly, try and load org.apache.commons.collections.LRUMap try { Class.forName("org.apache.commons.collections.LRUMap"); Map candidateMap = new SpoolingLRUMap(); if (LOG.isDebugEnabled()) { LOG.debug(cache.getName() + " Cache: Using SpoolingLRUMap implementation"); } return candidateMap; } catch (Exception e) { //Give up throw new CacheException(cache.getName() + "Cache: Cannot find org.apache.commons.collections.LRUMap."); } } /** * An LRU Map implementation based on Apache Commons LRUMap. * <p/> * This is used if {@link java.util.LinkedHashMap} is not found in the classpath. * LinkedHashMap is part of JDK */ public final class SpoolingLRUMap extends org.apache.commons.collections.LRUMap { /** * Constructor. * The maximum size is set to {@link Ehcache#getMaxElementsInMemory}. If the * LRUMap gets bigger than this, {@link #processRemovedLRU} is called. */ public SpoolingLRUMap() { setMaximumSize(cache.getMaxElementsInMemory()); } /** * Called after the element has been removed. * <p/> * Our choices are to do nothing or spool the element to disk. * <p/> * Note that value will be null when the memory size is set to 0. Thus a null guard is used. * * @param key * @param value */ protected final void processRemovedLRU(Object key, Object value) { //Already removed from the map at this point Element element = (Element) value; //When max size is 0 if (element == null) { return; } //check for expiry before going to the trouble of spooling if (element.isExpired()) { notifyExpiry(element); } else { evict(element); } } } /** * An extension of LinkedHashMap which overrides {@link #removeEldestEntry} * to persist cache entries to the auxiliary cache before they are removed. * <p/> * This implementation also provides LRU by access order. */ public final class SpoolingLinkedHashMap extends java.util.LinkedHashMap { private static final int INITIAL_CAPACITY = 100; private static final float GROWTH_FACTOR = .75F; /** * Default constructor. * Will create an initial capacity of 100, a loading of .75 and * LRU by access order. */ public SpoolingLinkedHashMap() { super(INITIAL_CAPACITY, GROWTH_FACTOR, true); } /** * Returns <tt>true</tt> if this map should remove its eldest entry. * This method is invoked by <tt>put</tt> and <tt>putAll</tt> after * inserting a new entry into the map. It provides the implementer * with the opportunity to remove the eldest entry each time a new one * is added. This is useful if the map represents a cache: it allows * the map to reduce memory consumption by deleting stale entries. * <p/> * Will return true if: * <ol> * <li> the element has expired * <li> the cache size is greater than the in-memory actual. * In this case we spool to disk before returning. * </ol> * * @param eldest The least recently inserted entry in the map, or if * this is an access-ordered map, the least recently accessed * entry. This is the entry that will be removed it this * method returns <tt>true</tt>. If the map was empty prior * to the <tt>put</tt> or <tt>putAll</tt> invocation resulting * in this invocation, this will be the entry that was just * inserted; in other words, if the map contains a single * entry, the eldest entry is also the newest. * @return true if the eldest entry should be removed * from the map; <tt>false</t> if it should be retained. */ protected final boolean removeEldestEntry(Map.Entry eldest) { Element element = (Element) eldest.getValue(); return removeLeastRecentlyUsedElement(element); } /** * Relies on being called from a synchronized method * * @param element * @return true if the LRU element should be removed */ private boolean removeLeastRecentlyUsedElement(Element element) throws CacheException { //check for expiry and remove before going to the trouble of spooling it if (element.isExpired()) { notifyExpiry(element); return true; } if (isFull()) { evict(element); return true; } else { return false; } } } }
[ "gregluck@b9324663-ca0f-0410-8574-be9b3887307d" ]
gregluck@b9324663-ca0f-0410-8574-be9b3887307d
ebd6d4418dc206cac6312b2a2b4863647597da5d
24643916cd1515911b7837ce81ebd17b0890cc81
/packages/apps/MTKAndroidSuiteDaemon/src/com/mediatek/android/content/DefaultInsertBatchHelper.java
f9c5d89d6002c9d21d381e1542d861fc11a20cd8
[ "Apache-2.0" ]
permissive
touxiong88/92_mediatek
3a0d61109deb2fa77f79ecb790d0d3fdd693e5fd
5e96a7bb778fd9d9b335825584664e0c8b5ff2c7
refs/heads/master
2020-05-02T10:20:49.365871
2019-04-25T09:12:56
2019-04-25T09:12:56
177,894,636
1
1
null
null
null
null
UTF-8
Java
false
false
4,854
java
/* Copyright Statement: * * This software/firmware and related documentation ("MediaTek Software") are * protected under relevant copyright laws. The information contained herein * is confidential and proprietary to MediaTek Inc. and/or its licensors. * Without the prior written permission of MediaTek inc. and/or its licensors, * any reproduction, modification, use or disclosure of MediaTek Software, * and information contained herein, in whole or in part, shall be strictly prohibited. * * MediaTek Inc. (C) 2010. All rights reserved. * * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. * * The following software/firmware and/or related documentation ("MediaTek Software") * have been modified by MediaTek Inc. All revisions are subject to any receiver's * applicable license agreements with MediaTek Inc. */ package com.mediatek.android.content; import android.content.ContentProviderResult; import com.mediatek.apst.target.util.Debugger; import com.mediatek.apst.util.entity.DatabaseRecordEntity; public abstract class DefaultInsertBatchHelper extends OperationBatchHelper { private long[] mInsertedIds; /** * @param opBatch * The ContentProviderOperationBatch used to insert batch. */ public DefaultInsertBatchHelper(final ContentProviderOperationBatch opBatch) { super(opBatch); } /** * @return the array of id for inserted rows. */ public long[] getResults() { return mInsertedIds; } /** * Override it. Provide a class name/tag for log. * * @return a class name. */ public String getName() { return "DefaultInsertBatchHelper"; }; /* * (non-Javadoc) * * @see com.mediatek.android.content.OperationBatchHelper#run(int) */ @Override public void run(final int batchSize) { mInsertedIds = new long[batchSize]; // Inserted id is DatabaseRecordEntity.ID_NULL by default, means fail for (int i = 0; i < mInsertedIds.length; i++) { mInsertedIds[i] = DatabaseRecordEntity.ID_NULL; } super.run(batchSize); } /* * (non-Javadoc) * * @see * com.mediatek.android.content.OperationBatchHelper#onOperationResult(android * .content.ContentProviderResult, int) */ @Override public void onOperationResult(final ContentProviderResult opResult, final int executedPosition) { if (null == opResult) { Debugger.logW(getName(), "onOperationResult", new Object[] { opResult, executedPosition }, "ContentProviderResult is null!"); mInsertedIds[executedPosition] = DatabaseRecordEntity.ID_NULL; } else { try { mInsertedIds[executedPosition] = Long.parseLong(opResult.uri .getLastPathSegment()); } catch (NumberFormatException e) { Debugger.logE(getName(), "onOperationResult", new Object[] { opResult, executedPosition }, null, e); mInsertedIds[executedPosition] = DatabaseRecordEntity.ID_NULL; } catch (NullPointerException e) { Debugger.logE(getName(), "onOperationResult", new Object[] { opResult, executedPosition }, null, e); mInsertedIds[executedPosition] = DatabaseRecordEntity.ID_NULL; } } } }
44eef0bc01338150afe7766920256314dc895974
ee67e165bf201756a55f3fed1d719b5e885d31e4
/app/src/main/java/com/cctv/music/cctv15/model/NewsDescription.java
35b1ea720d5e5cd119052b747b1f5405c835d8d3
[]
no_license
30962088/c15
308e3c6cbf384d8a6540e6d2b0d782f4fee34cec
2cccefc9ef3702d1431cf28a27a8ee61723d45e4
refs/heads/master
2020-12-24T15:32:20.449975
2015-10-13T16:19:00
2015-10-13T16:19:00
39,578,926
0
0
null
null
null
null
UTF-8
Java
false
false
1,473
java
package com.cctv.music.cctv15.model; import com.cctv.music.cctv15.utils.DateUtils; import java.io.Serializable; import java.util.Date; public class NewsDescription implements Serializable{ //commentcount=5 private int commentcount; //contentsdate=/Date(1431324920000)/ private String contentsdate; //contentsid=475 private int contentsid; //contentstitle=反法西斯战争胜利70周年优秀音乐电视作品展播-----放飞和平歌! private String contentstitle; //description=<p><img alt="" src="http://music.1du1du.com/cctv15/getTheImage?fileName=719629deca8743818578d51709379174.png" style="width: 300px; height: 166px;" /></p> private String description; //poemauthor= private String poemauthor; //praisecount=0 private int praisecount; //videositeurl=(null) private String videositeurl; public int getCommentcount() { return commentcount; } public Date getContentsdate() { return DateUtils.parse(contentsdate); } public int getContentsid() { return contentsid; } public String getContentstitle() { return contentstitle; } public String getDescription() { return description; } public String getPoemauthor() { return poemauthor; } public int getPraisecount() { return praisecount; } public String getVideositeurl() { return videositeurl; } }
2ae235f20bebc3e77d74fc171c3c5a7ffb4305ca
f1620e389b7e6cf2e1ec1f869bf5b8b3de57588a
/数据结构与算法初级/栈队列链表矩阵/class03/MyIsPalindromeList.java
98fd0dd2b13187c26dc657c6cb2eb88667d986fc
[]
no_license
dmcl-zju/note-of-java
920efa7f71f5f5fc397c416ac31bb196b8438337
0df1f07ae6f4f1aa94121628cb24dfc6d0cdbe76
refs/heads/master
2020-05-24T00:02:38.764587
2019-06-06T05:52:35
2019-06-06T05:52:35
187,007,750
0
0
null
null
null
null
GB18030
Java
false
false
2,924
java
package class03; import java.util.Stack; public class MyIsPalindromeList { //定义节点 public static class Node { public int value; public Node next; public Node(int data) { this.value = data; } } //方法一:读出来入栈,然后出栈和原来链表比对,一个不符合就false public static boolean isPalindrom1(Node head) { if(null == head) { return false; } Node node = head; Stack<Integer> stack = new Stack<>(); //入栈 while(head != null) { stack.push(head.value); head = head.next; } //出栈对比 head = node; while(head != null) { if(head.value!=stack.pop()) { return false; } head = head.next; } return true; } //方法二:只用N/2空间 public static boolean isPalindrom2(Node head) { Stack<Integer> stack = new Stack<>(); Node fast = head; Node slow = head; while(fast.next!=null && fast.next.next!= null) { slow = slow.next; fast = fast.next.next; } slow = slow.next; while(slow != null) { //System.out.println(slow.value); stack.push(slow.value); slow = slow.next; } slow = head; while(!stack.isEmpty()) { //System.out.println(slow.value+"--"+stack.peek()); if(slow.value != stack.pop()) { return false; } slow = slow.next; } //全都一样才是 return true; } //方法三:空间复杂度为O(1) public static boolean isPalindrom3(Node head) { boolean res = true; //先找中点 Node fast = head; Node slow = head; while(fast.next!=null && fast.next.next!=null) { fast = fast.next.next; slow = slow.next; } //对后半部分进行反转 Node pre = null; Node next = null; while(slow != null) { //System.out.println(slow.value+"------"); next = slow.next; slow.next = pre; pre = slow; slow = next; } //两边进行对比 slow = pre; while(head != null) { //System.out.println(slow.value+"------"+head.value); if(head.value != slow.value) { res = false; } head = head.next; slow = slow.next; } //先将链表恢复原来的样子,不改变数据 head = pre; pre = null; next = null; while(head != null) { next = head.next; head.next = pre; pre = head; head = next; } return res; } public static void printLinkedList(Node node) { System.out.print("Linked List: "); while (node != null) { System.out.print(node.value + " "); node = node.next; } System.out.println(); } public static void main(String[] args) { Node head = new Node(1); head.next = new Node(1); head.next.next = new Node(2); head.next.next.next = new Node(1); head.next.next.next.next = new Node(1); printLinkedList(head); System.out.println("方法一:"+isPalindrom1(head)); System.out.println("方法二:"+isPalindrom2(head)); printLinkedList(head); System.out.println("方法三:"+isPalindrom3(head)); printLinkedList(head); } }
b1e4bd2b39a8f3db5640479740b9d8414579c682
c6949bdbf61ba2855467ea7923c754142e217f64
/src/test/java/org/minperf/hem/HEM.java
d5f331542d9d09751a16d0eff3e175a8c4220db0
[ "Apache-2.0" ]
permissive
pranasblk/minperf
037ade2c871d5a11af6dd88c6eb4b713d99867bd
cc303690383fccfbeb769bdfd937b81e1e133ac1
refs/heads/master
2020-05-27T20:11:58.208792
2019-03-07T06:58:56
2019-03-07T06:58:56
188,774,588
1
0
Apache-2.0
2019-05-27T05:09:56
2019-05-27T05:09:56
null
UTF-8
Java
false
false
6,248
java
package org.minperf.hem; import java.io.File; import java.util.HashSet; import java.util.PrimitiveIterator; import org.minperf.BitCodes; import org.minperf.FunctionInfo; import org.minperf.RandomizedTest; public class HEM<T> { /** generate command line: - keys file (lines as text, or fixed number of bytes per key) - estimated (?) size -> to calculate signature size, chunk size - signature size (overrideable) - chunk size (overrideable) - number of keys to batch - option to either (a) merge duplicates (on clash), or (b) stop when finding a clash - defaults to merge? - how to do parallel key processing? only do first part, in parallel, with multiple key files - second step is: merge sort signature files (option to just do that, so 64:1 merge is possible) - also generate mphf (by streaming; chunk by chunk) - how to do parallel construction? by defining the chunk range, and merge MPHF at the end raw MPHF data format: * 64 bit: total size (number of keys) * 1 byte: number of bits per chunk (number of chunks is 2^n) * per chunk: * - 1 byte: signature hash (usually 0) * - chunk data (includes size of chunk) * - filler to full byte (so chunks can be easily concatenated) in-memory data format: * signature mask * chunk shift (chunk id = signature >>> shift) * array of evaluators * each evaluator knows the offset, and signature hash generate algorithm: * calc signature size (or use override) * calc number of chunks * read data, calc signatures, truncate to required size (truncate left part?) * sort & store signatures; one file per chunk (use uuid to allow concurrent generation) evaluation algorithm: * calc 128 bit signature * mask (to truncate, same as for generation) * shift to get chunk size target: <50 seconds for 1 billion keys page 7 50 ns / key? 24 threads 10^12 64-bit keys 3.7 bits/key 35.4 hours and required 637 GB RAM bit arrays ( 459 GB) the memory required for loading 20 billion keys in memory ( 178 GB). keys were loaded in memory when |Fi|  2% of total keys (i.e. when remaining number of keys to index was lower than 20 billion). The final MPHF occupied 3.71 bits per key. Query time (ns) around 216 ns ? xor-shift based hash function Retrieval and Perfect Hashing Using Fingerprinting Xorshift128* 2124 min 127440 sec 127440000000000 ns 1000000000000 keys 127.44 ns / key 24 threads, 1 thread might be 3058.56 ns / key 1000000000 35000000000 ns 35 ns / key, 8 threads; 280 ns / key 229000000000 ns, 1 thread; 229 ns / key */ public static void main(String... args) throws InterruptedException { // 3.7 bits/key // 250 ns / key with 1 thread // System.out.println(250 * 1000 * 1000000L / 1_000_000_000); for (int i = 0; i < 10; i++) { HashSet<Long> set = RandomizedTest.createSet(1000000, 1); for (int leafSize = 2; leafSize < 8; leafSize++) { for (int averageBucketSize = 4; averageBucketSize < 32; averageBucketSize *= 2) { FunctionInfo info = RandomizedTest.test(leafSize, averageBucketSize, set.size(), false, 1, true); System.out.println(info); } } } // test(args[0]); // test(args[1]); } private static void test(String fileName) throws InterruptedException { // dd if=/dev/urandom of=~/temp/hash/key64.bin bs=1048576 count=1024 // (13'017'359 bytes/sec) // int shift = 36; int shift; // dd if=/dev/urandom of=~/temp/hash/key64b.bin bs=1048576 count=4096 boolean varLong = false; int count = (int) (new File(fileName).length() / 8); double mean = Long.MAX_VALUE / count * 2; shift = BitCodes.calcBestGolombRiceShiftFromMean(mean); long[] data = new long[count]; long[] d2 = new long[count]; String diffsFileName = fileName + ".diffs"; for (int test = 0; test < 2; test++) { varLong ^= true; long time; System.out.println(""); System.out.println("test #" + test + " " + (varLong ? "varlong" : "golomb")); Thread.sleep(1000); time = System.nanoTime(); PrimitiveIterator.OfLong it = KeyReader.readSignaturesFromTextFile64(fileName); for (int i = 0; it.hasNext(); i++) { data[i] = it.nextLong(); } time = System.nanoTime() - time; System.out.println("read time: " + time / count + " ns/key, count=" + count); Thread.sleep(1000); time = System.nanoTime(); Sort.parallelSortUnsigned(data); // Sort.sortUnsignedSimple(data); time = System.nanoTime() - time; System.out.println("sort time: " + time / count + " ns/key"); SortedSignatures.FileWriter w = new SortedSignatures.FileWriter(diffsFileName); Thread.sleep(1000); time = System.nanoTime(); if (varLong) { w.writeDiffsVarLong(data); } else { w.writeDiffsGolombRice(data, shift); } w.close(); time = System.nanoTime() - time; System.out.println("diff write time: " + time / count + " ns/key"); System.out.println(" diff file size: " + new File(diffsFileName).length() / (double) count + " bytes/key"); Thread.sleep(1000); time = System.nanoTime(); SortedSignatures.FileIterator r = new SortedSignatures.FileIterator(diffsFileName); PrimitiveIterator.OfLong resultIterator; if (varLong) { resultIterator = r.iteratorVarLong(count); } else { resultIterator = r.iteratorGolombRice(count, shift); } for (int i = 0; i < count; i++) { d2[i] = resultIterator.nextLong(); } time = System.nanoTime() - time; System.out.println("diff read time: " + time / count + " ns/key"); for (int i = 0; i < d2.length; i++) { if (data[i] != d2[i]) { throw new AssertionError("" + i + " " + data[i] + "<>" + d2[i]); } } } } }
1f078a69d9d739550ded89ecb4f4d9264af0f1f5
0d844a9e982b1d63b47fee34d75019b6788bf69e
/src/ExactTarget.ETPushSdk.WinPhone/Util/JsonType.java
0255516165e93b7a53be7a9fa75b4ad5d862702f
[]
no_license
degdigital/Xamarin-ExactTarget
975e577fddfbd7fc5268c9fa69b01b4dbbcbb555
1d7f5e9be760d43b67696032b19742be6004fb9e
HEAD
2016-08-08T11:05:15.312886
2014-11-18T17:03:23
2014-11-18T17:03:23
26,359,899
0
5
null
null
null
null
UTF-8
Java
false
false
2,564
java
/* 1: */ package com.exacttarget.etpushsdk.util; /* 2: */ /* 3: */ import com.j256.ormlite.field.FieldType; /* 4: */ import com.j256.ormlite.field.SqlType; /* 5: */ import com.j256.ormlite.field.types.StringType; /* 6: */ import java.lang.reflect.Field; /* 7: */ import java.sql.SQLException; /* 8: */ import java.util.Collection; /* 9: */ /* 10: */ public class JsonType /* 11: */ extends StringType /* 12: */ { /* 13: */ private static JsonType singleton; /* 14: */ /* 15: */ public JsonType() /* 16: */ { /* 17:16 */ super(SqlType.STRING, new Class[] { String.class }); /* 18: */ } /* 19: */ /* 20: */ public static JsonType getSingleton() /* 21: */ { /* 22:19 */ if (singleton == null) { /* 23:20 */ singleton = new JsonType(); /* 24: */ } /* 25:22 */ return singleton; /* 26: */ } /* 27: */ /* 28: */ public boolean isValidForField(Field field) /* 29: */ { /* 30:26 */ return Collection.class.isAssignableFrom(field.getType()); /* 31: */ } /* 32: */ /* 33: */ public Object javaToSqlArg(FieldType fieldType, Object obj) /* 34: */ throws SQLException /* 35: */ { /* 36: */ ; /* 37:31 */ if ("java.lang.String".equals(obj.getClass().getName())) /* 38: */ { /* 39:33 */ fieldType = super.javaToSqlArg(fieldType, obj); /* 40: */ } /* 41: */ else /* 42: */ { /* 43:36 */ String json = JSONUtil.objectToJson(obj); /* 44:37 */ sqlArg = super.javaToSqlArg(sqlArg, json); /* 45: */ } /* 46:40 */ return sqlArg; /* 47: */ } /* 48: */ /* 49: */ public Object sqlArgToJava(FieldType fieldType, Object sqlArg, int columnPos) /* 50: */ throws SQLException /* 51: */ { /* 52:46 */ return JSONUtil.jsonToObject(fieldType = (String)super.sqlArgToJava(fieldType, sqlArg, columnPos), Object.class); /* 53: */ } /* 54: */ /* 55: */ public Object resultStringToJava(FieldType fieldType, String stringValue, int columnPos) /* 56: */ throws SQLException /* 57: */ { /* 58:52 */ return JSONUtil.jsonToObject(fieldType = (String)super.resultStringToJava(fieldType, stringValue, columnPos), Object.class); /* 59: */ } /* 60: */ } /* Location: C:\Users\Moreys\Downloads\MobilePushSDK-Android-3.3.0\MobilePushSDK-Android-3.3.0\libs\etsdk-3.3.0.jar * Qualified Name: com.exacttarget.etpushsdk.util.JsonType * JD-Core Version: 0.7.0.1 */
49e8a31ee7a6e6887c4710e4f5b6fe80e2e1a938
f9b99679aa3e38f474270db8d55bf3a504e9f77b
/fourth.java
ebdff34bbfe9e6e2db27e6dba2be1859d2f8413f
[]
no_license
erIamshivani/Calculator-Android-Project
16ecaebfee5ca462a025f9bbf29ced0a01bc474f
a26ffdd3e4b5608d49afc8fa7612f1eccbf94ed3
refs/heads/master
2021-07-09T09:45:45.340073
2017-10-08T07:35:59
2017-10-08T07:35:59
105,913,168
0
0
null
null
null
null
UTF-8
Java
false
false
1,191
java
package com.example.shivanii.assign1; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class fourth extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fourth); } public void div(View v) { EditText e1=(EditText)findViewById(R.id.num1); EditText e2=(EditText)findViewById(R.id.num2); int n1,n2; n1=Integer.parseInt(e1.getText().toString()); n2=Integer.parseInt(e2.getText().toString()); int sum=n1/n2; TextView result=(TextView) findViewById(R.id.res1); result.setText(Integer.toString(sum)); } public void next(View v) { Toast.makeText(this,"You are at the end of app",Toast.LENGTH_SHORT).show(); } public void prev(View v) { Intent intent=new Intent(this,third.class); startActivity(intent); } }
a43d7fb6e207923c09b410621c483a130203ba5a
0af8b92686a58eb0b64e319b22411432aca7a8f3
/large-multiproject/project57/src/test/java/org/gradle/test/performance57_5/Test57_414.java
408c2b663a0b5bd5ff67ce272e28953477668614
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
292
java
package org.gradle.test.performance57_5; import static org.junit.Assert.*; public class Test57_414 { private final Production57_414 production = new Production57_414("value"); @org.junit.Test public void test() { assertEquals(production.getProperty(), "value"); } }
b408a5e82fa5fe248b7edfa2bc224a647abd260e
410be58271d6dfb63ac2ea19854cb3aaa8a39eff
/src\main\java/com/mn/dao/AdminDao.java
96981789b622aa36bfe5433f6cb39dce2ab40453
[]
no_license
seungmi9191/Project_magazinenote
76356b08116345111dd4c74fc3ed9b364e7e5f40
fffdcac527493b7ce96f20a95df38532f80d00b0
refs/heads/master
2020-03-20T11:01:36.370836
2018-07-02T09:38:56
2018-07-02T09:38:56
135,629,679
0
0
null
null
null
null
UTF-8
Java
false
false
584
java
package com.mn.dao; import java.util.List; import org.apache.ibatis.session.SqlSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.mn.vo.UserVo; @Repository public class AdminDao { @Autowired private SqlSession sqlSession; //신청자 리스트 불러오기 public List<UserVo> selectList() { return sqlSession.selectList("admin.selectByApplyList"); } //지원 상세페이지 보기 public UserVo selectId(String id) { return sqlSession.selectOne("admin.selectView", id); } }
99c72b7e6200816df71a3c4c54caf989c82afc04
8f0cfe5d43f48c0c73c9f26df7c07e5aa6005c93
/app/src/main/java/com/upyun/shortvideo/views/CompoundDrawableTextView.java
e86f3b6198478eb1ccfeae871a7e025700240c26
[]
no_license
mvpleung/Android-short-video
fe167948e90a44e3bb8df5062e6472ceaf181de7
d2e38729131c0108bf90f38a46352304605379c4
refs/heads/master
2020-04-06T08:27:51.198082
2018-10-22T08:42:00
2018-10-22T08:42:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,641
java
/** * TuSDKVideoDemo * CompoundDrawableTextView.java * * @author LiuHang * @Date: June 1, 2017 7:28:12 PM * @Copyright: (c) 2017 tusdk.com. All rights reserved. * */ package com.upyun.shortvideo.views; import android.annotation.SuppressLint; import android.content.Context; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.widget.TextView; import com.upyun.shortvideo.R; /** * 自定义TextView,可以设置CompoundDrawable大小 * @author LiuHang */ public class CompoundDrawableTextView extends TextView { /** 属性集合 */ private TypedArray mTypedArray; /** 图片高度 */ private float mDrawableTopHeight; /** 图片宽度 */ private float mDrawableTopWidth; /** 顶部图片 */ private Drawable mDrawableTop; public CompoundDrawableTextView(Context context) { super(context); } @SuppressLint("Recycle") public CompoundDrawableTextView(Context context, AttributeSet attrs) { super(context, attrs); mTypedArray=context.obtainStyledAttributes(attrs, R.styleable.CompoundDrawableTextView); mDrawableTopHeight=mTypedArray.getDimension(R.styleable.CompoundDrawableTextView_drawableTopHeight, 10); mDrawableTopWidth=mTypedArray.getDimension(R.styleable.CompoundDrawableTextView_drawableTopWidth, 10); mDrawableTop=mTypedArray.getDrawable(R.styleable.CompoundDrawableTextView_drawableTop); // 自定义设置图片的宽高 if(mDrawableTop != null) mDrawableTop.setBounds(0, 0, (int)mDrawableTopWidth, (int)mDrawableTopHeight); setCompoundDrawables(null, mDrawableTop, null, null); } }
e74f7bbcf6afcd7a500b4c7960c2f1a8c7cb2355
05ad652db24b130e2b6bc9fa42655d1c4b390e20
/src/main/java/pages/RegisterPageFactory.java
a8ba92811c55dbade994556001e6e78572e445e6
[]
no_license
evasilioni/CaloriesCalcAutomation
1f9b3f4308984ed4e270c29ca1bcf2d73ed62936
c3dc3a5b85bd97e65f2a5fc03566ac426a77c72f
refs/heads/master
2022-11-27T19:03:53.200169
2019-06-24T12:38:51
2019-06-24T12:38:51
163,897,776
0
0
null
2022-11-16T11:32:31
2019-01-02T22:53:05
Java
UTF-8
Java
false
false
1,591
java
package pages; 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 RegisterPageFactory{ //Define web elements at class level WebDriver driver; //Definition of web elements at class level @FindBy(id ="name-input") WebElement userNameInputField; @FindBy(id="password-confirmation-input") WebElement passwordConfirmationInputField; @FindBy(tagName="h3") WebElement headerRegistration; @FindBy(xpath="//button[contains(text(),'Register')]") WebElement registerButton; @FindBy(xpath="//input[@value='Join']") WebElement joinButton; //Steps public String getHeaderRegistration() { return headerRegistration.getText(); } public void setUserNameInputField(String userName) { userNameInputField.sendKeys(userName); } public void setPasswordConfirmationInputField(String passwordConfirmation) { passwordConfirmationInputField.sendKeys(passwordConfirmation); } public void join() { joinButton.click(); } public void register(){ registerButton.click(); } //Contructor initiallizes the state of the driver public RegisterPageFactory(WebDriver driver) { this.driver = driver; // Wait 20 Second To Find Element If Element Is Not Present PageFactory.initElements(new AjaxElementLocatorFactory(driver, 20), this); } }
ebcd62d1ed163c2b3a72c23cd9cadcc9693250b1
bbec45d4b304592524e9a4c8047561eb575cc1f4
/plugins/org.polymap.core/src/org/polymap/core/workbench/ActionBar.java
94b43c366f0abea332ed24f9b9b15ab64b3f4e56
[]
no_license
Polymap3/polymap3-core
793d7debecd67dd8d56d027a70a07f793bc63dd4
b83b3802db7b2453220d97597d8042af32eb202f
refs/heads/master
2020-12-24T05:18:40.220204
2017-08-30T13:25:36
2017-08-30T13:25:36
31,892,676
0
3
null
2016-01-14T13:48:55
2015-03-09T10:44:37
Java
UTF-8
Java
false
false
1,904
java
package org.polymap.core.workbench; import java.util.Iterator; import java.util.List; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.rwt.graphics.Graphics; import org.eclipse.jface.action.Action; /** * * * @author <a href="http://www.polymap.de">Falko Braeutigam</a> * <li>24.06.2009: created</li> * @version $Revision: $ */ public class ActionBar { static void create( final List actions, final Composite actionBar ) { Control[] children = actionBar.getChildren(); for (int i = 0; i < children.length; i++) { children[i].dispose(); } actionBar.setLayout( new RowLayout() ); Iterator iterator = actions.iterator(); while (iterator.hasNext()) { Object next = iterator.next(); if (next instanceof Action) { final Action action = (Action)next; new ActionBarButton( action, actionBar ); Label separator = new Label( actionBar, SWT.NONE ); separator.setText( " " ); Label separator2 = new Label( actionBar, SWT.NONE ); separator2.setText( " " ); Label separator3 = new Label( actionBar, SWT.NONE ); separator3.setText( " " ); } else { Label separator = new Label( actionBar, SWT.SEPARATOR | SWT.VERTICAL ); separator.setForeground( Graphics.getColor( 255, 255, 255 ) ); Label separator2 = new Label( actionBar, SWT.NONE ); separator2.setText( " " ); Label separator3 = new Label( actionBar, SWT.NONE ); separator3.setText( " " ); } } actionBar.layout(); } }